diff --git a/.github/workflows/star-check.yml b/.github/workflows/star-check.yml deleted file mode 100644 index 24d6c17..0000000 --- a/.github/workflows/star-check.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Check if PR author has starred required repositories -on: - pull_request: - types: [opened, synchronize, reopened] -jobs: - check-starred: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Get PR author username and repo info - id: get-info - run: | - echo "username=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV - echo "current_repo=${{ github.event.repository.name }}" >> $GITHUB_ENV - echo "current_owner=${{ github.repository_owner }}" >> $GITHUB_ENV - - name: Pull github provider - uses: stackql/stackql-exec@v2.2.1 - with: - is_command: 'true' - query: "REGISTRY PULL github;" - - name: Run stackql query - id: check-star - uses: stackql/stackql-assert@v2.2.1 - with: - test_query: | - SELECT repo, count(*) as has_starred - FROM github.activity.repo_stargazers - WHERE owner = '${{ env.current_owner }}' and repo IN ('stackql','${{ env.current_repo }}') - AND login = '${{ env.username }}' - GROUP BY repo; - expected_results_str: '[{"has_starred":"1","repo":"stackql"},{"has_starred":"1","repo":"${{ env.current_repo }}"}]' - continue-on-error: true - - name: Check if starred - if: always() # Ensures this runs regardless of check-star outcome - run: | - if [ "${{ steps.check-star.outcome }}" = "success" ]; then - echo "::notice::Thanks for your support!" - else - echo "::error::It seems you haven't starred the required repositories. Please star the following repos before proceeding: https://github.com/${{ env.current_owner }}/${{ env.current_repo }} (this repo) and https://github.com/stackql/stackql (our core repo)" - exit 1 - fi \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..0186dc2 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,94 @@ +## Project + +This repository builds and documents the **next-generation `openai` provider** for StackQL, replacing the v1 `openai` provider **in this same repository, in situ** - SQL-based query and provisioning operations against the OpenAI platform surface available to standard API keys: models, files (metadata), fine-tuning (jobs, events, checkpoints), batches, vector stores (and their files and file batches), assistants/threads/runs (deprecation-labelled, see below), evals, uploads metadata, and container/session metadata where cleanly exposed. + +**This is a replacement, not an increment** - the snowflake refresh is the direct precedent: the new provider is generated on the current toolchain from the vendor's published spec, compared resource-by-resource against the v1 provider already in this repo, and ships with a Breaking Changes section documenting every rename and removal. v1 generation artifacts are archived in-repo (`legacy/`), never silently deleted, and the v1 toolchain is retired. + +**Scope boundaries, recorded so they are never relitigated**: +- The **organization/admin surface** (`/v1/organization/...` - usage, costs, projects, users, invites, audit logs, admin keys) uses a separate admin key class and is the sibling provider `openai_admin`, built in its own repository from the same pinned spec source. Nothing under `/organization` maps here. +- **Inference invocation** (chat/completions, responses, embeddings, images, audio, moderations, realtime) is the data plane, out of scope per the standing model-provider posture (the anthropic/openrouter treatment). **Batches are in scope** - an async job control surface, not an invocation. +- Binary transfer (file content, upload parts) is skipped per the standing exclusions; file and upload *metadata* is in scope. + +Build pipeline and repository layout follow the established stackql provider-dev conventions (`@stackql/provider-utils`, the split/normalize/generate stages, service-level `x-stackQL-config`). Cross-provider findings are reused, not re-derived - the replacement discipline (predecessor inventory, dispositions, generated Breaking Changes), the model-vendor scope posture, deprecation-as-build-input, the REPLACE-vs-UPDATE warning. + +## Spec source + +OpenAI publishes its OpenAPI specification (the artifact its SDKs are generated from) via the `openai/openai-openapi` repository. Phase 1 records the canonical current artifact (repo ref or served location); `bin/fetch-spec.sh` downloads, validates with `@apidevtools/swagger-parser`, and pins (source, ref, date, hash) in `provider-dev/config/spec_pin.json`. The spec covers the full platform including the organization subtree - `clean_specs.mjs` filters `/organization` paths out of this build deterministically (they belong to `openai_admin`), alongside the data-plane and binary exclusions, all reason-coded. Refreshes are reviewed diffs, never silent regenerations. + +**Deprecation is a build input** (the nvidia/oci discipline): the Assistants family carries the vendor's migration-to-Responses deprecation. Assistants/threads/runs map with the vendor's deprecation labelling carried into the docs; the drift CI watches the timeline; resources retire when the vendor retires them, with the policy recorded. + +## Design principles + +- **Fixed server, bearer auth, optional org/project headers** - `https://api.openai.com/v1`; `Authorization: Bearer` with `OPENAI_API_KEY`. Optional `OpenAI-Organization` / `OpenAI-Project` headers exposed via one mechanism decided in phase 1. +- **The OpenAI list envelope and derived cursor** - lists wrap as `{"object": "list", "data": [...], "first_id": ..., "last_id": ..., "has_more": bool}` with `limit`/`after`/`order`. `objectKey` `$.data`; the continuation token is *derived* - `after` takes the previous page's `last_id` (no dedicated next-token field). Whether any-sdk pagination config expresses `requestToken: after` fed from `responseToken: $.last_id` (terminate on absent / `has_more` false) is the phase 1 pagination finding; per-resource honesty for deviations. +- **Async jobs are the core surface** - fine-tuning jobs and batches: `INSERT` creates, `SELECT` polls, `EXEC` cancels; events/checkpoints are child `SELECT` resources. +- **Deep configs lower honestly** - hyperparameter/method blocks, chunking strategies, tool configs: columns plus `json_extract`. +- **OpenAI updates are POSTs with partial bodies** - confirm per resource, label `UPDATE` (keycloak warning applies to full-representation exceptions). + +## Replacement mechanics (in-situ refresh discipline) + +The v1 provider lives in this repository. The refresh proceeds alongside it, then replaces it: + +- `inventory_predecessor.mjs` reads the **v1 provider artifacts in this repo** (the existing generated service docs, wherever the repo currently keeps them) and writes `provider-dev/config/predecessor_inventory.csv`: every v1 service, resource, method, verb. +- Every predecessor entry is dispositioned: **carried** (same name), **renamed** (old -> new recorded), **retired** (data-plane, org-subtree, or defunct - reason-coded). +- README.md carries a **Breaking Changes** section *generated* from the disposition table (the snowflake refresh format) - never hand-written. +- Cutover: v1 generation artifacts and v1-era scripts move to `legacy/` in one commit (history preserved); the new `provider-dev/` becomes the only pipeline; the registry publish replaces the provider version per the registry flow; the docs site notes the generation change once. +- Acceptance: the v1 provider's documented example queries re-run against the new provider - each passes unchanged or is covered by a Breaking Changes entry. No third state. + +## Toolchain rules + +Latest `@stackql/provider-utils` (check npm first); Node >= 20, `type: module`; CLI entry points wrapped as npm scripts invoked through `node`; a local `stackql` binary for testing. + +## Repository layout (target state after cutover) + +``` +legacy/ # archived v1 artifacts and scripts (one commit) +provider-dev/ + downloaded/ # pinned spec snapshot + source/ # cleaned + filtered + split per-service specs + config/ # spec pin, predecessor inventory + dispositions, service names, all_services.csv + openapi/src/openai/ # generated provider output (replaces v1 output) + scripts/ # clean_specs.mjs (incl org filter), inventory_predecessor.mjs, map_operations.mjs, pre_normalize.mjs, post_process.mjs +bin/ # npm wrappers +tests/ # integration mock + fixtures + smoke_test.py +website/ # existing Docusaurus site retained, regenerated +CLAUDE.md +README.md # runnable-example style, incl Breaking Changes and the openai_admin sibling note +``` + +## Build pipeline + +Deterministic and re-runnable throughout; validate-and-fail-without-writing; manual decisions as rules in scripts, never hand-edits. + +**0. Fetch, pin, filter, clean; inventory the predecessor** - per the spec-source and replacement sections. + +**1. Split** - `npm run split --provider-name openai`. Services (decided by the phase 1 inventory, recorded in `service_names.json`; tag-discriminated - the untagged Containers family is tag-stamped deterministically in `clean_specs.mjs`): `models`, `files`, `fine_tuning` (jobs, events, checkpoints, checkpoint_permissions), `batches`, `vector_stores` (vector_stores, files, file_batches, file_batch_files), `assistants` (deprecation-labelled family: assistants, threads, messages, runs, run_steps), `evals` (evals, runs, run_output_items), `uploads` (metadata), `containers` (containers, files), `conversations` (conversations, items - the Responses-family state surface, added by the phase 1 decision), `skills` (skills, versions - added by the phase 1 decision; content endpoints excluded as binary). + +**2. Mappings** - GET list -> `SELECT .list` (`$.data`, derived cursor); GET single -> `SELECT .get`; POST create -> `INSERT`; POST partial update -> `UPDATE` (confirmed per resource); DELETE -> `DELETE`; cancel -> `EXEC`; inference/org-subtree/binary -> skipped, reason-coded. Plural snake_case names. Validation includes disposition-table consistency (no v1 resource undispositioned), unique signatures, complete disposition coverage. + +**3. Normalize** - `$.data` unwrapping; deep blocks to `json_extract`. + +**4. Generate** - servers `https://api.openai.com/v1`; auth bearer `OPENAI_API_KEY`; cursor config per the finding; org/project header mechanism per the decision; post-process for the rest. + +**5. Test** - the four test layers: offline SHOW/DESCRIBE; meta-routes; integration mock asserting `$.data`, the derived-cursor traversal (`after` = prior `last_id`, terminate `has_more: false`), a vector store lifecycle with file membership, a fine-tuning cancel `EXEC`, deprecation labels present, auth headers throughout; smokes cost-tiered - **ungated**: reads and cost-free lifecycles (file metadata round trip, vector store create/delete); **gated**: anything consuming tokens or training compute (mock-first, live only by explicit decision); `stackql-smoke-` naming, breadcrumbs swept. Never against a production project. + +**6. Cutover and publish** - the `legacy/` archive commit; registry version replacement; `registry pull openai` verification; the v1 example-query acceptance run. + +**7. Docs** - existing microsite regenerated (`openai-provider.stackql.io`). Lead: fine-tuning history and checkpoint inventory, batch status and error triage, vector store audits, file estate by purpose/age, assistants inventory with the deprecation posture - plus the `openai_admin` sibling pointer and the generation-change note once. + +**8. CI** - fetch + pin + filter + build, mock integration, meta-routes, gated smokes; spec-drift job plus an assistants deprecation-timeline watch. + +## Writing conventions + +Measured, precise, no hyperbole; third-person or passive descriptive framing; no em dashes (use `-`); `->` for arrows; QWERTY-only characters; runnable examples with `json_extract`. + +## Non-negotiables + +1. Latest `@stackql/provider-utils`, always +2. Established provider-dev conventions are the reference pattern; cross-provider findings reused, not re-derived +3. Nothing under `/organization` maps here - the subtree filter is validated +4. Every v1 resource is dispositioned - Breaking Changes is generated, never hand-written +5. v1 artifacts archive to `legacy/` in one commit - nothing silently deleted +6. Token/compute-consuming operations never run outside the gated tier +7. Deterministic scripts, never hand-edits to derived artifacts +8. Every regeneration is followed by the integration suite before commit \ No newline at end of file diff --git a/NOTES.md b/NOTES.md new file mode 100644 index 0000000..027d265 --- /dev/null +++ b/NOTES.md @@ -0,0 +1,236 @@ +# Engineering Notes + +Phase 1 working notes for the next-generation `openai` provider (in-situ replacement of v1). Each item records what was investigated, the evidence, and what remains open. Established cross-provider findings are reused, not re-derived: the replacement discipline (predecessor inventory, dispositions, generated Breaking Changes), the model-vendor scope posture, deprecation-as-build-input, blocked-on-key gating, and the REPLACE-vs-UPDATE warning. + +## 1. Repo survey and the v1 footprint (task 1) + +Surveyed 2026-07-15 at commit `15f31f1` (branch `feature/provider-dev`). + +**What v1 comprises in this repo.** The v1 provider's only in-repo artifacts are the generated Docusaurus service docs, moved here from the monolithic docs site in commit `15f31f1` ("moved to microsite", 2025-09-18): + +- `website/docs/index.md` - provider intro (claims 17 services / 52 resources; the resource count in that banner does not match the tree - see below) +- `website/docs/services//index.md` - 17 service index pages +- `website/docs/services///index.md` - 35 resource pages, each with an Overview table (resource id), a Fields table, a Methods table (method name, SQL verb, required params), and SELECT/INSERT/DELETE example blocks where applicable +- `website/build/` - a committed static build of the same site (derived artifact, regenerated at docs time) + +v1 services and per-service resource counts: assistants (5: assistants, messages, run_steps, runs, threads), audio (3: speeches, transcriptions, translations), audit_logs (1), batch (1: batches), chat (1: completions), completions (1), embeddings (1), files (1), fine_tuning (3: jobs, events, job_checkpoints), images (3: images, image_edits, image_variations), invites (2: invites, users), models (1), moderations (1), projects (4: projects, project_api_keys, project_service_accounts, project_users), uploads (2: uploads, upload_parts), users (1), vector_stores (4: vector_stores, vector_store_files, vector_store_file_batches, files_in_vector_store_batches). + +**No v1 generation pipeline survives in this repo.** `provider-dev/{config,downloaded,openapi,source,scripts}` exist but contain only `.gitkeep` placeholders; `bin/` holds template scaffolding copied from the digitalocean template (`package.json` still carries `"name": "stackql-provider-digitalocean"` and `@stackql/provider-utils ^0.5.0` - the latest on npm is 0.7.6, to be adopted per non-negotiable 1). There are no v1 openapi source artifacts, no v1 spec snapshot, and no v1 generation scripts to archive - the generated provider yaml for v1 lives in the central `stackql/stackql-provider-registry`, not here. + +**`legacy/` archive plan (the exact move list for the cutover commit):** + +- `website/docs/services/` (17 service trees, 52 md files) -> `legacy/website-docs-services/` +- `website/docs/index.md` -> `legacy/website-docs-services/index.md` +- `website/build/` - regenerated at docs time, not archived (derived artifact); removed in the same commit and rebuilt from the new docs +- nothing else qualifies: bin/ scaffolding is template-generic (upgraded in place, not v1-specific), provider-dev/ is empty + +The registry-side replacement (provider yaml version bump) happens in `stackql/stackql-provider-registry` per the registry flow, outside this repo. + +**Website state.** Docusaurus site deployed to `openai-provider.stackql.io` via GitHub Pages, driven by `.github/workflows/{prod,test}-web-deploy.yml` (`static/CNAME` pins the domain). `star-check.yml` is deleted in the working tree (pre-existing local change, carried into the first commit). + +**v1 documented example queries (the task 9 acceptance-query source).** Every resource page carries a `SELECT` example (`SELECT FROM openai..`), and INSERT/DELETE examples where mapped. The acceptance list is extracted from these pages at task 9. + +**Live-credential status.** `OPENAI_API_KEY` is not present on this machine (process, user, machine scopes; no `.env` here or in sibling repos beyond anthropic's own key). The nvidia/vsphere blocked-on-key pattern applies: all offline phases proceed; the task 4 live two-page traversal and the task 8 vector-store cost-free lifecycle are recorded as owed runbooks that execute unchanged once a key is present. + +## 2. Spec source, pin and filter (task 3) + +**Canonical artifact.** `openai/openai-openapi` publishes a single `openapi.yaml` (2.8 MB) on the default branch `main` - actively maintained (pushed 2026-07-14, the day before this pin). The dated branches (`2025-02-04` ...), `manual_spec` (last commit 2025-04-29) and `master` are historical. Pinned in `provider-dev/config/spec_pin.json`: + +- ref `a3276900e58b8b2a92e0cb087cd2e6e005f58458` (2026-07-14), sha256 `74cbcf73...d4f5f8b` +- openapi `3.1.0`, info.version `2.3.0`, 162 paths / 242 operations +- `@apidevtools/swagger-parser` 12.1.0 validates clean, no repairs +- `bin/fetch-spec.sh --check` re-resolves `main` HEAD against the pin (the drift-CI hook); refreshes are reviewed diffs via `--ref` + +`openapi: 3.1.0` carries the nvidia finding: 3.1 passed split/analyze there; normalize/generate are the unexercised legs - any breakage lands in `pre_normalize.mjs` as a deterministic downgrade of affected constructs. + +**Filter result** (`clean_specs.mjs`, first-match-wins path rules, report in `provider-dev/config/filter_report.csv`): 162 paths / 242 ops -> 59 paths / 100 ops. + +- `org-admin-surface` 52 paths / 81 ops - the `/organization` subtree plus the `/projects/{project_id}` role/group surface (same admin key class, not under `/organization`; recorded because non-negotiable 3 says "nothing under /organization" and these six paths are the one admin-class family outside it) -> `openai_admin` +- `data-plane-inference` 38 paths / 47 ops - chat/completions (including the stored-completions GET/POST/DELETE metadata sub-surface: the family is excluded whole per the recorded posture), completions, responses, embeddings, images, audio (including `voice_consents` - see Open), moderations, realtime, videos (Sora generation jobs - see Open) +- `binary-transfer` 6 paths / 6 ops - file/container-file/vector-store-file/skill content, upload parts +- `beta-ui-surface` 5 paths / 6 ops - ChatKit sessions (client-secret issuance) and threads (see Open) +- `alpha-unstable` 2 paths / 2 ops - `/fine_tuning/alpha/graders/{run,validate}` (compute-consuming, alpha-labelled) + +The validator fails the run if any rule matches nothing (stale-rule guard) or if any `/organization` path survives (non-negotiable 3). Kept in scope beyond the CLAUDE.md candidate list: `/conversations` (CRUD + items - the metadata/state surface of the Responses family, the successor shape to assistants threads which are themselves in scope) and `/skills` (files-like versioned metadata CRUD, standard key, non-inference; content endpoints excluded as binary). Both flagged under Open for explicit confirmation. + +**Deprecation labels in the pinned spec.** Only the five `/assistants` CRUD operations carry `deprecated: true`. Threads, messages, runs and run steps carry no operation-level flag despite the vendor's family-wide migration-to-Responses deprecation. The family-wide labelling is therefore a deterministic rule at build time (assistants + threads path families -> deprecated), recorded as such and re-checked by the drift CI - when the vendor stamps the rest of the family (or removes the paths), the rule is revisited with the diff. + +## 3. Pagination: the derived cursor (task 4) + +**The envelope, from the pinned spec.** 22 GET-list operations return a `data[]` envelope in the filtered surface: + +- 19 carry the full `{object, data, first_id, last_id, has_more}` list envelope (assistants, batches, containers, container files, conversation items, evals, eval runs, eval run output items, files, checkpoint permissions, job checkpoints, thread messages, thread runs, run steps, vector stores, vector store files, vector store batch files, skills, skill versions) +- 2 deviate: `GET /fine_tuning/jobs` and `.../events` return `{object, data, has_more}` - no `first_id`/`last_id` +- 1 is unpaginated: `GET /models` returns `{object, data}` with no cursor params + +**any-sdk/stackql engine analysis** (any-sdk local checkout `eff549b`, stackql `2a0297b`, binary v0.10.542): + +- The derived cursor IS expressible in config. `requestToken: {key: after, location: query}` is applied verbatim: `SetNextPage()` clones the prior request and `q.Set("after", token)` (any-sdk `internal/anysdk/http_armoury_params.go:114-122`). `responseToken: {key: $.last_id, location: body}` extracts by JSONPath: `extractNextPageTokenFromBody` -> `res.ExtractElement` -> `jsonpath.Get("$.last_id", body)` (stackql `internal/stackql/execution/mono_valent_execution.go:1883-1915`, any-sdk `pkg/response/response.go:105-124`, PaesslerAG/jsonpath v0.1.1). No dedicated next-token field is needed - the previous page's `last_id` IS the token, which is exactly this mechanism. +- **`has_more` cannot terminate the loop.** any-sdk's config vocabulary has `responseTerminator` (`internal/anysdk/pagination.go:44`), but nothing in the stackql traversal loop consumes it (zero references under stackql `internal/`). Termination is solely `tk == "" || tk == "" || tk == "[]"` (`mono_valent_execution.go:495`). +- **Termination still works, at the cost of one extra request.** On the true last page `has_more` is `false` but `last_id` is still populated, so the loop issues one further call with `after=`. That page returns `data: []` with `last_id: null` (or absent): JSONPath yields nil -> `fmt.Sprintf("%v", nil)` = `""` -> termination value (null case), or extraction error -> map-lookup fallback misses -> `""` (absent case). Either way traversal ends after exactly one empty overshoot request per full listing. Documented as the accepted cost; an engine ticket for `responseTerminator` consumption (evaluate `$.has_more == false`) is a follow-up, not a v1 gate. +- Config placement is service-level `x-stackQL-config` (provider-level pagination inheritance is broken in any-sdk). + +**The config** (applied per service at generate/post-process time): + +```yaml +x-stackQL-config: + pagination: + requestToken: + key: after + location: query + responseToken: + key: $.last_id + location: body +``` + +**Per-resource honesty for the deviants.** In `fine_tuning`, the jobs and events lists lack `last_id`: under the service-level config the token extraction misses -> `""` -> the loop cleanly stops after page 1. Those two resources are documented as first-page-plus-parameters (`after`, `limit` as WHERE parameters). A candidate config keyed at `$.data[-1:].id` exists in principle but negative-index JSONPath support in PaesslerAG/jsonpath v0.1.1 is unverified (no Go toolchain on this machine) - parked under Open; the honest posture ships either way. `models.list` is a single unpaginated call - no config effect. + +**Live two-page traversal - BLOCKED on `OPENAI_API_KEY`** (see section 1). Runbook, executes unchanged once a key is present: + +1. Seed >= 3 metadata rows if needed (three `stackql-smoke-` vector stores - cost-free, deleted in-run; files work too if >= 3 exist). +2. `GET /v1/vector_stores?limit=2` - assert the envelope (`object: list`, `data`, `first_id`, `last_id`, `has_more: true`) and capture `last_id`. +3. `GET /v1/vector_stores?limit=2&after=` - assert the second page starts after the first page's last id and `has_more: false`. +4. `GET /v1/vector_stores?limit=2&after=` - assert the empty-page shape (`data: []`, `last_id` null/absent) that the engine relies on for termination. +5. Same three steps through the generated provider (`SELECT ... FROM openai.vector_stores.vector_stores`) with a debug proxy or `--http.log`, asserting the loop makes exactly pages+1 requests and returns the union. + +## 4. Predecessor inventory and dispositions (tasks 2, 6) + +`inventory_predecessor.mjs` parses the v1 resource pages' Methods tables: **94 methods, 35 resources, 17 services** (SELECT 39, INSERT 24, DELETE 12, EXEC 11, UPDATE 8). The join key to the new surface is the operationId - v1 method names are snake_case operationIds from the older spec sync, typo included (`submit_tool_ouputs_to_run` = `submitToolOuputsToRun`, still present upstream). The 25 v1 methods with no operationId match are all in the four admin services (their operationIds were renamed upstream); a service-level rule dispositions them. + +`disposition_predecessor.mjs` result - **no v1 entry undispositioned (the validator forbids a third state)**: + +- **carried 42** - same `openai..` FQN (method names become resource-scoped: `retrieve_batch` -> `get`) +- **renamed 13** (5 distinct resource renames): `batch.batches` -> `batches.batches`, `fine_tuning.job_checkpoints` -> `fine_tuning.checkpoints`, `vector_stores.vector_store_files` -> `vector_stores.files`, `vector_stores.vector_store_file_batches` -> `vector_stores.file_batches`, `vector_stores.files_in_vector_store_batches` -> `vector_stores.file_batch_files` +- **retired 39**: 26 org-admin-surface (-> `openai_admin`: audit_logs, invites x2, projects x4, users), 10 data-plane-inference (audio x3, chat, completions, embeddings, images x3, moderations), 2 method-level (files.create_file multipart, files.download_file binary - the `files.files` resource itself survives as list/get/delete), 1 binary (uploads.upload_parts) + +No v1 resource lacks an obvious successor - every retirement carries a standing-posture reason code, so nothing needs an explicit decision beyond the Open items below. The Breaking Changes README section is generated from this table (marker-delimited, `disposition_predecessor.mjs` refuses to run without exactly one marker pair). + +## 5. Endpoint inventory and the service split (tasks 5, 7) + +`build_inventory.mjs` over the filtered spec -> `endpoint_inventory.csv`: **100 operations, 97 mapped / 3 skipped (createFile, CreateSkill, CreateSkillVersion: multipart-binary-body), 26 resources, 11 services** (select 43, insert 17, delete 16, exec 12, update 9). 23 deprecation-labelled ops (5 spec-flagged assistants CRUD + 18 family-rule), 9 update-POSTs, 20 async-job ops (create/poll/cancel triples on fine_tuning.jobs, batches, vector_stores.file_batches, uploads, assistants.runs, evals.runs; plus pause/resume/complete controls). + +**Service split (recorded in `service_names.json`, CLAUDE.md candidates updated):** `assistants` (assistants, threads, messages, runs, run_steps), `batches`, `containers` (containers, files), `conversations` (conversations, items), `evals` (evals, runs, run_output_items), `files`, `fine_tuning` (jobs, events, checkpoints, checkpoint_permissions), `models`, `skills` (skills, versions), `uploads`, `vector_stores` (vector_stores, files, file_batches, file_batch_files). Additions vs the CLAUDE.md candidates: `conversations` and `skills` (rationale in section 2). The split is tag-discriminated - the spec's tags map 1:1 to these services (the `Assistants` tag already spans `/assistants` + `/threads`), with two mechanics: the untagged Containers ops are tag-stamped in `clean_specs.mjs`, and `service_names.json` keys are provider-utils-normalized tag names (`batch` -> `batches` is the one real override; overrides apply after `normalizeServiceName`, verified in provider-utils 0.7.6 `split.js:127`). + +## 6. Pilot mapping - GREEN (task 8) + +Split (11 services) -> `generate-mappings` (analyze; the keycloak "delete `all_services.csv` before re-run" carry-over applies) -> `map_operations.mjs`. The mapper's rule table IS `endpoint_inventory.csv` joined by operationId - one source of truth, no second rule set to drift. All validations pass: coverage both directions, unique (service, resource, method), unique path-param signatures per (resource, SQL verb) (exec excluded), list methods all carry `$.data`, and disposition consistency (every carried/renamed v1 method resolves to a mapped method - 55/55). + +- `fine_tuning` (async-job archetype): jobs `create`/`get`(poll)/`list` + `cancel`/`pause`/`resume` EXEC; children events/checkpoints SELECT-only; checkpoint_permissions list/create/delete +- `vector_stores` (CRUD flagship): full CRUD + `search` EXEC on the store; files CRUD (update = attributes POST); file_batches create/poll/cancel; file_batch_files list +- `batches` (async boundary case): create/get/list + cancel EXEC + +No signature collisions anywhere (the oci `GetCompartment` failure mode does not occur: OpenAI child paths always add a distinct path parameter). The live vector-store lifecycle proof is blocked on key - runbook in section 7. + +## 7. Decisions and evidence for the remaining open questions (task 9) + +**Org/project headers - DECIDED: optional header parameters injected at pre-normalize, the anthropic mechanism.** The pinned spec declares neither `OpenAI-Organization` nor `OpenAI-Project` on any operation (zero occurrences). The in-family precedent is the anthropic provider, which declares `anthropic-version` as an optional per-operation header parameter with a schema default, generated through this same toolchain. Phase 2 `pre_normalize.mjs` injects both headers as `required: false` header parameters on every operation (deterministic rule); they surface as optional query parameters (settable in WHERE / INSERT params), never in required params; documented once in the README auth section. No auth-config or engine mechanism for static extra headers exists to prefer over this. + +**Update-POST partial semantics (keycloak warning) - spec-side evidence recorded, wire probes owed.** All 9 update-POSTs are labelled `UPDATE`, none `REPLACE`. Pilot evidence: `UpdateVectorStoreRequest` has zero required properties, all nullable (name, expires_after, metadata) - partial by construction; `updateVectorStoreFileAttributes` requires exactly the one field it targets (`attributes`) - a targeted update, not a representation replace. The OpenAI convention ("Only fields provided are updated" per the modify-* documentation) matches. Wire-level omitted-field-preservation probes (the keycloak method: update one field, assert others unchanged) fold into the blocked-on-key runbook for `vector_stores.update` and `files.update` before generation ships. + +**Deprecation labels through the generator - rule recorded, generate-phase verification owed.** The five spec-flagged `/assistants` ops carry `deprecated: true` through split unchanged (verified in `provider-dev/source/assistants.yaml`). The family rule (all assistants-service resources labelled deprecated in docs) is applied at the docs/post-process stage in phase 2; the endpoint inventory carries the flag per op (`spec` vs `family-rule` provenance). Drift CI watches for the vendor stamping threads/runs or removing paths. + +**Derived-cursor config in the pilots** - the section 3 config is the generate-phase input for all 11 services (service-level `x-stackQL-config`); `fine_tuning` ships with the two documented first-page deviants (jobs, events). Nothing further to decide in phase 1. + +**Rate limits and pacing - nothing observed (no live calls this session; blocked on key).** Posture recorded for the smoke design: metadata endpoints sit in the standard per-tier RPM buckets; the suites pace at <= 1 request/second, honor `Retry-After` on 429, and never parallelize writes. To be replaced with observed numbers when the key lands. + +**Gated-tier design for token/compute smokes - mock-first, recorded now:** + +- **Ungated (every CI run once a key exists):** offline SHOW/DESCRIBE + meta-routes (no key); live reads (models, files, vector_stores lists); cost-free lifecycles - vector store create -> get -> update metadata -> delete (no files attached, no embeddings billed), upload create -> cancel (metadata only). `stackql-smoke-` naming; sweep prior breadcrumbs by name prefix before each run. +- **Gated (mock-first; live only by explicit decision, never in CI defaults):** fine-tuning job create (training compute), batch create (token consumption on execution), `vector_stores.search` (embeds the query), eval run create, assistants runs (inference). The integration mock asserts the wire shapes for all of these (create/poll/cancel triples, `$.data` unwrapping, derived-cursor traversal incl. the empty-overshoot page, deprecation labels, bearer + org/project headers) so the gated tier's live value is purely confirmatory. +- Never against a production project; a dedicated test project under the org. + +**Cutover plan (drafted; executes at phase 2 exit):** + +1. The `legacy/` archive commit (one commit, history preserved): move `website/docs/services/` -> `legacy/website-docs-services/` and `website/docs/index.md` alongside; delete `website/build/` (derived; regenerated from the new docs). Nothing else is v1-specific (section 1). +2. Registry publish: new provider version for `openai` in `stackql/stackql-provider-registry` replacing the v1 version per the registry flow; old version stays pullable for pinning. +3. Verification: `REGISTRY PULL openai` against the published registry; the four test layers re-run `--registry public`. +4. Acceptance: the v1 documented example queries re-run - each passes unchanged or is covered by a Breaking Changes entry, no third state. Extracted target list (22 SELECT + 12 DELETE FROM-targets across the 35 v1 resource pages, plus the INSERT examples): every target resolves through `predecessor_dispositions.csv` - carried targets must pass verbatim; the 5 renamed vector_stores/batch/fine_tuning targets and the retired org-admin/data-plane targets are covered by the generated Breaking Changes section. The extraction command and the per-target expectation are re-derived from the dispositions CSV at acceptance time (deterministic, no hand-kept list). +5. Docs site regenerated (`openai-provider.stackql.io`) with the generation-change note and the `openai_admin` sibling pointer. + +## 8. Query-parameter pushdown - investigated, no clean v1 opportunity + +any-sdk's `queryParamPushdown` config (translating SQL clauses to query params) is a **live, wired** engine feature, unlike `responseTerminator`: stackql's `internal/stackql/pushdown` extracts a neutral intent (projection/predicates/order-by/limit/offset/count) from the SELECT, gated on the method carrying the config, and any-sdk's `ApplyPushdown` renders it. Six pushdown types exist: `select` (`$select`), `filter` (`$filter`), `orderBy`, `top` (LIMIT), `skip` (OFFSET), `count`. Purely an optimisation - client-side WHERE/projection/LIMIT stay authoritative, so a partial or absent translation never changes results. + +Assessed against the OpenAI list surface, **none is a clean fit for v1**: + +- **`filter` and `orderBy` render OData syntax only** (`applyPushdownFilter`/`applyPushdownOrderBy` require `syntax: odata` and emit `col eq 'v'` / `col desc`). OpenAI has no filter DSL - it uses discrete named query params - and its `order` is direction-only (`asc`/`desc`, implicitly on `created_at`), not a `col dir` expression. No renderer fits. +- **`select`/`skip`/`count` have no OpenAI equivalent** - no sparse fieldsets on lists, cursor pagination not offset, no count endpoints in scope. +- **`top` (LIMIT -> `limit`) is the only structural candidate, and it collides with pagination.** OpenAI's `limit` IS the pagination page-size parameter. The REST acquire path's pagination loop (`mono_valent_execution.go:1277-1304`) is eager - it fetches every page until the cursor token is absent and never consults the SQL LIMIT (only the GraphQL path bounds pages by `GetPushdownLimit`). So a `top` pushdown on `limit` would set the page size without reducing rows fetched, and for a small `LIMIT` it shrinks pages and *increases* request count. Counterproductive while cursor pagination is on. + +**What users want (filter/limit/project) is already delivered by ordinary parameter binding**, not pushdown: the discrete query params are carried onto the list methods as WHERE-able parameters (verified on `files.list`: `purpose`, `limit`, `order`, `after`). `SELECT ... FROM openai.files.files WHERE purpose = 'fine-tune' AND order = 'desc' AND limit = 100` binds each to its query param today, no config needed. The only thing pushdown would add is SQL-clause ergonomics (`LIMIT 100` instead of `WHERE limit = 100`), which the pagination collision makes not worth it. + +**Engine candidate (phase 2, not a v1 gate):** if the REST acquire path is taught to bound eager cursor pagination by the pushed LIMIT (mirroring the GraphQL path's `GetPushdownLimit`), a `top` pushdown on `limit` becomes a clean ergonomic win - `LIMIT n` fetches exactly one bounded page. Until that lands, no pushdown config is emitted. + +## 9. Binary (multipart) request bodies - not expressible; skip or use file_id + +any-sdk marshals only JSON and XML request bodies (`operation_store.go` `marshalBody` -> `application/json` / `application/xml`, everything else returns `media type not supported`). There is no `multipart/form-data` or `application/octet-stream` path, so an operation whose request body carries a `format: binary` field (a file upload) cannot be sent, regardless of the SQL verb it maps to - EXEC does not change this, since the body still goes through `marshalBody`. + +Four in-scope operations declare binary request fields. The disposition follows the CLAUDE.md binary-transfer exclusion and the EXEC-minimisation rule (EXEC is reserved for genuine lifecycle ops - cancel/pause/resume/complete - not a bucket for "doesn't fit INSERT"): + +- **`createFile`, `CreateSkill`, `CreateSkillVersion`** - the binary `file`/`files` field is required with no non-binary alternative, and none is a lifecycle op, so they are **skipped** (`multipart-binary-body`). Consequence: `skills`/`versions` are metadata surfaces (list/get/delete, plus `skills.update` for the default version) with no create; file upload is out of scope exactly as file *content* upload is. +- **`CreateContainerFile`** - the binary `file` is *optional* and there is a non-binary `file_id` (reference an already-uploaded file), so it stays **INSERT** via `file_id`; `pre_normalize.mjs` strips the dead binary `file` column (a general rule: `format: binary` request properties are removed and dropped from `required`, since they are never marshalable). + +The mapping totals move to 100 ops -> 97 mapped / 3 skipped (insert 17, select 43, delete 16, exec 12, update 9). If any-sdk gains multipart/octet-stream body support, these skips are revisited (the operations are recorded here, not lost). + +## 10. Pushdown and parameter casing - what shipped, and the two engine gaps + +Revisits section 8 with per-directive evidence (`applyPushdown*` in +`internal/anysdk/query_param_pushdown_apply.go`). + +**`top` (LIMIT) - enabled.** Correcting section 8: `applyPushdownTop` has *no* +dialect gate - it honours any `paramName` - so `LIMIT n` -> `?limit=n` is +expressible today. The service config now carries: + +```yaml +queryParamPushdown: + top: { paramName: limit, maxValue: 100 } +``` + +`limit` is therefore dropped from the generated example WHERE clauses +(`sanitize_docs.mjs`) and annotated in the params table as SQL-LIMIT driven +(`pre_normalize.mjs`). Caveat, recorded not hidden: because `limit` *is* the +pagination page-size parameter and the REST acquire path never bounds the cursor +walk by the pushed limit (`GetPushdownLimit` is consumed only in stackql's GraphQL +acquire path; the REST loop in `execution/mono_valent_execution.go` terminates on +token absence or the global `HTTPPageLimit`), a small `LIMIT` shrinks the page +without reducing rows fetched - it costs requests rather than saving them. The +over-fetch predates the pushdown; only the page size changes. Bounding the REST +walk by the pushed limit is the engine fix, raised upstream alongside the orderBy directive. + +**`orderBy` (`order`) - blocked, work order raised.** `applyPushdownOrderBy` hard- +requires `syntax: odata` and renders ` `; OpenAI's `order` takes a +bare `asc`/`desc` (column implicit). No custom renderer exists, so +`ORDER BY created_at DESC` cannot be pushed. `order` stays an ordinary WHERE +parameter (`WHERE "order" = 'desc'`). Requested upstream as a general directive (a `direction_only` algorithm alongside the default odata rendering). + +**`filter` - deliberately parked.** Same OData-only constraint, but vendor filter +DSLs vary too much for a useful generalisation; not pursued. + +**Parameter casing - not achievable without an any-sdk change.** any-sdk *does* +have the mechanism (`request.nativeCasing` + `pkg/casing`), and it is live at the +method level - proven: with `nativeCasing: kebab` stamped per method, +`WHERE "open_ai-_organization" = 'x'` (the mangled `ToSnake` alias of +`OpenAI-Organization`) resolves and reaches the API. But `casing.ToSnake` is a +botocore `xform_name` port that never treats `-` as a separator, so a hyphenated +header yields either a mangled alias or none; and no unhyphenated spelling is a +valid header. `WHERE openai_organization = ...` therefore fails with +`could not locate symbol`. Raised upstream against `casing.ToSnake`. + +Shipped posture: the scoping headers are declared with their wire-valid lowercase +kebab names (`openai-organization` / `openai-project` - HTTP field names are +case-insensitive per RFC 7230 s3.2, so these are the vendor's headers), methods +carry `request.nativeCasing: kebab` (a no-op today, the correct forward-compatible +declaration once the transform handles hyphens), and the docs use the quoted form. +`sanitize_docs.mjs` quotes the identifiers that do not parse bare - the two headers +and the reserved word `order` - because the doc generator emits them raw, which is +invalid SQL (`syntax error ... near 'order'`, `unexpected: openai - organization`). + +## Open + +1. **Live runbooks blocked on `OPENAI_API_KEY`** - the section 3 two-page traversal, the vector store cost-free lifecycle, the update-POST field-drop probes, rate-limit observation. All other phase 1 results are offline-proven; these execute unchanged when a key is present. (nvidia/vsphere blocked-on-key pattern.) +2. **Scope confirmations for the two added services** - `conversations` (Responses-family state; CRUD is clean metadata, items carry message content - the same content posture as the in-scope assistants thread messages) and `skills` (files-like versioned metadata; content endpoints already excluded as binary). Both are in the phase 1 build; strike this item if the maintainer concurs, or a one-line rule change in `clean_specs.mjs` removes either cleanly. +3. **Excluded-but-arguable families, recorded for the record** (not relitigated without new facts): `/audio/voice_consents` (consent records are metadata, but the audio family is data-plane and the surface is invocation-adjacent); `/videos` (Sora generation jobs are async-job-shaped, but generation is inference - the batches argument does not transfer because batch inputs are pre-priced files, video jobs are direct generation); ChatKit threads (session metadata, but the surface is beta and client-secret-coupled). +4. **`$.data[-1:].id` cursor for the fine_tuning list deviants** - negative-index JSONPath support in PaesslerAG/jsonpath v0.1.1 unverified (no Go toolchain here). If it works, jobs/events get transparent pagination too; if not, the shipped first-page posture stands. Phase 2, low priority. +5. **`responseTerminator` engine gap** - any-sdk config vocabulary carries it, the stackql loop ignores it; consuming it (`$.has_more == false`) would remove the one-request overshoot per traversal. Upstream ticket to file; not a v1 gate. +6. **openapi 3.1.0 through normalize/generate** - unexercised (nvidia finding); any breakage lands as deterministic downgrades in `pre_normalize.mjs`. Phase 2. +7. **`analyze` appends to an existing `all_services.csv`** - keycloak carry-over confirmed still true in provider-utils 0.7.6; delete before re-running `generate-mappings`. Candidate upstream fix. diff --git a/README.md b/README.md index 5545b37..783e1a7 100644 --- a/README.md +++ b/README.md @@ -1,292 +1,295 @@ -# StackQL Provider Template - -This repository serves as a template for developing StackQL providers. It provides a structured workflow and tools to generate, test, and document StackQL providers for various cloud services and APIs. - -## What is StackQL? - -[StackQL](https://github.com/stackql/stackql) is an open-source SQL interface for cloud APIs that allows you to query and manipulate cloud resources using SQL-like syntax. With StackQL, you can: - -- Query cloud resources across multiple providers using familiar SQL syntax -- Join data from different services and providers -- Execute CRUDL operations (`SELECT`, `INSERT`, `UPDATE`, `REPLACE`, `DELETE`) on cloud resources -- Execute lifecycle operations (like starting or stopping vms) using `EXEC` -- Build custom dashboards and reports -- Automate infrastructure operations using [`stackql-deploy`](https://stackql-deploy.io/) - -## What are StackQL Providers? - -StackQL providers are extensions that connect StackQL to specific cloud services or APIs. Each provider: - -1. Defines a schema that maps API endpoints to SQL-like resources and methods -2. Implements authentication mechanisms for the target API -3. Translates SQL operations into API calls -4. Transforms API responses into tabular data that can be queried with SQL - -This template repository helps you build StackQL providers by converting OpenAPI specifications into StackQL-compatible provider schemas using the `@stackql/provider-utils` package. - -## How StackQL Providers Work - -StackQL providers bridge the gap between SQL queries and REST APIs: - -1. **Resource Mapping**: API endpoints are mapped to SQL-like tables and views -2. **Method Mapping**: API operations are mapped to SQL verbs (`SELECT`, `INSERT`, `UPDATE`, `REPLACE`, `DELETE` and `EXEC`) -3. **Parameter Mapping**: SQL query conditions are translated to API parameters -4. **Response Transformation**: API responses are converted to tabular results - -## Prerequisites - -To use this template for developing a StackQL provider, you'll need: - -1. An OpenAPI specification for the target API -2. Node.js and `npm` installed on your system -3. StackQL CLI installed (see [StackQL Installation](https://stackql.io/docs/installing-stackql)) -4. API credentials for testing your provider - -## Development Workflow - -### 1. Clone this Template - -Start by cloning this template repository and installing dependencies: - -```bash -git clone https://github.com/stackql/stackql-provider-template.git stackql-provider-myprovider -cd stackql-provider-myprovider -npm install -``` - -### 2. Download the OpenAPI Specification - -Obtain the OpenAPI specification for your target API. You can typically find this in the API documentation or developer portal. - -```bash -mkdir -p provider-dev/downloaded -curl -L https://api-url.example.com/openapi.yaml -o provider-dev/downloaded/provider-name.yaml -``` - -> recommended to automate this by creating a script in the `provider-dev/scripts` folder - -### 3. Split the OpenAPI Spec into Service Specs - -Break down the OpenAPI specification into smaller, service-specific files: - -```bash -npm run split -- \ - --provider-name your-provider-name \ - --api-doc provider-dev/downloaded/provider-name.yaml \ - --svc-discriminator tag \ - --output-dir provider-dev/source \ - --overwrite \ - --svc-name-overrides "$(cat < this will vary by provider and may not be necessary in many cases - -### 7. Test the Provider - -#### Start the StackQL Server - -```bash -PROVIDER_REGISTRY_ROOT_DIR="$(pwd)/provider-dev/openapi" -npm run start-server -- --provider your-provider-name --registry $PROVIDER_REGISTRY_ROOT_DIR -``` - -#### Test Metadata Routes - -```bash -npm run test-meta-routes -- your-provider-name --verbose -``` - -#### Run Test Queries - -```bash -PROVIDER_REGISTRY_ROOT_DIR="$(pwd)/provider-dev/openapi" -REG_STR='{"url": "file://'${PROVIDER_REGISTRY_ROOT_DIR}'", "localDocRoot": "'${PROVIDER_REGISTRY_ROOT_DIR}'", "verifyConfig": {"nopVerify": true}}' -./stackql shell --registry="${REG_STR}" -``` - -Example test query: -```sql -SELECT * FROM your-provider-name.service_name.resource_name LIMIT 10; -``` - -When you're done testing, stop the StackQL server: -```bash -npm run stop-server -``` - -### 8. Publish the Provider - -To publish your provider: - -1. Fork the [stackql-provider-registry](https://github.com/stackql/stackql-provider-registry) repository -2. Copy your provider directory to `providers/src` in a feature branch -3. Follow the [registry release flow](https://github.com/stackql/stackql-provider-registry/blob/dev/docs/build-and-deployment.md) - -Test your published provider in the `dev` registry: -```bash -export DEV_REG="{ \"url\": \"https://registry-dev.stackql.app/providers\" }" -./stackql --registry="${DEV_REG}" shell -``` - -Pull and verify your provider: -```sql -registry pull your-provider-name; --- Run test queries -``` - -### 9. Generate Documentation - -Provider doc microsites are built using Docusaurus and published using GitHub Pages. To genarate and publish comprehensive user docs for your provider, do the following: - -a. Upodate `headerContent1.txt` and `headerContent2.txt` accordingly in `provider-dev/docgen/provider-data/` - -b. Update the following in `website/docusaurus.config.js`: - -```js -// Provider configuration - change these for different providers -const providerName = "yourprovidername"; -const providerTitle = "Your Provider Title"; -``` - -c. Then generate docs using... - -```bash -npm run generate-docs -- \ - --provider-name your-provider-name \ - --provider-dir ./provider-dev/openapi/src/your-provider-name/v00.00.00000 \ - --output-dir ./website \ - --provider-data-dir ./provider-dev/docgen/provider-data -``` - -d. Test the documentation locally: -```bash -cd website -yarn build -yarn start -``` - -### 10. Publish Documentation - -Remove the `.disabled` extension from `.github/workflows/test-web-deploy.yml.disabled` and `.github/workflows/prod-web-deploy.yml.disabled` - -Set up GitHub Pages in your repository settings, and configure DNS if needed: - -| Source Domain | Record Type | Target | -|---------------|-------------|--------| -| your-provider-name-provider.stackql.io | CNAME | stackql.github.io. | - -## Authentication Configuration - -Different APIs require different authentication methods. Here are common authentication configurations: - -### API Key in Header -```json -{ - "auth": { - "credentialsenvvar": "PROVIDER_API_KEY", - "type": "header", - "headerName": "X-API-Key" - } -} -``` - -### Bearer Token -```json -{ - "auth": { - "credentialsenvvar": "PROVIDER_TOKEN", - "type": "bearer" - } -} -``` - -### Basic Authentication -```json -{ - "auth": { - "credentialsenvvar": "PROVIDER_BASIC_AUTH", - "type": "basic" - } -} -``` - -### OAuth (Client Credentials Flow) -```json -{ - "auth": { - "credentialsenvvar": "PROVIDER_OAUTH_CONFIG", - "type": "oauth-client-credentials", - "tokenUrl": "https://auth.example.com/token" - } -} -``` - -## Contributing - -Contributions are welcome! Please feel free to submit a Pull Request. - -## License - -MIT \ No newline at end of file +# `openai` provider for [`stackql`](https://github.com/stackql/stackql) + +This repository generates and documents the `openai` provider for StackQL, enabling SQL-based query and provisioning operations against the OpenAI platform surface available to standard API keys - models, files (metadata), fine-tuning (jobs, events, checkpoints, checkpoint permissions), batches, vector stores (stores, files, file batches), assistants/threads/runs (deprecation-labelled), evals, conversations, uploads (metadata), containers and skills. The provider is built using the `@stackql/provider-utils` package. + +## Design Principles + +This is a ground-up replacement of the v1 `openai` provider, generated on the current toolchain from the vendor's published OpenAPI specification. Key points: + +- **Pinned vendor spec** - the single source artifact is `openapi.yaml` from [`openai/openai-openapi`](https://github.com/openai/openai-openapi) (branch `main`), pinned by commit and hash in `provider-dev/config/spec_pin.json`. Refreshes are reviewed diffs, never silent regenerations (`npm run fetch-spec -- --check` detects drift). +- **Scope boundaries** - the organization/admin surface (`/organization/...` - usage, costs, projects, users, invites, audit logs, admin keys) uses a separate admin key class and lives in the sibling `openai_admin` provider. Inference invocation (chat/completions, responses, embeddings, images, audio, moderations, realtime, video generation) is the data plane and out of scope per the standing model-provider posture. Batches are in scope - an async job control surface, not an invocation. Binary transfer (file content, upload parts) is excluded; file and upload metadata is in scope. All exclusions are deterministic, reason-coded rules in `provider-dev/scripts/clean_specs.mjs` with the removal list in `provider-dev/config/filter_report.csv`. +- **Fixed server, bearer auth** - `https://api.openai.com/v1` with `Authorization: Bearer $OPENAI_API_KEY`. +- **Async jobs are the core surface** - fine-tuning jobs, batches, vector store file batches, uploads: `INSERT` creates, `SELECT` polls, `EXEC` cancels; events and checkpoints are child `SELECT` resources. +- **The OpenAI list envelope** - list responses wrap as `{"object": "list", "data": [...], "first_id": ..., "last_id": ..., "has_more": bool}`; the provider unwraps `$.data` and drives pagination with the derived cursor (`after` fed from the previous page's `last_id`). +- **Deprecation is a build input** - the Assistants family carries the vendor's migration-to-Responses deprecation; the labels are carried into the provider docs and the drift CI watches the timeline. + + + +### Breaking Changes from the v1 Provider + +This rebuild replaces the published v1 `openai` provider. Every v1 resource is dispositioned below +(generated from `provider-dev/config/predecessor_dispositions.csv`: 94 v1 methods -> 42 carried, 13 renamed, 39 retired). +The old provider version remains available in the registry for pinning. + +**Renamed resources** (old -> new): + +| v1 resource | This rebuild | +|---|---| +| `openai.batch.batches` | `openai.batches.batches` | +| `openai.fine_tuning.job_checkpoints` | `openai.fine_tuning.checkpoints` | +| `openai.vector_stores.files_in_vector_store_batches` | `openai.vector_stores.file_batch_files` | +| `openai.vector_stores.vector_store_file_batches` | `openai.vector_stores.file_batches` | +| `openai.vector_stores.vector_store_files` | `openai.vector_stores.files` | + +**Retired resources** (reason-coded): + +- Binary transfer - out of scope per the standing exclusions (metadata remains queryable): `openai.uploads.upload_parts` +- Inference invocation (data plane) - out of scope per the standing model-provider posture; use the vendor SDKs for invocation: `openai.audio.speeches`, `openai.audio.transcriptions`, `openai.audio.translations`, `openai.chat.completions`, `openai.completions.completions`, `openai.embeddings.embeddings`, `openai.images.image_edits`, `openai.images.image_variations`, `openai.images.images`, `openai.moderations.moderations` +- Organization/admin surface (separate admin key class) - moved to the sibling [`openai_admin`](https://github.com/stackql/stackql-provider-registry) provider: `openai.audit_logs.audit_logs`, `openai.invites.invites`, `openai.invites.users`, `openai.projects.project_api_keys`, `openai.projects.project_service_accounts`, `openai.projects.project_users`, `openai.projects.projects`, `openai.users.users` + +**Retired methods on surviving resources**: + +- `openai.files.files.create_file` - Multipart binary upload body - not expressible; file content uploads are out of scope (metadata remains queryable) +- `openai.files.files.download_file` - Binary transfer - out of scope per the standing exclusions (metadata remains queryable) + +**Method naming** - v1 operation-derived method names become resource-scoped names +(`list_batches` -> `list`, `retrieve_batch` -> `get`, `create_fine_tuning_job` -> `create`, ...). +54 of the 55 surviving methods are renamed this way; the mapping is one-to-one per resource and recorded in the dispositions CSV. + + + +## Build Pipeline + +Deterministic and re-runnable throughout; every script validates and fails without writing. Node.js 20+ required. + +Stages 0-4 are implemented and run (fetch/filter, split, mappings, normalize, generate); the generated provider resolves in stackql (offline `SHOW`/`DESCRIBE` verified). Stage 5 has a live pystackql smoke test (`tests/smoke_test.py`); the meta-route and mock integration layers, and stages 6-7 (publish, docs), are documented as the intended invocations. The `bin/` wrappers (`normalize.mjs`, `generate-provider.mjs`) invoke the current `@stackql/provider-utils` directly; `generate-provider.sh` is a thin passthrough so no flag is dropped by the wrapper. + +### 0. Fetch, pin and filter the spec; inventory the predecessor + +```bash +npm run fetch-spec # download openapi.yaml at the pinned ref, validate, pin +npm run fetch-spec -- --check # drift check against the pin (CI) +npm run clean-specs # apply the reason-coded scope filters -> openapi_cleaned.yaml +npm run inventory-predecessor # read the v1 service docs -> predecessor_inventory.csv +node provider-dev/scripts/build_inventory.mjs # endpoint inventory over the filtered spec +node provider-dev/scripts/disposition_predecessor.mjs # disposition every v1 method; regenerate Breaking Changes +``` + +### 1. Split into service specs + +Tag-discriminated (the spec's tags map 1:1 to services; the untagged Containers family is tag-stamped in `clean_specs.mjs`; overrides in `provider-dev/config/service_names.json` are keyed by normalized tag name): + +```bash +node bin/split.mjs \ + --provider-name openai \ + --api-doc provider-dev/downloaded/openapi_cleaned.yaml \ + --output-dir provider-dev/source \ + --svc-discriminator tag \ + --svc-name-overrides "$(cat provider-dev/config/service_names.json)" \ + --overwrite +``` + +Produces 11 service specs in `provider-dev/source/`: `assistants` (assistants, threads, messages, runs, run_steps - deprecation-labelled family), `batches`, `containers`, `conversations`, `evals`, `files`, `fine_tuning`, `models`, `skills`, `uploads`, `vector_stores`. + +### 2. Generate mappings + +```bash +rm -f provider-dev/config/all_services.csv # analyze appends; always start clean +node bin/generate-mappings.mjs --provider-name openai --input-dir provider-dev/source --output-dir provider-dev/config +node provider-dev/scripts/map_operations.mjs +``` + +`map_operations.mjs` fills the `stackql_*` columns from the endpoint inventory (one deterministic rule table) and gates on: coverage both directions, unique method keys, unique path-param signatures per (resource, SQL verb), object keys on every list, and disposition consistency against the predecessor table. Current state: 97 operations mapped (select 43, insert 17, delete 16, exec 12, update 9), 26 resources across 11 services. + +### 3. Normalize the Service Specs + +StackQL models providers as relational data sources, and relational databases have no native polymorphism - the `oneOf` / `anyOf` / `allOf` composition must be lowered to concrete schemas before generation. Only the **column-producing sites** matter: the request-body and 200-response schema roots and their direct properties (a resource's columns). Polymorphism nested deeper lives inside object columns and is addressed with `json_extract`, so it is intentionally left alone. The OpenAI source is openapi 3.1.0 and composition-heavy (across the split specs before normalize: 253 `anyOf`, 128 `oneOf`, 16 `allOf`); most `anyOf` sites are the 3.1 nullable idiom (`anyOf: [{...}, {type: "null"}]`), while `oneOf` carries genuine polymorphism (message content parts, tool configs, eval data sources). + +Stage 3 runs in place on `provider-dev/source`: + +```bash +node provider-dev/scripts/pre_normalize.mjs # OpenAI-specific source edits +npm run normalize -- --api-dir provider-dev/source # generic allOf flatten + oneOf/anyOf lowering +node provider-dev/scripts/lower_residual_variants.mjs # lower any union left at a column site +``` + +**`pre_normalize.mjs`** applies the adjustments the generic normalizer cannot infer, before the flatten: + +- **Injects the optional org/project headers** on every operation (200 parameters across all 100 operations) - `OpenAI-Organization` and `OpenAI-Project` as `required: false` header parameters (the spec declares neither). They surface as optional query parameters, never in required params. +- **Carries the assistants-family deprecation** driven by the endpoint inventory. The vendor flags only the five `/assistants` CRUD operations `deprecated: true`, but the whole family (threads, messages, runs, run steps) carries the migration-to-Responses deprecation. The inventory's `deprecated` column records that decision per operation; `pre_normalize` stamps `deprecated: true` on the 18 family operations the vendor left unflagged (23 total), so the label is uniform and flows through generate into the provider and docs. +- **Guards against the openapi 3.1.0 array-type nullable form** (`type: ["string", "null"]`). This form is absent in the current pin, and the `anyOf: [{realType}, {type: "null"}]` idiom flattens safely under the normalizer's first-wins merge (the real type is always the first member), so no rewrite is needed here. The guard fails the run if a future spec refresh introduces the array-type form, so the downgrade is written deliberately rather than discovered during generate. + +**`npm run normalize`** (the `normalize` function in `@stackql/provider-utils`) renames `oneOf` / `anyOf` to `allOf` at the column-producing sites and flattens all `allOf` into single merged schemas (569 flattened, 300 variants renamed against this pin), resolving the nullable idiom to the real type in passing. Deep configuration blocks - `hyperparameters` and `method` on fine-tuning jobs, `chunking_strategy` on vector store files, tool configs on assistants - lower to object columns queried with `json_extract`, preserving the wire shape without exploding into hundreds of scalar columns. The list envelope is an object (`{object, data, ...}`), not a bare array, so no bare-array wrapping is needed and the `$.data` object key set during mapping carries through unchanged. + +**`lower_residual_variants.mjs`** finishes the job at the boundary the generic normalizer leaves shallow. After the flatten, nullable wrappers at column sites are already resolved, so any variant keyword remaining on a request/response property is an irreducible union (for example a conversation item's `environment`, a discriminated `oneOf` of a local environment or a container reference). A relational column cannot be a union, so it is lowered to a JSON-blob string column addressed with `json_extract` - the same posture the normalizer applies to structureless objects. A variant left at a schema *root* (which would collapse a whole resource into one blob column) is a defect and fails the run rather than being auto-lowered. Against this pin exactly one residual is lowered; the pass is idempotent. + +The three steps are deterministic and re-runnable from a fresh split. Re-running `generate-mappings` and `map_operations.mjs` against the normalized specs produces a byte-identical mapping (`filename, path, operationId, resource, method, verb, object_key`) - normalization changes schemas only, never paths, verbs, or the resource/method mapping. + +### 4. Generate the Provider + +Transform the normalized service specs into a StackQL provider using the mappings: + +```bash +rm -rf provider-dev/openapi/* +npm run generate-provider -- \ + --provider-name openai \ + --input-dir provider-dev/source \ + --output-dir provider-dev/openapi/src/openai \ + --config-path provider-dev/config/all_services.csv \ + --servers '[{"url": "https://api.openai.com/v1"}]' \ + --provider-config '{"auth": {"type": "bearer", "credentialsenvvar": "OPENAI_API_KEY"}}' \ + --service-config '{"pagination": {"requestToken": {"key": "after", "location": "query"}, "responseToken": {"key": "$.last_id", "location": "body"}}, "queryParamPushdown": {"top": {"paramName": "limit", "maxValue": 100}}}' \ + --naive-req-body-translate \ + --overwrite +``` + +- **Fixed server** - `https://api.openai.com/v1` is a literal host with no server variables, so there are no `WHERE` server parameters and no host-routing configuration. +- **`--service-config`** injects the derived-cursor pagination at the service level (provider-level inheritance is broken in any-sdk). The OpenAI list contract has no dedicated next-token field: `after` on the next request is fed from the previous page's `$.last_id`, and traversal ends when the token is absent on the final empty page. Two `fine_tuning` lists (`jobs`, `events`) omit `last_id` and `models` is unpaginated - these ship as documented first-page-plus-parameters reads under the same config (the token simply misses and the loop stops after page 1). See NOTES.md section 3 for the engine analysis and the `has_more` one-request overshoot. +- **`--naive-req-body-translate`** makes `INSERT` / `UPDATE` body columns the native wire property names (`model`, `training_file`, `metadata`), replacing the v1 `data__` prefix (`data__model`). The request-body-column change is a breaking change beyond the resource and method renames the phase 1 disposition table captures; it is folded into the generated Breaking Changes section. + +`--service-config` also enables **LIMIT pushdown**: `top` maps a SQL `LIMIT n` clause to the wire `limit` parameter (capped at OpenAI's max of 100), so `SELECT ... LIMIT 10` sends `limit=10` and users never hand-write `WHERE limit = 10`. `ORDER BY` is *not* pushed down - any-sdk's `orderBy` renderer is OData-only and emits ` `, while OpenAI's `order` takes a bare `asc`/`desc`; `order` therefore stays an ordinary parameter (`WHERE "order" = 'desc'`). See NOTES.md section 10. + +The optional org/project scoping headers are declared with their wire-valid lowercase kebab names (`openai-organization` / `openai-project`) - HTTP field names are case-insensitive (RFC 7230 s3.2), so these are the vendor's `OpenAI-Organization` / `OpenAI-Project` headers. They are addressed quoted in SQL (`WHERE "openai-organization" = 'org-...'`), since any-sdk's snake_case aliasing cannot reach a hyphenated identifier (NOTES.md section 10). + +No post-generate rewriting is needed. The two corrections a generated provider commonly requires are both already clean in the OpenAI output, verified after generation: + +- **Response media type** - all 99 methods resolve to `application/json`; the spec has no competing content types that would need rewriting. +- **Update / EXEC request binding** - the update-POST methods (`modify*`, `update*`) and the body-carrying EXEC methods (`vector_stores.search`, `uploads.complete`, `runs.submit_tool_outputs`) all carry the naive request-body translation, so their columns bind without intervention. + +The one build-input adjustment - the assistants family deprecation labelling - is applied upstream in `pre_normalize.mjs` (driven by the endpoint inventory's `deprecated` column), so it flows through generate into the provider and docs rather than being patched onto generated output. + +### 5. Test the Provider + +Four layers. + +**Validate offline** - resolves the provider with no network: + +```bash +REG_PATH="$(pwd)/provider-dev/openapi" +REG="{\"url\":\"file://${REG_PATH}\",\"localDocRoot\":\"${REG_PATH}\",\"verifyConfig\":{\"nopVerify\":true}}" + +stackql --registry="$REG" exec "SHOW SERVICES IN openai" +stackql --registry="$REG" exec "SHOW RESOURCES IN openai.vector_stores" +stackql --registry="$REG" exec "SHOW METHODS IN openai.fine_tuning.jobs" +stackql --registry="$REG" exec "DESCRIBE EXTENDED openai.vector_stores.vector_stores" +``` + +**Meta-route suite** - walks every service, resource and method, asserting each resource has methods, no two methods on one SQL verb share a required-params signature, and every selectable resource yields non-empty `DESCRIBE EXTENDED`: + +```bash +PROVIDER_REGISTRY_ROOT_DIR="$(pwd)/provider-dev/openapi" +npm run start-server -- --provider openai --registry $PROVIDER_REGISTRY_ROOT_DIR +npm run test-meta-routes -- openai --verbose +npm run stop-server +``` + +**Integration tests (mock API server - no key required)** - a mock `api.openai.com` serving real OpenAI wire shapes, asserting row-level results for each archetype: `$.data` list unwrapping, the derived-cursor traversal (`after` = prior `last_id`, terminating on the empty final page), a vector store lifecycle with file membership (`create` -> `get` -> file attach -> `list` files -> `delete`), a fine-tuning cancel `EXEC`, the deprecation labels present on the assistants family, and the bearer plus optional org/project headers on every request. Run after every regeneration. + +**Smoke tests** (`tests/smoke_test.py`, pystackql) - live against the real API, `stackql-smoke-` naming, breadcrumbs swept first, never against a production project. Auth is the provider's declared `bearer` config on `OPENAI_API_KEY`, so the key is read from the environment (no credential on the command line). Runs against the local generated provider (default) or the published provider (`--registry public`, via `registry pull openai`). + +Set up an isolated virtual environment and install the test dependencies (`tests/requirements.txt` pins `pystackql`): + +```bash +python3 -m venv .venv + +# activate the venv: +source .venv/bin/activate # macOS / Linux +# .venv\Scripts\Activate.ps1 # Windows PowerShell +# .venv\Scripts\activate.bat # Windows cmd + +pip install -r tests/requirements.txt +``` + +Then run the smokes (`.venv` active, `OPENAI_API_KEY` in the environment): + +```bash +export OPENAI_API_KEY='sk-...' + +python3 tests/smoke_test.py --timeout 60 # cap the vector store readiness poll (default 120s) +python3 tests/smoke_test.py --timeout 60 --with-completions # also run the gated completions demo +python3 tests/smoke_test.py --timeout 60 --registry public # published provider (doubles as post-publish verification) +python3 tests/smoke_test.py --cleanup-only # just sweep stackql-smoke breadcrumbs +``` + +The `.venv/` directory is gitignored. `pystackql` downloads the `stackql` binary on first use if one is not already on `PATH`. + +- **Ungated** (cost-free, run by default) - resolution (`SHOW SERVICES`), reads (`models`, `files` metadata, a `limit`-bounded read), and the vector store lifecycle: `create` -> poll the `list` until the store is listable (`--timeout`/`--poll-interval`, the create/SELECT-poll pattern the async resources use) -> `get` by id -> `update` name -> `delete` -> confirm gone. No files attached and no embeddings billed. A valid key always returns the base model list, so an empty `models` read is treated as an auth/connectivity failure. +- **Gated** (`--with-completions`, opt-in, consumes tokens) - a completions call with the prompt "explain how StackQL works". Chat/completions is inference (the data plane) and is deliberately not part of this provider, so this step calls the OpenAI API **directly** (same key, cheap model, small token cap), separately from the provider - it proves the key works end to end and returns a real answer without smuggling inference into the provider surface. + +Without `OPENAI_API_KEY` the resolution checks still pass and the live steps report `BLOCKED`, so the script is safe to run in any environment. + +**Authentication** - bearer token from `OPENAI_API_KEY`, matching the v1 provider: + +```bash +export OPENAI_API_KEY='sk-...' +stackql shell # OPENAI_API_KEY is the default credential env var +``` + +Optional organization and project scoping is set per query via the injected header parameters (`SELECT ... WHERE "OpenAI-Organization" = 'org-...'`), or globally through the runtime auth override. + +### 6. Publish the Provider + +Cutover replaces the v1 provider (see the archive and acceptance plan in NOTES.md section 7): the v1 doc artifacts move to `legacy/` in one commit (history preserved), the new provider version replaces the v1 version in the [`stackql-provider-registry`](https://github.com/stackql/stackql-provider-registry) per the [registry release flow](https://github.com/stackql/stackql-provider-registry/blob/dev/docs/build-and-deployment.md) (the old version stays pullable for pinning), and the v1 documented example queries re-run against the new provider - each passes unchanged or is covered by a Breaking Changes entry. + +Pull and verify from the dev registry: + +```bash +export DEV_REG="{ \"url\": \"https://registry-dev.stackql.app/providers\" }" +./stackql --registry="${DEV_REG}" shell +``` + +```sql +registry pull openai; +``` + +### 7. Generate Web Docs + +The doc microsite (`website/`, Docusaurus 3.10, served at `openai-provider.stackql.io`) is regenerated from the new provider output. It follows the shared-config pattern used across the provider microsites: the navbar/footer/theme/plugin configuration lives in [`stackql/docusaurus-config`](https://github.com/stackql/docusaurus-config), vendored into `.shared-config/` at build time (the `vendor-config` script runs automatically on `prestart`/`prebuild`). Site-local files are the provider identity (`website/provider.js`), thin wrappers (`docusaurus.config.js`, `sidebars.js`), the shared components/theme under `src/`, and static assets (including `static/CNAME`). The provider identity is already set: + +```js +// website/provider.js +export const providerName = 'openai'; +export const providerTitle = 'OpenAI'; +``` + +The landing-page installation/authentication content is authored in `headerContent1.txt` / `headerContent2.txt` under `provider-dev/docgen/provider-data/`. Generate, sanitize, then build: + +```bash +npm run generate-docs -- \ + --provider-name openai \ + --provider-dir ./provider-dev/openapi/src/openai/v00.00.00000 \ + --output-dir ./website \ + --provider-data-dir ./provider-dev/docgen/provider-data + +node provider-dev/docgen/sanitize_docs.mjs # fix OpenAI doc links (see below) + +cd website +yarn install +yarn build # vendor-config clones the shared config first; network to GitHub required +yarn serve +``` + +`sanitize_docs.mjs` does two things the doc generator cannot: + +- **Doc links** - rewrites the relative OpenAI doc links carried through from the spec descriptions (`[Files API](/docs/api-reference/...)`, `/docs/guides/...`, `/docs/models`) by prefixing them with `https://platform.openai.com`. OpenAI's docs have moved to `developers.openai.com` with renamed paths that cannot be computed deterministically, but `platform.openai.com` serves a 301 redirect from every old `/docs/...` path to its current home, so the host prefix lands users on the right page and stays correct as OpenAI reorganises. Without this step the links resolve against the microsite and 404 (the shared config's `onBrokenLinks: 'warn'` keeps the build passing, but the links are dead). +- **SQL examples** - the generator emits every parameter into the example `WHERE` clause and `INSERT` column list verbatim, which produces SQL that does not parse: `order` is a reserved word (`syntax error ... near 'order'`) and the header parameters are hyphenated (`unexpected: openai - organization`). Both are double-quoted. `limit` is dropped from the examples entirely, since a SQL `LIMIT` clause supplies it via the `top` pushdown; the params table still documents it, annotated by `pre_normalize.mjs`. + +The regenerated docs carry the `openai_admin` sibling pointer and note the generation change once, per the cutover plan. + +## Service Coverage + +11 services, 26 resources, 97 mapped operations (select 43, insert 17, delete 16, exec 12, update 9). + +| Service | Resources | Notes | +|---|---|---| +| `models` | models | list / get / delete | +| `files` | files | metadata (list / get / delete); content upload and download out of scope | +| `fine_tuning` | jobs, events, checkpoints, checkpoint_permissions | async-job archetype: create / poll / cancel / pause / resume | +| `batches` | batches | in-scope async job control: create / poll / cancel | +| `vector_stores` | vector_stores, files, file_batches, file_batch_files | CRUD flagship with file membership; `search` is `EXEC` (gated) | +| `assistants` | assistants, threads, messages, runs, run_steps | deprecation-labelled (vendor migration to Responses) | +| `evals` | evals, runs, run_output_items | eval definitions and runs | +| `conversations` | conversations, items | Responses-family state surface | +| `uploads` | uploads | metadata lifecycle: create / complete / cancel | +| `containers` | containers, files | code-interpreter container metadata; files created via `file_id` reference (binary upload out of scope) | +| `skills` | skills, versions | versioned skill metadata (list/get/delete, default-version update); skill creation is a multipart file upload, out of scope (binary) | + +The organization/admin surface (`/organization/...`) is the sibling `openai_admin` provider. See the Breaking Changes section above for the full v1 disposition. + +## License + +MIT + +## Contributing + +Contributions are welcome. Please open an issue or pull request. diff --git a/bin/fetch-spec.sh b/bin/fetch-spec.sh new file mode 100644 index 0000000..4582b1a --- /dev/null +++ b/bin/fetch-spec.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +# Fetch, validate and pin the OpenAI OpenAPI spec. See provider-dev/scripts/fetch_spec.mjs. +set -euo pipefail +cd "$(dirname "$0")/.." +node provider-dev/scripts/fetch_spec.mjs "$@" diff --git a/bin/generate-docs.sh b/bin/generate-docs.sh index 0602e15..d375179 100644 --- a/bin/generate-docs.sh +++ b/bin/generate-docs.sh @@ -30,7 +30,7 @@ while [[ $# -gt 0 ]]; do echo "Usage: generate-docs.sh [OPTIONS]" echo "" echo "Options:" - echo " --provider-name NAME Provider name (default: snowflake)" + echo " --provider-name NAME Provider name (default: openai)" echo " --provider-dir DIR Provider directory path (default: $PROVIDER_DIR)" echo " --output-dir DIR Output directory for docs (default: $OUTPUT_DIR)" echo " --provider-data-dir DIR Provider data directory (default: $PROVIDER_DATA_DIR)" diff --git a/bin/generate-provider.mjs b/bin/generate-provider.mjs index 501eead..ddd27bd 100644 --- a/bin/generate-provider.mjs +++ b/bin/generate-provider.mjs @@ -16,9 +16,11 @@ async function generateProvider() { const configPath = getArg('--config-path'); const servers = getArg('--servers'); const providerConfig = getArg('--provider-config'); + const serviceConfig = getArg('--service-config'); const skipFiles = getArg('--skip-files')?.split(',') || []; const overwrite = args.includes('--overwrite'); const verbose = args.includes('--verbose'); + const naiveReqBodyTranslate = args.includes('--naive-req-body-translate'); if (!providerName || !inputDir || !outputDir || !configPath) { console.error('Error: Missing required arguments'); @@ -51,7 +53,9 @@ async function generateProvider() { providerId: providerName, servers, providerConfig, + serviceConfig, skipFiles, + naiveReqBodyTranslate, overwrite, verbose }); diff --git a/bin/generate-provider.sh b/bin/generate-provider.sh index 429933a..ae3f4f3 100644 --- a/bin/generate-provider.sh +++ b/bin/generate-provider.sh @@ -1,134 +1,13 @@ #!/usr/bin/env bash -# Exit on error +# Thin passthrough to generate-provider.mjs (kept for bash users; `npm run +# generate-provider` calls generate-provider.mjs directly). Passing every +# argument straight through means the .mjs getArg surface is the single source +# of truth - the wrapper can never silently drop a flag it does not recognise +# (the failure mode the arg-re-parsing wrapper had with --service-config). + set -e -# Get the script directory for relative paths SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -REPO_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )" - -# Default values -PROVIDER_NAME="" -INPUT_DIR="" -OUTPUT_DIR="" -CONFIG_PATH="" -SERVERS="" -PROVIDER_CONFIG="" -SKIP_FILES="" -OVERWRITE=false -VERBOSE=false - -# Parse command line arguments -while [[ $# -gt 0 ]]; do - case $1 in - --provider-name) - PROVIDER_NAME="$2" - shift 2 - ;; - --input-dir) - INPUT_DIR="$2" - shift 2 - ;; - --output-dir) - OUTPUT_DIR="$2" - shift 2 - ;; - --config-path) - CONFIG_PATH="$2" - shift 2 - ;; - --servers) - SERVERS="$2" - shift 2 - ;; - --provider-config) - PROVIDER_CONFIG="$2" - shift 2 - ;; - --skip-files) - SKIP_FILES="$2" - shift 2 - ;; - --overwrite) - OVERWRITE=true - shift - ;; - --verbose) - VERBOSE=true - shift - ;; - --help) - echo "Usage: generate-provider.sh [OPTIONS]" - echo "" - echo "Options:" - echo " --provider-name NAME Provider name/ID (required)" - echo " --input-dir DIR Input directory containing split OpenAPI files (required)" - echo " --output-dir DIR Output directory for provider (required)" - echo " --config-path PATH Path to CSV mapping file (required)" - echo " --servers JSON JSON string with servers configuration" - echo " --provider-config JSON JSON string with provider configuration" - echo " --skip-files LIST Comma-separated list of files to skip" - echo " --overwrite Overwrite existing files" - echo " --verbose Enable verbose output" - echo " --help Show this help message" - exit 0 - ;; - *) - echo "Unknown option: $1" - echo "Use --help for usage information" - exit 1 - ;; - esac -done - -# Check required arguments -if [ -z "$PROVIDER_NAME" ] || [ -z "$INPUT_DIR" ] || [ -z "$OUTPUT_DIR" ] || [ -z "$CONFIG_PATH" ]; then - echo "Error: Missing required arguments" - echo "Use --help for usage information" - exit 1 -fi - -echo "🔧 Generating StackQL provider extensions..." -echo "Provider: $PROVIDER_NAME" -echo "Input Directory: $INPUT_DIR" -echo "Output Directory: $OUTPUT_DIR" -echo "Config Path: $CONFIG_PATH" - -# Build command arguments -ARGS=("--provider-name" "$PROVIDER_NAME" "--input-dir" "$INPUT_DIR" "--output-dir" "$OUTPUT_DIR" "--config-path" "$CONFIG_PATH") - -if [ -n "$SERVERS" ]; then - ARGS+=("--servers" "$SERVERS") - echo "Custom servers configuration provided" -fi - -if [ -n "$PROVIDER_CONFIG" ]; then - ARGS+=("--provider-config" "$PROVIDER_CONFIG") - echo "Custom provider configuration provided" -fi - -if [ -n "$SKIP_FILES" ]; then - ARGS+=("--skip-files" "$SKIP_FILES") - echo "Skipping files: $SKIP_FILES" -fi - -if [ "$OVERWRITE" = true ]; then - ARGS+=("--overwrite") - echo "Overwrite: Yes" -fi - -if [ "$VERBOSE" = true ]; then - ARGS+=("--verbose") - echo "Verbose: Yes" -fi - -# Run the Node.js script with arguments -node --experimental-modules "$SCRIPT_DIR/generate-provider.mjs" "${ARGS[@]}" - -# Check if command succeeded -if [ $? -ne 0 ]; then - echo "❌ Provider generation failed" - exit 1 -fi -echo "✅ Provider generated successfully at: $OUTPUT_DIR" \ No newline at end of file +node "$SCRIPT_DIR/generate-provider.mjs" "$@" diff --git a/bin/normalize.mjs b/bin/normalize.mjs new file mode 100644 index 0000000..01ffcdf --- /dev/null +++ b/bin/normalize.mjs @@ -0,0 +1,56 @@ +#!/usr/bin/env node + +import { providerdev } from '@stackql/provider-utils'; +import fs from 'fs'; + +async function normalizeSpecs() { + const args = process.argv.slice(2); + const getArg = (flag) => { + const index = args.indexOf(flag); + return index !== -1 ? args[index + 1] : null; + }; + + const apiDir = getArg('--api-dir'); + const verbose = args.includes('--verbose'); + const bareArrayOverridesStr = getArg('--bare-array-overrides'); + + if (!apiDir) { + console.error('Error: Missing required arguments'); + console.error('Usage: node normalize.mjs --api-dir DIR [--verbose] [--bare-array-overrides JSON|FILE.json]'); + process.exit(1); + } + + // --bare-array-overrides accepts inline JSON or a path to a JSON file + let bareArrayOverrides = null; + if (bareArrayOverridesStr) { + try { + const trimmed = bareArrayOverridesStr.trim(); + bareArrayOverrides = trimmed.startsWith('{') + ? JSON.parse(trimmed) + : JSON.parse(fs.readFileSync(trimmed, 'utf8')); + } catch (err) { + console.error('Error parsing bare array overrides (inline JSON or file path):', err.message); + process.exit(1); + } + } + + try { + const stats = await providerdev.normalize({ apiDir, verbose, bareArrayOverrides }); + console.log('Normalize completed:', JSON.stringify({ + filesProcessed: stats.filesProcessed, + allOfFlattened: stats.allOfFlattened, + oneOfRenamed: stats.oneOfRenamed, + anyOfRenamed: stats.anyOfRenamed, + misplacedKeywordsStripped: stats.stripped.length, + opaqueObjectsConverted: stats.opaqueConverted.length, + pathParamsLifted: stats.pathParamsLifted, + serversStripped: stats.serversStripped, + bareArraysWrapped: stats.bareArrayWrapped + }, null, 2)); + } catch (error) { + console.error('Error normalizing specs:', error); + process.exit(1); + } +} + +normalizeSpecs(); diff --git a/bin/normalize.sh b/bin/normalize.sh new file mode 100644 index 0000000..b0a04c0 --- /dev/null +++ b/bin/normalize.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# Thin passthrough to normalize.mjs (kept for bash users; `npm run normalize` calls normalize.mjs directly) + +set -e + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +node "$SCRIPT_DIR/normalize.mjs" "$@" diff --git a/package-lock.json b/package-lock.json index 89f374e..2d36f93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,527 +1,566 @@ -{ - "name": "stackql-provider-digitalocean", - "version": "0.1.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "stackql-provider-digitalocean", - "version": "0.1.0", - "dependencies": { - "@stackql/pgwire-lite": "^1.0.1", - "@stackql/provider-utils": "^0.5.0" - }, - "engines": { - "node": ">=14.16.0" - } - }, - "node_modules/@apidevtools/json-schema-ref-parser": { - "version": "11.7.2", - "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-11.7.2.tgz", - "integrity": "sha512-4gY54eEGEstClvEkGnwVkTkrx0sqwemEFG5OSRRn3tD91XH0+Q8XIkYIfo7IwEWPpJZwILb9GUXeShtplRc/eA==", - "license": "MIT", - "dependencies": { - "@jsdevtools/ono": "^7.1.3", - "@types/json-schema": "^7.0.15", - "js-yaml": "^4.1.0" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/philsturgeon" - } - }, - "node_modules/@apidevtools/openapi-schemas": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@apidevtools/openapi-schemas/-/openapi-schemas-2.1.0.tgz", - "integrity": "sha512-Zc1AlqrJlX3SlpupFGpiLi2EbteyP7fXmUOGup6/DnkRgjP9bgMM/ag+n91rsv0U1Gpz0H3VILA/o3bW7Ua6BQ==", - "license": "MIT", - "engines": { - "node": ">=10" - } - }, - "node_modules/@apidevtools/swagger-methods": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@apidevtools/swagger-methods/-/swagger-methods-3.0.2.tgz", - "integrity": "sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==", - "license": "MIT" - }, - "node_modules/@apidevtools/swagger-parser": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@apidevtools/swagger-parser/-/swagger-parser-10.1.1.tgz", - "integrity": "sha512-u/kozRnsPO/x8QtKYJOqoGtC4kH6yg1lfYkB9Au0WhYB0FNLpyFusttQtvhlwjtG3rOwiRz4D8DnnXa8iEpIKA==", - "license": "MIT", - "dependencies": { - "@apidevtools/json-schema-ref-parser": "11.7.2", - "@apidevtools/openapi-schemas": "^2.1.0", - "@apidevtools/swagger-methods": "^3.0.2", - "@jsdevtools/ono": "^7.1.3", - "ajv": "^8.17.1", - "ajv-draft-04": "^1.0.0", - "call-me-maybe": "^1.0.2" - }, - "peerDependencies": { - "openapi-types": ">=7" - } - }, - "node_modules/@colors/colors": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", - "integrity": "sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==", - "license": "MIT", - "engines": { - "node": ">=0.1.90" - } - }, - "node_modules/@dabh/diagnostics": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz", - "integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==", - "license": "MIT", - "dependencies": { - "colorspace": "1.1.x", - "enabled": "2.0.x", - "kuler": "^2.0.0" - } - }, - "node_modules/@jsdevtools/ono": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", - "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==", - "license": "MIT" - }, - "node_modules/@stackql/deno-openapi-dereferencer": { - "name": "@jsr/stackql__deno-openapi-dereferencer", - "version": "0.3.1", - "resolved": "https://npm.jsr.io/~/11/@jsr/stackql__deno-openapi-dereferencer/0.3.1.tgz", - "integrity": "sha512-7Ucdom3SYxvzp7VwzulQMe66E+1LeCZIprFQ70PwRPIUfL90bYNQDrLfe5L1WaB+X7StWdHmoFSFxoa9RDlN7w==", - "dependencies": { - "jsonpath-plus": "7.0.0" - } - }, - "node_modules/@stackql/pgwire-lite": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stackql/pgwire-lite/-/pgwire-lite-1.0.1.tgz", - "integrity": "sha512-jgA6ogzlXySZ1xiJzBxuvgRNu9V38Gs3qUZ4AjinlT7hj+8RH3UhYaDvyBd33QWiK3tVNkglYcnXPQ7q0+rmNA==", - "license": "MIT", - "dependencies": { - "winston": "^3.14.2" - } - }, - "node_modules/@stackql/provider-utils": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@stackql/provider-utils/-/provider-utils-0.5.0.tgz", - "integrity": "sha512-KwHVVCBC0XwbDI/dDb7FM1fEFqqnXQ0mPJFmiEYkASNs5mXQW0jbAazVBeOFO4JN0PN6AyX6D/vWCVOmpnz9jw==", - "license": "MIT", - "dependencies": { - "@apidevtools/swagger-parser": "^10.1.1", - "@stackql/deno-openapi-dereferencer": "npm:@jsr/stackql__deno-openapi-dereferencer@^0.3.1", - "csv-parser": "^3.2.0", - "js-yaml": "^4.1.0", - "pluralize": "^8.0.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "license": "MIT" - }, - "node_modules/@types/triple-beam": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz", - "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==", - "license": "MIT" - }, - "node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ajv-draft-04": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz", - "integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==", - "license": "MIT", - "peerDependencies": { - "ajv": "^8.5.0" - }, - "peerDependenciesMeta": { - "ajv": { - "optional": true - } - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "license": "Python-2.0" - }, - "node_modules/async": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", - "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", - "license": "MIT" - }, - "node_modules/call-me-maybe": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", - "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==", - "license": "MIT" - }, - "node_modules/color": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", - "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.3", - "color-string": "^1.6.0" - } - }, - "node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "license": "MIT" - }, - "node_modules/color-string": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", - "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", - "license": "MIT", - "dependencies": { - "color-name": "^1.0.0", - "simple-swizzle": "^0.2.2" - } - }, - "node_modules/colorspace": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz", - "integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==", - "license": "MIT", - "dependencies": { - "color": "^3.1.3", - "text-hex": "1.0.x" - } - }, - "node_modules/csv-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/csv-parser/-/csv-parser-3.2.0.tgz", - "integrity": "sha512-fgKbp+AJbn1h2dcAHKIdKNSSjfp43BZZykXsCjzALjKy80VXQNHPFJ6T9Afwdzoj24aMkq8GwDS7KGcDPpejrA==", - "license": "MIT", - "bin": { - "csv-parser": "bin/csv-parser" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/enabled": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz", - "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==", - "license": "MIT" - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "license": "MIT" - }, - "node_modules/fast-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", - "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fastify" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fastify" - } - ], - "license": "BSD-3-Clause" - }, - "node_modules/fecha": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", - "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==", - "license": "MIT" - }, - "node_modules/fn.name": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", - "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==", - "license": "MIT" - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "license": "ISC" - }, - "node_modules/is-arrayish": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.4.tgz", - "integrity": "sha512-m6UrgzFVUYawGBh1dUsWR5M2Clqic9RVXC/9f8ceNlv2IcO9j9J/z8UoCLPqtsPBFNzEpfR3xftohbfqDx8EQA==", - "license": "MIT" - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "license": "MIT" - }, - "node_modules/jsonpath-plus": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-7.0.0.tgz", - "integrity": "sha512-MH4UnrWrU1hJGVEyEyjvYgONkzNTO6Yol0nq18EMnUQ/ZC5cTuJheirXXIwu1b9mZ6t3XL0P79gPsu+zlTnDIQ==", - "license": "MIT", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/kuler": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", - "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==", - "license": "MIT" - }, - "node_modules/logform": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/logform/-/logform-2.7.0.tgz", - "integrity": "sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ==", - "license": "MIT", - "dependencies": { - "@colors/colors": "1.6.0", - "@types/triple-beam": "^1.3.2", - "fecha": "^4.2.0", - "ms": "^2.1.1", - "safe-stable-stringify": "^2.3.1", - "triple-beam": "^1.3.0" - }, - "engines": { - "node": ">= 12.0.0" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/one-time": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", - "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", - "license": "MIT", - "dependencies": { - "fn.name": "1.x.x" - } - }, - "node_modules/openapi-types": { - "version": "12.1.3", - "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz", - "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==", - "license": "MIT", - "peer": true - }, - "node_modules/pluralize": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", - "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/safe-stable-stringify": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", - "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", - "license": "MIT", - "engines": { - "node": ">=10" - } - }, - "node_modules/simple-swizzle": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.4.tgz", - "integrity": "sha512-nAu1WFPQSMNr2Zn9PGSZK9AGn4t/y97lEm+MXTtUDwfP0ksAIX4nO+6ruD9Jwut4C49SB1Ws+fbXsm/yScWOHw==", - "license": "MIT", - "dependencies": { - "is-arrayish": "^0.3.1" - } - }, - "node_modules/stack-trace": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", - "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==", - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/text-hex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", - "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==", - "license": "MIT" - }, - "node_modules/triple-beam": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz", - "integrity": "sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==", - "license": "MIT", - "engines": { - "node": ">= 14.0.0" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "license": "MIT" - }, - "node_modules/winston": { - "version": "3.17.0", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.17.0.tgz", - "integrity": "sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw==", - "license": "MIT", - "dependencies": { - "@colors/colors": "^1.6.0", - "@dabh/diagnostics": "^2.0.2", - "async": "^3.2.3", - "is-stream": "^2.0.0", - "logform": "^2.7.0", - "one-time": "^1.0.0", - "readable-stream": "^3.4.0", - "safe-stable-stringify": "^2.3.1", - "stack-trace": "0.0.x", - "triple-beam": "^1.3.0", - "winston-transport": "^4.9.0" - }, - "engines": { - "node": ">= 12.0.0" - } - }, - "node_modules/winston-transport": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.9.0.tgz", - "integrity": "sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==", - "license": "MIT", - "dependencies": { - "logform": "^2.7.0", - "readable-stream": "^3.6.2", - "triple-beam": "^1.3.0" - }, - "engines": { - "node": ">= 12.0.0" - } - } - } -} +{ + "name": "stackql-provider-openai", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "stackql-provider-openai", + "version": "0.1.0", + "dependencies": { + "@apidevtools/swagger-parser": "^12.0.0", + "@stackql/pgwire-lite": "^1.0.1", + "@stackql/provider-utils": "^0.7.6", + "js-yaml": "^4.1.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@apidevtools/json-schema-ref-parser": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-14.0.1.tgz", + "integrity": "sha512-Oc96zvmxx1fqoSEdUmfmvvb59/KDOnUoJ7s2t7bISyAn0XEz57LCCw8k2Y4Pf3mwKaZLMciESALORLgfe2frCw==", + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.15", + "js-yaml": "^4.1.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/philsturgeon" + } + }, + "node_modules/@apidevtools/openapi-schemas": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@apidevtools/openapi-schemas/-/openapi-schemas-2.1.0.tgz", + "integrity": "sha512-Zc1AlqrJlX3SlpupFGpiLi2EbteyP7fXmUOGup6/DnkRgjP9bgMM/ag+n91rsv0U1Gpz0H3VILA/o3bW7Ua6BQ==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/@apidevtools/swagger-methods": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@apidevtools/swagger-methods/-/swagger-methods-3.0.2.tgz", + "integrity": "sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==", + "license": "MIT" + }, + "node_modules/@apidevtools/swagger-parser": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/@apidevtools/swagger-parser/-/swagger-parser-12.1.0.tgz", + "integrity": "sha512-e5mJoswsnAX0jG+J09xHFYQXb/bUc5S3pLpMxUuRUA2H8T2kni3yEoyz2R3Dltw5f4A6j6rPNMpWTK+iVDFlng==", + "license": "MIT", + "dependencies": { + "@apidevtools/json-schema-ref-parser": "14.0.1", + "@apidevtools/openapi-schemas": "^2.1.0", + "@apidevtools/swagger-methods": "^3.0.2", + "ajv": "^8.17.1", + "ajv-draft-04": "^1.0.0", + "call-me-maybe": "^1.0.2" + }, + "peerDependencies": { + "openapi-types": ">=7" + } + }, + "node_modules/@colors/colors": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", + "integrity": "sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==", + "license": "MIT", + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/@dabh/diagnostics": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz", + "integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==", + "license": "MIT", + "dependencies": { + "colorspace": "1.1.x", + "enabled": "2.0.x", + "kuler": "^2.0.0" + } + }, + "node_modules/@jsdevtools/ono": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", + "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==", + "license": "MIT" + }, + "node_modules/@stackql/deno-openapi-dereferencer": { + "name": "@jsr/stackql__deno-openapi-dereferencer", + "version": "0.3.1", + "resolved": "https://npm.jsr.io/~/11/@jsr/stackql__deno-openapi-dereferencer/0.3.1.tgz", + "integrity": "sha512-7Ucdom3SYxvzp7VwzulQMe66E+1LeCZIprFQ70PwRPIUfL90bYNQDrLfe5L1WaB+X7StWdHmoFSFxoa9RDlN7w==", + "dependencies": { + "jsonpath-plus": "7.0.0" + } + }, + "node_modules/@stackql/pgwire-lite": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stackql/pgwire-lite/-/pgwire-lite-1.0.1.tgz", + "integrity": "sha512-jgA6ogzlXySZ1xiJzBxuvgRNu9V38Gs3qUZ4AjinlT7hj+8RH3UhYaDvyBd33QWiK3tVNkglYcnXPQ7q0+rmNA==", + "license": "MIT", + "dependencies": { + "winston": "^3.14.2" + } + }, + "node_modules/@stackql/provider-utils": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/@stackql/provider-utils/-/provider-utils-0.7.6.tgz", + "integrity": "sha512-1aa7xdVKoA9RppNIE/ojOTmc8k/I+glyKqAjZjTvcA87kyP7gmbMJPOdsX+LDFxSJ5xfslxTR+/ZZD3M5HZsiw==", + "license": "MIT", + "dependencies": { + "@apidevtools/swagger-parser": "^10.1.1", + "@stackql/deno-openapi-dereferencer": "npm:@jsr/stackql__deno-openapi-dereferencer@^0.3.1", + "csv-parser": "^3.2.0", + "js-yaml": "^4.1.0", + "pluralize": "^8.0.0" + }, + "bin": { + "docgen-utils": "bin/docgen-utils.mjs", + "provider-dev-utils": "bin/provider-dev-utils.mjs" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@stackql/provider-utils/node_modules/@apidevtools/json-schema-ref-parser": { + "version": "11.7.2", + "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-11.7.2.tgz", + "integrity": "sha512-4gY54eEGEstClvEkGnwVkTkrx0sqwemEFG5OSRRn3tD91XH0+Q8XIkYIfo7IwEWPpJZwILb9GUXeShtplRc/eA==", + "license": "MIT", + "dependencies": { + "@jsdevtools/ono": "^7.1.3", + "@types/json-schema": "^7.0.15", + "js-yaml": "^4.1.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/philsturgeon" + } + }, + "node_modules/@stackql/provider-utils/node_modules/@apidevtools/swagger-parser": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/@apidevtools/swagger-parser/-/swagger-parser-10.1.1.tgz", + "integrity": "sha512-u/kozRnsPO/x8QtKYJOqoGtC4kH6yg1lfYkB9Au0WhYB0FNLpyFusttQtvhlwjtG3rOwiRz4D8DnnXa8iEpIKA==", + "license": "MIT", + "dependencies": { + "@apidevtools/json-schema-ref-parser": "11.7.2", + "@apidevtools/openapi-schemas": "^2.1.0", + "@apidevtools/swagger-methods": "^3.0.2", + "@jsdevtools/ono": "^7.1.3", + "ajv": "^8.17.1", + "ajv-draft-04": "^1.0.0", + "call-me-maybe": "^1.0.2" + }, + "peerDependencies": { + "openapi-types": ">=7" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "license": "MIT" + }, + "node_modules/@types/triple-beam": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz", + "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==", + "license": "MIT" + }, + "node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-draft-04": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz", + "integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==", + "license": "MIT", + "peerDependencies": { + "ajv": "^8.5.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "license": "MIT" + }, + "node_modules/call-me-maybe": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", + "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==", + "license": "MIT" + }, + "node_modules/color": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", + "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.3", + "color-string": "^1.6.0" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "license": "MIT" + }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "license": "MIT", + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "node_modules/colorspace": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz", + "integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==", + "license": "MIT", + "dependencies": { + "color": "^3.1.3", + "text-hex": "1.0.x" + } + }, + "node_modules/csv-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/csv-parser/-/csv-parser-3.2.0.tgz", + "integrity": "sha512-fgKbp+AJbn1h2dcAHKIdKNSSjfp43BZZykXsCjzALjKy80VXQNHPFJ6T9Afwdzoj24aMkq8GwDS7KGcDPpejrA==", + "license": "MIT", + "bin": { + "csv-parser": "bin/csv-parser" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/enabled": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz", + "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==", + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fecha": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", + "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==", + "license": "MIT" + }, + "node_modules/fn.name": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", + "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==", + "license": "MIT" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/is-arrayish": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.4.tgz", + "integrity": "sha512-m6UrgzFVUYawGBh1dUsWR5M2Clqic9RVXC/9f8ceNlv2IcO9j9J/z8UoCLPqtsPBFNzEpfR3xftohbfqDx8EQA==", + "license": "MIT" + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/jsonpath-plus": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-7.0.0.tgz", + "integrity": "sha512-MH4UnrWrU1hJGVEyEyjvYgONkzNTO6Yol0nq18EMnUQ/ZC5cTuJheirXXIwu1b9mZ6t3XL0P79gPsu+zlTnDIQ==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/kuler": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", + "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==", + "license": "MIT" + }, + "node_modules/logform": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.7.0.tgz", + "integrity": "sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ==", + "license": "MIT", + "dependencies": { + "@colors/colors": "1.6.0", + "@types/triple-beam": "^1.3.2", + "fecha": "^4.2.0", + "ms": "^2.1.1", + "safe-stable-stringify": "^2.3.1", + "triple-beam": "^1.3.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/one-time": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", + "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", + "license": "MIT", + "dependencies": { + "fn.name": "1.x.x" + } + }, + "node_modules/openapi-types": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz", + "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==", + "license": "MIT", + "peer": true + }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safe-stable-stringify": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-swizzle": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.4.tgz", + "integrity": "sha512-nAu1WFPQSMNr2Zn9PGSZK9AGn4t/y97lEm+MXTtUDwfP0ksAIX4nO+6ruD9Jwut4C49SB1Ws+fbXsm/yScWOHw==", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/text-hex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==", + "license": "MIT" + }, + "node_modules/triple-beam": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz", + "integrity": "sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==", + "license": "MIT", + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/winston": { + "version": "3.17.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.17.0.tgz", + "integrity": "sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw==", + "license": "MIT", + "dependencies": { + "@colors/colors": "^1.6.0", + "@dabh/diagnostics": "^2.0.2", + "async": "^3.2.3", + "is-stream": "^2.0.0", + "logform": "^2.7.0", + "one-time": "^1.0.0", + "readable-stream": "^3.4.0", + "safe-stable-stringify": "^2.3.1", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.9.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/winston-transport": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.9.0.tgz", + "integrity": "sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==", + "license": "MIT", + "dependencies": { + "logform": "^2.7.0", + "readable-stream": "^3.6.2", + "triple-beam": "^1.3.0" + }, + "engines": { + "node": ">= 12.0.0" + } + } + } +} diff --git a/package.json b/package.json index c56e58b..421f9ca 100644 --- a/package.json +++ b/package.json @@ -1,28 +1,36 @@ -{ - "name": "stackql-provider-digitalocean", - "version": "0.1.0", - "description": "StackQL Provider for Digital Ocean", - "type": "module", - "scripts": { - "generate-docs": "./bin/generate-docs.sh", - "split": "./bin/split.sh", - "generate-mappings": "./bin/generate-mappings.sh", - "generate-provider": "./bin/generate-provider.sh", - "start-server": "bash ./bin/start-server.sh", - "stop-server": "bash ./bin/stop-server.sh", - "server-status": "bash ./bin/server-status.sh", - "test-meta-routes": "node ./bin/test-meta-routes.cjs" - }, - "dependencies": { - "@stackql/pgwire-lite": "^1.0.1", - "@stackql/provider-utils": "^0.5.0" - }, - "keywords": [ - "stackql", - "digitalocean", - "provider" - ], - "engines": { - "node": ">=14.16.0" - } -} \ No newline at end of file +{ + "name": "stackql-provider-openai", + "version": "0.1.0", + "description": "StackQL Provider for OpenAI", + "type": "module", + "scripts": { + "fetch-spec": "bash ./bin/fetch-spec.sh", + "inventory-predecessor": "node ./provider-dev/scripts/inventory_predecessor.mjs", + "clean-specs": "node ./provider-dev/scripts/clean_specs.mjs", + "pre-normalize": "node ./provider-dev/scripts/pre_normalize.mjs", + "normalize": "node ./bin/normalize.mjs", + "lower-residual-variants": "node ./provider-dev/scripts/lower_residual_variants.mjs", + "generate-docs": "./bin/generate-docs.sh", + "split": "./bin/split.sh", + "generate-mappings": "./bin/generate-mappings.sh", + "generate-provider": "node ./bin/generate-provider.mjs", + "start-server": "bash ./bin/start-server.sh", + "stop-server": "bash ./bin/stop-server.sh", + "server-status": "bash ./bin/server-status.sh", + "test-meta-routes": "node ./bin/test-meta-routes.cjs" + }, + "dependencies": { + "@apidevtools/swagger-parser": "^12.0.0", + "@stackql/pgwire-lite": "^1.0.1", + "@stackql/provider-utils": "^0.7.6", + "js-yaml": "^4.1.0" + }, + "keywords": [ + "stackql", + "openai", + "provider" + ], + "engines": { + "node": ">=20" + } +} diff --git a/provider-dev/config/all_services.csv b/provider-dev/config/all_services.csv new file mode 100644 index 0000000..f9e3e87 --- /dev/null +++ b/provider-dev/config/all_services.csv @@ -0,0 +1,197 @@ +filename,path,operationId,formatted_op_id,verb,response_object,tags,formatted_tags,stackql_resource_name,stackql_method_name,stackql_verb,stackql_object_key,op_description +assistants.yaml,/assistants,listAssistants,list_assistants,get,ListAssistantsResponse,Assistants,assistants,assistants,list,select,$.data,Returns a list of assistants. +assistants.yaml,/assistants,createAssistant,create_assistant,post,AssistantObject,Assistants,assistants,assistants,create,insert,,Create an assistant with a model and instructions. +assistants.yaml,/assistants/{assistant_id},getAssistant,get_assistant,get,AssistantObject,Assistants,assistants,assistants,get,select,,Retrieves an assistant. +assistants.yaml,/assistants/{assistant_id},modifyAssistant,modify_assistant,post,AssistantObject,Assistants,assistants,assistants,update,update,,Modifies an assistant. +assistants.yaml,/assistants/{assistant_id},deleteAssistant,delete_assistant,delete,DeleteAssistantResponse,Assistants,assistants,assistants,delete,delete,,Delete an assistant. +assistants.yaml,/threads,createThread,create_thread,post,ThreadObject,Assistants,assistants,threads,create,insert,,Create a thread. +assistants.yaml,/threads/runs,createThreadAndRun,create_thread_and_run,post,RunObject,Assistants,assistants,threads,create_thread_and_run,exec,,Create a thread and run it in one request. +assistants.yaml,/threads/{thread_id},getThread,get_thread,get,ThreadObject,Assistants,assistants,threads,get,select,,Retrieves a thread. +assistants.yaml,/threads/{thread_id},modifyThread,modify_thread,post,ThreadObject,Assistants,assistants,threads,update,update,,Modifies a thread. +assistants.yaml,/threads/{thread_id},deleteThread,delete_thread,delete,DeleteThreadResponse,Assistants,assistants,threads,delete,delete,,Delete a thread. +assistants.yaml,/threads/{thread_id}/messages,listMessages,list_messages,get,ListMessagesResponse,Assistants,assistants,messages,list,select,$.data,Returns a list of messages for a given thread. +assistants.yaml,/threads/{thread_id}/messages,createMessage,create_message,post,MessageObject,Assistants,assistants,messages,create,insert,,Create a message. +assistants.yaml,/threads/{thread_id}/messages/{message_id},getMessage,get_message,get,MessageObject,Assistants,assistants,messages,get,select,,Retrieve a message. +assistants.yaml,/threads/{thread_id}/messages/{message_id},modifyMessage,modify_message,post,MessageObject,Assistants,assistants,messages,update,update,,Modifies a message. +assistants.yaml,/threads/{thread_id}/messages/{message_id},deleteMessage,delete_message,delete,DeleteMessageResponse,Assistants,assistants,messages,delete,delete,,Deletes a message. +assistants.yaml,/threads/{thread_id}/runs,listRuns,list_runs,get,ListRunsResponse,Assistants,assistants,runs,list,select,$.data,Returns a list of runs belonging to a thread. +assistants.yaml,/threads/{thread_id}/runs,createRun,create_run,post,RunObject,Assistants,assistants,runs,create,insert,,Create a run. +assistants.yaml,/threads/{thread_id}/runs/{run_id},getRun,get_run,get,RunObject,Assistants,assistants,runs,get,select,,Retrieves a run. +assistants.yaml,/threads/{thread_id}/runs/{run_id},modifyRun,modify_run,post,RunObject,Assistants,assistants,runs,update,update,,Modifies a run. +assistants.yaml,/threads/{thread_id}/runs/{run_id}/cancel,cancelRun,cancel_run,post,RunObject,Assistants,assistants,runs,cancel,exec,,Cancels a run that is `in_progress`. +assistants.yaml,/threads/{thread_id}/runs/{run_id}/steps,listRunSteps,list_run_steps,get,ListRunStepsResponse,Assistants,assistants,run_steps,list,select,$.data,Returns a list of run steps belonging to a run. +assistants.yaml,/threads/{thread_id}/runs/{run_id}/steps/{step_id},getRunStep,get_run_step,get,RunStepObject,Assistants,assistants,run_steps,get,select,,Retrieves a run step. +assistants.yaml,/threads/{thread_id}/runs/{run_id}/submit_tool_outputs,submitToolOuputsToRun,submit_tool_ouputs_to_run,post,RunObject,Assistants,assistants,runs,submit_tool_outputs,exec,,"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. +" +batches.yaml,/batches,createBatch,create_batch,post,Batch,Batch,batch,batches,create,insert,,Creates and executes a batch from an uploaded file of requests +batches.yaml,/batches,listBatches,list_batches,get,ListBatchesResponse,Batch,batch,batches,list,select,$.data,List your organization's batches. +batches.yaml,/batches/{batch_id},retrieveBatch,retrieve_batch,get,Batch,Batch,batch,batches,get,select,,Retrieves a batch. +batches.yaml,/batches/{batch_id}/cancel,cancelBatch,cancel_batch,post,Batch,Batch,batch,batches,cancel,exec,,"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." +containers.yaml,/containers,ListContainers,list_containers,get,ContainerListResource,Containers,containers,containers,list,select,$.data,List Containers +containers.yaml,/containers,CreateContainer,create_container,post,ContainerResource,Containers,containers,containers,create,insert,,Create Container +containers.yaml,/containers/{container_id},RetrieveContainer,retrieve_container,get,ContainerResource,Containers,containers,containers,get,select,,Retrieve Container +containers.yaml,/containers/{container_id},DeleteContainer,delete_container,delete,,Containers,containers,containers,delete,delete,,Delete Container +containers.yaml,/containers/{container_id}/files,CreateContainerFile,create_container_file,post,ContainerFileResource,Containers,containers,files,create,insert,,"Create a Container File + +You can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID. +" +containers.yaml,/containers/{container_id}/files,ListContainerFiles,list_container_files,get,ContainerFileListResource,Containers,containers,files,list,select,$.data,List Container files +containers.yaml,/containers/{container_id}/files/{file_id},RetrieveContainerFile,retrieve_container_file,get,ContainerFileResource,Containers,containers,files,get,select,,Retrieve Container File +containers.yaml,/containers/{container_id}/files/{file_id},DeleteContainerFile,delete_container_file,delete,,Containers,containers,files,delete,delete,,Delete Container File +conversations.yaml,/conversations/{conversation_id}/items,createConversationItems,create_conversation_items,post,ConversationItemList,Conversations,conversations,items,create,insert,,Create items in a conversation with the given ID. +conversations.yaml,/conversations/{conversation_id}/items,listConversationItems,list_conversation_items,get,ConversationItemList,Conversations,conversations,items,list,select,$.data,List all items for a conversation with the given ID. +conversations.yaml,/conversations/{conversation_id}/items/{item_id},getConversationItem,get_conversation_item,get,ConversationItem,Conversations,conversations,items,get,select,,Get a single item from a conversation with the given IDs. +conversations.yaml,/conversations/{conversation_id}/items/{item_id},deleteConversationItem,delete_conversation_item,delete,ConversationResource,Conversations,conversations,items,delete,delete,,Delete an item from a conversation with the given IDs. +conversations.yaml,/conversations,createConversation,create_conversation,post,ConversationResource,Conversations,conversations,conversations,create,insert,,Create a conversation. +conversations.yaml,/conversations/{conversation_id},getConversation,get_conversation,get,ConversationResource,Conversations,conversations,conversations,get,select,,Get a conversation +conversations.yaml,/conversations/{conversation_id},deleteConversation,delete_conversation,delete,DeletedConversationResource,Conversations,conversations,conversations,delete,delete,,Delete a conversation. Items in the conversation will not be deleted. +conversations.yaml,/conversations/{conversation_id},updateConversation,update_conversation,post,ConversationResource,Conversations,conversations,conversations,update,update,,Update a conversation +evals.yaml,/evals,listEvals,list_evals,get,EvalList,Evals,evals,evals,list,select,$.data,"List evaluations for a project. +" +evals.yaml,/evals,createEval,create_eval,post,Eval,Evals,evals,evals,create,insert,,"Create the structure of an evaluation that can be used to test a model's performance. +An 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. +For more information, see the [Evals guide](/docs/guides/evals). +" +evals.yaml,/evals/{eval_id},getEval,get_eval,get,Eval,Evals,evals,evals,get,select,,"Get an evaluation by ID. +" +evals.yaml,/evals/{eval_id},updateEval,update_eval,post,Eval,Evals,evals,evals,update,update,,"Update certain properties of an evaluation. +" +evals.yaml,/evals/{eval_id},deleteEval,delete_eval,delete,,Evals,evals,evals,delete,delete,,"Delete an evaluation. +" +evals.yaml,/evals/{eval_id}/runs,getEvalRuns,get_eval_runs,get,EvalRunList,Evals,evals,runs,list,select,$.data,"Get a list of runs for an evaluation. +" +evals.yaml,/evals/{eval_id}/runs,createEvalRun,create_eval_run,post,EvalRun,Evals,evals,runs,create,insert,,"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. +" +evals.yaml,/evals/{eval_id}/runs/{run_id},getEvalRun,get_eval_run,get,EvalRun,Evals,evals,runs,get,select,,"Get an evaluation run by ID. +" +evals.yaml,/evals/{eval_id}/runs/{run_id},cancelEvalRun,cancel_eval_run,post,EvalRun,Evals,evals,runs,cancel,exec,,"Cancel an ongoing evaluation run. +" +evals.yaml,/evals/{eval_id}/runs/{run_id},deleteEvalRun,delete_eval_run,delete,,Evals,evals,runs,delete,delete,,"Delete an eval run. +" +evals.yaml,/evals/{eval_id}/runs/{run_id}/output_items,getEvalRunOutputItems,get_eval_run_output_items,get,EvalRunOutputItemList,Evals,evals,run_output_items,list,select,$.data,"Get a list of output items for an evaluation run. +" +evals.yaml,/evals/{eval_id}/runs/{run_id}/output_items/{output_item_id},getEvalRunOutputItem,get_eval_run_output_item,get,EvalRunOutputItem,Evals,evals,run_output_items,get,select,,"Get an evaluation run output item by ID. +" +files.yaml,/files,listFiles,list_files,get,ListFilesResponse,Files,files,files,list,select,$.data,Returns a list of files. +files.yaml,/files,createFile,create_file,post,OpenAIFile,Files,files,skip_this_resource,,,,"Upload a file that can be used across various endpoints. Individual files +can be up to 512 MB, and each project can store up to 2.5 TB of files in +total. There is no organization-wide storage limit. Uploads to this +endpoint are rate-limited to 1,000 requests per minute per authenticated +user. + +- The Assistants API supports files up to 2 million tokens and of specific + file types. See the [Assistants Tools guide](/docs/assistants/tools) for + details. +- The Fine-tuning API only supports `.jsonl` files. The input also has + certain required formats for fine-tuning + [chat](/docs/api-reference/fine-tuning/chat-input) or + [completions](/docs/api-reference/fine-tuning/completions-input) models. +- The Batch API only supports `.jsonl` files up to 200 MB in size. The input + also has a specific required + [format](/docs/api-reference/batch/request-input). +- 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_stores/{vector_store_id}/file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch) + instead of attaching them one by one. Vector store attachment has separate + limits from file upload, including 2,000 attached files per minute per + organization. + +Please [contact us](https://help.openai.com/) if you need to increase these +storage limits. +" +files.yaml,/files/{file_id},deleteFile,delete_file,delete,DeleteFileResponse,Files,files,files,delete,delete,,Delete a file and remove it from all vector stores. +files.yaml,/files/{file_id},retrieveFile,retrieve_file,get,OpenAIFile,Files,files,files,get,select,,Returns information about a specific file. +fine_tuning.yaml,/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions,listFineTuningCheckpointPermissions,list_fine_tuning_checkpoint_permissions,get,ListFineTuningCheckpointPermissionResponse,Fine-tuning,fine_tuning,checkpoint_permissions,list,select,$.data,"**NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + +Organization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint. +" +fine_tuning.yaml,/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions,createFineTuningCheckpointPermission,create_fine_tuning_checkpoint_permission,post,ListFineTuningCheckpointPermissionResponse,Fine-tuning,fine_tuning,checkpoint_permissions,create,insert,,"**NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys). + +This enables organization owners to share fine-tuned models with other projects in their organization. +" +fine_tuning.yaml,/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id},deleteFineTuningCheckpointPermission,delete_fine_tuning_checkpoint_permission,delete,DeleteFineTuningCheckpointPermissionResponse,Fine-tuning,fine_tuning,checkpoint_permissions,delete,delete,,"**NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + +Organization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint. +" +fine_tuning.yaml,/fine_tuning/jobs,createFineTuningJob,create_fine_tuning_job,post,FineTuningJob,Fine-tuning,fine_tuning,jobs,create,insert,,"Creates a fine-tuning job which begins the process of creating a new model from a given dataset. + +Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. + +[Learn more about fine-tuning](/docs/guides/model-optimization) +" +fine_tuning.yaml,/fine_tuning/jobs,listPaginatedFineTuningJobs,list_paginated_fine_tuning_jobs,get,ListPaginatedFineTuningJobsResponse,Fine-tuning,fine_tuning,jobs,list,select,$.data,"List your organization's fine-tuning jobs +" +fine_tuning.yaml,/fine_tuning/jobs/{fine_tuning_job_id},retrieveFineTuningJob,retrieve_fine_tuning_job,get,FineTuningJob,Fine-tuning,fine_tuning,jobs,get,select,,"Get info about a fine-tuning job. + +[Learn more about fine-tuning](/docs/guides/model-optimization) +" +fine_tuning.yaml,/fine_tuning/jobs/{fine_tuning_job_id}/cancel,cancelFineTuningJob,cancel_fine_tuning_job,post,FineTuningJob,Fine-tuning,fine_tuning,jobs,cancel,exec,,"Immediately cancel a fine-tune job. +" +fine_tuning.yaml,/fine_tuning/jobs/{fine_tuning_job_id}/checkpoints,listFineTuningJobCheckpoints,list_fine_tuning_job_checkpoints,get,ListFineTuningJobCheckpointsResponse,Fine-tuning,fine_tuning,checkpoints,list,select,$.data,"List checkpoints for a fine-tuning job. +" +fine_tuning.yaml,/fine_tuning/jobs/{fine_tuning_job_id}/events,listFineTuningEvents,list_fine_tuning_events,get,ListFineTuningJobEventsResponse,Fine-tuning,fine_tuning,events,list,select,$.data,"Get status updates for a fine-tuning job. +" +fine_tuning.yaml,/fine_tuning/jobs/{fine_tuning_job_id}/pause,pauseFineTuningJob,pause_fine_tuning_job,post,FineTuningJob,Fine-tuning,fine_tuning,jobs,pause,exec,,"Pause a fine-tune job. +" +fine_tuning.yaml,/fine_tuning/jobs/{fine_tuning_job_id}/resume,resumeFineTuningJob,resume_fine_tuning_job,post,FineTuningJob,Fine-tuning,fine_tuning,jobs,resume,exec,,"Resume a fine-tune job. +" +models.yaml,/models,listModels,list_models,get,ListModelsResponse,Models,models,models,list,select,$.data,"Lists the currently available models, and provides basic information about each one such as the owner and availability." +models.yaml,/models/{model},retrieveModel,retrieve_model,get,Model,Models,models,models,get,select,,"Retrieves a model instance, providing basic information about the model such as the owner and permissioning." +models.yaml,/models/{model},deleteModel,delete_model,delete,DeleteModelResponse,Models,models,models,delete,delete,,Delete a fine-tuned model. You must have the Owner role in your organization to delete a model. +skills.yaml,/skills,CreateSkill,create_skill,post,SkillResource,Skills,skills,skip_this_resource,,,,Create a new skill. +skills.yaml,/skills,ListSkills,list_skills,get,SkillListResource,Skills,skills,skills,list,select,$.data,List all skills for the current project. +skills.yaml,/skills/{skill_id},DeleteSkill,delete_skill,delete,DeletedSkillResource,Skills,skills,skills,delete,delete,,Delete a skill by its ID. +skills.yaml,/skills/{skill_id},GetSkill,get_skill,get,SkillResource,Skills,skills,skills,get,select,,Get a skill by its ID. +skills.yaml,/skills/{skill_id},UpdateSkillDefaultVersion,update_skill_default_version,post,SkillResource,Skills,skills,skills,update,update,,Update the default version pointer for a skill. +skills.yaml,/skills/{skill_id}/versions,CreateSkillVersion,create_skill_version,post,SkillVersionResource,Skills,skills,skip_this_resource,,,,Create a new immutable skill version. +skills.yaml,/skills/{skill_id}/versions,ListSkillVersions,list_skill_versions,get,SkillVersionListResource,Skills,skills,versions,list,select,$.data,List skill versions for a skill. +skills.yaml,/skills/{skill_id}/versions/{version},GetSkillVersion,get_skill_version,get,SkillVersionResource,Skills,skills,versions,get,select,,Get a specific skill version. +skills.yaml,/skills/{skill_id}/versions/{version},DeleteSkillVersion,delete_skill_version,delete,DeletedSkillVersionResource,Skills,skills,versions,delete,delete,,Delete a skill version. +uploads.yaml,/uploads,createUpload,create_upload,post,Upload,Uploads,uploads,uploads,create,insert,,"Creates an intermediate [Upload](/docs/api-reference/uploads/object) object +that you can add [Parts](/docs/api-reference/uploads/part-object) to. +Currently, an Upload can accept at most 8 GB in total and expires after an +hour after you create it. + +Once you complete the Upload, we will create a +[File](/docs/api-reference/files/object) object that contains all the parts +you uploaded. This File is usable in the rest of our platform as a regular +File object. + +For certain `purpose` values, the correct `mime_type` must be specified. +Please refer to documentation for the +[supported MIME types for your use case](/docs/assistants/tools/file-search#supported-files). + +For guidance on the proper filename extensions for each purpose, please +follow the documentation on [creating a +File](/docs/api-reference/files/create). + +Returns the Upload object with status `pending`. +" +uploads.yaml,/uploads/{upload_id}/cancel,cancelUpload,cancel_upload,post,Upload,Uploads,uploads,uploads,cancel,exec,,"Cancels the Upload. No Parts may be added after an Upload is cancelled. + +Returns the Upload object with status `cancelled`. +" +uploads.yaml,/uploads/{upload_id}/complete,completeUpload,complete_upload,post,Upload,Uploads,uploads,uploads,complete,exec,,"Completes the [Upload](/docs/api-reference/uploads/object). + +Within the returned Upload object, there is a nested [File](/docs/api-reference/files/object) object that is ready to use in the rest of the platform. + +You can specify the order of the Parts by passing in an ordered list of the Part IDs. + +The 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. +Returns the Upload object with status `completed`, including an additional `file` property containing the created usable File object. +" +vector_stores.yaml,/vector_stores,listVectorStores,list_vector_stores,get,ListVectorStoresResponse,Vector stores,vector stores,vector_stores,list,select,$.data,Returns a list of vector stores. +vector_stores.yaml,/vector_stores,createVectorStore,create_vector_store,post,VectorStoreObject,Vector stores,vector stores,vector_stores,create,insert,,Create a vector store. +vector_stores.yaml,/vector_stores/{vector_store_id},getVectorStore,get_vector_store,get,VectorStoreObject,Vector stores,vector stores,vector_stores,get,select,,Retrieves a vector store. +vector_stores.yaml,/vector_stores/{vector_store_id},modifyVectorStore,modify_vector_store,post,VectorStoreObject,Vector stores,vector stores,vector_stores,update,update,,Modifies a vector store. +vector_stores.yaml,/vector_stores/{vector_store_id},deleteVectorStore,delete_vector_store,delete,DeleteVectorStoreResponse,Vector stores,vector stores,vector_stores,delete,delete,,Delete a vector store. +vector_stores.yaml,/vector_stores/{vector_store_id}/file_batches,createVectorStoreFileBatch,create_vector_store_file_batch,post,VectorStoreFileBatchObject,Vector stores,vector stores,file_batches,create,insert,,Create a vector store file batch. +vector_stores.yaml,/vector_stores/{vector_store_id}/file_batches/{batch_id},getVectorStoreFileBatch,get_vector_store_file_batch,get,VectorStoreFileBatchObject,Vector stores,vector stores,file_batches,get,select,,Retrieves a vector store file batch. +vector_stores.yaml,/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel,cancelVectorStoreFileBatch,cancel_vector_store_file_batch,post,VectorStoreFileBatchObject,Vector stores,vector stores,file_batches,cancel,exec,,Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. +vector_stores.yaml,/vector_stores/{vector_store_id}/file_batches/{batch_id}/files,listFilesInVectorStoreBatch,list_files_in_vector_store_batch,get,ListVectorStoreFilesResponse,Vector stores,vector stores,file_batch_files,list,select,$.data,Returns a list of vector store files in a batch. +vector_stores.yaml,/vector_stores/{vector_store_id}/files,listVectorStoreFiles,list_vector_store_files,get,ListVectorStoreFilesResponse,Vector stores,vector stores,files,list,select,$.data,Returns a list of vector store files. +vector_stores.yaml,/vector_stores/{vector_store_id}/files,createVectorStoreFile,create_vector_store_file,post,VectorStoreFileObject,Vector stores,vector stores,files,create,insert,,Create a vector store file by attaching a [File](/docs/api-reference/files) to a [vector store](/docs/api-reference/vector-stores/object). +vector_stores.yaml,/vector_stores/{vector_store_id}/files/{file_id},getVectorStoreFile,get_vector_store_file,get,VectorStoreFileObject,Vector stores,vector stores,files,get,select,,Retrieves a vector store file. +vector_stores.yaml,/vector_stores/{vector_store_id}/files/{file_id},deleteVectorStoreFile,delete_vector_store_file,delete,DeleteVectorStoreFileResponse,Vector stores,vector stores,files,delete,delete,,"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](/docs/api-reference/files/delete) endpoint." +vector_stores.yaml,/vector_stores/{vector_store_id}/files/{file_id},updateVectorStoreFileAttributes,update_vector_store_file_attributes,post,VectorStoreFileObject,Vector stores,vector stores,files,update,update,,Update attributes on a vector store file. +vector_stores.yaml,/vector_stores/{vector_store_id}/search,searchVectorStore,search_vector_store,post,VectorStoreSearchResultsPage,Vector stores,vector stores,vector_stores,search,exec,,Search a vector store for relevant chunks based on a query and file attributes filter. diff --git a/provider-dev/config/endpoint_inventory.csv b/provider-dev/config/endpoint_inventory.csv new file mode 100644 index 0000000..64fcd12 --- /dev/null +++ b/provider-dev/config/endpoint_inventory.csv @@ -0,0 +1,101 @@ +service,resource,sql_verb,method,http_verb,path,operation_id,envelope,object_key,cursor_params,path_params,update_post,async_job,deprecated,skip_reason,notes +assistants,assistants,select,list,GET,/assistants,listAssistants,list-cursor,$.data,limit order after before,,,,spec,, +assistants,assistants,insert,create,POST,/assistants,createAssistant,object,,,,,,spec,, +assistants,assistants,delete,delete,DELETE,/assistants/{assistant_id},deleteAssistant,object,,,assistant_id,,,spec,, +assistants,assistants,select,get,GET,/assistants/{assistant_id},getAssistant,object,,,assistant_id,,,spec,, +assistants,assistants,update,update,POST,/assistants/{assistant_id},modifyAssistant,object,,,assistant_id,y,,spec,, +assistants,messages,select,list,GET,/threads/{thread_id}/messages,listMessages,list-cursor,$.data,limit order after before,thread_id,,,family-rule,, +assistants,messages,insert,create,POST,/threads/{thread_id}/messages,createMessage,object,,,thread_id,,,family-rule,, +assistants,messages,delete,delete,DELETE,/threads/{thread_id}/messages/{message_id},deleteMessage,object,,,thread_id message_id,,,family-rule,, +assistants,messages,select,get,GET,/threads/{thread_id}/messages/{message_id},getMessage,object,,,thread_id message_id,,,family-rule,, +assistants,messages,update,update,POST,/threads/{thread_id}/messages/{message_id},modifyMessage,object,,,thread_id message_id,y,,family-rule,, +assistants,run_steps,select,list,GET,/threads/{thread_id}/runs/{run_id}/steps,listRunSteps,list-cursor,$.data,limit order after before,thread_id run_id,,,family-rule,, +assistants,run_steps,select,get,GET,/threads/{thread_id}/runs/{run_id}/steps/{step_id},getRunStep,object,,,thread_id run_id step_id,,,family-rule,, +assistants,runs,select,list,GET,/threads/{thread_id}/runs,listRuns,list-cursor,$.data,limit order after before,thread_id,,,family-rule,, +assistants,runs,insert,create,POST,/threads/{thread_id}/runs,createRun,object,,,thread_id,,create,family-rule,, +assistants,runs,select,get,GET,/threads/{thread_id}/runs/{run_id},getRun,object,,,thread_id run_id,,poll,family-rule,, +assistants,runs,update,update,POST,/threads/{thread_id}/runs/{run_id},modifyRun,object,,,thread_id run_id,y,,family-rule,, +assistants,runs,exec,cancel,POST,/threads/{thread_id}/runs/{run_id}/cancel,cancelRun,object,,,thread_id run_id,,cancel,family-rule,, +assistants,runs,exec,submit_tool_outputs,POST,/threads/{thread_id}/runs/{run_id}/submit_tool_outputs,submitToolOuputsToRun,object,,,thread_id run_id,,,family-rule,, +assistants,threads,insert,create,POST,/threads,createThread,object,,,,,,family-rule,, +assistants,threads,delete,delete,DELETE,/threads/{thread_id},deleteThread,object,,,thread_id,,,family-rule,, +assistants,threads,select,get,GET,/threads/{thread_id},getThread,object,,,thread_id,,,family-rule,, +assistants,threads,update,update,POST,/threads/{thread_id},modifyThread,object,,,thread_id,y,,family-rule,, +assistants,threads,exec,create_thread_and_run,POST,/threads/runs,createThreadAndRun,object,,,,,,family-rule,, +batches,batches,select,list,GET,/batches,listBatches,list-cursor,$.data,after limit,,,,,, +batches,batches,insert,create,POST,/batches,createBatch,object,,,,,create,,, +batches,batches,select,get,GET,/batches/{batch_id},retrieveBatch,object,,,batch_id,,poll,,, +batches,batches,exec,cancel,POST,/batches/{batch_id}/cancel,cancelBatch,object,,,batch_id,,cancel,,, +containers,containers,select,list,GET,/containers,ListContainers,list-cursor,$.data,limit order after,,,,,, +containers,containers,insert,create,POST,/containers,CreateContainer,object,,,,,,,, +containers,containers,delete,delete,DELETE,/containers/{container_id},DeleteContainer,,,,container_id,,,,, +containers,containers,select,get,GET,/containers/{container_id},RetrieveContainer,object,,,container_id,,,,, +containers,files,select,list,GET,/containers/{container_id}/files,ListContainerFiles,list-cursor,$.data,limit order after,container_id,,,,, +containers,files,insert,create,POST,/containers/{container_id}/files,CreateContainerFile,object,,,container_id,,,,,INSERT via the non-binary file_id (reference an existing file); the optional binary file upload column is stripped in pre_normalize (any-sdk marshals JSON/XML only) +containers,files,delete,delete,DELETE,/containers/{container_id}/files/{file_id},DeleteContainerFile,,,,container_id file_id,,,,, +containers,files,select,get,GET,/containers/{container_id}/files/{file_id},RetrieveContainerFile,object,,,container_id file_id,,,,, +conversations,conversations,insert,create,POST,/conversations,createConversation,object,,,,,,,, +conversations,conversations,delete,delete,DELETE,/conversations/{conversation_id},deleteConversation,object,,,conversation_id,,,,, +conversations,conversations,select,get,GET,/conversations/{conversation_id},getConversation,object,,,conversation_id,,,,, +conversations,conversations,update,update,POST,/conversations/{conversation_id},updateConversation,object,,,conversation_id,y,,,, +conversations,items,select,list,GET,/conversations/{conversation_id}/items,listConversationItems,list-cursor,$.data,limit order after,conversation_id,,,,, +conversations,items,insert,create,POST,/conversations/{conversation_id}/items,createConversationItems,list-cursor,,,conversation_id,,,,, +conversations,items,delete,delete,DELETE,/conversations/{conversation_id}/items/{item_id},deleteConversationItem,object,,,conversation_id item_id,,,,, +conversations,items,select,get,GET,/conversations/{conversation_id}/items/{item_id},getConversationItem,object,,,conversation_id item_id,,,,, +evals,evals,select,list,GET,/evals,listEvals,list-cursor,$.data,after limit order,,,,,, +evals,evals,insert,create,POST,/evals,createEval,,,,,,,,, +evals,evals,delete,delete,DELETE,/evals/{eval_id},deleteEval,object,,,eval_id,,,,, +evals,evals,select,get,GET,/evals/{eval_id},getEval,object,,,eval_id,,,,, +evals,evals,update,update,POST,/evals/{eval_id},updateEval,object,,,eval_id,y,,,, +evals,run_output_items,select,list,GET,/evals/{eval_id}/runs/{run_id}/output_items,getEvalRunOutputItems,list-cursor,$.data,after limit order,eval_id run_id,,,,, +evals,run_output_items,select,get,GET,/evals/{eval_id}/runs/{run_id}/output_items/{output_item_id},getEvalRunOutputItem,object,,,eval_id run_id output_item_id,,,,, +evals,runs,select,list,GET,/evals/{eval_id}/runs,getEvalRuns,list-cursor,$.data,after limit order,eval_id,,,,, +evals,runs,insert,create,POST,/evals/{eval_id}/runs,createEvalRun,,,,eval_id,,create,,, +evals,runs,delete,delete,DELETE,/evals/{eval_id}/runs/{run_id},deleteEvalRun,object,,,eval_id run_id,,,,, +evals,runs,select,get,GET,/evals/{eval_id}/runs/{run_id},getEvalRun,object,,,eval_id run_id,,poll,,, +evals,runs,exec,cancel,POST,/evals/{eval_id}/runs/{run_id},cancelEvalRun,object,,,eval_id run_id,,cancel,,, +files,,,,POST,/files,createFile,object,,,,,,,multipart-binary-body, +files,files,select,list,GET,/files,listFiles,list-cursor,$.data,limit order after,,,,,, +files,files,delete,delete,DELETE,/files/{file_id},deleteFile,object,,,file_id,,,,, +files,files,select,get,GET,/files/{file_id},retrieveFile,object,,,file_id,,,,, +fine_tuning,checkpoint_permissions,select,list,GET,/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions,listFineTuningCheckpointPermissions,list-cursor,$.data,after limit order,fine_tuned_model_checkpoint,,,,, +fine_tuning,checkpoint_permissions,insert,create,POST,/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions,createFineTuningCheckpointPermission,list-cursor,,,fine_tuned_model_checkpoint,,,,, +fine_tuning,checkpoint_permissions,delete,delete,DELETE,/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id},deleteFineTuningCheckpointPermission,object,,,fine_tuned_model_checkpoint permission_id,,,,, +fine_tuning,checkpoints,select,list,GET,/fine_tuning/jobs/{fine_tuning_job_id}/checkpoints,listFineTuningJobCheckpoints,list-cursor,$.data,after limit,fine_tuning_job_id,,,,, +fine_tuning,events,select,list,GET,/fine_tuning/jobs/{fine_tuning_job_id}/events,listFineTuningEvents,list-has_more-only,$.data,after limit,fine_tuning_job_id,,,,, +fine_tuning,jobs,select,list,GET,/fine_tuning/jobs,listPaginatedFineTuningJobs,list-has_more-only,$.data,after limit,,,,,, +fine_tuning,jobs,insert,create,POST,/fine_tuning/jobs,createFineTuningJob,object,,,,,create,,, +fine_tuning,jobs,select,get,GET,/fine_tuning/jobs/{fine_tuning_job_id},retrieveFineTuningJob,object,,,fine_tuning_job_id,,poll,,, +fine_tuning,jobs,exec,cancel,POST,/fine_tuning/jobs/{fine_tuning_job_id}/cancel,cancelFineTuningJob,object,,,fine_tuning_job_id,,cancel,,, +fine_tuning,jobs,exec,pause,POST,/fine_tuning/jobs/{fine_tuning_job_id}/pause,pauseFineTuningJob,object,,,fine_tuning_job_id,,control,,, +fine_tuning,jobs,exec,resume,POST,/fine_tuning/jobs/{fine_tuning_job_id}/resume,resumeFineTuningJob,object,,,fine_tuning_job_id,,control,,, +models,models,select,list,GET,/models,listModels,list-plain,$.data,,,,,,, +models,models,delete,delete,DELETE,/models/{model},deleteModel,object,,,model,,,,, +models,models,select,get,GET,/models/{model},retrieveModel,object,,,model,,,,, +skills,,,,POST,/skills,CreateSkill,object,,,,,,,multipart-binary-body, +skills,,,,POST,/skills/{skill_id}/versions,CreateSkillVersion,object,,,skill_id,,,,multipart-binary-body, +skills,skills,select,list,GET,/skills,ListSkills,list-cursor,$.data,limit order after,,,,,, +skills,skills,delete,delete,DELETE,/skills/{skill_id},DeleteSkill,object,,,skill_id,,,,, +skills,skills,select,get,GET,/skills/{skill_id},GetSkill,object,,,skill_id,,,,, +skills,skills,update,update,POST,/skills/{skill_id},UpdateSkillDefaultVersion,object,,,skill_id,y,,,, +skills,versions,select,list,GET,/skills/{skill_id}/versions,ListSkillVersions,list-cursor,$.data,limit order after,skill_id,,,,, +skills,versions,delete,delete,DELETE,/skills/{skill_id}/versions/{version},DeleteSkillVersion,object,,,skill_id version,,,,, +skills,versions,select,get,GET,/skills/{skill_id}/versions/{version},GetSkillVersion,object,,,skill_id version,,,,, +uploads,uploads,insert,create,POST,/uploads,createUpload,object,,,,,create,,, +uploads,uploads,exec,cancel,POST,/uploads/{upload_id}/cancel,cancelUpload,object,,,upload_id,,cancel,,, +uploads,uploads,exec,complete,POST,/uploads/{upload_id}/complete,completeUpload,object,,,upload_id,,control,,, +vector_stores,file_batch_files,select,list,GET,/vector_stores/{vector_store_id}/file_batches/{batch_id}/files,listFilesInVectorStoreBatch,list-cursor,$.data,limit order after before,vector_store_id batch_id,,,,, +vector_stores,file_batches,insert,create,POST,/vector_stores/{vector_store_id}/file_batches,createVectorStoreFileBatch,object,,,vector_store_id,,create,,, +vector_stores,file_batches,select,get,GET,/vector_stores/{vector_store_id}/file_batches/{batch_id},getVectorStoreFileBatch,object,,,vector_store_id batch_id,,poll,,, +vector_stores,file_batches,exec,cancel,POST,/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel,cancelVectorStoreFileBatch,object,,,vector_store_id batch_id,,cancel,,, +vector_stores,files,select,list,GET,/vector_stores/{vector_store_id}/files,listVectorStoreFiles,list-cursor,$.data,limit order after before,vector_store_id,,,,, +vector_stores,files,insert,create,POST,/vector_stores/{vector_store_id}/files,createVectorStoreFile,object,,,vector_store_id,,,,, +vector_stores,files,delete,delete,DELETE,/vector_stores/{vector_store_id}/files/{file_id},deleteVectorStoreFile,object,,,vector_store_id file_id,,,,, +vector_stores,files,select,get,GET,/vector_stores/{vector_store_id}/files/{file_id},getVectorStoreFile,object,,,vector_store_id file_id,,,,, +vector_stores,files,update,update,POST,/vector_stores/{vector_store_id}/files/{file_id},updateVectorStoreFileAttributes,object,,,vector_store_id file_id,y,,,, +vector_stores,vector_stores,select,list,GET,/vector_stores,listVectorStores,list-cursor,$.data,limit order after before,,,,,, +vector_stores,vector_stores,insert,create,POST,/vector_stores,createVectorStore,object,,,,,,,, +vector_stores,vector_stores,delete,delete,DELETE,/vector_stores/{vector_store_id},deleteVectorStore,object,,,vector_store_id,,,,, +vector_stores,vector_stores,select,get,GET,/vector_stores/{vector_store_id},getVectorStore,object,,,vector_store_id,,,,, +vector_stores,vector_stores,update,update,POST,/vector_stores/{vector_store_id},modifyVectorStore,object,,,vector_store_id,y,,,, +vector_stores,vector_stores,exec,search,POST,/vector_stores/{vector_store_id}/search,searchVectorStore,list-has_more-only,,,vector_store_id,,,,,embedding-consuming query; gated smoke tier diff --git a/provider-dev/config/filter_report.csv b/provider-dev/config/filter_report.csv new file mode 100644 index 0000000..7e3017c --- /dev/null +++ b/provider-dev/config/filter_report.csv @@ -0,0 +1,104 @@ +path,verbs,operation_ids,reason +/fine_tuning/alpha/graders/run,POST,runGrader,alpha-unstable +/fine_tuning/alpha/graders/validate,POST,validateGrader,alpha-unstable +/chatkit/sessions,POST,CreateChatSessionMethod,beta-ui-surface +/chatkit/sessions/{session_id}/cancel,POST,CancelChatSessionMethod,beta-ui-surface +/chatkit/threads,GET,ListThreadsMethod,beta-ui-surface +/chatkit/threads/{thread_id},GET;DELETE,GetThreadMethod;DeleteThreadMethod,beta-ui-surface +/chatkit/threads/{thread_id}/items,GET,ListThreadItemsMethod,beta-ui-surface +/containers/{container_id}/files/{file_id}/content,GET,RetrieveContainerFileContent,binary-transfer +/files/{file_id}/content,GET,downloadFile,binary-transfer +/skills/{skill_id}/content,GET,GetSkillContent,binary-transfer +/skills/{skill_id}/versions/{version}/content,GET,GetSkillVersionContent,binary-transfer +/uploads/{upload_id}/parts,POST,addUploadPart,binary-transfer +/vector_stores/{vector_store_id}/files/{file_id}/content,GET,retrieveVectorStoreFileContent,binary-transfer +/audio/speech,POST,createSpeech,data-plane-inference +/audio/transcriptions,POST,createTranscription,data-plane-inference +/audio/translations,POST,createTranslation,data-plane-inference +/audio/voice_consents,GET;POST,listVoiceConsents;createVoiceConsent,data-plane-inference +/audio/voice_consents/{consent_id},GET;POST;DELETE,getVoiceConsent;updateVoiceConsent;deleteVoiceConsent,data-plane-inference +/audio/voices,POST,createVoice,data-plane-inference +/chat/completions,GET;POST,listChatCompletions;createChatCompletion,data-plane-inference +/chat/completions/{completion_id},GET;POST;DELETE,getChatCompletion;updateChatCompletion;deleteChatCompletion,data-plane-inference +/chat/completions/{completion_id}/messages,GET,getChatCompletionMessages,data-plane-inference +/completions,POST,createCompletion,data-plane-inference +/embeddings,POST,createEmbedding,data-plane-inference +/images/edits,POST,createImageEdit,data-plane-inference +/images/generations,POST,createImage,data-plane-inference +/images/variations,POST,createImageVariation,data-plane-inference +/moderations,POST,createModeration,data-plane-inference +/realtime/calls,POST,create-realtime-call,data-plane-inference +/realtime/calls/{call_id}/accept,POST,accept-realtime-call,data-plane-inference +/realtime/calls/{call_id}/hangup,POST,hangup-realtime-call,data-plane-inference +/realtime/calls/{call_id}/refer,POST,refer-realtime-call,data-plane-inference +/realtime/calls/{call_id}/reject,POST,reject-realtime-call,data-plane-inference +/realtime/client_secrets,POST,create-realtime-client-secret,data-plane-inference +/realtime/sessions,POST,create-realtime-session,data-plane-inference +/realtime/transcription_sessions,POST,create-realtime-transcription-session,data-plane-inference +/realtime/translations/client_secrets,POST,create-realtime-translation-client-secret,data-plane-inference +/responses,POST,createResponse,data-plane-inference +/responses/{response_id},GET;DELETE,getResponse;deleteResponse,data-plane-inference +/responses/{response_id}/cancel,POST,cancelResponse,data-plane-inference +/responses/{response_id}/input_items,GET,listInputItems,data-plane-inference +/responses/compact,POST,Compactconversation,data-plane-inference +/responses/input_tokens,POST,Getinputtokencounts,data-plane-inference +/videos,GET;POST,ListVideos;createVideo,data-plane-inference +/videos/{video_id},GET;DELETE,GetVideo;DeleteVideo,data-plane-inference +/videos/{video_id}/content,GET,RetrieveVideoContent,data-plane-inference +/videos/{video_id}/remix,POST,CreateVideoRemix,data-plane-inference +/videos/characters,POST,CreateVideoCharacter,data-plane-inference +/videos/characters/{character_id},GET,GetVideoCharacter,data-plane-inference +/videos/edits,POST,CreateVideoEdit,data-plane-inference +/videos/extensions,POST,CreateVideoExtend,data-plane-inference +/organization/admin_api_keys,GET;POST,admin-api-keys-list;admin-api-keys-create,org-admin-surface +/organization/admin_api_keys/{key_id},GET;DELETE,admin-api-keys-get;admin-api-keys-delete,org-admin-surface +/organization/audit_logs,GET,list-audit-logs,org-admin-surface +/organization/certificates,GET;POST,listOrganizationCertificates;uploadCertificate,org-admin-surface +/organization/certificates/{certificate_id},GET;POST;DELETE,getCertificate;modifyCertificate;deleteCertificate,org-admin-surface +/organization/certificates/activate,POST,activateOrganizationCertificates,org-admin-surface +/organization/certificates/deactivate,POST,deactivateOrganizationCertificates,org-admin-surface +/organization/costs,GET,usage-costs,org-admin-surface +/organization/groups,GET;POST,list-groups;create-group,org-admin-surface +/organization/groups/{group_id},POST;DELETE,update-group;delete-group,org-admin-surface +/organization/groups/{group_id}/roles,GET;POST,list-group-role-assignments;assign-group-role,org-admin-surface +/organization/groups/{group_id}/roles/{role_id},DELETE,unassign-group-role,org-admin-surface +/organization/groups/{group_id}/users,GET;POST,list-group-users;add-group-user,org-admin-surface +/organization/groups/{group_id}/users/{user_id},DELETE,remove-group-user,org-admin-surface +/organization/invites,GET;POST,list-invites;inviteUser,org-admin-surface +/organization/invites/{invite_id},GET;DELETE,retrieve-invite;delete-invite,org-admin-surface +/organization/projects,GET;POST,list-projects;create-project,org-admin-surface +/organization/projects/{project_id},GET;POST,retrieve-project;modify-project,org-admin-surface +/organization/projects/{project_id}/api_keys,GET,list-project-api-keys,org-admin-surface +/organization/projects/{project_id}/api_keys/{api_key_id},GET;DELETE,retrieve-project-api-key;delete-project-api-key,org-admin-surface +/organization/projects/{project_id}/archive,POST,archive-project,org-admin-surface +/organization/projects/{project_id}/certificates,GET,listProjectCertificates,org-admin-surface +/organization/projects/{project_id}/certificates/activate,POST,activateProjectCertificates,org-admin-surface +/organization/projects/{project_id}/certificates/deactivate,POST,deactivateProjectCertificates,org-admin-surface +/organization/projects/{project_id}/groups,GET;POST,list-project-groups;add-project-group,org-admin-surface +/organization/projects/{project_id}/groups/{group_id},DELETE,remove-project-group,org-admin-surface +/organization/projects/{project_id}/rate_limits,GET,list-project-rate-limits,org-admin-surface +/organization/projects/{project_id}/rate_limits/{rate_limit_id},POST,update-project-rate-limits,org-admin-surface +/organization/projects/{project_id}/service_accounts,GET;POST,list-project-service-accounts;create-project-service-account,org-admin-surface +/organization/projects/{project_id}/service_accounts/{service_account_id},GET;DELETE,retrieve-project-service-account;delete-project-service-account,org-admin-surface +/organization/projects/{project_id}/users,GET;POST,list-project-users;create-project-user,org-admin-surface +/organization/projects/{project_id}/users/{user_id},GET;POST;DELETE,retrieve-project-user;modify-project-user;delete-project-user,org-admin-surface +/organization/roles,GET;POST,list-roles;create-role,org-admin-surface +/organization/roles/{role_id},POST;DELETE,update-role;delete-role,org-admin-surface +/organization/usage/audio_speeches,GET,usage-audio-speeches,org-admin-surface +/organization/usage/audio_transcriptions,GET,usage-audio-transcriptions,org-admin-surface +/organization/usage/code_interpreter_sessions,GET,usage-code-interpreter-sessions,org-admin-surface +/organization/usage/completions,GET,usage-completions,org-admin-surface +/organization/usage/embeddings,GET,usage-embeddings,org-admin-surface +/organization/usage/images,GET,usage-images,org-admin-surface +/organization/usage/moderations,GET,usage-moderations,org-admin-surface +/organization/usage/vector_stores,GET,usage-vector-stores,org-admin-surface +/organization/users,GET,list-users,org-admin-surface +/organization/users/{user_id},GET;POST;DELETE,retrieve-user;modify-user;delete-user,org-admin-surface +/organization/users/{user_id}/roles,GET;POST,list-user-role-assignments;assign-user-role,org-admin-surface +/organization/users/{user_id}/roles/{role_id},DELETE,unassign-user-role,org-admin-surface +/projects/{project_id}/groups/{group_id}/roles,GET;POST,list-project-group-role-assignments;assign-project-group-role,org-admin-surface +/projects/{project_id}/groups/{group_id}/roles/{role_id},DELETE,unassign-project-group-role,org-admin-surface +/projects/{project_id}/roles,GET;POST,list-project-roles;create-project-role,org-admin-surface +/projects/{project_id}/roles/{role_id},POST;DELETE,update-project-role;delete-project-role,org-admin-surface +/projects/{project_id}/users/{user_id}/roles,GET;POST,list-project-user-role-assignments;assign-project-user-role,org-admin-surface +/projects/{project_id}/users/{user_id}/roles/{role_id},DELETE,unassign-project-user-role,org-admin-surface diff --git a/provider-dev/config/predecessor_dispositions.csv b/provider-dev/config/predecessor_dispositions.csv new file mode 100644 index 0000000..2824970 --- /dev/null +++ b/provider-dev/config/predecessor_dispositions.csv @@ -0,0 +1,95 @@ +service,resource,method,verb,old_fqn,disposition,new_fqn,new_method,reason +assistants,assistants,get_assistant,SELECT,openai.assistants.assistants,carried,openai.assistants.assistants,get, +assistants,assistants,list_assistants,SELECT,openai.assistants.assistants,carried,openai.assistants.assistants,list, +assistants,assistants,create_assistant,INSERT,openai.assistants.assistants,carried,openai.assistants.assistants,create, +assistants,assistants,delete_assistant,DELETE,openai.assistants.assistants,carried,openai.assistants.assistants,delete, +assistants,assistants,modify_assistant,UPDATE,openai.assistants.assistants,carried,openai.assistants.assistants,update, +assistants,messages,get_message,SELECT,openai.assistants.messages,carried,openai.assistants.messages,get, +assistants,messages,list_messages,SELECT,openai.assistants.messages,carried,openai.assistants.messages,list, +assistants,messages,create_message,INSERT,openai.assistants.messages,carried,openai.assistants.messages,create, +assistants,messages,delete_message,DELETE,openai.assistants.messages,carried,openai.assistants.messages,delete, +assistants,messages,modify_message,UPDATE,openai.assistants.messages,carried,openai.assistants.messages,update, +assistants,run_steps,get_run_step,SELECT,openai.assistants.run_steps,carried,openai.assistants.run_steps,get, +assistants,run_steps,list_run_steps,SELECT,openai.assistants.run_steps,carried,openai.assistants.run_steps,list, +assistants,runs,get_run,SELECT,openai.assistants.runs,carried,openai.assistants.runs,get, +assistants,runs,list_runs,SELECT,openai.assistants.runs,carried,openai.assistants.runs,list, +assistants,runs,create_run,INSERT,openai.assistants.runs,carried,openai.assistants.runs,create, +assistants,runs,modify_run,UPDATE,openai.assistants.runs,carried,openai.assistants.runs,update, +assistants,runs,cancel_run,EXEC,openai.assistants.runs,carried,openai.assistants.runs,cancel, +assistants,runs,submit_tool_ouputs_to_run,EXEC,openai.assistants.runs,carried,openai.assistants.runs,submit_tool_outputs, +assistants,threads,get_thread,SELECT,openai.assistants.threads,carried,openai.assistants.threads,get, +assistants,threads,create_thread,INSERT,openai.assistants.threads,carried,openai.assistants.threads,create, +assistants,threads,delete_thread,DELETE,openai.assistants.threads,carried,openai.assistants.threads,delete, +assistants,threads,modify_thread,UPDATE,openai.assistants.threads,carried,openai.assistants.threads,update, +assistants,threads,create_thread_and_run,EXEC,openai.assistants.threads,carried,openai.assistants.threads,create_thread_and_run, +audio,speeches,create_speech,INSERT,openai.audio.speeches,retired,,,data-plane-inference +audio,transcriptions,create_transcription,INSERT,openai.audio.transcriptions,retired,,,data-plane-inference +audio,translations,create_translation,INSERT,openai.audio.translations,retired,,,data-plane-inference +audit_logs,audit_logs,list_audit_logs,SELECT,openai.audit_logs.audit_logs,retired,,,org-admin-surface(openai_admin) +batch,batches,list_batches,SELECT,openai.batch.batches,renamed,openai.batches.batches,list, +batch,batches,retrieve_batch,SELECT,openai.batch.batches,renamed,openai.batches.batches,get, +batch,batches,create_batch,INSERT,openai.batch.batches,renamed,openai.batches.batches,create, +batch,batches,cancel_batch,EXEC,openai.batch.batches,renamed,openai.batches.batches,cancel, +chat,completions,create_chat_completion,SELECT,openai.chat.completions,retired,,,data-plane-inference +completions,completions,create_completion,INSERT,openai.completions.completions,retired,,,data-plane-inference +embeddings,embeddings,create_embedding,INSERT,openai.embeddings.embeddings,retired,,,data-plane-inference +files,files,list_files,SELECT,openai.files.files,carried,openai.files.files,list, +files,files,retrieve_file,SELECT,openai.files.files,carried,openai.files.files,get, +files,files,create_file,INSERT,openai.files.files,retired,,,multipart-binary-body +files,files,delete_file,DELETE,openai.files.files,carried,openai.files.files,delete, +files,files,download_file,EXEC,openai.files.files,retired,,,binary-transfer +fine_tuning,events,list_fine_tuning_events,SELECT,openai.fine_tuning.events,carried,openai.fine_tuning.events,list, +fine_tuning,job_checkpoints,list_fine_tuning_job_checkpoints,SELECT,openai.fine_tuning.job_checkpoints,renamed,openai.fine_tuning.checkpoints,list, +fine_tuning,jobs,list_paginated_fine_tuning_jobs,SELECT,openai.fine_tuning.jobs,carried,openai.fine_tuning.jobs,list, +fine_tuning,jobs,retrieve_fine_tuning_job,SELECT,openai.fine_tuning.jobs,carried,openai.fine_tuning.jobs,get, +fine_tuning,jobs,create_fine_tuning_job,INSERT,openai.fine_tuning.jobs,carried,openai.fine_tuning.jobs,create, +fine_tuning,jobs,cancel_fine_tuning_job,EXEC,openai.fine_tuning.jobs,carried,openai.fine_tuning.jobs,cancel, +images,image_edits,create_image_edit,INSERT,openai.images.image_edits,retired,,,data-plane-inference +images,image_variations,create_image_variation,INSERT,openai.images.image_variations,retired,,,data-plane-inference +images,images,create_image,INSERT,openai.images.images,retired,,,data-plane-inference +invites,invites,list_invites,SELECT,openai.invites.invites,retired,,,org-admin-surface(openai_admin) +invites,invites,retrieve_invite,SELECT,openai.invites.invites,retired,,,org-admin-surface(openai_admin) +invites,invites,delete_invite,DELETE,openai.invites.invites,retired,,,org-admin-surface(openai_admin) +invites,users,invite_user,EXEC,openai.invites.users,retired,,,org-admin-surface(openai_admin) +models,models,list_models,SELECT,openai.models.models,carried,openai.models.models,list, +models,models,retrieve_model,SELECT,openai.models.models,carried,openai.models.models,get, +models,models,delete_model,DELETE,openai.models.models,carried,openai.models.models,delete, +moderations,moderations,create_moderation,INSERT,openai.moderations.moderations,retired,,,data-plane-inference +projects,project_api_keys,list_project_api_keys,SELECT,openai.projects.project_api_keys,retired,,,org-admin-surface(openai_admin) +projects,project_api_keys,retrieve_project_api_key,SELECT,openai.projects.project_api_keys,retired,,,org-admin-surface(openai_admin) +projects,project_api_keys,delete_project_api_key,DELETE,openai.projects.project_api_keys,retired,,,org-admin-surface(openai_admin) +projects,project_service_accounts,list_project_service_accounts,SELECT,openai.projects.project_service_accounts,retired,,,org-admin-surface(openai_admin) +projects,project_service_accounts,retrieve_project_service_account,SELECT,openai.projects.project_service_accounts,retired,,,org-admin-surface(openai_admin) +projects,project_service_accounts,create_project_service_account,INSERT,openai.projects.project_service_accounts,retired,,,org-admin-surface(openai_admin) +projects,project_service_accounts,delete_project_service_account,DELETE,openai.projects.project_service_accounts,retired,,,org-admin-surface(openai_admin) +projects,project_users,list_project_users,SELECT,openai.projects.project_users,retired,,,org-admin-surface(openai_admin) +projects,project_users,retrieve_project_user,SELECT,openai.projects.project_users,retired,,,org-admin-surface(openai_admin) +projects,project_users,create_project_user,INSERT,openai.projects.project_users,retired,,,org-admin-surface(openai_admin) +projects,project_users,delete_project_user,DELETE,openai.projects.project_users,retired,,,org-admin-surface(openai_admin) +projects,project_users,modify_project_user,UPDATE,openai.projects.project_users,retired,,,org-admin-surface(openai_admin) +projects,projects,list_projects,SELECT,openai.projects.projects,retired,,,org-admin-surface(openai_admin) +projects,projects,retrieve_project,SELECT,openai.projects.projects,retired,,,org-admin-surface(openai_admin) +projects,projects,create_project,INSERT,openai.projects.projects,retired,,,org-admin-surface(openai_admin) +projects,projects,modify_project,UPDATE,openai.projects.projects,retired,,,org-admin-surface(openai_admin) +projects,projects,archive_project,EXEC,openai.projects.projects,retired,,,org-admin-surface(openai_admin) +uploads,upload_parts,add_upload_part,INSERT,openai.uploads.upload_parts,retired,,,binary-transfer +uploads,uploads,create_upload,INSERT,openai.uploads.uploads,carried,openai.uploads.uploads,create, +uploads,uploads,cancel_upload,EXEC,openai.uploads.uploads,carried,openai.uploads.uploads,cancel, +uploads,uploads,complete_upload,EXEC,openai.uploads.uploads,carried,openai.uploads.uploads,complete, +users,users,list_users,SELECT,openai.users.users,retired,,,org-admin-surface(openai_admin) +users,users,retrieve_user,SELECT,openai.users.users,retired,,,org-admin-surface(openai_admin) +users,users,delete_user,DELETE,openai.users.users,retired,,,org-admin-surface(openai_admin) +users,users,modify_user,UPDATE,openai.users.users,retired,,,org-admin-surface(openai_admin) +vector_stores,files_in_vector_store_batches,list_files_in_vector_store_batch,SELECT,openai.vector_stores.files_in_vector_store_batches,renamed,openai.vector_stores.file_batch_files,list, +vector_stores,vector_store_file_batches,get_vector_store_file_batch,SELECT,openai.vector_stores.vector_store_file_batches,renamed,openai.vector_stores.file_batches,get, +vector_stores,vector_store_file_batches,create_vector_store_file_batch,INSERT,openai.vector_stores.vector_store_file_batches,renamed,openai.vector_stores.file_batches,create, +vector_stores,vector_store_file_batches,cancel_vector_store_file_batch,EXEC,openai.vector_stores.vector_store_file_batches,renamed,openai.vector_stores.file_batches,cancel, +vector_stores,vector_store_files,get_vector_store_file,SELECT,openai.vector_stores.vector_store_files,renamed,openai.vector_stores.files,get, +vector_stores,vector_store_files,list_vector_store_files,SELECT,openai.vector_stores.vector_store_files,renamed,openai.vector_stores.files,list, +vector_stores,vector_store_files,create_vector_store_file,INSERT,openai.vector_stores.vector_store_files,renamed,openai.vector_stores.files,create, +vector_stores,vector_store_files,delete_vector_store_file,DELETE,openai.vector_stores.vector_store_files,renamed,openai.vector_stores.files,delete, +vector_stores,vector_stores,get_vector_store,SELECT,openai.vector_stores.vector_stores,carried,openai.vector_stores.vector_stores,get, +vector_stores,vector_stores,list_vector_stores,SELECT,openai.vector_stores.vector_stores,carried,openai.vector_stores.vector_stores,list, +vector_stores,vector_stores,create_vector_store,INSERT,openai.vector_stores.vector_stores,carried,openai.vector_stores.vector_stores,create, +vector_stores,vector_stores,delete_vector_store,DELETE,openai.vector_stores.vector_stores,carried,openai.vector_stores.vector_stores,delete, +vector_stores,vector_stores,modify_vector_store,UPDATE,openai.vector_stores.vector_stores,carried,openai.vector_stores.vector_stores,update, diff --git a/provider-dev/config/predecessor_inventory.csv b/provider-dev/config/predecessor_inventory.csv new file mode 100644 index 0000000..e9324b1 --- /dev/null +++ b/provider-dev/config/predecessor_inventory.csv @@ -0,0 +1,95 @@ +service,resource,method,verb,required_params,notes +assistants,assistants,get_assistant,SELECT,assistant_id, +assistants,assistants,list_assistants,SELECT,, +assistants,assistants,create_assistant,INSERT,data__model, +assistants,assistants,delete_assistant,DELETE,assistant_id, +assistants,assistants,modify_assistant,UPDATE,assistant_id, +assistants,messages,get_message,SELECT,"message_id, thread_id", +assistants,messages,list_messages,SELECT,thread_id, +assistants,messages,create_message,INSERT,"thread_id, data__content, data__role", +assistants,messages,delete_message,DELETE,"message_id, thread_id", +assistants,messages,modify_message,UPDATE,"message_id, thread_id", +assistants,run_steps,get_run_step,SELECT,"run_id, step_id, thread_id", +assistants,run_steps,list_run_steps,SELECT,"run_id, thread_id", +assistants,runs,get_run,SELECT,"run_id, thread_id", +assistants,runs,list_runs,SELECT,thread_id, +assistants,runs,create_run,INSERT,"thread_id, data__assistant_id", +assistants,runs,modify_run,UPDATE,"run_id, thread_id", +assistants,runs,cancel_run,EXEC,"run_id, thread_id", +assistants,runs,submit_tool_ouputs_to_run,EXEC,"run_id, thread_id, data__tool_outputs", +assistants,threads,get_thread,SELECT,thread_id, +assistants,threads,create_thread,INSERT,, +assistants,threads,delete_thread,DELETE,thread_id, +assistants,threads,modify_thread,UPDATE,thread_id, +assistants,threads,create_thread_and_run,EXEC,data__assistant_id, +audio,speeches,create_speech,INSERT,"data__input, data__model, data__voice", +audio,transcriptions,create_transcription,INSERT,, +audio,translations,create_translation,INSERT,, +audit_logs,audit_logs,list_audit_logs,SELECT,, +batch,batches,list_batches,SELECT,, +batch,batches,retrieve_batch,SELECT,batch_id, +batch,batches,create_batch,INSERT,"data__completion_window, data__endpoint, data__input_file_id", +batch,batches,cancel_batch,EXEC,batch_id, +chat,completions,create_chat_completion,SELECT,"data__messages, data__model", +completions,completions,create_completion,INSERT,"data__model, data__prompt", +embeddings,embeddings,create_embedding,INSERT,"data__input, data__model", +files,files,list_files,SELECT,, +files,files,retrieve_file,SELECT,file_id, +files,files,create_file,INSERT,, +files,files,delete_file,DELETE,file_id, +files,files,download_file,EXEC,file_id, +fine_tuning,events,list_fine_tuning_events,SELECT,fine_tuning_job_id, +fine_tuning,job_checkpoints,list_fine_tuning_job_checkpoints,SELECT,fine_tuning_job_id, +fine_tuning,jobs,list_paginated_fine_tuning_jobs,SELECT,, +fine_tuning,jobs,retrieve_fine_tuning_job,SELECT,fine_tuning_job_id, +fine_tuning,jobs,create_fine_tuning_job,INSERT,"data__model, data__training_file", +fine_tuning,jobs,cancel_fine_tuning_job,EXEC,fine_tuning_job_id, +images,image_edits,create_image_edit,INSERT,, +images,image_variations,create_image_variation,INSERT,, +images,images,create_image,INSERT,data__prompt, +invites,invites,list_invites,SELECT,, +invites,invites,retrieve_invite,SELECT,invite_id, +invites,invites,delete_invite,DELETE,invite_id, +invites,users,invite_user,EXEC,"data__email, data__role", +models,models,list_models,SELECT,, +models,models,retrieve_model,SELECT,model, +models,models,delete_model,DELETE,model, +moderations,moderations,create_moderation,INSERT,data__input, +projects,project_api_keys,list_project_api_keys,SELECT,project_id, +projects,project_api_keys,retrieve_project_api_key,SELECT,"key_id, project_id", +projects,project_api_keys,delete_project_api_key,DELETE,"key_id, project_id", +projects,project_service_accounts,list_project_service_accounts,SELECT,project_id, +projects,project_service_accounts,retrieve_project_service_account,SELECT,"project_id, service_account_id", +projects,project_service_accounts,create_project_service_account,INSERT,"project_id, data__name", +projects,project_service_accounts,delete_project_service_account,DELETE,"project_id, service_account_id", +projects,project_users,list_project_users,SELECT,project_id, +projects,project_users,retrieve_project_user,SELECT,"project_id, user_id", +projects,project_users,create_project_user,INSERT,"project_id, data__role, data__user_id", +projects,project_users,delete_project_user,DELETE,"project_id, user_id", +projects,project_users,modify_project_user,UPDATE,"project_id, user_id, data__role", +projects,projects,list_projects,SELECT,, +projects,projects,retrieve_project,SELECT,project_id, +projects,projects,create_project,INSERT,data__name, +projects,projects,modify_project,UPDATE,"project_id, data__name", +projects,projects,archive_project,EXEC,project_id, +uploads,upload_parts,add_upload_part,INSERT,upload_id, +uploads,uploads,create_upload,INSERT,"data__bytes, data__filename, data__mime_type, data__purpose", +uploads,uploads,cancel_upload,EXEC,upload_id, +uploads,uploads,complete_upload,EXEC,"upload_id, data__part_ids", +users,users,list_users,SELECT,, +users,users,retrieve_user,SELECT,user_id, +users,users,delete_user,DELETE,user_id, +users,users,modify_user,UPDATE,"user_id, data__role", +vector_stores,files_in_vector_store_batches,list_files_in_vector_store_batch,SELECT,"batch_id, vector_store_id", +vector_stores,vector_store_file_batches,get_vector_store_file_batch,SELECT,"batch_id, vector_store_id", +vector_stores,vector_store_file_batches,create_vector_store_file_batch,INSERT,"vector_store_id, data__file_ids", +vector_stores,vector_store_file_batches,cancel_vector_store_file_batch,EXEC,"batch_id, vector_store_id", +vector_stores,vector_store_files,get_vector_store_file,SELECT,"file_id, vector_store_id", +vector_stores,vector_store_files,list_vector_store_files,SELECT,vector_store_id, +vector_stores,vector_store_files,create_vector_store_file,INSERT,"vector_store_id, data__file_id", +vector_stores,vector_store_files,delete_vector_store_file,DELETE,"file_id, vector_store_id", +vector_stores,vector_stores,get_vector_store,SELECT,vector_store_id, +vector_stores,vector_stores,list_vector_stores,SELECT,, +vector_stores,vector_stores,create_vector_store,INSERT,, +vector_stores,vector_stores,delete_vector_store,DELETE,vector_store_id, +vector_stores,vector_stores,modify_vector_store,UPDATE,vector_store_id, diff --git a/provider-dev/config/service_names.json b/provider-dev/config/service_names.json new file mode 100644 index 0000000..55cb1be --- /dev/null +++ b/provider-dev/config/service_names.json @@ -0,0 +1,13 @@ +{ + "assistants": "assistants", + "batch": "batches", + "containers": "containers", + "conversations": "conversations", + "evals": "evals", + "files": "files", + "fine_tuning": "fine_tuning", + "models": "models", + "skills": "skills", + "uploads": "uploads", + "vector_stores": "vector_stores" +} diff --git a/provider-dev/config/spec_pin.json b/provider-dev/config/spec_pin.json new file mode 100644 index 0000000..820b4c2 --- /dev/null +++ b/provider-dev/config/spec_pin.json @@ -0,0 +1,15 @@ +{ + "source": "https://github.com/openai/openai-openapi", + "artifact": "openapi.yaml", + "branch": "main", + "ref": "a3276900e58b8b2a92e0cb087cd2e6e005f58458", + "ref_date": "2026-07-14T19:37:10Z", + "raw_url": "https://raw.githubusercontent.com/openai/openai-openapi/a3276900e58b8b2a92e0cb087cd2e6e005f58458/openapi.yaml", + "fetched_at": "2026-07-14T22:06:29.695Z", + "sha256": "74cbcf73838f4cd7e209b2d3f2e9ddc9fa155f21a44360b6fac7646a6d4f5f8b", + "openapi_version": "3.1.0", + "info_version": "2.3.0", + "info_title": "OpenAI API", + "paths": 162, + "operations": 242 +} diff --git a/provider-dev/docgen/provider-data/headerContent1.txt b/provider-dev/docgen/provider-data/headerContent1.txt index 8e95862..aec1505 100644 --- a/provider-dev/docgen/provider-data/headerContent1.txt +++ b/provider-dev/docgen/provider-data/headerContent1.txt @@ -1,19 +1,19 @@ ---- -title: REPLACEME -hide_title: false -hide_table_of_contents: false -keywords: - - REPLACEME - - stackql - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage REPLACEME resources using SQL -custom_edit_url: null -image: /img/stackql-REPLACEME-provider-featured-image.png -id: 'provider-intro' ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; - -REPLACEME with description for the provider. \ No newline at end of file +--- +title: openai +hide_title: false +hide_table_of_contents: false +keywords: + - openai + - stackql + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage OpenAI resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +id: 'provider-intro' +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; + +The OpenAI platform surface available to standard API keys - models, files, fine-tuning, batches, vector stores, assistants, evals, conversations, uploads, containers and skills - queried and managed with SQL. The organization/admin surface is the sibling `openai_admin` provider. diff --git a/provider-dev/docgen/provider-data/headerContent2.txt b/provider-dev/docgen/provider-data/headerContent2.txt index 0eeb8c1..5f9d410 100644 --- a/provider-dev/docgen/provider-data/headerContent2.txt +++ b/provider-dev/docgen/provider-data/headerContent2.txt @@ -1,42 +1,238 @@ -See also: -[[` SHOW `]](https://stackql.io/docs/language-spec/show) [[` DESCRIBE `]](https://stackql.io/docs/language-spec/describe) [[` REGISTRY `]](https://stackql.io/docs/language-spec/registry) -* * * - -## Installation - -To pull the latest version of the `REPLACEME` provider, run the following command: - -```bash -REGISTRY PULL REPLACEME; -``` -> To view previous provider versions or to pull a specific provider version, see [here](https://stackql.io/docs/language-spec/registry). - -## Authentication - -The following system environment variables are used for authentication by default: - -- - REPLACEME API token (see \ No newline at end of file +See also: +[[` SHOW `]](https://stackql.io/docs/language-spec/show) [[` DESCRIBE `]](https://stackql.io/docs/language-spec/describe) [[` REGISTRY `]](https://stackql.io/docs/language-spec/registry) +* * * + +## Installation + +To pull the latest version of the `openai` provider, run the following command: + +```bash +REGISTRY PULL openai; +``` +> To view previous provider versions or to pull a specific provider version, see [here](https://stackql.io/docs/language-spec/registry). + +## Authentication + +The following system environment variables are used for authentication by default: + +- - OpenAI API key, `sk-...` (see How to Create an OpenAI API Key) + +These variables are sourced at runtime (from the local machine or as CI variables/secrets). + +A standard API key carries its own organization and project defaults, so neither is required on any query. To scope a request explicitly, supply the optional `openai-organization` / `openai-project` headers - they are hyphenated wire names, so they are addressed with double quotes: `WHERE "openai-organization" = 'org-...'`. The organization/admin surface (usage, costs, projects, users, invites, audit logs) uses a separate **admin** key and lives in the sibling [`openai_admin`](https://openai-admin-provider.stackql.io) provider. + +
+ +Using different environment variables + +To use different environment variables (instead of the defaults), use the `--auth` flag of the `stackql` program. For example: + +```bash + +AUTH='{ "openai": { "type": "bearer", "credentialsenvvar": "OPENAI_API_KEY" }}' +stackql shell --auth="${AUTH}" + +``` +or using PowerShell: + +```powershell + +$Auth = "{ 'openai': { 'type': 'bearer', 'credentialsenvvar': 'OPENAI_API_KEY' }}" +stackql.exe shell --auth=$Auth + +``` +
+ +## Fine-tuning history and checkpoints + +Every fine-tuning job, newest first, with the tuning method and any failure reason: + +```sql +SELECT + id, + model, + status, + fine_tuned_model, + trained_tokens, + date(created_at, 'unixepoch') AS created, + json_extract(method, '$.type') AS method_type, + json_extract(error, '$.message') AS error_message +FROM openai.fine_tuning.jobs +ORDER BY created_at DESC; +``` + +Spend and success at a glance - tokens trained per base model: + +```sql +SELECT + model, + count(*) AS jobs, + sum(trained_tokens) AS trained_tokens, + sum(CASE WHEN status = 'succeeded' THEN 1 ELSE 0 END) AS succeeded, + sum(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) AS failed +FROM openai.fine_tuning.jobs +GROUP BY model +ORDER BY trained_tokens DESC; +``` + +Checkpoint inventory for one job - pick the best checkpoint by validation loss: + +```sql +SELECT + step_number, + fine_tuned_model_checkpoint, + json_extract(metrics, '$.train_loss') AS train_loss, + json_extract(metrics, '$.valid_loss') AS valid_loss, + json_extract(metrics, '$.full_valid_loss') AS full_valid_loss +FROM openai.fine_tuning.checkpoints +WHERE fine_tuning_job_id = 'ftjob-abc123' +ORDER BY step_number; +``` + +## Async jobs: create, poll, cancel + +Fine-tuning jobs, batches, vector store file batches and uploads are all the same shape - `INSERT` creates, `SELECT` polls, `EXEC` cancels: + +```sql +-- create +INSERT INTO openai.fine_tuning.jobs (model, training_file) +SELECT 'gpt-4o-mini-2024-07-18', 'file-abc123'; + +-- poll +SELECT status, trained_tokens, fine_tuned_model, json_extract(error, '$.message') AS error_message +FROM openai.fine_tuning.jobs +WHERE fine_tuning_job_id = 'ftjob-abc123'; + +-- cancel +EXEC openai.fine_tuning.jobs.cancel @fine_tuning_job_id = 'ftjob-abc123'; +``` + +## Batch status and error triage + +Batches that are not finished, with their per-request tallies: + +```sql +SELECT + id, + status, + endpoint, + json_extract(request_counts, '$.total') AS requests_total, + json_extract(request_counts, '$.completed') AS requests_completed, + json_extract(request_counts, '$.failed') AS requests_failed, + error_file_id, + date(created_at, 'unixepoch') AS created +FROM openai.batches.batches +WHERE status <> 'completed' +ORDER BY created_at DESC; +``` + +Triage the failures - batches with failed requests, and where to read the errors: + +```sql +SELECT + id, + status, + json_extract(request_counts, '$.failed') AS requests_failed, + output_file_id, + error_file_id, + date(coalesce(failed_at, completed_at, created_at), 'unixepoch') AS last_event +FROM openai.batches.batches +WHERE json_extract(request_counts, '$.failed') > 0 + OR status IN ('failed', 'expired', 'cancelled') +ORDER BY last_event DESC; +``` + +## Vector store audit + +Stores by size, with their file processing state: + +```sql +SELECT + name, + status, + round(usage_bytes / 1048576.0, 2) AS size_mb, + json_extract(file_counts, '$.total') AS files_total, + json_extract(file_counts, '$.completed') AS files_completed, + json_extract(file_counts, '$.failed') AS files_failed, + date(created_at, 'unixepoch') AS created, + date(last_active_at, 'unixepoch') AS last_active +FROM openai.vector_stores.vector_stores +ORDER BY usage_bytes DESC; +``` + +Which files failed to ingest, and why: + +```sql +SELECT + id AS file_id, + status, + usage_bytes, + json_extract(last_error, '$.code') AS error_code, + json_extract(last_error, '$.message') AS error_message +FROM openai.vector_stores.files +WHERE vector_store_id = 'vs_abc123' + AND status = 'failed'; +``` + +Idle stores - candidates for cleanup: + +```sql +SELECT name, id, round(usage_bytes / 1048576.0, 2) AS size_mb, + date(last_active_at, 'unixepoch') AS last_active +FROM openai.vector_stores.vector_stores +WHERE last_active_at < strftime('%s', date('now', '-30 days')) +ORDER BY usage_bytes DESC; +``` + +## File estate by purpose and age + +The whole file estate, grouped by what it is for: + +```sql +SELECT + purpose, + count(*) AS files, + round(sum(bytes) / 1048576.0, 2) AS total_mb, + min(date(created_at, 'unixepoch')) AS oldest, + max(date(created_at, 'unixepoch')) AS newest +FROM openai.files.files +GROUP BY purpose +ORDER BY total_mb DESC; +``` + +`purpose` is filtered on the wire, so narrowing is a server-side fetch rather than a client-side scan: + +```sql +SELECT id, filename, round(bytes / 1048576.0, 2) AS size_mb, + date(created_at, 'unixepoch') AS created, status +FROM openai.files.files +WHERE purpose = 'fine-tune' +ORDER BY created_at; +``` + +## Assistants inventory + +> The Assistants family (assistants, threads, messages, runs, run steps) carries OpenAI's **deprecation** in favour of the Responses API. It is mapped and labelled here for inventory and migration work; new build-outs should target Responses. + +What assistants exist, on which models: + +```sql +SELECT + id, + name, + model, + json_array_length(tools) AS tool_count, + date(created_at, 'unixepoch') AS created +FROM openai.assistants.assistants +ORDER BY created_at DESC +LIMIT 20; +``` + +Assistants by model - the migration surface, largest first: + +```sql +SELECT model, count(*) AS assistants +FROM openai.assistants.assistants +GROUP BY model +ORDER BY assistants DESC; +``` diff --git a/provider-dev/docgen/sanitize_docs.mjs b/provider-dev/docgen/sanitize_docs.mjs new file mode 100644 index 0000000..7b4a7a2 --- /dev/null +++ b/provider-dev/docgen/sanitize_docs.mjs @@ -0,0 +1,110 @@ +#!/usr/bin/env node +// Post-generate docs sanitizer. The OpenAI spec's field/method descriptions +// contain relative links to OpenAI's own docs (`[Files API](/docs/api-reference/ +// files/retrieve-contents)`, `/docs/guides/...`, `/docs/models`). generate-docs +// carries those through verbatim, so they resolve against the stackql microsite +// and 404. +// +// Fix: prefix every `/docs/...` link with `https://platform.openai.com`. OpenAI's +// path structure has moved (to developers.openai.com, with renamed leaves - +// retrieve-contents -> retrieve, fine-tuning -> model-optimization), so the new +// deep paths cannot be computed deterministically. But platform.openai.com serves +// a 301 redirect from every old `/docs/...` path to its current home (verified +// 25/26 distinct targets at build time; the 26th is a live page behind an anti-bot +// 403, not a 404), so the host prefix lands users on the right page and stays +// correct as OpenAI reorganises - the redirect map is theirs to maintain, not ours. +// +// Only `/docs/...` links are touched; internal `/services/...` navigation is left +// alone. Idempotent (rewritten https:// links no longer match) and re-runnable. +// Usage: node provider-dev/docgen/sanitize_docs.mjs [--docs-dir website/docs] + +import { readFileSync, writeFileSync, readdirSync, statSync } from 'node:fs'; +import { join, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..'); +const args = process.argv.slice(2); +const docsDirArg = args.indexOf('--docs-dir'); +const docsDir = docsDirArg !== -1 ? args[docsDirArg + 1] : join(repoRoot, 'website', 'docs'); + +const HOST = 'https://platform.openai.com'; +// markdown `](/docs/...)` and html `href="/docs/..."`; only the /docs/ subtree +const MD_LINK = /\]\((\/docs\/)/g; +const HTML_HREF = /(href=")(\/docs\/)/g; + +function walk(dir) { + const out = []; + for (const entry of readdirSync(dir)) { + const p = join(dir, entry); + if (statSync(p).isDirectory()) out.push(...walk(p)); + else if (entry.endsWith('.md') || entry.endsWith('.mdx')) out.push(p); + } + return out; +} + +// --------------------------------------------------------------------------- +// SQL example fixups +// +// The doc generator emits every parameter into the example WHERE clause / INSERT +// column list verbatim, which produces SQL that does not parse: +// - `order` is a stackql reserved word ("syntax error ... near 'order'") +// - `openai-organization` / `openai-project` are hyphenated identifiers +// ("unexpected: openai - organization"); they carry the vendor's headers, +// whose wire names must be hyphenated +// Both parse once double-quoted, so quote them. +// +// `limit` is dropped from the examples entirely: it is the page-size parameter +// driven by the `top` query-param pushdown, so a SQL `LIMIT n` clause supplies it +// automatically - showing `WHERE limit = ...` teaches the wrong idiom. The params +// table still documents it (annotated in pre_normalize.mjs). +// --------------------------------------------------------------------------- + +// identifiers that must be double-quoted to parse in a WHERE clause / column list +const NEEDS_QUOTING = ['order', 'openai-organization', 'openai-project']; +const quoteAlt = NEEDS_QUOTING.map((s) => s.replace(/[-]/g, '\\-')).join('|'); +const WHERE_QUOTE = new RegExp(`^((?:WHERE|AND) )(${quoteAlt})( = )`, 'gm'); +const COLUMN_QUOTE = new RegExp(`^(${quoteAlt})(,?)$`, 'gm'); +const LIMIT_LINE = /^(?:WHERE|AND) limit = '\{\{ limit \}\}'[ \t]*\r?\n/gm; + +// Within a SQL block, a removed leading `WHERE` must be replaced by promoting the +// next `AND` condition, else the clause is orphaned. +function promoteOrphanedAnd(sqlBlock) { + const lines = sqlBlock.split('\n'); + if (lines.some((l) => /^WHERE /.test(l))) return sqlBlock; + const idx = lines.findIndex((l) => /^AND /.test(l)); + if (idx === -1) return sqlBlock; + lines[idx] = lines[idx].replace(/^AND /, 'WHERE '); + return lines.join('\n'); +} + +function fixSqlBlocks(text, counters) { + return text.replace(/```sql\n([\s\S]*?)```/g, (whole, body) => { + let out = body; + const beforeLimit = out; + out = out.replace(LIMIT_LINE, () => { counters.limitDropped++; return ''; }); + if (out !== beforeLimit) out = promoteOrphanedAnd(out); + out = out.replace(WHERE_QUOTE, (_m, pre, ident, post) => { counters.quoted++; return `${pre}"${ident}"${post}`; }); + out = out.replace(COLUMN_QUOTE, (_m, ident, comma) => { counters.quoted++; return `"${ident}"${comma}`; }); + return '```sql\n' + out + '```'; + }); +} + +const files = walk(docsDir); +let filesTouched = 0; +let rewrites = 0; +const counters = { limitDropped: 0, quoted: 0 }; + +for (const file of files) { + const before = readFileSync(file, 'utf8'); + let after = before.replace(MD_LINK, () => { rewrites++; return `](${HOST}/docs/`; }); + after = after.replace(HTML_HREF, (_m, pre) => { rewrites++; return `${pre}${HOST}/docs/`; }); + after = fixSqlBlocks(after, counters); + if (after !== before) { + writeFileSync(file, after); + filesTouched++; + } +} + +console.log(`Sanitized ${rewrites} OpenAI doc link(s) -> prefixed with ${HOST}`); +console.log(`SQL examples: dropped ${counters.limitDropped} \`limit\` predicate(s) (supplied by a SQL LIMIT clause via the top pushdown); quoted ${counters.quoted} identifier(s) that do not parse bare (${NEEDS_QUOTING.join(', ')}).`); +console.log(`Touched ${filesTouched} of ${files.length} file(s) scanned.`); diff --git a/provider-dev/downloaded/openapi.yaml b/provider-dev/downloaded/openapi.yaml new file mode 100644 index 0000000..ccc5693 --- /dev/null +++ b/provider-dev/downloaded/openapi.yaml @@ -0,0 +1,81040 @@ +openapi: 3.1.0 +info: + title: OpenAI API + description: >- + The OpenAI REST API. Please see + https://platform.openai.com/docs/api-reference for more details. + version: 2.3.0 + termsOfService: https://openai.com/policies/terms-of-use + contact: + name: OpenAI Support + url: https://help.openai.com/ + license: + name: MIT + url: https://github.com/openai/openai-openapi/blob/master/LICENSE +servers: + - url: https://api.openai.com/v1 +security: + - ApiKeyAuth: [] +tags: + - name: Assistants + description: Build Assistants that can call models and use tools. + - name: Audio + description: Turn audio into text or text into audio. + - name: Chat + description: >- + Given a list of messages comprising a conversation, the model will return + a response. + - name: Conversations + description: Manage conversations and conversation items. + - name: Completions + description: >- + Given a prompt, the model will return one or more predicted completions, + and can also return the probabilities of alternative tokens at each + position. + - name: Embeddings + description: >- + Get a vector representation of a given input that can be easily consumed + by machine learning models and algorithms. + - name: Evals + description: Manage and run evals in the OpenAI platform. + - name: Fine-tuning + description: Manage fine-tuning jobs to tailor a model to your specific training data. + - name: Graders + description: Manage and run graders in the OpenAI platform. + - name: Batch + description: Create large batches of API requests to run asynchronously. + - name: Files + description: >- + Files are used to upload documents that can be used with features like + Assistants and Fine-tuning. + - name: Uploads + description: Use Uploads to upload large files in multiple parts. + - name: Images + description: Given a prompt and/or an input image, the model will generate a new image. + - name: Models + description: List and describe the various models available in the API. + - name: Moderations + description: >- + Given text and/or image inputs, classifies if those inputs are potentially + harmful. + - name: Audit Logs + description: List user actions and configuration changes within this organization. +paths: + /assistants: + get: + operationId: listAssistants + tags: + - Assistants + summary: Returns a list of assistants. + deprecated: true + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListAssistantsResponse' + x-oaiMeta: + name: List assistants + group: assistants + examples: + request: + curl: | + curl "https://api.openai.com/v1/assistants?order=desc&limit=20" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.assistants.list() + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistants = await openai.beta.assistants.list({ + order: "desc", + limit: "20", + }); + + console.log(myAssistants.data); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const assistant of client.beta.assistants.list()) { + console.log(assistant.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Assistants.List(context.TODO(), openai.BetaAssistantListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.AssistantListPage; + import com.openai.models.beta.assistants.AssistantListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantListPage page = client.beta().assistants().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.assistants.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698982736, + "name": "Coding Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc456", + "object": "assistant", + "created_at": 1698982718, + "name": "My Assistant", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc789", + "object": "assistant", + "created_at": 1698982643, + "name": null, + "description": null, + "model": "gpt-4o", + "instructions": null, + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + ], + "first_id": "asst_abc123", + "last_id": "asst_abc789", + "has_more": false + } + post: + operationId: createAssistant + tags: + - Assistants + summary: Create an assistant with a model and instructions. + deprecated: true + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAssistantRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantObject' + x-oaiMeta: + name: Create assistant + group: assistants + examples: + - title: Code Interpreter + request: + curl: | + curl "https://api.openai.com/v1/assistants" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "name": "Math Tutor", + "tools": [{"type": "code_interpreter"}], + "model": "gpt-4o" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.create( + model="gpt-4o", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.create({ + instructions: + "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + name: "Math Tutor", + tools: [{ type: "code_interpreter" }], + model: "gpt-4o", + }); + + console.log(myAssistant); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const assistant = await client.beta.assistants.create({ model: + 'gpt-4o' }); + + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{\n\t\tModel: shared.ChatModelGPT4o,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.ChatModel; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantCreateParams params = AssistantCreateParams.builder() + .model(ChatModel.GPT_4O) + .build(); + Assistant assistant = client.beta().assistants().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.create(model: :"gpt-4o") + + puts(assistant) + response: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698984975, + "name": "Math Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + - title: Files + request: + curl: | + curl https://api.openai.com/v1/assistants \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [{"type": "file_search"}], + "tool_resources": {"file_search": {"vector_store_ids": ["vs_123"]}}, + "model": "gpt-4o" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.create( + model="gpt-4o", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.create({ + instructions: + "You are an HR bot, and you have access to files to answer employee questions about company policies.", + name: "HR Helper", + tools: [{ type: "file_search" }], + tool_resources: { + file_search: { + vector_store_ids: ["vs_123"] + } + }, + model: "gpt-4o" + }); + + console.log(myAssistant); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const assistant = await client.beta.assistants.create({ model: + 'gpt-4o' }); + + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{\n\t\tModel: shared.ChatModelGPT4o,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.ChatModel; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantCreateParams params = AssistantCreateParams.builder() + .model(ChatModel.GPT_4O) + .build(); + Assistant assistant = client.beta().assistants().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.create(model: :"gpt-4o") + + puts(assistant) + response: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1699009403, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": ["vs_123"] + } + }, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + /assistants/{assistant_id}: + get: + operationId: getAssistant + tags: + - Assistants + summary: Retrieves an assistant. + deprecated: true + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to retrieve. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantObject' + x-oaiMeta: + name: Retrieve assistant + group: assistants + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.retrieve( + "assistant_id", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.retrieve( + "asst_abc123" + ); + + console.log(myAssistant); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const assistant = await + client.beta.assistants.retrieve('assistant_id'); + + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.Get(context.TODO(), \"assistant_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Assistant assistant = client.beta().assistants().retrieve("assistant_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.retrieve("assistant_id") + + puts(assistant) + response: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1699009709, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [ + { + "type": "file_search" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + post: + operationId: modifyAssistant + tags: + - Assistants + summary: Modifies an assistant. + deprecated: true + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to modify. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyAssistantRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantObject' + x-oaiMeta: + name: Modify assistant + group: assistants + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "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.", + "tools": [{"type": "file_search"}], + "model": "gpt-4o" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.update( + assistant_id="assistant_id", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myUpdatedAssistant = await openai.beta.assistants.update( + "asst_abc123", + { + 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.", + name: "HR Helper", + tools: [{ type: "file_search" }], + model: "gpt-4o" + } + ); + + console.log(myUpdatedAssistant); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const assistant = await + client.beta.assistants.update('assistant_id'); + + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.Update(\n\t\tcontext.TODO(),\n\t\t\"assistant_id\",\n\t\topenai.BetaAssistantUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Assistant assistant = client.beta().assistants().update("assistant_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.update("assistant_id") + + puts(assistant) + response: | + { + "id": "asst_123", + "object": "assistant", + "created_at": 1699009709, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "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.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": [] + } + }, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + delete: + operationId: deleteAssistant + tags: + - Assistants + summary: Delete an assistant. + deprecated: true + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAssistantResponse' + x-oaiMeta: + name: Delete assistant + group: assistants + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant_deleted = client.beta.assistants.delete( + "assistant_id", + ) + print(assistant_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const response = await openai.beta.assistants.delete("asst_abc123"); + + console.log(response); + } + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const assistantDeleted = await + client.beta.assistants.delete('assistant_id'); + + + console.log(assistantDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistantDeleted, err := client.Beta.Assistants.Delete(context.TODO(), \"assistant_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistantDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.AssistantDeleteParams; + import com.openai.models.beta.assistants.AssistantDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantDeleted assistantDeleted = client.beta().assistants().delete("assistant_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant_deleted = openai.beta.assistants.delete("assistant_id") + + puts(assistant_deleted) + response: | + { + "id": "asst_abc123", + "object": "assistant.deleted", + "deleted": true + } + /audio/speech: + post: + operationId: createSpeech + tags: + - Audio + summary: | + Generates audio from the input text. + + Returns the audio file content, or a stream of audio events. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateSpeechRequest' + responses: + '200': + description: OK + headers: + Transfer-Encoding: + schema: + type: string + description: chunked + content: + application/octet-stream: + schema: + type: string + format: binary + text/event-stream: + schema: + $ref: '#/components/schemas/CreateSpeechResponseStreamEvent' + x-oaiMeta: + name: Create speech + group: audio + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/audio/speech \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "gpt-4o-mini-tts", + "input": "The quick brown fox jumped over the lazy dog.", + "voice": "alloy" + }' \ + --output speech.mp3 + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + speech = client.audio.speech.create( + input="input", + model="tts-1", + voice="alloy", + ) + print(speech) + content = speech.read() + print(content) + javascript: | + import fs from "fs"; + import path from "path"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const speechFile = path.resolve("./speech.mp3"); + + async function main() { + const mp3 = await openai.audio.speech.create({ + model: "gpt-4o-mini-tts", + voice: "alloy", + input: "Today is a wonderful day to build something people love!", + }); + console.log(speechFile); + const buffer = Buffer.from(await mp3.arrayBuffer()); + await fs.promises.writeFile(speechFile, buffer); + } + main(); + csharp: | + using System; + using System.IO; + + using OpenAI.Audio; + + AudioClient client = new( + model: "gpt-4o-mini-tts", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + BinaryData speech = client.GenerateSpeech( + text: "The quick brown fox jumped over the lazy dog.", + voice: GeneratedSpeechVoice.Alloy + ); + + using FileStream stream = File.OpenWrite("speech.mp3"); + speech.ToStream().CopyTo(stream); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const speech = await client.audio.speech.create({ + input: 'input', + model: 'tts-1', + voice: 'alloy', + }); + + console.log(speech); + + const content = await speech.blob(); + console.log(content); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tspeech, err := client.Audio.Speech.New(context.TODO(), openai.AudioSpeechNewParams{\n\t\tInput: \"input\",\n\t\tModel: openai.SpeechModelTTS1,\n\t\tVoice: openai.AudioSpeechNewParamsVoiceUnion{\n\t\t\tOfAudioSpeechNewsVoiceString2: openai.String(\"alloy\"),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", speech)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.http.HttpResponse; + import com.openai.models.audio.speech.SpeechCreateParams; + import com.openai.models.audio.speech.SpeechModel; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SpeechCreateParams params = SpeechCreateParams.builder() + .input("input") + .model(SpeechModel.TTS_1) + .voice(SpeechCreateParams.Voice.UnionMember1.ALLOY) + .build(); + HttpResponse speech = client.audio().speech().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + speech = openai.audio.speech.create(input: "input", model: + :"tts-1", voice: :alloy) + + + puts(speech) + - title: SSE Stream Format + request: + curl: | + curl https://api.openai.com/v1/audio/speech \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "gpt-4o-mini-tts", + "input": "The quick brown fox jumped over the lazy dog.", + "voice": "alloy", + "stream_format": "sse" + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const speech = await client.audio.speech.create({ + input: 'input', + model: 'tts-1', + voice: 'alloy', + }); + + console.log(speech); + + const content = await speech.blob(); + console.log(content); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + speech = client.audio.speech.create( + input="input", + model="tts-1", + voice="alloy", + ) + print(speech) + content = speech.read() + print(content) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tspeech, err := client.Audio.Speech.New(context.TODO(), openai.AudioSpeechNewParams{\n\t\tInput: \"input\",\n\t\tModel: openai.SpeechModelTTS1,\n\t\tVoice: openai.AudioSpeechNewParamsVoiceUnion{\n\t\t\tOfAudioSpeechNewsVoiceString2: openai.String(\"alloy\"),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", speech)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.http.HttpResponse; + import com.openai.models.audio.speech.SpeechCreateParams; + import com.openai.models.audio.speech.SpeechModel; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SpeechCreateParams params = SpeechCreateParams.builder() + .input("input") + .model(SpeechModel.TTS_1) + .voice(SpeechCreateParams.Voice.UnionMember1.ALLOY) + .build(); + HttpResponse speech = client.audio().speech().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + speech = openai.audio.speech.create(input: "input", model: + :"tts-1", voice: :alloy) + + + puts(speech) + /audio/transcriptions: + post: + operationId: createTranscription + tags: + - Audio + summary: > + Transcribes audio into the input language. + + + Returns a transcription object in `json`, `diarized_json`, or + `verbose_json` + + format, or a stream of transcript events. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateTranscriptionRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CreateTranscriptionResponseJson' + - $ref: >- + #/components/schemas/CreateTranscriptionResponseDiarizedJson + - $ref: >- + #/components/schemas/CreateTranscriptionResponseVerboseJson + text/event-stream: + schema: + $ref: '#/components/schemas/CreateTranscriptionResponseStreamEvent' + x-oaiMeta: + name: Create transcription + group: audio + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F model="gpt-4o-transcribe" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for transcription in client.audio.transcriptions.create( + file=b"Example data", + model="gpt-4o-transcribe", + ): + print(transcription) + javascript: | + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "gpt-4o-transcribe", + }); + + console.log(transcription.text); + } + main(); + csharp: > + using System; + + + using OpenAI.Audio; + + string audioFilePath = "audio.mp3"; + + + AudioClient client = new( + model: "gpt-4o-transcribe", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + AudioTranscription transcription = + client.TranscribeAudio(audioFilePath); + + + Console.WriteLine($"{transcription.Text}"); + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const transcription = await client.audio.transcriptions.create({ + file: fs.createReadStream('speech.mp3'), + model: 'gpt-4o-transcribe', + }); + + console.log(transcription); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttranscription, err := client.Audio.Transcriptions.New(context.TODO(), openai.AudioTranscriptionNewParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tModel: openai.AudioModelGPT4oTranscribe,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", transcription)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.audio.AudioModel; + + import + com.openai.models.audio.transcriptions.TranscriptionCreateParams; + + import + com.openai.models.audio.transcriptions.TranscriptionCreateResponse; + + import java.io.ByteArrayInputStream; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + TranscriptionCreateParams params = TranscriptionCreateParams.builder() + .file(new ByteArrayInputStream("Example data".getBytes())) + .model(AudioModel.GPT_4O_TRANSCRIBE) + .build(); + TranscriptionCreateResponse transcription = client.audio().transcriptions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + transcription = openai.audio.transcriptions.create(file: + StringIO.new("Example data"), model: :"gpt-4o-transcribe") + + + puts(transcription) + response: | + { + "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.", + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 0, + "audio_tokens": 14 + }, + "output_tokens": 45, + "total_tokens": 59 + } + } + - title: Diarization + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/meeting.wav" \ + -F model="gpt-4o-transcribe-diarize" \ + -F response_format="diarized_json" \ + -F chunking_strategy=auto \ + -F 'known_speaker_names[]=agent' \ + -F 'known_speaker_references[]=data:audio/wav;base64,AAA...' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for transcription in client.audio.transcriptions.create( + file=b"Example data", + model="gpt-4o-transcribe", + ): + print(transcription) + javascript: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + const speakerRef = + fs.readFileSync("agent.wav").toString("base64"); + + + const transcript = await openai.audio.transcriptions.create({ + file: fs.createReadStream("meeting.wav"), + model: "gpt-4o-transcribe-diarize", + response_format: "diarized_json", + chunking_strategy: "auto", + extra_body: { + known_speaker_names: ["agent"], + known_speaker_references: [`data:audio/wav;base64,${speakerRef}`], + }, + }); + + + console.log(transcript.segments); + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const transcription = await client.audio.transcriptions.create({ + file: fs.createReadStream('speech.mp3'), + model: 'gpt-4o-transcribe', + }); + + console.log(transcription); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttranscription, err := client.Audio.Transcriptions.New(context.TODO(), openai.AudioTranscriptionNewParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tModel: openai.AudioModelGPT4oTranscribe,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", transcription)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.audio.AudioModel; + + import + com.openai.models.audio.transcriptions.TranscriptionCreateParams; + + import + com.openai.models.audio.transcriptions.TranscriptionCreateResponse; + + import java.io.ByteArrayInputStream; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + TranscriptionCreateParams params = TranscriptionCreateParams.builder() + .file(new ByteArrayInputStream("Example data".getBytes())) + .model(AudioModel.GPT_4O_TRANSCRIBE) + .build(); + TranscriptionCreateResponse transcription = client.audio().transcriptions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + transcription = openai.audio.transcriptions.create(file: + StringIO.new("Example data"), model: :"gpt-4o-transcribe") + + + puts(transcription) + response: | + { + "task": "transcribe", + "duration": 27.4, + "text": "Agent: Thanks for calling OpenAI support.\nA: Hi, I'm trying to enable diarization.\nAgent: Happy to walk you through the steps.", + "segments": [ + { + "type": "transcript.text.segment", + "id": "seg_001", + "start": 0.0, + "end": 4.7, + "text": "Thanks for calling OpenAI support.", + "speaker": "agent" + }, + { + "type": "transcript.text.segment", + "id": "seg_002", + "start": 4.7, + "end": 11.8, + "text": "Hi, I'm trying to enable diarization.", + "speaker": "A" + }, + { + "type": "transcript.text.segment", + "id": "seg_003", + "start": 12.1, + "end": 18.5, + "text": "Happy to walk you through the steps.", + "speaker": "agent" + } + ], + "usage": { + "type": "duration", + "seconds": 27 + } + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F model="gpt-4o-mini-transcribe" \ + -F stream=true + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for transcription in client.audio.transcriptions.create( + file=b"Example data", + model="gpt-4o-transcribe", + ): + print(transcription) + javascript: | + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const stream = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "gpt-4o-mini-transcribe", + stream: true, + }); + + for await (const event of stream) { + console.log(event); + } + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const transcription = await client.audio.transcriptions.create({ + file: fs.createReadStream('speech.mp3'), + model: 'gpt-4o-transcribe', + }); + + console.log(transcription); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttranscription, err := client.Audio.Transcriptions.New(context.TODO(), openai.AudioTranscriptionNewParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tModel: openai.AudioModelGPT4oTranscribe,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", transcription)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.audio.AudioModel; + + import + com.openai.models.audio.transcriptions.TranscriptionCreateParams; + + import + com.openai.models.audio.transcriptions.TranscriptionCreateResponse; + + import java.io.ByteArrayInputStream; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + TranscriptionCreateParams params = TranscriptionCreateParams.builder() + .file(new ByteArrayInputStream("Example data".getBytes())) + .model(AudioModel.GPT_4O_TRANSCRIBE) + .build(); + TranscriptionCreateResponse transcription = client.audio().transcriptions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + transcription = openai.audio.transcriptions.create(file: + StringIO.new("Example data"), model: :"gpt-4o-transcribe") + + + puts(transcription) + response: > + data: + {"type":"transcript.text.delta","delta":"I","logprobs":[{"token":"I","logprob":-0.00007588794,"bytes":[73]}]} + + + data: {"type":"transcript.text.delta","delta":" + see","logprobs":[{"token":" + see","logprob":-3.1281633e-7,"bytes":[32,115,101,101]}]} + + + data: {"type":"transcript.text.delta","delta":" + skies","logprobs":[{"token":" + skies","logprob":-2.3392786e-6,"bytes":[32,115,107,105,101,115]}]} + + + data: {"type":"transcript.text.delta","delta":" + of","logprobs":[{"token":" + of","logprob":-3.1281633e-7,"bytes":[32,111,102]}]} + + + data: {"type":"transcript.text.delta","delta":" + blue","logprobs":[{"token":" + blue","logprob":-1.0280384e-6,"bytes":[32,98,108,117,101]}]} + + + data: {"type":"transcript.text.delta","delta":" + and","logprobs":[{"token":" + and","logprob":-0.0005108566,"bytes":[32,97,110,100]}]} + + + data: {"type":"transcript.text.delta","delta":" + clouds","logprobs":[{"token":" + clouds","logprob":-1.9361265e-7,"bytes":[32,99,108,111,117,100,115]}]} + + + data: {"type":"transcript.text.delta","delta":" + of","logprobs":[{"token":" + of","logprob":-1.9361265e-7,"bytes":[32,111,102]}]} + + + data: {"type":"transcript.text.delta","delta":" + white","logprobs":[{"token":" + white","logprob":-7.89631e-7,"bytes":[32,119,104,105,116,101]}]} + + + data: + {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.0014890312,"bytes":[44]}]} + + + data: {"type":"transcript.text.delta","delta":" + the","logprobs":[{"token":" + the","logprob":-0.0110956915,"bytes":[32,116,104,101]}]} + + + data: {"type":"transcript.text.delta","delta":" + bright","logprobs":[{"token":" + bright","logprob":0.0,"bytes":[32,98,114,105,103,104,116]}]} + + + data: {"type":"transcript.text.delta","delta":" + blessed","logprobs":[{"token":" + blessed","logprob":-0.000045848617,"bytes":[32,98,108,101,115,115,101,100]}]} + + + data: {"type":"transcript.text.delta","delta":" + days","logprobs":[{"token":" + days","logprob":-0.000010802739,"bytes":[32,100,97,121,115]}]} + + + data: + {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.00001700133,"bytes":[44]}]} + + + data: {"type":"transcript.text.delta","delta":" + the","logprobs":[{"token":" + the","logprob":-0.0000118755715,"bytes":[32,116,104,101]}]} + + + data: {"type":"transcript.text.delta","delta":" + dark","logprobs":[{"token":" + dark","logprob":-5.5122365e-7,"bytes":[32,100,97,114,107]}]} + + + data: {"type":"transcript.text.delta","delta":" + sacred","logprobs":[{"token":" + sacred","logprob":-5.4385737e-6,"bytes":[32,115,97,99,114,101,100]}]} + + + data: {"type":"transcript.text.delta","delta":" + nights","logprobs":[{"token":" + nights","logprob":-4.00813e-6,"bytes":[32,110,105,103,104,116,115]}]} + + + data: + {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.0036910512,"bytes":[44]}]} + + + data: {"type":"transcript.text.delta","delta":" + and","logprobs":[{"token":" + and","logprob":-0.0031903093,"bytes":[32,97,110,100]}]} + + + data: {"type":"transcript.text.delta","delta":" + I","logprobs":[{"token":" + I","logprob":-1.504853e-6,"bytes":[32,73]}]} + + + data: {"type":"transcript.text.delta","delta":" + think","logprobs":[{"token":" + think","logprob":-4.3202e-7,"bytes":[32,116,104,105,110,107]}]} + + + data: {"type":"transcript.text.delta","delta":" + to","logprobs":[{"token":" + to","logprob":-1.9361265e-7,"bytes":[32,116,111]}]} + + + data: {"type":"transcript.text.delta","delta":" + myself","logprobs":[{"token":" + myself","logprob":-1.7432603e-6,"bytes":[32,109,121,115,101,108,102]}]} + + + data: + {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.29254505,"bytes":[44]}]} + + + data: {"type":"transcript.text.delta","delta":" + what","logprobs":[{"token":" + what","logprob":-0.016815351,"bytes":[32,119,104,97,116]}]} + + + data: {"type":"transcript.text.delta","delta":" + a","logprobs":[{"token":" + a","logprob":-3.1281633e-7,"bytes":[32,97]}]} + + + data: {"type":"transcript.text.delta","delta":" + wonderful","logprobs":[{"token":" + wonderful","logprob":-2.1008714e-6,"bytes":[32,119,111,110,100,101,114,102,117,108]}]} + + + data: {"type":"transcript.text.delta","delta":" + world","logprobs":[{"token":" + world","logprob":-8.180258e-6,"bytes":[32,119,111,114,108,100]}]} + + + data: + {"type":"transcript.text.delta","delta":".","logprobs":[{"token":".","logprob":-0.014231676,"bytes":[46]}]} + + + data: {"type":"transcript.text.done","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.","logprobs":[{"token":"I","logprob":-0.00007588794,"bytes":[73]},{"token":" + see","logprob":-3.1281633e-7,"bytes":[32,115,101,101]},{"token":" + skies","logprob":-2.3392786e-6,"bytes":[32,115,107,105,101,115]},{"token":" + of","logprob":-3.1281633e-7,"bytes":[32,111,102]},{"token":" + blue","logprob":-1.0280384e-6,"bytes":[32,98,108,117,101]},{"token":" + and","logprob":-0.0005108566,"bytes":[32,97,110,100]},{"token":" + clouds","logprob":-1.9361265e-7,"bytes":[32,99,108,111,117,100,115]},{"token":" + of","logprob":-1.9361265e-7,"bytes":[32,111,102]},{"token":" + white","logprob":-7.89631e-7,"bytes":[32,119,104,105,116,101]},{"token":",","logprob":-0.0014890312,"bytes":[44]},{"token":" + the","logprob":-0.0110956915,"bytes":[32,116,104,101]},{"token":" + bright","logprob":0.0,"bytes":[32,98,114,105,103,104,116]},{"token":" + blessed","logprob":-0.000045848617,"bytes":[32,98,108,101,115,115,101,100]},{"token":" + days","logprob":-0.000010802739,"bytes":[32,100,97,121,115]},{"token":",","logprob":-0.00001700133,"bytes":[44]},{"token":" + the","logprob":-0.0000118755715,"bytes":[32,116,104,101]},{"token":" + dark","logprob":-5.5122365e-7,"bytes":[32,100,97,114,107]},{"token":" + sacred","logprob":-5.4385737e-6,"bytes":[32,115,97,99,114,101,100]},{"token":" + nights","logprob":-4.00813e-6,"bytes":[32,110,105,103,104,116,115]},{"token":",","logprob":-0.0036910512,"bytes":[44]},{"token":" + and","logprob":-0.0031903093,"bytes":[32,97,110,100]},{"token":" + I","logprob":-1.504853e-6,"bytes":[32,73]},{"token":" + think","logprob":-4.3202e-7,"bytes":[32,116,104,105,110,107]},{"token":" + to","logprob":-1.9361265e-7,"bytes":[32,116,111]},{"token":" + myself","logprob":-1.7432603e-6,"bytes":[32,109,121,115,101,108,102]},{"token":",","logprob":-0.29254505,"bytes":[44]},{"token":" + what","logprob":-0.016815351,"bytes":[32,119,104,97,116]},{"token":" + a","logprob":-3.1281633e-7,"bytes":[32,97]},{"token":" + wonderful","logprob":-2.1008714e-6,"bytes":[32,119,111,110,100,101,114,102,117,108]},{"token":" + world","logprob":-8.180258e-6,"bytes":[32,119,111,114,108,100]},{"token":".","logprob":-0.014231676,"bytes":[46]}],"usage":{"input_tokens":14,"input_token_details":{"text_tokens":0,"audio_tokens":14},"output_tokens":45,"total_tokens":59}} + - title: Logprobs + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F "include[]=logprobs" \ + -F model="gpt-4o-transcribe" \ + -F response_format="json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for transcription in client.audio.transcriptions.create( + file=b"Example data", + model="gpt-4o-transcribe", + ): + print(transcription) + javascript: | + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "gpt-4o-transcribe", + response_format: "json", + include: ["logprobs"] + }); + + console.log(transcription); + } + main(); + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const transcription = await client.audio.transcriptions.create({ + file: fs.createReadStream('speech.mp3'), + model: 'gpt-4o-transcribe', + }); + + console.log(transcription); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttranscription, err := client.Audio.Transcriptions.New(context.TODO(), openai.AudioTranscriptionNewParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tModel: openai.AudioModelGPT4oTranscribe,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", transcription)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.audio.AudioModel; + + import + com.openai.models.audio.transcriptions.TranscriptionCreateParams; + + import + com.openai.models.audio.transcriptions.TranscriptionCreateResponse; + + import java.io.ByteArrayInputStream; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + TranscriptionCreateParams params = TranscriptionCreateParams.builder() + .file(new ByteArrayInputStream("Example data".getBytes())) + .model(AudioModel.GPT_4O_TRANSCRIBE) + .build(); + TranscriptionCreateResponse transcription = client.audio().transcriptions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + transcription = openai.audio.transcriptions.create(file: + StringIO.new("Example data"), model: :"gpt-4o-transcribe") + + + puts(transcription) + response: | + { + "text": "Hey, my knee is hurting and I want to see the doctor tomorrow ideally.", + "logprobs": [ + { "token": "Hey", "logprob": -1.0415299, "bytes": [72, 101, 121] }, + { "token": ",", "logprob": -9.805982e-5, "bytes": [44] }, + { "token": " my", "logprob": -0.00229799, "bytes": [32, 109, 121] }, + { + "token": " knee", + "logprob": -4.7159858e-5, + "bytes": [32, 107, 110, 101, 101] + }, + { "token": " is", "logprob": -0.043909557, "bytes": [32, 105, 115] }, + { + "token": " hurting", + "logprob": -1.1041146e-5, + "bytes": [32, 104, 117, 114, 116, 105, 110, 103] + }, + { "token": " and", "logprob": -0.011076359, "bytes": [32, 97, 110, 100] }, + { "token": " I", "logprob": -5.3193703e-6, "bytes": [32, 73] }, + { + "token": " want", + "logprob": -0.0017156356, + "bytes": [32, 119, 97, 110, 116] + }, + { "token": " to", "logprob": -7.89631e-7, "bytes": [32, 116, 111] }, + { "token": " see", "logprob": -5.5122365e-7, "bytes": [32, 115, 101, 101] }, + { "token": " the", "logprob": -0.0040786397, "bytes": [32, 116, 104, 101] }, + { + "token": " doctor", + "logprob": -2.3392786e-6, + "bytes": [32, 100, 111, 99, 116, 111, 114] + }, + { + "token": " tomorrow", + "logprob": -7.89631e-7, + "bytes": [32, 116, 111, 109, 111, 114, 114, 111, 119] + }, + { + "token": " ideally", + "logprob": -0.5800861, + "bytes": [32, 105, 100, 101, 97, 108, 108, 121] + }, + { "token": ".", "logprob": -0.00011093382, "bytes": [46] } + ], + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 0, + "audio_tokens": 14 + }, + "output_tokens": 45, + "total_tokens": 59 + } + } + - title: Word timestamps + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F "timestamp_granularities[]=word" \ + -F model="whisper-1" \ + -F response_format="verbose_json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for transcription in client.audio.transcriptions.create( + file=b"Example data", + model="gpt-4o-transcribe", + ): + print(transcription) + javascript: | + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "whisper-1", + response_format: "verbose_json", + timestamp_granularities: ["word"] + }); + + console.log(transcription.text); + } + main(); + csharp: > + using System; + + + using OpenAI.Audio; + + + string audioFilePath = "audio.mp3"; + + + AudioClient client = new( + model: "whisper-1", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + AudioTranscriptionOptions options = new() + + { + ResponseFormat = AudioTranscriptionFormat.Verbose, + TimestampGranularities = AudioTimestampGranularities.Word, + }; + + + AudioTranscription transcription = + client.TranscribeAudio(audioFilePath, options); + + + Console.WriteLine($"{transcription.Text}"); + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const transcription = await client.audio.transcriptions.create({ + file: fs.createReadStream('speech.mp3'), + model: 'gpt-4o-transcribe', + }); + + console.log(transcription); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttranscription, err := client.Audio.Transcriptions.New(context.TODO(), openai.AudioTranscriptionNewParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tModel: openai.AudioModelGPT4oTranscribe,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", transcription)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.audio.AudioModel; + + import + com.openai.models.audio.transcriptions.TranscriptionCreateParams; + + import + com.openai.models.audio.transcriptions.TranscriptionCreateResponse; + + import java.io.ByteArrayInputStream; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + TranscriptionCreateParams params = TranscriptionCreateParams.builder() + .file(new ByteArrayInputStream("Example data".getBytes())) + .model(AudioModel.GPT_4O_TRANSCRIBE) + .build(); + TranscriptionCreateResponse transcription = client.audio().transcriptions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + transcription = openai.audio.transcriptions.create(file: + StringIO.new("Example data"), model: :"gpt-4o-transcribe") + + + puts(transcription) + response: | + { + "task": "transcribe", + "language": "english", + "duration": 8.470000267028809, + "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.", + "words": [ + { + "word": "The", + "start": 0.0, + "end": 0.23999999463558197 + }, + ... + { + "word": "volleyball", + "start": 7.400000095367432, + "end": 7.900000095367432 + } + ], + "usage": { + "type": "duration", + "seconds": 9 + } + } + - title: Segment timestamps + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F "timestamp_granularities[]=segment" \ + -F model="whisper-1" \ + -F response_format="verbose_json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for transcription in client.audio.transcriptions.create( + file=b"Example data", + model="gpt-4o-transcribe", + ): + print(transcription) + javascript: | + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "whisper-1", + response_format: "verbose_json", + timestamp_granularities: ["segment"] + }); + + console.log(transcription.text); + } + main(); + csharp: > + using System; + + + using OpenAI.Audio; + + + string audioFilePath = "audio.mp3"; + + + AudioClient client = new( + model: "whisper-1", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + AudioTranscriptionOptions options = new() + + { + ResponseFormat = AudioTranscriptionFormat.Verbose, + TimestampGranularities = AudioTimestampGranularities.Segment, + }; + + + AudioTranscription transcription = + client.TranscribeAudio(audioFilePath, options); + + + Console.WriteLine($"{transcription.Text}"); + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const transcription = await client.audio.transcriptions.create({ + file: fs.createReadStream('speech.mp3'), + model: 'gpt-4o-transcribe', + }); + + console.log(transcription); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttranscription, err := client.Audio.Transcriptions.New(context.TODO(), openai.AudioTranscriptionNewParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tModel: openai.AudioModelGPT4oTranscribe,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", transcription)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.audio.AudioModel; + + import + com.openai.models.audio.transcriptions.TranscriptionCreateParams; + + import + com.openai.models.audio.transcriptions.TranscriptionCreateResponse; + + import java.io.ByteArrayInputStream; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + TranscriptionCreateParams params = TranscriptionCreateParams.builder() + .file(new ByteArrayInputStream("Example data".getBytes())) + .model(AudioModel.GPT_4O_TRANSCRIBE) + .build(); + TranscriptionCreateResponse transcription = client.audio().transcriptions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + transcription = openai.audio.transcriptions.create(file: + StringIO.new("Example data"), model: :"gpt-4o-transcribe") + + + puts(transcription) + response: | + { + "task": "transcribe", + "language": "english", + "duration": 8.470000267028809, + "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.", + "segments": [ + { + "id": 0, + "seek": 0, + "start": 0.0, + "end": 3.319999933242798, + "text": " The beach was a popular spot on a hot summer day.", + "tokens": [ + 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530 + ], + "temperature": 0.0, + "avg_logprob": -0.2860786020755768, + "compression_ratio": 1.2363636493682861, + "no_speech_prob": 0.00985979475080967 + }, + ... + ], + "usage": { + "type": "duration", + "seconds": 9 + } + } + /audio/translations: + post: + operationId: createTranslation + tags: + - Audio + summary: Translates audio into English. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateTranslationRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CreateTranslationResponseJson' + - $ref: '#/components/schemas/CreateTranslationResponseVerboseJson' + x-oaiMeta: + name: Create translation + group: audio + examples: + request: + curl: | + curl https://api.openai.com/v1/audio/translations \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/german.m4a" \ + -F model="whisper-1" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + translation = client.audio.translations.create( + file=b"Example data", + model="whisper-1", + ) + print(translation) + javascript: | + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const translation = await openai.audio.translations.create({ + file: fs.createReadStream("speech.mp3"), + model: "whisper-1", + }); + + console.log(translation.text); + } + main(); + csharp: > + using System; + + + using OpenAI.Audio; + + + string audioFilePath = "audio.mp3"; + + + AudioClient client = new( + model: "whisper-1", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + AudioTranscription transcription = + client.TranscribeAudio(audioFilePath); + + + Console.WriteLine($"{transcription.Text}"); + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const translation = await client.audio.translations.create({ + file: fs.createReadStream('speech.mp3'), + model: 'whisper-1', + }); + + console.log(translation); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttranslation, err := client.Audio.Translations.New(context.TODO(), openai.AudioTranslationNewParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tModel: openai.AudioModelWhisper1,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", translation)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.audio.AudioModel; + + import + com.openai.models.audio.translations.TranslationCreateParams; + + import + com.openai.models.audio.translations.TranslationCreateResponse; + + import java.io.ByteArrayInputStream; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + TranslationCreateParams params = TranslationCreateParams.builder() + .file(new ByteArrayInputStream("Example data".getBytes())) + .model(AudioModel.WHISPER_1) + .build(); + TranslationCreateResponse translation = client.audio().translations().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + translation = openai.audio.translations.create(file: + StringIO.new("Example data"), model: :"whisper-1") + + + puts(translation) + response: | + { + "text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?" + } + /audio/voice_consents: + post: + operationId: createVoiceConsent + tags: + - Audio + summary: Upload a voice consent recording. + description: > + Upload a consent recording that authorizes creation of a custom voice. + + + See the [custom voices guide](/docs/guides/text-to-speech#custom-voices) + for requirements and best practices. Custom voices are limited to + eligible customers. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateVoiceConsentRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VoiceConsentResource' + x-oaiMeta: + name: Create voice consent + group: audio + examples: + request: + curl: | + curl https://api.openai.com/v1/audio/voice_consents \ + -X POST \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F "name=John Doe" \ + -F "language=en-US" \ + -F "recording=@$HOME/consent_recording.wav;type=audio/x-wav" + response: '' + get: + operationId: listVoiceConsents + tags: + - Audio + summary: Returns a list of voice consent recordings. + description: > + List consent recordings available to your organization for creating + custom voices. + + + See the [custom voices + guide](/docs/guides/text-to-speech#custom-voices). Custom voices are + limited to eligible customers. + parameters: + - in: query + name: after + required: false + schema: + type: string + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VoiceConsentListResource' + x-oaiMeta: + name: List voice consents + group: audio + examples: + request: + curl: | + curl https://api.openai.com/v1/audio/voice_consents?limit=20 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + response: '' + /audio/voice_consents/{consent_id}: + get: + operationId: getVoiceConsent + tags: + - Audio + summary: Retrieves a voice consent recording. + description: > + Retrieve consent recording metadata used for creating custom voices. + + + See the [custom voices + guide](/docs/guides/text-to-speech#custom-voices). Custom voices are + limited to eligible customers. + parameters: + - in: path + name: consent_id + required: true + schema: + type: string + description: The ID of the consent recording to retrieve. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VoiceConsentResource' + x-oaiMeta: + name: Retrieve voice consent + group: audio + examples: + request: + curl: | + curl https://api.openai.com/v1/audio/voice_consents/cons_1234 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + response: '' + post: + operationId: updateVoiceConsent + 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. + + + See the [custom voices + guide](/docs/guides/text-to-speech#custom-voices). Custom voices are + limited to eligible customers. + parameters: + - in: path + name: consent_id + required: true + schema: + type: string + description: The ID of the consent recording to update. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateVoiceConsentRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VoiceConsentResource' + x-oaiMeta: + name: Update voice consent + group: audio + examples: + request: + curl: | + curl https://api.openai.com/v1/audio/voice_consents/cons_1234 \ + -X POST \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "John Doe" + }' + response: '' + delete: + operationId: deleteVoiceConsent + tags: + - Audio + summary: Deletes a voice consent recording. + description: > + Delete a consent recording that was uploaded for creating custom voices. + + + See the [custom voices + guide](/docs/guides/text-to-speech#custom-voices). Custom voices are + limited to eligible customers. + parameters: + - in: path + name: consent_id + required: true + schema: + type: string + description: The ID of the consent recording to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VoiceConsentDeletedResource' + x-oaiMeta: + name: Delete voice consent + group: audio + examples: + request: + curl: | + curl https://api.openai.com/v1/audio/voice_consents/cons_1234 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + response: '' + /audio/voices: + post: + operationId: createVoice + 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. + + + See the [custom voices guide](/docs/guides/text-to-speech#custom-voices) + for requirements and best practices. Custom voices are limited to + eligible customers. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateVoiceRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VoiceResource' + x-oaiMeta: + name: Create voice + group: audio + examples: + request: + curl: | + curl https://api.openai.com/v1/audio/voices \ + -X POST \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F "name=My new voice" \ + -F "consent=cons_1234" \ + -F "audio_sample=@$HOME/audio_sample.wav;type=audio/x-wav" + response: '' + /batches: + post: + summary: Creates and executes a batch from an uploaded file of requests + operationId: createBatch + tags: + - Batch + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - input_file_id + - endpoint + - completion_window + properties: + input_file_id: + type: string + description: > + The ID of an uploaded file that contains requests for the + new batch. + + + See [upload file](/docs/api-reference/files/create) for how + to upload a file. + + + Your input file must be formatted as a [JSONL + file](/docs/api-reference/batch/request-input), 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. + 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. + completion_window: + type: string + enum: + - 24h + description: >- + The time frame within which the batch should be processed. + Currently only `24h` is supported. + metadata: + $ref: '#/components/schemas/Metadata' + output_expires_after: + $ref: '#/components/schemas/BatchFileExpirationAfter' + responses: + '200': + description: Batch created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Batch' + x-oaiMeta: + name: Create batch + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "input_file_id": "file-abc123", + "endpoint": "/v1/chat/completions", + "completion_window": "24h" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + batch = client.batches.create( + completion_window="24h", + endpoint="/v1/responses", + input_file_id="input_file_id", + ) + print(batch.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.create({ + input_file_id: "file-abc123", + endpoint: "/v1/chat/completions", + completion_window: "24h" + }); + + console.log(batch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const batch = await client.batches.create({ + completion_window: '24h', + endpoint: '/v1/responses', + input_file_id: 'input_file_id', + }); + + console.log(batch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.New(context.TODO(), openai.BatchNewParams{\n\t\tCompletionWindow: openai.BatchNewParamsCompletionWindow24h,\n\t\tEndpoint: openai.BatchNewParamsEndpointV1Responses,\n\t\tInputFileID: \"input_file_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.Batch; + import com.openai.models.batches.BatchCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BatchCreateParams params = BatchCreateParams.builder() + .completionWindow(BatchCreateParams.CompletionWindow._24H) + .endpoint(BatchCreateParams.Endpoint.V1_RESPONSES) + .inputFileId("input_file_id") + .build(); + Batch batch = client.batches().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + batch = openai.batches.create( + completion_window: :"24h", + endpoint: :"/v1/responses", + input_file_id: "input_file_id" + ) + + puts(batch) + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "validating", + "output_file_id": null, + "error_file_id": null, + "created_at": 1711471533, + "in_progress_at": null, + "expires_at": null, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 0, + "completed": 0, + "failed": 0 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + get: + operationId: listBatches + tags: + - Batch + summary: List your organization's batches. + parameters: + - in: query + name: after + required: false + schema: + type: string + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + responses: + '200': + description: Batch listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ListBatchesResponse' + x-oaiMeta: + name: List batches + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches?limit=2 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.batches.list() + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.batches.list(); + + for await (const batch of list) { + console.log(batch); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const batch of client.batches.list()) { + console.log(batch.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Batches.List(context.TODO(), openai.BatchListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.BatchListPage; + import com.openai.models.batches.BatchListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BatchListPage page = client.batches().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.batches.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly job", + } + }, + { ... }, + ], + "first_id": "batch_abc123", + "last_id": "batch_abc456", + "has_more": true + } + /batches/{batch_id}: + get: + operationId: retrieveBatch + tags: + - Batch + summary: Retrieves a batch. + parameters: + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the batch to retrieve. + responses: + '200': + description: Batch retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Batch' + x-oaiMeta: + name: Retrieve batch + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches/batch_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + batch = client.batches.retrieve( + "batch_id", + ) + print(batch.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.retrieve("batch_abc123"); + + console.log(batch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const batch = await client.batches.retrieve('batch_id'); + + console.log(batch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.Get(context.TODO(), \"batch_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.Batch; + import com.openai.models.batches.BatchRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Batch batch = client.batches().retrieve("batch_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + batch = openai.batches.retrieve("batch_id") + + puts(batch) + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + /batches/{batch_id}/cancel: + post: + operationId: cancelBatch + 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. + parameters: + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the batch to cancel. + responses: + '200': + description: Batch is cancelling. Returns the cancelling batch's details. + content: + application/json: + schema: + $ref: '#/components/schemas/Batch' + x-oaiMeta: + name: Cancel batch + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches/batch_abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -X POST + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + batch = client.batches.cancel( + "batch_id", + ) + print(batch.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.cancel("batch_abc123"); + + console.log(batch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const batch = await client.batches.cancel('batch_id'); + + console.log(batch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.Cancel(context.TODO(), \"batch_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.Batch; + import com.openai.models.batches.BatchCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Batch batch = client.batches().cancel("batch_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + batch = openai.batches.cancel("batch_id") + + puts(batch) + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "cancelling", + "output_file_id": null, + "error_file_id": null, + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": 1711475133, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 23, + "failed": 1 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + /chat/completions: + get: + operationId: listChatCompletions + tags: + - Chat + summary: > + List stored Chat Completions. Only Chat Completions that have been + stored + + with the `store` parameter set to `true` will be returned. + parameters: + - name: model + in: query + description: The model used to generate the Chat Completions. + required: false + schema: + type: string + - name: metadata + in: query + description: | + A list of metadata keys to filter the Chat Completions by. Example: + + `metadata[key1]=value1&metadata[key2]=value2` + required: false + schema: + $ref: '#/components/schemas/Metadata' + - name: after + in: query + description: >- + Identifier for the last chat completion from the previous pagination + request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of Chat Completions to retrieve. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: >- + Sort order for Chat Completions by timestamp. Use `asc` for + ascending order or `desc` for descending order. Defaults to `asc`. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + responses: + '200': + description: A list of Chat Completions + content: + application/json: + schema: + $ref: '#/components/schemas/ChatCompletionList' + x-oaiMeta: + name: List Chat Completions + group: chat + path: list + examples: + request: + curl: | + curl https://api.openai.com/v1/chat/completions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.chat.completions.list() + page = page.data[0] + print(page.id) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const chatCompletion of client.chat.completions.list()) + { + console.log(chatCompletion.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Chat.Completions.List(context.TODO(), openai.ChatCompletionListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.chat.completions.ChatCompletionListPage; + + import + com.openai.models.chat.completions.ChatCompletionListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ChatCompletionListPage page = client.chat().completions().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.chat.completions.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "chat.completion", + "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "model": "gpt-5.4", + "created": 1738960610, + "request_id": "req_ded8ab984ec4bf840f37566c1011c417", + "tool_choice": null, + "usage": { + "total_tokens": 31, + "completion_tokens": 18, + "prompt_tokens": 13 + }, + "seed": 4944116822809979520, + "top_p": 1.0, + "temperature": 1.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0, + "system_fingerprint": "fp_50cad350e4", + "input_user": null, + "service_tier": "default", + "tools": null, + "metadata": {}, + "choices": [ + { + "index": 0, + "message": { + "content": "Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark.", + "role": "assistant", + "tool_calls": null, + "function_call": null + }, + "finish_reason": "stop", + "logprobs": null + } + ], + "response_format": null + } + ], + "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "has_more": false + } + post: + operationId: createChatCompletion + tags: + - Chat + summary: > + **Starting a new project?** We recommend trying + [Responses](/docs/api-reference/responses) + + to take advantage of the latest OpenAI platform features. Compare + + [Chat Completions with + Responses](/docs/guides/responses-vs-chat-completions?api-mode=responses). + + + --- + + + Creates a model response for the given chat conversation. Learn more in + the + + [text generation](/docs/guides/text-generation), + [vision](/docs/guides/vision), + + and [audio](/docs/guides/audio) guides. + + + Parameter support can differ depending on the model used to generate the + + response, particularly for newer reasoning models. Parameters that are + only + + supported for reasoning models are noted below. For the current state of + + unsupported parameters in reasoning models, + + [refer to the reasoning guide](/docs/guides/reasoning). + + + Returns a chat completion object, or a streamed sequence of chat + completion + + chunk objects if the request is streamed. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateChatCompletionRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CreateChatCompletionResponse' + text/event-stream: + schema: + $ref: '#/components/schemas/CreateChatCompletionStreamResponse' + x-oaiMeta: + name: Create chat completion + group: chat + path: create + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "VAR_chat_model_id", + "messages": [ + { + "role": "developer", + "content": "You are a helpful assistant." + }, + { + "role": "user", + "content": "Hello!" + } + ] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for completion in client.chat.completions.create( + messages=[{ + "content": "string", + "role": "developer", + }], + model="gpt-5.4", + ): + print(completion) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const completion = await openai.chat.completions.create({ + messages: [{ role: "developer", content: "You are a helpful assistant." }], + model: "VAR_chat_model_id", + store: true, + }); + + console.log(completion.choices[0]); + } + + main(); + csharp: | + using System; + using System.Collections.Generic; + + using OpenAI.Chat; + + ChatClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + List messages = + [ + new SystemChatMessage("You are a helpful assistant."), + new UserChatMessage("Hello!") + ]; + + ChatCompletion completion = client.CompleteChat(messages); + + Console.WriteLine(completion.Content[0].Text); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const chatCompletion = await client.chat.completions.create({ + messages: [{ content: 'string', role: 'developer' }], + model: 'gpt-5.4', + }); + + console.log(chatCompletion); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatCompletion, err := client.Chat.Completions.New(context.TODO(), openai.ChatCompletionNewParams{\n\t\tMessages: []openai.ChatCompletionMessageParamUnion{{\n\t\t\tOfDeveloper: &openai.ChatCompletionDeveloperMessageParam{\n\t\t\t\tContent: openai.ChatCompletionDeveloperMessageParamContentUnion{\n\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t},\n\t\t\t},\n\t\t}},\n\t\tModel: shared.ChatModelGPT5_4,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatCompletion)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.ChatModel; + + import com.openai.models.chat.completions.ChatCompletion; + + import + com.openai.models.chat.completions.ChatCompletionCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ChatCompletionCreateParams params = ChatCompletionCreateParams.builder() + .addDeveloperMessage("string") + .model(ChatModel.GPT_5_4) + .build(); + ChatCompletion chatCompletion = client.chat().completions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + chat_completion = openai.chat.completions.create(messages: + [{content: "string", role: :developer}], model: :"gpt-5.4") + + + puts(chat_completion) + response: | + { + "id": "chatcmpl-B9MBs8CjcvOU2jLn4n570S5qMJKcT", + "object": "chat.completion", + "created": 1741569952, + "model": "gpt-5.4", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "Hello! How can I assist you today?", + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 19, + "completion_tokens": 10, + "total_tokens": 29, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default" + } + - title: Image input + request: + curl: | + curl https://api.openai.com/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "messages": [ + { + "role": "user", + "content": [ + { + "type": "text", + "text": "What is in this image?" + }, + { + "type": "image_url", + "image_url": { + "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" + } + } + ] + } + ], + "max_tokens": 300 + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for completion in client.chat.completions.create( + messages=[{ + "content": "string", + "role": "developer", + }], + model="gpt-5.4", + ): + print(completion) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const response = await openai.chat.completions.create({ + model: "gpt-5.4", + messages: [ + { + role: "user", + content: [ + { type: "text", text: "What's in this image?" }, + { + type: "image_url", + image_url: { + "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", + }, + } + ], + }, + ], + }); + console.log(response.choices[0]); + } + main(); + csharp: | + using System; + using System.Collections.Generic; + + using OpenAI.Chat; + + ChatClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + List messages = + [ + new UserChatMessage( + [ + ChatMessageContentPart.CreateTextPart("What's in this image?"), + ChatMessageContentPart.CreateImagePart(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")) + ]) + ]; + + ChatCompletion completion = client.CompleteChat(messages); + + Console.WriteLine(completion.Content[0].Text); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const chatCompletion = await client.chat.completions.create({ + messages: [{ content: 'string', role: 'developer' }], + model: 'gpt-5.4', + }); + + console.log(chatCompletion); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatCompletion, err := client.Chat.Completions.New(context.TODO(), openai.ChatCompletionNewParams{\n\t\tMessages: []openai.ChatCompletionMessageParamUnion{{\n\t\t\tOfDeveloper: &openai.ChatCompletionDeveloperMessageParam{\n\t\t\t\tContent: openai.ChatCompletionDeveloperMessageParamContentUnion{\n\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t},\n\t\t\t},\n\t\t}},\n\t\tModel: shared.ChatModelGPT5_4,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatCompletion)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.ChatModel; + + import com.openai.models.chat.completions.ChatCompletion; + + import + com.openai.models.chat.completions.ChatCompletionCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ChatCompletionCreateParams params = ChatCompletionCreateParams.builder() + .addDeveloperMessage("string") + .model(ChatModel.GPT_5_4) + .build(); + ChatCompletion chatCompletion = client.chat().completions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + chat_completion = openai.chat.completions.create(messages: + [{content: "string", role: :developer}], model: :"gpt-5.4") + + + puts(chat_completion) + response: | + { + "id": "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG", + "object": "chat.completion", + "created": 1741570283, + "model": "gpt-5.4", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "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.", + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 1117, + "completion_tokens": 46, + "total_tokens": 1163, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default" + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "VAR_chat_model_id", + "messages": [ + { + "role": "developer", + "content": "You are a helpful assistant." + }, + { + "role": "user", + "content": "Hello!" + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for completion in client.chat.completions.create( + messages=[{ + "content": "string", + "role": "developer", + }], + model="gpt-5.4", + ): + print(completion) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const completion = await openai.chat.completions.create({ + model: "VAR_chat_model_id", + messages: [ + {"role": "developer", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Hello!"} + ], + stream: true, + }); + + for await (const chunk of completion) { + console.log(chunk.choices[0].delta.content); + } + } + + main(); + csharp: > + using System; + + using System.ClientModel; + + using System.Collections.Generic; + + using System.Threading.Tasks; + + + using OpenAI.Chat; + + + ChatClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + List messages = + + [ + new SystemChatMessage("You are a helpful assistant."), + new UserChatMessage("Hello!") + ]; + + + AsyncCollectionResult + completionUpdates = client.CompleteChatStreamingAsync(messages); + + + await foreach (StreamingChatCompletionUpdate completionUpdate in + completionUpdates) + + { + if (completionUpdate.ContentUpdate.Count > 0) + { + Console.Write(completionUpdate.ContentUpdate[0].Text); + } + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const chatCompletion = await client.chat.completions.create({ + messages: [{ content: 'string', role: 'developer' }], + model: 'gpt-5.4', + }); + + console.log(chatCompletion); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatCompletion, err := client.Chat.Completions.New(context.TODO(), openai.ChatCompletionNewParams{\n\t\tMessages: []openai.ChatCompletionMessageParamUnion{{\n\t\t\tOfDeveloper: &openai.ChatCompletionDeveloperMessageParam{\n\t\t\t\tContent: openai.ChatCompletionDeveloperMessageParamContentUnion{\n\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t},\n\t\t\t},\n\t\t}},\n\t\tModel: shared.ChatModelGPT5_4,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatCompletion)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.ChatModel; + + import com.openai.models.chat.completions.ChatCompletion; + + import + com.openai.models.chat.completions.ChatCompletionCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ChatCompletionCreateParams params = ChatCompletionCreateParams.builder() + .addDeveloperMessage("string") + .model(ChatModel.GPT_5_4) + .build(); + ChatCompletion chatCompletion = client.chat().completions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + chat_completion = openai.chat.completions.create(messages: + [{content: "string", role: :developer}], model: :"gpt-5.4") + + + puts(chat_completion) + response: > + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} + + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} + + + .... + + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + - title: Functions + request: + curl: | + curl https://api.openai.com/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "messages": [ + { + "role": "user", + "content": "What is the weather like in Boston today?" + } + ], + "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"] + } + } + } + ], + "tool_choice": "auto" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for completion in client.chat.completions.create( + messages=[{ + "content": "string", + "role": "developer", + }], + model="gpt-5.4", + ): + print(completion) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const messages = [{"role": "user", "content": "What's the weather like in Boston today?"}]; + const 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"], + }, + } + } + ]; + + const response = await openai.chat.completions.create({ + model: "gpt-5.4", + messages: messages, + tools: tools, + tool_choice: "auto", + }); + + console.log(response); + } + + main(); + csharp: > + using System; + + using System.Collections.Generic; + + + using OpenAI.Chat; + + + ChatClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + ChatTool getCurrentWeatherTool = ChatTool.CreateFunctionTool( + functionName: "get_current_weather", + functionDescription: "Get the current weather in a given location", + functionParameters: BinaryData.FromString(""" + { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA" + }, + "unit": { + "type": "string", + "enum": [ "celsius", "fahrenheit" ] + } + }, + "required": [ "location" ] + } + """) + ); + + + List messages = + + [ + new UserChatMessage("What's the weather like in Boston today?"), + ]; + + + ChatCompletionOptions options = new() + + { + Tools = + { + getCurrentWeatherTool + }, + ToolChoice = ChatToolChoice.CreateAutoChoice(), + }; + + + ChatCompletion completion = client.CompleteChat(messages, + options); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const chatCompletion = await client.chat.completions.create({ + messages: [{ content: 'string', role: 'developer' }], + model: 'gpt-5.4', + }); + + console.log(chatCompletion); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatCompletion, err := client.Chat.Completions.New(context.TODO(), openai.ChatCompletionNewParams{\n\t\tMessages: []openai.ChatCompletionMessageParamUnion{{\n\t\t\tOfDeveloper: &openai.ChatCompletionDeveloperMessageParam{\n\t\t\t\tContent: openai.ChatCompletionDeveloperMessageParamContentUnion{\n\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t},\n\t\t\t},\n\t\t}},\n\t\tModel: shared.ChatModelGPT5_4,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatCompletion)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.ChatModel; + + import com.openai.models.chat.completions.ChatCompletion; + + import + com.openai.models.chat.completions.ChatCompletionCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ChatCompletionCreateParams params = ChatCompletionCreateParams.builder() + .addDeveloperMessage("string") + .model(ChatModel.GPT_5_4) + .build(); + ChatCompletion chatCompletion = client.chat().completions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + chat_completion = openai.chat.completions.create(messages: + [{content: "string", role: :developer}], model: :"gpt-5.4") + + + puts(chat_completion) + response: | + { + "id": "chatcmpl-abc123", + "object": "chat.completion", + "created": 1699896916, + "model": "gpt-4o-mini", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_abc123", + "type": "function", + "function": { + "name": "get_current_weather", + "arguments": "{\n\"location\": \"Boston, MA\"\n}" + } + } + ] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 82, + "completion_tokens": 17, + "total_tokens": 99, + "completion_tokens_details": { + "reasoning_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + } + } + - title: Logprobs + request: + curl: | + curl https://api.openai.com/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "VAR_chat_model_id", + "messages": [ + { + "role": "user", + "content": "Hello!" + } + ], + "logprobs": true, + "top_logprobs": 2 + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for completion in client.chat.completions.create( + messages=[{ + "content": "string", + "role": "developer", + }], + model="gpt-5.4", + ): + print(completion) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const completion = await openai.chat.completions.create({ + messages: [{ role: "user", content: "Hello!" }], + model: "VAR_chat_model_id", + logprobs: true, + top_logprobs: 2, + }); + + console.log(completion.choices[0]); + } + + main(); + csharp: > + using System; + + using System.Collections.Generic; + + + using OpenAI.Chat; + + + ChatClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + List messages = + + [ + new UserChatMessage("Hello!") + ]; + + + ChatCompletionOptions options = new() + + { + IncludeLogProbabilities = true, + TopLogProbabilityCount = 2 + }; + + + ChatCompletion completion = client.CompleteChat(messages, + options); + + + Console.WriteLine(completion.Content[0].Text); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const chatCompletion = await client.chat.completions.create({ + messages: [{ content: 'string', role: 'developer' }], + model: 'gpt-5.4', + }); + + console.log(chatCompletion); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatCompletion, err := client.Chat.Completions.New(context.TODO(), openai.ChatCompletionNewParams{\n\t\tMessages: []openai.ChatCompletionMessageParamUnion{{\n\t\t\tOfDeveloper: &openai.ChatCompletionDeveloperMessageParam{\n\t\t\t\tContent: openai.ChatCompletionDeveloperMessageParamContentUnion{\n\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t},\n\t\t\t},\n\t\t}},\n\t\tModel: shared.ChatModelGPT5_4,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatCompletion)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.ChatModel; + + import com.openai.models.chat.completions.ChatCompletion; + + import + com.openai.models.chat.completions.ChatCompletionCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ChatCompletionCreateParams params = ChatCompletionCreateParams.builder() + .addDeveloperMessage("string") + .model(ChatModel.GPT_5_4) + .build(); + ChatCompletion chatCompletion = client.chat().completions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + chat_completion = openai.chat.completions.create(messages: + [{content: "string", role: :developer}], model: :"gpt-5.4") + + + puts(chat_completion) + response: | + { + "id": "chatcmpl-123", + "object": "chat.completion", + "created": 1702685778, + "model": "gpt-4o-mini", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "Hello! How can I assist you today?" + }, + "logprobs": { + "content": [ + { + "token": "Hello", + "logprob": -0.31725305, + "bytes": [72, 101, 108, 108, 111], + "top_logprobs": [ + { + "token": "Hello", + "logprob": -0.31725305, + "bytes": [72, 101, 108, 108, 111] + }, + { + "token": "Hi", + "logprob": -1.3190403, + "bytes": [72, 105] + } + ] + }, + { + "token": "!", + "logprob": -0.02380986, + "bytes": [ + 33 + ], + "top_logprobs": [ + { + "token": "!", + "logprob": -0.02380986, + "bytes": [33] + }, + { + "token": " there", + "logprob": -3.787621, + "bytes": [32, 116, 104, 101, 114, 101] + } + ] + }, + { + "token": " How", + "logprob": -0.000054669687, + "bytes": [32, 72, 111, 119], + "top_logprobs": [ + { + "token": " How", + "logprob": -0.000054669687, + "bytes": [32, 72, 111, 119] + }, + { + "token": "<|end|>", + "logprob": -10.953937, + "bytes": null + } + ] + }, + { + "token": " can", + "logprob": -0.015801601, + "bytes": [32, 99, 97, 110], + "top_logprobs": [ + { + "token": " can", + "logprob": -0.015801601, + "bytes": [32, 99, 97, 110] + }, + { + "token": " may", + "logprob": -4.161023, + "bytes": [32, 109, 97, 121] + } + ] + }, + { + "token": " I", + "logprob": -3.7697225e-6, + "bytes": [ + 32, + 73 + ], + "top_logprobs": [ + { + "token": " I", + "logprob": -3.7697225e-6, + "bytes": [32, 73] + }, + { + "token": " assist", + "logprob": -13.596657, + "bytes": [32, 97, 115, 115, 105, 115, 116] + } + ] + }, + { + "token": " assist", + "logprob": -0.04571125, + "bytes": [32, 97, 115, 115, 105, 115, 116], + "top_logprobs": [ + { + "token": " assist", + "logprob": -0.04571125, + "bytes": [32, 97, 115, 115, 105, 115, 116] + }, + { + "token": " help", + "logprob": -3.1089056, + "bytes": [32, 104, 101, 108, 112] + } + ] + }, + { + "token": " you", + "logprob": -5.4385737e-6, + "bytes": [32, 121, 111, 117], + "top_logprobs": [ + { + "token": " you", + "logprob": -5.4385737e-6, + "bytes": [32, 121, 111, 117] + }, + { + "token": " today", + "logprob": -12.807695, + "bytes": [32, 116, 111, 100, 97, 121] + } + ] + }, + { + "token": " today", + "logprob": -0.0040071653, + "bytes": [32, 116, 111, 100, 97, 121], + "top_logprobs": [ + { + "token": " today", + "logprob": -0.0040071653, + "bytes": [32, 116, 111, 100, 97, 121] + }, + { + "token": "?", + "logprob": -5.5247097, + "bytes": [63] + } + ] + }, + { + "token": "?", + "logprob": -0.0008108172, + "bytes": [63], + "top_logprobs": [ + { + "token": "?", + "logprob": -0.0008108172, + "bytes": [63] + }, + { + "token": "?\n", + "logprob": -7.184561, + "bytes": [63, 10] + } + ] + } + ] + }, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 9, + "completion_tokens": 9, + "total_tokens": 18, + "completion_tokens_details": { + "reasoning_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "system_fingerprint": null + } + /chat/completions/{completion_id}: + get: + operationId: getChatCompletion + tags: + - Chat + summary: > + Get a stored chat completion. Only Chat Completions that have been + created + + with the `store` parameter set to `true` will be returned. + parameters: + - in: path + name: completion_id + required: true + schema: + type: string + description: The ID of the chat completion to retrieve. + responses: + '200': + description: A chat completion + content: + application/json: + schema: + $ref: '#/components/schemas/CreateChatCompletionResponse' + x-oaiMeta: + name: Get chat completion + group: chat + examples: + request: + curl: | + curl https://api.openai.com/v1/chat/completions/chatcmpl-abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + chat_completion = client.chat.completions.retrieve( + "completion_id", + ) + print(chat_completion.id) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const chatCompletion = await + client.chat.completions.retrieve('completion_id'); + + + console.log(chatCompletion.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatCompletion, err := client.Chat.Completions.Get(context.TODO(), \"completion_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatCompletion.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.chat.completions.ChatCompletion; + + import + com.openai.models.chat.completions.ChatCompletionRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ChatCompletion chatCompletion = client.chat().completions().retrieve("completion_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + chat_completion = + openai.chat.completions.retrieve("completion_id") + + + puts(chat_completion) + response: | + { + "object": "chat.completion", + "id": "chatcmpl-abc123", + "model": "gpt-4o-2024-08-06", + "created": 1738960610, + "request_id": "req_ded8ab984ec4bf840f37566c1011c417", + "tool_choice": null, + "usage": { + "total_tokens": 31, + "completion_tokens": 18, + "prompt_tokens": 13 + }, + "seed": 4944116822809979520, + "top_p": 1.0, + "temperature": 1.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0, + "system_fingerprint": "fp_50cad350e4", + "input_user": null, + "service_tier": "default", + "tools": null, + "metadata": {}, + "choices": [ + { + "index": 0, + "message": { + "content": "Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark.", + "role": "assistant", + "tool_calls": null, + "function_call": null + }, + "finish_reason": "stop", + "logprobs": null + } + ], + "response_format": null + } + post: + operationId: updateChatCompletion + tags: + - Chat + summary: > + Modify a stored chat completion. Only Chat Completions that have been + + created with the `store` parameter set to `true` can be modified. + Currently, + + the only supported modification is to update the `metadata` field. + parameters: + - in: path + name: completion_id + required: true + schema: + type: string + description: The ID of the chat completion to update. + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - metadata + properties: + metadata: + $ref: '#/components/schemas/Metadata' + responses: + '200': + description: A chat completion + content: + application/json: + schema: + $ref: '#/components/schemas/CreateChatCompletionResponse' + x-oaiMeta: + name: Update chat completion + group: chat + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/chat/completions/chat_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"metadata": {"foo": "bar"}}' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + chat_completion = client.chat.completions.update( + completion_id="completion_id", + metadata={ + "foo": "string" + }, + ) + print(chat_completion.id) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const chatCompletion = await + client.chat.completions.update('completion_id', { + metadata: { foo: 'string' }, + }); + + + console.log(chatCompletion.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatCompletion, err := client.Chat.Completions.Update(\n\t\tcontext.TODO(),\n\t\t\"completion_id\",\n\t\topenai.ChatCompletionUpdateParams{\n\t\t\tMetadata: shared.Metadata{\n\t\t\t\t\"foo\": \"string\",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatCompletion.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.core.JsonValue; + + import com.openai.models.chat.completions.ChatCompletion; + + import + com.openai.models.chat.completions.ChatCompletionUpdateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ChatCompletionUpdateParams params = ChatCompletionUpdateParams.builder() + .completionId("completion_id") + .metadata(ChatCompletionUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build()) + .build(); + ChatCompletion chatCompletion = client.chat().completions().update(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + chat_completion = openai.chat.completions.update("completion_id", + metadata: {foo: "string"}) + + + puts(chat_completion) + response: | + { + "object": "chat.completion", + "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "model": "gpt-4o-2024-08-06", + "created": 1738960610, + "request_id": "req_ded8ab984ec4bf840f37566c1011c417", + "tool_choice": null, + "usage": { + "total_tokens": 31, + "completion_tokens": 18, + "prompt_tokens": 13 + }, + "seed": 4944116822809979520, + "top_p": 1.0, + "temperature": 1.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0, + "system_fingerprint": "fp_50cad350e4", + "input_user": null, + "service_tier": "default", + "tools": null, + "metadata": { + "foo": "bar" + }, + "choices": [ + { + "index": 0, + "message": { + "content": "Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark.", + "role": "assistant", + "tool_calls": null, + "function_call": null + }, + "finish_reason": "stop", + "logprobs": null + } + ], + "response_format": null + } + delete: + operationId: deleteChatCompletion + tags: + - Chat + summary: | + Delete a stored chat completion. Only Chat Completions that have been + created with the `store` parameter set to `true` can be deleted. + parameters: + - in: path + name: completion_id + required: true + schema: + type: string + description: The ID of the chat completion to delete. + responses: + '200': + description: The chat completion was deleted successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ChatCompletionDeleted' + x-oaiMeta: + name: Delete chat completion + group: chat + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/chat/completions/chat_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + chat_completion_deleted = client.chat.completions.delete( + "completion_id", + ) + print(chat_completion_deleted.id) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const chatCompletionDeleted = await + client.chat.completions.delete('completion_id'); + + + console.log(chatCompletionDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatCompletionDeleted, err := client.Chat.Completions.Delete(context.TODO(), \"completion_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatCompletionDeleted.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.chat.completions.ChatCompletionDeleteParams; + + import com.openai.models.chat.completions.ChatCompletionDeleted; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ChatCompletionDeleted chatCompletionDeleted = client.chat().completions().delete("completion_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + chat_completion_deleted = + openai.chat.completions.delete("completion_id") + + + puts(chat_completion_deleted) + response: | + { + "object": "chat.completion.deleted", + "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "deleted": true + } + /chat/completions/{completion_id}/messages: + get: + operationId: getChatCompletionMessages + tags: + - Chat + summary: | + Get the messages in a stored chat completion. Only Chat Completions that + have been created with the `store` parameter set to `true` will be + returned. + parameters: + - in: path + name: completion_id + required: true + schema: + type: string + description: The ID of the chat completion to retrieve messages from. + - name: after + in: query + description: >- + Identifier for the last message from the previous pagination + request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of messages to retrieve. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: >- + Sort order for messages by timestamp. Use `asc` for ascending order + or `desc` for descending order. Defaults to `asc`. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + responses: + '200': + description: A list of messages + content: + application/json: + schema: + $ref: '#/components/schemas/ChatCompletionMessageList' + x-oaiMeta: + name: Get chat messages + group: chat + examples: + request: + curl: > + curl + https://api.openai.com/v1/chat/completions/chat_abc123/messages \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.chat.completions.messages.list( + completion_id="completion_id", + ) + page = page.data[0] + print(page) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const chatCompletionStoreMessage of + client.chat.completions.messages.list( + 'completion_id', + )) { + console.log(chatCompletionStoreMessage); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Chat.Completions.Messages.List(\n\t\tcontext.TODO(),\n\t\t\"completion_id\",\n\t\topenai.ChatCompletionMessageListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.chat.completions.messages.MessageListPage; + + import + com.openai.models.chat.completions.messages.MessageListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageListPage page = client.chat().completions().messages().list("completion_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.chat.completions.messages.list("completion_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "role": "user", + "content": "write a haiku about ai", + "name": null, + "content_parts": null + } + ], + "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "has_more": false + } + /completions: + post: + operationId: createCompletion + tags: + - Completions + summary: > + Creates a completion for the provided prompt and parameters. + + + Returns a completion object, or a sequence of completion objects if the + request is streamed. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateCompletionRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CreateCompletionResponse' + x-oaiMeta: + name: Create completion + group: completions + legacy: true + examples: + - title: No streaming + request: + curl: | + curl https://api.openai.com/v1/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "VAR_completion_model_id", + "prompt": "Say this is a test", + "max_tokens": 7, + "temperature": 0 + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for completion in client.completions.create( + model="gpt-3.5-turbo-instruct", + prompt="This is a test.", + ): + print(completion) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const completion = await openai.completions.create({ + model: "VAR_completion_model_id", + prompt: "Say this is a test.", + max_tokens: 7, + temperature: 0, + }); + + console.log(completion); + } + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const completion = await client.completions.create({ + model: 'gpt-3.5-turbo-instruct', + prompt: 'This is a test.', + }); + + console.log(completion); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcompletion, err := client.Completions.New(context.TODO(), openai.CompletionNewParams{\n\t\tModel: openai.CompletionNewParamsModelGPT3_5TurboInstruct,\n\t\tPrompt: openai.CompletionNewParamsPromptUnion{\n\t\t\tOfString: openai.String(\"This is a test.\"),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", completion)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.completions.Completion; + import com.openai.models.completions.CompletionCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CompletionCreateParams params = CompletionCreateParams.builder() + .model(CompletionCreateParams.Model.GPT_3_5_TURBO_INSTRUCT) + .prompt("This is a test.") + .build(); + Completion completion = client.completions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + completion = openai.completions.create(model: + :"gpt-3.5-turbo-instruct", prompt: "This is a test.") + + + puts(completion) + response: | + { + "id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7", + "object": "text_completion", + "created": 1589478378, + "model": "VAR_completion_model_id", + "system_fingerprint": "fp_44709d6fcb", + "choices": [ + { + "text": "\n\nThis is indeed a test", + "index": 0, + "logprobs": null, + "finish_reason": "length" + } + ], + "usage": { + "prompt_tokens": 5, + "completion_tokens": 7, + "total_tokens": 12 + } + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "VAR_completion_model_id", + "prompt": "Say this is a test", + "max_tokens": 7, + "temperature": 0, + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for completion in client.completions.create( + model="gpt-3.5-turbo-instruct", + prompt="This is a test.", + ): + print(completion) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.completions.create({ + model: "VAR_completion_model_id", + prompt: "Say this is a test.", + stream: true, + }); + + for await (const chunk of stream) { + console.log(chunk.choices[0].text) + } + } + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const completion = await client.completions.create({ + model: 'gpt-3.5-turbo-instruct', + prompt: 'This is a test.', + }); + + console.log(completion); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcompletion, err := client.Completions.New(context.TODO(), openai.CompletionNewParams{\n\t\tModel: openai.CompletionNewParamsModelGPT3_5TurboInstruct,\n\t\tPrompt: openai.CompletionNewParamsPromptUnion{\n\t\t\tOfString: openai.String(\"This is a test.\"),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", completion)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.completions.Completion; + import com.openai.models.completions.CompletionCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CompletionCreateParams params = CompletionCreateParams.builder() + .model(CompletionCreateParams.Model.GPT_3_5_TURBO_INSTRUCT) + .prompt("This is a test.") + .build(); + Completion completion = client.completions().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + completion = openai.completions.create(model: + :"gpt-3.5-turbo-instruct", prompt: "This is a test.") + + + puts(completion) + response: | + { + "id": "cmpl-7iA7iJjj8V2zOkCGvWF2hAkDWBQZe", + "object": "text_completion", + "created": 1690759702, + "choices": [ + { + "text": "This", + "index": 0, + "logprobs": null, + "finish_reason": null + } + ], + "model": "gpt-3.5-turbo-instruct" + "system_fingerprint": "fp_44709d6fcb", + } + /containers: + get: + summary: List Containers + description: Lists containers. + operationId: ListContainers + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: name + in: query + description: Filter results by container name. + required: false + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerListResource' + x-oaiMeta: + name: List containers + group: containers + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/containers \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const containerListResponse of + client.containers.list()) { + console.log(containerListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.containers.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Containers.List(context.TODO(), openai.ContainerListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerListPage; + import com.openai.models.containers.ContainerListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContainerListPage page = client.containers().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.containers.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "4g", + "name": "My Container" + } + ], + "first_id": "container_123", + "last_id": "container_123", + "has_more": false + } + post: + summary: Create Container + description: Creates a container. + operationId: CreateContainer + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateContainerBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerResource' + x-oaiMeta: + name: Create container + group: containers + path: post + examples: + request: + curl: | + curl https://api.openai.com/v1/containers \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "My Container", + "memory_limit": "4g", + "skills": [ + { + "type": "skill_reference", + "skill_id": "skill_4db6f1a2c9e73508b41f9da06e2c7b5f" + }, + { + "type": "skill_reference", + "skill_id": "openai-spreadsheets", + "version": "latest" + } + ], + "network_policy": { + "type": "allowlist", + "allowed_domains": ["api.buildkite.com"] + } + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const container = await client.containers.create({ name: 'name' + }); + + + console.log(container.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + container = client.containers.create( + name="name", + ) + print(container.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcontainer, err := client.Containers.New(context.TODO(), openai.ContainerNewParams{\n\t\tName: \"name\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", container.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerCreateParams; + import com.openai.models.containers.ContainerCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContainerCreateParams params = ContainerCreateParams.builder() + .name("name") + .build(); + ContainerCreateResponse container = client.containers().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + container = openai.containers.create(name: "name") + + puts(container) + response: | + { + "id": "cntr_682e30645a488191b6363a0cbefc0f0a025ec61b66250591", + "object": "container", + "created_at": 1747857508, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747857508, + "network_policy": { + "type": "allowlist", + "allowed_domains": ["api.buildkite.com"] + }, + "memory_limit": "4g", + "name": "My Container" + } + /containers/{container_id}: + get: + summary: Retrieve Container + description: Retrieves a container. + operationId: RetrieveContainer + parameters: + - name: container_id + in: path + required: true + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerResource' + x-oaiMeta: + name: Retrieve container + group: containers + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const container = await + client.containers.retrieve('container_id'); + + + console.log(container.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + container = client.containers.retrieve( + "container_id", + ) + print(container.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcontainer, err := client.Containers.Get(context.TODO(), \"container_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", container.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerRetrieveParams; + import com.openai.models.containers.ContainerRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContainerRetrieveResponse container = client.containers().retrieve("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + container = openai.containers.retrieve("container_id") + + puts(container) + response: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "4g", + "name": "My Container" + } + delete: + operationId: DeleteContainer + summary: Delete Container + description: Delete a container. + parameters: + - name: container_id + in: path + description: The ID of the container to delete. + required: true + schema: + type: string + responses: + '200': + description: OK + x-oaiMeta: + name: Delete a container + group: containers + path: delete + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + await client.containers.delete('container_id'); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.containers.delete( + "container_id", + ) + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Containers.Delete(context.TODO(), \"container_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + client.containers().delete("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + result = openai.containers.delete("container_id") + + puts(result) + response: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container.deleted", + "deleted": true + } + /containers/{container_id}/files: + post: + summary: > + Create a Container File + + + You can send either a multipart/form-data request with the raw file + content, or a JSON request with a file ID. + description: | + Creates a container file. + operationId: CreateContainerFile + parameters: + - name: container_id + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateContainerFileBody' + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateContainerFileBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerFileResource' + x-oaiMeta: + name: Create container file + group: containers + path: post + examples: + request: + curl: > + curl + https://api.openai.com/v1/containers/cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04/files + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F file="@example.txt" + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const file = await client.containers.files.create('container_id'); + + console.log(file.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file = client.containers.files.create( + container_id="container_id", + ) + print(file.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfile, err := client.Containers.Files.New(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\topenai.ContainerFileNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", file.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileCreateParams; + import com.openai.models.containers.files.FileCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileCreateResponse file = client.containers().files().create("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file = openai.containers.files.create("container_id") + + puts(file) + response: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + get: + summary: List Container files + description: Lists container files. + operationId: ListContainerFiles + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerFileListResource' + x-oaiMeta: + name: List container files + group: containers + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/containers/cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04/files + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const fileListResponse of + client.containers.files.list('container_id')) { + console.log(fileListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.containers.files.list( + container_id="container_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Containers.Files.List(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\topenai.ContainerFileListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileListPage; + import com.openai.models.containers.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileListPage page = client.containers().files().list("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.containers.files.list("container_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + ], + "first_id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "has_more": false, + "last_id": "cfile_682e0e8a43c88191a7978f477a09bdf5" + } + /containers/{container_id}/files/{file_id}: + get: + summary: Retrieve Container File + description: Retrieves a container file. + operationId: RetrieveContainerFile + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: file_id + in: path + required: true + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerFileResource' + x-oaiMeta: + name: Retrieve container file + group: containers + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/containers/container_123/files/file_456 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const file = await client.containers.files.retrieve('file_id', { + container_id: 'container_id' }); + + + console.log(file.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file = client.containers.files.retrieve( + file_id="file_id", + container_id="container_id", + ) + print(file.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfile, err := client.Containers.Files.Get(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", file.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileRetrieveParams; + import com.openai.models.containers.files.FileRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileRetrieveParams params = FileRetrieveParams.builder() + .containerId("container_id") + .fileId("file_id") + .build(); + FileRetrieveResponse file = client.containers().files().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + file = openai.containers.files.retrieve("file_id", container_id: + "container_id") + + + puts(file) + response: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + delete: + operationId: DeleteContainerFile + summary: Delete Container File + description: Delete a container file. + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: file_id + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + x-oaiMeta: + name: Delete a container file + group: containers + path: delete + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863/files/cfile_682e0e8a43c88191a7978f477a09bdf5 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + await client.containers.files.delete('file_id', { container_id: + 'container_id' }); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.containers.files.delete( + file_id="file_id", + container_id="container_id", + ) + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Containers.Files.Delete(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileDeleteParams params = FileDeleteParams.builder() + .containerId("container_id") + .fileId("file_id") + .build(); + client.containers().files().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + result = openai.containers.files.delete("file_id", container_id: + "container_id") + + + puts(result) + response: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file.deleted", + "deleted": true + } + /containers/{container_id}/files/{file_id}/content: + get: + summary: Retrieve Container File Content + description: Retrieves a container file content. + operationId: RetrieveContainerFileContent + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: file_id + in: path + required: true + schema: + type: string + responses: + '200': + description: Success + x-oaiMeta: + name: Retrieve container file content + group: containers + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/containers/container_123/files/cfile_456/content + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const content = await + client.containers.files.content.retrieve('file_id', { + container_id: 'container_id', + }); + + + console.log(content); + + + const data = await content.blob(); + + console.log(data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + content = client.containers.files.content.retrieve( + file_id="file_id", + container_id="container_id", + ) + print(content) + data = content.read() + print(data) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcontent, err := client.Containers.Files.Content.Get(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", content)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.core.http.HttpResponse; + + import + com.openai.models.containers.files.content.ContentRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContentRetrieveParams params = ContentRetrieveParams.builder() + .containerId("container_id") + .fileId("file_id") + .build(); + HttpResponse content = client.containers().files().content().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + content = openai.containers.files.content.retrieve("file_id", + container_id: "container_id") + + + puts(content) + response: | + + /conversations/{conversation_id}/items: + post: + operationId: createConversationItems + tags: + - Conversations + summary: Create items in a conversation with the given ID. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation to add the item to. + - name: include + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: > + Additional fields to include in the response. See the `include` + + parameter for [listing Conversation items + above](/docs/api-reference/conversations/list-items#conversations_list_items-include) + for more information. + requestBody: + required: true + content: + application/json: + schema: + properties: + items: + type: array + description: > + The items to add to the conversation. You may add up to 20 + items at a time. + items: + $ref: '#/components/schemas/InputItem' + maxItems: 20 + required: + - items + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationItemList' + x-oaiMeta: + name: Create items + group: conversations + path: create-item + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123/items \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "items": [ + { + "type": "message", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + }, + { + "type": "message", + "role": "user", + "content": [ + {"type": "input_text", "text": "How are you?"} + ] + } + ] + }' + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const items = await client.conversations.items.create( + "conv_123", + { + items: [ + { + type: "message", + role: "user", + content: [{ type: "input_text", text: "Hello!" }], + }, + { + type: "message", + role: "user", + content: [{ type: "input_text", text: "How are you?" }], + }, + ], + } + ); + console.log(items.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation_item_list = client.conversations.items.create( + conversation_id="conv_123", + items=[{ + "content": "string", + "role": "user", + "type": "message", + }], + ) + print(conversation_item_list.first_id) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ConversationItemList created = client.ConversationItems.Create( + conversationId: "conv_123", + new CreateConversationItemsOptions + { + Items = new List + { + new ConversationMessage + { + Role = "user", + Content = + { + new ConversationInputText { Text = "Hello!" } + } + }, + new ConversationMessage + { + Role = "user", + Content = + { + new ConversationInputText { Text = "How are you?" } + } + } + } + } + ); + Console.WriteLine(created.Data.Count); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const conversationItemList = await + client.conversations.items.create('conv_123', { + items: [ + { + content: 'string', + role: 'user', + type: 'message', + }, + ], + }); + + + console.log(conversationItemList.first_id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationItemList, err := client.Conversations.Items.New(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ItemNewParams{\n\t\t\tItems: []responses.ResponseInputItemUnionParam{{\n\t\t\t\tOfMessage: &responses.EasyInputMessageParam{\n\t\t\t\t\tContent: responses.EasyInputMessageContentUnionParam{\n\t\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t\t},\n\t\t\t\t\tRole: responses.EasyInputMessageRoleUser,\n\t\t\t\t\tType: responses.EasyInputMessageTypeMessage,\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationItemList.FirstID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.items.ConversationItemList; + import com.openai.models.conversations.items.ItemCreateParams; + import com.openai.models.responses.EasyInputMessage; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemCreateParams params = ItemCreateParams.builder() + .conversationId("conv_123") + .addItem(EasyInputMessage.builder() + .content("string") + .role(EasyInputMessage.Role.USER) + .type(EasyInputMessage.Type.MESSAGE) + .build()) + .build(); + ConversationItemList conversationItemList = client.conversations().items().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + conversation_item_list = + openai.conversations.items.create("conv_123", items: [{content: + "string", role: :user, type: :message}]) + + + puts(conversation_item_list) + response: | + { + "object": "list", + "data": [ + { + "type": "message", + "id": "msg_abc", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + }, + { + "type": "message", + "id": "msg_def", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "How are you?"} + ] + } + ], + "first_id": "msg_abc", + "last_id": "msg_def", + "has_more": false + } + get: + operationId: listConversationItems + tags: + - Conversations + summary: List all items for a conversation with the given ID. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation to list items for. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between + + 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - in: query + name: order + schema: + type: string + enum: + - asc + - desc + description: | + The order to return the input items in. Default is `desc`. + - `asc`: Return the input items in ascending order. + - `desc`: Return the input items in descending order. + - in: query + name: after + schema: + type: string + description: | + An item ID to list items after, used in pagination. + - name: include + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: >- + Specify additional output data to include in the model response. + Currently supported values are: + + - `web_search_call.action.sources`: Include the sources of the web + search tool call. + + - `code_interpreter_call.outputs`: Includes the outputs of python + code execution in code interpreter tool call items. + + - `computer_call_output.output.image_url`: Include image urls from + the computer call output. + + - `file_search_call.results`: Include the search results of the file + search tool call. + + - `message.input_image.image_url`: Include image urls from the input + message. + + - `message.output_text.logprobs`: Include logprobs with assistant + messages. + + - `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). + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationItemList' + x-oaiMeta: + name: List items + group: conversations + path: list-items + examples: + request: + curl: > + curl + "https://api.openai.com/v1/conversations/conv_123/items?limit=10" + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: > + import OpenAI from "openai"; + + const client = new OpenAI(); + + + const items = await client.conversations.items.list("conv_123", { + limit: 10 }); + + console.log(items.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.conversations.items.list( + conversation_id="conv_123", + ) + page = page.data[0] + print(page) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ConversationItemList items = client.ConversationItems.List( + conversationId: "conv_123", + new ListConversationItemsOptions { Limit = 10 } + ); + Console.WriteLine(items.Data.Count); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const conversationItem of + client.conversations.items.list('conv_123')) { + console.log(conversationItem); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Conversations.Items.List(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ItemListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.items.ItemListPage; + import com.openai.models.conversations.items.ItemListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemListPage page = client.conversations().items().list("conv_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.conversations.items.list("conv_123") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "type": "message", + "id": "msg_abc", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + } + ], + "first_id": "msg_abc", + "last_id": "msg_abc", + "has_more": false + } + /conversations/{conversation_id}/items/{item_id}: + get: + operationId: getConversationItem + tags: + - Conversations + summary: Get a single item from a conversation with the given IDs. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation that contains the item. + - in: path + name: item_id + required: true + schema: + type: string + example: msg_abc + description: The ID of the item to retrieve. + - name: include + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: > + Additional fields to include in the response. See the `include` + + parameter for [listing Conversation items + above](/docs/api-reference/conversations/list-items#conversations_list_items-include) + for more information. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationItem' + x-oaiMeta: + name: Retrieve an item + group: conversations + path: get-item + examples: + request: + curl: > + curl + https://api.openai.com/v1/conversations/conv_123/items/msg_abc \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const item = await client.conversations.items.retrieve( + "conv_123", + "msg_abc" + ); + console.log(item); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation_item = client.conversations.items.retrieve( + item_id="msg_abc", + conversation_id="conv_123", + ) + print(conversation_item) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ConversationItem item = client.ConversationItems.Get( + conversationId: "conv_123", + itemId: "msg_abc" + ); + Console.WriteLine(item.Id); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const conversationItem = await + client.conversations.items.retrieve('msg_abc', { + conversation_id: 'conv_123', + }); + + + console.log(conversationItem); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationItem, err := client.Conversations.Items.Get(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\t\"msg_abc\",\n\t\tconversations.ItemGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationItem)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.items.ConversationItem; + import com.openai.models.conversations.items.ItemRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemRetrieveParams params = ItemRetrieveParams.builder() + .conversationId("conv_123") + .itemId("msg_abc") + .build(); + ConversationItem conversationItem = client.conversations().items().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + conversation_item = openai.conversations.items.retrieve("msg_abc", + conversation_id: "conv_123") + + + puts(conversation_item) + response: | + { + "type": "message", + "id": "msg_abc", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + } + delete: + operationId: deleteConversationItem + tags: + - Conversations + summary: Delete an item from a conversation with the given IDs. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation that contains the item. + - in: path + name: item_id + required: true + schema: + type: string + example: msg_abc + description: The ID of the item to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Delete an item + group: conversations + path: delete-item + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/conversations/conv_123/items/msg_abc \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const conversation = await client.conversations.items.delete( + "conv_123", + "msg_abc" + ); + console.log(conversation); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.items.delete( + item_id="msg_abc", + conversation_id="conv_123", + ) + print(conversation.id) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation conversation = client.ConversationItems.Delete( + conversationId: "conv_123", + itemId: "msg_abc" + ); + Console.WriteLine(conversation.Id); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const conversation = await + client.conversations.items.delete('msg_abc', { + conversation_id: 'conv_123', + }); + + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Items.Delete(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\t\"msg_abc\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.items.ItemDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemDeleteParams params = ItemDeleteParams.builder() + .conversationId("conv_123") + .itemId("msg_abc") + .build(); + Conversation conversation = client.conversations().items().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + conversation = openai.conversations.items.delete("msg_abc", + conversation_id: "conv_123") + + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "demo"} + } + /embeddings: + post: + operationId: createEmbedding + tags: + - Embeddings + summary: Creates an embedding vector representing the input text. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEmbeddingRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEmbeddingResponse' + x-oaiMeta: + name: Create embeddings + group: embeddings + examples: + request: + curl: | + curl https://api.openai.com/v1/embeddings \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "input": "The food was delicious and the waiter...", + "model": "text-embedding-ada-002", + "encoding_format": "float" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + create_embedding_response = client.embeddings.create( + input="The quick brown fox jumped over the lazy dog", + model="text-embedding-3-small", + ) + print(create_embedding_response.data) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const embedding = await openai.embeddings.create({ + model: "text-embedding-ada-002", + input: "The quick brown fox jumped over the lazy dog", + encoding_format: "float", + }); + + console.log(embedding); + } + + main(); + csharp: > + using System; + + + using OpenAI.Embeddings; + + + EmbeddingClient client = new( + model: "text-embedding-3-small", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + OpenAIEmbedding embedding = client.GenerateEmbedding(input: "The + quick brown fox jumped over the lazy dog"); + + ReadOnlyMemory vector = embedding.ToFloats(); + + + for (int i = 0; i < vector.Length; i++) + + { + Console.WriteLine($" [{i,4}] = {vector.Span[i]}"); + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const createEmbeddingResponse = await client.embeddings.create({ + input: 'The quick brown fox jumped over the lazy dog', + model: 'text-embedding-3-small', + }); + + console.log(createEmbeddingResponse.data); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcreateEmbeddingResponse, err := client.Embeddings.New(context.TODO(), openai.EmbeddingNewParams{\n\t\tInput: openai.EmbeddingNewParamsInputUnion{\n\t\t\tOfString: openai.String(\"The quick brown fox jumped over the lazy dog\"),\n\t\t},\n\t\tModel: openai.EmbeddingModelTextEmbedding3Small,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", createEmbeddingResponse.Data)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.embeddings.CreateEmbeddingResponse; + import com.openai.models.embeddings.EmbeddingCreateParams; + import com.openai.models.embeddings.EmbeddingModel; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EmbeddingCreateParams params = EmbeddingCreateParams.builder() + .input("The quick brown fox jumped over the lazy dog") + .model(EmbeddingModel.TEXT_EMBEDDING_3_SMALL) + .build(); + CreateEmbeddingResponse createEmbeddingResponse = client.embeddings().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + create_embedding_response = openai.embeddings.create( + input: "The quick brown fox jumped over the lazy dog", + model: :"text-embedding-3-small" + ) + + puts(create_embedding_response) + response: | + { + "object": "list", + "data": [ + { + "object": "embedding", + "embedding": [ + 0.0023064255, + -0.009327292, + .... (1536 floats total for ada-002) + -0.0028842222, + ], + "index": 0 + } + ], + "model": "text-embedding-ada-002", + "usage": { + "prompt_tokens": 8, + "total_tokens": 8 + } + } + /evals: + get: + operationId: listEvals + tags: + - Evals + summary: | + List evaluations for a project. + parameters: + - name: after + in: query + description: Identifier for the last eval from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of evals to retrieve. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: >- + Sort order for evals by timestamp. Use `asc` for ascending order or + `desc` for descending order. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + - name: order_by + in: query + description: > + Evals can be ordered by creation time or last updated time. Use + + `created_at` for creation time or `updated_at` for last updated + time. + required: false + schema: + type: string + enum: + - created_at + - updated_at + default: created_at + responses: + '200': + description: A list of evals + content: + application/json: + schema: + $ref: '#/components/schemas/EvalList' + x-oaiMeta: + name: List evals + group: evals + path: list + examples: + request: + curl: | + curl https://api.openai.com/v1/evals?limit=1 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.evals.list() + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const evals = await openai.evals.list({ limit: 1 }); + console.log(evals); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const evalListResponse of client.evals.list()) { + console.log(evalListResponse.id); + } + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalListPage; + import com.openai.models.evals.EvalListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalListPage page = client.evals().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.evals.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "object": "eval", + "data_source_config": { + "type": "stored_completions", + "metadata": { + "usecase": "push_notifications_summarizer" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + ] + } + }, + "testing_criteria": [ + { + "name": "Push Notification Summary Grader", + "id": "Push Notification Summary Grader-9b876f24-4762-4be9-aff4-db7a9b31c673", + "type": "label_model", + "model": "o3-mini", + "input": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "text": "\nLabel the following push notification summary as either correct or incorrect.\nThe push notification and the summary will be provided below.\nA good push notificiation summary is concise and snappy.\nIf it is good, then label it as correct, if not, then incorrect.\n" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "\nPush notifications: {{item.input}}\nSummary: {{sample.output_text}}\n" + } + } + ], + "passing_labels": [ + "correct" + ], + "labels": [ + "correct", + "incorrect" + ], + "sampling_params": null + } + ], + "name": "Push Notification Summary Grader", + "created_at": 1739314509, + "metadata": { + "description": "A stored completions eval for push notification summaries" + } + } + ], + "first_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "last_id": "eval_67aa884cf6688190b58f657d4441c8b7", + "has_more": true + } + post: + operationId: createEval + tags: + - Evals + summary: > + Create the structure of an evaluation that can be used to test a model's + performance. + + An 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. + + For more information, see the [Evals guide](/docs/guides/evals). + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEvalRequest' + responses: + '201': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Eval' + x-oaiMeta: + name: Create eval + group: evals + path: post + examples: + request: + curl: | + curl https://api.openai.com/v1/evals \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Sentiment", + "data_source_config": { + "type": "stored_completions", + "metadata": { + "usecase": "chatbot" + } + }, + "testing_criteria": [ + { + "type": "label_model", + "model": "o3-mini", + "input": [ + { + "role": "developer", + "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" + }, + { + "role": "user", + "content": "Statement: {{item.input}}" + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ], + "name": "Example label grader" + } + ] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.create( + data_source_config={ + "item_schema": { + "foo": "bar" + }, + "type": "custom", + }, + testing_criteria=[{ + "input": [{ + "content": "content", + "role": "role", + }], + "labels": ["string"], + "model": "model", + "name": "name", + "passing_labels": ["string"], + "type": "label_model", + }], + ) + print(eval.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const evalObj = await openai.evals.create({ + name: "Sentiment", + data_source_config: { + type: "stored_completions", + metadata: { usecase: "chatbot" } + }, + testing_criteria: [ + { + type: "label_model", + model: "o3-mini", + input: [ + { role: "developer", content: "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" }, + { role: "user", content: "Statement: {{item.input}}" } + ], + passing_labels: ["positive"], + labels: ["positive", "neutral", "negative"], + name: "Example label grader" + } + ] + }); + console.log(evalObj); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.create({ + data_source_config: { + item_schema: { foo: 'bar' }, + type: 'custom', + }, + testing_criteria: [ + { + input: [{ content: 'content', role: 'role' }], + labels: ['string'], + model: 'model', + name: 'name', + passing_labels: ['string'], + type: 'label_model', + }, + ], + }); + + console.log(_eval.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.evals.EvalCreateParams; + import com.openai.models.evals.EvalCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalCreateParams params = EvalCreateParams.builder() + .customDataSourceConfig(EvalCreateParams.DataSourceConfig.Custom.ItemSchema.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build()) + .addTestingCriterion(EvalCreateParams.TestingCriterion.LabelModel.builder() + .addInput(EvalCreateParams.TestingCriterion.LabelModel.Input.SimpleInputMessage.builder() + .content("content") + .role("role") + .build()) + .addLabel("string") + .model("model") + .name("name") + .addPassingLabel("string") + .build()) + .build(); + EvalCreateResponse eval = client.evals().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.create( + data_source_config: {item_schema: {foo: "bar"}, type: :custom}, + testing_criteria: [ + { + input: [{content: "content", role: "role"}], + labels: ["string"], + model: "model", + name: "name", + passing_labels: ["string"], + type: :label_model + } + ] + ) + + puts(eval_) + response: | + { + "object": "eval", + "id": "eval_67b7fa9a81a88190ab4aa417e397ea21", + "data_source_config": { + "type": "stored_completions", + "metadata": { + "usecase": "chatbot" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + ] + }, + "testing_criteria": [ + { + "name": "Example label grader", + "type": "label_model", + "model": "o3-mini", + "input": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.input}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + ], + "name": "Sentiment", + "created_at": 1740110490, + "metadata": { + "description": "An eval for sentiment analysis" + } + } + /evals/{eval_id}: + get: + operationId: getEval + tags: + - Evals + summary: | + Get an evaluation by ID. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve. + responses: + '200': + description: The evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/Eval' + x-oaiMeta: + name: Get an eval + group: evals + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.retrieve( + "eval_id", + ) + print(eval.id) + javascript: > + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + const evalObj = await + openai.evals.retrieve("eval_67abd54d9b0081909a86353f6fb9317a"); + + console.log(evalObj); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.retrieve('eval_id'); + + console.log(_eval.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalRetrieveParams; + import com.openai.models.evals.EvalRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalRetrieveResponse eval = client.evals().retrieve("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.retrieve("eval_id") + + puts(eval_) + response: | + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": {}, + } + post: + operationId: updateEval + tags: + - Evals + summary: | + Update certain properties of an evaluation. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to update. + requestBody: + description: Request to update an evaluation + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: Rename the evaluation. + metadata: + $ref: '#/components/schemas/Metadata' + responses: + '200': + description: The updated evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/Eval' + x-oaiMeta: + name: Update an eval + group: evals + path: update + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"name": "Updated Eval", "metadata": {"description": "Updated description"}}' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.update( + eval_id="eval_id", + ) + print(eval.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const updatedEval = await openai.evals.update( + "eval_67abd54d9b0081909a86353f6fb9317a", + { + name: "Updated Eval", + metadata: { description: "Updated description" } + } + ); + console.log(updatedEval); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.update('eval_id'); + + console.log(_eval.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalUpdateParams; + import com.openai.models.evals.EvalUpdateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalUpdateResponse eval = client.evals().update("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.update("eval_id") + + puts(eval_) + response: | + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "Updated Eval", + "created_at": 1739314509, + "metadata": {"description": "Updated description"}, + } + delete: + operationId: deleteEval + tags: + - Evals + summary: | + Delete an evaluation. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to delete. + responses: + '200': + description: Successfully deleted the evaluation. + content: + application/json: + schema: + type: object + properties: + object: + type: string + example: eval.deleted + deleted: + type: boolean + example: true + eval_id: + type: string + example: eval_abc123 + required: + - object + - deleted + - eval_id + '404': + description: Evaluation not found. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Delete an eval + group: evals + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_abc123 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.delete( + "eval_id", + ) + print(eval.eval_id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const deleted = await openai.evals.delete("eval_abc123"); + console.log(deleted); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.delete('eval_id'); + + console.log(_eval.eval_id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalDeleteParams; + import com.openai.models.evals.EvalDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalDeleteResponse eval = client.evals().delete("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.delete("eval_id") + + puts(eval_) + response: | + { + "object": "eval.deleted", + "deleted": true, + "eval_id": "eval_abc123" + } + /evals/{eval_id}/runs: + get: + operationId: getEvalRuns + tags: + - Evals + summary: | + Get a list of runs for an evaluation. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: after + in: query + description: Identifier for the last run from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of runs to retrieve. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: >- + Sort order for runs by timestamp. Use `asc` for ascending order or + `desc` for descending order. Defaults to `asc`. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + - name: status + in: query + description: >- + Filter runs by status. One of `queued` | `in_progress` | `failed` | + `completed` | `canceled`. + required: false + schema: + type: string + enum: + - queued + - in_progress + - completed + - canceled + - failed + responses: + '200': + description: A list of runs for the evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRunList' + x-oaiMeta: + name: Get eval runs + group: evals + path: get-runs + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/egroup_67abd54d9b0081909a86353f6fb9317a/runs + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.evals.runs.list( + eval_id="eval_id", + ) + page = page.data[0] + print(page.id) + javascript: > + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + const runs = await + openai.evals.runs.list("egroup_67abd54d9b0081909a86353f6fb9317a"); + + console.log(runs); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const runListResponse of + client.evals.runs.list('eval_id')) { + console.log(runListResponse.id); + } + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunListPage; + import com.openai.models.evals.runs.RunListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunListPage page = client.evals().runs().list("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.evals.runs.list("eval_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "eval.run", + "id": "evalrun_67e0c7d31560819090d60c0780591042", + "eval_id": "eval_67e0c726d560819083f19a957c4c640b", + "report_url": "https://platform.openai.com/evaluations/eval_67e0c726d560819083f19a957c4c640b", + "status": "completed", + "model": "o3-mini", + "name": "bulk_with_negative_examples_o3-mini", + "created_at": 1742784467, + "result_counts": { + "total": 1, + "errored": 0, + "failed": 0, + "passed": 1 + }, + "per_model_usage": [ + { + "model_name": "o3-mini", + "invocation_count": 1, + "prompt_tokens": 563, + "completion_tokens": 874, + "total_tokens": 1437, + "cached_tokens": 0 + } + ], + "per_testing_criteria_results": [ + { + "testing_criteria": "Push Notification Summary Grader-1808cd0b-eeec-4e0b-a519-337e79f4f5d1", + "passed": 1, + "failed": 0 + } + ], + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "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" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.notifications}}" + } + } + ] + }, + "model": "o3-mini", + "sampling_params": null + }, + "error": null, + "metadata": {} + } + ], + "first_id": "evalrun_67e0c7d31560819090d60c0780591042", + "last_id": "evalrun_67e0c7d31560819090d60c0780591042", + "has_more": true + } + post: + operationId: createEvalRun + 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. + parameters: + - in: path + name: eval_id + required: true + schema: + type: string + description: The ID of the evaluation to create a run for. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEvalRunRequest' + responses: + '201': + description: Successfully created a run for the evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRun' + '400': + description: Bad request (for example, missing eval object) + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Create eval run + group: evals + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_67e579652b548190aaa83ada4b125f47/runs + \ + -X POST \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"name":"gpt-4o-mini","data_source":{"type":"completions","input_messages":{"type":"template","template":[{"role":"developer","content":"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"} , {"role":"user","content":"{{item.input}}"}]} ,"sampling_params":{"temperature":1,"max_completions_tokens":2048,"top_p":1,"seed":42},"model":"gpt-4o-mini","source":{"type":"file_content","content":[{"item":{"input":"Tech Company Launches Advanced Artificial Intelligence Platform","ground_truth":"Technology"}}]}}' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.evals.runs.create( + eval_id="eval_id", + data_source={ + "source": { + "content": [{ + "item": { + "foo": "bar" + } + }], + "type": "file_content", + }, + "type": "jsonl", + }, + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const run = await openai.evals.runs.create( + "eval_67e579652b548190aaa83ada4b125f47", + { + name: "gpt-4o-mini", + data_source: { + type: "completions", + input_messages: { + type: "template", + template: [ + { + role: "developer", + content: "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" + }, + { + role: "user", + content: "{{item.input}}" + } + ] + }, + sampling_params: { + temperature: 1, + max_completions_tokens: 2048, + top_p: 1, + seed: 42 + }, + model: "gpt-4o-mini", + source: { + type: "file_content", + content: [ + { + item: { + input: "Tech Company Launches Advanced Artificial Intelligence Platform", + ground_truth: "Technology" + } + } + ] + } + } + } + ); + console.log(run); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.evals.runs.create('eval_id', { + data_source: { + source: { content: [{ item: { foo: 'bar' } }], type: 'file_content' }, + type: 'jsonl', + }, + }); + + console.log(run.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.evals.runs.CreateEvalJsonlRunDataSource; + import com.openai.models.evals.runs.RunCreateParams; + import com.openai.models.evals.runs.RunCreateResponse; + import java.util.List; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .evalId("eval_id") + .dataSource(CreateEvalJsonlRunDataSource.builder() + .fileContentSource(List.of(CreateEvalJsonlRunDataSource.Source.FileContent.Content.builder() + .item(CreateEvalJsonlRunDataSource.Source.FileContent.Content.Item.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build()) + .build())) + .build()) + .build(); + RunCreateResponse run = client.evals().runs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.evals.runs.create( + "eval_id", + data_source: {source: {content: [{item: {foo: "bar"}}], type: :file_content}, type: :jsonl} + ) + + puts(run) + response: | + { + "object": "eval.run", + "id": "evalrun_67e57965b480819094274e3a32235e4c", + "eval_id": "eval_67e579652b548190aaa83ada4b125f47", + "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47&run_id=evalrun_67e57965b480819094274e3a32235e4c", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + /evals/{eval_id}/runs/{run_id}: + get: + operationId: getEvalRun + tags: + - Evals + summary: | + Get an evaluation run by ID. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to retrieve. + responses: + '200': + description: The evaluation run + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRun' + x-oaiMeta: + name: Get an eval run + group: evals + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.evals.runs.retrieve( + run_id="run_id", + eval_id="eval_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const run = await openai.evals.runs.retrieve( + "evalrun_67abd54d60ec8190832b46859da808f7", + { eval_id: "eval_67abd54d9b0081909a86353f6fb9317a" } + ); + console.log(run); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.evals.runs.retrieve('run_id', { eval_id: + 'eval_id' }); + + + console.log(run.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunRetrieveParams; + import com.openai.models.evals.runs.RunRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunRetrieveParams params = RunRetrieveParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + RunRetrieveResponse run = client.evals().runs().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.evals.runs.retrieve("run_id", eval_id: "eval_id") + + puts(run) + response: | + { + "object": "eval.run", + "id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "report_url": "https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + post: + operationId: cancelEvalRun + tags: + - Evals + summary: | + Cancel an ongoing evaluation run. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation whose run you want to cancel. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to cancel. + responses: + '200': + description: The canceled eval run object + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRun' + x-oaiMeta: + name: Cancel eval run + group: evals + path: post + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7/cancel + \ + -X POST \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.evals.runs.cancel( + run_id="run_id", + eval_id="eval_id", + ) + print(response.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const canceledRun = await openai.evals.runs.cancel( + "evalrun_67abd54d60ec8190832b46859da808f7", + { eval_id: "eval_67abd54d9b0081909a86353f6fb9317a" } + ); + console.log(canceledRun); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const response = await client.evals.runs.cancel('run_id', { + eval_id: 'eval_id' }); + + + console.log(response.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunCancelParams; + import com.openai.models.evals.runs.RunCancelResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCancelParams params = RunCancelParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + RunCancelResponse response = client.evals().runs().cancel(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.evals.runs.cancel("run_id", eval_id: "eval_id") + + puts(response) + response: | + { + "object": "eval.run", + "id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "report_url": "https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7", + "status": "canceled", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + delete: + operationId: deleteEvalRun + tags: + - Evals + summary: | + Delete an eval run. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to delete the run from. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to delete. + 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 + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Delete eval run + group: evals + path: delete + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_123abc/runs/evalrun_abc456 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.evals.runs.delete( + run_id="run_id", + eval_id="eval_id", + ) + print(run.run_id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const deleted = await openai.evals.runs.delete( + "eval_123abc", + "evalrun_abc456" + ); + console.log(deleted); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.evals.runs.delete('run_id', { eval_id: + 'eval_id' }); + + + console.log(run.run_id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunDeleteParams; + import com.openai.models.evals.runs.RunDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunDeleteParams params = RunDeleteParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + RunDeleteResponse run = client.evals().runs().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.evals.runs.delete("run_id", eval_id: "eval_id") + + puts(run) + response: | + { + "object": "eval.run.deleted", + "deleted": true, + "run_id": "evalrun_abc456" + } + /evals/{eval_id}/runs/{run_id}/output_items: + get: + operationId: getEvalRunOutputItems + tags: + - Evals + summary: | + Get a list of output items for an evaluation run. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to retrieve output items for. + - name: after + in: query + description: >- + Identifier for the last output item from the previous pagination + request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of output items to retrieve. + required: false + schema: + type: integer + default: 20 + - name: status + in: query + description: > + Filter output items by status. Use `failed` to filter by failed + output + + items or `pass` to filter by passed output items. + required: false + schema: + type: string + enum: + - fail + - pass + - name: order + in: query + description: >- + Sort order for output items by timestamp. Use `asc` for ascending + order or `desc` for descending order. Defaults to `asc`. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + responses: + '200': + description: A list of output items for the evaluation run + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRunOutputItemList' + x-oaiMeta: + name: Get eval run output items + group: evals + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/egroup_67abd54d9b0081909a86353f6fb9317a/runs/erun_67abd54d60ec8190832b46859da808f7/output_items + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.evals.runs.output_items.list( + run_id="run_id", + eval_id="eval_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const outputItems = await openai.evals.runs.outputItems.list( + "egroup_67abd54d9b0081909a86353f6fb9317a", + "erun_67abd54d60ec8190832b46859da808f7" + ); + console.log(outputItems); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const outputItemListResponse of + client.evals.runs.outputItems.list('run_id', { + eval_id: 'eval_id', + })) { + console.log(outputItemListResponse.id); + } + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.evals.runs.outputitems.OutputItemListPage; + + import + com.openai.models.evals.runs.outputitems.OutputItemListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OutputItemListParams params = OutputItemListParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + OutputItemListPage page = client.evals().runs().outputItems().list(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + page = openai.evals.runs.output_items.list("run_id", eval_id: + "eval_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "eval.run.output_item", + "id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "created_at": 1743092076, + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "status": "pass", + "datasource_item_id": 5, + "datasource_item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + }, + "results": [ + { + "name": "String check-a2486074-d803-4445-b431-ad2262e85d47", + "sample": null, + "passed": true, + "score": 1.0 + } + ], + "sample": { + "input": [ + { + "role": "developer", + "content": "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", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + }, + { + "role": "user", + "content": "Stock Markets Rally After Positive Economic Data Released", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "output": [ + { + "role": "assistant", + "content": "Markets", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "finish_reason": "stop", + "model": "gpt-4o-mini-2024-07-18", + "usage": { + "total_tokens": 325, + "completion_tokens": 2, + "prompt_tokens": 323, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } + ], + "first_id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "last_id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "has_more": true + } + /evals/{eval_id}/runs/{run_id}/output_items/{output_item_id}: + get: + operationId: getEvalRunOutputItem + tags: + - Evals + summary: | + Get an evaluation run output item by ID. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to retrieve. + - name: output_item_id + in: path + required: true + schema: + type: string + description: The ID of the output item to retrieve. + responses: + '200': + description: The evaluation run output item + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRunOutputItem' + x-oaiMeta: + name: Get an output item of an eval run + group: evals + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7/output_items/outputitem_67abd55eb6548190bb580745d5644a33 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + output_item = client.evals.runs.output_items.retrieve( + output_item_id="output_item_id", + eval_id="eval_id", + run_id="run_id", + ) + print(output_item.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const outputItem = await openai.evals.runs.outputItems.retrieve( + "outputitem_67abd55eb6548190bb580745d5644a33", + { + eval_id: "eval_67abd54d9b0081909a86353f6fb9317a", + run_id: "evalrun_67abd54d60ec8190832b46859da808f7", + } + ); + console.log(outputItem); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const outputItem = await + client.evals.runs.outputItems.retrieve('output_item_id', { + eval_id: 'eval_id', + run_id: 'run_id', + }); + + + console.log(outputItem.id); + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.evals.runs.outputitems.OutputItemRetrieveParams; + + import + com.openai.models.evals.runs.outputitems.OutputItemRetrieveResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OutputItemRetrieveParams params = OutputItemRetrieveParams.builder() + .evalId("eval_id") + .runId("run_id") + .outputItemId("output_item_id") + .build(); + OutputItemRetrieveResponse outputItem = client.evals().runs().outputItems().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + output_item = + openai.evals.runs.output_items.retrieve("output_item_id", eval_id: + "eval_id", run_id: "run_id") + + + puts(output_item) + response: | + { + "object": "eval.run.output_item", + "id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "created_at": 1743092076, + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "status": "pass", + "datasource_item_id": 5, + "datasource_item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + }, + "results": [ + { + "name": "String check-a2486074-d803-4445-b431-ad2262e85d47", + "sample": null, + "passed": true, + "score": 1.0 + } + ], + "sample": { + "input": [ + { + "role": "developer", + "content": "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", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + }, + { + "role": "user", + "content": "Stock Markets Rally After Positive Economic Data Released", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "output": [ + { + "role": "assistant", + "content": "Markets", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "finish_reason": "stop", + "model": "gpt-4o-mini-2024-07-18", + "usage": { + "total_tokens": 325, + "completion_tokens": 2, + "prompt_tokens": 323, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } + /files: + get: + operationId: listFiles + tags: + - Files + summary: Returns a list of files. + parameters: + - in: query + name: purpose + required: false + schema: + type: string + description: Only return files with the given purpose. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 10,000, and the default is 10,000. + required: false + schema: + type: integer + default: 10000 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFilesResponse' + x-oaiMeta: + name: List files + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.files.list() + page = page.data[0] + print(page) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.files.list(); + + for await (const file of list) { + console.log(file); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fileObject of client.files.list()) { + console.log(fileObject); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Files.List(context.TODO(), openai.FileListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileListPage; + import com.openai.models.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileListPage page = client.files().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.files.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "file", + "bytes": 175, + "created_at": 1613677385, + "expires_at": 1677614202, + "filename": "salesOverview.pdf", + "purpose": "assistants", + }, + { + "id": "file-abc456", + "object": "file", + "bytes": 140, + "created_at": 1613779121, + "expires_at": 1677614202, + "filename": "puppy.jsonl", + "purpose": "fine-tune", + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + post: + operationId: createFile + tags: + - Files + summary: > + Upload a file that can be used across various endpoints. Individual + files + + can be up to 512 MB, and each project can store up to 2.5 TB of files in + + total. There is no organization-wide storage limit. Uploads to this + + endpoint are rate-limited to 1,000 requests per minute per authenticated + + user. + + + - The Assistants API supports files up to 2 million tokens and of + specific + file types. See the [Assistants Tools guide](/docs/assistants/tools) for + details. + - The Fine-tuning API only supports `.jsonl` files. The input also has + certain required formats for fine-tuning + [chat](/docs/api-reference/fine-tuning/chat-input) or + [completions](/docs/api-reference/fine-tuning/completions-input) models. + - The Batch API only supports `.jsonl` files up to 200 MB in size. The + input + also has a specific required + [format](/docs/api-reference/batch/request-input). + - 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_stores/{vector_store_id}/file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch) + instead of attaching them one by one. Vector store attachment has separate + limits from file upload, including 2,000 attached files per minute per + organization. + + Please [contact us](https://help.openai.com/) if you need to increase + these + + storage limits. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateFileRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIFile' + 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. + examples: + request: + curl: | + curl https://api.openai.com/v1/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F purpose="fine-tune" \ + -F file="@mydata.jsonl" + -F expires_after[anchor]="created_at" + -F expires_after[seconds]=2592000 + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file_object = client.files.create( + file=b"Example data", + purpose="assistants", + ) + print(file_object.id) + javascript: |- + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.create({ + file: fs.createReadStream("mydata.jsonl"), + purpose: "fine-tune", + expires_after: { + anchor: "created_at", + seconds: 2592000 + } + }); + + console.log(file); + } + + main(); + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fileObject = await client.files.create({ + file: fs.createReadStream('fine-tune.jsonl'), + purpose: 'assistants', + }); + + console.log(fileObject.id); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfileObject, err := client.Files.New(context.TODO(), openai.FileNewParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tPurpose: openai.FilePurposeAssistants,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fileObject.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileCreateParams; + import com.openai.models.files.FileObject; + import com.openai.models.files.FilePurpose; + import java.io.ByteArrayInputStream; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileCreateParams params = FileCreateParams.builder() + .file(new ByteArrayInputStream("Example data".getBytes())) + .purpose(FilePurpose.ASSISTANTS) + .build(); + FileObject fileObject = client.files().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + file_object = openai.files.create(file: StringIO.new("Example + data"), purpose: :assistants) + + + puts(file_object) + response: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1677614202, + "filename": "mydata.jsonl", + "purpose": "fine-tune", + } + /files/{file_id}: + delete: + operationId: deleteFile + tags: + - Files + summary: Delete a file and remove it from all vector stores. + parameters: + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to use for this request. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteFileResponse' + x-oaiMeta: + name: Delete file + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files/file-abc123 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file_deleted = client.files.delete( + "file_id", + ) + print(file_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.delete("file-abc123"); + + console.log(file); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fileDeleted = await client.files.delete('file_id'); + + console.log(fileDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfileDeleted, err := client.Files.Delete(context.TODO(), \"file_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fileDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileDeleteParams; + import com.openai.models.files.FileDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileDeleted fileDeleted = client.files().delete("file_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file_deleted = openai.files.delete("file_id") + + puts(file_deleted) + response: | + { + "id": "file-abc123", + "object": "file", + "deleted": true + } + get: + operationId: retrieveFile + tags: + - Files + summary: Returns information about a specific file. + parameters: + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to use for this request. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIFile' + x-oaiMeta: + name: Retrieve file + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files/file-abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file_object = client.files.retrieve( + "file_id", + ) + print(file_object.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.retrieve("file-abc123"); + + console.log(file); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fileObject = await client.files.retrieve('file_id'); + + console.log(fileObject.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfileObject, err := client.Files.Get(context.TODO(), \"file_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fileObject.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileObject; + import com.openai.models.files.FileRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileObject fileObject = client.files().retrieve("file_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file_object = openai.files.retrieve("file_id") + + puts(file_object) + response: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1677614202, + "filename": "mydata.jsonl", + "purpose": "fine-tune", + } + /files/{file_id}/content: + get: + operationId: downloadFile + tags: + - Files + summary: Returns the contents of the specified file. + parameters: + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to use for this request. + responses: + '200': + description: OK + content: + application/json: + schema: + type: string + x-oaiMeta: + name: Retrieve file content + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files/file-abc123/content \ + -H "Authorization: Bearer $OPENAI_API_KEY" > file.jsonl + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.files.content( + "file_id", + ) + print(response) + content = response.read() + print(content) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.content("file-abc123"); + + console.log(file); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.files.content('file_id'); + + console.log(response); + + const content = await response.blob(); + console.log(content); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Files.Content(context.TODO(), \"file_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.http.HttpResponse; + import com.openai.models.files.FileContentParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + HttpResponse response = client.files().content("file_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.files.content("file_id") + + puts(response) + response: '' + /fine_tuning/alpha/graders/run: + post: + operationId: runGrader + tags: + - Fine-tuning + summary: | + Run a grader. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RunGraderRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunGraderResponse' + x-oaiMeta: + name: Run grader + beta: true + group: graders + examples: + - title: Score text alignment + request: + curl: > + curl -X POST + https://api.openai.com/v1/fine_tuning/alpha/graders/run \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "grader": { + "type": "score_model", + "name": "Example score model grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Score how close the reference answer is to the model answer on a 0-1 scale. Return only the score.\n\nReference answer: {{item.reference_answer}}\n\nModel answer: {{sample.output_text}}" + } + ] + } + ], + "model": "gpt-5-mini", + "sampling_params": { + "temperature": 1, + "top_p": 1, + "seed": 42 + } + }, + "item": { + "reference_answer": "fuzzy wuzzy was a bear" + }, + "model_sample": "fuzzy wuzzy was a bear" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.fine_tuning.alpha.graders.run( + grader={ + "input": "input", + "name": "name", + "operation": "eq", + "reference": "reference", + "type": "string_check", + }, + model_sample="model_sample", + ) + print(response.metadata) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const result = await openai.fineTuning.alpha.graders.run({ + grader: { + type: "score_model", + name: "Example score model grader", + input: [ + { + role: "user", + content: [ + { + type: "input_text", + text: "Score how close the reference answer is to the model answer on a 0-1 scale. Return only the score.\n\nReference answer: {{item.reference_answer}}\n\nModel answer: {{sample.output_text}}", + }, + ], + }, + ], + model: "gpt-5-mini", + sampling_params: { temperature: 1, top_p: 1, seed: 42 }, + }, + item: { reference_answer: "fuzzy wuzzy was a bear" }, + model_sample: "fuzzy wuzzy was a bear", + }); + console.log(result); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.fineTuning.alpha.graders.run({ + grader: { + input: 'input', + name: 'name', + operation: 'eq', + reference: 'reference', + type: 'string_check', + }, + model_sample: 'model_sample', + }); + + console.log(response.metadata); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.FineTuning.Alpha.Graders.Run(context.TODO(), openai.FineTuningAlphaGraderRunParams{\n\t\tGrader: openai.FineTuningAlphaGraderRunParamsGraderUnion{\n\t\t\tOfStringCheck: &openai.StringCheckGraderParam{\n\t\t\t\tInput: \"input\",\n\t\t\t\tName: \"name\",\n\t\t\t\tOperation: openai.StringCheckGraderOperationEq,\n\t\t\t\tReference: \"reference\",\n\t\t\t},\n\t\t},\n\t\tModelSample: \"model_sample\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Metadata)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.finetuning.alpha.graders.GraderRunParams; + + import + com.openai.models.finetuning.alpha.graders.GraderRunResponse; + + import com.openai.models.graders.gradermodels.StringCheckGrader; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GraderRunParams params = GraderRunParams.builder() + .grader(StringCheckGrader.builder() + .input("input") + .name("name") + .operation(StringCheckGrader.Operation.EQ) + .reference("reference") + .build()) + .modelSample("model_sample") + .build(); + GraderRunResponse response = client.fineTuning().alpha().graders().run(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.fine_tuning.alpha.graders.run( + grader: {input: "input", name: "name", operation: :eq, reference: "reference", type: :string_check}, + model_sample: "model_sample" + ) + + puts(response) + response: | + { + "reward": 1.0, + "metadata": { + "name": "Example score model grader", + "type": "score_model", + "errors": { + "formula_parse_error": false, + "sample_parse_error": false, + "truncated_observation_error": false, + "unresponsive_reward_error": false, + "invalid_variable_error": false, + "other_error": false, + "python_grader_server_error": false, + "python_grader_server_error_type": null, + "python_grader_runtime_error": false, + "python_grader_runtime_error_details": null, + "model_grader_server_error": false, + "model_grader_refusal_error": false, + "model_grader_parse_error": false, + "model_grader_server_error_details": null + }, + "execution_time": 4.365238428115845, + "scores": {}, + "token_usage": { + "prompt_tokens": 190, + "total_tokens": 324, + "completion_tokens": 134, + "cached_tokens": 0 + }, + "sampled_model_name": "gpt-4o-2024-08-06" + }, + "sub_rewards": {}, + "model_grader_token_usage_per_model": { + "gpt-4o-2024-08-06": { + "prompt_tokens": 190, + "total_tokens": 324, + "completion_tokens": 134, + "cached_tokens": 0 + } + } + } + - title: Score an image caption + request: + curl: > + curl -X POST + https://api.openai.com/v1/fine_tuning/alpha/graders/run \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "grader": { + "type": "score_model", + "name": "Image caption grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Score how well the provided caption matches the image on a 0-1 scale. Only return the score.\n\nCaption: {{sample.output_text}}" + }, + { + "type": "input_image", + "image_url": "https://example.com/dog-catching-ball.png", + "file_id": null, + "detail": "high" + } + ] + } + ], + "model": "gpt-5-mini", + "sampling_params": { + "temperature": 0.2 + } + }, + "item": { + "expected_caption": "A golden retriever jumps to catch a tennis ball" + }, + "model_sample": "A dog leaps to grab a tennis ball mid-air" + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.fineTuning.alpha.graders.run({ + grader: { + input: 'input', + name: 'name', + operation: 'eq', + reference: 'reference', + type: 'string_check', + }, + model_sample: 'model_sample', + }); + + console.log(response.metadata); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.fine_tuning.alpha.graders.run( + grader={ + "input": "input", + "name": "name", + "operation": "eq", + "reference": "reference", + "type": "string_check", + }, + model_sample="model_sample", + ) + print(response.metadata) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.FineTuning.Alpha.Graders.Run(context.TODO(), openai.FineTuningAlphaGraderRunParams{\n\t\tGrader: openai.FineTuningAlphaGraderRunParamsGraderUnion{\n\t\t\tOfStringCheck: &openai.StringCheckGraderParam{\n\t\t\t\tInput: \"input\",\n\t\t\t\tName: \"name\",\n\t\t\t\tOperation: openai.StringCheckGraderOperationEq,\n\t\t\t\tReference: \"reference\",\n\t\t\t},\n\t\t},\n\t\tModelSample: \"model_sample\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Metadata)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.finetuning.alpha.graders.GraderRunParams; + + import + com.openai.models.finetuning.alpha.graders.GraderRunResponse; + + import com.openai.models.graders.gradermodels.StringCheckGrader; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GraderRunParams params = GraderRunParams.builder() + .grader(StringCheckGrader.builder() + .input("input") + .name("name") + .operation(StringCheckGrader.Operation.EQ) + .reference("reference") + .build()) + .modelSample("model_sample") + .build(); + GraderRunResponse response = client.fineTuning().alpha().graders().run(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.fine_tuning.alpha.graders.run( + grader: {input: "input", name: "name", operation: :eq, reference: "reference", type: :string_check}, + model_sample: "model_sample" + ) + + puts(response) + - title: Score an audio response + request: + curl: > + curl -X POST + https://api.openai.com/v1/fine_tuning/alpha/graders/run \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "grader": { + "type": "score_model", + "name": "Audio clarity grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Listen to the clip and return a confidence score from 0 to 1 that the speaker said: {{item.target_phrase}}" + }, + { + "type": "input_audio", + "input_audio": { + "data": "{{item.audio_clip_b64}}", + "format": "mp3" + } + } + ] + } + ], + "model": "gpt-audio", + "sampling_params": { + "temperature": 0.2, + "top_p": 1, + "seed": 123 + } + }, + "item": { + "target_phrase": "Please deliver the package on Tuesday", + "audio_clip_b64": "" + }, + "model_sample": "Please deliver the package on Tuesday" + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.fineTuning.alpha.graders.run({ + grader: { + input: 'input', + name: 'name', + operation: 'eq', + reference: 'reference', + type: 'string_check', + }, + model_sample: 'model_sample', + }); + + console.log(response.metadata); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.fine_tuning.alpha.graders.run( + grader={ + "input": "input", + "name": "name", + "operation": "eq", + "reference": "reference", + "type": "string_check", + }, + model_sample="model_sample", + ) + print(response.metadata) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.FineTuning.Alpha.Graders.Run(context.TODO(), openai.FineTuningAlphaGraderRunParams{\n\t\tGrader: openai.FineTuningAlphaGraderRunParamsGraderUnion{\n\t\t\tOfStringCheck: &openai.StringCheckGraderParam{\n\t\t\t\tInput: \"input\",\n\t\t\t\tName: \"name\",\n\t\t\t\tOperation: openai.StringCheckGraderOperationEq,\n\t\t\t\tReference: \"reference\",\n\t\t\t},\n\t\t},\n\t\tModelSample: \"model_sample\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Metadata)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.finetuning.alpha.graders.GraderRunParams; + + import + com.openai.models.finetuning.alpha.graders.GraderRunResponse; + + import com.openai.models.graders.gradermodels.StringCheckGrader; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GraderRunParams params = GraderRunParams.builder() + .grader(StringCheckGrader.builder() + .input("input") + .name("name") + .operation(StringCheckGrader.Operation.EQ) + .reference("reference") + .build()) + .modelSample("model_sample") + .build(); + GraderRunResponse response = client.fineTuning().alpha().graders().run(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.fine_tuning.alpha.graders.run( + grader: {input: "input", name: "name", operation: :eq, reference: "reference", type: :string_check}, + model_sample: "model_sample" + ) + + puts(response) + /fine_tuning/alpha/graders/validate: + post: + operationId: validateGrader + tags: + - Fine-tuning + summary: | + Validate a grader. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ValidateGraderRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ValidateGraderResponse' + x-oaiMeta: + name: Validate grader + beta: true + group: graders + examples: + request: + curl: > + curl https://api.openai.com/v1/fine_tuning/alpha/graders/validate + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "grader": { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.fineTuning.alpha.graders.validate({ + grader: { + input: 'input', + name: 'name', + operation: 'eq', + reference: 'reference', + type: 'string_check', + }, + }); + + console.log(response.grader); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.fine_tuning.alpha.graders.validate( + grader={ + "input": "input", + "name": "name", + "operation": "eq", + "reference": "reference", + "type": "string_check", + }, + ) + print(response.grader) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.FineTuning.Alpha.Graders.Validate(context.TODO(), openai.FineTuningAlphaGraderValidateParams{\n\t\tGrader: openai.FineTuningAlphaGraderValidateParamsGraderUnion{\n\t\t\tOfStringCheckGrader: &openai.StringCheckGraderParam{\n\t\t\t\tInput: \"input\",\n\t\t\t\tName: \"name\",\n\t\t\t\tOperation: openai.StringCheckGraderOperationEq,\n\t\t\t\tReference: \"reference\",\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Grader)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.finetuning.alpha.graders.GraderValidateParams; + + import + com.openai.models.finetuning.alpha.graders.GraderValidateResponse; + + import com.openai.models.graders.gradermodels.StringCheckGrader; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GraderValidateParams params = GraderValidateParams.builder() + .grader(StringCheckGrader.builder() + .input("input") + .name("name") + .operation(StringCheckGrader.Operation.EQ) + .reference("reference") + .build()) + .build(); + GraderValidateResponse response = client.fineTuning().alpha().graders().validate(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.fine_tuning.alpha.graders.validate( + grader: {input: "input", name: "name", operation: :eq, reference: "reference", type: :string_check} + ) + + puts(response) + response: | + { + "grader": { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + } + /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions: + get: + operationId: listFineTuningCheckpointPermissions + tags: + - Fine-tuning + summary: > + **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + + + Organization owners can use this endpoint to view all permissions for a + fine-tuned model checkpoint. + parameters: + - in: path + name: fine_tuned_model_checkpoint + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuned model checkpoint to get permissions for. + - name: project_id + in: query + description: The ID of the project to get permissions for. + required: false + schema: + type: string + - name: after + in: query + description: >- + Identifier for the last permission ID from the previous pagination + request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of permissions to retrieve. + required: false + schema: + type: integer + default: 10 + - name: order + in: query + description: The order in which to retrieve permissions. + required: false + schema: + type: string + enum: + - ascending + - descending + default: descending + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: >- + #/components/schemas/ListFineTuningCheckpointPermissionResponse + 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 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const permission = await + client.fineTuning.checkpoints.permissions.retrieve( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + ); + + + console.log(permission.first_id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + permission = client.fine_tuning.checkpoints.permissions.retrieve( + fine_tuned_model_checkpoint="ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(permission.first_id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpermission, err := client.FineTuning.Checkpoints.Permissions.Get(\n\t\tcontext.TODO(),\n\t\t\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n\t\topenai.FineTuningCheckpointPermissionGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", permission.FirstID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.finetuning.checkpoints.permissions.PermissionRetrieveParams; + + import + com.openai.models.finetuning.checkpoints.permissions.PermissionRetrieveResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PermissionRetrieveResponse permission = client.fineTuning().checkpoints().permissions().retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + permission = + openai.fine_tuning.checkpoints.permissions.retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(permission) + response: | + { + "object": "list", + "data": [ + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + }, + { + "object": "checkpoint.permission", + "id": "cp_enQCFmOTGj3syEpYVhBRLTSy", + "created_at": 1721764800, + "project_id": "proj_iqGMw1llN8IrBb6SvvY5A1oF" + }, + ], + "first_id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "cp_enQCFmOTGj3syEpYVhBRLTSy", + "has_more": false + } + post: + operationId: createFineTuningCheckpointPermission + tags: + - Fine-tuning + summary: > + **NOTE:** Calling this endpoint requires an [admin API + key](../admin-api-keys). + + + This enables organization owners to share fine-tuned models with other + projects in their organization. + parameters: + - in: path + name: fine_tuned_model_checkpoint + required: true + schema: + type: string + example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd + description: > + The ID of the fine-tuned model checkpoint to create a permission + for. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateFineTuningCheckpointPermissionRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: >- + #/components/schemas/ListFineTuningCheckpointPermissionResponse + x-oaiMeta: + name: Create 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 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + -d '{"project_ids": ["proj_abGMw1llN8IrBb6SvvY5A1iH"]}' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const permissionCreateResponse of + client.fineTuning.checkpoints.permissions.create( + 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + { project_ids: ['string'] }, + )) { + console.log(permissionCreateResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.checkpoints.permissions.create( + fine_tuned_model_checkpoint="ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd", + project_ids=["string"], + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Checkpoints.Permissions.New(\n\t\tcontext.TODO(),\n\t\t\"ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd\",\n\t\topenai.FineTuningCheckpointPermissionNewParams{\n\t\t\tProjectIDs: []string{\"string\"},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.finetuning.checkpoints.permissions.PermissionCreatePage; + + import + com.openai.models.finetuning.checkpoints.permissions.PermissionCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PermissionCreateParams params = PermissionCreateParams.builder() + .fineTunedModelCheckpoint("ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd") + .addProjectId("string") + .build(); + PermissionCreatePage page = client.fineTuning().checkpoints().permissions().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.fine_tuning.checkpoints.permissions.create( + "ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd", + project_ids: ["string"] + ) + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + } + ], + "first_id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "has_more": false + } + /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}: + delete: + operationId: deleteFineTuningCheckpointPermission + tags: + - Fine-tuning + summary: > + **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + + + Organization owners can use this endpoint to delete a permission for a + fine-tuned model checkpoint. + parameters: + - in: path + name: fine_tuned_model_checkpoint + required: true + schema: + type: string + example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd + description: > + The ID of the fine-tuned model checkpoint to delete a permission + for. + - in: path + name: permission_id + required: true + schema: + type: string + example: cp_zc4Q7MP6XxulcVzj4MZdwsAB + description: | + The ID of the fine-tuned model checkpoint permission to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: >- + #/components/schemas/DeleteFineTuningCheckpointPermissionResponse + x-oaiMeta: + name: Delete checkpoint permission + 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/cp_zc4Q7MP6XxulcVzj4MZdwsAB + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const permission = await + client.fineTuning.checkpoints.permissions.delete( + 'cp_zc4Q7MP6XxulcVzj4MZdwsAB', + { fine_tuned_model_checkpoint: 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd' }, + ); + + + console.log(permission.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + permission = client.fine_tuning.checkpoints.permissions.delete( + permission_id="cp_zc4Q7MP6XxulcVzj4MZdwsAB", + fine_tuned_model_checkpoint="ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd", + ) + print(permission.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpermission, err := client.FineTuning.Checkpoints.Permissions.Delete(\n\t\tcontext.TODO(),\n\t\t\"ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd\",\n\t\t\"cp_zc4Q7MP6XxulcVzj4MZdwsAB\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", permission.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.finetuning.checkpoints.permissions.PermissionDeleteParams; + + import + com.openai.models.finetuning.checkpoints.permissions.PermissionDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PermissionDeleteParams params = PermissionDeleteParams.builder() + .fineTunedModelCheckpoint("ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd") + .permissionId("cp_zc4Q7MP6XxulcVzj4MZdwsAB") + .build(); + PermissionDeleteResponse permission = client.fineTuning().checkpoints().permissions().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + permission = openai.fine_tuning.checkpoints.permissions.delete( + "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + fine_tuned_model_checkpoint: "ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd" + ) + + puts(permission) + response: | + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "deleted": true + } + /fine_tuning/jobs: + post: + operationId: createFineTuningJob + tags: + - Fine-tuning + summary: > + Creates a fine-tuning job which begins the process of creating a new + model from a given dataset. + + + Response includes details of the enqueued job including job status and + the name of the fine-tuned models once complete. + + + [Learn more about fine-tuning](/docs/guides/model-optimization) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateFineTuningJobRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Create fine-tuning job + group: fine-tuning + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-BK7bzQj3FfZFXr7DbL6xJwfo", + "model": "gpt-4o-mini" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123" + }); + + console.log(fineTune); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = openai.fine_tuning.jobs.create(model: + :"gpt-4o-mini", training_file: "file-abc123") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + } + } + }, + "metadata": null + } + - title: Epochs + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "model": "gpt-4o-mini", + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 2 + } + } + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + javascript: > + import OpenAI from "openai"; + + import { SupervisedMethod, SupervisedHyperparameters } from + "openai/resources/fine-tuning/methods"; + + + const openai = new OpenAI(); + + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123", + model: "gpt-4o-mini", + method: { + type: "supervised", + supervised: { + hyperparameters: { + n_epochs: 2 + } + } + } + }); + + console.log(fineTune); + } + + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = openai.fine_tuning.jobs.create(model: + :"gpt-4o-mini", training_file: "file-abc123") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": 2 + }, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": 2 + } + } + }, + "metadata": null, + "error": { + "code": null, + "message": null, + "param": null + }, + "finished_at": null, + "seed": 683058546, + "trained_tokens": null, + "estimated_finish": null, + "integrations": [], + "user_provided_suffix": null, + "usage_metrics": null, + "shared_with_openai": false + } + - title: DPO + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini", + "method": { + "type": "dpo", + "dpo": { + "hyperparameters": { + "beta": 0.1 + } + } + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = openai.fine_tuning.jobs.create(model: + :"gpt-4o-mini", training_file: "file-abc123") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc", + "model": "gpt-4o-mini", + "created_at": 1746130590, + "fine_tuned_model": null, + "organization_id": "org-abc", + "result_files": [], + "status": "queued", + "validation_file": "file-123", + "training_file": "file-abc", + "method": { + "type": "dpo", + "dpo": { + "hyperparameters": { + "beta": 0.1, + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto" + } + } + }, + "metadata": null, + "error": { + "code": null, + "message": null, + "param": null + }, + "finished_at": null, + "hyperparameters": null, + "seed": 1036326793, + "estimated_finish": null, + "integrations": [], + "user_provided_suffix": null, + "usage_metrics": null, + "shared_with_openai": false + } + - title: Reinforcement + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc", + "validation_file": "file-123", + "model": "o4-mini", + "method": { + "type": "reinforcement", + "reinforcement": { + "grader": { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + }, + "hyperparameters": { + "reasoning_effort": "medium" + } + } + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = openai.fine_tuning.jobs.create(model: + :"gpt-4o-mini", training_file: "file-abc123") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "o4-mini", + "created_at": 1721764800, + "finished_at": null, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "validating_files", + "validation_file": "file-123", + "training_file": "file-abc", + "trained_tokens": null, + "error": {}, + "user_provided_suffix": null, + "seed": 950189191, + "estimated_finish": null, + "integrations": [], + "method": { + "type": "reinforcement", + "reinforcement": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + "eval_interval": "auto", + "eval_samples": "auto", + "compute_multiplier": "auto", + "reasoning_effort": "medium" + }, + "grader": { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + }, + "response_format": null + } + }, + "metadata": null, + "usage_metrics": null, + "shared_with_openai": false + } + + - title: Validation file + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123", + validation_file: "file-abc123" + }); + + console.log(fineTune); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = openai.fine_tuning.jobs.create(model: + :"gpt-4o-mini", training_file: "file-abc123") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123", + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + } + } + }, + "metadata": null + } + - title: W&B Integration + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini", + "integrations": [ + { + "type": "wandb", + "wandb": { + "project": "my-wandb-project", + "name": "ft-run-display-name" + "tags": [ + "first-experiment", "v2" + ] + } + } + ] + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = openai.fine_tuning.jobs.create(model: + :"gpt-4o-mini", training_file: "file-abc123") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123", + "integrations": [ + { + "type": "wandb", + "wandb": { + "project": "my-wandb-project", + "entity": None, + "run_id": "ftjob-abc123" + } + } + ], + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + } + } + }, + "metadata": null + } + get: + operationId: listPaginatedFineTuningJobs + tags: + - Fine-tuning + summary: | + List your organization's fine-tuning jobs + parameters: + - name: after + in: query + description: Identifier for the last job from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of fine-tuning jobs to retrieve. + required: false + schema: + type: integer + default: 20 + - in: query + name: metadata + required: false + schema: + type: object + nullable: true + 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. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListPaginatedFineTuningJobsResponse' + 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 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.jobs.list() + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.fineTuning.jobs.list(); + + for await (const fineTune of list) { + console.log(fineTune); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fineTuningJob of client.fineTuning.jobs.list()) { + console.log(fineTuningJob.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Jobs.List(context.TODO(), openai.FineTuningJobListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.JobListPage; + import com.openai.models.finetuning.jobs.JobListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobListPage page = client.fineTuning().jobs().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.fine_tuning.jobs.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "metadata": { + "key": "value" + } + }, + { ... }, + { ... } + ], "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}: + get: + operationId: retrieveFineTuningJob + tags: + - Fine-tuning + summary: | + Get info about a fine-tuning job. + + [Learn more about fine-tuning](/docs/guides/model-optimization) + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Retrieve fine-tuning job + group: fine-tuning + examples: + request: + curl: > + curl + https://api.openai.com/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.retrieve( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.retrieve("ftjob-abc123"); + + console.log(fineTune); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const fineTuningJob = await + client.fineTuning.jobs.retrieve('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Get(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = + openai.fine_tuning.jobs.retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "davinci-002", + "created_at": 1692661014, + "finished_at": 1692661190, + "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + "organization_id": "org-123", + "result_files": [ + "file-abc123" + ], + "status": "succeeded", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + }, + "trained_tokens": 5768, + "integrations": [], + "seed": 0, + "estimated_finish": 0, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + } + } + } + } + /fine_tuning/jobs/{fine_tuning_job_id}/cancel: + post: + operationId: cancelFineTuningJob + tags: + - Fine-tuning + summary: | + Immediately cancel a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to cancel. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Cancel fine-tuning + group: fine-tuning + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.cancel( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.cancel("ftjob-abc123"); + + console.log(fineTune); + } + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const fineTuningJob = await + client.fineTuning.jobs.cancel('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Cancel(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().cancel("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = + openai.fine_tuning.jobs.cancel("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "cancelled", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } + /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints: + get: + operationId: listFineTuningJobCheckpoints + tags: + - Fine-tuning + summary: | + List checkpoints for a fine-tuning job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to get checkpoints for. + - name: after + in: query + description: >- + Identifier for the last checkpoint ID from the previous pagination + request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of checkpoints to retrieve. + required: false + schema: + type: integer + default: 10 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFineTuningJobCheckpointsResponse' + x-oaiMeta: + name: List fine-tuning checkpoints + group: fine-tuning + examples: + request: + curl: > + curl + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/checkpoints + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const fineTuningJobCheckpoint of + client.fineTuning.jobs.checkpoints.list( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + )) { + console.log(fineTuningJobCheckpoint.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.jobs.checkpoints.list( + fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Jobs.Checkpoints.List(\n\t\tcontext.TODO(),\n\t\t\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n\t\topenai.FineTuningJobCheckpointListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.finetuning.jobs.checkpoints.CheckpointListPage; + + import + com.openai.models.finetuning.jobs.checkpoints.CheckpointListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CheckpointListPage page = client.fineTuning().jobs().checkpoints().list("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + page = + openai.fine_tuning.jobs.checkpoints.list("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:96olL566:ckpt-step-2000", + "metrics": { + "full_valid_loss": 0.134, + "full_valid_mean_token_accuracy": 0.874 + }, + "fine_tuning_job_id": "ftjob-abc123", + "step_number": 2000 + }, + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_enQCFmOTGj3syEpYVhBRLTSy", + "created_at": 1721764800, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:7q8mpxmy:ckpt-step-1000", + "metrics": { + "full_valid_loss": 0.167, + "full_valid_mean_token_accuracy": 0.781 + }, + "fine_tuning_job_id": "ftjob-abc123", + "step_number": 1000 + } + ], + "first_id": "ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "ftckpt_enQCFmOTGj3syEpYVhBRLTSy", + "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}/events: + get: + operationId: listFineTuningEvents + tags: + - Fine-tuning + summary: | + Get status updates for a fine-tuning job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to get events for. + - name: after + in: query + description: Identifier for the last event from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of events to retrieve. + required: false + schema: + type: integer + default: 20 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFineTuningJobEventsResponse' + x-oaiMeta: + name: List fine-tuning events + group: fine-tuning + examples: + request: + curl: > + curl + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/events \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.jobs.list_events( + fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.fineTuning.list_events(id="ftjob-abc123", limit=2); + + for await (const fineTune of list) { + console.log(fineTune); + } + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const fineTuningJobEvent of + client.fineTuning.jobs.listEvents( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + )) { + console.log(fineTuningJobEvent.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Jobs.ListEvents(\n\t\tcontext.TODO(),\n\t\t\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n\t\topenai.FineTuningJobListEventsParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.JobListEventsPage; + import com.openai.models.finetuning.jobs.JobListEventsParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobListEventsPage page = client.fineTuning().jobs().listEvents("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + page = + openai.fine_tuning.jobs.list_events("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job.event", + "id": "ft-event-ddTJfwuMVpfLXseO0Am0Gqjm", + "created_at": 1721764800, + "level": "info", + "message": "Fine tuning job successfully completed", + "data": null, + "type": "message" + }, + { + "object": "fine_tuning.job.event", + "id": "ft-event-tyiGuB72evQncpH87xe505Sv", + "created_at": 1721764800, + "level": "info", + "message": "New fine-tuned model created: ft:gpt-4o-mini:openai::7p4lURel", + "data": null, + "type": "message" + } + ], + "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}/pause: + post: + operationId: pauseFineTuningJob + tags: + - Fine-tuning + summary: | + Pause a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to pause. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Pause fine-tuning + group: fine-tuning + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/pause \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.pause( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.pause("ftjob-abc123"); + + console.log(fineTune); + } + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const fineTuningJob = await + client.fineTuning.jobs.pause('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Pause(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobPauseParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().pause("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = + openai.fine_tuning.jobs.pause("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "paused", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } + /fine_tuning/jobs/{fine_tuning_job_id}/resume: + post: + operationId: resumeFineTuningJob + tags: + - Fine-tuning + summary: | + Resume a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to resume. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Resume fine-tuning + group: fine-tuning + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/resume \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.resume( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.resume("ftjob-abc123"); + + console.log(fineTune); + } + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const fineTuningJob = await + client.fineTuning.jobs.resume('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Resume(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobResumeParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().resume("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = + openai.fine_tuning.jobs.resume("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } + /images/edits: + post: + operationId: createImageEdit + tags: + - Images + summary: >- + Creates an edited or extended image given one or more source images and + a prompt. This endpoint supports GPT Image models (`gpt-image-1.5`, + `gpt-image-1`, `gpt-image-1-mini`, and `chatgpt-image-latest`) and + `dall-e-2`. + description: > + You can call this endpoint with either: + + + - `multipart/form-data`: use binary uploads via `image` (and optional + `mask`). + + - `application/json`: use `images` (and optional `mask`) as references + with either `image_url` or `file_id`. + + + Note that JSON requests use `images` (array) instead of the multipart + `image` field. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateImageEditRequest' + examples: + multipart_edit: + summary: Multipart form upload (binary image + prompt) + value: + model: gpt-image-1.5 + prompt: Add a watercolor effect to this image + image: + size: 1024x1024 + quality: high + application/json: + schema: + $ref: '#/components/schemas/EditImageBodyJsonParam' + examples: + json_with_url: + summary: JSON request with image URL + value: + model: gpt-image-1.5 + prompt: Add a watercolor effect to this image + images: + - image_url: https://example.com/source-image.png + size: 1024x1024 + quality: high + json_with_file_id: + summary: JSON request with uploaded file id + value: + model: gpt-image-1.5 + prompt: Replace the background with a snowy mountain scene + images: + - file_id: file-abc123 + mask: + file_id: file-mask123 + output_format: png + output_compression: 100 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ImagesResponse' + text/event-stream: + schema: + $ref: '#/components/schemas/ImageEditStreamEvent' + x-oaiMeta: + name: Create image edit + group: images + examples: + - title: Edit image + request: + curl: | + curl -s -D >(grep -i x-request-id >&2) \ + -o >(jq -r '.data[0].b64_json' | base64 --decode > gift-basket.png) \ + -X POST "https://api.openai.com/v1/images/edits" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F "model=gpt-image-1.5" \ + -F "image[]=@body-lotion.png" \ + -F "image[]=@bath-bomb.png" \ + -F "image[]=@incense-kit.png" \ + -F "image[]=@soap.png" \ + -F 'prompt=Create a lovely gift basket with these four items in it' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for image in client.images.edit( + image=b"Example data", + prompt="A cute baby sea otter wearing a beret", + ): + print(image) + javascript: | + import fs from "fs"; + import OpenAI, { toFile } from "openai"; + + const client = new OpenAI(); + + const imageFiles = [ + "bath-bomb.png", + "body-lotion.png", + "incense-kit.png", + "soap.png", + ]; + + const images = await Promise.all( + imageFiles.map(async (file) => + await toFile(fs.createReadStream(file), null, { + type: "image/png", + }) + ), + ); + + const rsp = await client.images.edit({ + model: "gpt-image-1.5", + image: images, + prompt: "Create a lovely gift basket with these four items in it", + }); + + // Save the image to a file + const image_base64 = rsp.data[0].b64_json; + const image_bytes = Buffer.from(image_base64, "base64"); + fs.writeFileSync("basket.png", image_bytes); + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const imagesResponse = await client.images.edit({ + image: fs.createReadStream('path/to/file'), + prompt: 'A cute baby sea otter wearing a beret', + }); + + console.log(imagesResponse); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\timagesResponse, err := client.Images.Edit(context.TODO(), openai.ImageEditParams{\n\t\tImage: openai.ImageEditParamsImageUnion{\n\t\t\tOfFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\t},\n\t\tPrompt: \"A cute baby sea otter wearing a beret\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", imagesResponse)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.images.ImageEditParams; + import com.openai.models.images.ImagesResponse; + import java.io.ByteArrayInputStream; + import java.io.InputStream; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ImageEditParams params = ImageEditParams.builder() + .image(new ByteArrayInputStream("Example data".getBytes())) + .prompt("A cute baby sea otter wearing a beret") + .build(); + ImagesResponse imagesResponse = client.images().edit(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + images_response = openai.images.edit(image: + StringIO.new("Example data"), prompt: "A cute baby sea otter + wearing a beret") + + + puts(images_response) + - title: Streaming + request: + curl: | + curl -s -N -X POST "https://api.openai.com/v1/images/edits" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F "model=gpt-image-1.5" \ + -F "image[]=@body-lotion.png" \ + -F "image[]=@bath-bomb.png" \ + -F "image[]=@incense-kit.png" \ + -F "image[]=@soap.png" \ + -F 'prompt=Create a lovely gift basket with these four items in it' \ + -F "stream=true" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for image in client.images.edit( + image=b"Example data", + prompt="A cute baby sea otter wearing a beret", + ): + print(image) + javascript: | + import fs from "fs"; + import OpenAI, { toFile } from "openai"; + + const client = new OpenAI(); + + const imageFiles = [ + "bath-bomb.png", + "body-lotion.png", + "incense-kit.png", + "soap.png", + ]; + + const images = await Promise.all( + imageFiles.map(async (file) => + await toFile(fs.createReadStream(file), null, { + type: "image/png", + }) + ), + ); + + const stream = await client.images.edit({ + model: "gpt-image-1.5", + image: images, + prompt: "Create a lovely gift basket with these four items in it", + stream: true, + }); + + for await (const event of stream) { + console.log(event); + } + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const imagesResponse = await client.images.edit({ + image: fs.createReadStream('path/to/file'), + prompt: 'A cute baby sea otter wearing a beret', + }); + + console.log(imagesResponse); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\timagesResponse, err := client.Images.Edit(context.TODO(), openai.ImageEditParams{\n\t\tImage: openai.ImageEditParamsImageUnion{\n\t\t\tOfFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\t},\n\t\tPrompt: \"A cute baby sea otter wearing a beret\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", imagesResponse)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.images.ImageEditParams; + import com.openai.models.images.ImagesResponse; + import java.io.ByteArrayInputStream; + import java.io.InputStream; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ImageEditParams params = ImageEditParams.builder() + .image(new ByteArrayInputStream("Example data".getBytes())) + .prompt("A cute baby sea otter wearing a beret") + .build(); + ImagesResponse imagesResponse = client.images().edit(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + images_response = openai.images.edit(image: + StringIO.new("Example data"), prompt: "A cute baby sea otter + wearing a beret") + + + puts(images_response) + response: > + event: image_edit.partial_image + + data: + {"type":"image_edit.partial_image","b64_json":"...","partial_image_index":0} + + + event: image_edit.completed + + data: + {"type":"image_edit.completed","b64_json":"...","usage":{"total_tokens":100,"input_tokens":50,"output_tokens":50,"input_tokens_details":{"text_tokens":10,"image_tokens":40}}} + /images/generations: + post: + operationId: createImage + tags: + - Images + summary: | + Creates an image given a prompt. [Learn more](/docs/guides/images). + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateImageRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ImagesResponse' + text/event-stream: + schema: + $ref: '#/components/schemas/ImageGenStreamEvent' + x-oaiMeta: + name: Create image + group: images + examples: + - title: Generate image + request: + curl: | + curl https://api.openai.com/v1/images/generations \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-image-1.5", + "prompt": "A cute baby sea otter", + "n": 1, + "size": "1024x1024" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for image in client.images.generate( + prompt="A cute baby sea otter", + ): + print(image) + javascript: | + import OpenAI from "openai"; + import { writeFile } from "fs/promises"; + + const client = new OpenAI(); + + const img = await client.images.generate({ + model: "gpt-image-1.5", + prompt: "A cute baby sea otter", + n: 1, + size: "1024x1024" + }); + + const imageBuffer = Buffer.from(img.data[0].b64_json, "base64"); + await writeFile("output.png", imageBuffer); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const imagesResponse = await client.images.generate({ prompt: 'A + cute baby sea otter' }); + + + console.log(imagesResponse); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\timagesResponse, err := client.Images.Generate(context.TODO(), openai.ImageGenerateParams{\n\t\tPrompt: \"A cute baby sea otter\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", imagesResponse)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.images.ImageGenerateParams; + import com.openai.models.images.ImagesResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ImageGenerateParams params = ImageGenerateParams.builder() + .prompt("A cute baby sea otter") + .build(); + ImagesResponse imagesResponse = client.images().generate(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + images_response = openai.images.generate(prompt: "A cute baby + sea otter") + + + puts(images_response) + response: | + { + "created": 1713833628, + "data": [ + { + "b64_json": "..." + } + ], + "usage": { + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 + } + } + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/images/generations \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-image-1.5", + "prompt": "A cute baby sea otter", + "n": 1, + "size": "1024x1024", + "stream": true + }' \ + --no-buffer + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for image in client.images.generate( + prompt="A cute baby sea otter", + ): + print(image) + javascript: | + import OpenAI from "openai"; + + const client = new OpenAI(); + + const stream = await client.images.generate({ + model: "gpt-image-1.5", + prompt: "A cute baby sea otter", + n: 1, + size: "1024x1024", + stream: true, + }); + + for await (const event of stream) { + console.log(event); + } + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const imagesResponse = await client.images.generate({ prompt: 'A + cute baby sea otter' }); + + + console.log(imagesResponse); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\timagesResponse, err := client.Images.Generate(context.TODO(), openai.ImageGenerateParams{\n\t\tPrompt: \"A cute baby sea otter\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", imagesResponse)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.images.ImageGenerateParams; + import com.openai.models.images.ImagesResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ImageGenerateParams params = ImageGenerateParams.builder() + .prompt("A cute baby sea otter") + .build(); + ImagesResponse imagesResponse = client.images().generate(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + images_response = openai.images.generate(prompt: "A cute baby + sea otter") + + + puts(images_response) + response: > + event: image_generation.partial_image + + data: + {"type":"image_generation.partial_image","b64_json":"...","partial_image_index":0} + + + event: image_generation.completed + + data: + {"type":"image_generation.completed","b64_json":"...","usage":{"total_tokens":100,"input_tokens":50,"output_tokens":50,"input_tokens_details":{"text_tokens":10,"image_tokens":40}}} + /images/variations: + post: + operationId: createImageVariation + tags: + - Images + summary: >- + Creates a variation of a given image. This endpoint only supports + `dall-e-2`. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateImageVariationRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ImagesResponse' + x-oaiMeta: + name: Create image variation + group: images + examples: + request: + curl: | + curl https://api.openai.com/v1/images/variations \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F image="@otter.png" \ + -F n=2 \ + -F size="1024x1024" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + images_response = client.images.create_variation( + image=b"Example data", + ) + print(images_response.created) + javascript: |- + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const image = await openai.images.createVariation({ + image: fs.createReadStream("otter.png"), + }); + + console.log(image.data); + } + main(); + csharp: > + using System; + + + using OpenAI.Images; + + + ImageClient client = new( + model: "dall-e-2", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + GeneratedImage image = + client.GenerateImageVariation(imageFilePath: "otter.png"); + + + Console.WriteLine(image.ImageUri); + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const imagesResponse = await client.images.createVariation({ + image: fs.createReadStream('otter.png'), + }); + + console.log(imagesResponse.created); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\timagesResponse, err := client.Images.NewVariation(context.TODO(), openai.ImageNewVariationParams{\n\t\tImage: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", imagesResponse.Created)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.images.ImageCreateVariationParams; + import com.openai.models.images.ImagesResponse; + import java.io.ByteArrayInputStream; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ImageCreateVariationParams params = ImageCreateVariationParams.builder() + .image(new ByteArrayInputStream("Example data".getBytes())) + .build(); + ImagesResponse imagesResponse = client.images().createVariation(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + images_response = openai.images.create_variation(image: + StringIO.new("Example data")) + + + puts(images_response) + response: | + { + "created": 1589478378, + "data": [ + { + "url": "https://..." + }, + { + "url": "https://..." + } + ] + } + /models: + get: + operationId: listModels + tags: + - Models + summary: >- + Lists the currently available models, and provides basic information + about each one such as the owner and availability. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListModelsResponse' + x-oaiMeta: + name: List models + group: models + examples: + request: + curl: | + curl https://api.openai.com/v1/models \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.models.list() + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.models.list(); + + for await (const model of list) { + console.log(model); + } + } + main(); + csharp: | + using System; + + using OpenAI.Models; + + OpenAIModelClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + foreach (var model in client.GetModels().Value) + { + Console.WriteLine(model.Id); + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const model of client.models.list()) { + console.log(model.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Models.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.models.ModelListPage; + import com.openai.models.models.ModelListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ModelListPage page = client.models().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.models.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "model-id-0", + "object": "model", + "created": 1686935002, + "owned_by": "organization-owner" + }, + { + "id": "model-id-1", + "object": "model", + "created": 1686935002, + "owned_by": "organization-owner", + }, + { + "id": "model-id-2", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + }, + ] + } + /models/{model}: + get: + operationId: retrieveModel + tags: + - Models + summary: >- + Retrieves a model instance, providing basic information about the model + such as the owner and permissioning. + parameters: + - in: path + name: model + required: true + schema: + type: string + example: gpt-4o-mini + description: The ID of the model to use for this request + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Model' + x-oaiMeta: + name: Retrieve model + group: models + examples: + request: + curl: | + curl https://api.openai.com/v1/models/VAR_chat_model_id \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + model = client.models.retrieve( + "gpt-4o-mini", + ) + print(model.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const model = await openai.models.retrieve("VAR_chat_model_id"); + + console.log(model); + } + + main(); + csharp: | + using System; + using System.ClientModel; + + using OpenAI.Models; + + OpenAIModelClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ClientResult model = client.GetModel("babbage-002"); + Console.WriteLine(model.Value.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const model = await client.models.retrieve('gpt-4o-mini'); + + console.log(model.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmodel, err := client.Models.Get(context.TODO(), \"gpt-4o-mini\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", model.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.models.Model; + import com.openai.models.models.ModelRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Model model = client.models().retrieve("gpt-4o-mini"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + model = openai.models.retrieve("gpt-4o-mini") + + puts(model) + response: | + { + "id": "VAR_chat_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + } + delete: + operationId: deleteModel + tags: + - Models + summary: >- + Delete a fine-tuned model. You must have the Owner role in your + organization to delete a model. + parameters: + - in: path + name: model + required: true + schema: + type: string + example: ft:gpt-4o-mini:acemeco:suffix:abc123 + description: The model to delete + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteModelResponse' + 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 + \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + model_deleted = client.models.delete( + "ft:gpt-4o-mini:acemeco:suffix:abc123", + ) + print(model_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const model = await openai.models.delete("ft:gpt-4o-mini:acemeco:suffix:abc123"); + + console.log(model); + } + main(); + csharp: > + using System; + + using System.ClientModel; + + + using OpenAI.Models; + + + OpenAIModelClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + ClientResult success = + client.DeleteModel("ft:gpt-4o-mini:acemeco:suffix:abc123"); + + Console.WriteLine(success); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const modelDeleted = await + client.models.delete('ft:gpt-4o-mini:acemeco:suffix:abc123'); + + + console.log(modelDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmodelDeleted, err := client.Models.Delete(context.TODO(), \"ft:gpt-4o-mini:acemeco:suffix:abc123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", modelDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.models.ModelDeleteParams; + import com.openai.models.models.ModelDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ModelDeleted modelDeleted = client.models().delete("ft:gpt-4o-mini:acemeco:suffix:abc123"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + model_deleted = + openai.models.delete("ft:gpt-4o-mini:acemeco:suffix:abc123") + + + puts(model_deleted) + response: | + { + "id": "ft:gpt-4o-mini:acemeco:suffix:abc123", + "object": "model", + "deleted": true + } + /moderations: + post: + operationId: createModeration + tags: + - Moderations + summary: | + Classifies if text and/or image inputs are potentially harmful. Learn + more in the [moderation guide](/docs/guides/moderation). + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateModerationRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CreateModerationResponse' + x-oaiMeta: + name: Create moderation + group: moderations + examples: + - title: Single string + request: + curl: | + curl https://api.openai.com/v1/moderations \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "input": "I want to kill them." + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + moderation = client.moderations.create( + input="I want to kill them.", + ) + print(moderation.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const moderation = await openai.moderations.create({ input: "I want to kill them." }); + + console.log(moderation); + } + main(); + csharp: > + using System; + + using System.ClientModel; + + + using OpenAI.Moderations; + + + ModerationClient client = new( + model: "omni-moderation-latest", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + ClientResult moderation = + client.ClassifyText("I want to kill them."); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const moderation = await client.moderations.create({ input: 'I + want to kill them.' }); + + + console.log(moderation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmoderation, err := client.Moderations.New(context.TODO(), openai.ModerationNewParams{\n\t\tInput: openai.ModerationNewParamsInputUnion{\n\t\t\tOfString: openai.String(\"I want to kill them.\"),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", moderation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.moderations.ModerationCreateParams; + import com.openai.models.moderations.ModerationCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ModerationCreateParams params = ModerationCreateParams.builder() + .input("I want to kill them.") + .build(); + ModerationCreateResponse moderation = client.moderations().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + moderation = openai.moderations.create(input: "I want to kill + them.") + + + puts(moderation) + response: | + { + "id": "modr-AB8CjOTu2jiq12hp1AQPfeqFWaORR", + "model": "text-moderation-007", + "results": [ + { + "flagged": true, + "categories": { + "sexual": false, + "hate": false, + "harassment": true, + "self-harm": false, + "sexual/minors": false, + "hate/threatening": false, + "violence/graphic": false, + "self-harm/intent": false, + "self-harm/instructions": false, + "harassment/threatening": true, + "violence": true + }, + "category_scores": { + "sexual": 0.000011726012417057063, + "hate": 0.22706663608551025, + "harassment": 0.5215635299682617, + "self-harm": 2.227119921371923e-6, + "sexual/minors": 7.107352217872176e-8, + "hate/threatening": 0.023547329008579254, + "violence/graphic": 0.00003391829886822961, + "self-harm/intent": 1.646940972932498e-6, + "self-harm/instructions": 1.1198755256458526e-9, + "harassment/threatening": 0.5694745779037476, + "violence": 0.9971134662628174 + } + } + ] + } + - title: Image and text + request: + curl: | + curl https://api.openai.com/v1/moderations \ + -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "omni-moderation-latest", + "input": [ + { "type": "text", "text": "...text to classify goes here..." }, + { + "type": "image_url", + "image_url": { + "url": "https://example.com/image.png" + } + } + ] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + moderation = client.moderations.create( + input="I want to kill them.", + ) + print(moderation.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + const moderation = await openai.moderations.create({ + model: "omni-moderation-latest", + input: [ + { type: "text", text: "...text to classify goes here..." }, + { + type: "image_url", + image_url: { + url: "https://example.com/image.png" + // can also use base64 encoded image URLs + // url: "data:image/jpeg;base64,abcdefg..." + } + } + ], + }); + + console.log(moderation); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const moderation = await client.moderations.create({ input: 'I + want to kill them.' }); + + + console.log(moderation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmoderation, err := client.Moderations.New(context.TODO(), openai.ModerationNewParams{\n\t\tInput: openai.ModerationNewParamsInputUnion{\n\t\t\tOfString: openai.String(\"I want to kill them.\"),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", moderation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.moderations.ModerationCreateParams; + import com.openai.models.moderations.ModerationCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ModerationCreateParams params = ModerationCreateParams.builder() + .input("I want to kill them.") + .build(); + ModerationCreateResponse moderation = client.moderations().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + moderation = openai.moderations.create(input: "I want to kill + them.") + + + puts(moderation) + response: | + { + "id": "modr-0d9740456c391e43c445bf0f010940c7", + "model": "omni-moderation-latest", + "results": [ + { + "flagged": true, + "categories": { + "harassment": true, + "harassment/threatening": true, + "sexual": false, + "hate": false, + "hate/threatening": false, + "illicit": false, + "illicit/violent": false, + "self-harm/intent": false, + "self-harm/instructions": false, + "self-harm": false, + "sexual/minors": false, + "violence": true, + "violence/graphic": true + }, + "category_scores": { + "harassment": 0.8189693396524255, + "harassment/threatening": 0.804985420696006, + "sexual": 1.573112165348997e-6, + "hate": 0.007562942636942845, + "hate/threatening": 0.004208854591835476, + "illicit": 0.030535955153511665, + "illicit/violent": 0.008925306722380033, + "self-harm/intent": 0.00023023930975076432, + "self-harm/instructions": 0.0002293869201073356, + "self-harm": 0.012598046106750154, + "sexual/minors": 2.212566909570261e-8, + "violence": 0.9999992735124786, + "violence/graphic": 0.843064871157054 + }, + "category_applied_input_types": { + "harassment": [ + "text" + ], + "harassment/threatening": [ + "text" + ], + "sexual": [ + "text", + "image" + ], + "hate": [ + "text" + ], + "hate/threatening": [ + "text" + ], + "illicit": [ + "text" + ], + "illicit/violent": [ + "text" + ], + "self-harm/intent": [ + "text", + "image" + ], + "self-harm/instructions": [ + "text", + "image" + ], + "self-harm": [ + "text", + "image" + ], + "sexual/minors": [ + "text" + ], + "violence": [ + "text", + "image" + ], + "violence/graphic": [ + "text", + "image" + ] + } + } + ] + } + /organization/admin_api_keys: + get: + security: + - AdminApiKeyAuth: [] + summary: 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 + description: >- + Return keys with IDs that come after this ID in the pagination + order. + - in: query + name: order + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + description: Order results by creation time, ascending or descending. + - in: query + name: limit + required: false + schema: + type: integer + default: 20 + description: Maximum number of keys to return. + responses: + '200': + description: A list of organization API keys. + content: + application/json: + schema: + $ref: '#/components/schemas/ApiKeyList' + x-oaiMeta: + name: List all organization and project API keys. + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/admin_api_keys?after=key_abc&limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const adminAPIKey of + client.admin.organization.adminAPIKeys.list()) { + console.log(adminAPIKey.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.admin_api_keys.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.AdminAPIKeys.List(context.TODO(), openai.AdminOrganizationAdminAPIKeyListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.adminapikeys.AdminApiKeyListPage; + + import + com.openai.models.admin.organization.adminapikeys.AdminApiKeyListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AdminApiKeyListPage page = client.admin().organization().adminApiKeys().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.admin_api_keys.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "organization.admin_api_key", + "id": "key_abc", + "name": "Main Admin Key", + "redacted_value": "sk-admin...def", + "created_at": 1711471533, + "last_used_at": 1711471534, + "owner": { + "type": "service_account", + "object": "organization.service_account", + "id": "sa_456", + "name": "My Service Account", + "created_at": 1711471533, + "role": "member" + } + } + ], + "first_id": "key_abc", + "last_id": "key_abc", + "has_more": false + } + post: + security: + - AdminApiKeyAuth: [] + summary: 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: + application/json: + schema: + type: object + required: + - name + properties: + name: + type: string + example: New Admin Key + responses: + '200': + description: The newly created admin API key. + content: + application/json: + schema: + $ref: '#/components/schemas/AdminApiKeyCreateResponse' + x-oaiMeta: + name: Create admin API key + group: administration + examples: + request: + curl: > + curl -X POST https://api.openai.com/v1/organization/admin_api_keys + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "New Admin Key" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const adminAPIKey = await + client.admin.organization.adminAPIKeys.create({ name: 'New Admin + Key' }); + + + console.log(adminAPIKey); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + admin_api_key = client.admin.organization.admin_api_keys.create( + name="New Admin Key", + ) + print(admin_api_key) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tadminAPIKey, err := client.Admin.Organization.AdminAPIKeys.New(context.TODO(), openai.AdminOrganizationAdminAPIKeyNewParams{\n\t\tName: \"New Admin Key\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", adminAPIKey)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.adminapikeys.AdminApiKeyCreateParams; + + import + com.openai.models.admin.organization.adminapikeys.AdminApiKeyCreateResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AdminApiKeyCreateParams params = AdminApiKeyCreateParams.builder() + .name("New Admin Key") + .build(); + AdminApiKeyCreateResponse adminApiKey = client.admin().organization().adminApiKeys().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + admin_api_key = + openai.admin.organization.admin_api_keys.create(name: "New Admin + Key") + + + puts(admin_api_key) + response: | + { + "object": "organization.admin_api_key", + "id": "key_xyz", + "name": "New Admin Key", + "redacted_value": "sk-admin...xyz", + "created_at": 1711471533, + "last_used_at": 1711471534, + "owner": { + "type": "user", + "object": "organization.user", + "id": "user_123", + "name": "John Doe", + "created_at": 1711471533, + "role": "owner" + }, + "value": "sk-admin-1234abcd" + } + /organization/admin_api_keys/{key_id}: + get: + security: + - AdminApiKeyAuth: [] + summary: 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 + name: key_id + required: true + schema: + type: string + description: The ID of the API key. + responses: + '200': + description: Details of the requested API key. + content: + application/json: + schema: + $ref: '#/components/schemas/AdminApiKey' + x-oaiMeta: + name: Retrieve admin API key + group: administration + examples: + request: + curl: > + curl https://api.openai.com/v1/organization/admin_api_keys/key_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const adminAPIKey = await + client.admin.organization.adminAPIKeys.retrieve('key_id'); + + + console.log(adminAPIKey.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + admin_api_key = client.admin.organization.admin_api_keys.retrieve( + "key_id", + ) + print(admin_api_key.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tadminAPIKey, err := client.Admin.Organization.AdminAPIKeys.Get(context.TODO(), \"key_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", adminAPIKey.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.adminapikeys.AdminApiKey; + + import + com.openai.models.admin.organization.adminapikeys.AdminApiKeyRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AdminApiKey adminApiKey = client.admin().organization().adminApiKeys().retrieve("key_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + admin_api_key = + openai.admin.organization.admin_api_keys.retrieve("key_id") + + + puts(admin_api_key) + response: | + { + "object": "organization.admin_api_key", + "id": "key_abc", + "name": "Main Admin Key", + "redacted_value": "sk-admin...xyz", + "created_at": 1711471533, + "last_used_at": 1711471534, + "owner": { + "type": "user", + "object": "organization.user", + "id": "user_123", + "name": "John Doe", + "created_at": 1711471533, + "role": "owner" + } + } + delete: + security: + - AdminApiKeyAuth: [] + summary: Delete an organization admin API key + operationId: admin-api-keys-delete + description: Delete the specified admin API key. + parameters: + - in: path + name: key_id + required: true + schema: + type: string + description: The ID of the API key to be deleted. + responses: + '200': + description: Confirmation that the API key was deleted. + content: + application/json: + schema: + type: object + properties: + id: + type: string + example: key_abc + object: + type: string + enum: + - organization.admin_api_key.deleted + example: organization.admin_api_key.deleted + x-stainless-const: true + deleted: + type: boolean + example: true + required: + - id + - object + - deleted + x-oaiMeta: + name: Delete admin API key + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/admin_api_keys/key_abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const adminAPIKey = await + client.admin.organization.adminAPIKeys.delete('key_id'); + + + console.log(adminAPIKey.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + admin_api_key = client.admin.organization.admin_api_keys.delete( + "key_id", + ) + print(admin_api_key.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tadminAPIKey, err := client.Admin.Organization.AdminAPIKeys.Delete(context.TODO(), \"key_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", adminAPIKey.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.adminapikeys.AdminApiKeyDeleteParams; + + import + com.openai.models.admin.organization.adminapikeys.AdminApiKeyDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AdminApiKeyDeleteResponse adminApiKey = client.admin().organization().adminApiKeys().delete("key_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + admin_api_key = + openai.admin.organization.admin_api_keys.delete("key_id") + + + puts(admin_api_key) + response: | + { + "id": "key_abc", + "object": "organization.admin_api_key.deleted", + "deleted": true + } + /organization/audit_logs: + get: + security: + - AdminApiKeyAuth: [] + summary: List user actions and configuration changes within this organization. + operationId: list-audit-logs + tags: + - Audit Logs + parameters: + - name: effective_at + in: query + description: >- + Return only events whose `effective_at` (Unix seconds) is in this + range. + required: false + schema: + type: object + properties: + gt: + type: integer + description: >- + Return only events whose `effective_at` (Unix seconds) is + greater than this value. + gte: + type: integer + description: >- + Return only events whose `effective_at` (Unix seconds) is + greater than or equal to this value. + lt: + type: integer + description: >- + Return only events whose `effective_at` (Unix seconds) is less + than this value. + lte: + type: integer + description: >- + Return only events whose `effective_at` (Unix seconds) is less + than or equal to this value. + - name: project_ids[] + in: query + description: Return only events for these projects. + required: false + schema: + type: array + items: + type: string + - name: event_types[] + in: query + description: >- + Return only events with a `type` in one of these values. For + example, `project.created`. For all options, see the documentation + for the [audit log object](/docs/api-reference/audit-logs/object). + required: false + schema: + type: array + items: + $ref: '#/components/schemas/AuditLogEventType' + - name: actor_ids[] + in: query + description: >- + Return only events performed by these actors. Can be a user ID, a + service account ID, or an api key tracking ID. + required: false + schema: + type: array + items: + type: string + - name: actor_emails[] + in: query + description: Return only events performed by users with these emails. + required: false + schema: + type: array + items: + type: string + - name: resource_ids[] + in: query + description: >- + Return only events performed on these targets. For example, a + project ID updated. + required: false + schema: + type: array + items: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + responses: + '200': + description: Audit logs listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ListAuditLogsResponse' + x-oaiMeta: + name: List audit logs + group: audit-logs + examples: + request: + curl: | + curl https://api.openai.com/v1/organization/audit_logs \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const auditLogListResponse of + client.admin.organization.auditLogs.list()) { + console.log(auditLogListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.audit_logs.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.AuditLogs.List(context.TODO(), openai.AdminOrganizationAuditLogListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.auditlogs.AuditLogListPage; + + import + com.openai.models.admin.organization.auditlogs.AuditLogListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AuditLogListPage page = client.admin().organization().auditLogs().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.audit_logs.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "audit_log-xxx_yyyymmdd", + "type": "project.archived", + "effective_at": 1722461446, + "actor": { + "type": "api_key", + "api_key": { + "type": "user", + "user": { + "id": "user-xxx", + "email": "user@example.com" + } + } + }, + "project.archived": { + "id": "proj_abc" + }, + }, + { + "id": "audit_log-yyy__20240101", + "type": "api_key.updated", + "effective_at": 1720804190, + "actor": { + "type": "session", + "session": { + "user": { + "id": "user-xxx", + "email": "user@example.com" + }, + "ip_address": "127.0.0.1", + "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", + "ja3": "a497151ce4338a12c4418c44d375173e", + "ja4": "q13d0313h3_55b375c5d22e_c7319ce65786", + "ip_address_details": { + "country": "US", + "city": "San Francisco", + "region": "California", + "region_code": "CA", + "asn": "1234", + "latitude": "37.77490", + "longitude": "-122.41940" + } + } + }, + "api_key.updated": { + "id": "key_xxxx", + "data": { + "scopes": ["resource_2.operation_2"] + } + }, + } + ], + "first_id": "audit_log-xxx__20240101", + "last_id": "audit_log_yyy__20240101", + "has_more": true + } + /organization/certificates: + get: + security: + - AdminApiKeyAuth: [] + summary: List uploaded certificates for this organization. + operationId: listOrganizationCertificates + tags: + - Certificates + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + '200': + description: Certificates listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ListCertificatesResponse' + x-oaiMeta: + name: List organization certificates + group: administration + examples: + request: + curl: | + curl https://api.openai.com/v1/organization/certificates \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const certificateListResponse of + client.admin.organization.certificates.list()) { + console.log(certificateListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.certificates.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Certificates.List(context.TODO(), openai.AdminOrganizationCertificateListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.certificates.CertificateListPage; + + import + com.openai.models.admin.organization.certificates.CertificateListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateListPage page = client.admin().organization().certificates().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.certificates.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "organization.certificate", + "id": "cert_abc", + "name": "My Example Certificate", + "active": true, + "created_at": 1234567, + "certificate_details": { + "valid_at": 12345667, + "expires_at": 12345678 + } + }, + ], + "first_id": "cert_abc", + "last_id": "cert_abc", + "has_more": false + } + post: + security: + - AdminApiKeyAuth: [] + summary: > + Upload a certificate to the organization. This does **not** + automatically activate the certificate. + + + Organizations can upload up to 50 certificates. + operationId: uploadCertificate + tags: + - Certificates + requestBody: + description: The certificate upload payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UploadCertificateRequest' + responses: + '200': + description: Certificate uploaded successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Certificate' + x-oaiMeta: + name: Upload certificate + group: administration + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/organization/certificates \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "My Example Certificate", + "certificate": "-----BEGIN CERTIFICATE-----\\nMIIDeT...\\n-----END CERTIFICATE-----" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const certificate = await + client.admin.organization.certificates.create({ + certificate: 'certificate', + }); + + + console.log(certificate.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + certificate = client.admin.organization.certificates.create( + certificate="certificate", + ) + print(certificate.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tcertificate, err := client.Admin.Organization.Certificates.New(context.TODO(), openai.AdminOrganizationCertificateNewParams{\n\t\tCertificate: \"certificate\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", certificate.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.certificates.Certificate; + + import + com.openai.models.admin.organization.certificates.CertificateCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateCreateParams params = CertificateCreateParams.builder() + .certificate("certificate") + .build(); + Certificate certificate = client.admin().organization().certificates().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + certificate = + openai.admin.organization.certificates.create(certificate: + "certificate") + + + puts(certificate) + response: | + { + "object": "certificate", + "id": "cert_abc", + "name": "My Example Certificate", + "created_at": 1234567, + "certificate_details": { + "valid_at": 12345667, + "expires_at": 12345678 + } + } + /organization/certificates/activate: + post: + security: + - AdminApiKeyAuth: [] + summary: > + Activate certificates at the organization level. + + + You can atomically and idempotently activate up to 10 certificates at a + time. + operationId: activateOrganizationCertificates + tags: + - Certificates + requestBody: + description: The certificate activation payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ToggleCertificatesRequest' + responses: + '200': + description: Certificates activated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/OrganizationCertificateActivationResponse' + x-oaiMeta: + name: Activate certificates for organization + group: administration + examples: + request: + curl: > + curl https://api.openai.com/v1/organization/certificates/activate + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" \ + + -d '{ + "certificate_ids": ["cert_abc", "cert_def"] + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const certificateActivateResponse of + client.admin.organization.certificates.activate({ + certificate_ids: ['cert_abc'], + })) { + console.log(certificateActivateResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.certificates.activate( + certificate_ids=["cert_abc"], + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Certificates.Activate(context.TODO(), openai.AdminOrganizationCertificateActivateParams{\n\t\tCertificateIDs: []string{\"cert_abc\"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.certificates.CertificateActivatePage; + + import + com.openai.models.admin.organization.certificates.CertificateActivateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateActivateParams params = CertificateActivateParams.builder() + .addCertificateId("cert_abc") + .build(); + CertificateActivatePage page = client.admin().organization().certificates().activate(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + page = + openai.admin.organization.certificates.activate(certificate_ids: + ["cert_abc"]) + + + puts(page) + response: | + { + "object": "organization.certificate.activation", + "data": [ + { + "object": "organization.certificate", + "id": "cert_abc", + "name": "My Example Certificate", + "active": true, + "created_at": 1234567, + "certificate_details": { + "valid_at": 12345667, + "expires_at": 12345678 + } + }, + { + "object": "organization.certificate", + "id": "cert_def", + "name": "My Example Certificate 2", + "active": true, + "created_at": 1234567, + "certificate_details": { + "valid_at": 12345667, + "expires_at": 12345678 + } + }, + ], + } + /organization/certificates/deactivate: + post: + security: + - AdminApiKeyAuth: [] + summary: > + Deactivate certificates at the organization level. + + + You can atomically and idempotently deactivate up to 10 certificates at + a time. + operationId: deactivateOrganizationCertificates + tags: + - Certificates + requestBody: + description: The certificate deactivation payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ToggleCertificatesRequest' + responses: + '200': + description: Certificates deactivated successfully. + content: + application/json: + schema: + $ref: >- + #/components/schemas/OrganizationCertificateDeactivationResponse + x-oaiMeta: + name: Deactivate certificates for organization + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/certificates/deactivate \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" \ + + -d '{ + "certificate_ids": ["cert_abc", "cert_def"] + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const certificateDeactivateResponse of + client.admin.organization.certificates.deactivate( + { certificate_ids: ['cert_abc'] }, + )) { + console.log(certificateDeactivateResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.certificates.deactivate( + certificate_ids=["cert_abc"], + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Certificates.Deactivate(context.TODO(), openai.AdminOrganizationCertificateDeactivateParams{\n\t\tCertificateIDs: []string{\"cert_abc\"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.certificates.CertificateDeactivatePage; + + import + com.openai.models.admin.organization.certificates.CertificateDeactivateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateDeactivateParams params = CertificateDeactivateParams.builder() + .addCertificateId("cert_abc") + .build(); + CertificateDeactivatePage page = client.admin().organization().certificates().deactivate(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + page = + openai.admin.organization.certificates.deactivate(certificate_ids: + ["cert_abc"]) + + + puts(page) + response: | + { + "object": "organization.certificate.deactivation", + "data": [ + { + "object": "organization.certificate", + "id": "cert_abc", + "name": "My Example Certificate", + "active": false, + "created_at": 1234567, + "certificate_details": { + "valid_at": 12345667, + "expires_at": 12345678 + } + }, + { + "object": "organization.certificate", + "id": "cert_def", + "name": "My Example Certificate 2", + "active": false, + "created_at": 1234567, + "certificate_details": { + "valid_at": 12345667, + "expires_at": 12345678 + } + }, + ], + } + /organization/certificates/{certificate_id}: + get: + security: + - AdminApiKeyAuth: [] + summary: | + Get a certificate that has been uploaded to the organization. + + You can get a certificate regardless of whether it is active or not. + operationId: getCertificate + tags: + - Certificates + parameters: + - name: certificate_id + in: path + description: Unique ID of the certificate to retrieve. + required: true + schema: + type: string + - name: include + in: query + description: >- + A list of additional fields to include in the response. Currently + the only supported value is `content` to fetch the PEM content of + the certificate. + required: false + schema: + type: array + items: + type: string + enum: + - content + responses: + '200': + description: Certificate retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Certificate' + x-oaiMeta: + name: Get certificate + group: administration + examples: + request: + curl: > + curl + "https://api.openai.com/v1/organization/certificates/cert_abc?include[]=content" + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const certificate = await + client.admin.organization.certificates.retrieve('certificate_id'); + + + console.log(certificate.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + certificate = client.admin.organization.certificates.retrieve( + certificate_id="certificate_id", + ) + print(certificate.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tcertificate, err := client.Admin.Organization.Certificates.Get(\n\t\tcontext.TODO(),\n\t\t\"certificate_id\",\n\t\topenai.AdminOrganizationCertificateGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", certificate.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.certificates.Certificate; + + import + com.openai.models.admin.organization.certificates.CertificateRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Certificate certificate = client.admin().organization().certificates().retrieve("certificate_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + certificate = + openai.admin.organization.certificates.retrieve("certificate_id") + + + puts(certificate) + response: | + { + "object": "certificate", + "id": "cert_abc", + "name": "My Example Certificate", + "created_at": 1234567, + "certificate_details": { + "valid_at": 1234567, + "expires_at": 12345678, + "content": "-----BEGIN CERTIFICATE-----MIIDeT...-----END CERTIFICATE-----" + } + } + post: + security: + - AdminApiKeyAuth: [] + summary: | + Modify a certificate. Note that only the name can be modified. + operationId: modifyCertificate + tags: + - Certificates + parameters: + - name: certificate_id + in: path + description: Unique ID of the certificate to modify. + required: true + schema: + type: string + requestBody: + description: The certificate modification payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyCertificateRequest' + responses: + '200': + description: Certificate modified successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Certificate' + x-oaiMeta: + name: Modify certificate + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/certificates/cert_abc \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" \ + + -d '{ + "name": "Renamed Certificate" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const certificate = await + client.admin.organization.certificates.update('certificate_id'); + + + console.log(certificate.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + certificate = client.admin.organization.certificates.update( + certificate_id="certificate_id", + ) + print(certificate.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tcertificate, err := client.Admin.Organization.Certificates.Update(\n\t\tcontext.TODO(),\n\t\t\"certificate_id\",\n\t\topenai.AdminOrganizationCertificateUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", certificate.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.certificates.Certificate; + + import + com.openai.models.admin.organization.certificates.CertificateUpdateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Certificate certificate = client.admin().organization().certificates().update("certificate_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + certificate = + openai.admin.organization.certificates.update("certificate_id") + + + puts(certificate) + response: | + { + "object": "certificate", + "id": "cert_abc", + "name": "Renamed Certificate", + "created_at": 1234567, + "certificate_details": { + "valid_at": 12345667, + "expires_at": 12345678 + } + } + delete: + security: + - AdminApiKeyAuth: [] + summary: | + Delete a certificate from the organization. + + The certificate must be inactive for the organization and all projects. + operationId: deleteCertificate + tags: + - Certificates + parameters: + - name: certificate_id + in: path + description: Unique ID of the certificate to delete. + required: true + schema: + type: string + responses: + '200': + description: Certificate deleted successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteCertificateResponse' + x-oaiMeta: + name: Delete certificate + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/certificates/cert_abc \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const certificate = await + client.admin.organization.certificates.delete('certificate_id'); + + + console.log(certificate.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + certificate = client.admin.organization.certificates.delete( + "certificate_id", + ) + print(certificate.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tcertificate, err := client.Admin.Organization.Certificates.Delete(context.TODO(), \"certificate_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", certificate.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.certificates.CertificateDeleteParams; + + import + com.openai.models.admin.organization.certificates.CertificateDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateDeleteResponse certificate = client.admin().organization().certificates().delete("certificate_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + certificate = + openai.admin.organization.certificates.delete("certificate_id") + + + puts(certificate) + response: | + { + "object": "certificate.deleted", + "id": "cert_abc" + } + /organization/costs: + get: + security: + - AdminApiKeyAuth: [] + summary: Get costs details for the organization. + operationId: usage-costs + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: >- + Width of each time bucket in response. Currently only `1d` is + supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1d + default: 1d + - name: project_ids + in: query + description: Return only costs for these projects. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only costs for these API keys. + required: false + schema: + type: array + items: + type: string + - 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. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - line_item + - api_key_id + - name: limit + in: query + description: > + A limit on the number of buckets to be returned. Limit can range + between 1 and 180, and the default is 7. + required: false + schema: + type: integer + default: 7 + - name: page + in: query + description: >- + A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + '200': + description: Costs data retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UsageResponse' + x-oaiMeta: + name: Costs + group: usage-costs + examples: + request: + curl: > + curl + "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1" + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const response = await client.admin.organization.usage.costs({ + start_time: 0 }); + + + console.log(response.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + response = client.admin.organization.usage.costs( + start_time=0, + ) + print(response.data) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.Costs(context.TODO(), openai.AdminOrganizationUsageCostsParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.usage.UsageCostsParams; + + import + com.openai.models.admin.organization.usage.UsageCostsResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageCostsParams params = UsageCostsParams.builder() + .startTime(0L) + .build(); + UsageCostsResponse response = client.admin().organization().usage().costs(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + response = openai.admin.organization.usage.costs(start_time: 0) + + puts(response) + response: | + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "organization.costs.result", + "amount": { + "value": 0.06, + "currency": "usd" + }, + "line_item": null, + "project_id": null, + "api_key_id": null, + "quantity": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/groups: + get: + security: + - AdminApiKeyAuth: [] + summary: Lists all groups in the organization. + operationId: list-groups + tags: + - Groups + parameters: + - name: limit + in: query + description: > + A limit on the number of groups to be returned. Limit can range + between 0 and 1000, and the default is 100. + required: false + schema: + type: integer + minimum: 0 + maximum: 1000 + default: 100 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is a group ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with group_abc, your subsequent call can + include `after=group_abc` in order to fetch the next page of the + list. + required: false + schema: + type: string + - name: order + in: query + description: Specifies the sort order of the returned groups. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + responses: + '200': + description: Groups listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/GroupListResource' + x-oaiMeta: + name: List groups + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/groups?limit=20&order=asc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const group of client.admin.organization.groups.list()) + { + console.log(group.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.groups.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Groups.List(context.TODO(), openai.AdminOrganizationGroupListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.admin.organization.groups.GroupListPage; + + import + com.openai.models.admin.organization.groups.GroupListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupListPage page = client.admin().organization().groups().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.groups.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "group", + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "is_scim_managed": false + } + ], + "has_more": false, + "next": null + } + post: + security: + - AdminApiKeyAuth: [] + summary: Creates a new group in the organization. + operationId: create-group + tags: + - Groups + requestBody: + description: Parameters for the group you want to create. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateGroupBody' + responses: + '200': + description: Group created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/GroupResponse' + x-oaiMeta: + name: Create group + group: administration + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/organization/groups \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Support Team" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const group = await client.admin.organization.groups.create({ + name: 'x' }); + + + console.log(group.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + group = client.admin.organization.groups.create( + name="x", + ) + print(group.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tgroup, err := client.Admin.Organization.Groups.New(context.TODO(), openai.AdminOrganizationGroupNewParams{\n\t\tName: \"x\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", group.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.admin.organization.groups.Group; + + import + com.openai.models.admin.organization.groups.GroupCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupCreateParams params = GroupCreateParams.builder() + .name("x") + .build(); + Group group = client.admin().organization().groups().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + group = openai.admin.organization.groups.create(name: "x") + + puts(group) + response: | + { + "object": "group", + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "is_scim_managed": false + } + /organization/groups/{group_id}: + post: + security: + - AdminApiKeyAuth: [] + summary: Updates a group's information. + operationId: update-group + tags: + - Groups + parameters: + - name: group_id + in: path + description: The ID of the group to update. + required: true + schema: + type: string + requestBody: + description: New attributes to set on the group. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateGroupBody' + responses: + '200': + description: Group updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/GroupResourceWithSuccess' + x-oaiMeta: + name: Update group + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Escalations" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const group = await + client.admin.organization.groups.update('group_id', { name: 'x' + }); + + + console.log(group.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + group = client.admin.organization.groups.update( + group_id="group_id", + name="x", + ) + print(group.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tgroup, err := client.Admin.Organization.Groups.Update(\n\t\tcontext.TODO(),\n\t\t\"group_id\",\n\t\topenai.AdminOrganizationGroupUpdateParams{\n\t\t\tName: \"x\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", group.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.groups.GroupUpdateParams; + + import + com.openai.models.admin.organization.groups.GroupUpdateResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupUpdateParams params = GroupUpdateParams.builder() + .groupId("group_id") + .name("x") + .build(); + GroupUpdateResponse group = client.admin().organization().groups().update(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + group = openai.admin.organization.groups.update("group_id", name: + "x") + + + puts(group) + response: | + { + "id": "group_01J1F8ABCDXYZ", + "name": "Escalations", + "created_at": 1711471533, + "is_scim_managed": false + } + delete: + security: + - AdminApiKeyAuth: [] + summary: Deletes a group from the organization. + operationId: delete-group + tags: + - Groups + parameters: + - name: group_id + in: path + description: The ID of the group to delete. + required: true + schema: + type: string + responses: + '200': + description: Group deleted successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/GroupDeletedResource' + x-oaiMeta: + name: Delete group + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const group = await + client.admin.organization.groups.delete('group_id'); + + + console.log(group.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + group = client.admin.organization.groups.delete( + "group_id", + ) + print(group.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tgroup, err := client.Admin.Organization.Groups.Delete(context.TODO(), \"group_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", group.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.groups.GroupDeleteParams; + + import + com.openai.models.admin.organization.groups.GroupDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupDeleteResponse group = client.admin().organization().groups().delete("group_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + group = openai.admin.organization.groups.delete("group_id") + + puts(group) + response: | + { + "object": "group.deleted", + "id": "group_01J1F8ABCDXYZ", + "deleted": true + } + /organization/groups/{group_id}/roles: + get: + security: + - AdminApiKeyAuth: [] + summary: >- + Lists the organization roles assigned to a group within the + organization. + operationId: list-group-role-assignments + tags: + - Group organization role assignments + parameters: + - name: group_id + in: path + description: >- + The ID of the group whose organization role assignments you want to + list. + required: true + schema: + type: string + - name: limit + in: query + description: A limit on the number of organization role assignments to return. + required: false + schema: + type: integer + minimum: 0 + maximum: 1000 + - name: after + in: query + description: >- + Cursor for pagination. Provide the value from the previous + response's `next` field to continue listing organization roles. + required: false + schema: + type: string + - name: order + in: query + description: Sort order for the returned organization roles. + required: false + schema: + type: string + enum: + - asc + - desc + responses: + '200': + description: Group organization role assignments listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/RoleListResource' + x-oaiMeta: + name: List group organization role assignments + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/roles + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const roleListResponse of + client.admin.organization.groups.roles.list('group_id')) { + console.log(roleListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.groups.roles.list( + group_id="group_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Groups.Roles.List(\n\t\tcontext.TODO(),\n\t\t\"group_id\",\n\t\topenai.AdminOrganizationGroupRoleListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.groups.roles.RoleListPage; + + import + com.openai.models.admin.organization.groups.roles.RoleListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleListPage page = client.admin().organization().groups().roles().list("group_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.groups.roles.list("group_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false, + "description": "Allows managing organization groups", + "created_at": 1711471533, + "updated_at": 1711472599, + "created_by": "user_abc123", + "created_by_user_obj": { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + }, + "metadata": {} + } + ], + "has_more": false, + "next": null + } + post: + security: + - AdminApiKeyAuth: [] + summary: Assigns an organization role to a group within the organization. + operationId: assign-group-role + tags: + - Group organization role assignments + parameters: + - name: group_id + in: path + description: The ID of the group that should receive the organization role. + required: true + schema: + type: string + requestBody: + description: Identifies the organization role to assign to the group. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PublicAssignOrganizationGroupRoleBody' + responses: + '200': + description: Organization role assigned to the group successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/GroupRoleAssignment' + x-oaiMeta: + name: Assign organization role to group + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/roles + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "role_id": "role_01J1F8ROLE01" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.groups.roles.create('group_id', { + role_id: 'role_id', + }); + + + console.log(role.group); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.groups.roles.create( + group_id="group_id", + role_id="role_id", + ) + print(role.group) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Groups.Roles.New(\n\t\tcontext.TODO(),\n\t\t\"group_id\",\n\t\topenai.AdminOrganizationGroupRoleNewParams{\n\t\t\tRoleID: \"role_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.Group)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.groups.roles.RoleCreateParams; + + import + com.openai.models.admin.organization.groups.roles.RoleCreateResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleCreateParams params = RoleCreateParams.builder() + .groupId("group_id") + .roleId("role_id") + .build(); + RoleCreateResponse role = client.admin().organization().groups().roles().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + role = openai.admin.organization.groups.roles.create("group_id", + role_id: "role_id") + + + puts(role) + response: | + { + "object": "group.role", + "group": { + "object": "group", + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "scim_managed": false + }, + "role": { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + } + /organization/groups/{group_id}/roles/{role_id}: + delete: + security: + - AdminApiKeyAuth: [] + summary: Unassigns an organization role from a group within the organization. + operationId: unassign-group-role + tags: + - Group organization role assignments + parameters: + - name: group_id + in: path + description: The ID of the group to modify. + required: true + schema: + type: string + - name: role_id + in: path + description: The ID of the organization role to remove from the group. + required: true + schema: + type: string + responses: + '200': + description: Organization role unassigned from the group successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedRoleAssignmentResource' + x-oaiMeta: + name: Unassign organization role from group + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/roles/role_01J1F8ROLE01 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.groups.roles.delete('role_id', { + group_id: 'group_id', + }); + + + console.log(role.deleted); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.groups.roles.delete( + role_id="role_id", + group_id="group_id", + ) + print(role.deleted) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Groups.Roles.Delete(\n\t\tcontext.TODO(),\n\t\t\"group_id\",\n\t\t\"role_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.Deleted)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.groups.roles.RoleDeleteParams; + + import + com.openai.models.admin.organization.groups.roles.RoleDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleDeleteParams params = RoleDeleteParams.builder() + .groupId("group_id") + .roleId("role_id") + .build(); + RoleDeleteResponse role = client.admin().organization().groups().roles().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + role = openai.admin.organization.groups.roles.delete("role_id", + group_id: "group_id") + + + puts(role) + response: | + { + "object": "group.role.deleted", + "deleted": true + } + /organization/groups/{group_id}/users: + get: + security: + - AdminApiKeyAuth: [] + summary: Lists the users assigned to a group. + operationId: list-group-users + tags: + - Group users + parameters: + - name: group_id + in: path + description: The ID of the group to inspect. + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of users to be returned. Limit can range + between 0 and 1000, and the default is 100. + required: false + schema: + type: integer + minimum: 0 + maximum: 1000 + default: 100 + - name: after + in: query + description: > + A cursor for use in pagination. Provide the ID of the last user from + the previous list response to retrieve the next page. + required: false + schema: + type: string + - name: order + in: query + description: Specifies the sort order of users in the list. + required: false + schema: + type: string + enum: + - asc + - desc + default: desc + responses: + '200': + description: Group users listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UserListResource' + x-oaiMeta: + name: List group users + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/users?limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const organizationGroupUser of + client.admin.organization.groups.users.list('group_id')) { + console.log(organizationGroupUser.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.groups.users.list( + group_id="group_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Groups.Users.List(\n\t\tcontext.TODO(),\n\t\t\"group_id\",\n\t\topenai.AdminOrganizationGroupUserListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.groups.users.UserListPage; + + import + com.openai.models.admin.organization.groups.users.UserListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserListPage page = client.admin().organization().groups().users().list("group_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.groups.users.list("group_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + } + ], + "has_more": false, + "next": null + } + post: + security: + - AdminApiKeyAuth: [] + summary: Adds a user to a group. + operationId: add-group-user + tags: + - Group users + parameters: + - name: group_id + in: path + description: The ID of the group to update. + required: true + schema: + type: string + requestBody: + description: Identifies the user that should be added to the group. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateGroupUserBody' + responses: + '200': + description: User added to the group successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/GroupUserAssignment' + x-oaiMeta: + name: Add group user + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/users + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "user_id": "user_abc123" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const user = await + client.admin.organization.groups.users.create('group_id', { + user_id: 'user_id', + }); + + + console.log(user.group_id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + user = client.admin.organization.groups.users.create( + group_id="group_id", + user_id="user_id", + ) + print(user.group_id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tuser, err := client.Admin.Organization.Groups.Users.New(\n\t\tcontext.TODO(),\n\t\t\"group_id\",\n\t\topenai.AdminOrganizationGroupUserNewParams{\n\t\t\tUserID: \"user_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", user.GroupID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.groups.users.UserCreateParams; + + import + com.openai.models.admin.organization.groups.users.UserCreateResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserCreateParams params = UserCreateParams.builder() + .groupId("group_id") + .userId("user_id") + .build(); + UserCreateResponse user = client.admin().organization().groups().users().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + user = openai.admin.organization.groups.users.create("group_id", + user_id: "user_id") + + + puts(user) + response: | + { + "object": "group.user", + "user_id": "user_abc123", + "group_id": "group_01J1F8ABCDXYZ" + } + /organization/groups/{group_id}/users/{user_id}: + delete: + security: + - AdminApiKeyAuth: [] + summary: Removes a user from a group. + operationId: remove-group-user + tags: + - Group users + parameters: + - name: group_id + in: path + description: The ID of the group to update. + required: true + schema: + type: string + - name: user_id + in: path + description: The ID of the user to remove from the group. + required: true + schema: + type: string + responses: + '200': + description: User removed from the group successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/GroupUserDeletedResource' + x-oaiMeta: + name: Remove group user + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/users/user_abc123 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const user = await + client.admin.organization.groups.users.delete('user_id', { + group_id: 'group_id', + }); + + + console.log(user.deleted); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + user = client.admin.organization.groups.users.delete( + user_id="user_id", + group_id="group_id", + ) + print(user.deleted) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tuser, err := client.Admin.Organization.Groups.Users.Delete(\n\t\tcontext.TODO(),\n\t\t\"group_id\",\n\t\t\"user_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", user.Deleted)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.groups.users.UserDeleteParams; + + import + com.openai.models.admin.organization.groups.users.UserDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserDeleteParams params = UserDeleteParams.builder() + .groupId("group_id") + .userId("user_id") + .build(); + UserDeleteResponse user = client.admin().organization().groups().users().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + user = openai.admin.organization.groups.users.delete("user_id", + group_id: "group_id") + + + puts(user) + response: | + { + "object": "group.user.deleted", + "deleted": true + } + /organization/invites: + get: + security: + - AdminApiKeyAuth: [] + summary: Returns a list of invites in the organization. + operationId: list-invites + tags: + - Invites + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + responses: + '200': + description: Invites listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/InviteListResponse' + x-oaiMeta: + name: List invites + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/invites?after=invite-abc&limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const invite of + client.admin.organization.invites.list()) { + console.log(invite.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.invites.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Invites.List(context.TODO(), openai.AdminOrganizationInviteListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.invites.InviteListPage; + + import + com.openai.models.admin.organization.invites.InviteListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + InviteListPage page = client.admin().organization().invites().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.invites.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "organization.invite", + "id": "invite-abc", + "email": "user@example.com", + "role": "owner", + "status": "accepted", + "created_at": 1711471533, + "expires_at": 1711471533, + "accepted_at": 1711471533 + } + ], + "first_id": "invite-abc", + "last_id": "invite-abc", + "has_more": false + } + post: + security: + - 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. + operationId: inviteUser + tags: + - Invites + requestBody: + description: The invite request payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/InviteRequest' + responses: + '200': + description: User invited successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Invite' + x-oaiMeta: + name: Create invite + group: administration + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/organization/invites \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "email": "anotheruser@example.com", + "role": "reader", + "projects": [ + { + "id": "project-xyz", + "role": "member" + }, + { + "id": "project-abc", + "role": "owner" + } + ] + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const invite = await client.admin.organization.invites.create({ + email: 'email', role: 'reader' }); + + + console.log(invite.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + invite = client.admin.organization.invites.create( + email="email", + role="reader", + ) + print(invite.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tinvite, err := client.Admin.Organization.Invites.New(context.TODO(), openai.AdminOrganizationInviteNewParams{\n\t\tEmail: \"email\",\n\t\tRole: openai.AdminOrganizationInviteNewParamsRoleReader,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", invite.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.admin.organization.invites.Invite; + + import + com.openai.models.admin.organization.invites.InviteCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + InviteCreateParams params = InviteCreateParams.builder() + .email("email") + .role(InviteCreateParams.Role.READER) + .build(); + Invite invite = client.admin().organization().invites().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + invite = openai.admin.organization.invites.create(email: "email", + role: :reader) + + + puts(invite) + response: | + { + "object": "organization.invite", + "id": "invite-def", + "email": "anotheruser@example.com", + "role": "reader", + "status": "pending", + "created_at": 1711471533, + "expires_at": 1711471533, + "accepted_at": null, + "projects": [ + { + "id": "project-xyz", + "role": "member" + }, + { + "id": "project-abc", + "role": "owner" + } + ] + } + /organization/invites/{invite_id}: + get: + security: + - AdminApiKeyAuth: [] + summary: Retrieves an invite. + operationId: retrieve-invite + tags: + - Invites + parameters: + - in: path + name: invite_id + required: true + schema: + type: string + description: The ID of the invite to retrieve. + responses: + '200': + description: Invite retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Invite' + x-oaiMeta: + name: Retrieve invite + group: administration + examples: + request: + curl: | + curl https://api.openai.com/v1/organization/invites/invite-abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const invite = await + client.admin.organization.invites.retrieve('invite_id'); + + + console.log(invite.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + invite = client.admin.organization.invites.retrieve( + "invite_id", + ) + print(invite.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tinvite, err := client.Admin.Organization.Invites.Get(context.TODO(), \"invite_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", invite.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.admin.organization.invites.Invite; + + import + com.openai.models.admin.organization.invites.InviteRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Invite invite = client.admin().organization().invites().retrieve("invite_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + invite = openai.admin.organization.invites.retrieve("invite_id") + + puts(invite) + response: | + { + "object": "organization.invite", + "id": "invite-abc", + "email": "user@example.com", + "role": "owner", + "status": "accepted", + "created_at": 1711471533, + "expires_at": 1711471533, + "accepted_at": 1711471533 + } + delete: + security: + - AdminApiKeyAuth: [] + summary: >- + Delete an invite. If the invite has already been accepted, it cannot be + deleted. + operationId: delete-invite + tags: + - Invites + parameters: + - in: path + name: invite_id + required: true + schema: + type: string + description: The ID of the invite to delete. + responses: + '200': + description: Invite deleted successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/InviteDeleteResponse' + x-oaiMeta: + name: Delete invite + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/invites/invite-abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const invite = await + client.admin.organization.invites.delete('invite_id'); + + + console.log(invite.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + invite = client.admin.organization.invites.delete( + "invite_id", + ) + print(invite.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tinvite, err := client.Admin.Organization.Invites.Delete(context.TODO(), \"invite_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", invite.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.invites.InviteDeleteParams; + + import + com.openai.models.admin.organization.invites.InviteDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + InviteDeleteResponse invite = client.admin().organization().invites().delete("invite_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + invite = openai.admin.organization.invites.delete("invite_id") + + puts(invite) + response: | + { + "object": "organization.invite.deleted", + "id": "invite-abc", + "deleted": true + } + /organization/projects: + get: + summary: Returns a list of projects. + operationId: list-projects + security: + - AdminApiKeyAuth: [] + tags: + - Projects + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + - name: include_archived + in: query + schema: + type: boolean + default: false + description: >- + If `true` returns all projects including those that have been + `archived`. Archived projects are not included by default. + responses: + '200': + description: Projects listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectListResponse' + x-oaiMeta: + name: List projects + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects?after=proj_abc&limit=20&include_archived=false + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const project of + client.admin.organization.projects.list()) { + console.log(project.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.projects.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Projects.List(context.TODO(), openai.AdminOrganizationProjectListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.ProjectListPage; + + import + com.openai.models.admin.organization.projects.ProjectListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ProjectListPage page = client.admin().organization().projects().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.projects.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project example", + "created_at": 1711471533, + "archived_at": null, + "status": "active" + } + ], + "first_id": "proj-abc", + "last_id": "proj-xyz", + "has_more": false + } + post: + summary: >- + Create a new project in the organization. Projects can be created and + archived, but cannot be deleted. + operationId: create-project + security: + - AdminApiKeyAuth: [] + tags: + - Projects + requestBody: + description: The project create request payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectCreateRequest' + responses: + '200': + description: Project created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Project' + x-oaiMeta: + name: Create project + group: administration + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/organization/projects \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Project ABC" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const project = await client.admin.organization.projects.create({ + name: 'name' }); + + + console.log(project.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + project = client.admin.organization.projects.create( + name="name", + ) + print(project.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tproject, err := client.Admin.Organization.Projects.New(context.TODO(), openai.AdminOrganizationProjectNewParams{\n\t\tName: \"name\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", project.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.admin.organization.projects.Project; + + import + com.openai.models.admin.organization.projects.ProjectCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ProjectCreateParams params = ProjectCreateParams.builder() + .name("name") + .build(); + Project project = client.admin().organization().projects().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + project = openai.admin.organization.projects.create(name: "name") + + puts(project) + response: | + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project ABC", + "created_at": 1711471533, + "archived_at": null, + "status": "active" + } + /organization/projects/{project_id}: + get: + summary: Retrieves a project. + operationId: retrieve-project + security: + - AdminApiKeyAuth: [] + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + responses: + '200': + description: Project retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Project' + x-oaiMeta: + name: Retrieve project + group: administration + description: Retrieve a project. + examples: + request: + curl: | + curl https://api.openai.com/v1/organization/projects/proj_abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const project = await + client.admin.organization.projects.retrieve('project_id'); + + + console.log(project.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + project = client.admin.organization.projects.retrieve( + "project_id", + ) + print(project.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tproject, err := client.Admin.Organization.Projects.Get(context.TODO(), \"project_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", project.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.admin.organization.projects.Project; + + import + com.openai.models.admin.organization.projects.ProjectRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Project project = client.admin().organization().projects().retrieve("project_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + project = + openai.admin.organization.projects.retrieve("project_id") + + + puts(project) + response: | + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project example", + "created_at": 1711471533, + "archived_at": null, + "status": "active" + } + post: + summary: Modifies a project in the organization. + operationId: modify-project + security: + - AdminApiKeyAuth: [] + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + requestBody: + description: The project update request payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectUpdateRequest' + responses: + '200': + description: Project updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Project' + '400': + description: Error response when updating the default project. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + name: Modify project + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Project DEF" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const project = await + client.admin.organization.projects.update('project_id'); + + + console.log(project.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + project = client.admin.organization.projects.update( + project_id="project_id", + ) + print(project.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tproject, err := client.Admin.Organization.Projects.Update(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", project.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.admin.organization.projects.Project; + + import + com.openai.models.admin.organization.projects.ProjectUpdateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Project project = client.admin().organization().projects().update("project_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + project = openai.admin.organization.projects.update("project_id") + + puts(project) + response: '' + /organization/projects/{project_id}/api_keys: + get: + security: + - AdminApiKeyAuth: [] + summary: Returns a list of API keys in the project. + operationId: list-project-api-keys + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + responses: + '200': + description: Project API keys listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectApiKeyListResponse' + x-oaiMeta: + name: List project API keys + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const projectAPIKey of + client.admin.organization.projects.apiKeys.list('project_id')) { + console.log(projectAPIKey.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.projects.api_keys.list( + project_id="project_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Projects.APIKeys.List(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectAPIKeyListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.apikeys.ApiKeyListPage; + + import + com.openai.models.admin.organization.projects.apikeys.ApiKeyListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ApiKeyListPage page = client.admin().organization().projects().apiKeys().list("project_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + page = + openai.admin.organization.projects.api_keys.list("project_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "organization.project.api_key", + "redacted_value": "sk-abc...def", + "name": "My API Key", + "created_at": 1711471533, + "last_used_at": 1711471534, + "id": "key_abc", + "owner": { + "type": "user", + "user": { + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "created_at": 1711471533 + } + } + } + ], + "first_id": "key_abc", + "last_id": "key_xyz", + "has_more": false + } + /organization/projects/{project_id}/api_keys/{api_key_id}: + get: + security: + - AdminApiKeyAuth: [] + summary: Retrieves an API key in the project. + operationId: retrieve-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 + responses: + '200': + description: Project API key retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectApiKey' + x-oaiMeta: + name: Retrieve project API key + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const projectAPIKey = await + client.admin.organization.projects.apiKeys.retrieve('api_key_id', + { + project_id: 'project_id', + }); + + + console.log(projectAPIKey.id); + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + + project_api_key = + client.admin.organization.projects.api_keys.retrieve( + api_key_id="api_key_id", + project_id="project_id", + ) + + print(project_api_key.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tprojectAPIKey, err := client.Admin.Organization.Projects.APIKeys.Get(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"api_key_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", projectAPIKey.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.apikeys.ApiKeyRetrieveParams; + + import + com.openai.models.admin.organization.projects.apikeys.ProjectApiKey; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ApiKeyRetrieveParams params = ApiKeyRetrieveParams.builder() + .projectId("project_id") + .apiKeyId("api_key_id") + .build(); + ProjectApiKey projectApiKey = client.admin().organization().projects().apiKeys().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + project_api_key = + openai.admin.organization.projects.api_keys.retrieve("api_key_id", + project_id: "project_id") + + + puts(project_api_key) + response: | + { + "object": "organization.project.api_key", + "redacted_value": "sk-abc...def", + "name": "My API Key", + "created_at": 1711471533, + "last_used_at": 1711471534, + "id": "key_abc", + "owner": { + "type": "user", + "user": { + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "created_at": 1711471533 + } + } + } + delete: + security: + - AdminApiKeyAuth: [] + summary: > + Deletes an API key from the project. + + + Returns confirmation of the key deletion, or an error if the key + belonged to + + a service account. + operationId: delete-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 + responses: + '200': + description: Project API key deleted successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectApiKeyDeleteResponse' + '400': + description: Error response for various conditions. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + name: Delete project API key + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const apiKey = await + client.admin.organization.projects.apiKeys.delete('api_key_id', { + project_id: 'project_id', + }); + + + console.log(apiKey.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + api_key = client.admin.organization.projects.api_keys.delete( + api_key_id="api_key_id", + project_id="project_id", + ) + print(api_key.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tapiKey, err := client.Admin.Organization.Projects.APIKeys.Delete(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"api_key_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", apiKey.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.apikeys.ApiKeyDeleteParams; + + import + com.openai.models.admin.organization.projects.apikeys.ApiKeyDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ApiKeyDeleteParams params = ApiKeyDeleteParams.builder() + .projectId("project_id") + .apiKeyId("api_key_id") + .build(); + ApiKeyDeleteResponse apiKey = client.admin().organization().projects().apiKeys().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + api_key = + openai.admin.organization.projects.api_keys.delete("api_key_id", + project_id: "project_id") + + + puts(api_key) + response: | + { + "object": "organization.project.api_key.deleted", + "id": "key_abc", + "deleted": true + } + /organization/projects/{project_id}/archive: + post: + summary: >- + Archives a project in the organization. Archived projects cannot be used + or updated. + operationId: archive-project + security: + - AdminApiKeyAuth: [] + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + responses: + '200': + description: Project archived successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Project' + x-oaiMeta: + name: Archive project + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc/archive \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const project = await + client.admin.organization.projects.archive('project_id'); + + + console.log(project.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + project = client.admin.organization.projects.archive( + "project_id", + ) + print(project.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tproject, err := client.Admin.Organization.Projects.Archive(context.TODO(), \"project_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", project.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.admin.organization.projects.Project; + + import + com.openai.models.admin.organization.projects.ProjectArchiveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Project project = client.admin().organization().projects().archive("project_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + project = openai.admin.organization.projects.archive("project_id") + + puts(project) + response: | + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project DEF", + "created_at": 1711471533, + "archived_at": 1711471533, + "status": "archived" + } + /organization/projects/{project_id}/certificates: + get: + security: + - AdminApiKeyAuth: [] + summary: List certificates for this project. + operationId: listProjectCertificates + tags: + - Certificates + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + responses: + '200': + description: Certificates listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ListProjectCertificatesResponse' + x-oaiMeta: + name: List project certificates + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/certificates + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const certificateListResponse of + client.admin.organization.projects.certificates.list( + 'project_id', + )) { + console.log(certificateListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.projects.certificates.list( + project_id="project_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Projects.Certificates.List(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectCertificateListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.certificates.CertificateListPage; + + import + com.openai.models.admin.organization.projects.certificates.CertificateListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateListPage page = client.admin().organization().projects().certificates().list("project_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + page = + openai.admin.organization.projects.certificates.list("project_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "organization.project.certificate", + "id": "cert_abc", + "name": "My Example Certificate", + "active": true, + "created_at": 1234567, + "certificate_details": { + "valid_at": 12345667, + "expires_at": 12345678 + } + }, + ], + "first_id": "cert_abc", + "last_id": "cert_abc", + "has_more": false + } + /organization/projects/{project_id}/certificates/activate: + post: + security: + - AdminApiKeyAuth: [] + summary: > + Activate certificates at the project level. + + + You can atomically and idempotently activate up to 10 certificates at a + time. + operationId: activateProjectCertificates + tags: + - Certificates + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + requestBody: + description: The certificate activation payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ToggleCertificatesRequest' + responses: + '200': + description: Certificates activated successfully. + content: + application/json: + schema: + $ref: >- + #/components/schemas/OrganizationProjectCertificateActivationResponse + x-oaiMeta: + name: Activate certificates for project + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/certificates/activate + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" \ + + -d '{ + "certificate_ids": ["cert_abc", "cert_def"] + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const certificateActivateResponse of + client.admin.organization.projects.certificates.activate( + 'project_id', + { certificate_ids: ['cert_abc'] }, + )) { + console.log(certificateActivateResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.projects.certificates.activate( + project_id="project_id", + certificate_ids=["cert_abc"], + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Projects.Certificates.Activate(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectCertificateActivateParams{\n\t\t\tCertificateIDs: []string{\"cert_abc\"},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.certificates.CertificateActivatePage; + + import + com.openai.models.admin.organization.projects.certificates.CertificateActivateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateActivateParams params = CertificateActivateParams.builder() + .projectId("project_id") + .addCertificateId("cert_abc") + .build(); + CertificateActivatePage page = client.admin().organization().projects().certificates().activate(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + page = + openai.admin.organization.projects.certificates.activate("project_id", + certificate_ids: ["cert_abc"]) + + + puts(page) + response: | + { + "object": "organization.project.certificate.activation", + "data": [ + { + "object": "organization.project.certificate", + "id": "cert_abc", + "name": "My Example Certificate", + "active": true, + "created_at": 1234567, + "certificate_details": { + "valid_at": 12345667, + "expires_at": 12345678 + } + }, + { + "object": "organization.project.certificate", + "id": "cert_def", + "name": "My Example Certificate 2", + "active": true, + "created_at": 1234567, + "certificate_details": { + "valid_at": 12345667, + "expires_at": 12345678 + } + }, + ], + } + /organization/projects/{project_id}/certificates/deactivate: + post: + security: + - AdminApiKeyAuth: [] + summary: | + Deactivate certificates at the project level. You can atomically and + idempotently deactivate up to 10 certificates at a time. + operationId: deactivateProjectCertificates + tags: + - Certificates + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + requestBody: + description: The certificate deactivation payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ToggleCertificatesRequest' + responses: + '200': + description: Certificates deactivated successfully. + content: + application/json: + schema: + $ref: >- + #/components/schemas/OrganizationProjectCertificateDeactivationResponse + x-oaiMeta: + name: Deactivate certificates for project + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/certificates/deactivate + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" \ + + -d '{ + "certificate_ids": ["cert_abc", "cert_def"] + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const certificateDeactivateResponse of + client.admin.organization.projects.certificates.deactivate( + 'project_id', + { certificate_ids: ['cert_abc'] }, + )) { + console.log(certificateDeactivateResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.projects.certificates.deactivate( + project_id="project_id", + certificate_ids=["cert_abc"], + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Projects.Certificates.Deactivate(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectCertificateDeactivateParams{\n\t\t\tCertificateIDs: []string{\"cert_abc\"},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.certificates.CertificateDeactivatePage; + + import + com.openai.models.admin.organization.projects.certificates.CertificateDeactivateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CertificateDeactivateParams params = CertificateDeactivateParams.builder() + .projectId("project_id") + .addCertificateId("cert_abc") + .build(); + CertificateDeactivatePage page = client.admin().organization().projects().certificates().deactivate(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + page = + openai.admin.organization.projects.certificates.deactivate("project_id", + certificate_ids: ["cert_abc"]) + + + puts(page) + response: | + { + "object": "organization.project.certificate.deactivation", + "data": [ + { + "object": "organization.project.certificate", + "id": "cert_abc", + "name": "My Example Certificate", + "active": false, + "created_at": 1234567, + "certificate_details": { + "valid_at": 12345667, + "expires_at": 12345678 + } + }, + { + "object": "organization.project.certificate", + "id": "cert_def", + "name": "My Example Certificate 2", + "active": false, + "created_at": 1234567, + "certificate_details": { + "valid_at": 12345667, + "expires_at": 12345678 + } + }, + ], + } + /organization/projects/{project_id}/groups: + get: + security: + - AdminApiKeyAuth: [] + summary: Lists the groups that have access to a project. + operationId: list-project-groups + tags: + - Project groups + parameters: + - name: project_id + in: path + description: The ID of the project to inspect. + required: true + schema: + type: string + - name: limit + in: query + description: A limit on the number of project groups to return. Defaults to 20. + required: false + schema: + type: integer + minimum: 0 + maximum: 100 + default: 20 + - name: after + in: query + description: >- + Cursor for pagination. Provide the ID of the last group from the + previous response to fetch the next page. + required: false + schema: + type: string + - name: order + in: query + description: Sort order for the returned groups. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + responses: + '200': + description: Project groups listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectGroupListResource' + x-oaiMeta: + name: List project groups + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc123/groups?limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const projectGroup of + client.admin.organization.projects.groups.list('project_id')) { + console.log(projectGroup.group_id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.projects.groups.list( + project_id="project_id", + ) + page = page.data[0] + print(page.group_id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Projects.Groups.List(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectGroupListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.groups.GroupListPage; + + import + com.openai.models.admin.organization.projects.groups.GroupListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupListPage page = client.admin().organization().projects().groups().list("project_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + page = + openai.admin.organization.projects.groups.list("project_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "project.group", + "project_id": "proj_abc123", + "group_id": "group_01J1F8ABCDXYZ", + "group_name": "Support Team", + "created_at": 1711471533 + } + ], + "has_more": false, + "next": null + } + post: + security: + - AdminApiKeyAuth: [] + summary: Grants a group access to a project. + operationId: add-project-group + tags: + - Project groups + parameters: + - name: project_id + in: path + description: The ID of the project to update. + required: true + schema: + type: string + requestBody: + description: Identifies the group and role to assign to the project. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/InviteProjectGroupBody' + responses: + '200': + description: Group granted access to the project successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectGroup' + x-oaiMeta: + name: Add project group + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc123/groups + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "group_id": "group_01J1F8ABCDXYZ", + "role": "role_01J1F8PROJ" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const projectGroup = await + client.admin.organization.projects.groups.create('project_id', { + group_id: 'group_id', + role: 'role', + }); + + + console.log(projectGroup.group_id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + project_group = client.admin.organization.projects.groups.create( + project_id="project_id", + group_id="group_id", + role="role", + ) + print(project_group.group_id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tprojectGroup, err := client.Admin.Organization.Projects.Groups.New(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectGroupNewParams{\n\t\t\tGroupID: \"group_id\",\n\t\t\tRole: \"role\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", projectGroup.GroupID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.groups.GroupCreateParams; + + import + com.openai.models.admin.organization.projects.groups.ProjectGroup; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupCreateParams params = GroupCreateParams.builder() + .projectId("project_id") + .groupId("group_id") + .role("role") + .build(); + ProjectGroup projectGroup = client.admin().organization().projects().groups().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + project_group = + openai.admin.organization.projects.groups.create("project_id", + group_id: "group_id", role: "role") + + + puts(project_group) + response: | + { + "object": "project.group", + "project_id": "proj_abc123", + "group_id": "group_01J1F8ABCDXYZ", + "group_name": "Support Team", + "created_at": 1711471533 + } + /organization/projects/{project_id}/groups/{group_id}: + delete: + security: + - AdminApiKeyAuth: [] + summary: Revokes a group's access to a project. + operationId: remove-project-group + tags: + - Project groups + parameters: + - name: project_id + in: path + description: The ID of the project to update. + required: true + schema: + type: string + - name: group_id + in: path + description: The ID of the group to remove from the project. + required: true + schema: + type: string + responses: + '200': + description: Group removed from the project successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectGroupDeletedResource' + x-oaiMeta: + name: Remove project group + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/projects/proj_abc123/groups/group_01J1F8ABCDXYZ + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const group = await + client.admin.organization.projects.groups.delete('group_id', { + project_id: 'project_id', + }); + + + console.log(group.deleted); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + group = client.admin.organization.projects.groups.delete( + group_id="group_id", + project_id="project_id", + ) + print(group.deleted) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tgroup, err := client.Admin.Organization.Projects.Groups.Delete(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"group_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", group.Deleted)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.groups.GroupDeleteParams; + + import + com.openai.models.admin.organization.projects.groups.GroupDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + GroupDeleteParams params = GroupDeleteParams.builder() + .projectId("project_id") + .groupId("group_id") + .build(); + GroupDeleteResponse group = client.admin().organization().projects().groups().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + group = + openai.admin.organization.projects.groups.delete("group_id", + project_id: "project_id") + + + puts(group) + response: | + { + "object": "project.group.deleted", + "deleted": true + } + /organization/projects/{project_id}/rate_limits: + get: + security: + - AdminApiKeyAuth: [] + summary: Returns the rate limits per model for a project. + operationId: list-project-rate-limits + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: limit + in: query + description: | + A limit on the number of objects to be returned. The default is 100. + required: false + schema: + type: integer + default: 100 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, beginning with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + required: false + schema: + type: string + responses: + '200': + description: Project rate limits listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectRateLimitListResponse' + 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 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const projectRateLimit of + client.admin.organization.projects.rateLimits.listRateLimits( + 'project_id', + )) { + console.log(projectRateLimit.id); + } + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + + page = + client.admin.organization.projects.rate_limits.list_rate_limits( + project_id="project_id", + ) + + page = page.data[0] + + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Projects.RateLimits.ListRateLimits(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectRateLimitListRateLimitsParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.ratelimits.RateLimitListRateLimitsPage; + + import + com.openai.models.admin.organization.projects.ratelimits.RateLimitListRateLimitsParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RateLimitListRateLimitsPage page = client.admin().organization().projects().rateLimits().listRateLimits("project_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + page = + openai.admin.organization.projects.rate_limits.list_rate_limits("project_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "project.rate_limit", + "id": "rl-ada", + "model": "ada", + "max_requests_per_1_minute": 600, + "max_tokens_per_1_minute": 150000, + "max_images_per_1_minute": 10 + } + ], + "first_id": "rl-ada", + "last_id": "rl-ada", + "has_more": false + } + error_response: | + { + "code": 404, + "message": "The project {project_id} was not found" + } + /organization/projects/{project_id}/rate_limits/{rate_limit_id}: + post: + security: + - AdminApiKeyAuth: [] + summary: Updates a project rate limit. + operationId: update-project-rate-limits + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: rate_limit_id + in: path + description: The ID of the rate limit. + required: true + schema: + type: string + requestBody: + description: The project rate limit update request payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectRateLimitUpdateRequest' + responses: + '200': + description: Project rate limit updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectRateLimit' + '400': + description: Error response for various conditions. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + 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 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "max_requests_per_1_minute": 500 + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const projectRateLimit = await + client.admin.organization.projects.rateLimits.updateRateLimit( + 'rate_limit_id', + { project_id: 'project_id' }, + ); + + + console.log(projectRateLimit.id); + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + + project_rate_limit = + client.admin.organization.projects.rate_limits.update_rate_limit( + rate_limit_id="rate_limit_id", + project_id="project_id", + ) + + print(project_rate_limit.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tprojectRateLimit, err := client.Admin.Organization.Projects.RateLimits.UpdateRateLimit(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"rate_limit_id\",\n\t\topenai.AdminOrganizationProjectRateLimitUpdateRateLimitParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", projectRateLimit.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.ratelimits.ProjectRateLimit; + + import + com.openai.models.admin.organization.projects.ratelimits.RateLimitUpdateRateLimitParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RateLimitUpdateRateLimitParams params = RateLimitUpdateRateLimitParams.builder() + .projectId("project_id") + .rateLimitId("rate_limit_id") + .build(); + ProjectRateLimit projectRateLimit = client.admin().organization().projects().rateLimits().updateRateLimit(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + project_rate_limit = + openai.admin.organization.projects.rate_limits.update_rate_limit( + "rate_limit_id", + project_id: "project_id" + ) + + + puts(project_rate_limit) + response: | + { + "object": "project.rate_limit", + "id": "rl-ada", + "model": "ada", + "max_requests_per_1_minute": 600, + "max_tokens_per_1_minute": 150000, + "max_images_per_1_minute": 10 + } + error_response: | + { + "code": 404, + "message": "The project {project_id} was not found" + } + /organization/projects/{project_id}/service_accounts: + get: + security: + - AdminApiKeyAuth: [] + summary: Returns a list of service accounts in the project. + operationId: list-project-service-accounts + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + responses: + '200': + description: Project service accounts listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectServiceAccountListResponse' + '400': + description: Error response when project is archived. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + 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 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const projectServiceAccount of + client.admin.organization.projects.serviceAccounts.list( + 'project_id', + )) { + console.log(projectServiceAccount.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.projects.service_accounts.list( + project_id="project_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Projects.ServiceAccounts.List(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectServiceAccountListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountListPage; + + import + com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ServiceAccountListPage page = client.admin().organization().projects().serviceAccounts().list("project_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + page = + openai.admin.organization.projects.service_accounts.list("project_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Service Account", + "role": "owner", + "created_at": 1711471533 + } + ], + "first_id": "svc_acct_abc", + "last_id": "svc_acct_xyz", + "has_more": false + } + post: + security: + - AdminApiKeyAuth: [] + summary: >- + Creates a new service account in the project. This also returns an + unredacted API key for the service account. + operationId: create-project-service-account + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + requestBody: + description: The project service account create request payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectServiceAccountCreateRequest' + responses: + '200': + description: Project service account created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectServiceAccountCreateResponse' + '400': + description: Error response when project is archived. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + name: Create project service account + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc/service_accounts + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Production App" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const serviceAccount = await + client.admin.organization.projects.serviceAccounts.create( + 'project_id', + { name: 'name' }, + ); + + + console.log(serviceAccount.id); + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + + service_account = + client.admin.organization.projects.service_accounts.create( + project_id="project_id", + name="name", + ) + + print(service_account.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tserviceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.New(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectServiceAccountNewParams{\n\t\t\tName: \"name\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", serviceAccount.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountCreateParams; + + import + com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountCreateResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ServiceAccountCreateParams params = ServiceAccountCreateParams.builder() + .projectId("project_id") + .name("name") + .build(); + ServiceAccountCreateResponse serviceAccount = client.admin().organization().projects().serviceAccounts().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + service_account = + openai.admin.organization.projects.service_accounts.create("project_id", + name: "name") + + + puts(service_account) + response: | + { + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Production App", + "role": "member", + "created_at": 1711471533, + "api_key": { + "object": "organization.project.service_account.api_key", + "value": "sk-abcdefghijklmnop123", + "name": "Secret Key", + "created_at": 1711471533, + "id": "key_abc" + } + } + /organization/projects/{project_id}/service_accounts/{service_account_id}: + get: + security: + - AdminApiKeyAuth: [] + summary: Retrieves a service account in the project. + operationId: retrieve-project-service-account + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: service_account_id + in: path + description: The ID of the service account. + required: true + schema: + type: string + responses: + '200': + description: Project service account retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectServiceAccount' + x-oaiMeta: + name: Retrieve project service account + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const projectServiceAccount = await + client.admin.organization.projects.serviceAccounts.retrieve( + 'service_account_id', + { project_id: 'project_id' }, + ); + + + console.log(projectServiceAccount.id); + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + + project_service_account = + client.admin.organization.projects.service_accounts.retrieve( + service_account_id="service_account_id", + project_id="project_id", + ) + + print(project_service_account.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tprojectServiceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.Get(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"service_account_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", projectServiceAccount.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.serviceaccounts.ProjectServiceAccount; + + import + com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ServiceAccountRetrieveParams params = ServiceAccountRetrieveParams.builder() + .projectId("project_id") + .serviceAccountId("service_account_id") + .build(); + ProjectServiceAccount projectServiceAccount = client.admin().organization().projects().serviceAccounts().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + project_service_account = + openai.admin.organization.projects.service_accounts.retrieve( + "service_account_id", + project_id: "project_id" + ) + + + puts(project_service_account) + response: | + { + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Service Account", + "role": "owner", + "created_at": 1711471533 + } + delete: + security: + - AdminApiKeyAuth: [] + summary: > + Deletes a service account from the project. + + + Returns confirmation of service account deletion, or an error if the + project + + is archived (archived projects have no service accounts). + operationId: delete-project-service-account + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: service_account_id + in: path + description: The ID of the service account. + required: true + schema: + type: string + responses: + '200': + description: Project service account deleted successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectServiceAccountDeleteResponse' + x-oaiMeta: + name: Delete project service account + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const serviceAccount = await + client.admin.organization.projects.serviceAccounts.delete( + 'service_account_id', + { project_id: 'project_id' }, + ); + + + console.log(serviceAccount.id); + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + + service_account = + client.admin.organization.projects.service_accounts.delete( + service_account_id="service_account_id", + project_id="project_id", + ) + + print(service_account.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tserviceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.Delete(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"service_account_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", serviceAccount.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountDeleteParams; + + import + com.openai.models.admin.organization.projects.serviceaccounts.ServiceAccountDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ServiceAccountDeleteParams params = ServiceAccountDeleteParams.builder() + .projectId("project_id") + .serviceAccountId("service_account_id") + .build(); + ServiceAccountDeleteResponse serviceAccount = client.admin().organization().projects().serviceAccounts().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + service_account = + openai.admin.organization.projects.service_accounts.delete("service_account_id", + project_id: "project_id") + + + puts(service_account) + response: | + { + "object": "organization.project.service_account.deleted", + "id": "svc_acct_abc", + "deleted": true + } + /organization/projects/{project_id}/users: + get: + security: + - AdminApiKeyAuth: [] + summary: Returns a list of users in the project. + operationId: list-project-users + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + responses: + '200': + description: Project users listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectUserListResponse' + '400': + description: Error response when project is archived. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + name: List project users + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/users?after=user_abc&limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const projectUser of + client.admin.organization.projects.users.list('project_id')) { + console.log(projectUser.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.projects.users.list( + project_id="project_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Projects.Users.List(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectUserListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.users.UserListPage; + + import + com.openai.models.admin.organization.projects.users.UserListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserListPage page = client.admin().organization().projects().users().list("project_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.projects.users.list("project_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + ], + "first_id": "user-abc", + "last_id": "user-xyz", + "has_more": false + } + post: + security: + - AdminApiKeyAuth: [] + summary: >- + 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: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + tags: + - Projects + requestBody: + description: The project user create request payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectUserCreateRequest' + responses: + '200': + description: User added to project successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectUser' + '400': + description: Error response for various conditions. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + name: Create project user + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc/users \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "user_id": "user_abc", + "role": "member" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const projectUser = await + client.admin.organization.projects.users.create('project_id', { + role: 'role', + }); + + + console.log(projectUser.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + project_user = client.admin.organization.projects.users.create( + project_id="project_id", + role="role", + ) + print(project_user.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tprojectUser, err := client.Admin.Organization.Projects.Users.New(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectUserNewParams{\n\t\t\tRole: \"role\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", projectUser.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.users.ProjectUser; + + import + com.openai.models.admin.organization.projects.users.UserCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserCreateParams params = UserCreateParams.builder() + .projectId("project_id") + .role("role") + .build(); + ProjectUser projectUser = client.admin().organization().projects().users().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + project_user = + openai.admin.organization.projects.users.create("project_id", + role: "role") + + + puts(project_user) + response: | + { + "object": "organization.project.user", + "id": "user_abc", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + /organization/projects/{project_id}/users/{user_id}: + get: + security: + - AdminApiKeyAuth: [] + summary: Retrieves a user in the project. + operationId: retrieve-project-user + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + responses: + '200': + description: Project user retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectUser' + x-oaiMeta: + name: Retrieve project user + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const projectUser = await + client.admin.organization.projects.users.retrieve('user_id', { + project_id: 'project_id', + }); + + + console.log(projectUser.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + project_user = client.admin.organization.projects.users.retrieve( + user_id="user_id", + project_id="project_id", + ) + print(project_user.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tprojectUser, err := client.Admin.Organization.Projects.Users.Get(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"user_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", projectUser.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.users.ProjectUser; + + import + com.openai.models.admin.organization.projects.users.UserRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserRetrieveParams params = UserRetrieveParams.builder() + .projectId("project_id") + .userId("user_id") + .build(); + ProjectUser projectUser = client.admin().organization().projects().users().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + project_user = + openai.admin.organization.projects.users.retrieve("user_id", + project_id: "project_id") + + + puts(project_user) + response: | + { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + post: + security: + - AdminApiKeyAuth: [] + summary: Modifies a user's role in the project. + operationId: modify-project-user + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + requestBody: + description: The project user update request payload. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectUserUpdateRequest' + responses: + '200': + description: Project user's role updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectUser' + '400': + description: Error response for various conditions. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + name: Modify project user + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "role": "owner" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const projectUser = await + client.admin.organization.projects.users.update('user_id', { + project_id: 'project_id', + }); + + + console.log(projectUser.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + project_user = client.admin.organization.projects.users.update( + user_id="user_id", + project_id="project_id", + ) + print(project_user.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tprojectUser, err := client.Admin.Organization.Projects.Users.Update(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"user_id\",\n\t\topenai.AdminOrganizationProjectUserUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", projectUser.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.users.ProjectUser; + + import + com.openai.models.admin.organization.projects.users.UserUpdateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserUpdateParams params = UserUpdateParams.builder() + .projectId("project_id") + .userId("user_id") + .build(); + ProjectUser projectUser = client.admin().organization().projects().users().update(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + project_user = + openai.admin.organization.projects.users.update("user_id", + project_id: "project_id") + + + puts(project_user) + response: | + { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + delete: + security: + - AdminApiKeyAuth: [] + summary: > + Deletes a user from the project. + + + Returns confirmation of project user deletion, or an error if the + project is + + archived (archived projects have no users). + operationId: delete-project-user + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + responses: + '200': + description: Project user deleted successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectUserDeleteResponse' + '400': + description: Error response for various conditions. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + name: Delete project user + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const user = await + client.admin.organization.projects.users.delete('user_id', { + project_id: 'project_id', + }); + + + console.log(user.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + user = client.admin.organization.projects.users.delete( + user_id="user_id", + project_id="project_id", + ) + print(user.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tuser, err := client.Admin.Organization.Projects.Users.Delete(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"user_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", user.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.users.UserDeleteParams; + + import + com.openai.models.admin.organization.projects.users.UserDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserDeleteParams params = UserDeleteParams.builder() + .projectId("project_id") + .userId("user_id") + .build(); + UserDeleteResponse user = client.admin().organization().projects().users().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + user = openai.admin.organization.projects.users.delete("user_id", + project_id: "project_id") + + + puts(user) + response: | + { + "object": "organization.project.user.deleted", + "id": "user_abc", + "deleted": true + } + /organization/roles: + get: + security: + - AdminApiKeyAuth: [] + summary: Lists the roles configured for the organization. + operationId: list-roles + tags: + - Roles + parameters: + - name: limit + in: query + description: A limit on the number of roles to return. Defaults to 1000. + required: false + schema: + type: integer + minimum: 0 + maximum: 1000 + default: 1000 + - name: after + in: query + description: >- + Cursor for pagination. Provide the value from the previous + response's `next` field to continue listing roles. + required: false + schema: + type: string + - name: order + in: query + description: Sort order for the returned roles. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + responses: + '200': + description: Roles listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/PublicRoleListResource' + x-oaiMeta: + name: List organization roles + group: administration + examples: + request: + curl: | + curl https://api.openai.com/v1/organization/roles?limit=20 \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const role of client.admin.organization.roles.list()) { + console.log(role.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.roles.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Roles.List(context.TODO(), openai.AdminOrganizationRoleListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.admin.organization.roles.RoleListPage; + import com.openai.models.admin.organization.roles.RoleListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleListPage page = client.admin().organization().roles().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.roles.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + ], + "has_more": false, + "next": null + } + post: + security: + - AdminApiKeyAuth: [] + summary: Creates a custom role for the organization. + operationId: create-role + tags: + - Roles + requestBody: + description: Parameters for the role you want to create. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PublicCreateOrganizationRoleBody' + responses: + '200': + description: Role created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Role' + x-oaiMeta: + name: Create organization role + group: administration + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/organization/roles \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "role_name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "description": "Allows managing organization groups" + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + const role = await client.admin.organization.roles.create({ + permissions: ['string'], + role_name: 'role_name', + }); + + console.log(role.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.roles.create( + permissions=["string"], + role_name="role_name", + ) + print(role.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Roles.New(context.TODO(), openai.AdminOrganizationRoleNewParams{\n\t\tPermissions: []string{\"string\"},\n\t\tRoleName: \"role_name\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.admin.organization.roles.Role; + + import + com.openai.models.admin.organization.roles.RoleCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleCreateParams params = RoleCreateParams.builder() + .addPermission("string") + .roleName("role_name") + .build(); + Role role = client.admin().organization().roles().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + role = openai.admin.organization.roles.create(permissions: + ["string"], role_name: "role_name") + + + puts(role) + response: | + { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + /organization/roles/{role_id}: + post: + security: + - AdminApiKeyAuth: [] + summary: Updates an existing organization role. + operationId: update-role + tags: + - Roles + parameters: + - name: role_id + in: path + description: The ID of the role to update. + required: true + schema: + type: string + requestBody: + description: Fields to update on the role. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PublicUpdateOrganizationRoleBody' + responses: + '200': + description: Role updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Role' + x-oaiMeta: + name: Update organization role + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/roles/role_01J1F8ROLE01 \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "role_name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "description": "Allows managing organization groups" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.roles.update('role_id'); + + + console.log(role.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.roles.update( + role_id="role_id", + ) + print(role.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Roles.Update(\n\t\tcontext.TODO(),\n\t\t\"role_id\",\n\t\topenai.AdminOrganizationRoleUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.admin.organization.roles.Role; + + import + com.openai.models.admin.organization.roles.RoleUpdateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Role role = client.admin().organization().roles().update("role_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + role = openai.admin.organization.roles.update("role_id") + + puts(role) + response: | + { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + delete: + security: + - AdminApiKeyAuth: [] + summary: Deletes a custom role from the organization. + operationId: delete-role + tags: + - Roles + parameters: + - name: role_id + in: path + description: The ID of the role to delete. + required: true + schema: + type: string + responses: + '200': + description: Role deleted successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/RoleDeletedResource' + x-oaiMeta: + name: Delete organization role + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/roles/role_01J1F8ROLE01 \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.roles.delete('role_id'); + + + console.log(role.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.roles.delete( + "role_id", + ) + print(role.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Roles.Delete(context.TODO(), \"role_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.roles.RoleDeleteParams; + + import + com.openai.models.admin.organization.roles.RoleDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleDeleteResponse role = client.admin().organization().roles().delete("role_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + role = openai.admin.organization.roles.delete("role_id") + + puts(role) + response: | + { + "object": "role.deleted", + "id": "role_01J1F8ROLE01", + "deleted": true + } + /organization/usage/audio_speeches: + get: + security: + - AdminApiKeyAuth: [] + summary: Get audio speeches usage details for the organization. + operationId: usage-audio-speeches + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: >- + Width of each time bucket in response. Currently `1m`, `1h` and `1d` + are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: user_ids + in: query + description: Return only usage for these users. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only usage for these API keys. + required: false + schema: + type: array + items: + type: string + - name: models + in: query + description: Return only usage for these models. + required: false + schema: + type: array + items: + type: string + - 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` or any combination of + them. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: >- + A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + '200': + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UsageResponse' + x-oaiMeta: + name: Audio speeches + group: usage-audio-speeches + examples: + request: + curl: > + curl + "https://api.openai.com/v1/organization/usage/audio_speeches?start_time=1730419200&limit=1" + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const response = await + client.admin.organization.usage.audioSpeeches({ start_time: 0 }); + + + console.log(response.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + response = client.admin.organization.usage.audio_speeches( + start_time=0, + ) + print(response.data) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.AudioSpeeches(context.TODO(), openai.AdminOrganizationUsageAudioSpeechesParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.usage.UsageAudioSpeechesParams; + + import + com.openai.models.admin.organization.usage.UsageAudioSpeechesResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageAudioSpeechesParams params = UsageAudioSpeechesParams.builder() + .startTime(0L) + .build(); + UsageAudioSpeechesResponse response = client.admin().organization().usage().audioSpeeches(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + response = + openai.admin.organization.usage.audio_speeches(start_time: 0) + + + puts(response) + response: | + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "organization.usage.audio_speeches.result", + "characters": 45, + "num_model_requests": 1, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/usage/audio_transcriptions: + get: + security: + - AdminApiKeyAuth: [] + summary: Get audio transcriptions usage details for the organization. + operationId: usage-audio-transcriptions + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: >- + Width of each time bucket in response. Currently `1m`, `1h` and `1d` + are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: user_ids + in: query + description: Return only usage for these users. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only usage for these API keys. + required: false + schema: + type: array + items: + type: string + - name: models + in: query + description: Return only usage for these models. + required: false + schema: + type: array + items: + type: string + - 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` or any combination of + them. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: >- + A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + '200': + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UsageResponse' + x-oaiMeta: + name: Audio transcriptions + group: usage-audio-transcriptions + examples: + request: + curl: > + curl + "https://api.openai.com/v1/organization/usage/audio_transcriptions?start_time=1730419200&limit=1" + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const response = await + client.admin.organization.usage.audioTranscriptions({ start_time: + 0 }); + + + console.log(response.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + response = client.admin.organization.usage.audio_transcriptions( + start_time=0, + ) + print(response.data) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.AudioTranscriptions(context.TODO(), openai.AdminOrganizationUsageAudioTranscriptionsParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.usage.UsageAudioTranscriptionsParams; + + import + com.openai.models.admin.organization.usage.UsageAudioTranscriptionsResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageAudioTranscriptionsParams params = UsageAudioTranscriptionsParams.builder() + .startTime(0L) + .build(); + UsageAudioTranscriptionsResponse response = client.admin().organization().usage().audioTranscriptions(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + response = + openai.admin.organization.usage.audio_transcriptions(start_time: + 0) + + + puts(response) + response: | + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "organization.usage.audio_transcriptions.result", + "seconds": 20, + "num_model_requests": 1, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/usage/code_interpreter_sessions: + get: + security: + - AdminApiKeyAuth: [] + summary: Get code interpreter sessions usage details for the organization. + operationId: usage-code-interpreter-sessions + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: >- + Width of each time bucket in response. Currently `1m`, `1h` and `1d` + are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: group_by + in: query + description: >- + Group the usage data by the specified fields. Support fields include + `project_id`. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: >- + A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + '200': + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UsageResponse' + x-oaiMeta: + name: Code interpreter sessions + group: usage-code-interpreter-sessions + examples: + request: + curl: > + curl + "https://api.openai.com/v1/organization/usage/code_interpreter_sessions?start_time=1730419200&limit=1" + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const response = await + client.admin.organization.usage.codeInterpreterSessions({ + start_time: 0 }); + + + console.log(response.data); + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + + response = + client.admin.organization.usage.code_interpreter_sessions( + start_time=0, + ) + + print(response.data) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.CodeInterpreterSessions(context.TODO(), openai.AdminOrganizationUsageCodeInterpreterSessionsParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.usage.UsageCodeInterpreterSessionsParams; + + import + com.openai.models.admin.organization.usage.UsageCodeInterpreterSessionsResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageCodeInterpreterSessionsParams params = UsageCodeInterpreterSessionsParams.builder() + .startTime(0L) + .build(); + UsageCodeInterpreterSessionsResponse response = client.admin().organization().usage().codeInterpreterSessions(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + response = + openai.admin.organization.usage.code_interpreter_sessions(start_time: + 0) + + + puts(response) + response: | + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "organization.usage.code_interpreter_sessions.result", + "num_sessions": 1, + "project_id": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/usage/completions: + get: + security: + - AdminApiKeyAuth: [] + summary: Get completions usage details for the organization. + operationId: usage-completions + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: >- + Width of each time bucket in response. Currently `1m`, `1h` and `1d` + are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: user_ids + in: query + description: Return only usage for these users. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only usage for these API keys. + required: false + schema: + type: array + items: + type: string + - name: models + in: query + description: Return only usage for these models. + required: false + schema: + type: array + items: + type: string + - 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: + type: boolean + - 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. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - batch + - service_tier + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: >- + A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + '200': + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UsageResponse' + x-oaiMeta: + name: Completions + group: usage-completions + examples: + request: + curl: > + curl + "https://api.openai.com/v1/organization/usage/completions?start_time=1730419200&limit=1" + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const response = await + client.admin.organization.usage.completions({ start_time: 0 }); + + + console.log(response.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + response = client.admin.organization.usage.completions( + start_time=0, + ) + print(response.data) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.Completions(context.TODO(), openai.AdminOrganizationUsageCompletionsParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.usage.UsageCompletionsParams; + + import + com.openai.models.admin.organization.usage.UsageCompletionsResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageCompletionsParams params = UsageCompletionsParams.builder() + .startTime(0L) + .build(); + UsageCompletionsResponse response = client.admin().organization().usage().completions(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + response = openai.admin.organization.usage.completions(start_time: + 0) + + + puts(response) + response: | + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "organization.usage.completions.result", + "input_tokens": 1000, + "output_tokens": 500, + "input_cached_tokens": 800, + "input_audio_tokens": 0, + "output_audio_tokens": 0, + "num_model_requests": 5, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null, + "batch": null, + "service_tier": null + } + ] + } + ], + "has_more": true, + "next_page": "page_AAAAAGdGxdEiJdKOAAAAAGcqsYA=" + } + /organization/usage/embeddings: + get: + security: + - AdminApiKeyAuth: [] + summary: Get embeddings usage details for the organization. + operationId: usage-embeddings + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: >- + Width of each time bucket in response. Currently `1m`, `1h` and `1d` + are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: user_ids + in: query + description: Return only usage for these users. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only usage for these API keys. + required: false + schema: + type: array + items: + type: string + - name: models + in: query + description: Return only usage for these models. + required: false + schema: + type: array + items: + type: string + - 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` or any combination of + them. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: >- + A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + '200': + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UsageResponse' + x-oaiMeta: + name: Embeddings + group: usage-embeddings + examples: + request: + curl: > + curl + "https://api.openai.com/v1/organization/usage/embeddings?start_time=1730419200&limit=1" + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const response = await + client.admin.organization.usage.embeddings({ start_time: 0 }); + + + console.log(response.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + response = client.admin.organization.usage.embeddings( + start_time=0, + ) + print(response.data) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.Embeddings(context.TODO(), openai.AdminOrganizationUsageEmbeddingsParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.usage.UsageEmbeddingsParams; + + import + com.openai.models.admin.organization.usage.UsageEmbeddingsResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageEmbeddingsParams params = UsageEmbeddingsParams.builder() + .startTime(0L) + .build(); + UsageEmbeddingsResponse response = client.admin().organization().usage().embeddings(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + response = openai.admin.organization.usage.embeddings(start_time: + 0) + + + puts(response) + response: | + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "organization.usage.embeddings.result", + "input_tokens": 16, + "num_model_requests": 2, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/usage/images: + get: + security: + - AdminApiKeyAuth: [] + summary: Get images usage details for the organization. + operationId: usage-images + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: >- + Width of each time bucket in response. Currently `1m`, `1h` and `1d` + are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: sources + in: query + description: >- + Return only usages for these sources. Possible values are + `image.generation`, `image.edit`, `image.variation` or any + combination of them. + required: false + schema: + type: array + items: + type: string + enum: + - image.generation + - image.edit + - image.variation + - name: sizes + in: query + description: >- + Return only usages for these image sizes. Possible values are + `256x256`, `512x512`, `1024x1024`, `1792x1792`, `1024x1792` or any + combination of them. + required: false + schema: + type: array + items: + type: string + enum: + - 256x256 + - 512x512 + - 1024x1024 + - 1792x1792 + - 1024x1792 + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: user_ids + in: query + description: Return only usage for these users. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only usage for these API keys. + required: false + schema: + type: array + items: + type: string + - name: models + in: query + description: Return only usage for these models. + required: false + schema: + type: array + items: + type: string + - 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`, `size`, `source` or + any combination of them. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - size + - source + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: >- + A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + '200': + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UsageResponse' + x-oaiMeta: + name: Images + group: usage-images + examples: + request: + curl: > + curl + "https://api.openai.com/v1/organization/usage/images?start_time=1730419200&limit=1" + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const response = await client.admin.organization.usage.images({ + start_time: 0 }); + + + console.log(response.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + response = client.admin.organization.usage.images( + start_time=0, + ) + print(response.data) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.Images(context.TODO(), openai.AdminOrganizationUsageImagesParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.usage.UsageImagesParams; + + import + com.openai.models.admin.organization.usage.UsageImagesResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageImagesParams params = UsageImagesParams.builder() + .startTime(0L) + .build(); + UsageImagesResponse response = client.admin().organization().usage().images(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + response = openai.admin.organization.usage.images(start_time: 0) + + puts(response) + response: | + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "organization.usage.images.result", + "images": 2, + "num_model_requests": 2, + "size": null, + "source": null, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/usage/moderations: + get: + security: + - AdminApiKeyAuth: [] + summary: Get moderations usage details for the organization. + operationId: usage-moderations + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: >- + Width of each time bucket in response. Currently `1m`, `1h` and `1d` + are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: user_ids + in: query + description: Return only usage for these users. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only usage for these API keys. + required: false + schema: + type: array + items: + type: string + - name: models + in: query + description: Return only usage for these models. + required: false + schema: + type: array + items: + type: string + - 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` or any combination of + them. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: >- + A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + '200': + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UsageResponse' + x-oaiMeta: + name: Moderations + group: usage-moderations + examples: + request: + curl: > + curl + "https://api.openai.com/v1/organization/usage/moderations?start_time=1730419200&limit=1" + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const response = await + client.admin.organization.usage.moderations({ start_time: 0 }); + + + console.log(response.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + response = client.admin.organization.usage.moderations( + start_time=0, + ) + print(response.data) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.Moderations(context.TODO(), openai.AdminOrganizationUsageModerationsParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.usage.UsageModerationsParams; + + import + com.openai.models.admin.organization.usage.UsageModerationsResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageModerationsParams params = UsageModerationsParams.builder() + .startTime(0L) + .build(); + UsageModerationsResponse response = client.admin().organization().usage().moderations(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + response = openai.admin.organization.usage.moderations(start_time: + 0) + + + puts(response) + response: | + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "organization.usage.moderations.result", + "input_tokens": 16, + "num_model_requests": 2, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/usage/vector_stores: + get: + security: + - AdminApiKeyAuth: [] + summary: Get vector stores usage details for the organization. + operationId: usage-vector-stores + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: >- + Width of each time bucket in response. Currently `1m`, `1h` and `1d` + are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: group_by + in: query + description: >- + Group the usage data by the specified fields. Support fields include + `project_id`. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: >- + A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + '200': + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UsageResponse' + x-oaiMeta: + name: Vector stores + group: usage-vector-stores + examples: + request: + curl: > + curl + "https://api.openai.com/v1/organization/usage/vector_stores?start_time=1730419200&limit=1" + \ + + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const response = await + client.admin.organization.usage.vectorStores({ start_time: 0 }); + + + console.log(response.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + response = client.admin.organization.usage.vector_stores( + start_time=0, + ) + print(response.data) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.VectorStores(context.TODO(), openai.AdminOrganizationUsageVectorStoresParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.usage.UsageVectorStoresParams; + + import + com.openai.models.admin.organization.usage.UsageVectorStoresResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UsageVectorStoresParams params = UsageVectorStoresParams.builder() + .startTime(0L) + .build(); + UsageVectorStoresResponse response = client.admin().organization().usage().vectorStores(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + response = + openai.admin.organization.usage.vector_stores(start_time: 0) + + + puts(response) + response: | + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "organization.usage.vector_stores.result", + "usage_bytes": 1024, + "project_id": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/users: + get: + security: + - AdminApiKeyAuth: [] + summary: Lists all of the users in the organization. + operationId: list-users + tags: + - Users + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + - name: emails + in: query + description: Filter by the email address of users. + required: false + schema: + type: array + items: + type: string + responses: + '200': + description: Users listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UserListResponse' + x-oaiMeta: + name: List users + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/users?after=user_abc&limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const organizationUser of + client.admin.organization.users.list()) { + console.log(organizationUser.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.users.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Users.List(context.TODO(), openai.AdminOrganizationUserListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.admin.organization.users.UserListPage; + import com.openai.models.admin.organization.users.UserListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserListPage page = client.admin().organization().users().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.users.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "organization.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + ], + "first_id": "user-abc", + "last_id": "user-xyz", + "has_more": false + } + /organization/users/{user_id}: + get: + security: + - AdminApiKeyAuth: [] + summary: Retrieves a user by their identifier. + operationId: retrieve-user + tags: + - Users + parameters: + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + responses: + '200': + description: User retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/User' + x-oaiMeta: + name: Retrieve user + group: administration + examples: + request: + curl: | + curl https://api.openai.com/v1/organization/users/user_abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const organizationUser = await + client.admin.organization.users.retrieve('user_id'); + + + console.log(organizationUser.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + organization_user = client.admin.organization.users.retrieve( + "user_id", + ) + print(organization_user.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\torganizationUser, err := client.Admin.Organization.Users.Get(context.TODO(), \"user_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", organizationUser.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.users.OrganizationUser; + + import + com.openai.models.admin.organization.users.UserRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OrganizationUser organizationUser = client.admin().organization().users().retrieve("user_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + organization_user = + openai.admin.organization.users.retrieve("user_id") + + + puts(organization_user) + response: | + { + "object": "organization.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + post: + security: + - AdminApiKeyAuth: [] + summary: Modifies a user's role in the organization. + operationId: modify-user + tags: + - Users + parameters: + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + requestBody: + description: The new user role to modify. This must be one of `owner` or `member`. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UserRoleUpdateRequest' + responses: + '200': + description: User role updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/User' + x-oaiMeta: + name: Modify user + group: administration + examples: + request: + curl: > + curl -X POST https://api.openai.com/v1/organization/users/user_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "role": "owner" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const organizationUser = await + client.admin.organization.users.update('user_id'); + + + console.log(organizationUser.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + organization_user = client.admin.organization.users.update( + user_id="user_id", + ) + print(organization_user.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\torganizationUser, err := client.Admin.Organization.Users.Update(\n\t\tcontext.TODO(),\n\t\t\"user_id\",\n\t\topenai.AdminOrganizationUserUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", organizationUser.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.users.OrganizationUser; + + import + com.openai.models.admin.organization.users.UserUpdateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OrganizationUser organizationUser = client.admin().organization().users().update("user_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + organization_user = + openai.admin.organization.users.update("user_id") + + + puts(organization_user) + response: | + { + "object": "organization.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + delete: + security: + - AdminApiKeyAuth: [] + summary: Deletes a user from the organization. + operationId: delete-user + tags: + - Users + parameters: + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + responses: + '200': + description: User deleted successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UserDeleteResponse' + x-oaiMeta: + name: Delete user + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/users/user_abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const user = await + client.admin.organization.users.delete('user_id'); + + + console.log(user.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + user = client.admin.organization.users.delete( + "user_id", + ) + print(user.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tuser, err := client.Admin.Organization.Users.Delete(context.TODO(), \"user_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", user.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.users.UserDeleteParams; + + import + com.openai.models.admin.organization.users.UserDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UserDeleteResponse user = client.admin().organization().users().delete("user_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + user = openai.admin.organization.users.delete("user_id") + + puts(user) + response: | + { + "object": "organization.user.deleted", + "id": "user_abc", + "deleted": true + } + /organization/users/{user_id}/roles: + get: + security: + - AdminApiKeyAuth: [] + summary: Lists the organization roles assigned to a user within the organization. + operationId: list-user-role-assignments + tags: + - User organization role assignments + parameters: + - name: user_id + in: path + description: The ID of the user to inspect. + required: true + schema: + type: string + - name: limit + in: query + description: A limit on the number of organization role assignments to return. + required: false + schema: + type: integer + minimum: 0 + maximum: 1000 + - name: after + in: query + description: >- + Cursor for pagination. Provide the value from the previous + response's `next` field to continue listing organization roles. + required: false + schema: + type: string + - name: order + in: query + description: Sort order for the returned organization roles. + required: false + schema: + type: string + enum: + - asc + - desc + responses: + '200': + description: User organization role assignments listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/RoleListResource' + x-oaiMeta: + name: List user organization role assignments + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/users/user_abc123/roles \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const roleListResponse of + client.admin.organization.users.roles.list('user_id')) { + console.log(roleListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.users.roles.list( + user_id="user_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Users.Roles.List(\n\t\tcontext.TODO(),\n\t\t\"user_id\",\n\t\topenai.AdminOrganizationUserRoleListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.users.roles.RoleListPage; + + import + com.openai.models.admin.organization.users.roles.RoleListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleListPage page = client.admin().organization().users().roles().list("user_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.users.roles.list("user_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false, + "description": "Allows managing organization groups", + "created_at": 1711471533, + "updated_at": 1711472599, + "created_by": "user_abc123", + "created_by_user_obj": { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + }, + "metadata": {} + } + ], + "has_more": false, + "next": null + } + post: + security: + - AdminApiKeyAuth: [] + summary: Assigns an organization role to a user within the organization. + operationId: assign-user-role + tags: + - User organization role assignments + parameters: + - name: user_id + in: path + description: The ID of the user that should receive the organization role. + required: true + schema: + type: string + requestBody: + description: Identifies the organization role to assign to the user. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PublicAssignOrganizationGroupRoleBody' + responses: + '200': + description: Organization role assigned to the user successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UserRoleAssignment' + x-oaiMeta: + name: Assign organization role to user + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/users/user_abc123/roles \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "role_id": "role_01J1F8ROLE01" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.users.roles.create('user_id', { role_id: + 'role_id' }); + + + console.log(role.object); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.users.roles.create( + user_id="user_id", + role_id="role_id", + ) + print(role.object) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Users.Roles.New(\n\t\tcontext.TODO(),\n\t\t\"user_id\",\n\t\topenai.AdminOrganizationUserRoleNewParams{\n\t\t\tRoleID: \"role_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.Object)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.users.roles.RoleCreateParams; + + import + com.openai.models.admin.organization.users.roles.RoleCreateResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleCreateParams params = RoleCreateParams.builder() + .userId("user_id") + .roleId("role_id") + .build(); + RoleCreateResponse role = client.admin().organization().users().roles().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + role = openai.admin.organization.users.roles.create("user_id", + role_id: "role_id") + + + puts(role) + response: | + { + "object": "user.role", + "user": { + "object": "organization.user", + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com", + "role": "owner", + "added_at": 1711470000 + }, + "role": { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + } + /organization/users/{user_id}/roles/{role_id}: + delete: + security: + - AdminApiKeyAuth: [] + summary: Unassigns an organization role from a user within the organization. + operationId: unassign-user-role + tags: + - User organization role assignments + parameters: + - name: user_id + in: path + description: The ID of the user to modify. + required: true + schema: + type: string + - name: role_id + in: path + description: The ID of the organization role to remove from the user. + required: true + schema: + type: string + responses: + '200': + description: Organization role unassigned from the user successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedRoleAssignmentResource' + x-oaiMeta: + name: Unassign organization role from user + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/users/user_abc123/roles/role_01J1F8ROLE01 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.users.roles.delete('role_id', { user_id: + 'user_id' }); + + + console.log(role.deleted); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.users.roles.delete( + role_id="role_id", + user_id="user_id", + ) + print(role.deleted) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Users.Roles.Delete(\n\t\tcontext.TODO(),\n\t\t\"user_id\",\n\t\t\"role_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.Deleted)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.users.roles.RoleDeleteParams; + + import + com.openai.models.admin.organization.users.roles.RoleDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleDeleteParams params = RoleDeleteParams.builder() + .userId("user_id") + .roleId("role_id") + .build(); + RoleDeleteResponse role = client.admin().organization().users().roles().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + role = openai.admin.organization.users.roles.delete("role_id", + user_id: "user_id") + + + puts(role) + response: | + { + "object": "user.role.deleted", + "deleted": true + } + /projects/{project_id}/groups/{group_id}/roles: + get: + security: + - AdminApiKeyAuth: [] + summary: Lists the project roles assigned to a group within a project. + operationId: list-project-group-role-assignments + tags: + - Project group role assignments + parameters: + - name: project_id + in: path + description: The ID of the project to inspect. + required: true + schema: + type: string + - name: group_id + in: path + description: The ID of the group to inspect. + required: true + schema: + type: string + - name: limit + in: query + description: A limit on the number of project role assignments to return. + required: false + schema: + type: integer + minimum: 0 + maximum: 1000 + - name: after + in: query + description: >- + Cursor for pagination. Provide the value from the previous + response's `next` field to continue listing project roles. + required: false + schema: + type: string + - name: order + in: query + description: Sort order for the returned project roles. + required: false + schema: + type: string + enum: + - asc + - desc + responses: + '200': + description: Project group role assignments listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/RoleListResource' + 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 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const roleListResponse of + client.admin.organization.projects.groups.roles.list( + 'group_id', + { project_id: 'project_id' }, + )) { + console.log(roleListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.projects.groups.roles.list( + group_id="group_id", + project_id="project_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Projects.Groups.Roles.List(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"group_id\",\n\t\topenai.AdminOrganizationProjectGroupRoleListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.groups.roles.RoleListPage; + + import + com.openai.models.admin.organization.projects.groups.roles.RoleListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleListParams params = RoleListParams.builder() + .projectId("project_id") + .groupId("group_id") + .build(); + RoleListPage page = client.admin().organization().projects().groups().roles().list(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + page = + openai.admin.organization.projects.groups.roles.list("group_id", + project_id: "project_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "role_01J1F8PROJ", + "name": "API Project Key Manager", + "permissions": [ + "api.organization.projects.api_keys.read", + "api.organization.projects.api_keys.write" + ], + "resource_type": "api.project", + "predefined_role": false, + "description": "Allows managing API keys for the project", + "created_at": 1711471533, + "updated_at": 1711472599, + "created_by": "user_abc123", + "created_by_user_obj": { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + }, + "metadata": {} + } + ], + "has_more": false, + "next": null + } + post: + security: + - AdminApiKeyAuth: [] + summary: Assigns a project role to a group within a project. + operationId: assign-project-group-role + tags: + - Project group role assignments + parameters: + - name: project_id + in: path + description: The ID of the project to update. + required: true + schema: + type: string + - name: group_id + in: path + description: The ID of the group that should receive the project role. + required: true + schema: + type: string + requestBody: + description: Identifies the project role to assign to the group. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PublicAssignOrganizationGroupRoleBody' + responses: + '200': + description: Project role assigned to the group successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/GroupRoleAssignment' + x-oaiMeta: + name: Assign project role to group + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/projects/proj_abc123/groups/group_01J1F8ABCDXYZ/roles + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "role_id": "role_01J1F8PROJ" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.projects.groups.roles.create('group_id', + { + project_id: 'project_id', + role_id: 'role_id', + }); + + + console.log(role.group); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.projects.groups.roles.create( + group_id="group_id", + project_id="project_id", + role_id="role_id", + ) + print(role.group) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Projects.Groups.Roles.New(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"group_id\",\n\t\topenai.AdminOrganizationProjectGroupRoleNewParams{\n\t\t\tRoleID: \"role_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.Group)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.groups.roles.RoleCreateParams; + + import + com.openai.models.admin.organization.projects.groups.roles.RoleCreateResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleCreateParams params = RoleCreateParams.builder() + .projectId("project_id") + .groupId("group_id") + .roleId("role_id") + .build(); + RoleCreateResponse role = client.admin().organization().projects().groups().roles().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + role = openai.admin.organization.projects.groups.roles.create( + "group_id", + project_id: "project_id", + role_id: "role_id" + ) + + puts(role) + response: | + { + "object": "group.role", + "group": { + "object": "group", + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "scim_managed": false + }, + "role": { + "object": "role", + "id": "role_01J1F8PROJ", + "name": "API Project Key Manager", + "description": "Allows managing API keys for the project", + "permissions": [ + "api.organization.projects.api_keys.read", + "api.organization.projects.api_keys.write" + ], + "resource_type": "api.project", + "predefined_role": false + } + } + /projects/{project_id}/groups/{group_id}/roles/{role_id}: + delete: + security: + - AdminApiKeyAuth: [] + summary: Unassigns a project role from a group within a project. + operationId: unassign-project-group-role + tags: + - Project group role assignments + parameters: + - name: project_id + in: path + description: The ID of the project to modify. + required: true + schema: + type: string + - name: group_id + in: path + description: The ID of the group whose project role assignment should be removed. + required: true + schema: + type: string + - name: role_id + in: path + description: The ID of the project role to remove from the group. + required: true + schema: + type: string + responses: + '200': + description: Project role unassigned from the group successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedRoleAssignmentResource' + x-oaiMeta: + name: Unassign project role from group + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/projects/proj_abc123/groups/group_01J1F8ABCDXYZ/roles/role_01J1F8PROJ + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.projects.groups.roles.delete('role_id', + { + project_id: 'project_id', + group_id: 'group_id', + }); + + + console.log(role.deleted); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.projects.groups.roles.delete( + role_id="role_id", + project_id="project_id", + group_id="group_id", + ) + print(role.deleted) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Projects.Groups.Roles.Delete(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"group_id\",\n\t\t\"role_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.Deleted)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.groups.roles.RoleDeleteParams; + + import + com.openai.models.admin.organization.projects.groups.roles.RoleDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleDeleteParams params = RoleDeleteParams.builder() + .projectId("project_id") + .groupId("group_id") + .roleId("role_id") + .build(); + RoleDeleteResponse role = client.admin().organization().projects().groups().roles().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + role = openai.admin.organization.projects.groups.roles.delete( + "role_id", + project_id: "project_id", + group_id: "group_id" + ) + + puts(role) + response: | + { + "object": "group.role.deleted", + "deleted": true + } + /projects/{project_id}/roles: + get: + security: + - AdminApiKeyAuth: [] + summary: Lists the roles configured for a project. + operationId: list-project-roles + tags: + - Roles + parameters: + - name: project_id + in: path + description: The ID of the project to inspect. + required: true + schema: + type: string + - name: limit + in: query + description: A limit on the number of roles to return. Defaults to 1000. + required: false + schema: + type: integer + minimum: 0 + maximum: 1000 + default: 1000 + - name: after + in: query + description: >- + Cursor for pagination. Provide the value from the previous + response's `next` field to continue listing roles. + required: false + schema: + type: string + - name: order + in: query + description: Sort order for the returned roles. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + responses: + '200': + description: Project roles listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/PublicRoleListResource' + x-oaiMeta: + name: List project roles + group: administration + examples: + request: + curl: > + curl https://api.openai.com/v1/projects/proj_abc123/roles?limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const role of + client.admin.organization.projects.roles.list('project_id')) { + console.log(role.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.projects.roles.list( + project_id="project_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Projects.Roles.List(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectRoleListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.roles.RoleListPage; + + import + com.openai.models.admin.organization.projects.roles.RoleListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleListPage page = client.admin().organization().projects().roles().list("project_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + page = openai.admin.organization.projects.roles.list("project_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "role", + "id": "role_01J1F8PROJ", + "name": "API Project Key Manager", + "description": "Allows managing API keys for the project", + "permissions": [ + "api.organization.projects.api_keys.read", + "api.organization.projects.api_keys.write" + ], + "resource_type": "api.project", + "predefined_role": false + } + ], + "has_more": false, + "next": null + } + post: + security: + - AdminApiKeyAuth: [] + summary: Creates a custom role for a project. + operationId: create-project-role + tags: + - Roles + parameters: + - name: project_id + in: path + description: The ID of the project to update. + required: true + schema: + type: string + requestBody: + description: Parameters for the project role you want to create. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PublicCreateOrganizationRoleBody' + responses: + '200': + description: Project role created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Role' + x-oaiMeta: + name: Create project role + group: administration + examples: + request: + curl: > + curl -X POST https://api.openai.com/v1/projects/proj_abc123/roles + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "role_name": "API Project Key Manager", + "permissions": [ + "api.organization.projects.api_keys.read", + "api.organization.projects.api_keys.write" + ], + "description": "Allows managing API keys for the project" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.projects.roles.create('project_id', { + permissions: ['string'], + role_name: 'role_name', + }); + + + console.log(role.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.projects.roles.create( + project_id="project_id", + permissions=["string"], + role_name="role_name", + ) + print(role.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Projects.Roles.New(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\topenai.AdminOrganizationProjectRoleNewParams{\n\t\t\tPermissions: []string{\"string\"},\n\t\t\tRoleName: \"role_name\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.roles.RoleCreateParams; + + import com.openai.models.admin.organization.roles.Role; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleCreateParams params = RoleCreateParams.builder() + .projectId("project_id") + .addPermission("string") + .roleName("role_name") + .build(); + Role role = client.admin().organization().projects().roles().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + role = openai.admin.organization.projects.roles.create( + "project_id", + permissions: ["string"], + role_name: "role_name" + ) + + puts(role) + response: | + { + "object": "role", + "id": "role_01J1F8PROJ", + "name": "API Project Key Manager", + "description": "Allows managing API keys for the project", + "permissions": [ + "api.organization.projects.api_keys.read", + "api.organization.projects.api_keys.write" + ], + "resource_type": "api.project", + "predefined_role": false + } + /projects/{project_id}/roles/{role_id}: + post: + security: + - AdminApiKeyAuth: [] + summary: Updates an existing project role. + operationId: update-project-role + tags: + - Roles + parameters: + - name: project_id + in: path + description: The ID of the project to update. + required: true + schema: + type: string + - name: role_id + in: path + description: The ID of the role to update. + required: true + schema: + type: string + requestBody: + description: Fields to update on the project role. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PublicUpdateOrganizationRoleBody' + responses: + '200': + description: Project role updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Role' + x-oaiMeta: + name: Update project role + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/projects/proj_abc123/roles/role_01J1F8PROJ + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "role_name": "API Project Key Manager", + "permissions": [ + "api.organization.projects.api_keys.read", + "api.organization.projects.api_keys.write" + ], + "description": "Allows managing API keys for the project" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.projects.roles.update('role_id', { + project_id: 'project_id', + }); + + + console.log(role.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.projects.roles.update( + role_id="role_id", + project_id="project_id", + ) + print(role.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Projects.Roles.Update(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"role_id\",\n\t\topenai.AdminOrganizationProjectRoleUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.roles.RoleUpdateParams; + + import com.openai.models.admin.organization.roles.Role; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleUpdateParams params = RoleUpdateParams.builder() + .projectId("project_id") + .roleId("role_id") + .build(); + Role role = client.admin().organization().projects().roles().update(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + role = openai.admin.organization.projects.roles.update("role_id", + project_id: "project_id") + + + puts(role) + response: | + { + "object": "role", + "id": "role_01J1F8PROJ", + "name": "API Project Key Manager", + "description": "Allows managing API keys for the project", + "permissions": [ + "api.organization.projects.api_keys.read", + "api.organization.projects.api_keys.write" + ], + "resource_type": "api.project", + "predefined_role": false + } + delete: + security: + - AdminApiKeyAuth: [] + summary: Deletes a custom role from a project. + operationId: delete-project-role + tags: + - Roles + parameters: + - name: project_id + in: path + description: The ID of the project to update. + required: true + schema: + type: string + - name: role_id + in: path + description: The ID of the role to delete. + required: true + schema: + type: string + responses: + '200': + description: Project role deleted successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/RoleDeletedResource' + x-oaiMeta: + name: Delete project role + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/projects/proj_abc123/roles/role_01J1F8PROJ + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.projects.roles.delete('role_id', { + project_id: 'project_id', + }); + + + console.log(role.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.projects.roles.delete( + role_id="role_id", + project_id="project_id", + ) + print(role.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Projects.Roles.Delete(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"role_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.roles.RoleDeleteParams; + + import + com.openai.models.admin.organization.projects.roles.RoleDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleDeleteParams params = RoleDeleteParams.builder() + .projectId("project_id") + .roleId("role_id") + .build(); + RoleDeleteResponse role = client.admin().organization().projects().roles().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + role = openai.admin.organization.projects.roles.delete("role_id", + project_id: "project_id") + + + puts(role) + response: | + { + "object": "role.deleted", + "id": "role_01J1F8PROJ", + "deleted": true + } + /projects/{project_id}/users/{user_id}/roles: + get: + security: + - AdminApiKeyAuth: [] + summary: Lists the project roles assigned to a user within a project. + operationId: list-project-user-role-assignments + tags: + - Project user role assignments + parameters: + - name: project_id + in: path + description: The ID of the project to inspect. + required: true + schema: + type: string + - name: user_id + in: path + description: The ID of the user to inspect. + required: true + schema: + type: string + - name: limit + in: query + description: A limit on the number of project role assignments to return. + required: false + schema: + type: integer + minimum: 0 + maximum: 1000 + - name: after + in: query + description: >- + Cursor for pagination. Provide the value from the previous + response's `next` field to continue listing project roles. + required: false + schema: + type: string + - name: order + in: query + description: Sort order for the returned project roles. + required: false + schema: + type: string + enum: + - asc + - desc + responses: + '200': + description: Project user role assignments listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/RoleListResource' + 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 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const roleListResponse of + client.admin.organization.projects.users.roles.list( + 'user_id', + { project_id: 'project_id' }, + )) { + console.log(roleListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + page = client.admin.organization.projects.users.roles.list( + user_id="user_id", + project_id="project_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.Projects.Users.Roles.List(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"user_id\",\n\t\topenai.AdminOrganizationProjectUserRoleListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.users.roles.RoleListPage; + + import + com.openai.models.admin.organization.projects.users.roles.RoleListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleListParams params = RoleListParams.builder() + .projectId("project_id") + .userId("user_id") + .build(); + RoleListPage page = client.admin().organization().projects().users().roles().list(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + page = + openai.admin.organization.projects.users.roles.list("user_id", + project_id: "project_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "role_01J1F8PROJ", + "name": "API Project Key Manager", + "permissions": [ + "api.organization.projects.api_keys.read", + "api.organization.projects.api_keys.write" + ], + "resource_type": "api.project", + "predefined_role": false, + "description": "Allows managing API keys for the project", + "created_at": 1711471533, + "updated_at": 1711472599, + "created_by": "user_abc123", + "created_by_user_obj": { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + }, + "metadata": {} + } + ], + "has_more": false, + "next": null + } + post: + security: + - AdminApiKeyAuth: [] + summary: Assigns a project role to a user within a project. + operationId: assign-project-user-role + tags: + - Project user role assignments + parameters: + - name: project_id + in: path + description: The ID of the project to update. + required: true + schema: + type: string + - name: user_id + in: path + description: The ID of the user that should receive the project role. + required: true + schema: + type: string + requestBody: + description: Identifies the project role to assign to the user. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PublicAssignOrganizationGroupRoleBody' + responses: + '200': + description: Project role assigned to the user successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/UserRoleAssignment' + x-oaiMeta: + name: Assign project role to user + group: administration + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "role_id": "role_01J1F8PROJ" + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.projects.users.roles.create('user_id', { + project_id: 'project_id', + role_id: 'role_id', + }); + + + console.log(role.object); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.projects.users.roles.create( + user_id="user_id", + project_id="project_id", + role_id="role_id", + ) + print(role.object) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Projects.Users.Roles.New(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"user_id\",\n\t\topenai.AdminOrganizationProjectUserRoleNewParams{\n\t\t\tRoleID: \"role_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.Object)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.users.roles.RoleCreateParams; + + import + com.openai.models.admin.organization.projects.users.roles.RoleCreateResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleCreateParams params = RoleCreateParams.builder() + .projectId("project_id") + .userId("user_id") + .roleId("role_id") + .build(); + RoleCreateResponse role = client.admin().organization().projects().users().roles().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + role = openai.admin.organization.projects.users.roles.create( + "user_id", + project_id: "project_id", + role_id: "role_id" + ) + + puts(role) + response: | + { + "object": "user.role", + "user": { + "object": "organization.user", + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com", + "role": "owner", + "added_at": 1711470000 + }, + "role": { + "object": "role", + "id": "role_01J1F8PROJ", + "name": "API Project Key Manager", + "description": "Allows managing API keys for the project", + "permissions": [ + "api.organization.projects.api_keys.read", + "api.organization.projects.api_keys.write" + ], + "resource_type": "api.project", + "predefined_role": false + } + } + /projects/{project_id}/users/{user_id}/roles/{role_id}: + delete: + security: + - AdminApiKeyAuth: [] + summary: Unassigns a project role from a user within a project. + operationId: unassign-project-user-role + tags: + - Project user role assignments + parameters: + - name: project_id + in: path + description: The ID of the project to modify. + required: true + schema: + type: string + - name: user_id + in: path + description: The ID of the user whose project role assignment should be removed. + required: true + schema: + type: string + - name: role_id + in: path + description: The ID of the project role to remove from the user. + required: true + schema: + type: string + responses: + '200': + description: Project role unassigned from the user successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedRoleAssignmentResource' + x-oaiMeta: + name: Unassign project role from user + group: administration + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles/role_01J1F8PROJ + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const role = await + client.admin.organization.projects.users.roles.delete('role_id', { + project_id: 'project_id', + user_id: 'user_id', + }); + + + console.log(role.deleted); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + role = client.admin.organization.projects.users.roles.delete( + role_id="role_id", + project_id="project_id", + user_id="user_id", + ) + print(role.deleted) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\trole, err := client.Admin.Organization.Projects.Users.Roles.Delete(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"user_id\",\n\t\t\"role_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", role.Deleted)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.users.roles.RoleDeleteParams; + + import + com.openai.models.admin.organization.projects.users.roles.RoleDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RoleDeleteParams params = RoleDeleteParams.builder() + .projectId("project_id") + .userId("user_id") + .roleId("role_id") + .build(); + RoleDeleteResponse role = client.admin().organization().projects().users().roles().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + role = openai.admin.organization.projects.users.roles.delete( + "role_id", + project_id: "project_id", + user_id: "user_id" + ) + + puts(role) + response: | + { + "object": "user.role.deleted", + "deleted": true + } + /realtime/calls: + post: + summary: >- + Create a new Realtime API call over WebRTC and receive the SDP answer + needed + + to complete the peer connection. + operationId: create-realtime-call + tags: + - Realtime + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/RealtimeCallCreateRequest' + encoding: + sdp: + contentType: application/sdp + session: + contentType: application/json + application/sdp: + schema: + type: string + description: >- + WebRTC SDP offer. Use this variant when you have previously + created an + + ephemeral **session token** and are authenticating the request + with it. + + Realtime session parameters will be retrieved from the session + token. + responses: + '201': + description: Realtime call created successfully. + headers: + Location: + description: >- + Relative URL containing the call ID for subsequent control + requests. + schema: + type: string + content: + application/sdp: + schema: + type: string + description: SDP answer produced by OpenAI for the peer connection. + x-oaiMeta: + name: Create call + group: realtime + returns: >- + Returns `201 Created` with the SDP answer in the response body. The + + `Location` response header includes the call ID for follow-up + requests, + + e.g., establishing a monitoring WebSocket or hanging up the call. + examples: + request: + curl: |- + curl -X POST https://api.openai.com/v1/realtime/calls \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F "sdp=- + v=0 + + o=- 4227147428 1719357865 IN IP4 127.0.0.1 + + s=- + + c=IN IP4 0.0.0.0 + + t=0 0 + + a=group:BUNDLE 0 1 + + a=msid-semantic:WMS * + + a=fingerprint:sha-256 + CA:92:52:51:B4:91:3B:34:DD:9C:0B:FB:76:19:7E:3B:F1:21:0F:32:2C:38:01:72:5D:3F:78:C7:5F:8B:C7:36 + + m=audio 9 UDP/TLS/RTP/SAVPF 111 0 8 + + a=mid:0 + + a=ice-ufrag:kZ2qkHXX/u11 + + a=ice-pwd:uoD16Di5OGx3VbqgA3ymjEQV2kwiOjw6 + + a=setup:active + + a=rtcp-mux + + a=rtpmap:111 opus/48000/2 + + a=candidate:993865896 1 udp 2130706431 4.155.146.196 3478 typ host + ufrag kZ2qkHXX/u11 + + a=candidate:1432411780 1 tcp 1671430143 4.155.146.196 443 typ host + tcptype passive ufrag kZ2qkHXX/u11 + + m=application 9 UDP/DTLS/SCTP webrtc-datachannel + + a=mid:1 + + a=sctp-port:5000 + /realtime/calls/{call_id}/accept: + post: + summary: |- + Accept an incoming SIP call and configure the realtime session that will + handle it. + operationId: accept-realtime-call + tags: + - Realtime + parameters: + - in: path + name: call_id + required: true + schema: + type: string + description: >- + The identifier for the call provided in the + + [`realtime.call.incoming`](/docs/api-reference/webhook-events/realtime/call/incoming) + + webhook. + requestBody: + required: true + description: >- + Session configuration to apply before the caller is bridged to the + model. + content: + application/json: + schema: + $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' + responses: + '200': + description: Call accepted successfully. + x-oaiMeta: + name: Accept call + group: realtime-calls + returns: >- + Returns `200 OK` once OpenAI starts ringing the SIP leg with the + supplied + + session configuration. + examples: + request: + curl: >- + curl -X POST + https://api.openai.com/v1/realtime/calls/$CALL_ID/accept \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "type": "realtime", + "model": "gpt-realtime", + "instructions": "You are Alex, a friendly concierge for Example Corp.", + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + await client.realtime.calls.accept('call_id', { type: 'realtime' + }); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.realtime.calls.accept( + call_id="call_id", + type="realtime", + ) + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/realtime\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Realtime.Calls.Accept(\n\t\tcontext.TODO(),\n\t\t\"call_id\",\n\t\trealtime.CallAcceptParams{\n\t\t\tRealtimeSessionCreateRequest: realtime.RealtimeSessionCreateRequestParam{},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.realtime.RealtimeSessionCreateRequest; + import com.openai.models.realtime.calls.CallAcceptParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CallAcceptParams params = CallAcceptParams.builder() + .callId("call_id") + .realtimeSessionCreateRequest(RealtimeSessionCreateRequest.builder().build()) + .build(); + client.realtime().calls().accept(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + result = openai.realtime.calls.accept("call_id", type: :realtime) + + puts(result) + response: '' + /realtime/calls/{call_id}/hangup: + post: + summary: |- + End an active Realtime API call, whether it was initiated over SIP or + WebRTC. + operationId: hangup-realtime-call + tags: + - Realtime + parameters: + - in: path + name: call_id + required: true + schema: + type: string + description: >- + The identifier for the call. For SIP calls, use the value provided + in the + + [`realtime.call.incoming`](/docs/api-reference/webhook-events/realtime/call/incoming) + + webhook. For WebRTC sessions, reuse the call ID returned in the + `Location` + + header when creating the call with + + [`POST + /v1/realtime/calls`](/docs/api-reference/realtime/create-call). + responses: + '200': + description: Call hangup initiated successfully. + x-oaiMeta: + name: Hang up call + group: realtime-calls + returns: Returns `200 OK` when OpenAI begins terminating the realtime call. + examples: + request: + curl: >- + curl -X POST + https://api.openai.com/v1/realtime/calls/$CALL_ID/hangup \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + await client.realtime.calls.hangup('call_id'); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.realtime.calls.hangup( + "call_id", + ) + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Realtime.Calls.Hangup(context.TODO(), \"call_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.realtime.calls.CallHangupParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + client.realtime().calls().hangup("call_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + result = openai.realtime.calls.hangup("call_id") + + puts(result) + response: '' + /realtime/calls/{call_id}/refer: + post: + summary: >- + Transfer an active SIP call to a new destination using the SIP REFER + verb. + operationId: refer-realtime-call + tags: + - Realtime + parameters: + - in: path + name: call_id + required: true + schema: + type: string + description: >- + The identifier for the call provided in the + + [`realtime.call.incoming`](/docs/api-reference/webhook-events/realtime/call/incoming) + + webhook. + requestBody: + required: true + description: Destination URI for the REFER request. + content: + application/json: + schema: + $ref: '#/components/schemas/RealtimeCallReferRequest' + responses: + '200': + description: Call referred successfully. + x-oaiMeta: + name: Refer call + group: realtime-calls + returns: Returns `200 OK` once the REFER is handed off to your SIP provider. + examples: + request: + curl: >- + curl -X POST + https://api.openai.com/v1/realtime/calls/$CALL_ID/refer \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"target_uri": "tel:+14155550123"}' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + await client.realtime.calls.refer('call_id', { target_uri: + 'tel:+14155550123' }); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.realtime.calls.refer( + call_id="call_id", + target_uri="tel:+14155550123", + ) + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/realtime\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Realtime.Calls.Refer(\n\t\tcontext.TODO(),\n\t\t\"call_id\",\n\t\trealtime.CallReferParams{\n\t\t\tTargetUri: \"tel:+14155550123\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.realtime.calls.CallReferParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CallReferParams params = CallReferParams.builder() + .callId("call_id") + .targetUri("tel:+14155550123") + .build(); + client.realtime().calls().refer(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + result = openai.realtime.calls.refer("call_id", target_uri: + "tel:+14155550123") + + + puts(result) + response: '' + /realtime/calls/{call_id}/reject: + post: + summary: >- + Decline an incoming SIP call by returning a SIP status code to the + caller. + operationId: reject-realtime-call + tags: + - Realtime + parameters: + - in: path + name: call_id + required: true + schema: + type: string + description: >- + The identifier for the call provided in the + + [`realtime.call.incoming`](/docs/api-reference/webhook-events/realtime/call/incoming) + + webhook. + requestBody: + required: false + description: >- + Provide an optional SIP status code. When omitted the API responds + with + + `603 Decline`. + content: + application/json: + schema: + $ref: '#/components/schemas/RealtimeCallRejectRequest' + responses: + '200': + description: Call rejected successfully. + x-oaiMeta: + name: Reject call + group: realtime-calls + returns: Returns `200 OK` after OpenAI sends the SIP status code to the caller. + examples: + request: + curl: >- + curl -X POST + https://api.openai.com/v1/realtime/calls/$CALL_ID/reject \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"status_code": 486}' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + await client.realtime.calls.reject('call_id'); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.realtime.calls.reject( + call_id="call_id", + ) + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/realtime\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Realtime.Calls.Reject(\n\t\tcontext.TODO(),\n\t\t\"call_id\",\n\t\trealtime.CallRejectParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.realtime.calls.CallRejectParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + client.realtime().calls().reject("call_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + result = openai.realtime.calls.reject("call_id") + + puts(result) + response: '' + /realtime/client_secrets: + post: + summary: > + Create a Realtime client secret with an associated session + configuration. + + + Client secrets are short-lived tokens that can be passed to a client + app, + + such as a web frontend or mobile client, which grants access to the + Realtime API without + + leaking your main API key. You can configure a custom TTL for each + client secret. + + + You can also attach session configuration options to the client secret, + which will be + + applied to any sessions created using that client secret, but these can + also be overridden + + by the client connection. + + + [Learn more about authentication with client secrets over + WebRTC](/docs/guides/realtime-webrtc). + + + Returns the created client secret and the effective session object. The + client secret is a string that looks like `ek_1234`. + operationId: create-realtime-client-secret + tags: + - Realtime + requestBody: + description: Create a client secret with the given session configuration. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RealtimeCreateClientSecretRequest' + responses: + '200': + description: Client secret created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/RealtimeCreateClientSecretResponse' + x-oaiMeta: + name: Create client secret + group: realtime + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/realtime/client_secrets \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "expires_after": { + "anchor": "created_at", + "seconds": 600 + }, + "session": { + "type": "realtime", + "model": "gpt-realtime", + "instructions": "You are a friendly assistant." + } + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const clientSecret = await client.realtime.clientSecrets.create(); + + console.log(clientSecret.expires_at); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client_secret = client.realtime.client_secrets.create() + print(client_secret.expires_at) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/realtime\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tclientSecret, err := client.Realtime.ClientSecrets.New(context.TODO(), realtime.ClientSecretNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", clientSecret.ExpiresAt)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.realtime.clientsecrets.ClientSecretCreateParams; + + import + com.openai.models.realtime.clientsecrets.ClientSecretCreateResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ClientSecretCreateResponse clientSecret = client.realtime().clientSecrets().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + client_secret = openai.realtime.client_secrets.create + + puts(client_secret) + response: | + { + "value": "ek_68af296e8e408191a1120ab6383263c2", + "expires_at": 1756310470, + "session": { + "type": "realtime", + "object": "realtime.session", + "id": "sess_C9CiUVUzUzYIssh3ELY1d", + "model": "gpt-realtime", + "output_modalities": [ + "audio" + ], + "instructions": "You are a friendly assistant.", + "tools": [], + "tool_choice": "auto", + "max_output_tokens": "inf", + "tracing": null, + "truncation": "auto", + "prompt": null, + "expires_at": 0, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy", + "speed": 1.0 + } + }, + "include": null + } + } + /realtime/sessions: + post: + summary: > + Create an ephemeral API token for use in client-side applications with + the + + Realtime API. Can be configured with the same session parameters as the + + `session.update` client event. + + + It responds with a session object, plus a `client_secret` key which + contains + + a usable ephemeral API token that can be used to authenticate browser + clients + + for the Realtime API. + + + Returns the created Realtime session object, plus an ephemeral key. + operationId: create-realtime-session + tags: + - Realtime + requestBody: + description: Create an ephemeral API key with the given session configuration. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RealtimeSessionCreateRequest' + responses: + '200': + description: Session created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/RealtimeSessionCreateResponse' + x-oaiMeta: + name: Create session + group: realtime + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/realtime/sessions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "gpt-realtime", + "modalities": ["audio", "text"], + "instructions": "You are a friendly assistant." + }' + response: | + { + "id": "sess_001", + "object": "realtime.session", + "model": "gpt-realtime-2025-08-25", + "modalities": ["audio", "text"], + "instructions": "You are a friendly assistant.", + "voice": "alloy", + "input_audio_format": "pcm16", + "output_audio_format": "pcm16", + "input_audio_transcription": { + "model": "whisper-1" + }, + "turn_detection": null, + "tools": [], + "tool_choice": "none", + "temperature": 0.7, + "max_response_output_tokens": 200, + "speed": 1.1, + "tracing": "auto", + "client_secret": { + "value": "ek_abc123", + "expires_at": 1234567890 + } + } + /realtime/transcription_sessions: + post: + summary: > + Create an ephemeral API token for use in client-side applications with + the + + Realtime API specifically for realtime transcriptions. + + Can be configured with the same session parameters as the + `transcription_session.update` client event. + + + It responds with a session object, plus a `client_secret` key which + contains + + a usable ephemeral API token that can be used to authenticate browser + clients + + for the Realtime API. + + + Returns the created Realtime transcription session object, plus an + ephemeral key. + operationId: create-realtime-transcription-session + tags: + - Realtime + requestBody: + description: Create an ephemeral API key with the given session configuration. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequest' + responses: + '200': + description: Session created successfully. + content: + application/json: + schema: + $ref: >- + #/components/schemas/RealtimeTranscriptionSessionCreateResponse + x-oaiMeta: + name: Create transcription session + group: realtime + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/realtime/transcription_sessions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{}' + response: | + { + "id": "sess_BBwZc7cFV3XizEyKGDCGL", + "object": "realtime.transcription_session", + "modalities": ["audio", "text"], + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200 + }, + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "language": null, + "prompt": "" + }, + "client_secret": null + } + /realtime/translations/client_secrets: + post: + summary: > + Create a Realtime translation client secret with an associated + translation session configuration. + + + Client secrets are short-lived tokens that can be passed to a client + app, + + such as a web frontend or mobile client, which grants access to the + Realtime + + Translation API without leaking your main API key. You can configure a + custom + + TTL for each client secret. + + + Returns the created client secret and the effective translation session + object. + + The client secret is a string that looks like `ek_1234`. + operationId: create-realtime-translation-client-secret + tags: + - Realtime + requestBody: + description: >- + Create a client secret with the given translation session + configuration. + required: true + content: + application/json: + schema: + $ref: >- + #/components/schemas/RealtimeTranslationClientSecretCreateRequest + responses: + '200': + description: Translation client secret created successfully. + content: + application/json: + schema: + $ref: >- + #/components/schemas/RealtimeTranslationClientSecretCreateResponse + x-oaiMeta: + name: Create translation client secret + group: realtime + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/realtime/translations/client_secrets \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "expires_after": { + "anchor": "created_at", + "seconds": 600 + }, + "session": { + "model": "gpt-realtime-translate", + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper" + }, + "noise_reduction": null + }, + "output": { + "language": "es" + } + } + } + }' + response: | + { + "value": "ek_68af296e8e408191a1120ab6383263c2", + "expires_at": 1756310470, + "session": { + "id": "sess_C9CiUVUzUzYIssh3ELY1d", + "type": "translation", + "expires_at": 1756310470, + "model": "gpt-realtime-translate", + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper" + }, + "noise_reduction": null + }, + "output": { + "language": "es" + } + } + } + } + /responses: + post: + operationId: createResponse + tags: + - Responses + summary: > + Creates a model response. Provide [text](/docs/guides/text) or + + [image](/docs/guides/images) inputs to generate + [text](/docs/guides/text) + + or [JSON](/docs/guides/structured-outputs) outputs. Have the model call + + your own [custom code](/docs/guides/function-calling) or use built-in + + [tools](/docs/guides/tools) like [web + search](/docs/guides/tools-web-search) + + or [file search](/docs/guides/tools-file-search) to use your own data + + as input for the model's response. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateResponse' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + text/event-stream: + schema: + $ref: '#/components/schemas/ResponseStreamEvent' + x-oaiMeta: + name: Create a model response + group: responses + path: create + examples: + - title: Text input + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "input": "Tell me a three sentence bedtime story about a unicorn." + }' + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-5.4", + input: "Tell me a three sentence bedtime story about a unicorn." + }); + + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.responses.create(): + print(response) + csharp: > + using System; + + using OpenAI.Responses; + + + OpenAIResponseClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + OpenAIResponse response = client.CreateResponse("Tell me a three + sentence bedtime story about a unicorn."); + + + Console.WriteLine(response.GetOutputText()); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.responses.create(); + + console.log(response.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Responses.New(context.TODO(), responses.ResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.Response; + import com.openai.models.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Response response = client.responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.responses.create + + puts(response) + response: | + { + "id": "resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b", + "object": "response", + "created_at": 1741476542, + "status": "completed", + "completed_at": 1741476543, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-5.4", + "output": [ + { + "type": "message", + "id": "msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "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.", + "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": 36, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 87, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 123 + }, + "user": null, + "metadata": {} + } + - title: Image input + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "input": [ + { + "role": "user", + "content": [ + {"type": "input_text", "text": "what is in this image?"}, + { + "type": "input_image", + "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" + } + ] + } + ] + }' + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-5.4", + input: [ + { + role: "user", + content: [ + { type: "input_text", text: "what is in this image?" }, + { + type: "input_image", + 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", + }, + ], + }, + ], + }); + + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.responses.create(): + print(response) + csharp: | + using System; + using System.Collections.Generic; + + using OpenAI.Responses; + + OpenAIResponseClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + List inputItems = + [ + ResponseItem.CreateUserMessageItem( + [ + ResponseContentPart.CreateInputTextPart("What is in this image?"), + 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")) + ] + ) + ]; + + OpenAIResponse response = client.CreateResponse(inputItems); + + Console.WriteLine(response.GetOutputText()); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.responses.create(); + + console.log(response.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Responses.New(context.TODO(), responses.ResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.Response; + import com.openai.models.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Response response = client.responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.responses.create + + puts(response) + response: | + { + "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-5.4", + "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": [] + } + ] + } + ], + "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": 328, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 52, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 380 + }, + "user": null, + "metadata": {} + } + - title: File input + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "input": [ + { + "role": "user", + "content": [ + {"type": "input_text", "text": "what is in this file?"}, + { + "type": "input_file", + "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf" + } + ] + } + ] + }' + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-5.4", + input: [ + { + role: "user", + content: [ + { type: "input_text", text: "what is in this file?" }, + { + type: "input_file", + file_url: "https://www.berkshirehathaway.com/letters/2024ltr.pdf", + }, + ], + }, + ], + }); + + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.responses.create(): + print(response) + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.responses.create(); + + console.log(response.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Responses.New(context.TODO(), responses.ResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.Response; + import com.openai.models.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Response response = client.responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.responses.create + + puts(response) + response: | + { + "id": "resp_686eef60237881a2bd1180bb8b13de430e34c516d176ff86", + "object": "response", + "created_at": 1752100704, + "status": "completed", + "completed_at": 1752100705, + "background": false, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-5.4", + "output": [ + { + "id": "msg_686eef60d3e081a29283bdcbc4322fd90e34c516d176ff86", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "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." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 8438, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 398, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 8836 + }, + "user": null, + "metadata": {} + } + - title: Web search + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "tools": [{ "type": "web_search_preview" }], + "input": "What was a positive news story from today?" + }' + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-5.4", + tools: [{ type: "web_search_preview" }], + input: "What was a positive news story from today?", + }); + + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.responses.create(): + print(response) + csharp: > + using System; + + + using OpenAI.Responses; + + + OpenAIResponseClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + string userInputText = "What was a positive news story from + today?"; + + + ResponseCreationOptions options = new() + + { + Tools = + { + ResponseTool.CreateWebSearchTool() + }, + }; + + + OpenAIResponse response = client.CreateResponse(userInputText, + options); + + + Console.WriteLine(response.GetOutputText()); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.responses.create(); + + console.log(response.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Responses.New(context.TODO(), responses.ResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.Response; + import com.openai.models.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Response response = client.responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.responses.create + + puts(response) + response: | + { + "id": "resp_67ccf18ef5fc8190b16dbee19bc54e5f087bb177ab789d5c", + "object": "response", + "created_at": 1741484430, + "status": "completed", + "completed_at": 1741484431, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-5.4", + "output": [ + { + "type": "web_search_call", + "id": "ws_67ccf18f64008190a39b619f4c8455ef087bb177ab789d5c", + "status": "completed" + }, + { + "type": "message", + "id": "msg_67ccf190ca3881909d433c50b1f6357e087bb177ab789d5c", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "As of today, March 9, 2025, one notable positive news story...", + "annotations": [ + { + "type": "url_citation", + "start_index": 442, + "end_index": 557, + "url": "https://.../?utm_source=chatgpt.com", + "title": "..." + }, + { + "type": "url_citation", + "start_index": 962, + "end_index": 1077, + "url": "https://.../?utm_source=chatgpt.com", + "title": "..." + }, + { + "type": "url_citation", + "start_index": 1336, + "end_index": 1451, + "url": "https://.../?utm_source=chatgpt.com", + "title": "..." + } + ] + } + ] + } + ], + "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": [ + { + "type": "web_search_preview", + "domains": [], + "search_context_size": "medium", + "user_location": { + "type": "approximate", + "city": null, + "country": "US", + "region": null, + "timezone": null + } + } + ], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 328, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 356, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 684 + }, + "user": null, + "metadata": {} + } + - title: File search + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "tools": [{ + "type": "file_search", + "vector_store_ids": ["vs_1234567890"], + "max_num_results": 20 + }], + "input": "What are the attributes of an ancient brown dragon?" + }' + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-5.4", + tools: [{ + type: "file_search", + vector_store_ids: ["vs_1234567890"], + max_num_results: 20 + }], + input: "What are the attributes of an ancient brown dragon?", + }); + + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.responses.create(): + print(response) + csharp: > + using System; + + + using OpenAI.Responses; + + + OpenAIResponseClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + string userInputText = "What are the attributes of an ancient + brown dragon?"; + + + ResponseCreationOptions options = new() + + { + Tools = + { + ResponseTool.CreateFileSearchTool( + vectorStoreIds: ["vs_1234567890"], + maxResultCount: 20 + ) + }, + }; + + + OpenAIResponse response = client.CreateResponse(userInputText, + options); + + + Console.WriteLine(response.GetOutputText()); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.responses.create(); + + console.log(response.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Responses.New(context.TODO(), responses.ResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.Response; + import com.openai.models.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Response response = client.responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.responses.create + + puts(response) + response: | + { + "id": "resp_67ccf4c55fc48190b71bd0463ad3306d09504fb6872380d7", + "object": "response", + "created_at": 1741485253, + "status": "completed", + "completed_at": 1741485254, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-5.4", + "output": [ + { + "type": "file_search_call", + "id": "fs_67ccf4c63cd08190887ef6464ba5681609504fb6872380d7", + "status": "completed", + "queries": [ + "attributes of an ancient brown dragon" + ], + "results": null + }, + { + "type": "message", + "id": "msg_67ccf4c93e5c81909d595b369351a9d309504fb6872380d7", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "The attributes of an ancient brown dragon include...", + "annotations": [ + { + "type": "file_citation", + "index": 320, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 576, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 815, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 815, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 1030, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 1030, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 1156, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 1225, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + } + ] + } + ] + } + ], + "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": [ + { + "type": "file_search", + "filters": null, + "max_num_results": 20, + "ranking_options": { + "ranker": "auto", + "score_threshold": 0.0 + }, + "vector_store_ids": [ + "vs_1234567890" + ] + } + ], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 18307, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 348, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18655 + }, + "user": null, + "metadata": {} + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "instructions": "You are a helpful assistant.", + "input": "Hello!", + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.responses.create(): + print(response) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-5.4", + instructions: "You are a helpful assistant.", + input: "Hello!", + stream: true, + }); + + for await (const event of response) { + console.log(event); + } + csharp: > + using System; + + using System.ClientModel; + + using System.Threading.Tasks; + + + using OpenAI.Responses; + + + OpenAIResponseClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + string userInputText = "Hello!"; + + + ResponseCreationOptions options = new() + + { + Instructions = "You are a helpful assistant.", + }; + + + AsyncCollectionResult responseUpdates = + client.CreateResponseStreamingAsync(userInputText, options); + + + await foreach (StreamingResponseUpdate responseUpdate in + responseUpdates) + + { + if (responseUpdate is StreamingResponseOutputTextDeltaUpdate outputTextDeltaUpdate) + { + Console.Write(outputTextDeltaUpdate.Delta); + } + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.responses.create(); + + console.log(response.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Responses.New(context.TODO(), responses.ResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.Response; + import com.openai.models.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Response response = client.responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.responses.create + + puts(response) + response: > + event: response.created + + data: + {"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-5.4","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":{}}} + + + event: response.in_progress + + data: + {"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-5.4","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":{}}} + + + event: response.output_item.added + + data: + {"type":"response.output_item.added","output_index":0,"item":{"id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","type":"message","status":"in_progress","role":"assistant","content":[]}} + + + event: response.content_part.added + + data: + {"type":"response.content_part.added","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"part":{"type":"output_text","text":"","annotations":[]}} + + + event: response.output_text.delta + + data: + {"type":"response.output_text.delta","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"delta":"Hi"} + + + ... + + + event: response.output_text.done + + data: + {"type":"response.output_text.done","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"text":"Hi + there! How can I assist you today?"} + + + event: response.content_part.done + + data: + {"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":[]}} + + + event: response.output_item.done + + data: + {"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":[]}]}} + + + event: response.completed + + data: + {"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-5.4","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":{}}} + - title: Functions + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "input": "What is the weather like in Boston today?", + "tools": [ + { + "type": "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", "unit"] + } + } + ], + "tool_choice": "auto" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.responses.create(): + print(response) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const tools = [ + { + type: "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", "unit"], + }, + }, + ]; + + const response = await openai.responses.create({ + model: "gpt-5.4", + tools: tools, + input: "What is the weather like in Boston today?", + tool_choice: "auto", + }); + + console.log(response); + csharp: > + using System; + + using OpenAI.Responses; + + + OpenAIResponseClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + ResponseTool getCurrentWeatherFunctionTool = + ResponseTool.CreateFunctionTool( + functionName: "get_current_weather", + functionDescription: "Get the current weather in a given location", + functionParameters: BinaryData.FromString(""" + { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA" + }, + "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]} + }, + "required": ["location", "unit"] + } + """ + ) + ); + + + string userInputText = "What is the weather like in Boston + today?"; + + + ResponseCreationOptions options = new() + + { + Tools = + { + getCurrentWeatherFunctionTool + }, + ToolChoice = ResponseToolChoice.CreateAutoChoice(), + }; + + + OpenAIResponse response = client.CreateResponse(userInputText, + options); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.responses.create(); + + console.log(response.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Responses.New(context.TODO(), responses.ResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.Response; + import com.openai.models.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Response response = client.responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.responses.create + + puts(response) + response: | + { + "id": "resp_67ca09c5efe0819096d0511c92b8c890096610f474011cc0", + "object": "response", + "created_at": 1741294021, + "status": "completed", + "completed_at": 1741294022, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-5.4", + "output": [ + { + "type": "function_call", + "id": "fc_67ca09c6bedc8190a7abfec07b1a1332096610f474011cc0", + "call_id": "call_unLAR8MvFNptuiZK6K6HCy5k", + "name": "get_current_weather", + "arguments": "{\"location\":\"Boston, MA\",\"unit\":\"celsius\"}", + "status": "completed" + } + ], + "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": [ + { + "type": "function", + "description": "Get the current weather in a given location", + "name": "get_current_weather", + "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", + "unit" + ] + }, + "strict": true + } + ], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 291, + "output_tokens": 23, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 314 + }, + "user": null, + "metadata": {} + } + - title: Reasoning + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "o3-mini", + "input": "How much wood would a woodchuck chuck?", + "reasoning": { + "effort": "high" + } + }' + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "o3-mini", + input: "How much wood would a woodchuck chuck?", + reasoning: { + effort: "high" + } + }); + + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.responses.create(): + print(response) + csharp: > + using System; + + using OpenAI.Responses; + + + OpenAIResponseClient client = new( + model: "o3-mini", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + string userInputText = "How much wood would a woodchuck chuck?"; + + + ResponseCreationOptions options = new() + + { + ReasoningOptions = new() + { + ReasoningEffortLevel = ResponseReasoningEffortLevel.High, + }, + }; + + + OpenAIResponse response = client.CreateResponse(userInputText, + options); + + + Console.WriteLine(response.GetOutputText()); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.responses.create(); + + console.log(response.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Responses.New(context.TODO(), responses.ResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.Response; + import com.openai.models.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Response response = client.responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.responses.create + + puts(response) + response: | + { + "id": "resp_67ccd7eca01881908ff0b5146584e408072912b2993db808", + "object": "response", + "created_at": 1741477868, + "status": "completed", + "completed_at": 1741477869, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "o1-2024-12-17", + "output": [ + { + "type": "message", + "id": "msg_67ccd7f7b5848190a6f3e95d809f6b44072912b2993db808", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "The classic tongue twister...", + "annotations": [] + } + ] + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": "high", + "summary": null + }, + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 81, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 1035, + "output_tokens_details": { + "reasoning_tokens": 832 + }, + "total_tokens": 1116 + }, + "user": null, + "metadata": {} + } + /responses/{response_id}: + get: + operationId: getResponse + tags: + - Responses + summary: | + Retrieves a model response with the given ID. + parameters: + - in: path + name: response_id + required: true + schema: + type: string + example: resp_677efb5139a88190b512bc3fef8e535d + description: The ID of the response to retrieve. + - in: query + name: include + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: | + Additional fields to include in the response. See the `include` + parameter for Response creation above for more information. + - in: query + name: stream + schema: + type: boolean + description: > + If set to true, the model response data will be streamed to the + client + + as 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). + + See the [Streaming section + below](/docs/api-reference/responses-streaming) + + for more information. + - in: query + name: starting_after + schema: + type: integer + description: | + The sequence number of the event after which to start streaming. + - in: query + name: include_obfuscation + schema: + type: boolean + description: > + When true, stream obfuscation will be enabled. Stream obfuscation + adds + + random characters to an `obfuscation` field on streaming delta + events + + to normalize payload sizes as a mitigation to certain side-channel + + attacks. These obfuscation fields are included by default, but add a + + small amount of overhead to the data stream. You can set + + `include_obfuscation` to false to optimize for bandwidth if you + trust + + the network links between your application and the OpenAI API. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + x-oaiMeta: + name: Get a model response + group: responses + examples: + request: + curl: | + curl https://api.openai.com/v1/responses/resp_123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const response = await client.responses.retrieve("resp_123"); + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.responses.retrieve( + response_id="resp_677efb5139a88190b512bc3fef8e535d", + ): + print(response) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const response = await + client.responses.retrieve('resp_677efb5139a88190b512bc3fef8e535d'); + + + console.log(response.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Responses.Get(\n\t\tcontext.TODO(),\n\t\t\"resp_677efb5139a88190b512bc3fef8e535d\",\n\t\tresponses.ResponseGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.Response; + import com.openai.models.responses.ResponseRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Response response = client.responses().retrieve("resp_677efb5139a88190b512bc3fef8e535d"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + response = + openai.responses.retrieve("resp_677efb5139a88190b512bc3fef8e535d") + + + puts(response) + response: | + { + "id": "resp_67cb71b351908190a308f3859487620d06981a8637e6bc44", + "object": "response", + "created_at": 1741386163, + "status": "completed", + "completed_at": 1741386164, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-2024-08-06", + "output": [ + { + "type": "message", + "id": "msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "Silent circuits hum, \nThoughts emerge in data streams— \nDigital dawn breaks.", + "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": 32, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 18, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 50 + }, + "user": null, + "metadata": {} + } + delete: + operationId: deleteResponse + tags: + - Responses + summary: | + Deletes a model response with the given ID. + parameters: + - in: path + name: response_id + required: true + schema: + type: string + example: resp_677efb5139a88190b512bc3fef8e535d + description: The ID of the response to delete. + responses: + '200': + description: OK + '404': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Delete a model response + group: responses + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/responses/resp_123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const response = await client.responses.delete("resp_123"); + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.responses.delete( + "resp_677efb5139a88190b512bc3fef8e535d", + ) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + await + client.responses.delete('resp_677efb5139a88190b512bc3fef8e535d'); + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Responses.Delete(context.TODO(), \"resp_677efb5139a88190b512bc3fef8e535d\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.ResponseDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + client.responses().delete("resp_677efb5139a88190b512bc3fef8e535d"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + result = + openai.responses.delete("resp_677efb5139a88190b512bc3fef8e535d") + + + puts(result) + response: | + { + "id": "resp_6786a1bec27481909a17d673315b29f6", + "object": "response", + "deleted": true + } + /responses/{response_id}/cancel: + post: + operationId: cancelResponse + tags: + - Responses + summary: | + Cancels a model response with the given ID. Only responses created with + the `background` parameter set to `true` can be cancelled. + [Learn more](/docs/guides/background). + parameters: + - in: path + name: response_id + required: true + schema: + type: string + example: resp_677efb5139a88190b512bc3fef8e535d + description: The ID of the response to cancel. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + '404': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Cancel a response + group: responses + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/responses/resp_123/cancel \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const response = await client.responses.cancel("resp_123"); + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.responses.cancel( + "resp_677efb5139a88190b512bc3fef8e535d", + ) + print(response.id) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const response = await + client.responses.cancel('resp_677efb5139a88190b512bc3fef8e535d'); + + + console.log(response.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Responses.Cancel(context.TODO(), \"resp_677efb5139a88190b512bc3fef8e535d\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.Response; + import com.openai.models.responses.ResponseCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Response response = client.responses().cancel("resp_677efb5139a88190b512bc3fef8e535d"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + response = + openai.responses.cancel("resp_677efb5139a88190b512bc3fef8e535d") + + + puts(response) + response: | + { + "id": "resp_67cb71b351908190a308f3859487620d06981a8637e6bc44", + "object": "response", + "created_at": 1741386163, + "status": "cancelled", + "background": true, + "completed_at": null, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-2024-08-06", + "output": [ + { + "type": "message", + "id": "msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44", + "status": "in_progress", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "Silent circuits hum, \nThoughts emerge in data streams— \nDigital dawn breaks.", + "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": null, + "user": null, + "metadata": {} + } + /responses/{response_id}/input_items: + get: + operationId: listInputItems + tags: + - Responses + 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 + + 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - in: query + name: order + schema: + type: string + enum: + - asc + - desc + description: | + The order to return the input items in. Default is `desc`. + - `asc`: Return the input items in ascending order. + - `desc`: Return the input items in descending order. + - in: query + name: after + schema: + type: string + description: | + An item ID to list items after, used in pagination. + - in: query + name: include + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: | + Additional fields to include in the response. See the `include` + parameter for Response creation above for more information. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseItemList' + x-oaiMeta: + name: List input items + group: responses + examples: + request: + curl: | + curl https://api.openai.com/v1/responses/resp_abc123/input_items \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: > + import OpenAI from "openai"; + + const client = new OpenAI(); + + + const response = await + client.responses.inputItems.list("resp_123"); + + console.log(response.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.responses.input_items.list( + response_id="response_id", + ) + page = page.data[0] + print(page) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const responseItem of + client.responses.inputItems.list('response_id')) { + console.log(responseItem); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Responses.InputItems.List(\n\t\tcontext.TODO(),\n\t\t\"response_id\",\n\t\tresponses.InputItemListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.inputitems.InputItemListPage; + import com.openai.models.responses.inputitems.InputItemListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + InputItemListPage page = client.responses().inputItems().list("response_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.responses.input_items.list("response_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "msg_abc123", + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Tell me a three sentence bedtime story about a unicorn." + } + ] + } + ], + "first_id": "msg_abc123", + "last_id": "msg_abc123", + "has_more": false + } + /threads: + post: + operationId: createThread + tags: + - Assistants + summary: Create a thread. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateThreadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadObject' + x-oaiMeta: + name: Create thread + group: threads + beta: true + examples: + - title: Empty + request: + curl: | + curl https://api.openai.com/v1/threads \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.create() + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const emptyThread = await openai.beta.threads.create(); + + console.log(emptyThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.create(); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.New(context.TODO(), openai.BetaThreadNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.create + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699012949, + "metadata": {}, + "tool_resources": {} + } + - title: Messages + request: + curl: | + curl https://api.openai.com/v1/threads \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "messages": [{ + "role": "user", + "content": "Hello, what is AI?" + }, { + "role": "user", + "content": "How does AI work? Explain it in simple terms." + }] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.create() + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const messageThread = await openai.beta.threads.create({ + messages: [ + { + role: "user", + content: "Hello, what is AI?" + }, + { + role: "user", + content: "How does AI work? Explain it in simple terms.", + }, + ], + }); + + console.log(messageThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.create(); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.New(context.TODO(), openai.BetaThreadNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.create + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": {}, + "tool_resources": {} + } + /threads/runs: + post: + operationId: createThreadAndRun + tags: + - Assistants + summary: Create a thread and run it in one request. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateThreadAndRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Create thread and run + group: threads + beta: true + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "thread": { + "messages": [ + {"role": "user", "content": "Explain deep learning to a 5 year old."} + ] + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for thread in client.beta.threads.create_and_run( + assistant_id="assistant_id", + ): + print(thread) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.createAndRun({ + assistant_id: "asst_abc123", + thread: { + messages: [ + { role: "user", content: "Explain deep learning to a 5 year old." }, + ], + }, + }); + + console.log(run); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.createAndRun({ + assistant_id: 'assistant_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.NewAndRun(context.TODO(), openai.BetaThreadNewAndRunParams{\n\t\tAssistantID: \"assistant_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadCreateAndRunParams; + import com.openai.models.beta.threads.runs.Run; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadCreateAndRunParams params = ThreadCreateAndRunParams.builder() + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().createAndRun(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.create_and_run(assistant_id: + "assistant_id") + + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699076792, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "queued", + "started_at": null, + "expires_at": 1699077392, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4o", + "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", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_123", + "thread": { + "messages": [ + {"role": "user", "content": "Hello"} + ] + }, + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for thread in client.beta.threads.create_and_run( + assistant_id="assistant_id", + ): + print(thread) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.createAndRun({ + assistant_id: "asst_123", + thread: { + messages: [ + { role: "user", content: "Hello" }, + ], + }, + stream: true + }); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.createAndRun({ + assistant_id: 'assistant_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.NewAndRun(context.TODO(), openai.BetaThreadNewAndRunParams{\n\t\tAssistantID: \"assistant_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadCreateAndRunParams; + import com.openai.models.beta.threads.runs.Run; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadCreateAndRunParams params = ThreadCreateAndRunParams.builder() + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().createAndRun(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.create_and_run(assistant_id: + "assistant_id") + + + puts(run) + response: > + event: thread.created + + data: + {"id":"thread_123","object":"thread","created_at":1710348075,"metadata":{}} + + + event: thread.run.created + + data: + {"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-4o","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} + + + event: thread.run.queued + + data: + {"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-4o","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} + + + event: thread.run.in_progress + + data: + {"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-4o","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} + + + event: thread.run.step.created + + data: + {"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} + + + event: thread.run.step.in_progress + + data: + {"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} + + + event: thread.message.created + + data: + {"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":{}} + + + event: thread.message.in_progress + + data: + {"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":{}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + + ... + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + today"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + + event: thread.message.completed + + data: + {"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":{}} + + + event: thread.run.step.completed + + data: + {"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}} + + + event: thread.run.completed + + {"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-4o","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} + + + event: done + + data: [DONE] + - title: Streaming with Functions + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "thread": { + "messages": [ + {"role": "user", "content": "What is the weather like in San Francisco?"} + ] + }, + "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"] + } + } + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for thread in client.beta.threads.create_and_run( + assistant_id="assistant_id", + ): + print(thread) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const 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"], + }, + } + } + ]; + + async function main() { + const stream = await openai.beta.threads.createAndRun({ + assistant_id: "asst_123", + thread: { + messages: [ + { role: "user", content: "What is the weather like in San Francisco?" }, + ], + }, + tools: tools, + stream: true + }); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.createAndRun({ + assistant_id: 'assistant_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.NewAndRun(context.TODO(), openai.BetaThreadNewAndRunParams{\n\t\tAssistantID: \"assistant_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadCreateAndRunParams; + import com.openai.models.beta.threads.runs.Run; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadCreateAndRunParams params = ThreadCreateAndRunParams.builder() + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().createAndRun(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.create_and_run(assistant_id: + "assistant_id") + + + puts(run) + response: > + event: thread.created + + data: + {"id":"thread_123","object":"thread","created_at":1710351818,"metadata":{}} + + + event: thread.run.created + + data: + {"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-4o","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}} + + + event: thread.run.queued + + data: + {"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-4o","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}} + + + event: thread.run.in_progress + + data: + {"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-4o","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}} + + + event: thread.run.step.created + + data: + {"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} + + + event: thread.run.step.in_progress + + data: + {"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} + + + event: thread.run.step.delta + + data: + {"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}}]}}} + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]}}} + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"location"}}]}}} + + + ... + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"ahrenheit"}}]}}} + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]}}} + + + event: thread.run.requires_action + + data: + {"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-4o","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}} + + + event: done + + data: [DONE] + /threads/{thread_id}: + get: + operationId: getThread + tags: + - Assistants + summary: Retrieves a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to retrieve. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadObject' + x-oaiMeta: + name: Retrieve thread + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.retrieve( + "thread_id", + ) + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myThread = await openai.beta.threads.retrieve( + "thread_abc123" + ); + + console.log(myThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.retrieve('thread_id'); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.Get(context.TODO(), \"thread_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().retrieve("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.retrieve("thread_id") + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": {}, + "tool_resources": { + "code_interpreter": { + "file_ids": [] + } + } + } + post: + operationId: modifyThread + tags: + - Assistants + summary: Modifies a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to modify. Only the `metadata` can be modified. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyThreadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadObject' + x-oaiMeta: + name: Modify thread + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "modified": "true", + "user": "abc123" + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.update( + thread_id="thread_id", + ) + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const updatedThread = await openai.beta.threads.update( + "thread_abc123", + { + metadata: { modified: "true", user: "abc123" }, + } + ); + + console.log(updatedThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.update('thread_id'); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().update("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.update("thread_id") + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": { + "modified": "true", + "user": "abc123" + }, + "tool_resources": {} + } + delete: + operationId: deleteThread + tags: + - Assistants + summary: Delete a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteThreadResponse' + x-oaiMeta: + name: Delete thread + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread_deleted = client.beta.threads.delete( + "thread_id", + ) + print(thread_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const response = await openai.beta.threads.delete("thread_abc123"); + + console.log(response); + } + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const threadDeleted = await + client.beta.threads.delete('thread_id'); + + + console.log(threadDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthreadDeleted, err := client.Beta.Threads.Delete(context.TODO(), \"thread_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", threadDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadDeleteParams; + import com.openai.models.beta.threads.ThreadDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadDeleted threadDeleted = client.beta().threads().delete("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread_deleted = openai.beta.threads.delete("thread_id") + + puts(thread_deleted) + response: | + { + "id": "thread_abc123", + "object": "thread.deleted", + "deleted": true + } + /threads/{thread_id}/messages: + get: + operationId: listMessages + tags: + - Assistants + summary: Returns a list of messages for a given thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: >- + The ID of the [thread](/docs/api-reference/threads) the messages + belong to. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: run_id + in: query + description: | + Filter messages by the run ID that generated them. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListMessagesResponse' + x-oaiMeta: + name: List messages + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.threads.messages.list( + thread_id="thread_id", + ) + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const threadMessages = await openai.beta.threads.messages.list( + "thread_abc123" + ); + + console.log(threadMessages.data); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const message of + client.beta.threads.messages.list('thread_id')) { + console.log(message.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Threads.Messages.List(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadMessageListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.messages.MessageListPage; + import com.openai.models.beta.threads.messages.MessageListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageListPage page = client.beta().threads().messages().list("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.threads.messages.list("thread_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699016383, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + }, + { + "id": "msg_abc456", + "object": "thread.message", + "created_at": 1699016383, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Hello, what is AI?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + ], + "first_id": "msg_abc123", + "last_id": "msg_abc456", + "has_more": false + } + post: + operationId: createMessage + tags: + - Assistants + summary: Create a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: >- + The ID of the [thread](/docs/api-reference/threads) to create a + message for. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateMessageRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MessageObject' + x-oaiMeta: + name: Create message + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "role": "user", + "content": "How does AI work? Explain it in simple terms." + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message = client.beta.threads.messages.create( + thread_id="thread_id", + content="string", + role="user", + ) + print(message.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const threadMessages = await openai.beta.threads.messages.create( + "thread_abc123", + { role: "user", content: "How does AI work? Explain it in simple terms." } + ); + + console.log(threadMessages); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const message = await + client.beta.threads.messages.create('thread_id', { + content: 'string', + role: 'user', + }); + + + console.log(message.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.Beta.Threads.Messages.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadMessageNewParams{\n\t\t\tContent: openai.BetaThreadMessageNewParamsContentUnion{\n\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t},\n\t\t\tRole: openai.BetaThreadMessageNewParamsRoleUser,\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.threads.messages.Message; + + import + com.openai.models.beta.threads.messages.MessageCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageCreateParams params = MessageCreateParams.builder() + .threadId("thread_id") + .content("string") + .role(MessageCreateParams.Role.USER) + .build(); + Message message = client.beta().threads().messages().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + message = openai.beta.threads.messages.create("thread_id", + content: "string", role: :user) + + + puts(message) + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1713226573, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + /threads/{thread_id}/messages/{message_id}: + get: + operationId: getMessage + tags: + - Assistants + summary: Retrieve a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: >- + The ID of the [thread](/docs/api-reference/threads) to which this + message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to retrieve. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MessageObject' + x-oaiMeta: + name: Retrieve message + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 + \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message = client.beta.threads.messages.retrieve( + message_id="message_id", + thread_id="thread_id", + ) + print(message.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const message = await openai.beta.threads.messages.retrieve( + "msg_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(message); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const message = await + client.beta.threads.messages.retrieve('message_id', { + thread_id: 'thread_id', + }); + + + console.log(message.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.Beta.Threads.Messages.Get(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"message_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.threads.messages.Message; + + import + com.openai.models.beta.threads.messages.MessageRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageRetrieveParams params = MessageRetrieveParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + Message message = client.beta().threads().messages().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + message = openai.beta.threads.messages.retrieve("message_id", + thread_id: "thread_id") + + + puts(message) + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699017614, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + post: + operationId: modifyMessage + tags: + - Assistants + summary: Modifies a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to modify. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyMessageRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MessageObject' + x-oaiMeta: + name: Modify message + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 + \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "modified": "true", + "user": "abc123" + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message = client.beta.threads.messages.update( + message_id="message_id", + thread_id="thread_id", + ) + print(message.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const message = await openai.beta.threads.messages.update( + "thread_abc123", + "msg_abc123", + { + metadata: { + modified: "true", + user: "abc123", + }, + } + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const message = await + client.beta.threads.messages.update('message_id', { thread_id: + 'thread_id' }); + + + console.log(message.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.Beta.Threads.Messages.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"message_id\",\n\t\topenai.BetaThreadMessageUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.threads.messages.Message; + + import + com.openai.models.beta.threads.messages.MessageUpdateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageUpdateParams params = MessageUpdateParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + Message message = client.beta().threads().messages().update(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + message = openai.beta.threads.messages.update("message_id", + thread_id: "thread_id") + + + puts(message) + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699017614, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "file_ids": [], + "metadata": { + "modified": "true", + "user": "abc123" + } + } + delete: + operationId: deleteMessage + tags: + - Assistants + summary: Deletes a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteMessageResponse' + x-oaiMeta: + name: Delete message + group: threads + beta: true + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 + \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message_deleted = client.beta.threads.messages.delete( + message_id="message_id", + thread_id="thread_id", + ) + print(message_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const deletedMessage = await openai.beta.threads.messages.delete( + "msg_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(deletedMessage); + } + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const messageDeleted = await + client.beta.threads.messages.delete('message_id', { + thread_id: 'thread_id', + }); + + + console.log(messageDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessageDeleted, err := client.Beta.Threads.Messages.Delete(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"message_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", messageDeleted.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.beta.threads.messages.MessageDeleteParams; + + import com.openai.models.beta.threads.messages.MessageDeleted; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageDeleteParams params = MessageDeleteParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + MessageDeleted messageDeleted = client.beta().threads().messages().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + message_deleted = + openai.beta.threads.messages.delete("message_id", thread_id: + "thread_id") + + + puts(message_deleted) + response: | + { + "id": "msg_abc123", + "object": "thread.message.deleted", + "deleted": true + } + /threads/{thread_id}/runs: + get: + operationId: listRuns + tags: + - Assistants + summary: Returns a list of runs belonging to a thread. + parameters: + - name: thread_id + in: path + required: true + schema: + type: string + description: The ID of the thread the run belongs to. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListRunsResponse' + x-oaiMeta: + name: List runs + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.threads.runs.list( + thread_id="thread_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const runs = await openai.beta.threads.runs.list( + "thread_abc123" + ); + + console.log(runs); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const run of + client.beta.threads.runs.list('thread_id')) { + console.log(run.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Threads.Runs.List(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.RunListPage; + import com.openai.models.beta.threads.runs.RunListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunListPage page = client.beta().threads().runs().list("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.threads.runs.list("thread_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + }, + { + "id": "run_abc456", + "object": "thread.run", + "created_at": 1699063290, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699063290, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699063291, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + ], + "first_id": "run_abc123", + "last_id": "run_abc456", + "has_more": false + } + post: + operationId: createRun + tags: + - Assistants + summary: Create a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to run. + - name: include[] + in: query + description: > + A list of additional fields to include in the response. Currently + the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch + the file search result content. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Create run + group: threads + beta: true + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.create( + thread_id="thread_id", + assistant_id="assistant_id", + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.create( + "thread_abc123", + { assistant_id: "asst_abc123" } + ); + + console.log(run); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.runs.create('thread_id', { + assistant_id: 'assistant_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunNewParams{\n\t\t\tAssistantID: \"assistant_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .threadId("thread_id") + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().runs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.create("thread_id", assistant_id: + "assistant_id") + + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699063290, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "queued", + "started_at": 1699063290, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699063291, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/threads/thread_123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_123", + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.create( + thread_id="thread_id", + assistant_id="assistant_id", + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.runs.create( + "thread_123", + { assistant_id: "asst_123", stream: true } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.runs.create('thread_id', { + assistant_id: 'assistant_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunNewParams{\n\t\t\tAssistantID: \"assistant_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .threadId("thread_id") + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().runs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.create("thread_id", assistant_id: + "assistant_id") + + + puts(run) + response: > + event: thread.run.created + + data: + {"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-4o","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}} + + + event: thread.run.queued + + data: + {"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-4o","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}} + + + event: thread.run.in_progress + + data: + {"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-4o","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}} + + + event: thread.run.step.created + + data: + {"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} + + + event: thread.run.step.in_progress + + data: + {"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} + + + event: thread.message.created + + data: + {"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":{}} + + + event: thread.message.in_progress + + data: + {"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":{}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + + ... + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + today"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + + event: thread.message.completed + + data: + {"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":{}} + + + event: thread.run.step.completed + + data: + {"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}} + + + event: thread.run.completed + + data: + {"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-4o","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}} + + + event: done + + data: [DONE] + - title: Streaming with Functions + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "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"] + } + } + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.create( + thread_id="thread_id", + assistant_id="assistant_id", + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const 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"], + }, + } + } + ]; + + async function main() { + const stream = await openai.beta.threads.runs.create( + "thread_abc123", + { + assistant_id: "asst_abc123", + tools: tools, + stream: true + } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.runs.create('thread_id', { + assistant_id: 'assistant_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunNewParams{\n\t\t\tAssistantID: \"assistant_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .threadId("thread_id") + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().runs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.create("thread_id", assistant_id: + "assistant_id") + + + puts(run) + response: > + event: thread.run.created + + data: + {"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-4o","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}} + + + event: thread.run.queued + + data: + {"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-4o","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}} + + + event: thread.run.in_progress + + data: + {"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-4o","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}} + + + event: thread.run.step.created + + data: + {"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} + + + event: thread.run.step.in_progress + + data: + {"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} + + + event: thread.message.created + + data: + {"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":{}} + + + event: thread.message.in_progress + + data: + {"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":{}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + + ... + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + today"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + + event: thread.message.completed + + data: + {"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":{}} + + + event: thread.run.step.completed + + data: + {"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}} + + + event: thread.run.completed + + data: + {"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-4o","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}} + + + event: done + + data: [DONE] + /threads/{thread_id}/runs/{run_id}: + get: + operationId: getRun + tags: + - Assistants + summary: Retrieves a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) that was run. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to retrieve. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Retrieve run + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.beta.threads.runs.retrieve( + run_id="run_id", + thread_id="thread_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.retrieve( + "run_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(run); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.runs.retrieve('run_id', { + thread_id: 'thread_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.Get(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunRetrieveParams params = RunRetrieveParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + Run run = client.beta().threads().runs().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.retrieve("run_id", thread_id: + "thread_id") + + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + post: + operationId: modifyRun + tags: + - Assistants + summary: Modifies a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) that was run. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to modify. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Modify run + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "user_id": "user_abc123" + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.beta.threads.runs.update( + run_id="run_id", + thread_id="thread_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.update( + "run_abc123", + { + thread_id: "thread_abc123", + metadata: { + user_id: "user_abc123", + }, + } + ); + + console.log(run); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.runs.update('run_id', { + thread_id: 'thread_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunUpdateParams params = RunUpdateParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + Run run = client.beta().threads().runs().update(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.update("run_id", thread_id: + "thread_id") + + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": { + "user_id": "user_abc123" + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + /threads/{thread_id}/runs/{run_id}/cancel: + post: + operationId: cancelRun + tags: + - Assistants + summary: Cancels a run that is `in_progress`. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this run belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to cancel. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Cancel a run + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/cancel + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X POST + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.beta.threads.runs.cancel( + run_id="run_id", + thread_id="thread_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.cancel( + "run_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(run); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.runs.cancel('run_id', { + thread_id: 'thread_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.Cancel(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCancelParams params = RunCancelParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + Run run = client.beta().threads().runs().cancel(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.cancel("run_id", thread_id: + "thread_id") + + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699076126, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "cancelling", + "started_at": 1699076126, + "expires_at": 1699076726, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "last_error": null, + "model": "gpt-4o", + "instructions": "You summarize books.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": ["vs_123"] + } + }, + "metadata": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + /threads/{thread_id}/runs/{run_id}/steps: + get: + operationId: listRunSteps + tags: + - Assistants + summary: Returns a list of run steps belonging to a run. + parameters: + - name: thread_id + in: path + required: true + schema: + type: string + description: The ID of the thread the run and run steps belong to. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run the run steps belong to. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: include[] + in: query + description: > + A list of additional fields to include in the response. Currently + the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch + the file search result content. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListRunStepsResponse' + x-oaiMeta: + name: List run steps + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.threads.runs.steps.list( + run_id="run_id", + thread_id="thread_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const runStep = await openai.beta.threads.runs.steps.list( + "run_abc123", + { thread_id: "thread_abc123" } + ); + console.log(runStep); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const runStep of + client.beta.threads.runs.steps.list('run_id', { + thread_id: 'thread_id', + })) { + console.log(runStep.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Threads.Runs.Steps.List(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunStepListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.steps.StepListPage; + import com.openai.models.beta.threads.runs.steps.StepListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + StepListParams params = StepListParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + StepListPage page = client.beta().threads().runs().steps().list(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + page = openai.beta.threads.runs.steps.list("run_id", thread_id: + "thread_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + ], + "first_id": "step_abc123", + "last_id": "step_abc456", + "has_more": false + } + /threads/{thread_id}/runs/{run_id}/steps/{step_id}: + get: + operationId: getRunStep + tags: + - Assistants + summary: Retrieves a run step. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which the run and run step belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to which the run step belongs. + - in: path + name: step_id + required: true + schema: + type: string + description: The ID of the run step to retrieve. + - name: include[] + in: query + description: > + A list of additional fields to include in the response. Currently + the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch + the file search result content. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunStepObject' + x-oaiMeta: + name: Retrieve run step + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run_step = client.beta.threads.runs.steps.retrieve( + step_id="step_id", + thread_id="thread_id", + run_id="run_id", + ) + print(run_step.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const runStep = await openai.beta.threads.runs.steps.retrieve( + "step_abc123", + { thread_id: "thread_abc123", run_id: "run_abc123" } + ); + console.log(runStep); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const runStep = await + client.beta.threads.runs.steps.retrieve('step_id', { + thread_id: 'thread_id', + run_id: 'run_id', + }); + + + console.log(runStep.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trunStep, err := client.Beta.Threads.Runs.Steps.Get(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\t\"step_id\",\n\t\topenai.BetaThreadRunStepGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", runStep.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.threads.runs.steps.RunStep; + + import + com.openai.models.beta.threads.runs.steps.StepRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + StepRetrieveParams params = StepRetrieveParams.builder() + .threadId("thread_id") + .runId("run_id") + .stepId("step_id") + .build(); + RunStep runStep = client.beta().threads().runs().steps().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run_step = openai.beta.threads.runs.steps.retrieve("step_id", + thread_id: "thread_id", run_id: "run_id") + + + puts(run_step) + response: | + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + /threads/{thread_id}/runs/{run_id}/submit_tool_outputs: + post: + operationId: submitToolOuputsToRun + 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. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: >- + The ID of the [thread](/docs/api-reference/threads) to which this + run belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run that requires the tool output submission. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SubmitToolOutputsRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Submit tool outputs to run + group: threads + beta: true + examples: + - title: Default + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "tool_outputs": [ + { + "tool_call_id": "call_001", + "output": "70 degrees and sunny." + } + ] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.submit_tool_outputs( + run_id="run_id", + thread_id="thread_id", + tool_outputs=[{}], + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.submitToolOutputs( + "run_123", + { + thread_id: "thread_123", + tool_outputs: [ + { + tool_call_id: "call_001", + output: "70 degrees and sunny.", + }, + ], + } + ); + + console.log(run); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await + client.beta.threads.runs.submitToolOutputs('run_id', { + thread_id: 'thread_id', + tool_outputs: [{}], + }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.SubmitToolOutputs(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunSubmitToolOutputsParams{\n\t\t\tToolOutputs: []openai.BetaThreadRunSubmitToolOutputsParamsToolOutput{{}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.threads.runs.Run; + + import + com.openai.models.beta.threads.runs.RunSubmitToolOutputsParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunSubmitToolOutputsParams params = RunSubmitToolOutputsParams.builder() + .threadId("thread_id") + .runId("run_id") + .addToolOutput(RunSubmitToolOutputsParams.ToolOutput.builder().build()) + .build(); + Run run = client.beta().threads().runs().submitToolOutputs(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.submit_tool_outputs("run_id", + thread_id: "thread_id", tool_outputs: [{}]) + + + puts(run) + response: | + { + "id": "run_123", + "object": "thread.run", + "created_at": 1699075592, + "assistant_id": "asst_123", + "thread_id": "thread_123", + "status": "queued", + "started_at": 1699075592, + "expires_at": 1699076192, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "last_error": null, + "model": "gpt-4o", + "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": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "tool_outputs": [ + { + "tool_call_id": "call_001", + "output": "70 degrees and sunny." + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.submit_tool_outputs( + run_id="run_id", + thread_id="thread_id", + tool_outputs=[{}], + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.runs.submitToolOutputs( + "run_123", + { + thread_id: "thread_123", + tool_outputs: [ + { + tool_call_id: "call_001", + output: "70 degrees and sunny.", + }, + ], + } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await + client.beta.threads.runs.submitToolOutputs('run_id', { + thread_id: 'thread_id', + tool_outputs: [{}], + }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.SubmitToolOutputs(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunSubmitToolOutputsParams{\n\t\t\tToolOutputs: []openai.BetaThreadRunSubmitToolOutputsParamsToolOutput{{}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.threads.runs.Run; + + import + com.openai.models.beta.threads.runs.RunSubmitToolOutputsParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunSubmitToolOutputsParams params = RunSubmitToolOutputsParams.builder() + .threadId("thread_id") + .runId("run_id") + .addToolOutput(RunSubmitToolOutputsParams.ToolOutput.builder().build()) + .build(); + Run run = client.beta().threads().runs().submitToolOutputs(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.submit_tool_outputs("run_id", + thread_id: "thread_id", tool_outputs: [{}]) + + + puts(run) + response: > + event: thread.run.step.completed + + data: + {"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}} + + + event: thread.run.queued + + data: + {"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-4o","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}} + + + event: thread.run.in_progress + + data: + {"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-4o","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}} + + + event: thread.run.step.created + + data: + {"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} + + + event: thread.run.step.in_progress + + data: + {"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} + + + event: thread.message.created + + data: + {"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":{}} + + + event: thread.message.in_progress + + data: + {"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":{}} + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"The","annotations":[]}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + current"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + weather"}}]}} + + + ... + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + sunny"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"."}}]}} + + + event: thread.message.completed + + data: + {"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":{}} + + + event: thread.run.step.completed + + data: + {"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}} + + + event: thread.run.completed + + data: + {"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-4o","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}} + + + event: done + + data: [DONE] + /uploads: + post: + operationId: createUpload + tags: + - Uploads + summary: > + Creates an intermediate [Upload](/docs/api-reference/uploads/object) + object + + that you can add [Parts](/docs/api-reference/uploads/part-object) to. + + Currently, an Upload can accept at most 8 GB in total and expires after + an + + hour after you create it. + + + Once you complete the Upload, we will create a + + [File](/docs/api-reference/files/object) object that contains all the + parts + + you uploaded. This File is usable in the rest of our platform as a + regular + + File object. + + + For certain `purpose` values, the correct `mime_type` must be + specified. + + Please refer to documentation for the + + [supported MIME types for your use + case](/docs/assistants/tools/file-search#supported-files). + + + For guidance on the proper filename extensions for each purpose, please + + follow the documentation on [creating a + + File](/docs/api-reference/files/create). + + + Returns the Upload object with status `pending`. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUploadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Upload' + x-oaiMeta: + name: Create upload + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "purpose": "fine-tune", + "filename": "training_examples.jsonl", + "bytes": 2147483648, + "mime_type": "text/jsonl", + "expires_after": { + "anchor": "created_at", + "seconds": 3600 + } + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const upload = await client.uploads.create({ + bytes: 0, + filename: 'filename', + mime_type: 'mime_type', + purpose: 'assistants', + }); + + console.log(upload.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload = client.uploads.create( + bytes=0, + filename="filename", + mime_type="mime_type", + purpose="assistants", + ) + print(upload.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tupload, err := client.Uploads.New(context.TODO(), openai.UploadNewParams{\n\t\tBytes: 0,\n\t\tFilename: \"filename\",\n\t\tMimeType: \"mime_type\",\n\t\tPurpose: openai.FilePurposeAssistants,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", upload.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FilePurpose; + import com.openai.models.uploads.Upload; + import com.openai.models.uploads.UploadCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UploadCreateParams params = UploadCreateParams.builder() + .bytes(0L) + .filename("filename") + .mimeType("mime_type") + .purpose(FilePurpose.ASSISTANTS) + .build(); + Upload upload = client.uploads().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + upload = openai.uploads.create(bytes: 0, filename: "filename", + mime_type: "mime_type", purpose: :assistants) + + + puts(upload) + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "pending", + "expires_at": 1719127296 + } + /uploads/{upload_id}/cancel: + post: + operationId: cancelUpload + tags: + - Uploads + summary: | + Cancels the Upload. No Parts may be added after an Upload is cancelled. + + Returns the Upload object with status `cancelled`. + parameters: + - in: path + name: upload_id + required: true + schema: + type: string + example: upload_abc123 + description: | + The ID of the Upload. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Upload' + x-oaiMeta: + name: Cancel upload + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads/upload_abc123/cancel + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const upload = await client.uploads.cancel('upload_abc123'); + + console.log(upload.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload = client.uploads.cancel( + "upload_abc123", + ) + print(upload.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tupload, err := client.Uploads.Cancel(context.TODO(), \"upload_abc123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", upload.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.uploads.Upload; + import com.openai.models.uploads.UploadCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Upload upload = client.uploads().cancel("upload_abc123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + upload = openai.uploads.cancel("upload_abc123") + + puts(upload) + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "cancelled", + "expires_at": 1719127296 + } + /uploads/{upload_id}/complete: + post: + operationId: completeUpload + tags: + - Uploads + summary: > + Completes the [Upload](/docs/api-reference/uploads/object). + + + Within the returned Upload object, there is a nested + [File](/docs/api-reference/files/object) object that is ready to use in + the rest of the platform. + + + You can specify the order of the Parts by passing in an ordered list of + the Part IDs. + + + The 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. + + Returns the Upload object with status `completed`, including an + additional `file` property containing the created usable File object. + parameters: + - in: path + name: upload_id + required: true + schema: + type: string + example: upload_abc123 + description: | + The ID of the Upload. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CompleteUploadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Upload' + x-oaiMeta: + name: Complete upload + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads/upload_abc123/complete + -d '{ + "part_ids": ["part_def456", "part_ghi789"] + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const upload = await client.uploads.complete('upload_abc123', { + part_ids: ['string'] }); + + + console.log(upload.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload = client.uploads.complete( + upload_id="upload_abc123", + part_ids=["string"], + ) + print(upload.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tupload, err := client.Uploads.Complete(\n\t\tcontext.TODO(),\n\t\t\"upload_abc123\",\n\t\topenai.UploadCompleteParams{\n\t\t\tPartIDs: []string{\"string\"},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", upload.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.uploads.Upload; + import com.openai.models.uploads.UploadCompleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UploadCompleteParams params = UploadCompleteParams.builder() + .uploadId("upload_abc123") + .addPartId("string") + .build(); + Upload upload = client.uploads().complete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + upload = openai.uploads.complete("upload_abc123", part_ids: + ["string"]) + + + puts(upload) + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "completed", + "expires_at": 1719127296, + "file": { + "id": "file-xyz321", + "object": "file", + "bytes": 2147483648, + "created_at": 1719186911, + "expires_at": 1719127296, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + } + } + /uploads/{upload_id}/parts: + post: + operationId: addUploadPart + tags: + - Uploads + summary: > + Adds a [Part](/docs/api-reference/uploads/part-object) to an + [Upload](/docs/api-reference/uploads/object) object. A Part represents a + chunk of bytes from the file you are trying to upload. + + + Each Part can be at most 64 MB, and you can add Parts until you hit the + Upload maximum of 8 GB. + + + It is possible to add multiple Parts in parallel. You can decide the + intended order of the Parts when you [complete the + Upload](/docs/api-reference/uploads/complete). + parameters: + - in: path + name: upload_id + required: true + schema: + type: string + example: upload_abc123 + description: | + The ID of the Upload. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/AddUploadPartRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/UploadPart' + x-oaiMeta: + name: Add upload part + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads/upload_abc123/parts + -F data="aHR0cHM6Ly9hcGkub3BlbmFpLmNvbS92MS91cGxvYWRz..." + node.js: >- + import fs from 'fs'; + + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const uploadPart = await + client.uploads.parts.create('upload_abc123', { + data: fs.createReadStream('path/to/file'), + }); + + + console.log(uploadPart.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload_part = client.uploads.parts.create( + upload_id="upload_abc123", + data=b"Example data", + ) + print(upload_part.id) + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tuploadPart, err := client.Uploads.Parts.New(\n\t\tcontext.TODO(),\n\t\t\"upload_abc123\",\n\t\topenai.UploadPartNewParams{\n\t\t\tData: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", uploadPart.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.uploads.parts.PartCreateParams; + import com.openai.models.uploads.parts.UploadPart; + import java.io.ByteArrayInputStream; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PartCreateParams params = PartCreateParams.builder() + .uploadId("upload_abc123") + .data(new ByteArrayInputStream("Example data".getBytes())) + .build(); + UploadPart uploadPart = client.uploads().parts().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + upload_part = openai.uploads.parts.create("upload_abc123", data: + StringIO.new("Example data")) + + + puts(upload_part) + response: | + { + "id": "part_def456", + "object": "upload.part", + "created_at": 1719185911, + "upload_id": "upload_abc123" + } + /vector_stores: + get: + operationId: listVectorStores + tags: + - Vector stores + summary: Returns a list of vector stores. + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListVectorStoresResponse' + x-oaiMeta: + name: List vector stores + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.list() + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStores = await openai.vectorStores.list(); + console.log(vectorStores); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const vectorStore of client.vectorStores.list()) { + console.log(vectorStore.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.List(context.TODO(), openai.VectorStoreListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStoreListPage; + import com.openai.models.vectorstores.VectorStoreListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreListPage page = client.vectorStores().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "description": "Contains commonly asked questions and answers, organized by topic.", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + }, + { + "id": "vs_abc456", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ v2", + "description": null, + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + ], + "first_id": "vs_abc123", + "last_id": "vs_abc456", + "has_more": false + } + post: + operationId: createVectorStore + tags: + - Vector stores + summary: Create a vector store. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVectorStoreRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreObject' + x-oaiMeta: + name: Create vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "name": "Support FAQ" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store = client.vector_stores.create() + print(vector_store.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.vectorStores.create({ + name: "Support FAQ" + }); + console.log(vectorStore); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStore = await client.vectorStores.create(); + + console.log(vectorStore.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.New(context.TODO(), openai.VectorStoreNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStore; + import com.openai.models.vectorstores.VectorStoreCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStore vectorStore = client.vectorStores().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store = openai.vector_stores.create + + puts(vector_store) + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "description": "Contains commonly asked questions and answers, organized by topic.", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + /vector_stores/{vector_store_id}: + get: + operationId: getVectorStore + tags: + - Vector stores + summary: Retrieves a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to retrieve. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreObject' + x-oaiMeta: + name: Retrieve vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store = client.vector_stores.retrieve( + "vector_store_id", + ) + print(vector_store.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.vectorStores.retrieve( + "vs_abc123" + ); + console.log(vectorStore); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStore = await + client.vectorStores.retrieve('vector_store_id'); + + + console.log(vectorStore.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.Get(context.TODO(), \"vector_store_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStore; + import com.openai.models.vectorstores.VectorStoreRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStore vectorStore = client.vectorStores().retrieve("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store = openai.vector_stores.retrieve("vector_store_id") + + puts(vector_store) + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776 + } + post: + operationId: modifyVectorStore + tags: + - Vector stores + summary: Modifies a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to modify. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateVectorStoreRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreObject' + x-oaiMeta: + name: Modify vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + -d '{ + "name": "Support FAQ" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store = client.vector_stores.update( + vector_store_id="vector_store_id", + ) + print(vector_store.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.vectorStores.update( + "vs_abc123", + { + name: "Support FAQ" + } + ); + console.log(vectorStore); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStore = await + client.vectorStores.update('vector_store_id'); + + + console.log(vectorStore.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.Update(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\topenai.VectorStoreUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStore; + import com.openai.models.vectorstores.VectorStoreUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStore vectorStore = client.vectorStores().update("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store = openai.vector_stores.update("vector_store_id") + + puts(vector_store) + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "description": "Contains commonly asked questions and answers, organized by topic.", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + delete: + operationId: deleteVectorStore + tags: + - Vector stores + summary: Delete a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteVectorStoreResponse' + x-oaiMeta: + name: Delete vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_deleted = client.vector_stores.delete( + "vector_store_id", + ) + print(vector_store_deleted.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStore = await openai.vectorStores.delete( + "vs_abc123" + ); + console.log(deletedVectorStore); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreDeleted = await + client.vectorStores.delete('vector_store_id'); + + + console.log(vectorStoreDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreDeleted, err := client.VectorStores.Delete(context.TODO(), \"vector_store_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStoreDeleteParams; + import com.openai.models.vectorstores.VectorStoreDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreDeleted vectorStoreDeleted = client.vectorStores().delete("vector_store_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_deleted = + openai.vector_stores.delete("vector_store_id") + + + puts(vector_store_deleted) + response: | + { + id: "vs_abc123", + object: "vector_store.deleted", + deleted: true + } + /vector_stores/{vector_store_id}/file_batches: + post: + operationId: createVectorStoreFileBatch + tags: + - Vector stores + summary: Create a vector store file batch. + description: > + The maximum number of files in a single batch request is 2000. + + Vector 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`). + + For ingesting multiple files into the same vector store, this batch + endpoint is recommended. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: | + The ID of the vector store for which to create a File Batch. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVectorStoreFileBatchRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatchObject' + 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`). + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/file_batches \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "files": [ + { + "file_id": "file-abc123", + "attributes": {"category": "finance"} + }, + { + "file_id": "file-abc456", + "chunking_strategy": { + "type": "static", + "max_chunk_size_tokens": 1200, + "chunk_overlap_tokens": 200 + } + } + ] + }' + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + + vector_store_file_batch = + client.vector_stores.file_batches.create( + vector_store_id="vs_abc123", + ) + + print(vector_store_file_batch.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const myVectorStoreFileBatch = await openai.vectorStores.fileBatches.create( + "vs_abc123", + { + files: [ + { + file_id: "file-abc123", + attributes: { category: "finance" }, + }, + { + file_id: "file-abc456", + chunking_strategy: { + type: "static", + max_chunk_size_tokens: 1200, + chunk_overlap_tokens: 200, + }, + }, + ] + } + ); + console.log(myVectorStoreFileBatch); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFileBatch = await + client.vectorStores.fileBatches.create('vs_abc123'); + + + console.log(vectorStoreFileBatch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.New(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreFileBatchNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.vectorstores.filebatches.FileBatchCreateParams; + + import + com.openai.models.vectorstores.filebatches.VectorStoreFileBatch; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().create("vs_abc123"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_file_batch = + openai.vector_stores.file_batches.create("vs_abc123") + + + puts(vector_store_file_batch) + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 1, + "completed": 1, + "failed": 0, + "cancelled": 0, + "total": 0, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}: + get: + operationId: getVectorStoreFileBatch + tags: + - Vector stores + summary: Retrieves a vector store file batch. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store that the file batch belongs to. + - in: path + name: batch_id + required: true + schema: + type: string + example: vsfb_abc123 + description: The ID of the file batch being retrieved. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatchObject' + x-oaiMeta: + name: Retrieve vector store file batch + group: vector_stores + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/file_batches/vsfb_abc123 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + + vector_store_file_batch = + client.vector_stores.file_batches.retrieve( + batch_id="vsfb_abc123", + vector_store_id="vs_abc123", + ) + + print(vector_store_file_batch.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFileBatch = await openai.vectorStores.fileBatches.retrieve( + "vsfb_abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(vectorStoreFileBatch); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFileBatch = await + client.vectorStores.fileBatches.retrieve('vsfb_abc123', { + vector_store_id: 'vs_abc123', + }); + + + console.log(vectorStoreFileBatch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.Get(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"vsfb_abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.vectorstores.filebatches.FileBatchRetrieveParams; + + import + com.openai.models.vectorstores.filebatches.VectorStoreFileBatch; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileBatchRetrieveParams params = FileBatchRetrieveParams.builder() + .vectorStoreId("vs_abc123") + .batchId("vsfb_abc123") + .build(); + VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_file_batch = + openai.vector_stores.file_batches.retrieve("vsfb_abc123", + vector_store_id: "vs_abc123") + + + puts(vector_store_file_batch) + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 1, + "completed": 1, + "failed": 0, + "cancelled": 0, + "total": 0, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel: + post: + operationId: cancelVectorStoreFileBatch + 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. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store that the file batch belongs to. + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the file batch to cancel. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatchObject' + x-oaiMeta: + name: Cancel vector store file batch + group: vector_stores + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X POST + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + + vector_store_file_batch = + client.vector_stores.file_batches.cancel( + batch_id="batch_id", + vector_store_id="vector_store_id", + ) + + print(vector_store_file_batch.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStoreFileBatch = await openai.vectorStores.fileBatches.cancel( + "vsfb_abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(deletedVectorStoreFileBatch); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFileBatch = await + client.vectorStores.fileBatches.cancel('batch_id', { + vector_store_id: 'vector_store_id', + }); + + + console.log(vectorStoreFileBatch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.Cancel(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"batch_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.vectorstores.filebatches.FileBatchCancelParams; + + import + com.openai.models.vectorstores.filebatches.VectorStoreFileBatch; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileBatchCancelParams params = FileBatchCancelParams.builder() + .vectorStoreId("vector_store_id") + .batchId("batch_id") + .build(); + VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().cancel(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_file_batch = + openai.vector_stores.file_batches.cancel("batch_id", + vector_store_id: "vector_store_id") + + + puts(vector_store_file_batch) + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 12, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 15, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}/files: + get: + operationId: listFilesInVectorStoreBatch + tags: + - Vector stores + summary: Returns a list of vector store files in a batch. + parameters: + - name: vector_store_id + in: path + description: The ID of the vector store that the files belong to. + required: true + schema: + type: string + - name: batch_id + in: path + description: The ID of the file batch that the files belong to. + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: filter + in: query + description: >- + Filter by file status. One of `in_progress`, `completed`, `failed`, + `cancelled`. + schema: + type: string + enum: + - in_progress + - completed + - failed + - cancelled + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListVectorStoreFilesResponse' + x-oaiMeta: + name: List vector store files in a batch + group: vector_stores + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.file_batches.list_files( + batch_id="batch_id", + vector_store_id="vector_store_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFiles = await openai.vectorStores.fileBatches.listFiles( + "vsfb_abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(vectorStoreFiles); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const vectorStoreFile of + client.vectorStores.fileBatches.listFiles('batch_id', { + vector_store_id: 'vector_store_id', + })) { + console.log(vectorStoreFile.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.FileBatches.ListFiles(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"batch_id\",\n\t\topenai.VectorStoreFileBatchListFilesParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.vectorstores.filebatches.FileBatchListFilesPage; + + import + com.openai.models.vectorstores.filebatches.FileBatchListFilesParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileBatchListFilesParams params = FileBatchListFilesParams.builder() + .vectorStoreId("vector_store_id") + .batchId("batch_id") + .build(); + FileBatchListFilesPage page = client.vectorStores().fileBatches().listFiles(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + page = openai.vector_stores.file_batches.list_files("batch_id", + vector_store_id: "vector_store_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + }, + { + "id": "file-abc456", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + /vector_stores/{vector_store_id}/files: + get: + operationId: listVectorStoreFiles + tags: + - Vector stores + summary: Returns a list of vector store files. + parameters: + - name: vector_store_id + in: path + description: The ID of the vector store that the files belong to. + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: filter + in: query + description: >- + Filter by file status. One of `in_progress`, `completed`, `failed`, + `cancelled`. + schema: + type: string + enum: + - in_progress + - completed + - failed + - cancelled + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListVectorStoreFilesResponse' + x-oaiMeta: + name: List vector store files + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.files.list( + vector_store_id="vector_store_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFiles = await openai.vectorStores.files.list( + "vs_abc123" + ); + console.log(vectorStoreFiles); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const vectorStoreFile of + client.vectorStores.files.list('vector_store_id')) { + console.log(vectorStoreFile.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.Files.List(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\topenai.VectorStoreFileListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileListPage; + import com.openai.models.vectorstores.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileListPage page = client.vectorStores().files().list("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.files.list("vector_store_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + }, + { + "id": "file-abc456", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + post: + operationId: createVectorStoreFile + tags: + - Vector stores + summary: >- + Create a vector store file by attaching a + [File](/docs/api-reference/files) to a [vector + store](/docs/api-reference/vector-stores/object). + 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`. + + For uploading multiple files to the same vector store, use the file + batches endpoint to reduce request volume. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: | + The ID of the vector store for which to create a File. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVectorStoreFileRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileObject' + 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. + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "file_id": "file-abc123" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file = client.vector_stores.files.create( + vector_store_id="vs_abc123", + file_id="file_id", + ) + print(vector_store_file.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const myVectorStoreFile = await openai.vectorStores.files.create( + "vs_abc123", + { + file_id: "file-abc123" + } + ); + console.log(myVectorStoreFile); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFile = await + client.vectorStores.files.create('vs_abc123', { file_id: 'file_id' + }); + + + console.log(vectorStoreFile.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.New(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreFileNewParams{\n\t\t\tFileID: \"file_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileCreateParams; + import com.openai.models.vectorstores.files.VectorStoreFile; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileCreateParams params = FileCreateParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file_id") + .build(); + VectorStoreFile vectorStoreFile = client.vectorStores().files().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_file = openai.vector_stores.files.create("vs_abc123", + file_id: "file_id") + + + puts(vector_store_file) + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "usage_bytes": 1234, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null + } + /vector_stores/{vector_store_id}/files/{file_id}: + get: + operationId: getVectorStoreFile + tags: + - Vector stores + summary: Retrieves a vector store file. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store that the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + example: file-abc123 + description: The ID of the file being retrieved. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileObject' + x-oaiMeta: + name: Retrieve vector store file + group: vector_stores + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file = client.vector_stores.files.retrieve( + file_id="file-abc123", + vector_store_id="vs_abc123", + ) + print(vector_store_file.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFile = await openai.vectorStores.files.retrieve( + "file-abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(vectorStoreFile); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFile = await + client.vectorStores.files.retrieve('file-abc123', { + vector_store_id: 'vs_abc123', + }); + + + console.log(vectorStoreFile.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.Get(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"file-abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileRetrieveParams; + import com.openai.models.vectorstores.files.VectorStoreFile; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileRetrieveParams params = FileRetrieveParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file-abc123") + .build(); + VectorStoreFile vectorStoreFile = client.vectorStores().files().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_file = + openai.vector_stores.files.retrieve("file-abc123", + vector_store_id: "vs_abc123") + + + puts(vector_store_file) + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null + } + delete: + operationId: deleteVectorStoreFile + 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](/docs/api-reference/files/delete) endpoint. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store that the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteVectorStoreFileResponse' + x-oaiMeta: + name: Delete vector store file + group: vector_stores + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file_deleted = client.vector_stores.files.delete( + file_id="file_id", + vector_store_id="vector_store_id", + ) + print(vector_store_file_deleted.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStoreFile = await openai.vectorStores.files.delete( + "file-abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(deletedVectorStoreFile); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFileDeleted = await + client.vectorStores.files.delete('file_id', { + vector_store_id: 'vector_store_id', + }); + + + console.log(vectorStoreFileDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileDeleted, err := client.VectorStores.Files.Delete(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileDeleted.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.vectorstores.files.FileDeleteParams; + + import + com.openai.models.vectorstores.files.VectorStoreFileDeleted; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileDeleteParams params = FileDeleteParams.builder() + .vectorStoreId("vector_store_id") + .fileId("file_id") + .build(); + VectorStoreFileDeleted vectorStoreFileDeleted = client.vectorStores().files().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_file_deleted = + openai.vector_stores.files.delete("file_id", vector_store_id: + "vector_store_id") + + + puts(vector_store_file_deleted) + response: | + { + id: "file-abc123", + object: "vector_store.file.deleted", + deleted: true + } + post: + operationId: updateVectorStoreFileAttributes + tags: + - Vector stores + summary: Update attributes on a vector store file. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + example: file-abc123 + description: The ID of the file to update attributes. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateVectorStoreFileAttributesRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileObject' + 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} + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"attributes": {"key1": "value1", "key2": 2}}' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFile = await + client.vectorStores.files.update('file-abc123', { + vector_store_id: 'vs_abc123', + attributes: { foo: 'string' }, + }); + + + console.log(vectorStoreFile.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file = client.vector_stores.files.update( + file_id="file-abc123", + vector_store_id="vs_abc123", + attributes={ + "foo": "string" + }, + ) + print(vector_store_file.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.Update(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"file-abc123\",\n\t\topenai.VectorStoreFileUpdateParams{\n\t\t\tAttributes: map[string]openai.VectorStoreFileUpdateParamsAttributeUnion{\n\t\t\t\t\"foo\": {\n\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.vectorstores.files.FileUpdateParams; + import com.openai.models.vectorstores.files.VectorStoreFile; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileUpdateParams params = FileUpdateParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file-abc123") + .attributes(FileUpdateParams.Attributes.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build()) + .build(); + VectorStoreFile vectorStoreFile = client.vectorStores().files().update(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file = openai.vector_stores.files.update( + "file-abc123", + vector_store_id: "vs_abc123", + attributes: {foo: "string"} + ) + + puts(vector_store_file) + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "usage_bytes": 1234, + "created_at": 1699061776, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null, + "chunking_strategy": {...}, + "attributes": {"key1": "value1", "key2": 2} + } + /vector_stores/{vector_store_id}/files/{file_id}/content: + get: + operationId: retrieveVectorStoreFileContent + tags: + - Vector stores + summary: Retrieve the parsed contents of a vector store file. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store. + - in: path + name: file_id + required: true + schema: + type: string + example: file-abc123 + description: The ID of the file within the vector store. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileContentResponse' + x-oaiMeta: + name: Retrieve vector store file content + group: vector_stores + examples: + request: + curl: > + curl \ + + https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123/content + \ + + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const fileContentResponse of + client.vectorStores.files.content('file-abc123', { + vector_store_id: 'vs_abc123', + })) { + console.log(fileContentResponse.text); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.files.content( + file_id="file-abc123", + vector_store_id="vs_abc123", + ) + page = page.data[0] + print(page.text) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.Files.Content(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"file-abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileContentPage; + import com.openai.models.vectorstores.files.FileContentParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileContentParams params = FileContentParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file-abc123") + .build(); + FileContentPage page = client.vectorStores().files().content(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + page = openai.vector_stores.files.content("file-abc123", + vector_store_id: "vs_abc123") + + + puts(page) + response: | + { + "file_id": "file-abc123", + "filename": "example.txt", + "attributes": {"key": "value"}, + "content": [ + {"type": "text", "text": "..."}, + ... + ] + } + /vector_stores/{vector_store_id}/search: + post: + operationId: searchVectorStore + tags: + - Vector stores + summary: >- + Search a vector store for relevant chunks based on a query and file + attributes filter. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store to search. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreSearchRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreSearchResultsPage' + x-oaiMeta: + name: Search vector store + group: vector_stores + examples: + request: + curl: | + curl -X POST \ + https://api.openai.com/v1/vector_stores/vs_abc123/search \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"query": "What is the return policy?", "filters": {...}}' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const vectorStoreSearchResponse of + client.vectorStores.search('vs_abc123', { + query: 'string', + })) { + console.log(vectorStoreSearchResponse.file_id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.search( + vector_store_id="vs_abc123", + query="string", + ) + page = page.data[0] + print(page.file_id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.Search(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreSearchParams{\n\t\t\tQuery: openai.VectorStoreSearchParamsQueryUnion{\n\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStoreSearchPage; + import com.openai.models.vectorstores.VectorStoreSearchParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreSearchParams params = VectorStoreSearchParams.builder() + .vectorStoreId("vs_abc123") + .query("string") + .build(); + VectorStoreSearchPage page = client.vectorStores().search(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.search("vs_abc123", query: "string") + + puts(page) + response: | + { + "object": "vector_store.search_results.page", + "search_query": "What is the return policy?", + "data": [ + { + "file_id": "file_123", + "filename": "document.pdf", + "score": 0.95, + "attributes": { + "author": "John Doe", + "date": "2023-01-01" + }, + "content": [ + { + "type": "text", + "text": "Relevant chunk" + } + ] + }, + { + "file_id": "file_456", + "filename": "notes.txt", + "score": 0.89, + "attributes": { + "author": "Jane Smith", + "date": "2023-01-02" + }, + "content": [ + { + "type": "text", + "text": "Sample text content from the vector store." + } + ] + } + ], + "has_more": false, + "next_page": null + } + /conversations: + post: + tags: + - Conversations + summary: Create a conversation. + operationId: createConversation + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateConversationBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Create a conversation + group: conversations + path: create + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "metadata": {"topic": "demo"}, + "items": [ + { + "type": "message", + "role": "user", + "content": "Hello!" + } + ] + }' + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const conversation = await client.conversations.create({ + metadata: { topic: "demo" }, + items: [ + { type: "message", role: "user", content: "Hello!" } + ], + }); + console.log(conversation); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.create() + print(conversation.id) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation conversation = client.CreateConversation( + new CreateConversationOptions + { + Metadata = new Dictionary + { + { "topic", "demo" } + }, + Items = + { + new ConversationMessageInput + { + Role = "user", + Content = "Hello!", + } + } + } + ); + Console.WriteLine(conversation.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversation = await client.conversations.create(); + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.New(context.TODO(), conversations.ConversationNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.ConversationCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Conversation conversation = client.conversations().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation = openai.conversations.create + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "demo"} + } + /conversations/{conversation_id}: + get: + tags: + - Conversations + summary: Get a conversation + operationId: getConversation + parameters: + - name: conversation_id + in: path + description: The ID of the conversation to retrieve. + required: true + schema: + example: conv_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Retrieve a conversation + group: conversations + path: retrieve + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: > + import OpenAI from "openai"; + + const client = new OpenAI(); + + + const conversation = await + client.conversations.retrieve("conv_123"); + + console.log(conversation); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.retrieve( + "conv_123", + ) + print(conversation.id) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation conversation = client.GetConversation("conv_123"); + Console.WriteLine(conversation.Id); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const conversation = await + client.conversations.retrieve('conv_123'); + + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Get(context.TODO(), \"conv_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.ConversationRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Conversation conversation = client.conversations().retrieve("conv_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation = openai.conversations.retrieve("conv_123") + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "demo"} + } + delete: + tags: + - Conversations + summary: Delete a conversation. Items in the conversation will not be deleted. + operationId: deleteConversation + parameters: + - name: conversation_id + in: path + description: The ID of the conversation to delete. + required: true + schema: + example: conv_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedConversationResource' + x-oaiMeta: + name: Delete a conversation + group: conversations + path: delete + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/conversations/conv_123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const deleted = await client.conversations.delete("conv_123"); + console.log(deleted); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation_deleted_resource = client.conversations.delete( + "conv_123", + ) + print(conversation_deleted_resource.id) + csharp: > + using System; + + using OpenAI.Conversations; + + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + DeletedConversation deleted = + client.DeleteConversation("conv_123"); + + Console.WriteLine(deleted.Id); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const conversationDeletedResource = await + client.conversations.delete('conv_123'); + + + console.log(conversationDeletedResource.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationDeletedResource, err := client.Conversations.Delete(context.TODO(), \"conv_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationDeletedResource.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.conversations.ConversationDeleteParams; + + import + com.openai.models.conversations.ConversationDeletedResource; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ConversationDeletedResource conversationDeletedResource = client.conversations().delete("conv_123"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + conversation_deleted_resource = + openai.conversations.delete("conv_123") + + + puts(conversation_deleted_resource) + response: | + { + "id": "conv_123", + "object": "conversation.deleted", + "deleted": true + } + post: + tags: + - Conversations + summary: Update a conversation + operationId: updateConversation + parameters: + - name: conversation_id + in: path + description: The ID of the conversation to update. + required: true + schema: + example: conv_123 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateConversationBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Update a conversation + group: conversations + path: update + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "metadata": {"topic": "project-x"} + }' + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const updated = await client.conversations.update( + "conv_123", + { metadata: { topic: "project-x" } } + ); + console.log(updated); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.update( + conversation_id="conv_123", + metadata={ + "foo": "string" + }, + ) + print(conversation.id) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation updated = client.UpdateConversation( + conversationId: "conv_123", + new UpdateConversationOptions + { + Metadata = new Dictionary + { + { "topic", "project-x" } + } + } + ); + Console.WriteLine(updated.Id); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const conversation = await client.conversations.update('conv_123', + { metadata: { foo: 'string' } }); + + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Update(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ConversationUpdateParams{\n\t\t\tMetadata: shared.Metadata{\n\t\t\t\t\"foo\": \"string\",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.ConversationUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ConversationUpdateParams params = ConversationUpdateParams.builder() + .conversationId("conv_123") + .metadata(ConversationUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build()) + .build(); + Conversation conversation = client.conversations().update(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + conversation = openai.conversations.update("conv_123", metadata: + {foo: "string"}) + + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "project-x"} + } + /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 + content: + application/json: + schema: + $ref: '#/components/schemas/VideoResource' + x-oaiMeta: + name: Create video + group: videos + path: create + examples: + request: + curl: | + curl https://api.openai.com/v1/videos \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F "model=sora-2" \ + -F "prompt=A calico cat playing a piano on stage" + javascript: > + import OpenAI from 'openai'; + + + const openai = new OpenAI(); + + + const video = await openai.videos.create({ prompt: 'A calico cat + playing a piano on stage' }); + + + console.log(video.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + video = client.videos.create( + prompt="x", + ) + print(video.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvideo, err := client.Videos.New(context.TODO(), openai.VideoNewParams{\n\t\tPrompt: \"x\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", video.ID)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + video = openai.videos.create(prompt: "x") + + puts(video) + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.videos.Video; + import com.openai.models.videos.VideoCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VideoCreateParams params = VideoCreateParams.builder() + .prompt("x") + .build(); + Video video = client.videos().create(params); + } + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const video = await client.videos.create({ prompt: 'x' }); + + console.log(video.id); + response: | + { + "id": "video_123", + "object": "video", + "model": "sora-2", + "status": "queued", + "progress": 0, + "created_at": 1712697600, + "size": "1024x1792", + "seconds": "8", + "quality": "standard" + } + get: + tags: + - Videos + summary: 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 + 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/OrderEnum' + - 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 + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/VideoListResource' + x-oaiMeta: + name: List videos + group: videos + path: list for the organization. + examples: + request: + curl: | + curl https://api.openai.com/v1/videos \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from 'openai'; + + const openai = new OpenAI(); + + // Automatically fetches more pages as needed. + for await (const video of openai.videos.list()) { + console.log(video.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.videos.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Videos.List(context.TODO(), openai.VideoListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.videos.list + + puts(page) + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.videos.VideoListPage; + import com.openai.models.videos.VideoListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VideoListPage page = client.videos().list(); + } + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const video of client.videos.list()) { + console.log(video.id); + } + response: | + { + "data": [ + { + "id": "video_123", + "object": "video", + "model": "sora-2", + "status": "completed" + } + ], + "object": "list" + } + /videos/characters: + post: + tags: + - Videos + summary: 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/VideoCharacterResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.videos.createCharacter({ + name: 'x', + video: fs.createReadStream('path/to/file'), + }); + + console.log(response.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.videos.create_character( + name="x", + video=b"Example data", + ) + print(response.id) + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Videos.NewCharacter(context.TODO(), openai.VideoNewCharacterParams{\n\t\tName: \"x\",\n\t\tVideo: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.videos.VideoCreateCharacterParams; + import com.openai.models.videos.VideoCreateCharacterResponse; + import java.io.ByteArrayInputStream; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VideoCreateCharacterParams params = VideoCreateCharacterParams.builder() + .name("x") + .video(new ByteArrayInputStream("Example data".getBytes())) + .build(); + VideoCreateCharacterResponse response = client.videos().createCharacter(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + response = openai.videos.create_character(name: "x", video: + StringIO.new("Example data")) + + + puts(response) + /videos/characters/{character_id}: + get: + tags: + - Videos + summary: Fetch a character. + operationId: GetVideoCharacter + parameters: + - name: character_id + in: path + description: The identifier of the character to retrieve. + required: true + schema: + example: char_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/VideoCharacterResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.videos.getCharacter('char_123'); + + console.log(response.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.videos.get_character( + "char_123", + ) + print(response.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Videos.GetCharacter(context.TODO(), \"char_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.videos.VideoGetCharacterParams; + import com.openai.models.videos.VideoGetCharacterResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VideoGetCharacterResponse response = client.videos().getCharacter("char_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.videos.get_character("char_123") + + puts(response) + /videos/edits: + post: + tags: + - Videos + 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' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/VideoResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const video = await client.videos.edit({ prompt: 'x', video: + fs.createReadStream('path/to/file') }); + + + console.log(video.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + video = client.videos.edit( + prompt="x", + video=b"Example data", + ) + print(video.id) + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvideo, err := client.Videos.Edit(context.TODO(), openai.VideoEditParams{\n\t\tPrompt: \"x\",\n\t\tVideo: openai.VideoEditParamsVideoUnion{\n\t\t\tOfFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", video.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.videos.Video; + import com.openai.models.videos.VideoEditParams; + import java.io.ByteArrayInputStream; + import java.io.InputStream; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VideoEditParams params = VideoEditParams.builder() + .prompt("x") + .video(new ByteArrayInputStream("Example data".getBytes())) + .build(); + Video video = client.videos().edit(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + video = openai.videos.edit(prompt: "x", video: + StringIO.new("Example data")) + + + puts(video) + /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' + application/json: + schema: + $ref: '#/components/schemas/CreateVideoExtendJsonBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/VideoResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const video = await client.videos.extend({ + prompt: 'x', + seconds: '4', + video: fs.createReadStream('path/to/file'), + }); + + console.log(video.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + video = client.videos.extend( + prompt="x", + seconds="4", + video=b"Example data", + ) + print(video.id) + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvideo, err := client.Videos.Extend(context.TODO(), openai.VideoExtendParams{\n\t\tPrompt: \"x\",\n\t\tSeconds: openai.VideoSeconds4,\n\t\tVideo: openai.VideoExtendParamsVideoUnion{\n\t\t\tOfFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", video.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.videos.Video; + import com.openai.models.videos.VideoExtendParams; + import com.openai.models.videos.VideoSeconds; + import java.io.ByteArrayInputStream; + import java.io.InputStream; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VideoExtendParams params = VideoExtendParams.builder() + .prompt("x") + .seconds(VideoSeconds._4) + .video(new ByteArrayInputStream("Example data".getBytes())) + .build(); + Video video = client.videos().extend(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + video = openai.videos.extend_(prompt: "x", seconds: :"4", video: + StringIO.new("Example data")) + + + puts(video) + /videos/{video_id}: + get: + tags: + - Videos + summary: Fetch the latest metadata for a generated video. + operationId: GetVideo + parameters: + - name: video_id + in: path + description: The identifier of the video to retrieve. + required: true + schema: + example: video_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/VideoResource' + x-oaiMeta: + name: Retrieve video + group: videos + path: retrieve matching the provided identifier. + examples: + response: '' + request: + javascript: | + import OpenAI from 'openai'; + + const client = new OpenAI(); + + const video = await client.videos.retrieve('video_123'); + + console.log(video.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + video = client.videos.retrieve( + "video_123", + ) + print(video.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvideo, err := client.Videos.Get(context.TODO(), \"video_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", video.ID)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + video = openai.videos.retrieve("video_123") + + puts(video) + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.videos.Video; + import com.openai.models.videos.VideoRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Video video = client.videos().retrieve("video_123"); + } + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const video = await client.videos.retrieve('video_123'); + + console.log(video.id); + delete: + tags: + - Videos + summary: 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: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedVideoResource' + x-oaiMeta: + name: Delete video + group: videos + path: delete + examples: + response: '' + request: + javascript: | + import OpenAI from 'openai'; + + const client = new OpenAI(); + + const video = await client.videos.delete('video_123'); + + console.log(video.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + video = client.videos.delete( + "video_123", + ) + print(video.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvideo, err := client.Videos.Delete(context.TODO(), \"video_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", video.ID)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + video = openai.videos.delete("video_123") + + puts(video) + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.videos.VideoDeleteParams; + import com.openai.models.videos.VideoDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VideoDeleteResponse video = client.videos().delete("video_123"); + } + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const video = await client.videos.delete('video_123'); + + console.log(video.id); + /videos/{video_id}/content: + get: + tags: + - Videos + summary: |- + Download the generated video bytes or a derived preview asset. + + Streams the rendered video content for the specified video job. + operationId: RetrieveVideoContent + parameters: + - name: video_id + in: path + description: The identifier of the video whose media to download. + required: true + schema: + 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 video bytes or preview asset that matches the requested variant. + content: + video/mp4: + schema: + type: string + format: binary + image/webp: + schema: + type: string + format: binary + application/json: + schema: + type: string + x-oaiMeta: + name: Retrieve video content + group: videos + path: content + examples: + response: '' + request: + javascript: | + import OpenAI from 'openai'; + + const client = new OpenAI(); + + const response = await client.videos.downloadContent('video_123'); + + console.log(response); + + const content = await response.blob(); + console.log(content); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.videos.download_content( + video_id="video_123", + ) + print(response) + content = response.read() + print(content) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Videos.DownloadContent(\n\t\tcontext.TODO(),\n\t\t\"video_123\",\n\t\topenai.VideoDownloadContentParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.videos.download_content("video_123") + + puts(response) + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.http.HttpResponse; + import com.openai.models.videos.VideoDownloadContentParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + HttpResponse response = client.videos().downloadContent("video_123"); + } + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.videos.downloadContent('video_123'); + + console.log(response); + + const content = await response.blob(); + console.log(content); + /videos/{video_id}/remix: + post: + tags: + - Videos + summary: Create a remix of a completed video using a refreshed prompt. + operationId: CreateVideoRemix + parameters: + - name: video_id + in: path + description: The identifier of the completed video to remix. + required: true + schema: + example: video_123 + type: string + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateVideoRemixBody' + application/json: + schema: + $ref: '#/components/schemas/CreateVideoRemixBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/VideoResource' + x-oaiMeta: + name: Remix video + group: videos + path: remix using the provided prompt. + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/videos/video_123/remix \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "prompt": "Extend the scene with the cat taking a bow to the cheering audience" + }' + javascript: > + import OpenAI from 'openai'; + + + const client = new OpenAI(); + + + const video = await client.videos.remix('video_123', { prompt: + 'Extend the scene with the cat taking a bow to the cheering + audience' }); + + + console.log(video.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + video = client.videos.remix( + video_id="video_123", + prompt="x", + ) + print(video.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvideo, err := client.Videos.Remix(\n\t\tcontext.TODO(),\n\t\t\"video_123\",\n\t\topenai.VideoRemixParams{\n\t\t\tPrompt: \"x\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", video.ID)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + video = openai.videos.remix("video_123", prompt: "x") + + puts(video) + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.videos.Video; + import com.openai.models.videos.VideoRemixParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VideoRemixParams params = VideoRemixParams.builder() + .videoId("video_123") + .prompt("x") + .build(); + Video video = client.videos().remix(params); + } + } + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const video = await client.videos.remix('video_123', { prompt: 'x' + }); + + + console.log(video.id); + response: | + { + "id": "video_456", + "object": "video", + "model": "sora-2", + "status": "queued", + "progress": 0, + "created_at": 1712698600, + "size": "720x1280", + "seconds": "8", + "remixed_from_video_id": "video_123" + } + /responses/input_tokens: + post: + summary: >- + Returns input token counts of the request. + + + Returns 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' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/TokenCountsBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/TokenCountsResource' + x-oaiMeta: + name: Get input token counts + group: responses + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/responses/input_tokens \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5", + "input": "Tell me a joke." + }' + javascript: | + import OpenAI from "openai"; + + const client = new OpenAI(); + + const response = await client.responses.inputTokens.count({ + model: "gpt-5", + input: "Tell me a joke.", + }); + + console.log(response.input_tokens); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.responses.input_tokens.count() + print(response.input_tokens) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Responses.InputTokens.Count(context.TODO(), responses.InputTokenCountParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.InputTokens)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.responses.input_tokens.count + + puts(response) + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.responses.inputtokens.InputTokenCountParams; + + import + com.openai.models.responses.inputtokens.InputTokenCountResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + InputTokenCountResponse response = client.responses().inputTokens().count(); + } + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.responses.inputTokens.count(); + + console.log(response.input_tokens); + response: | + { + "object": "response.input_tokens", + "input_tokens": 11 + } + /responses/compact: + post: + summary: >- + Compact a conversation. Returns a compacted response object. + + + Learn when and how to compact long-running conversations in the + [conversation state + guide](/docs/guides/conversation-state#managing-the-context-window). For + ZDR-compatible compaction details, see [Compaction + (advanced)](/docs/guides/conversation-state#compaction-advanced). + operationId: Compactconversation + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CompactResponseMethodPublicBody' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/CompactResponseMethodPublicBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/CompactResource' + x-oaiMeta: + name: Compact a response + group: responses + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/responses/compact \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.1-codex-max", + "input": [ + { + "role": "user", + "content": "Create a simple landing page for a dog petting café." + }, + { + "id": "msg_001", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "Below is a single file, ready-to-use landing page for a dog petting café:..." + } + ], + "role": "assistant" + } + ] + }' + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + // Compact the previous response if you are running out of tokens + const compactedResponse = await openai.responses.compact({ + model: "gpt-5.1-codex-max", + input: [ + { + role: "user", + content: "Create a simple landing page for a dog petting café.", + }, + // All items returned from previous requests are included here, like reasoning, message, function call, etc. + { + id: "msg_030d085c0b53e67e0069332e3a72d4819c96c6f2c4adc15d33", + type: "message", + status: "completed", + content: [ + { + type: "output_text", + annotations: [], + logprobs: [], + text: "Below is a single file, ready-to-use landing page for a dog petting café:...", + }, + ], + role: "assistant", + }, + ], + }); + + // Pass the compactedResponse.output as input to the next request + console.log(compactedResponse); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + compacted_response = client.responses.compact( + model="gpt-5.4", + ) + print(compacted_response.id) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const compactedResponse = await client.responses.compact({ model: + 'gpt-5.4' }); + + + console.log(compactedResponse.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcompactedResponse, err := client.Responses.Compact(context.TODO(), responses.ResponseCompactParams{\n\t\tModel: responses.ResponseCompactParamsModelGPT5_4,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", compactedResponse.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.responses.CompactedResponse; + import com.openai.models.responses.ResponseCompactParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ResponseCompactParams params = ResponseCompactParams.builder() + .model(ResponseCompactParams.Model.GPT_5_4) + .build(); + CompactedResponse compactedResponse = client.responses().compact(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + compacted_response = openai.responses.compact(model: :"gpt-5.4") + + puts(compacted_response) + response: | + { + "id": "resp_001", + "object": "response.compaction", + "created_at": 1764967971, + "output": [ + { + "id": "msg_000", + "type": "message", + "status": "completed", + "content": [ + { + "type": "input_text", + "text": "Create a simple landing page for a dog petting cafe." + } + ], + "role": "user" + }, + { + "id": "cmp_001", + "type": "compaction", + "encrypted_content": "gAAAAABpM0Yj-...=" + } + ], + "usage": { + "input_tokens": 139, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 438, + "output_tokens_details": { + "reasoning_tokens": 64 + }, + "total_tokens": 577 + } + } + /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' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.skills.create(); + + console.log(skill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill = client.skills.create() + print(skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskill, err := client.Skills.New(context.TODO(), openai.SkillNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.Skill; + import com.openai.models.skills.SkillCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Skill skill = client.skills().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill = openai.skills.create + + puts(skill) + get: + tags: + - Skills + summary: 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 + 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/OrderEnum' + - 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 + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillListResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const skill of client.skills.list()) { + console.log(skill.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.skills.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Skills.List(context.TODO(), openai.SkillListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.SkillListPage; + import com.openai.models.skills.SkillListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SkillListPage page = client.skills().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.skills.list + + puts(page) + /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 + schema: + example: skill_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedSkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const deletedSkill = await client.skills.delete('skill_123'); + + console.log(deletedSkill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + deleted_skill = client.skills.delete( + "skill_123", + ) + print(deleted_skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tdeletedSkill, err := client.Skills.Delete(context.TODO(), \"skill_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", deletedSkill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.DeletedSkill; + import com.openai.models.skills.SkillDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + DeletedSkill deletedSkill = client.skills().delete("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + deleted_skill = openai.skills.delete("skill_123") + + puts(deleted_skill) + 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 + schema: + example: skill_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.skills.retrieve('skill_123'); + + console.log(skill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill = client.skills.retrieve( + "skill_123", + ) + print(skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskill, err := client.Skills.Get(context.TODO(), \"skill_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.Skill; + import com.openai.models.skills.SkillRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Skill skill = client.skills().retrieve("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill = openai.skills.retrieve("skill_123") + + puts(skill) + 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 + schema: + example: skill_123 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SetDefaultSkillVersionBody' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/SetDefaultSkillVersionBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const skill = await client.skills.update('skill_123', { + default_version: 'default_version' }); + + + console.log(skill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill = client.skills.update( + skill_id="skill_123", + default_version="default_version", + ) + print(skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskill, err := client.Skills.Update(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\topenai.SkillUpdateParams{\n\t\t\tDefaultVersion: \"default_version\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.Skill; + import com.openai.models.skills.SkillUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SkillUpdateParams params = SkillUpdateParams.builder() + .skillId("skill_123") + .defaultVersion("default_version") + .build(); + Skill skill = client.skills().update(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + skill = openai.skills.update("skill_123", default_version: + "default_version") + + + puts(skill) + /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. + content: + application/zip: + schema: + type: string + format: binary + application/json: + schema: + type: string + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const content = await client.skills.content.retrieve('skill_123'); + + console.log(content); + + const data = await content.blob(); + console.log(data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + content = client.skills.content.retrieve( + "skill_123", + ) + print(content) + data = content.read() + print(data) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcontent, err := client.Skills.Content.Get(context.TODO(), \"skill_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", content)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.http.HttpResponse; + import com.openai.models.skills.content.ContentRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + HttpResponse content = client.skills().content().retrieve("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + content = openai.skills.content.retrieve("skill_123") + + puts(content) + /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 + content: + application/json: + schema: + $ref: '#/components/schemas/SkillVersionResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const skillVersion = await + client.skills.versions.create('skill_123'); + + + console.log(skillVersion.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill_version = client.skills.versions.create( + skill_id="skill_123", + ) + print(skill_version.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskillVersion, err := client.Skills.Versions.New(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\topenai.SkillVersionNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skillVersion.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.SkillVersion; + import com.openai.models.skills.versions.VersionCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SkillVersion skillVersion = client.skills().versions().create("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill_version = openai.skills.versions.create("skill_123") + + puts(skill_version) + get: + tags: + - Skills + summary: 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 + - name: limit + in: query + description: Number of versions to retrieve. + required: false + schema: + type: integer + minimum: 0 + maximum: 100 + - 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/SkillVersionListResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const skillVersion of + client.skills.versions.list('skill_123')) { + console.log(skillVersion.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.skills.versions.list( + skill_id="skill_123", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Skills.Versions.List(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\topenai.SkillVersionListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.VersionListPage; + import com.openai.models.skills.versions.VersionListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VersionListPage page = client.skills().versions().list("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.skills.versions.list("skill_123") + + puts(page) + /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' + x-oaiMeta: + examples: + response: '' + request: + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const skillVersion = await + client.skills.versions.retrieve('version', { skill_id: 'skill_123' + }); + + + console.log(skillVersion.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill_version = client.skills.versions.retrieve( + version="version", + skill_id="skill_123", + ) + print(skill_version.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskillVersion, err := client.Skills.Versions.Get(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\t\"version\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skillVersion.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.SkillVersion; + import com.openai.models.skills.versions.VersionRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VersionRetrieveParams params = VersionRetrieveParams.builder() + .skillId("skill_123") + .version("version") + .build(); + SkillVersion skillVersion = client.skills().versions().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + skill_version = openai.skills.versions.retrieve("version", + skill_id: "skill_123") + + + puts(skill_version) + 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 + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedSkillVersionResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const deletedSkillVersion = await + client.skills.versions.delete('version', { + skill_id: 'skill_123', + }); + + + console.log(deletedSkillVersion.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + deleted_skill_version = client.skills.versions.delete( + version="version", + skill_id="skill_123", + ) + print(deleted_skill_version.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tdeletedSkillVersion, err := client.Skills.Versions.Delete(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\t\"version\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", deletedSkillVersion.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.DeletedSkillVersion; + import com.openai.models.skills.versions.VersionDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VersionDeleteParams params = VersionDeleteParams.builder() + .skillId("skill_123") + .version("version") + .build(); + DeletedSkillVersion deletedSkillVersion = client.skills().versions().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + deleted_skill_version = openai.skills.versions.delete("version", + skill_id: "skill_123") + + + puts(deleted_skill_version) + /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. + content: + application/zip: + schema: + type: string + format: binary + application/json: + schema: + type: string + x-oaiMeta: + examples: + response: '' + request: + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const content = await + client.skills.versions.content.retrieve('version', { skill_id: + 'skill_123' }); + + + console.log(content); + + + const data = await content.blob(); + + console.log(data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + content = client.skills.versions.content.retrieve( + version="version", + skill_id="skill_123", + ) + print(content) + data = content.read() + print(data) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcontent, err := client.Skills.Versions.Content.Get(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\t\"version\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", content)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.core.http.HttpResponse; + + import + com.openai.models.skills.versions.content.ContentRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContentRetrieveParams params = ContentRetrieveParams.builder() + .skillId("skill_123") + .version("version") + .build(); + HttpResponse content = client.skills().versions().content().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + content = openai.skills.versions.content.retrieve("version", + skill_id: "skill_123") + + + puts(content) + /chatkit/sessions/{session_id}/cancel: + post: + summary: |- + Cancel an active ChatKit session and return its most recent metadata. + + Cancelling 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/ChatSessionResource' + x-oaiMeta: + name: Cancel chat session + group: chatkit + beta: true + path: cancel-session new requests from using the issued client secret. + examples: + request: + curl: | + curl -X POST \ + https://api.openai.com/v1/chatkit/sessions/cksess_123/cancel \ + -H "OpenAI-Beta: chatkit_beta=v1" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: > + import OpenAI from 'openai'; + + + const client = new OpenAI(); + + + const chatSession = await + client.beta.chatkit.sessions.cancel('cksess_123'); + + + console.log(chatSession.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + chat_session = client.beta.chatkit.sessions.cancel( + "cksess_123", + ) + print(chat_session.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatSession, err := client.Beta.ChatKit.Sessions.Cancel(context.TODO(), \"cksess_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatSession.ID)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + chat_session = openai.beta.chatkit.sessions.cancel("cksess_123") + + puts(chat_session) + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.beta.chatkit.sessions.SessionCancelParams; + + import com.openai.models.beta.chatkit.threads.ChatSession; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ChatSession chatSession = client.beta().chatkit().sessions().cancel("cksess_123"); + } + } + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const chatSession = await + client.beta.chatkit.sessions.cancel('cksess_123'); + + + console.log(chatSession.id); + response: | + { + "id": "cksess_123", + "object": "chatkit.session", + "workflow": { + "id": "workflow_alpha", + "version": "1" + }, + "scope": { + "customer_id": "cust_456" + }, + "max_requests_per_1_minute": 30, + "ttl_seconds": 900, + "status": "cancelled", + "cancelled_at": 1712345678 + } + /chatkit/sessions: + post: + summary: Create a ChatKit session. + operationId: CreateChatSessionMethod + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateChatSessionBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ChatSessionResource' + 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 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: chatkit_beta=v1" \ + -d '{ + "workflow": { + "id": "workflow_alpha", + "version": "2024-10-01" + }, + "scope": { + "project": "alpha", + "environment": "staging" + }, + "expires_after": 1800, + "max_requests_per_1_minute": 60, + "max_requests_per_session": 500 + }' + javascript: > + import OpenAI from 'openai'; + + + const client = new OpenAI(); + + + const chatSession = await client.beta.chatkit.sessions.create({ + user: 'user', workflow: { id: 'id' } }); + + + console.log(chatSession.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + chat_session = client.beta.chatkit.sessions.create( + user="x", + workflow={ + "id": "id" + }, + ) + print(chat_session.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatSession, err := client.Beta.ChatKit.Sessions.New(context.TODO(), openai.BetaChatKitSessionNewParams{\n\t\tUser: \"x\",\n\t\tWorkflow: openai.ChatSessionWorkflowParam{\n\t\t\tID: \"id\",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatSession.ID)\n}\n" + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + chat_session = openai.beta.chatkit.sessions.create(user: "x", + workflow: {id: "id"}) + + + puts(chat_session) + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.beta.chatkit.sessions.SessionCreateParams; + + import com.openai.models.beta.chatkit.threads.ChatSession; + + import + com.openai.models.beta.chatkit.threads.ChatSessionWorkflowParam; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SessionCreateParams params = SessionCreateParams.builder() + .user("x") + .workflow(ChatSessionWorkflowParam.builder() + .id("id") + .build()) + .build(); + ChatSession chatSession = client.beta().chatkit().sessions().create(params); + } + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const chatSession = await client.beta.chatkit.sessions.create({ + user: 'x', + workflow: { id: 'id' }, + }); + + console.log(chatSession.id); + response: | + { + "client_secret": "chatkit_token_123", + "expires_at": 1735689600, + "workflow": { + "id": "workflow_alpha", + "version": "2024-10-01" + }, + "scope": { + "project": "alpha", + "environment": "staging" + }, + "max_requests_per_1_minute": 60, + "max_requests_per_session": 500, + "status": "active" + } + /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 + - 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/ThreadItemListResource' + 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" + \ + -H "OpenAI-Beta: chatkit_beta=v1" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: > + import OpenAI from 'openai'; + + + const client = new OpenAI(); + + + // Automatically fetches more pages as needed. + + for await (const thread of + client.beta.chatkit.threads.listItems('cthr_123')) { + console.log(thread); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.chatkit.threads.list_items( + thread_id="cthr_123", + ) + page = page.data[0] + print(page) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.ChatKit.Threads.ListItems(\n\t\tcontext.TODO(),\n\t\t\"cthr_123\",\n\t\topenai.BetaChatKitThreadListItemsParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.chatkit.threads.list_items("cthr_123") + + puts(page) + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.chatkit.threads.ThreadListItemsPage; + + import + com.openai.models.beta.chatkit.threads.ThreadListItemsParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadListItemsPage page = client.beta().chatkit().threads().listItems("cthr_123"); + } + } + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const thread of + client.beta.chatkit.threads.listItems('cthr_123')) { + console.log(thread); + } + response: | + { + "data": [ + { + "id": "cthi_user_001", + "object": "chatkit.thread_item", + "type": "user_message", + "content": [ + { + "type": "input_text", + "text": "I need help debugging an onboarding issue." + } + ], + "attachments": [] + }, + { + "id": "cthi_assistant_002", + "object": "chatkit.thread_item", + "type": "assistant_message", + "content": [ + { + "type": "output_text", + "text": "Let's start by confirming the workflow version you deployed." + } + ] + } + ], + "has_more": false, + "object": "list" + } + /chatkit/threads/{thread_id}: + get: + summary: Retrieve a ChatKit thread by its identifier. + operationId: GetThreadMethod + parameters: + - name: thread_id + in: path + description: Identifier of the ChatKit thread to retrieve. + required: true + schema: + example: cthr_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadResource' + x-oaiMeta: + name: Retrieve ChatKit thread + group: chatkit + beta: true + path: threads/retrieve + examples: + request: + curl: | + curl https://api.openai.com/v1/chatkit/threads/cthr_abc123 \ + -H "OpenAI-Beta: chatkit_beta=v1" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: > + import OpenAI from 'openai'; + + + const client = new OpenAI(); + + + const chatkitThread = await + client.beta.chatkit.threads.retrieve('cthr_123'); + + + console.log(chatkitThread.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + chatkit_thread = client.beta.chatkit.threads.retrieve( + "cthr_123", + ) + print(chatkit_thread.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tchatkitThread, err := client.Beta.ChatKit.Threads.Get(context.TODO(), \"cthr_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", chatkitThread.ID)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + chatkit_thread = openai.beta.chatkit.threads.retrieve("cthr_123") + + puts(chatkit_thread) + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.chatkit.threads.ChatKitThread; + + import + com.openai.models.beta.chatkit.threads.ThreadRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ChatKitThread chatkitThread = client.beta().chatkit().threads().retrieve("cthr_123"); + } + } + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const chatkitThread = await + client.beta.chatkit.threads.retrieve('cthr_123'); + + + console.log(chatkitThread.id); + response: | + { + "id": "cthr_abc123", + "object": "chatkit.thread", + "title": "Customer escalation", + "items": { + "data": [ + { + "id": "cthi_user_001", + "object": "chatkit.thread_item", + "type": "user_message", + "content": [ + { + "type": "input_text", + "text": "I need help debugging an onboarding issue." + } + ], + "attachments": [] + }, + { + "id": "cthi_assistant_002", + "object": "chatkit.thread_item", + "type": "assistant_message", + "content": [ + { + "type": "output_text", + "text": "Let's start by confirming the workflow version you deployed." + } + ] + } + ], + "has_more": false + } + } + delete: + summary: 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/DeletedThreadResource' + x-oaiMeta: + beta: true + examples: + response: '' + request: + javascript: > + import OpenAI from 'openai'; + + + const client = new OpenAI(); + + + const thread = await + client.beta.chat_kit.threads.delete('cthr_123'); + + + console.log(thread.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.chatkit.threads.delete( + "cthr_123", + ) + print(thread.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.ChatKit.Threads.Delete(context.TODO(), \"cthr_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.chatkit.threads.delete("cthr_123") + + puts(thread) + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.chatkit.threads.ThreadDeleteParams; + + import + com.openai.models.beta.chatkit.threads.ThreadDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadDeleteResponse thread = client.beta().chatkit().threads().delete("cthr_123"); + } + } + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const thread = await + client.beta.chatkit.threads.delete('cthr_123'); + + + console.log(thread.id); + 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 + - 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: 1 + maxLength: 512 + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadListResource' + x-oaiMeta: + name: List ChatKit threads + group: chatkit + beta: true + path: list-threads scope. + examples: + request: + curl: > + curl + "https://api.openai.com/v1/chatkit/threads?limit=2&order=desc" \ + -H "OpenAI-Beta: chatkit_beta=v1" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: > + import OpenAI from 'openai'; + + + const client = new OpenAI(); + + + // Automatically fetches more pages as needed. + + for await (const chatkitThread of + client.beta.chatkit.threads.list()) { + console.log(chatkitThread.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.chatkit.threads.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.ChatKit.Threads.List(context.TODO(), openai.BetaChatKitThreadListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.chatkit.threads.list + + puts(page) + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.chatkit.threads.ThreadListPage; + import com.openai.models.beta.chatkit.threads.ThreadListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadListPage page = client.beta().chatkit().threads().list(); + } + } + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const chatkitThread of + client.beta.chatkit.threads.list()) { + console.log(chatkitThread.id); + } + response: | + { + "data": [ + { + "id": "cthr_abc123", + "object": "chatkit.thread", + "title": "Customer escalation" + }, + { + "id": "cthr_def456", + "object": "chatkit.thread", + "title": "Demo feedback" + } + ], + "has_more": false, + "object": "list" + } +webhooks: + batch_cancelled: + post: + description: | + Sent when a batch has been cancelled. + 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 + + status codes will be retried. + batch_completed: + post: + description: | + Sent when a batch has completed processing. + 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 + + status codes will be retried. + batch_expired: + post: + description: | + Sent when a batch has expired before completion. + 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 + + status codes will be retried. + batch_failed: + post: + description: | + Sent when a batch has failed. + 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 + + status codes will be retried. + eval_run_canceled: + post: + description: | + Sent when an eval run has been canceled. + 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 + + status codes will be retried. + eval_run_failed: + post: + description: | + Sent when an eval run has failed. + 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 + + status codes will be retried. + eval_run_succeeded: + post: + description: | + Sent when an eval run has succeeded. + 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 + + status codes will be retried. + fine_tuning_job_cancelled: + post: + description: | + Sent when a fine-tuning job has been cancelled. + 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 + + status codes will be retried. + fine_tuning_job_failed: + post: + description: | + Sent when a fine-tuning job has failed. + 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 + + status codes will be retried. + fine_tuning_job_succeeded: + post: + description: | + Sent when a fine-tuning job has succeeded. + 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 + + status codes will be retried. + realtime_call_incoming: + post: + description: | + Sent when Realtime API Receives a incoming SIP call. + 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 + + status codes will be retried. + response_cancelled: + post: + description: | + Sent when a background response has been cancelled. + 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 + + status codes will be retried. + response_completed: + post: + description: | + Sent when a background response has completed successfully. + 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 + + status codes will be retried. + response_failed: + post: + description: | + Sent when a background response has failed. + 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 + + status codes will be retried. + response_incomplete: + post: + description: | + Sent when a background response is incomplete. + 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 + + status codes will be retried. +components: + schemas: + AddUploadPartRequest: + type: object + additionalProperties: false + properties: + data: + description: | + The chunk of bytes for this Part. + 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 + name: + anyOf: + - type: string + - type: 'null' + 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 + created_at: + type: integer + format: unixtime + example: 1711471533 + description: The Unix timestamp (in seconds) of when the API key was created + 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' + 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 + - id + - owner + x-oaiMeta: + name: The admin API key object + example: | + { + "object": "organization.admin_api_key", + "id": "key_abc", + "name": "Main Admin Key", + "redacted_value": "sk-admin...xyz", + "created_at": 1711471533, + "last_used_at": 1711471534, + "owner": { + "type": "user", + "object": "organization.user", + "id": "user_123", + "name": "John Doe", + "created_at": 1711471533, + "role": "owner" + } + } + AdminApiKeyCreateResponse: + allOf: + - $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: + value: + type: string + example: sk-admin-1234abcd + description: The value of the API key. Only shown on create. + required: + - value + ApiKeyList: + type: object + properties: + 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: string + - type: 'null' + example: key_abc + last_id: + anyOf: + - type: string + - type: 'null' + 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. + permissions: + type: array + description: Permissions associated with the role. + items: + 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: int64 + - 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' + required: + - id + - name + - permissions + - resource_type + - predefined_role + - description + - created_at + - updated_at + - created_by + - created_by_user_obj + - metadata + 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. + type: string + maxLength: 256 + - type: 'null' + description: + anyOf: + - description: > + The description of the assistant. The maximum length is 512 + characters. + type: string + maxLength: 512 + - type: 'null' + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. + type: string + instructions: + anyOf: + - description: > + The system instructions that the assistant uses. The maximum + length is 256,000 characters. + 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`. + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter`` tool. There can be + a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The ID of the [vector + store](/docs/api-reference/vector-stores/object) + attached to this assistant. There can be a maximum of 1 + vector store attached to the assistant. + 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. + 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. + + + We generally recommend altering this or temperature but not + both. + - type: 'null' + response_format: + anyOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + - type: 'null' + required: + - id + - object + - created_at + - name + - description + - model + - instructions + - tools + - metadata + x-oaiMeta: + name: The assistant object + example: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698984975, + "name": "Math Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + deprecated: true + AssistantStreamEvent: + description: > + Represents an event emitted when streaming a Run. + + + Each event in a server-sent events stream has an `event` and `data` + property: + + + ``` + + event: thread.created + + data: {"id": "thread_123", "object": "thread", ...} + + ``` + + + We emit events whenever a new object is created, transitions to a new + state, or is being + + streamed in parts (deltas). For example, we emit `thread.run.created` + when a new run + + is created, `thread.run.completed` when a run completes, and so on. When + an Assistant chooses + + to create a message during a run, we emit a `thread.message.created + event`, a + + `thread.message.in_progress` event, many `thread.message.delta` events, + and finally a + + `thread.message.completed` event. + + + We may add additional events over time, so we recommend handling unknown + events gracefully + + in your code. See the [Assistants API + quickstart](/docs/assistants/overview) to learn how to + + integrate the Assistants API with streaming. + oneOf: + - $ref: '#/components/schemas/ThreadStreamEvent' + - $ref: '#/components/schemas/RunStreamEvent' + - $ref: '#/components/schemas/RunStepStreamEvent' + - $ref: '#/components/schemas/MessageStreamEvent' + - $ref: '#/components/schemas/ErrorEvent' + - $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 + 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. + + + Note that the file search tool may output fewer than + `max_num_results` results. See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. + 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](/docs/models#gpt-4o), [GPT-4 + Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models + since `gpt-3.5-turbo-1106`. + + + Setting 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](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures + the message the model generates is valid JSON. + + + **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. + oneOf: + - type: string + description: | + `auto` is the default value + 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. + + `none` means the model will not call any tools and instead generates a + message. + + `auto` is the default value and 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. + + Specifying a particular tool like `{"type": "file_search"}` or `{"type": + "function", "function": {"name": "my_function"}}` forces the model to + call that tool. + 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. + 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: + - 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. + 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. + 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-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. + anyOf: + - type: string + - type: string + enum: + - whisper-1 + - gpt-4o-mini-transcribe + - gpt-4o-mini-transcribe-2025-12-15 + - gpt-4o-transcribe + - gpt-4o-transcribe-diarize + - gpt-realtime-whisper + language: + type: string + 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. + prompt: + type: string + description: > + An optional text to guide the model's style or continue a previous + audio + + segment. + + For `whisper-1`, the [prompt is a list of + keywords](/docs/guides/speech-to-text#prompting). + + For `gpt-4o-transcribe` models (excluding + `gpt-4o-transcribe-diarize`), the prompt is a free text string, for + example "expect words related to technology". + + Prompt is not supported with `gpt-realtime-whisper` in GA Realtime + sessions. + delay: + type: string + description: > + Controls how long the model waits before emitting transcription + text. + + Higher values can improve transcription accuracy at the cost of + latency. + + Only supported with `gpt-realtime-whisper` in GA Realtime sessions. + enum: + - minimal + - low + - medium + - high + - xhigh + AudioTranscriptionResponse: + type: object + properties: + model: + description: > + The model used for transcription. Current options are `whisper-1`, + `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, + `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and + `gpt-realtime-whisper`. + anyOf: + - type: string + - type: string + enum: + - whisper-1 + - gpt-4o-mini-transcribe + - gpt-4o-mini-transcribe-2025-12-15 + - gpt-4o-transcribe + - gpt-4o-transcribe-diarize + - gpt-realtime-whisper + language: + type: string + description: | + The language of the input audio. + prompt: + type: string + description: | + The prompt configured for input audio transcription, when present. + 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. + 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"]` + 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"]` + 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. + 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. + checkpoint.permission.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the checkpoint permission. + 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. + 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. + 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. + group.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the group. + 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. + 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. + 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`. + invite.accepted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the invite. + invite.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the invite. + 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 + 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 + 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 + 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. + 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. + 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. + 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. + 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` + 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. + 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. + project.archived: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + project.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + 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. + rate_limit.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + 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: + 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. + 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. + role.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The role ID. + 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. + 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. + 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. + 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. + 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. + name: + type: string + description: The name of the certificate. + required: + - id + - type + - effective_at + x-oaiMeta: + name: The audit log object + example: | + { + "id": "req_xxx_20240101", + "type": "api_key.created", + "effective_at": 1720804090, + "actor": { + "type": "session", + "session": { + "user": { + "id": "user-xxx", + "email": "user@example.com" + }, + "ip_address": "127.0.0.1", + "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" + } + }, + "api_key.created": { + "id": "key_xxxx", + "data": { + "scopes": ["resource.operation"] + } + } + } + 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' + api_key: + $ref: '#/components/schemas/AuditLogActorApiKey' + 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. + type: + type: string + description: The type of API key. Can be either `user` or `service_account`. + enum: + - user + - service_account + user: + $ref: '#/components/schemas/AuditLogActorUser' + 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. + AuditLogActorSession: + type: object + description: The session in which the audit logged action was performed. + properties: + user: + $ref: '#/components/schemas/AuditLogActorUser' + 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. + 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 + - role.created + - role.updated + - role.deleted + - role.assignment.created + - role.assignment.deleted + - scim.enabled + - scim.disabled + - service_account.created + - service_account.updated + - service_account.deleted + - user.added + - user.updated + - user.deleted + 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 + object: + type: string + enum: + - batch + description: The object type, which is always `batch`. + x-stainless-const: true + endpoint: + type: string + description: The OpenAI API endpoint used by the batch. + model: + type: string + description: > + Model ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI + + offers a wide range of models with different capabilities, + performance + + characteristics, and price points. Refer to the [model + + guide](/docs/models) to browse and compare available models. + errors: + type: object + properties: + object: + type: string + description: The object type, which is always `list`. + data: + type: array + items: + 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 + description: >- + The name of the parameter that caused the error, if + applicable. + - type: 'null' + line: + anyOf: + - type: integer + description: >- + The line number of the input file where the error + occurred, if applicable. + - type: 'null' + input_file_id: + type: string + description: The ID of the input file for the batch. + completion_window: + type: string + description: The time frame within which the batch should be processed. + status: + type: string + description: The current status of the batch. + enum: + - validating + - failed + - in_progress + - finalizing + - completed + - expired + - cancelling + - cancelled + output_file_id: + type: string + description: >- + The ID of the file containing the outputs of successfully executed + requests. + error_file_id: + type: string + description: The ID of the file containing the outputs of requests with errors. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was created. + in_progress_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the batch started + processing. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch will expire. + finalizing_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the batch started + finalizing. + completed_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was completed. + failed_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch failed. + expired_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch expired. + cancelling_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the batch started + cancelling. + cancelled_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was cancelled. + request_counts: + 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. + failed: + type: integer + description: Number of requests that have failed. + required: + - total + - completed + - failed + description: The request counts for different statuses within the batch. + usage: + type: object + description: > + Represents token usage details including input tokens, output + tokens, a + + breakdown of output tokens, and the total tokens used. Only + populated on + + batches created after September 7, 2025. + 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 + + prompt caching](/docs/guides/prompt-caching). + 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. + 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: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/completions", + "model": "gpt-5-2025-08-07", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "usage": { + "input_tokens": 1500, + "input_tokens_details": { + "cached_tokens": 1024 + }, + "output_tokens": 500, + "output_tokens_details": { + "reasoning_tokens": 300 + }, + "total_tokens": 2000 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + 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 + required: + - anchor + - seconds + 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. + + + - If creating, updating, or getting a specific certificate, the + object type is `certificate`. + + - If listing, activating, or deactivating certificates for the + organization, the object type is `organization.certificate`. + + - If listing, activating, or deactivating certificates for a + project, the object type is `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. + 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: + - object + - id + - name + - created_at + - certificate_details + x-oaiMeta: + name: The certificate object + example: | + { + "object": "certificate", + "id": "cert_abc", + "name": "My Certificate", + "created_at": 1234567, + "certificate_details": { + "valid_at": 1234567, + "expires_at": 12345678, + "content": "-----BEGIN CERTIFICATE----- MIIGAjCCA...6znFlOW+ -----END CERTIFICATE-----" + } + } + ChatCompletionAllowedTools: + type: object + title: Allowed tools + description: | + Constrains the tools available to the model to a pre-defined set. + properties: + mode: + type: string + enum: + - auto + - required + description: > + Constrains the tools available to the model to a pre-defined set. + + + `auto` allows the model to pick from among the allowed tools and + generate a + + message. + + + `required` requires the model to call one or more of the allowed + tools. + tools: + type: array + description: > + A list of tool definitions that the model should be allowed to call. + + + For the Chat Completions API, the list of tool definitions might + look like: + + ```json + + [ + { "type": "function", "function": { "name": "get_weather" } }, + { "type": "function", "function": { "name": "get_time" } } + ] + + ``` + items: + type: object + x-oaiExpandable: false + description: | + A tool definition that the model should be allowed to call. + additionalProperties: true + required: + - mode + - tools + ChatCompletionAllowedToolsChoice: + type: object + title: Allowed tools + description: | + Constrains the tools available to the model to a pre-defined set. + 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' + 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 + id: + type: string + description: The ID of the chat completion that was deleted. + 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. + 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: + 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' + required: + - name + ChatCompletionList: + type: object + title: ChatCompletionList + description: | + An object representing a list of Chat Completions. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of chat completion objects. + items: + $ref: '#/components/schemas/CreateChatCompletionResponse' + 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: | + { + "object": "list", + "data": [ + { + "object": "chat.completion", + "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "model": "gpt-4o-2024-08-06", + "created": 1738960610, + "request_id": "req_ded8ab984ec4bf840f37566c1011c417", + "tool_choice": null, + "usage": { + "total_tokens": 31, + "completion_tokens": 18, + "prompt_tokens": 13 + }, + "seed": 4944116822809979520, + "top_p": 1.0, + "temperature": 1.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0, + "system_fingerprint": "fp_50cad350e4", + "input_user": null, + "service_tier": "default", + "tools": null, + "metadata": {}, + "choices": [ + { + "index": 0, + "message": { + "content": "Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark.", + "role": "assistant", + "tool_calls": null, + "function_call": null + }, + "finish_reason": "stop", + "logprobs": null + } + ], + "response_format": null + } + ], + "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "has_more": false + } + ChatCompletionMessageCustomToolCall: + type: object + title: Custom tool call + description: | + A call to a custom tool created by the model. + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - custom + description: The type of the tool. Always `custom`. + x-stainless-const: true + 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 + - custom + ChatCompletionMessageList: + type: object + title: ChatCompletionMessageList + description: | + An object representing a list of chat completion messages. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of chat completion message objects. + 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. + + Otherwise, null. + items: + oneOf: + - $ref: >- + #/components/schemas/ChatCompletionRequestMessageContentPartText + - $ref: >- + #/components/schemas/ChatCompletionRequestMessageContentPartImage + - type: 'null' + first_id: + type: string + description: The identifier of the first chat message in the data array. + last_id: + type: string + description: The identifier of the last chat message in the data array. + has_more: + type: boolean + description: Indicates whether there are more chat messages available. + required: + - object + - data + - first_id + - last_id + - has_more + x-oaiMeta: + name: The chat completion message list object + group: chat + example: | + { + "object": "list", + "data": [ + { + "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "role": "user", + "content": "write a haiku about ai", + "name": null, + "content_parts": null + } + ], + "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "has_more": false + } + ChatCompletionMessageToolCall: + type: object + title: Function tool call + description: | + A call to a function tool created by the model. + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + x-stainless-const: true + function: + type: object + 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 + - function + ChatCompletionMessageToolCallChunk: + type: object + properties: + index: + type: integer + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + x-stainless-const: true + 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. + 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. + + Most models are capable of generating text, which is the default: + + + `["text"]` + + + The `gpt-4o-audio-preview` model can also be used to [generate + audio](/docs/guides/audio). To + + request that this model generate both text and audio responses, you + can + + use: + + + `["text", "audio"]` + items: + type: string + enum: + - text + - audio + - type: 'null' + 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 + 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. + 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. + - type: 'null' + refusal: + anyOf: + - type: string + description: The refusal message by the assistant. + - type: 'null' + 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: object + description: | + Data about a previous audio response from the model. + [Learn more](/docs/guides/audio). + required: + - id + properties: + id: + type: string + description: > + Unique identifier for a previous audio response from the + model. + - type: 'null' + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCalls' + 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' + required: + - role + ChatCompletionRequestAssistantMessageContentPart: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartRefusal' + discriminator: + propertyName: type + ChatCompletionRequestDeveloperMessage: + type: object + title: Developer message + description: > + Developer-provided instructions that the model should follow, regardless + of + + messages sent by the user. With o1 models and newer, `developer` + messages + + replace the previous `system` messages. + 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: + $ref: >- + #/components/schemas/ChatCompletionRequestMessageContentPartText + 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: + - 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' + name: + type: string + description: The name of the function to call. + required: + - role + - content + - name + ChatCompletionRequestMessage: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestDeveloperMessage' + - $ref: '#/components/schemas/ChatCompletionRequestSystemMessage' + - $ref: '#/components/schemas/ChatCompletionRequestUserMessage' + - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage' + - $ref: '#/components/schemas/ChatCompletionRequestToolMessage' + - $ref: '#/components/schemas/ChatCompletionRequestFunctionMessage' + discriminator: + propertyName: role + ChatCompletionRequestMessageContentPartAudio: + type: object + title: Audio content part + description: | + Learn about [audio inputs](/docs/guides/audio). + 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". + required: + - data + - format + required: + - type + - input_audio + ChatCompletionRequestMessageContentPartFile: + type: object + title: File content part + description: | + Learn about [file inputs](/docs/guides/text) for text generation. + 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 + + string. + file_data: + type: string + description: > + The base64 encoded file data, used when passing the file to the + model + + as a string. + file_id: + type: string + description: | + The ID of an uploaded file to use as input. + required: + - type + - file + ChatCompletionRequestMessageContentPartImage: + type: object + title: Image content part + description: | + Learn about [image inputs](/docs/guides/vision). + 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](/docs/guides/vision#low-or-high-fidelity-image-understanding). + enum: + - auto + - low + - high + default: auto + required: + - url + 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 + 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](/docs/guides/text-generation). + properties: + type: + type: string + enum: + - text + description: The type of the content part. + x-stainless-const: true + text: + type: string + description: The text content. + required: + - type + - text + ChatCompletionRequestSystemMessage: + type: object + title: System message + description: > + Developer-provided instructions that the model should follow, regardless + of + + messages sent by the user. With o1 models and newer, use `developer` + messages + + for this purpose instead. + 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 + role: + type: string + enum: + - system + description: The role of the messages author, in this case `system`. + 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: + - 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 + 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 + description: The contents of the tool message. + tool_call_id: + type: string + description: Tool call that this message is responding to. + required: + - role + - content + - tool_call_id + ChatCompletionRequestToolMessageContentPart: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + ChatCompletionRequestUserMessage: + type: object + title: User message + description: | + Messages sent by an end user, containing prompts or additional context + information. + properties: + content: + description: | + The contents of the user message. + 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](/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: + 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' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartImage' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartAudio' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartFile' + ChatCompletionResponseMessage: + type: object + description: A chat completion message generated by the model. + properties: + content: + anyOf: + - type: string + description: The contents of the message. + - type: 'null' + refusal: + anyOf: + - type: string + description: The refusal message generated by the model. + - type: 'null' + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCalls' + annotations: + type: array + description: | + Annotations for the message, when applicable, as when using the + [web search tool](/docs/guides/tools-web-search?api-mode=chat). + items: + type: object + description: | + A URL citation when using web search. + 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. + 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. + required: + - name + - arguments + audio: + anyOf: + - type: object + description: > + If the audio output modality is requested, this object contains + data + + about the audio response from the model. [Learn + more](/docs/guides/audio). + 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 + + no longer be accessible on the server for use in multi-turn + + conversations. + data: + type: string + description: > + Base64 encoded audio bytes generated by the model, in the + format + + specified in the request. + transcript: + type: string + description: Transcript of the audio generated by the model. + - 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`. + type: object + default: null + properties: + include_usage: + type: boolean + description: > + If set, an additional chunk will be streamed before the `data: + [DONE]` + + message. The `usage` field on this chunk shows the token usage + statistics + + for the entire request, and the `choices` field will always be + an empty + + array. + + + All other chunks will also include a `usage` field, but with a + null + + value. **NOTE:** If the stream is interrupted, you may not + receive the + + final usage chunk which contains the total token usage for the + request. + include_obfuscation: + type: boolean + description: > + When true, stream obfuscation will be enabled. Stream + obfuscation adds + + random characters to an `obfuscation` field on streaming delta + events to + + normalize payload sizes as a mitigation to certain side-channel + attacks. + + These obfuscation fields are included by default, but add a + small amount + + of overhead to the data stream. You can set + `include_obfuscation` to + + false to optimize for bandwidth if you trust the network links + between + + your application and the OpenAI API. + - 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' + 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. + tool_calls: + type: array + items: + $ref: '#/components/schemas/ChatCompletionMessageToolCallChunk' + 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' + ChatCompletionTokenLogprob: + 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' + 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' + 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. + 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. + + `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. + + Specifying a particular tool via `{"type": "function", "function": + {"name": "my_function"}}` forces the model to call that tool. + + + `none` is the default when no tools are present. `auto` is the default + if tools are present. + 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. + enum: + - none + - auto + - required + - $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. + properties: + type: + type: string + enum: + - files + description: | + The type of the code interpreter file output. Always `files`. + x-stainless-const: true + files: + type: array + items: + type: object + properties: + mime_type: + type: string + description: | + The MIME type of the file. + file_id: + type: string + description: | + The ID of the file. + 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. + properties: + type: + type: string + enum: + - logs + description: | + The type of the code interpreter text output. Always `logs`. + x-stainless-const: true + logs: + type: string + description: | + The logs of the code interpreter tool call. + required: + - type + - logs + CodeInterpreterTool: + type: object + title: Code interpreter + description: | + A tool that runs Python code to help generate a response to a prompt. + properties: + type: + type: string + enum: + - code_interpreter + description: | + The type of the code interpreter tool. Always `code_interpreter`. + x-stainless-const: true + container: + description: > + The code interpreter container. Can be a container ID or an object + that + + specifies uploaded file IDs to make available to your code, along + with an + + optional `memory_limit` setting. + oneOf: + - type: string + description: The container ID. + - $ref: '#/components/schemas/AutoCodeInterpreterToolParam' + required: + - type + - container + CodeInterpreterToolCall: + type: object + title: Code interpreter tool call + description: | + A tool call to run code. + 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`. + id: + type: string + description: | + The unique ID of the code interpreter tool call. + 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`. + container_id: + type: string + description: | + The ID of the container used to run the code. + code: + anyOf: + - type: string + description: | + The code to run, or null if not available. + - type: 'null' + 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. + + Can be null if no outputs are available. + - type: 'null' + 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. + 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`. + + - `eq`: equals + + - `ne`: not equal + + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + oneOf: + - type: string + - type: number + - type: boolean + - type: array + items: + oneOf: + - type: string + - type: number + 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. + items: + type: string + md5: + description: > + The optional md5 checksum for the file contents to verify if the + bytes uploaded matches what you expect. + type: string + 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. + prompt_tokens: + type: integer + default: 0 + description: Number of tokens in the prompt. + total_tokens: + type: integer + default: 0 + description: Total number of tokens used in the request (prompt + completion). + 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 + prediction that appeared in the completion. + 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. + rejected_prediction_tokens: + type: integer + default: 0 + description: > + When using Predicted Outputs, the number of tokens in the + + prediction that did not appear in the completion. However, like + + reasoning tokens, these tokens are still counted in the total + + completion tokens for purposes of billing, output, and context + window + + limits. + prompt_tokens_details: + 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. + 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: '#' + discriminator: + propertyName: type + required: + - type + - filters + x-oaiMeta: + name: CompoundFilter + ComputerAction: + oneOf: + - $ref: '#/components/schemas/ClickParam' + - $ref: '#/components/schemas/DoubleClickAction' + - $ref: '#/components/schemas/DragParam' + - $ref: '#/components/schemas/KeyPressAction' + - $ref: '#/components/schemas/MoveParam' + - $ref: '#/components/schemas/ScreenshotParam' + - $ref: '#/components/schemas/ScrollParam' + - $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 + `type` discriminator and action-specific fields. + items: + $ref: '#/components/schemas/ComputerAction' + ComputerScreenshotImage: + type: object + description: | + A computer screenshot image used with the computer use tool. + properties: + type: + type: string + enum: + - computer_screenshot + default: computer_screenshot + description: > + Specifies the event type. For a computer screenshot, this property + is + + always set to `computer_screenshot`. + x-stainless-const: true + image_url: + type: string + format: uri + description: The URL of the screenshot image. + 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 + + [computer use guide](/docs/guides/tools-computer-use) for more + information. + 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. + 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. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + 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. + properties: + type: + type: string + description: > + The type of the computer tool call output. Always + `computer_call_output`. + enum: + - computer_call_output + default: computer_call_output + x-stainless-const: true + id: + type: string + description: | + The ID of the computer tool call output. + call_id: + type: string + description: | + The ID of the computer tool call that produced the output. + acknowledged_safety_checks: + type: array + description: > + The safety checks reported by the API that have been acknowledged by + the + + developer. + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + status: + type: string + description: > + The status of the message input. One of `in_progress`, `completed`, + or + + `incomplete`. Populated when input items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - output + ComputerToolCallOutputResource: + allOf: + - $ref: '#/components/schemas/ComputerToolCallOutput' + - type: object + properties: + id: + type: string + description: | + The unique ID of the computer call tool output. + status: + description: > + The status of the message input. One of `in_progress`, + `completed`, or + + `incomplete`. Populated when input items are returned via API. + $ref: '#/components/schemas/ComputerCallOutputStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + 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' + 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: + - object + - data + - first_id + - last_id + - has_more + 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. + path: + type: string + description: Path of the file in the container. + source: + type: string + description: Source of the file (e.g., `user`, `assistant`). + required: + - id + - object + - created_at + - bytes + - container_id + - path + - source + x-oaiMeta: + name: The container file object + example: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + 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. + 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. + + The anchor is the reference point for the expiration. + + The minutes is the number of minutes after the anchor before the + container expires. + 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. + memory_limit: + type: string + description: The memory limit configured for the container. + enum: + - 1g + - 4g + - 16g + - 64g + 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 + required: + - type + required: + - id + - object + - name + - created_at + - status + - id + - name + - created_at + - status + x-oaiMeta: + name: The container object + example: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "1g", + "name": "My Container" + } + Content: + description: | + Multi-modal input and output contents. + 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](/docs/api-reference/responses/object#responses/object-output). + 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/ReasoningItem' + - $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' + - $ref: '#/components/schemas/CustomToolCallOutput' + 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' + 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. + last_id: + type: string + description: The ID of the last item in the list. + required: + - object + - data + - has_more + - first_id + - last_id + x-oaiMeta: + name: The item list + group: conversations + ConversationParam: + description: > + The conversation that this response belongs to. Items from this + conversation are prepended to `input_items` for this response request. + + Input items and output items from this response are automatically added + to this conversation after this response completes. + default: null + oneOf: + - type: string + title: Conversation ID + description: | + The unique ID of the conversation. + - $ref: '#/components/schemas/ConversationParam-2' + 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" + 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' + 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' + quantity: + anyOf: + - type: number + description: >- + When `group_by=line_item`, this field provides the quantity of + the grouped costs result. + - type: 'null' + required: + - object + x-oaiMeta: + name: Costs object + example: | + { + "object": "organization.costs.result", + "amount": { + "value": 0.06, + "currency": "usd" + }, + "line_item": "Image models", + "project_id": "proj_abc", + "quantity": 10000 + } + CreateAssistantRequest: + type: object + additionalProperties: false + properties: + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. + example: gpt-4o + anyOf: + - type: string + - $ref: '#/components/schemas/AssistantSupportedModels' + x-oaiTypeLabel: string + name: + anyOf: + - description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + - type: 'null' + description: + anyOf: + - description: > + The description of the assistant. The maximum length is 512 + characters. + type: string + maxLength: 512 + - type: 'null' + instructions: + anyOf: + - description: > + The system instructions that the assistant uses. The maximum + length is 256,000 characters. + type: string + maxLength: 256000 + - type: 'null' + 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`. + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector + store](/docs/api-reference/vector-stores/object) + attached to this assistant. There can be a maximum of 1 + vector store attached to the assistant. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: > + A helper to create a [vector + store](/docs/api-reference/vector-stores/object) with + file_ids and attach it to this assistant. There can be a + maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/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. + 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`. + + + Note that the overlap must not exceed + half of `max_chunk_size_tokens`. + 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' + 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. + 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. + + + We generally recommend altering this or temperature but not + both. + - type: 'null' + response_format: + anyOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + - type: 'null' + required: + - model + CreateChatCompletionRequest: + allOf: + - $ref: '#/components/schemas/CreateModelResponseProperties' + - type: object + properties: + messages: + description: > + A list of messages comprising the conversation so far. Depending + on the + + [model](/docs/models) you use, different message types + (modalities) are + + supported, like [text](/docs/guides/text-generation), + + [images](/docs/guides/vision), and [audio](/docs/guides/audio). + type: array + minItems: 1 + items: + $ref: '#/components/schemas/ChatCompletionRequestMessage' + model: + 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](/docs/models) + + to browse and compare available models. + $ref: '#/components/schemas/ModelIdsShared' + 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](/docs/guides/reasoning). + 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 + + their existing frequency in the text so far, decreasing the + model's + + likelihood to repeat the same line verbatim. + 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. + web_search_options: + type: object + title: Web search + description: > + This tool searches the web for relevant results to use in a + response. + + Learn more about the [web search + tool](/docs/guides/tools-web-search?api-mode=chat). + properties: + user_location: + type: object + nullable: true + required: + - type + - approximate + description: | + Approximate location parameters for the search. + properties: + type: + type: string + description: > + The type of location approximation. Always + `approximate`. + 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 + + tokens to return at each token position, each with an associated + log + + probability. In some cases, the number of returned tokens may be + fewer than + + requested. + + `logprobs` must be set to `true` if this parameter is used. + type: integer + minimum: 0 + maximum: 20 + nullable: true + response_format: + description: > + An object specifying the format that the model must output. + + + Setting 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](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables the older JSON + mode, which + + ensures the message the model generates is valid JSON. Using + `json_schema` + + is preferred for models that support it. + 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 + + `modalities: ["audio"]`. [Learn more](/docs/guides/audio). + required: + - voice + - format + properties: + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + description: > + The voice the model uses to respond. Supported built-in + voices are + + `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, + `onyx`, + + `sage`, `shimmer`, `marin`, and `cedar`. You may also + provide a + + custom voice object with an `id`, for example `{ "id": + "voice_1234" }`. + format: + type: string + enum: + - wav + - aac + - mp3 + - flac + - opus + - pcm16 + description: > + Specifies the output audio format. Must be one of `wav`, + `mp3`, `flac`, + + `opus`, or `pcm16`. + store: + type: boolean + default: false + nullable: true + description: > + Whether or not to store the output of this chat completion + request for + + use in our [model distillation](/docs/guides/distillation) or + + [evals](/docs/guides/evals) products. + + + Supports text and image inputs. Note: image inputs over 8MB will + be dropped. + stream: + description: > + If set to true, the model response data will be streamed to the + client + + as 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). + + See the [Streaming section + below](/docs/api-reference/chat/streaming) + + for more information, along with the [streaming + responses](/docs/guides/streaming-responses) + + guide for more information on how to handle the streaming + events. + 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. + + + Accepts a JSON object that maps tokens (specified by their token + ID in the + + tokenizer) to an associated bias value from -100 to 100. + 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. + logprobs: + description: > + Whether to return log probabilities of the output tokens or not. + If true, + + returns the log probabilities of each output token returned in + the + + `content` of `message`. + type: boolean + default: false + nullable: true + max_tokens: + description: > + The maximum number of [tokens](/tokenizer) that can be generated + in the + + chat completion. This value can be used to control + + [costs](https://openai.com/api/pricing/) for text generated via + API. + + + This value is now deprecated in favor of + `max_completion_tokens`, and is + + not compatible with [o-series models](/docs/guides/reasoning). + 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](/docs/guides/predicted-outputs), + + which can greatly improve response times when large parts of the + model + + response are known ahead of time. This is most common when you + are + + regenerating a file with only minor changes to most of the + content. + oneOf: + - $ref: '#/components/schemas/PredictionContent' + seed: + type: integer + minimum: -9223372036854776000 + maximum: 9223372036854776000 + nullable: true + deprecated: true + description: > + This feature is in Beta. + + 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. + + Determinism is not guaranteed, and you should refer to the + `system_fingerprint` response parameter to monitor changes in + the backend. + 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 + [custom tools](/docs/guides/function-calling#custom-tools) or + [function tools](/docs/guides/function-calling). + 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`. + + + Controls which (if any) function is called by the model. + + + `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. + + + Specifying a particular function via `{"name": "my_function"}` + forces the + + model to call that function. + + + `none` is the default when no functions are present. `auto` is + the default + + if functions are present. + 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. + enum: + - none + - auto + - $ref: '#/components/schemas/ChatCompletionFunctionCallOption' + functions: + deprecated: true + description: | + Deprecated in favor of `tools`. + + A list of functions the model may generate JSON inputs for. + type: array + minItems: 1 + maxItems: 128 + items: + $ref: '#/components/schemas/ChatCompletionFunctions' + 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, + + `length` if the maximum number of tokens specified in the + request was reached, + + `content_filter` if content was omitted due to a flag from our + content filters, + + `tool_calls` if the model called a tool, or `function_call` + (deprecated) if the model called a function. + 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: + 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. + service_tier: + $ref: '#/components/schemas/ServiceTier' + system_fingerprint: + type: string + deprecated: true + description: > + This fingerprint represents the backend configuration that the model + runs with. + + + Can be used in conjunction with the `seed` request parameter to + understand when backend changes have been made that might impact + determinism. + object: + type: string + description: The object type, which is always `chat.completion`. + enum: + - chat.completion + x-stainless-const: true + usage: + $ref: '#/components/schemas/CompletionUsage' + required: + - choices + - created + - id + - model + - object + x-oaiMeta: + name: The chat completion object + group: chat + example: | + { + "id": "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG", + "object": "chat.completion", + "created": 1741570283, + "model": "gpt-4o-2024-08-06", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "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.", + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 1117, + "completion_tokens": 46, + "total_tokens": 1163, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_fc9f1d7035" + } + CreateChatCompletionStreamResponse: + type: object + description: | + Represents a streamed chunk of a chat completion response returned + by the model, based on the provided input. + [Learn more](/docs/guides/streaming-responses). + properties: + id: + type: string + description: >- + A unique identifier for the chat completion. Each chunk has the same + ID. + 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 + + last chunk if you set `stream_options: {"include_usage": true}`. + items: + type: object + required: + - delta + - finish_reason + - index + properties: + delta: + $ref: '#/components/schemas/ChatCompletionStreamResponseDelta' + logprobs: + description: Log probability information for the choice. + 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 + refusal: + description: >- + A list of message refusal tokens with log probability + information. + type: array + items: + $ref: '#/components/schemas/ChatCompletionTokenLogprob' + nullable: true + required: + - content + - refusal + 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, + + `length` if the maximum number of tokens specified in the + request was reached, + + `content_filter` if content was omitted due to a flag from our + content filters, + + `tool_calls` if the model called a tool, or `function_call` + (deprecated) if the model called a function. + 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. + model: + type: string + description: The model to generate the completion. + service_tier: + $ref: '#/components/schemas/ServiceTier' + system_fingerprint: + type: string + deprecated: true + description: > + This fingerprint represents the backend configuration that the model + runs with. + + Can be used in conjunction with the `seed` request parameter to + understand when backend changes have been made that might impact + determinism. + 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 + + `stream_options: {"include_usage": true}` in your request. When + present, it + + contains a null value **except for the last chunk** which contains + the + + token usage statistics for the entire request. + + + **NOTE:** If the stream is interrupted or cancelled, you may not + + receive the final usage chunk which contains the total token usage + for + + the request. + 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-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} + + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} + + + .... + + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + CreateCompletionRequest: + type: object + properties: + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. + anyOf: + - type: string + - type: string + enum: + - gpt-3.5-turbo-instruct + - davinci-002 + - babbage-002 + 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. + + + Note 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. + default: <|endoftext|> + nullable: true + oneOf: + - type: string + default: '' + example: This is a test. + - 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]]' + 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. + + + When 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`. + + + **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`. + echo: + type: boolean + default: false + nullable: true + description: | + Echo back the prompt in addition to the completion + 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. + + + [See more information about frequency and presence + penalties.](/docs/guides/text-generation) + 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. + + + Accepts 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](/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. + + + As an example, you can pass `{"50256": -100}` to prevent the + <|endoftext|> token from being generated. + 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. + + + The maximum value for `logprobs` is 5. + max_tokens: + type: integer + minimum: 0 + default: 16 + example: 16 + nullable: true + description: > + The maximum number of [tokens](/tokenizer) that can be generated in + the completion. + + + The 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': + type: integer + minimum: 1 + maximum: 128 + default: 1 + example: 1 + nullable: true + description: > + How many completions to generate for each prompt. + + + **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`. + 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. + + + [See more information about frequency and presence + penalties.](/docs/guides/text-generation) + 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. + + + Determinism is not guaranteed, and you should refer to the + `system_fingerprint` response parameter to monitor changes in the + backend. + 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). + type: boolean + nullable: true + default: false + stream_options: + $ref: '#/components/schemas/ChatCompletionStreamOptions' + suffix: + description: | + The suffix that comes after a completion of inserted text. + + This parameter is only supported for `gpt-3.5-turbo-instruct`. + default: null + nullable: true + type: string + example: test. + 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. + + + We generally recommend altering this or `top_p` but not both. + 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. + + + We generally recommend altering this or `temperature` but not both. + 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](/docs/guides/safety-best-practices#end-user-ids). + 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). + 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, + + `length` if the maximum number of tokens specified in the + request was reached, + + or `content_filter` if content was omitted due to a flag from + our content filters. + 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 + 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. + + + Can be used in conjunction with the `seed` request parameter to + understand when backend changes have been made that might impact + determinism. + object: + type: string + description: The object type, which is always "text_completion" + enum: + - text_completion + x-stainless-const: true + usage: + $ref: '#/components/schemas/CompletionUsage' + required: + - id + - object + - created + - model + - choices + x-oaiMeta: + name: The completion object + legacy: true + example: | + { + "id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7", + "object": "text_completion", + "created": 1589478378, + "model": "gpt-4-turbo", + "choices": [ + { + "text": "\n\nThis is indeed a test", + "index": 0, + "logprobs": null, + "finish_reason": "length" + } + ], + "usage": { + "prompt_tokens": 5, + "completion_tokens": 7, + "total_tokens": 12 + } + } + 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: + 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 + 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' + 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. + 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. + 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](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. + example: text-embedding-3-small + anyOf: + - type: string + - type: string + enum: + - text-embedding-ada-002 + - text-embedding-3-small + - text-embedding-3-large + 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. + 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](/docs/guides/safety-best-practices#end-user-ids). + 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. + required: + - prompt_tokens + - total_tokens + required: + - object + - model + - data + - usage + CreateEvalCompletionsRunDataSource: + type: object + title: CompletionsRunDataSource + description: > + A CompletionsRunDataSource object describing a model sampling + configuration. + 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. + + + Setting 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](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables the older JSON + mode, which + + ensures the message the model generates is valid JSON. Using + `json_schema` + + is preferred for models that support it. + 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. + items: + $ref: '#/components/schemas/ChatCompletionTool' + 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: | + { + "name": "gpt-4o-mini-2024-07-18", + "data_source": { + "type": "completions", + "input_messages": { + "type": "item_reference", + "item_reference": "item.input" + }, + "model": "gpt-4o-mini-2024-07-18", + "source": { + "type": "stored_completions", + "model": "gpt-4o-mini-2024-07-18" + } + } + } + CreateEvalCustomDataSourceConfig: + type: object + title: CustomDataSourceConfig + description: > + A CustomDataSourceConfig object that defines the schema for the data + source used for the evaluation runs. + + This schema is used to define the shape of the data that will be: + + - Used to define your testing criteria and + + - What data is required when creating a run + 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: | + { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + } + 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: + - item_schema + - type + x-oaiMeta: + name: The eval file data source config object + group: evals + example: | + { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + }, + "include_sample_schema": true + } + 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 + 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' + required: + - type + - source + x-oaiMeta: + name: The file data source object for the eval run configuration + group: evals + example: | + { + "type": "jsonl", + "source": { + "type": "file_id", + "id": "file-9GYS6xbkWgWhmE7VoLUWFg" + } + } + CreateEvalLabelModelGrader: + type: object + title: LabelModelGrader + description: > + A LabelModelGrader object which uses a model to assign labels to each + item + + in the evaluation. + 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' + 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: | + { + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "role": "system", + "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" + }, + { + "role": "user", + "content": "Statement: {{item.response}}" + } + ], + "passing_labels": ["positive"], + "labels": ["positive", "neutral", "negative"], + "name": "Sentiment label grader" + } + CreateEvalLogsDataSourceConfig: + type: object + title: LogsDataSourceConfig + description: > + A data source config which specifies the metadata property of your logs + query. + + This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, + etc. + 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: | + { + "use_case": "customer_support_agent" + } + required: + - type + x-oaiMeta: + name: The logs data source object for evals + group: evals + example: | + { + "type": "logs", + "metadata": { + "use_case": "customer_support_agent" + } + } + 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' + 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. + 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 + + can specify which tool to use by setting the `tool_choice` + parameter. + + + The two categories of tools you can provide the model are: + + + - **Built-in tools**: Tools that are provided by OpenAI that + extend the + model's capabilities, like [web search](/docs/guides/tools-web-search) + or [file search](/docs/guides/tools-file-search). Learn more about + [built-in tools](/docs/guides/tools). + - **Function calls (custom tools)**: Functions that are defined + by you, + enabling the model to call your own code. Learn more about + [function calling](/docs/guides/function-calling). + items: + $ref: '#/components/schemas/Tool' + text: + type: object + description: > + Configuration options for a text response from the model. Can be + plain + + text or structured JSON data. Learn more: + + - [Text inputs and outputs](/docs/guides/text) + + - [Structured Outputs](/docs/guides/structured-outputs) + properties: + format: + $ref: '#/components/schemas/TextResponseFormatConfiguration' + 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: | + { + "name": "gpt-4o-mini-2024-07-18", + "data_source": { + "type": "responses", + "input_messages": { + "type": "item_reference", + "item_reference": "item.input" + }, + "model": "gpt-4o-mini-2024-07-18", + "source": { + "type": "responses", + "model": "gpt-4o-mini-2024-07-18" + } + } + } + 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' + required: + - data_source + CreateEvalStoredCompletionsDataSourceConfig: + type: object + title: StoredCompletionsDataSourceConfig + description: | + Deprecated in favor of LogsDataSourceConfig. + 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: | + { + "use_case": "customer_support_agent" + } + required: + - type + deprecated: true + x-oaiMeta: + name: The stored completions data source object for evals + group: evals + example: | + { + "type": "stored_completions", + "metadata": { + "use_case": "customer_support_agent" + } + } + CreateFileRequest: + type: object + additionalProperties: false + properties: + file: + description: | + The File object (not file name) to be uploaded. + type: string + format: binary + purpose: + description: | + The intended purpose of the uploaded file. One of: + - `assistants`: Used in the Assistants API + - `batch`: Used in the Batch API + - `fine-tune`: Used for fine-tuning + - `vision`: Images used for vision fine-tuning + - `user_data`: Flexible file type for any purpose + - `evals`: Used for eval data sets + type: string + enum: + - assistants + - batch + - fine-tune + - vision + - user_data + - evals + expires_after: + $ref: '#/components/schemas/FileExpirationAfter' + required: + - file + - purpose + CreateFineTuningCheckpointPermissionRequest: + type: object + additionalProperties: false + properties: + project_ids: + type: array + description: The project identifiers to grant access to. + items: + type: string + required: + - project_ids + CreateFineTuningJobRequest: + type: object + properties: + model: + description: > + The name of the model to fine-tune. You can select one of the + + [supported + models](/docs/guides/fine-tuning#which-models-can-be-fine-tuned). + example: gpt-4o-mini + anyOf: + - type: string + - type: string + enum: + - babbage-002 + - davinci-002 + - gpt-3.5-turbo + - gpt-4o-mini + x-oaiTypeLabel: string + training_file: + description: > + The ID of an uploaded file that contains training data. + + + See [upload file](/docs/api-reference/files/create) for how to + upload a file. + + + Your dataset must be formatted as a JSONL file. Additionally, you + must upload your file with the purpose `fine-tune`. + + + The contents of the file should differ depending on if the model + uses the [chat](/docs/api-reference/fine-tuning/chat-input), + [completions](/docs/api-reference/fine-tuning/completions-input) + format, or if the fine-tuning method uses the + [preference](/docs/api-reference/fine-tuning/preference-input) + format. + + + See the [fine-tuning guide](/docs/guides/model-optimization) for + more details. + type: string + example: file-abc123 + hyperparameters: + type: object + description: > + The hyperparameters used for the fine-tuning job. + + This value is now deprecated in favor of `method`, and should be + passed in under the `method` parameter. + 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. + 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. + 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 + + through the training dataset. + 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. + + + For example, a `suffix` of "custom-model-name" would produce a model + name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. + type: string + minLength: 1 + maxLength: 64 + default: null + nullable: true + validation_file: + description: > + The ID of an uploaded file that contains validation data. + + + If you provide this file, the data is used to generate validation + + metrics periodically during fine-tuning. These metrics can be viewed + in + + the fine-tuning results file. + + The same data should not be present in both train and validation + files. + + + Your dataset must be formatted as a JSONL file. You must upload your + file with the purpose `fine-tune`. + + + See the [fine-tuning guide](/docs/guides/model-optimization) for + more details. + 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. + 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 + + metrics will be sent to. Optionally, you can set an explicit + display name for your run, add tags + + to your run, and set a default entity (team, username, etc) to + be associated with your run. + required: + - project + properties: + project: + description: > + The name of the project that the new run will be created + under. + 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. + 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 + + like associated with the run. If not set, the default + entity for the registered WandB API key is used. + 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 + + default tags are generated by OpenAI: "openai/finetune", + "openai/{base-model}", "openai/{ftjob-abcdef}". + 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. + + If a seed is not specified, one will be generated for you. + 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 + required: + - name + x-oaiMeta: + example: | + { + "name": "Support Team" + } + 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. + required: + - user_id + x-oaiMeta: + example: | + { + "user_id": "user_abc123" + } + CreateImageEditRequest: + type: object + properties: + 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. + + + For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and + `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` + + file less than 50MB. You can provide up to 16 images. + + `chatgpt-image-latest` follows the same input constraints as GPT + image models. + + + For `dall-e-2`, you can only provide one image, and it should be a + square + + `png` file less than 4MB. + 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: > + Allows to set transparency for the background of the generated + image(s). + + This parameter is only supported for the GPT image models. Must be + one of + + `transparent`, `opaque` or `auto` (default value). When `auto` is + used, the + + model will automatically determine the best background for the + image. + + + If `transparent`, the output format needs to support transparency, + so it + + should be set to either `png` (default value) or `webp`. + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1.5 + - dall-e-2 + - gpt-image-1 + - gpt-image-1-mini + - chatgpt-image-latest + x-stainless-const: true + x-oaiTypeLabel: string + default: gpt-image-1.5 + example: gpt-image-1.5 + nullable: true + description: The model to use for image generation. 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 + default: 1024x1024 + example: 1024x1024 + nullable: true + description: >- + The size of the generated images. For `gpt-image-2` and + `gpt-image-2-2026-04-21`, 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 + + only supported for the GPT image models. Must be one of `png`, + `jpeg`, or `webp`. + + The default value is `png`. + 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. + 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](/docs/guides/safety-best-practices#end-user-ids). + input_fidelity: + anyOf: + - $ref: '#/components/schemas/InputFidelity' + - type: 'null' + stream: + type: boolean + default: false + example: false + nullable: true + description: > + Edit the image in streaming mode. Defaults to `false`. See the + + [Image generation guide](/docs/guides/image-generation) for more + information. + partial_images: + $ref: '#/components/schemas/PartialImages' + quality: + type: string + enum: + - standard + - low + - medium + - high + - auto + default: auto + example: high + nullable: true + description: > + The quality of the image that will be generated for GPT image + models. Defaults to `auto`. + 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 + - dall-e-2 + - dall-e-3 + - gpt-image-1 + - gpt-image-1-mini + 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`). 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 + - auto + default: auto + example: medium + nullable: true + description: > + The quality of the image that will be generated. + + + - `auto` (default value) will automatically select the best quality + for the given model. + + - `high`, `medium` and `low` are supported for the GPT image models. + + - `hd` and `standard` are supported for `dall-e-3`. + + - `standard` is the only option for `dall-e-2`. + 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 + + [Image generation guide](/docs/guides/image-generation) for more + information. + + This parameter is only supported for the GPT image models. + partial_images: + $ref: '#/components/schemas/PartialImages' + size: + anyOf: + - type: string + - type: string + enum: + - auto + - 1024x1024 + - 1536x1024 + - 1024x1536 + - 256x256 + - 512x512 + - 1792x1024 + - 1024x1792 + default: auto + example: 1024x1024 + nullable: true + description: >- + The size of the generated images. For `gpt-image-2` and + `gpt-image-2-2026-04-21`, 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: > + Allows to set transparency for the background of the generated + image(s). + + This parameter is only supported for the GPT image models. Must be + one of + + `transparent`, `opaque` or `auto` (default value). When `auto` is + used, the + + model will automatically determine the best background for the + image. + + + If `transparent`, the output format needs to support transparency, + so it + + should be set to either `png` (default value) or `webp`. + 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: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI to monitor and detect abuse. [Learn + more](/docs/guides/safety-best-practices#end-user-ids). + required: + - prompt + CreateImageVariationRequest: + type: object + 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. + type: string + format: binary + model: + anyOf: + - type: string + - type: string + enum: + - dall-e-2 + x-stainless-const: true + 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. + size: + 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`. + 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](/docs/guides/safety-best-practices#end-user-ids). + 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: + + - `user`: Indicates the message is sent by an actual user and should + be used in most cases to represent user-generated messages. + + - `assistant`: Indicates the message is generated by the assistant. + Use this value to insert messages from the assistant into the + conversation. + 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](/docs/models). + title: Array of content parts + items: + oneOf: + - $ref: '#/components/schemas/MessageContentImageFileObject' + - $ref: '#/components/schemas/MessageContentImageUrlObject' + - $ref: '#/components/schemas/MessageRequestContentTextObject' + minItems: 1 + 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' + metadata: + $ref: '#/components/schemas/Metadata' + CreateModelResponseProperties: + allOf: + - $ref: '#/components/schemas/ModelResponseProperties' + - type: object + properties: + top_logprobs: + description: > + An integer between 0 and 20 specifying the maximum number of + most likely + + tokens to return at each token position, each with an associated + log + + probability. In some cases, the number of returned tokens may be + fewer than + + requested. + type: integer + minimum: 0 + maximum: 20 + CreateModerationRequest: + type: object + properties: + input: + description: > + Input (or inputs) to classify. Can be a single string, an array of + strings, or + + an array of multi-modal input objects similar to other models. + oneOf: + - type: string + description: A string of text to classify for moderation. + default: '' + example: I want to kill them. + - type: array + description: An array of strings to classify for moderation. + items: + type: string + default: '' + example: I want to kill them. + - 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 + model: + description: | + The content moderation model you would like to use. Learn more in + [the moderation guide](/docs/guides/moderation), and learn about + available models [here](/docs/models#moderation). + nullable: false + 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: + - input + CreateModerationResponse: + type: object + description: Represents if a given text input is potentially harmful. + properties: + id: + type: string + description: The unique identifier for the moderation request. + model: + type: string + 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: | + { + "id": "modr-0d9740456c391e43c445bf0f010940c7", + "model": "omni-moderation-latest", + "results": [ + { + "flagged": true, + "categories": { + "harassment": true, + "harassment/threatening": true, + "sexual": false, + "hate": false, + "hate/threatening": false, + "illicit": false, + "illicit/violent": false, + "self-harm/intent": false, + "self-harm/instructions": false, + "self-harm": false, + "sexual/minors": false, + "violence": true, + "violence/graphic": true + }, + "category_scores": { + "harassment": 0.8189693396524255, + "harassment/threatening": 0.804985420696006, + "sexual": 1.573112165348997e-6, + "hate": 0.007562942636942845, + "hate/threatening": 0.004208854591835476, + "illicit": 0.030535955153511665, + "illicit/violent": 0.008925306722380033, + "self-harm/intent": 0.00023023930975076432, + "self-harm/instructions": 0.0002293869201073356, + "self-harm": 0.012598046106750154, + "sexual/minors": 2.212566909570261e-8, + "violence": 0.9999992735124786, + "violence/graphic": 0.843064871157054 + }, + "category_applied_input_types": { + "harassment": [ + "text" + ], + "harassment/threatening": [ + "text" + ], + "sexual": [ + "text", + "image" + ], + "hate": [ + "text" + ], + "hate/threatening": [ + "text" + ], + "illicit": [ + "text" + ], + "illicit/violent": [ + "text" + ], + "self-harm/intent": [ + "text", + "image" + ], + "self-harm/instructions": [ + "text", + "image" + ], + "self-harm": [ + "text", + "image" + ], + "sexual/minors": [ + "text" + ], + "violence": [ + "text", + "image" + ], + "violence/graphic": [ + "text", + "image" + ] + } + } + ] + } + CreateResponse: + allOf: + - $ref: '#/components/schemas/CreateModelResponseProperties' + - $ref: '#/components/schemas/ResponseProperties' + - type: object + properties: + input: + $ref: '#/components/schemas/InputParam' + include: + anyOf: + - type: array + description: >- + Specify additional output data to include in the model + response. Currently supported values are: + + - `web_search_call.action.sources`: Include the sources of + the web search tool call. + + - `code_interpreter_call.outputs`: Includes the outputs of + python code execution in code interpreter tool call items. + + - `computer_call_output.output.image_url`: Include image + urls from the computer call output. + + - `file_search_call.results`: Include the search results of + the file search tool call. + + - `message.input_image.image_url`: Include image urls from + the input message. + + - `message.output_text.logprobs`: Include logprobs with + assistant messages. + + - `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. + default: true + - type: 'null' + store: + anyOf: + - type: boolean + description: > + Whether to store the generated model response for later + retrieval via + + API. + default: true + - type: 'null' + instructions: + anyOf: + - type: string + description: > + A system (or developer) message inserted into the model's + context. + + + When using 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' + stream: + anyOf: + - description: > + If set to true, the model response data will be streamed to + the client + + as 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). + + See the [Streaming section + below](/docs/api-reference/responses-streaming) + + for more information. + 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. + 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](/docs/guides/reasoning). + type: integer + minimum: 16 + - type: 'null' + CreateRunRequest: + type: object + additionalProperties: false + properties: + assistant_id: + description: >- + The ID of the [assistant](/docs/api-reference/assistants) to use to + execute this run. + type: string + model: + description: >- + The ID of the [Model](/docs/api-reference/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-4o + anyOf: + - type: string + - $ref: '#/components/schemas/AssistantSupportedModels' + x-oaiTypeLabel: string + nullable: true + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + instructions: + description: >- + Overrides the + [instructions](/docs/api-reference/assistants/createAssistant) 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. + 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. + + + We generally recommend altering this or temperature but not both. + 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. + 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. + 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. + 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](/docs/models#tts): `tts-1`, + `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`. + anyOf: + - type: string + - type: string + enum: + - tts-1 + - tts-1-hd + - gpt-4o-mini-tts + - gpt-4o-mini-tts-2025-12-15 + 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](/docs/guides/text-to-speech#voice-options). + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + 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 + CreateThreadAndRunRequest: + type: object + additionalProperties: false + properties: + assistant_id: + description: >- + The ID of the [assistant](/docs/api-reference/assistants) to use to + execute this run. + type: string + thread: + $ref: '#/components/schemas/CreateThreadRequest' + model: + description: >- + The ID of the [Model](/docs/api-reference/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-4o + 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-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. + type: string + 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' + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The ID of the [vector + store](/docs/api-reference/vector-stores/object) attached to + this assistant. There can be a maximum of 1 vector store + attached to the assistant. + maxItems: 1 + items: + type: string + 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. + 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. + + + We generally recommend altering this or temperature but not both. + 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. + 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. + 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. + 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 + request, an empty thread will be created. + additionalProperties: false + properties: + messages: + description: >- + A list of [messages](/docs/api-reference/messages) 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector + store](/docs/api-reference/vector-stores/object) + attached to this thread. There can be a maximum of 1 + vector store attached to the thread. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: > + A helper to create a [vector + store](/docs/api-reference/vector-stores/object) with + file_ids and attach it to this thread. There can be a + maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/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. + 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`. + + + Note that the overlap must not exceed + half of `max_chunk_size_tokens`. + 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. + type: string + x-oaiTypeLabel: file + format: binary + model: + description: > + ID of the model to use. The options are `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`. + example: gpt-4o-transcribe + anyOf: + - type: string + - type: string + enum: + - whisper-1 + - 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. + type: string + prompt: + description: > + An optional text to guide the model's style or continue a previous + audio segment. The [prompt](/docs/guides/speech-to-text#prompting) + should match the audio language. This field is not supported when + using `gpt-4o-transcribe-diarize`. + 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. + type: number + default: 0 + include: + description: > + Additional information to include in the transcription response. + + `logprobs` will return the log probabilities of the tokens in the + + response to understand the model's confidence in the transcription. + + `logprobs` only works with response_format set to `json` and only + with + + the 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`. + 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. + + This option is not available for `gpt-4o-transcribe-diarize`. + 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 + + as 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). + + See the [Streaming section of the Speech-to-Text + guide](/docs/guides/speech-to-text?lang=curl#streaming-transcriptions) + + for more information. + + + Note: Streaming is not supported for the `whisper-1` model and + will be ignored. + 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"`. + 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. + 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`. + 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. + 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: | + { + "task": "transcribe", + "duration": 42.7, + "text": "Agent: Thanks for calling OpenAI support.\nCustomer: Hi, I need help with diarization.", + "segments": [ + { + "type": "transcript.text.segment", + "id": "seg_001", + "start": 0.0, + "end": 5.2, + "text": "Thanks for calling OpenAI support.", + "speaker": "agent" + }, + { + "type": "transcript.text.segment", + "id": "seg_002", + "start": 5.2, + "end": 12.8, + "text": "Hi, I need help with diarization.", + "speaker": "A" + } + ], + "usage": { + "type": "duration", + "seconds": 43 + } + } + CreateTranscriptionResponseJson: + type: object + description: >- + Represents a transcription response returned by model, based on the + provided input. + properties: + text: + type: string + description: The transcribed text. + 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. + 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: | + { + "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.", + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 10, + "audio_tokens": 4 + }, + "output_tokens": 101, + "total_tokens": 115 + } + } + 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: | + { + "task": "transcribe", + "language": "english", + "duration": 8.470000267028809, + "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.", + "segments": [ + { + "id": 0, + "seek": 0, + "start": 0.0, + "end": 3.319999933242798, + "text": " The beach was a popular spot on a hot summer day.", + "tokens": [ + 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530 + ], + "temperature": 0.0, + "avg_logprob": -0.2860786020755768, + "compression_ratio": 1.2363636493682861, + "no_speech_prob": 0.00985979475080967 + }, + ... + ], + "usage": { + "type": "duration", + "seconds": 9 + } + } + 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. + 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. + 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](/docs/guides/speech-to-text#prompting) + should be in English. + type: string + response_format: + description: > + The format of the output, in one of these options: `json`, `text`, + `srt`, `verbose_json`, or `vtt`. + 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. + 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. + type: string + purpose: + description: | + The intended purpose of the uploaded file. + + See the [documentation on File + purposes](/docs/api-reference/files/create#files-create-purpose). + type: string + enum: + - assistants + - batch + - fine-tune + - vision + bytes: + description: | + The number of bytes in the file you are uploading. + type: integer + mime_type: + description: > + The MIME type of the file. + + + + This must fall within the supported MIME types for your file + purpose. See + + the supported MIME types for assistants and vision. + 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](/docs/api-reference/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](/docs/api-reference/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`](/docs/api-reference/vector-stores-file-batches/createBatch) + 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](/docs/api-reference/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. + + + Supported MIME types: + + `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, + `audio/flac`, `audio/webm`, `audio/mp4`. + 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. + + + Supported MIME types: + + `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, + `audio/flac`, `audio/webm`, `audio/mp4`. + 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. + properties: + type: + type: string + enum: + - custom_tool_call + x-stainless-const: true + description: | + The type of the custom tool call. Always `custom_tool_call`. + id: + type: string + description: | + The unique ID of the custom tool call in the OpenAI platform. + call_id: + type: string + description: > + An identifier used to map this custom tool call to a tool call + output. + namespace: + type: string + description: | + The namespace of the custom tool being called. + name: + type: string + description: | + The name of the custom tool being called. + input: + type: string + description: | + The input for the custom tool call generated by the model. + 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. + 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`. + id: + type: string + description: | + The unique ID of the custom tool call output in the OpenAI platform. + call_id: + type: string + description: > + The call ID, used to map this custom tool call output to a custom + tool call. + output: + description: | + The output from the custom tool call generated by your code. + Can be a string or an list of output content. + oneOf: + - type: string + description: | + A string of the output of the custom tool call. + 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. + 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. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallOutputStatusEnum' + created_by: + type: string + description: | + The identifier of the actor that created the item. + 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. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + CustomToolChatCompletions: + type: object + title: Custom tool + description: | + A custom tool that processes input using a specified format. + 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. + 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. + format: + description: > + The input format for the custom tool. Default is unconstrained + text. + 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: | + { + "object": "group.role.deleted", + "deleted": true + } + 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 + + hierarchy. Instructions given with the `developer` or `system` role take + + precedence over instructions given with the `user` role. Messages with + the + + `assistant` role are presumed to have been generated by the model in + previous + + interactions. + properties: + role: + type: string + description: > + The role of the message input. One of `user`, `assistant`, `system`, + or + + `developer`. + enum: + - user + - assistant + - system + - developer + content: + description: > + Text, image, or audio input to the model, used to generate a + response. + + Can also contain previous assistant responses. + oneOf: + - type: string + title: Text input + description: | + A text input to the model. + - $ref: '#/components/schemas/InputMessageContentList' + phase: + anyOf: + - $ref: '#/components/schemas/MessagePhase' + - type: 'null' + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + required: + - role + - content + EditImageBodyJsonParam: + type: object + description: > + JSON request body for image edits. + + + Use `images` (array of `ImageRefParam`) instead of multipart `image` + uploads. + + You can reference images via external URLs, data URLs, or uploaded file + IDs. + + JSON edits support GPT image models only; DALL-E edits require multipart + (`dall-e-2` only). + properties: + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1.5 + - gpt-image-1 + - gpt-image-1-mini + - chatgpt-image-latest + - type: 'null' + x-oaiTypeLabel: string + default: gpt-image-1.5 + example: gpt-image-1.5 + description: The model to use for image editing. + images: + type: array + minItems: 1 + maxItems: 16 + description: | + Input image references to edit. + For GPT image models, you can provide up to 16 images. + items: + $ref: '#/components/schemas/ImageRefParam' + mask: + $ref: '#/components/schemas/ImageRefParam' + 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 + - auto + - type: 'null' + default: auto + example: high + description: | + Output quality for GPT image models. + input_fidelity: + anyOf: + - type: string + enum: + - high + - low + - type: 'null' + description: Controls fidelity to the original input image(s). + size: + anyOf: + - type: string + enum: + - auto + - 1024x1024 + - 1536x1024 + - 1024x1536 + - type: 'null' + default: auto + example: 1024x1024 + description: Requested output image size. + user: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI + + monitor and detect abuse. + 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: Background behavior for generated image output. + 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. + 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](/docs/guides/embeddings). + items: + type: number + format: float + 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: | + { + "object": "embedding", + "embedding": [ + 0.0023064255, + -0.009327292, + .... (1536 floats total for ada-002) + -0.0028842222, + ], + "index": 0 + } + Error: + type: object + properties: + code: + anyOf: + - type: string + - type: 'null' + message: + type: string + param: + anyOf: + - type: string + - type: 'null' + type: + type: string + 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](/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](/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. + An Eval represents a task to be done for your LLM integration. + Like: + - Improve the quality of my chatbot + - See how well my chatbot handles customer support + - Check if o4-mini is better at my usecase than gpt-4o + 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: + default: eval + 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: | + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + }, + "include_sample_schema": true + }, + "testing_criteria": [ + { + "name": "My string check grader", + "type": "string_check", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq", + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": { + "test": "synthetics", + } + } + EvalApiError: + type: object + title: EvalApiError + description: | + An object representing an error response from the Eval API. + 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: | + { + "code": "internal_error", + "message": "The eval run failed due to an internal error." + } + EvalCustomDataSourceConfig: + type: object + title: CustomDataSourceConfig + description: > + A CustomDataSourceConfig which specifies the schema of your `item` and + optionally `sample` namespaces. + + The response schema defines the shape of the data that will be: + + - Used to define your testing criteria and + + - What data is required when creating a run + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + 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: | + { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + } + }, + "required": ["item"] + } + } + 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: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + "pass_threshold": 0.8 + } + 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: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "pass_threshold": 0.8, + "evaluation_metric": "fuzzy_match" + } + EvalItem: + type: object + title: Eval message object + description: > + A message input to the model with a role indicating instruction + following + + hierarchy. Instructions given with the `developer` or `system` role take + + precedence over instructions given with the `user` role. Messages with + the + + `assistant` role are presumed to have been generated by the model in + previous + + interactions. + properties: + role: + type: string + description: > + The role of the message input. One of `user`, `assistant`, `system`, + or + + `developer`. + enum: + - user + - assistant + - system + - developer + content: + $ref: '#/components/schemas/EvalItemContent' + type: + type: string + description: | + The type of the message input. Always `message`. + 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. + 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 + + image, or input audio object. + items: + $ref: '#/components/schemas/EvalItemContentItem' + EvalItemContentItem: + title: Eval content item + description: > + A single content item: input text, output text, input image, or input + audio. + 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. + properties: + type: + type: string + description: | + The type of the output text. Always `output_text`. + enum: + - output_text + x-stainless-const: true + text: + type: string + description: | + The text output from the model. + required: + - type + - text + EvalItemContentText: + type: string + title: Text input + description: | + A text input to the model. + 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`. + enum: + - input_image + x-stainless-const: true + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + 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. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval objects. + 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: | + { + "object": "list", + "data": [ + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": {}, + } + ], + "first_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "last_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "has_more": true + } + EvalLogsDataSourceConfig: + type: object + title: LogsDataSourceConfig + description: > + A LogsDataSourceConfig which specifies the metadata property of your + logs query. + + This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, + etc. + + The schema returned by this data source config is used to defined what + variables are available in your evals. + + `item` and `sample` are both defined when using this data source config. + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + required: + - type + - schema + x-oaiMeta: + name: The logs data source object for evals + group: evals + example: | + { + "type": "logs", + "metadata": { + "language": "english" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + } + } + EvalResponsesSource: + type: object + title: EvalResponsesSource + description: | + A EvalResponsesSource object describing a run data source configuration. + 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: | + { + "type": "responses", + "model": "gpt-4o-mini-2024-07-18", + "temperature": 0.7, + "top_p": 1.0, + "users": ["user1", "user2"], + "tools": ["tool1", "tool2"], + "instructions_search": "You are a coding assistant" + } + EvalRun: + type: object + title: EvalRun + description: | + A schema representing an evaluation run. + 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 + description: The model that is evaluated, if applicable. + name: + type: string + 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 + 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' + 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: | + { + "object": "eval.run", + "id": "evalrun_67e57965b480819094274e3a32235e4c", + "eval_id": "eval_67e579652b548190aaa83ada4b125f47", + "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47?run_id=evalrun_67e57965b480819094274e3a32235e4c", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + EvalRunList: + type: object + title: EvalRunList + description: | + An object representing a list of runs for an evaluation. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval run objects. + 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: | + { + "object": "list", + "data": [ + { + "object": "eval.run", + "id": "evalrun_67b7fbdad46c819092f6fe7a14189620", + "eval_id": "eval_67b7fa9a81a88190ab4aa417e397ea21", + "report_url": "https://platform.openai.com/evaluations/eval_67b7fa9a81a88190ab4aa417e397ea21?run_id=evalrun_67b7fbdad46c819092f6fe7a14189620", + "status": "completed", + "model": "o3-mini", + "name": "Academic Assistant", + "created_at": 1740110812, + "result_counts": { + "total": 171, + "errored": 0, + "failed": 80, + "passed": 91 + }, + "per_model_usage": null, + "per_testing_criteria_results": [ + { + "testing_criteria": "String check grader", + "passed": 91, + "failed": 80 + } + ], + "run_data_source": { + "type": "completions", + "template_messages": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "You are a helpful assistant." + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Hello, can you help me with my homework?" + } + } + ], + "datasource_reference": null, + "model": "o3-mini", + "max_completion_tokens": null, + "seed": null, + "temperature": null, + "top_p": null + }, + "error": null, + "metadata": {"test": "synthetics"} + } + ], + "first_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "last_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "has_more": false + } + EvalRunOutputItem: + type: object + title: EvalRunOutputItem + description: | + A schema representing an evaluation run output item. + 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: + $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. + 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: | + { + "object": "eval.run.output_item", + "id": "outputitem_67abd55eb6548190bb580745d5644a33", + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "created_at": 1739314509, + "status": "pass", + "datasource_item_id": 137, + "datasource_item": { + "teacher": "To grade essays, I only check for style, content, and grammar.", + "student": "I am a student who is trying to write the best essay." + }, + "results": [ + { + "name": "String Check Grader", + "type": "string-check-grader", + "score": 1.0, + "passed": true, + } + ], + "sample": { + "input": [ + { + "role": "system", + "content": "You are an evaluator bot..." + }, + { + "role": "user", + "content": "You are assessing..." + } + ], + "output": [ + { + "role": "assistant", + "content": "The rubric is not clear nor concise." + } + ], + "finish_reason": "stop", + "model": "gpt-4o-2024-08-06", + "usage": { + "total_tokens": 521, + "completion_tokens": 2, + "prompt_tokens": 519, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } + EvalRunOutputItemList: + type: object + title: EvalRunOutputItemList + description: | + An object representing a list of output items for an evaluation run. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval run output item objects. + 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: | + { + "object": "list", + "data": [ + { + "object": "eval.run.output_item", + "id": "outputitem_67abd55eb6548190bb580745d5644a33", + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "created_at": 1739314509, + "status": "pass", + "datasource_item_id": 137, + "datasource_item": { + "teacher": "To grade essays, I only check for style, content, and grammar.", + "student": "I am a student who is trying to write the best essay." + }, + "results": [ + { + "name": "String Check Grader", + "type": "string-check-grader", + "score": 1.0, + "passed": true, + } + ], + "sample": { + "input": [ + { + "role": "system", + "content": "You are an evaluator bot..." + }, + { + "role": "user", + "content": "You are assessing..." + } + ], + "output": [ + { + "role": "assistant", + "content": "The rubric is not clear nor concise." + } + ], + "finish_reason": "stop", + "model": "gpt-4o-2024-08-06", + "usage": { + "total_tokens": 521, + "completion_tokens": 2, + "prompt_tokens": 519, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + }, + ], + "first_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "last_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "has_more": false + } + EvalRunOutputItemResult: + type: object + title: EvalRunOutputItemResult + description: | + A single grader result for an evaluation run output item. + 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. + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + required: + - type + - schema + deprecated: true + x-oaiMeta: + name: The stored completions data source object for evals + group: evals + example: | + { + "type": "stored_completions", + "metadata": { + "language": "english" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + } + } + EvalStoredCompletionsSource: + type: object + title: StoredCompletionsRunDataSource + description: > + A StoredCompletionsRunDataSource configuration describing a set of + filters + 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-4o'). + - 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: | + { + "type": "stored_completions", + "model": "gpt-4o", + "created_after": 1668124800, + "created_before": 1668124900, + "limit": 100, + "metadata": {} + } + 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. + properties: + type: + type: string + description: | + The type of the file path. Always `file_path`. + enum: + - file_path + x-stainless-const: true + file_id: + type: string + description: | + The ID of the file. + index: + type: integer + description: | + The index of the file in the list of files. + 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. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. + 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 + + [file search guide](/docs/guides/tools-file-search) for more + information. + properties: + id: + type: string + description: | + The unique ID of the file search tool call. + type: + type: string + enum: + - file_search_call + description: | + The type of the file search tool call. Always `file_search_call`. + x-stainless-const: true + status: + type: string + description: | + The status of the file search tool call. One of `in_progress`, + `searching`, `incomplete` or `failed`, + enum: + - in_progress + - searching + - completed + - incomplete + - failed + queries: + type: array + items: + type: string + description: | + The queries used to search for files. + results: + anyOf: + - type: array + description: | + The results of the file search tool call. + items: + type: object + properties: + file_id: + type: string + description: | + The unique ID of the file. + text: + type: string + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. + - 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. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0 + maximum: 2 + exclusiveMinimum: true + 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. + 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. + 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 through the training dataset. + 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. + 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. + 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 through the training dataset. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 50 + default: auto + reasoning_effort: + description: | + Level of reasoning effort. + type: string + enum: + - default + - low + - medium + - high + default: default + compute_multiplier: + description: > + Multiplier on amount of compute used for exploring search space + during training. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0.00001 + maximum: 10 + exclusiveMinimum: true + default: auto + eval_interval: + description: | + The number of training steps between evaluation runs. + 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. + 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. + 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. + 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 through the training dataset. + 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. + 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: | + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1712211699, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + } + 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 + + metrics will be sent to. Optionally, you can set an explicit display + name for your run, add tags + + to your run, and set a default entity (team, username, etc) to be + associated with your run. + required: + - project + properties: + project: + description: | + The name of the project that the new run will be created under. + 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. + 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 + + like associated with the run. If not set, the default entity + for the registered WandB API key is used. + 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 + + default tags are generated by OpenAI: "openai/finetune", + "openai/{base-model}", "openai/{ftjob-abcdef}". + 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. + 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' + 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 + 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 + + are updated less frequently, but with lower variance. + 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 + + overfitting. + 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 + + through the training dataset. + 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](/docs/api-reference/files/retrieve-contents). + items: + type: string + example: file-abc123 + status: + type: string + description: >- + The current status of the fine-tuning job, which can be either + `validating_files`, `queued`, `running`, `succeeded`, `failed`, or + `cancelled`. + enum: + - validating_files + - queued + - running + - succeeded + - failed + - cancelled + 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](/docs/api-reference/files/retrieve-contents). + validation_file: + anyOf: + - type: string + description: >- + The file ID used for validation. You can retrieve the validation + results with the [Files + API](/docs/api-reference/files/retrieve-contents). + - 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 + 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: + $ref: '#/components/schemas/FineTuneMethod' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - created_at + - error + - finished_at + - fine_tuned_model + - hyperparameters + - id + - model + - object + - organization_id + - result_files + - status + - trained_tokens + - training_file + - validation_file + - seed + x-oaiMeta: + name: The fine-tuning job object + example: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "davinci-002", + "created_at": 1692661014, + "finished_at": 1692661190, + "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + "organization_id": "org-123", + "result_files": [ + "file-abc123" + ], + "status": "succeeded", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + }, + "trained_tokens": 5768, + "integrations": [], + "seed": 0, + "estimated_finish": 0, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + } + } + }, + "metadata": { + "key": "value" + } + } + 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. + 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: | + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P", + "created_at": 1712211699, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88", + "fine_tuning_job_id": "ftjob-fpbNQ3H1GrMehXRf8cO97xTN", + "metrics": { + "step": 88, + "train_loss": 0.478, + "train_mean_token_accuracy": 0.924, + "valid_loss": 10.112, + "valid_mean_token_accuracy": 0.145, + "full_valid_loss": 0.567, + "full_valid_mean_token_accuracy": 0.944 + }, + "step_number": 88 + } + 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 + description: The data associated with the event. + required: + - id + - object + - created_at + - level + - message + x-oaiMeta: + name: The fine-tuning job event object + example: | + { + "object": "fine_tuning.job.event", + "id": "ftevent-abc123" + "created_at": 1677610602, + "level": "info", + "message": "Created fine-tuning job", + "data": {}, + "type": "message" + } + FunctionAndCustomToolCallOutput: + oneOf: + - $ref: '#/components/schemas/InputTextContent' + - $ref: '#/components/schemas/InputImageContent' + - $ref: '#/components/schemas/InputFileContent' + discriminator: + propertyName: type + 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](/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](/docs/guides/function-calling) for examples, and the + [JSON Schema + reference](https://json-schema.org/understanding-json-schema/) for + documentation about the format. + + + Omitting `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 + + [function calling guide](/docs/guides/function-calling) for more + information. + properties: + id: + type: string + description: | + The unique ID of the function tool call. + type: + type: string + enum: + - function_call + description: | + The type of the function tool call. Always `function_call`. + x-stainless-const: true + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - name + - arguments + FunctionToolCallOutput: + type: object + title: Function tool call output + description: | + The output of a function tool call. + properties: + id: + type: string + description: > + The unique ID of the function tool call output. Populated when this + item + + is returned via API. + type: + type: string + enum: + - function_call_output + description: > + The type of the function tool call output. Always + `function_call_output`. + x-stainless-const: true + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + output: + description: | + The output from the function call generated by your code. + Can be a string or an list of output content. + oneOf: + - type: string + description: | + A string of the output of the function call. + title: string output + - type: array + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + title: output content list + description: | + Text, image, or file output of the function call. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - output + FunctionToolCallOutputResource: + allOf: + - $ref: '#/components/schemas/FunctionToolCallOutput' + - type: object + properties: + id: + type: string + description: | + The unique ID of the function call tool output. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallOutputStatusEnum' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + FunctionToolCallResource: + allOf: + - $ref: '#/components/schemas/FunctionToolCall' + - type: object + properties: + id: + type: string + description: | + The unique ID of the function tool call. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + GraderLabelModel: + type: object + title: LabelModelGrader + description: > + A LabelModelGrader object which uses a model to assign labels to each + item + + in the evaluation. + 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: | + { + "name": "First label grader", + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.response}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + 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: + 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: | + { + "type": "multi", + "name": "example multi grader", + "graders": [ + { + "type": "text_similarity", + "name": "example text similarity grader", + "input": "The graded text", + "reference": "The reference text", + "evaluation_metric": "fuzzy_match" + }, + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + ], + "calculate_output": "0.5 * text_similarity_score + 0.5 * string_check_score)" + } + GraderPython: + type: object + title: PythonGrader + description: | + A PythonGrader object that runs a python script on the input. + 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: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + } + GraderScoreModel: + type: object + title: ScoreModelGrader + description: > + A ScoreModelGrader object that uses a model to assign a score to the + input. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: > + An alternative to temperature for nucleus sampling; 1.0 + includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: > + The maximum number of tokens the grader model may generate + in its response. + - 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. + 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: | + { + "type": "score_model", + "name": "Example score model grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "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}}" + ) + }, + { + "type": "input_image", + "image_url": "https://example.com/reference.png", + "file_id": null, + "detail": "auto" + } + ], + } + ], + "model": "gpt-5-mini", + "sampling_params": { + "temperature": 1, + "top_p": 1, + "seed": 42, + "max_completions_tokens": 32768, + "reasoning_effort": "medium" + }, + } + GraderStringCheck: + type: object + title: StringCheckGrader + description: > + A StringCheckGrader object that performs a string comparison between + input and reference using a specified operation. + 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: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + GraderTextSimilarity: + type: object + title: TextSimilarityGrader + description: > + A TextSimilarityGrader object which grades text based on similarity + metrics. + 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`, + + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, + `rouge_5`, + + or `rouge_l`. + required: + - type + - name + - input + - reference + - evaluation_metric + x-oaiMeta: + name: Text Similarity Grader + group: graders + example: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "evaluation_metric": "fuzzy_match" + } + 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: | + { + "object": "group", + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "scim_managed": false + } + 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: | + { + "object": "group.deleted", + "id": "group_01J1F8ABCDXYZ", + "deleted": true + } + 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: | + { + "object": "list", + "data": [ + { + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "is_scim_managed": false + }, + { + "id": "group_01J1F8PQRMNO", + "name": "Sales", + "created_at": 1711472599, + "is_scim_managed": true + } + ], + "has_more": false, + "next": null + } + 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: | + { + "id": "group_01J1F8ABCDXYZ", + "name": "Escalations", + "created_at": 1711471533, + "is_scim_managed": false + } + 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 + description: The type of the group. + required: + - id + - name + - created_at + - is_scim_managed + - group_type + x-oaiMeta: + name: Group + example: | + { + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "is_scim_managed": false, + "group_type": "group" + } + 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: | + { + "object": "group.role", + "group": { + "object": "group", + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "scim_managed": false + }, + "role": { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + } + 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: | + { + "object": "group.user", + "user_id": "user_abc123", + "group_id": "group_01J1F8ABCDXYZ" + } + 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: | + { + "object": "group.user.deleted", + "deleted": true + } + 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 the GPT image models, and only present if `response_format` is + set to `b64_json` for `dall-e-2` and `dall-e-3`. + 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. + revised_prompt: + type: string + description: >- + For `dall-e-3` only, the revised prompt that was used to generate + the image. + ImageEditCompletedEvent: + type: object + description: > + Emitted when image editing has completed and the final image is + available. + properties: + type: + type: string + description: | + The type of the event. Always `image_edit.completed`. + 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. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + type: string + description: | + The size of the edited image. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + quality: + type: string + description: | + The quality setting for the edited image. + enum: + - low + - medium + - high + - auto + background: + type: string + description: | + The background setting for the edited image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the edited image. + 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: | + { + "type": "image_edit.completed", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "usage": { + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 + } + } + } + ImageEditPartialImageEvent: + type: object + description: > + Emitted when a partial image is available during image editing + streaming. + properties: + type: + type: string + description: | + The type of the event. Always `image_edit.partial_image`. + 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. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + type: string + description: | + The size of the requested edited image. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + quality: + type: string + description: | + The quality setting for the requested edited image. + enum: + - low + - medium + - high + - auto + background: + type: string + description: | + The background setting for the requested edited image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the requested edited image. + enum: + - png + - webp + - jpeg + partial_image_index: + type: integer + description: | + 0-based index for the partial image (streaming). + required: + - type + - b64_json + - created_at + - size + - quality + - background + - output_format + - partial_image_index + x-oaiMeta: + name: image_edit.partial_image + group: images + example: | + { + "type": "image_edit.partial_image", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "partial_image_index": 0 + } + 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. + properties: + type: + type: string + description: | + The type of the event. Always `image_generation.completed`. + enum: + - image_generation.completed + x-stainless-const: true + b64_json: + type: string + description: | + Base64-encoded image data, suitable for rendering as an image. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + type: string + description: | + The size of the generated image. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + quality: + type: string + description: | + The quality setting for the generated image. + enum: + - low + - medium + - high + - auto + background: + type: string + description: | + The background setting for the generated image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the generated image. + 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: | + { + "type": "image_generation.completed", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "usage": { + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 + } + } + } + ImageGenPartialImageEvent: + type: object + description: > + Emitted when a partial image is available during image generation + streaming. + properties: + type: + type: string + description: | + The type of the event. Always `image_generation.partial_image`. + 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. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + type: string + description: | + The size of the requested image. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + quality: + type: string + description: | + The quality setting for the requested image. + enum: + - low + - medium + - high + - auto + background: + type: string + description: | + The background setting for the requested image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the requested image. + enum: + - png + - webp + - jpeg + partial_image_index: + type: integer + description: | + 0-based index for the partial image (streaming). + required: + - type + - b64_json + - created_at + - size + - quality + - background + - output_format + - partial_image_index + x-oaiMeta: + name: image_generation.partial_image + group: images + example: | + { + "type": "image_generation.partial_image", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "partial_image_index": 0 + } + 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. + properties: + type: + type: string + enum: + - image_generation + description: | + The type of the image generation tool. Always `image_generation`. + x-stainless-const: true + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-1.5 + description: | + The image generation model to use. Default: `gpt-image-1`. + default: gpt-image-1 + quality: + type: string + enum: + - low + - medium + - high + - auto + description: | + The quality of the generated image. One of `low`, `medium`, `high`, + or `auto`. Default: `auto`. + default: auto + size: + anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + description: >- + The size of the generated images. For `gpt-image-2` and + `gpt-image-2-2026-04-21`, 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 + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer + minimum: 0 + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: + type: string + enum: + - transparent + - opaque + - auto + description: | + Background type for the generated image. One of `transparent`, + `opaque`, or `auto`. Default: `auto`. + default: auto + input_fidelity: + anyOf: + - $ref: '#/components/schemas/InputFidelity' + - type: 'null' + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + 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. + default: 0 + action: + description: > + Whether to generate a new image or edit an existing image. Default: + `auto`. + $ref: '#/components/schemas/ImageGenActionEnum' + required: + - type + ImageGenToolCall: + type: object + title: Image generation call + description: | + An image generation request made by the model. + properties: + type: + type: string + enum: + - image_generation_call + description: > + The type of the image generation call. Always + `image_generation_call`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the image generation call. + status: + type: string + enum: + - in_progress + - completed + - generating + - failed + description: | + The status of the image generation call. + result: + anyOf: + - type: string + description: | + The generated image encoded in base64. + - type: 'null' + required: + - type + - id + - status + - result + ImageRefParam: + type: object + description: | + Reference an input image by either URL or uploaded file ID. + Provide exactly one of `image_url` or `file_id`. + 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: + 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: + type: string + description: >- + The size of the image generated. Either `1024x1024`, `1024x1536`, or + `1536x1024`. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + quality: + type: string + description: >- + The quality of the image generated. Either `low`, `medium`, or + `high`. + enum: + - low + - medium + - high + usage: + $ref: '#/components/schemas/ImageGenUsage' + required: + - created + x-oaiMeta: + name: The image generation response + group: images + example: | + { + "created": 1713833628, + "data": [ + { + "b64_json": "..." + } + ], + "background": "transparent", + "output_format": "png", + "size": "1024x1024", + "quality": "high", + "usage": { + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 + } + } + } + ImagesUsage: + type: object + description: > + For the GPT image models only, the token usage information for the image + generation. + 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. + 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. + properties: + type: + type: string + description: | + The type of the input item. Always `input_audio`. + enum: + - input_audio + x-stainless-const: true + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: > + The format of the audio data. Currently supported formats are + `mp3` and + + `wav`. + 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 + generated by the model. Can contain text, images, and audio inputs, + as well as previous assistant responses and tool call outputs. + $ref: '#/components/schemas/Item' + - $ref: '#/components/schemas/ItemReferenceParam' + discriminator: + propertyName: type + InputMessage: + type: object + title: Input message + description: > + A message input to the model with a role indicating instruction + following + + hierarchy. Instructions given with the `developer` or `system` role take + + precedence over instructions given with the `user` role. + properties: + type: + type: string + description: | + The type of the message input. Always set to `message`. + enum: + - message + x-stainless-const: true + role: + type: string + description: > + The role of the message input. One of `user`, `system`, or + `developer`. + enum: + - user + - system + - developer + status: + type: string + description: | + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + 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 + + types. + 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. + required: + - id + - type + InputParam: + description: | + Text, image, or file inputs to the model, used to generate a response. + + Learn more: + - [Text inputs and outputs](/docs/guides/text) + - [Image inputs](/docs/guides/images) + - [File inputs](/docs/guides/pdf-files) + - [Conversation state](/docs/guides/conversation-state) + - [Function calling](/docs/guides/function-calling) + oneOf: + - type: string + title: Text input + description: | + A text input to the model, equivalent to a text input with the + `user` role. + - type: array + title: Input item list + description: | + A list of one or many input items to the model, containing + different content types. + 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: | + { + "object": "organization.invite", + "id": "invite-abc", + "email": "user@example.com", + "role": "owner", + "status": "accepted", + "created_at": 1711471533, + "expires_at": 1711471533, + "accepted_at": 1711471533, + "projects": [ + { + "id": "project-xyz", + "role": "member" + } + ] + } + 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: | + { + "group_id": "group_01J1F8ABCDXYZ", + "role": "role_01J1F8PROJ" + } + 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. + 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. + 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/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. + 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/ReasoningItem' + - $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: | + { + "object": "list", + "data": [ + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698982736, + "name": "Coding Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc456", + "object": "assistant", + "created_at": 1698982718, + "name": "My Assistant", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc789", + "object": "assistant", + "created_at": 1698982643, + "name": null, + "description": null, + "model": "gpt-4o", + "instructions": null, + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + ], + "first_id": "asst_abc123", + "last_id": "asst_abc789", + "has_more": false + } + 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 + LocalShellToolCall: + type: object + title: Local shell call + description: | + A tool call to run a command on the local shell. + properties: + type: + type: string + enum: + - local_shell_call + description: | + The type of the local shell call. Always `local_shell_call`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the local shell call. + call_id: + type: string + description: | + The unique ID of the local shell tool call generated by the model. + action: + $ref: '#/components/schemas/LocalShellExecAction' + status: + type: string + enum: + - in_progress + - completed + - incomplete + description: | + The status of the local shell call. + required: + - type + - id + - call_id + - action + - status + LocalShellToolCallOutput: + type: object + title: Local shell call output + description: | + The output of a local shell tool call. + properties: + type: + type: string + enum: + - local_shell_call_output + description: > + The type of the local shell tool call output. Always + `local_shell_call_output`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the local shell tool call generated by the model. + output: + type: string + description: | + A JSON string of the output of the local shell tool call. + status: + anyOf: + - type: string + enum: + - in_progress + - completed + - incomplete + description: > + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. + - type: 'null' + required: + - id + - type + - call_id + - output + LogProbProperties: + type: object + description: | + A log probability object. + properties: + token: + type: string + description: | + The token that was used to generate the log probability. + logprob: + type: number + description: | + The log probability of the token. + bytes: + type: array + items: + type: integer + description: | + The bytes that were used to generate the log probability. + required: + - token + - logprob + - bytes + MCPApprovalRequest: + type: object + title: MCP approval request + description: | + A request for human approval of a tool invocation. + 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 + MCPApprovalResponse: + type: object + title: MCP approval response + description: | + A response to an MCP approval request. + properties: + type: + type: string + enum: + - mcp_approval_response + description: | + The type of the item. Always `mcp_approval_response`. + x-stainless-const: true + id: + anyOf: + - type: string + description: | + The unique ID of the approval response + - type: 'null' + 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 + - request_id + - approve + - approval_request_id + MCPApprovalResponseResource: + type: object + title: MCP approval response + description: | + A response to an MCP approval request. + 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 + - request_id + - approve + - approval_request_id + MCPListTools: + type: object + title: MCP list tools + description: | + A list of tools available on an MCP server. + 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. + error: + anyOf: + - type: string + description: | + Error message if the server could not list tools. + - type: 'null' + required: + - type + - id + - server_label + - tools + MCPListToolsTool: + type: object + title: MCP list tools tool + description: | + A tool available on an MCP server. + properties: + name: + type: string + description: | + The name of the tool. + description: + anyOf: + - type: string + description: | + The description of the tool. + - type: 'null' + input_schema: + type: object + description: | + The JSON schema describing the tool's input. + annotations: + anyOf: + - type: object + description: | + Additional annotations about the tool. + - 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 + + (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). + 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. + server_url: + type: string + format: uri + description: > + The URL for the MCP server. One of `server_url` or `connector_id` + must be + + provided. + 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 + + `server_url` or `connector_id` must be provided. Learn more about + service + + connectors [here](/docs/guides/tools-remote-mcp#connectors). + + + Currently supported `connector_id` values are: + + + - Dropbox: `connector_dropbox` + + - Gmail: `connector_gmail` + + - Google Calendar: `connector_googlecalendar` + + - Google Drive: `connector_googledrive` + + - Microsoft Teams: `connector_microsoftteams` + + - Outlook Calendar: `connector_outlookcalendar` + + - Outlook Email: `connector_outlookemail` + + - SharePoint: `connector_sharepoint` + authorization: + type: string + description: > + An OAuth access token that can be used with a remote MCP server, + either + + with a custom MCP server URL or a service connector. Your + application + + must handle the OAuth authorization flow and provide the token here. + server_description: + type: string + description: > + Optional description of the MCP server, used to provide more + context. + headers: + anyOf: + - type: object + additionalProperties: + type: string + description: > + Optional HTTP headers to send to the MCP server. Use for + authentication + + or other purposes. + - type: 'null' + allowed_tools: + anyOf: + - description: | + List of allowed tool names or a filter object. + oneOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/MCPToolFilter' + - 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 + + `always`, `never`, or a filter object associated with tools + + that require approval. + 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 + + `never`. When set to `always`, all tools will require + approval. When + + set to `never`, all tools will not require approval. + enum: + - always + - never + default: always + - type: 'null' + defer_loading: + type: boolean + description: | + Whether this MCP tool is deferred and discovered via tool search. + required: + - type + - server_label + MCPToolCall: + type: object + title: MCP tool call + description: | + An invocation of a tool on an MCP server. + 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. + output: + anyOf: + - type: string + description: | + The output from the tool call. + - type: 'null' + error: + anyOf: + - type: string + description: | + The error from the tool call, if any. + - type: 'null' + status: + $ref: '#/components/schemas/MCPToolCallStatus' + description: > + The status of the tool call. One of `in_progress`, `completed`, + `incomplete`, `calling`, or `failed`. + approval_request_id: + anyOf: + - type: string + description: > + Unique identifier for the MCP tool call approval request. + + Include this value in a subsequent `mcp_approval_response` input + to approve or reject the corresponding tool call. + - type: 'null' + required: + - type + - id + - server_label + - name + - arguments + MCPToolFilter: + type: object + title: MCP tool filter + description: | + A filter object to specify which tools are allowed. + 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 + + MCP server is [annotated with + `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), + + it will match this filter. + required: [] + additionalProperties: false + MessageContentImageFileObject: + title: Image file + type: object + description: >- + References an image [File](/docs/api-reference/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](/docs/api-reference/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](/docs/api-reference/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](/docs/api-reference/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. + 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: | + { + "id": "msg_123", + "object": "thread.message.delta", + "delta": { + "content": [ + { + "index": 0, + "type": "text", + "text": { "value": "Hello", "annotations": [] } + } + ] + } + } + MessageObject: + type: object + title: The message object + description: Represents a message within a [thread](/docs/api-reference/threads). + 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](/docs/api-reference/threads) 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](/docs/api-reference/assistants) that authored this + message. + type: string + - type: 'null' + run_id: + anyOf: + - description: >- + The ID of the [run](/docs/api-reference/runs) 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: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1698983503, + "thread_id": "thread_abc123", + "role": "assistant", + "content": [ + { + "type": "text", + "text": { + "value": "Hi! How can I help you today?", + "annotations": [] + } + } + ], + "assistant_id": "asst_abc123", + "run_id": "run_abc123", + "attachments": [], + "metadata": {} + } + MessagePhase: + type: string + 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. + 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](/docs/api-reference/messages/object) is + created. + x-oaiMeta: + dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' + - 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](/docs/api-reference/messages/object) moves + to an `in_progress` state. + x-oaiMeta: + dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' + - 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](/docs/api-reference/messages/object) are being streamed. + x-oaiMeta: + dataDescription: >- + `data` is a [message + delta](/docs/api-reference/assistants-streaming/message-delta-object) + - 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](/docs/api-reference/messages/object) is + completed. + x-oaiMeta: + dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' + - 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](/docs/api-reference/messages/object) ends + before it is completed. + x-oaiMeta: + dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' + Metadata: + anyOf: + - 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. + + + Keys are strings with a maximum length of 64 characters. Values are + strings + + with a maximum length of 512 characters. + 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. + required: + - id + - object + - created + - owned_by + x-oaiMeta: + name: The model object + example: | + { + "id": "VAR_chat_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + } + 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-5` or `o3`. OpenAI + offers a wide range of models with different capabilities, performance + characteristics, and price points. Refer to the [model + guide](/docs/models) to browse and compare available models. + ModelIdsResponses: + example: gpt-5.1 + 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-codex + - gpt-5-pro + - gpt-5-pro-2025-10-06 + - gpt-5.1-codex-max + ModelIdsShared: + example: gpt-5.4 + anyOf: + - type: string + - type: string + enum: + - 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 + 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 + + tokens to return at each token position, each with an associated + log + + probability. In some cases, the number of returned tokens may be + fewer than + + requested. + 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. + + We generally recommend altering this or `top_p` but not both. + - 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. + + + We generally recommend altering this or `temperature` but not + both. + - type: 'null' + user: + 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. + + A stable identifier for your end-users. + + Used to boost cache hit rates by better bucketing similar requests + and to help OpenAI detect and prevent abuse. [Learn + more](/docs/guides/safety-best-practices#safety-identifiers). + safety_identifier: + 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. + + The 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](/docs/guides/safety-best-practices#safety-identifiers). + prompt_cache_key: + 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](/docs/guides/prompt-caching). + service_tier: + $ref: '#/components/schemas/ServiceTier' + prompt_cache_retention: + anyOf: + - type: string + enum: + - in_memory + - 24h + description: > + The 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](/docs/guides/prompt-caching#prompt-cache-retention). + - type: 'null' + ModifyAssistantRequest: + type: object + additionalProperties: false + properties: + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. + 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. + type: string + maxLength: 256 + - type: 'null' + description: + anyOf: + - description: > + The description of the assistant. The maximum length is 512 + characters. + type: string + maxLength: 512 + - type: 'null' + instructions: + anyOf: + - description: > + The system instructions that the assistant uses. The maximum + length is 256,000 characters. + 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`. + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + Overrides the list of [file](/docs/api-reference/files) + IDs made available to the `code_interpreter` tool. There + can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + Overrides the [vector + store](/docs/api-reference/vector-stores/object) + attached to this assistant. There can be a maximum of 1 + vector store attached to the assistant. + 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. + 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. + + + We generally recommend altering this or temperature but not + both. + - 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector + store](/docs/api-reference/vector-stores/object) + attached to this thread. There can be a maximum of 1 + vector store attached to the thread. + 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. + 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 + 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. + 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`. + required: + - id + - object + - bytes + - created_at + - filename + - purpose + - status + x-oaiMeta: + name: The file object + example: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1680202602, + "filename": "salesOverview.pdf", + "purpose": "assistants", + } + 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 + 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 + 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. + properties: + type: + type: string + description: | + The type of the output audio. Always `output_audio`. + enum: + - output_audio + x-stainless-const: true + data: + type: string + description: | + Base64-encoded audio data from the model. + transcript: + type: string + description: | + The transcript of the audio data from the model. + 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/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $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. + properties: + id: + type: string + description: | + The unique ID of the output message. + type: + type: string + description: | + The type of the output message. Always `message`. + enum: + - message + x-stainless-const: true + role: + type: string + description: | + The role of the output message. Always `assistant`. + enum: + - assistant + x-stainless-const: true + content: + type: array + description: | + The content of the output message. + 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 + + `incomplete`. Populated when input items are returned via API. + 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](/docs/guides/function-calling#configuring-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 + + streaming responses that return partial images. Value must be + between 0 and 3. + + When set to 0, the response will be a single image sent in one + streaming event. + + + Note that the final image may be sent before the full number of + partial images + + are generated if the full image is generated more quickly. + - type: 'null' + PredictionContent: + type: object + title: Static Content + description: > + Static predicted output content, such as the content of a text file that + is + + being regenerated. + required: + - type + - content + properties: + type: + type: string + enum: + - content + description: | + The type of the predicted content you want to provide. This type is + currently always `content`. + x-stainless-const: true + content: + description: > + The content that should be matched when generating a model response. + + If generated tokens would match this content, the entire model + response + + can be returned much more quickly. + oneOf: + - type: string + title: Text content + description: | + The content used for a Predicted Output. This is often the + text of a file you are regenerating with minor changes. + - type: array + description: >- + An array of content parts with a defined type. Supported options + differ based on the [model](/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. + required: + - id + - object + - created_at + x-oaiMeta: + name: The project object + example: | + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project example", + "created_at": 1711471533, + "archived_at": null, + "status": "active", + "external_key_id": null + } + 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 + 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: + 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 + x-oaiMeta: + name: The project API key object + example: | + { + "object": "organization.project.api_key", + "redacted_value": "sk-abc...def", + "name": "My API Key", + "created_at": 1711471533, + "last_used_at": 1711471534, + "id": "key_abc", + "owner": { + "type": "user", + "user": { + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "created_at": 1711471533 + } + } + } + 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' + 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](/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 + 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 + 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: | + { + "object": "project.group", + "project_id": "proj_abc123", + "group_id": "group_01J1F8ABCDXYZ", + "group_name": "Support Team", + "group_type": "group", + "created_at": 1711471533 + } + 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: | + { + "object": "project.group.deleted", + "deleted": true + } + 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: | + { + "object": "list", + "data": [ + { + "object": "project.group", + "project_id": "proj_abc123", + "group_id": "group_01J1F8ABCDXYZ", + "group_name": "Support Team", + "created_at": 1711471533 + } + ], + "has_more": false, + "next": null + } + 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 + 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: | + { + "object": "project.rate_limit", + "id": "rl_ada", + "model": "ada", + "max_requests_per_1_minute": 600, + "max_tokens_per_1_minute": 150000, + "max_images_per_1_minute": 10 + } + 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 + description: '`owner` or `member`' + 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: | + { + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Service Account", + "role": "owner", + "created_at": 1711471533 + } + 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 + 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. + 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 + description: Service accounts can only have one role of type `member` + x-stainless-const: true + 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 + 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' + description: Geography for the project. + 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: | + { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + 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. + [Learn more](/docs/guides/text?api-mode=responses#reusable-prompts). + 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: | + { + "role_id": "role_01J1F8ROLE01" + } + 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: | + { + "role_name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "description": "Allows managing organization groups" + } + 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: | + { + "object": "list", + "data": [ + { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + ], + "has_more": false, + "next": null + } + 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: | + { + "role_name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "description": "Allows managing organization groups" + } + 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 + + calls, and function call responses. This event can be used both to + populate a + + "history" of the conversation and to add new items mid-stream, but has + the + + current limitation that it cannot populate assistant audio messages. + + + If successful, the server will respond with a + `conversation.item.created` + + event, otherwise an `error` event will be sent. + 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. + + If set to `root`, the new item will be added to the beginning of the + conversation. + + If 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. + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - type + - item + x-oaiMeta: + name: conversation.item.create + group: realtime + example: | + { + "type": "conversation.item.create", + "item": { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } + ] + }, + "event_id": "b904fba0-0ec4-40af-8bbb-f908a9b26793", + } + RealtimeBetaClientEventConversationItemDelete: + type: object + description: > + Send this event when you want to remove any item from the conversation + + history. The server will respond with a `conversation.item.deleted` + event, + + unless the item does not exist in the conversation history, in which + case the + + server will respond with an error. + 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: | + { + "event_id": "event_901", + "type": "conversation.item.delete", + "item_id": "msg_003" + } + 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. + + The server will respond with a `conversation.item.retrieved` event, + + unless the item does not exist in the conversation history, in which + case the + + server will respond with an error. + 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: | + { + "event_id": "event_901", + "type": "conversation.item.retrieve", + "item_id": "msg_003" + } + RealtimeBetaClientEventConversationItemTruncate: + type: object + description: > + Send this event to truncate a previous assistant message’s audio. The + server + + will produce audio faster than realtime, so this event is useful when + the user + + interrupts to truncate audio that has already been sent to the client + but not + + yet played. This will synchronize the server's understanding of the + audio with + + the client's playback. + + + Truncating audio will delete the server-side text transcript to ensure + there + + is not text in the context that hasn't been heard by the user. + + + If successful, the server will respond with a + `conversation.item.truncated` + + event. + 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 + + items can be truncated. + 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 + + the audio_end_ms is greater than the actual audio duration, the + server + + will respond with an error. + required: + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncate + group: realtime + example: | + { + "event_id": "event_678", + "type": "conversation.item.truncate", + "item_id": "msg_002", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeBetaClientEventInputAudioBufferAppend: + type: object + description: > + Send this event to append audio bytes to the input audio buffer. The + audio + + buffer is temporary storage you can write to and later commit. In Server + VAD + + mode, the audio buffer is used to detect speech and the server will + decide + + when to commit. When Server VAD is disabled, you must commit the audio + buffer + + manually. + + + The client may choose how much audio to place in each event up to a + maximum + + of 15 MiB, for example streaming smaller chunks from the client may + allow the + + VAD to be more responsive. Unlike made other client events, the server + will + + not send a confirmation response to this event. + 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 + + `input_audio_format` field in the session configuration. + required: + - type + - audio + x-oaiMeta: + name: input_audio_buffer.append + group: realtime + example: | + { + "event_id": "event_456", + "type": "input_audio_buffer.append", + "audio": "Base64EncodedAudioData" + } + RealtimeBetaClientEventInputAudioBufferClear: + type: object + description: | + Send this event to clear the audio bytes in the buffer. The server will + respond with an `input_audio_buffer.cleared` event. + 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: | + { + "event_id": "event_012", + "type": "input_audio_buffer.clear" + } + RealtimeBetaClientEventInputAudioBufferCommit: + 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. + + + Committing 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. + 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: | + { + "event_id": "event_789", + "type": "input_audio_buffer.commit" + } + RealtimeBetaClientEventOutputAudioBufferClear: + type: object + description: > + **WebRTC/SIP Only:** Emit to cut off the current audio response. This + will trigger the server to + + stop generating audio and emit a `output_audio_buffer.cleared` event. + This + + event should be preceded by a `response.cancel` client event to stop the + + generation of the current response. + + [Learn + more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + 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: | + { + "event_id": "optional_client_event_id", + "type": "output_audio_buffer.clear" + } + RealtimeBetaClientEventResponseCancel: + type: object + description: > + Send this event to cancel an in-progress response. The server will + respond + + with a `response.done` event with a status of + `response.status=cancelled`. If + + there is no response to cancel, the server will respond with an error. + 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 + in-progress response in the default conversation. + required: + - type + x-oaiMeta: + name: response.cancel + group: realtime + example: | + { + "event_id": "event_567", + "type": "response.cancel" + } + RealtimeBetaClientEventResponseCreate: + type: object + description: > + This event instructs the server to create a Response, which means + triggering + + model inference. When in Server VAD mode, the server will create + Responses + + automatically. + + + A Response will include at least one Item, and may have two, in which + case + + the second will be a function call. These Items will be appended to the + + conversation history. + + + The server will respond with a `response.created` event, events for + Items + + and content created, and finally a `response.done` event to indicate + the + + Response is complete. + + + The `response.create` event can optionally include inference + configuration like + + `instructions`, and `temperature`. These fields will override the + Session's + + configuration for this Response only. + + + Responses can be created out-of-band of the default Conversation, + meaning that they can + + have arbitrary input, and it's possible to disable writing the output to + the Conversation. + + Only one Response can write to the default Conversation at a time, but + otherwise multiple + + Responses can be created in parallel. + + + Clients can set `conversation` to `none` to create a Response that does + not write to the default + + Conversation. Arbitrary input can be provided with the `input` field, + which is an array accepting + + raw Items and references to existing Items. + 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 + + { + "type": "response.create", + } + + + // Trigger an out-of-band response that does not write to the default + Conversation + + { + "type": "response.create", + "response": { + "instructions": "Provide a concise answer.", + "tools": [], // clear any session tools + "conversation": "none", + "output_modalities": ["text"], + "input": [ + { + "type": "item_reference", + "id": "item_12345", + }, + { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Summarize the above message in one sentence." + } + ] + } + ], + } + } + RealtimeBetaClientEventSessionUpdate: + type: object + description: > + Send this event to update the session’s default configuration. + + The client may send this event at any time to update any field, + + except for `voice`. However, note that once a session has been + + initialized with a particular `model`, it can’t be changed to + + another model using `session.update`. + + + When the server receives a `session.update`, it will respond + + with a `session.updated` event showing the full, effective + configuration. + + Only the fields that are present are updated. To clear a field like + + `instructions`, pass an empty string. + 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: | + { + "type": "session.update", + "session": { + "tools": [ + { + "type": "function", + "name": "display_color_palette", + "description": "Call this function when a user asks for a color palette.", + "parameters": { + "type": "object", + "properties": { + "theme": { + "type": "string", + "description": "Description of the theme for the color scheme." + }, + "colors": { + "type": "array", + "description": "Array of five hex color codes based on the theme.", + "items": { + "type": "string", + "description": "Hex color code" + } + } + }, + "required": [ + "theme", + "colors" + ] + } + } + ], + "tool_choice": "auto" + } + } + RealtimeBetaClientEventTranscriptionSessionUpdate: + type: object + description: | + Send this event to update a transcription session. + 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: | + { + "type": "transcription_session.update", + "session": { + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.logprobs", + ] + } + } + 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 + + `incomplete`, `in_progress`). + 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 + + with the `status` field (`completed`, `cancelled`, + `incomplete`, + + `failed`). + 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). + error: + type: object + description: | + A description of the error that caused the response to fail, + populated when the `status` is `failed`. + 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 + + Realtime API session will maintain a conversation context and append + new + + Items to the Conversation, thus output from previous turns (text + and + + audio tokens) will become the input for later turns. + properties: + total_tokens: + type: integer + description: > + The total number of tokens in the Response including input and + output + + text and audio tokens. + input_tokens: + type: integer + description: > + The number of input tokens used in the Response, including text + and + + audio tokens. + output_tokens: + type: integer + description: > + The number of output tokens sent in the Response, including text + and + + audio tokens. + 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` + + field in the `response.create` event. If `auto`, the response will + be added to + + the default conversation and the value of `conversation_id` will be + an id like + + `conv_1234`. If `none`, the response will not be added to any + conversation and + + the value of `conversation_id` will be `null`. If responses are + being triggered + + by server VAD, the response will be added to the default + conversation, thus + + the `conversation_id` will be an id like `conv_1234`. + type: string + voice: + $ref: '#/components/schemas/VoiceIdsShared' + description: > + The voice the model used to respond. + + Current voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, + `sage`, + + `shimmer`, and `verse`. + modalities: + type: array + description: > + The set of modalities the model used to respond. If there are + multiple modalities, + + the model will pick one, for example if `modalities` is `["text", + "audio"]`, the model + + could be responding in either text or audio. + 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`. + temperature: + type: number + description: > + Sampling temperature for the model, limited to [0.6, 1.2]. Defaults + to 0.8. + 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, + inclusive of tool calls, that was used in this response. + 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, + set this to ["text"]. + 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. + + + Note 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. + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + description: > + The voice the model uses to respond. Supported built-in voices are + + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, + `verse`, + + `marin`, and `cedar`. You may also provide a custom voice object + with an + + `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed + during + + the session once the model has responded with audio at least once. + 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`. + 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 + + to call it, and guidance about what to tell the user when + calling + + (if anything). + 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 + + function/MCP tool. + 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. + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + conversation: + description: > + Controls which conversation the response is added to. Currently + supports + + `auto` and `none`, with `auto` as the default value. The `auto` + value + + means that the contents of the response will be added to the default + + conversation. Set this to `none` to create an out-of-band response + which + + will not add items to default conversation. + 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 + + creates a new context for this Response instead of using the default + + conversation. An empty array `[]` will clear the context for this + Response. + + Note that this can include references to items from the default + conversation. + items: + $ref: '#/components/schemas/RealtimeConversationItem' + RealtimeBetaServerEventConversationItemCreated: + type: object + description: > + Returned when a conversation item is created. There are several + scenarios that produce this event: + - The server is generating a Response, which if successful will produce + either one or two Items, which will be of type `message` + (role `assistant`) or type `function_call`. + - The input audio buffer has been committed, either by the client or the + server (in `server_vad` mode). The server will take the content of the + input audio buffer and add it to a new user message Item. + - The client has sent a `conversation.item.create` event to add a new Item + to the Conversation. + 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 + + client to understand the order of the conversation. Can be + `null` if the + + item has no predecessor. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.created + group: realtime + example: | + { + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [] + } + } + RealtimeBetaServerEventConversationItemDeleted: + type: object + description: > + Returned when an item in the conversation is deleted by the client with + a + + `conversation.item.delete` event. This event is used to synchronize the + + server's understanding of the conversation history with the client's + view. + 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: | + { + "event_id": "event_2728", + "type": "conversation.item.deleted", + "item_id": "msg_005" + } + RealtimeBetaServerEventConversationItemInputAudioTranscriptionCompleted: + type: object + description: > + This event is the output of audio transcription for user audio written + to the + + user audio buffer. Transcription begins when the input audio buffer is + + committed by the client or server (in `server_vad` mode). Transcription + runs + + asynchronously with Response creation, so this event may come before or + after + + the Response events. + + + Realtime API models accept audio natively, and thus input transcription + is a + + separate process run on a separate ASR (Automatic Speech Recognition) + model. + + The transcript may diverge somewhat from the model's interpretation, and + + should be treated as a rough guide. + 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 + `conversation.item.input_audio_transcription.completed`. + 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. + 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: | + { + "event_id": "event_2122", + "type": "conversation.item.input_audio_transcription.completed", + "item_id": "msg_003", + "content_index": 0, + "transcript": "Hello, how are you?", + "usage": { + "type": "tokens", + "total_tokens": 48, + "input_tokens": 38, + "input_token_details": { + "text_tokens": 10, + "audio_tokens": 28, + }, + "output_tokens": 10, + } + } + RealtimeBetaServerEventConversationItemInputAudioTranscriptionDelta: + type: object + description: > + Returned when the text value of an input audio transcription content + part is updated. + 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: | + { + "type": "conversation.item.input_audio_transcription.delta", + "event_id": "event_001", + "item_id": "item_001", + "content_index": 0, + "delta": "Hello" + } + RealtimeBetaServerEventConversationItemInputAudioTranscriptionFailed: + type: object + description: > + Returned when input audio transcription is configured, and a + transcription + + request for a user message failed. These events are separate from other + + `error` events so that the client can identify the related Item. + 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 + `conversation.item.input_audio_transcription.failed`. + 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: | + { + "event_id": "event_2324", + "type": "conversation.item.input_audio_transcription.failed", + "item_id": "msg_003", + "content_index": 0, + "error": { + "type": "transcription_error", + "code": "audio_unintelligible", + "message": "The audio could not be transcribed.", + "param": null + } + } + 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: | + { + "event_id": "event_6501", + "type": "conversation.item.input_audio_transcription.segment", + "item_id": "msg_011", + "content_index": 0, + "text": "hello", + "id": "seg_0001", + "speaker": "spk_1", + "start": 0.0, + "end": 0.4 + } + RealtimeBetaServerEventConversationItemRetrieved: + type: object + description: > + Returned when a conversation item is retrieved with + `conversation.item.retrieve`. + 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: | + { + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [ + { + "type": "input_audio", + "transcript": "hello how are you", + "audio": "base64encodedaudio==" + } + ] + } + } + RealtimeBetaServerEventConversationItemTruncated: + type: object + description: > + Returned when an earlier assistant audio message item is truncated by + the + + client with a `conversation.item.truncate` event. This event is used to + + synchronize the server's understanding of the audio with the client's + playback. + + + This action will truncate the audio and remove the server-side text + transcript + + to ensure there is no text in the context that hasn't been heard by the + user. + 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. + required: + - event_id + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncated + group: realtime + example: | + { + "event_id": "event_2526", + "type": "conversation.item.truncated", + "item_id": "msg_004", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeBetaServerEventError: + type: object + description: > + Returned when an error occurs, which could be a client problem or a + server + + problem. Most errors are recoverable and the session will stay open, we + + recommend to implementors to monitor and log error messages by default. + 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"). + 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. + - type: 'null' + required: + - event_id + - type + - error + x-oaiMeta: + name: error + group: realtime + example: | + { + "event_id": "event_890", + "type": "error", + "error": { + "type": "invalid_request_error", + "code": "invalid_event", + "message": "The 'type' field is missing.", + "param": null, + "event_id": "event_567" + } + } + RealtimeBetaServerEventInputAudioBufferCleared: + type: object + description: | + Returned when the input audio buffer is cleared by the client with a + `input_audio_buffer.clear` event. + 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: | + { + "event_id": "event_1314", + "type": "input_audio_buffer.cleared" + } + RealtimeBetaServerEventInputAudioBufferCommitted: + type: object + description: > + Returned when an input audio buffer is committed, either by the client + or + + automatically in server VAD mode. The `item_id` property is the ID of + the user + + message item that will be created, thus a `conversation.item.created` + event + + will also be sent to the client. + 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. + + Can be `null` if the item has no predecessor. + - 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: | + { + "event_id": "event_1121", + "type": "input_audio_buffer.committed", + "previous_item_id": "msg_001", + "item_id": "msg_002" + } + RealtimeBetaServerEventInputAudioBufferSpeechStarted: + type: object + description: > + Sent by the server when in `server_vad` mode to indicate that speech has + been + + detected in the audio buffer. This can happen any time audio is added to + the + + buffer (unless speech is already detected). The client may want to use + this + + event to interrupt audio playback or provide visual feedback to the + user. + + + The client should expect to receive a + `input_audio_buffer.speech_stopped` event + + when speech stops. The `item_id` property is the ID of the user message + item + + that will be created when speech stops and will also be included in the + + `input_audio_buffer.speech_stopped` event (unless the client manually + commits + + the audio buffer during VAD activation). + 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 + + session when speech was first detected. This will correspond to the + + beginning of audio sent to the model, and thus includes the + + `prefix_padding_ms` configured in the Session. + item_id: + type: string + description: > + The ID of the user message item that will be created when speech + stops. + required: + - event_id + - type + - audio_start_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.speech_started + group: realtime + example: | + { + "event_id": "event_1516", + "type": "input_audio_buffer.speech_started", + "audio_start_ms": 1000, + "item_id": "msg_003" + } + RealtimeBetaServerEventInputAudioBufferSpeechStopped: + type: object + description: > + Returned in `server_vad` mode when the server detects the end of speech + in + + the audio buffer. The server will also send an + `conversation.item.created` + + event with the user message item that is created from the audio buffer. + 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 + + correspond to the end of audio sent to the model, and thus includes + the + + `min_silence_duration_ms` configured in the Session. + 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: | + { + "event_id": "event_1718", + "type": "input_audio_buffer.speech_stopped", + "audio_end_ms": 2000, + "item_id": "msg_003" + } + 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: | + { + "event_id": "event_6102", + "type": "mcp_list_tools.completed", + "item_id": "mcp_list_tools_001" + } + 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: | + { + "event_id": "event_6103", + "type": "mcp_list_tools.failed", + "item_id": "mcp_list_tools_001" + } + 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: | + { + "event_id": "event_6101", + "type": "mcp_list_tools.in_progress", + "item_id": "mcp_list_tools_001" + } + RealtimeBetaServerEventRateLimitsUpdated: + type: object + description: > + Emitted at the beginning of a Response to indicate the updated rate + limits. + + When a Response is created some tokens will be "reserved" for the + output + + tokens, the rate limits shown here reflect that reservation, which is + then + + adjusted accordingly once the Response is completed. + 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`). + 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: | + { + "event_id": "event_5758", + "type": "rate_limits.updated", + "rate_limits": [ + { + "name": "requests", + "limit": 1000, + "remaining": 999, + "reset_seconds": 60 + }, + { + "name": "tokens", + "limit": 50000, + "remaining": 49950, + "reset_seconds": 60 + } + ] + } + 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: | + { + "event_id": "event_4950", + "type": "response.output_audio.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Base64EncodedAudioDelta" + } + RealtimeBetaServerEventResponseAudioDone: + type: object + description: > + Returned when the model-generated audio is done. Also emitted when a + Response + + is interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_5152", + "type": "response.output_audio.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0 + } + RealtimeBetaServerEventResponseAudioTranscriptDelta: + type: object + description: > + Returned when the model-generated transcription of audio output is + updated. + 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: | + { + "event_id": "event_4546", + "type": "response.output_audio_transcript.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Hello, how can I a" + } + RealtimeBetaServerEventResponseAudioTranscriptDone: + type: object + description: | + Returned when the model-generated transcription of audio output is done + streaming. Also emitted when a Response is interrupted, incomplete, or + cancelled. + 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: | + { + "event_id": "event_4748", + "type": "response.output_audio_transcript.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "transcript": "Hello, how can I assist you today?" + } + RealtimeBetaServerEventResponseContentPartAdded: + type: object + description: > + Returned when a new content part is added to an assistant message item + during + + response generation. + 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: | + { + "event_id": "event_3738", + "type": "response.content_part.added", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "" + } + } + RealtimeBetaServerEventResponseContentPartDone: + type: object + description: > + Returned when a content part is done streaming in an assistant message + item. + + Also emitted when a Response is interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_3940", + "type": "response.content_part.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "Sure, I can help with that." + } + } + RealtimeBetaServerEventResponseCreated: + type: object + description: > + Returned when a new Response is created. The first event of response + creation, + + where the response is in an initial state of `in_progress`. + 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: | + { + "type": "response.created", + "event_id": "event_C9G8pqbTEddBSIxbBN6Os", + "response": { + "object": "realtime.response", + "id": "resp_C9G8p7IH2WxLbkgPNouYL", + "status": "in_progress", + "status_details": null, + "output": [], + "conversation_id": "conv_C9G8mmBkLhQJwCon3hoJN", + "output_modalities": [ + "audio" + ], + "max_output_tokens": "inf", + "audio": { + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin" + } + }, + "usage": null, + "metadata": null + }, + "timestamp": "2:30:35 PM" + } + RealtimeBetaServerEventResponseDone: + type: object + description: > + Returned when a Response is done streaming. Always emitted, no matter + the + + final state. The Response object included in the `response.done` event + will + + include all output Items in the Response but will omit the raw audio + data. + 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: | + { + "event_id": "event_3132", + "type": "response.done", + "response": { + "id": "resp_001", + "object": "realtime.response", + "status": "completed", + "status_details": null, + "output": [ + { + "id": "msg_006", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, how can I assist you today?" + } + ] + } + ], + "usage": { + "total_tokens":275, + "input_tokens":127, + "output_tokens":148, + "input_token_details": { + "cached_tokens":384, + "text_tokens":119, + "audio_tokens":8, + "cached_tokens_details": { + "text_tokens": 128, + "audio_tokens": 256 + } + }, + "output_token_details": { + "text_tokens":36, + "audio_tokens":112 + } + } + } + } + RealtimeBetaServerEventResponseFunctionCallArgumentsDelta: + type: object + description: | + Returned when the model-generated function call arguments are updated. + 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`. + 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: | + { + "event_id": "event_5354", + "type": "response.function_call_arguments.delta", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "delta": "{\"location\": \"San\"" + } + RealtimeBetaServerEventResponseFunctionCallArgumentsDone: + type: object + description: > + Returned when the model-generated function call arguments are done + streaming. + + Also emitted when a Response is interrupted, incomplete, or cancelled. + 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`. + 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: | + { + "event_id": "event_5556", + "type": "response.function_call_arguments.done", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "name": "get_weather", + "arguments": "{\"location\": \"San Francisco\"}" + } + 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: | + { + "event_id": "event_6201", + "type": "response.mcp_call_arguments.delta", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "delta": "{\"partial\":true}" + } + 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: | + { + "event_id": "event_6202", + "type": "response.mcp_call_arguments.done", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "arguments": "{\"q\":\"docs\"}" + } + 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: | + { + "event_id": "event_6302", + "type": "response.mcp_call.completed", + "output_index": 0, + "item_id": "mcp_call_001" + } + 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: | + { + "event_id": "event_6303", + "type": "response.mcp_call.failed", + "output_index": 0, + "item_id": "mcp_call_001" + } + 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: | + { + "event_id": "event_6301", + "type": "response.mcp_call.in_progress", + "output_index": 0, + "item_id": "mcp_call_001" + } + 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: | + { + "event_id": "event_3334", + "type": "response.output_item.added", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "in_progress", + "role": "assistant", + "content": [] + } + } + RealtimeBetaServerEventResponseOutputItemDone: + type: object + description: > + Returned when an Item is done streaming. Also emitted when a Response + is + + interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_3536", + "type": "response.output_item.done", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, I can help with that." + } + ] + } + } + 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: | + { + "event_id": "event_4142", + "type": "response.output_text.delta", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "delta": "Sure, I can h" + } + RealtimeBetaServerEventResponseTextDone: + type: object + description: > + Returned when the text value of an "output_text" content part is done + streaming. Also + + emitted when a Response is interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_4344", + "type": "response.output_text.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "text": "Sure, I can help with that." + } + RealtimeBetaServerEventSessionCreated: + type: object + description: > + Returned when a Session is created. Emitted automatically when a new + + connection is established as the first server event. This event will + contain + + the default Session configuration. + 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: | + { + "type": "session.created", + "event_id": "event_C9G5RJeJ2gF77mV7f2B1j", + "session": { + "object": "realtime.session", + "id": "sess_C9G5QPteg4UIbotdKLoYQ", + "model": "gpt-realtime-2025-08-28", + "modalities": [ + "audio" + ], + "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.", + "tools": [], + "tool_choice": "auto", + "max_response_output_tokens": "inf", + "tracing": null, + "prompt": null, + "expires_at": 1756324625, + "input_audio_format": "pcm16", + "input_audio_transcription": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + }, + "output_audio_format": "pcm16", + "voice": "marin", + "include": null + } + } + RealtimeBetaServerEventSessionUpdated: + type: object + description: | + Returned when a session is updated with a `session.update` event, unless + there is an error. + 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: | + { + "event_id": "event_5678", + "type": "session.updated", + "session": { + "id": "sess_001", + "object": "realtime.session", + "model": "gpt-realtime", + "modalities": ["text"], + "instructions": "New instructions", + "voice": "sage", + "input_audio_format": "pcm16", + "output_audio_format": "pcm16", + "input_audio_transcription": { + "model": "whisper-1" + }, + "turn_detection": null, + "tools": [], + "tool_choice": "none", + "temperature": 0.7, + "max_response_output_tokens": 200, + "speed": 1.1, + "tracing": "auto" + } + } + RealtimeBetaServerEventTranscriptionSessionCreated: + type: object + description: | + Returned when a transcription session is created. + 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: | + { + "event_id": "event_5566", + "type": "transcription_session.created", + "session": { + "id": "sess_001", + "object": "realtime.transcription_session", + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500 + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [] + } + } + RealtimeBetaServerEventTranscriptionSessionUpdated: + type: object + description: > + Returned when a transcription session is updated with a + `transcription_session.update` event, unless + + there is an error. + 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: | + { + "event_id": "event_5678", + "type": "transcription_session.updated", + "session": { + "id": "sess_001", + "object": "realtime.transcription_session", + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + // "interrupt_response": false -- this will NOT be returned + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.avg_logprob", + ], + } + } + RealtimeCallCreateRequest: + title: Realtime call creation request + type: object + description: >- + Parameters required to initiate a realtime call and receive the SDP + answer + + needed to complete a WebRTC peer connection. Provide an SDP offer + generated + + by 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 + + created. Use the same parameters you would send in a [`create client + secret`](/docs/api-reference/realtime-sessions/create-realtime-client-secret) + + request. + additionalProperties: false + RealtimeCallReferRequest: + title: Realtime call refer request + type: object + description: >- + Parameters required to transfer a SIP call to a new destination using + the + + Realtime API. + required: + - target_uri + properties: + target_uri: + type: string + description: >- + URI that should appear in the SIP Refer-To header. Supports values + like + + `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) + + when omitted. + example: 486 + additionalProperties: false + RealtimeClientEvent: + discriminator: + propertyName: type + description: | + A realtime client event. + 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 + + calls, and function call responses. This event can be used both to + populate a + + "history" of the conversation and to add new items mid-stream, but has + the + + current limitation that it cannot populate assistant audio messages. + + + If successful, the server will respond with a + `conversation.item.created` + + event, otherwise an `error` event will be sent. + 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. + + + If set to `root`, the new item will be added to the beginning of the + conversation. + + + If 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. + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - type + - item + x-oaiMeta: + name: conversation.item.create + group: realtime + example: | + { + "type": "conversation.item.create", + "item": { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } + ] + } + } + RealtimeClientEventConversationItemDelete: + type: object + description: > + Send this event when you want to remove any item from the conversation + + history. The server will respond with a `conversation.item.deleted` + event, + + unless the item does not exist in the conversation history, in which + case the + + server will respond with an error. + 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: | + { + "event_id": "event_901", + "type": "conversation.item.delete", + "item_id": "item_003" + } + 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. + + The server will respond with a `conversation.item.retrieved` event, + + unless the item does not exist in the conversation history, in which + case the + + server will respond with an error. + 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: | + { + "event_id": "event_901", + "type": "conversation.item.retrieve", + "item_id": "item_003" + } + RealtimeClientEventConversationItemTruncate: + type: object + description: > + Send this event to truncate a previous assistant message’s audio. The + server + + will produce audio faster than realtime, so this event is useful when + the user + + interrupts to truncate audio that has already been sent to the client + but not + + yet played. This will synchronize the server's understanding of the + audio with + + the client's playback. + + + Truncating audio will delete the server-side text transcript to ensure + there + + is not text in the context that hasn't been heard by the user. + + + If successful, the server will respond with a + `conversation.item.truncated` + + event. + 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 + + items can be truncated. + 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 + + the audio_end_ms is greater than the actual audio duration, the + server + + will respond with an error. + required: + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncate + group: realtime + example: | + { + "event_id": "event_678", + "type": "conversation.item.truncate", + "item_id": "item_002", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeClientEventInputAudioBufferAppend: + type: object + description: > + Send this event to append audio bytes to the input audio buffer. The + audio + + buffer is temporary storage you can write to and later commit. A + "commit" will create a new + + user message item in the conversation history from the buffer content + and clear the buffer. + + Input audio transcription (if enabled) will be generated when the buffer + is committed. + + + If VAD is enabled the audio buffer is used to detect speech and the + server will decide + + when to commit. When Server VAD is disabled, you must commit the audio + buffer + + manually. Input audio noise reduction operates on writes to the audio + buffer. + + + The client may choose how much audio to place in each event up to a + maximum + + of 15 MiB, for example streaming smaller chunks from the client may + allow the + + VAD to be more responsive. Unlike most other client events, the server + will + + not send a confirmation response to this event. + 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 + + `input_audio_format` field in the session configuration. + required: + - type + - audio + x-oaiMeta: + name: input_audio_buffer.append + group: realtime + example: | + { + "event_id": "event_456", + "type": "input_audio_buffer.append", + "audio": "Base64EncodedAudioData" + } + RealtimeClientEventInputAudioBufferClear: + type: object + description: | + Send this event to clear the audio bytes in the buffer. The server will + respond with an `input_audio_buffer.cleared` event. + 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: | + { + "event_id": "event_012", + "type": "input_audio_buffer.clear" + } + 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. + + + Committing 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. + 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: | + { + "event_id": "event_789", + "type": "input_audio_buffer.commit" + } + RealtimeClientEventOutputAudioBufferClear: + type: object + description: > + **WebRTC/SIP Only:** Emit to cut off the current audio response. This + will trigger the server to + + stop generating audio and emit a `output_audio_buffer.cleared` event. + This + + event should be preceded by a `response.cancel` client event to stop the + + generation of the current response. + + [Learn + more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + 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: | + { + "event_id": "optional_client_event_id", + "type": "output_audio_buffer.clear" + } + RealtimeClientEventResponseCancel: + type: object + description: > + Send this event to cancel an in-progress response. The server will + respond + + with a `response.done` event with a status of + `response.status=cancelled`. If + + there is no response to cancel, the server will respond with an error. + It's safe + + to call `response.cancel` even if no response is in progress, an error + will be + + returned the session will remain unaffected. + 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 + in-progress response in the default conversation. + required: + - type + x-oaiMeta: + name: response.cancel + group: realtime + example: | + { + "type": "response.cancel", + "response_id": "resp_12345" + } + RealtimeClientEventResponseCreate: + type: object + description: > + This event instructs the server to create a Response, which means + triggering + + model inference. When in Server VAD mode, the server will create + Responses + + automatically. + + + A Response will include at least one Item, and may have two, in which + case + + the second will be a function call. These Items will be appended to the + + conversation history by default. + + + The server will respond with a `response.created` event, events for + Items + + and content created, and finally a `response.done` event to indicate + the + + Response is complete. + + + The `response.create` event includes inference configuration like + + `instructions` and `tools`. If these are set, they will override the + Session's + + configuration for this Response only. + + + Responses can be created out-of-band of the default Conversation, + meaning that they can + + have arbitrary input, and it's possible to disable writing the output to + the Conversation. + + Only one Response can write to the default Conversation at a time, but + otherwise multiple + + Responses can be created in parallel. The `metadata` field is a good way + to disambiguate + + multiple simultaneous Responses. + + + Clients can set `conversation` to `none` to create a Response that does + not write to the default + + Conversation. Arbitrary input can be provided with the `input` field, + which is an array accepting + + raw Items and references to existing Items. + 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 + + { + "type": "response.create", + } + + + // Trigger an out-of-band response that does not write to the default + Conversation + + { + "type": "response.create", + "response": { + "instructions": "Provide a concise answer.", + "tools": [], // clear any session tools + "conversation": "none", + "output_modalities": ["text"], + "metadata": { + "response_purpose": "summarization" + }, + "input": [ + { + "type": "item_reference", + "id": "item_12345" + }, + { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Summarize the above message in one sentence." + } + ] + } + ] + } + } + RealtimeClientEventSessionUpdate: + type: object + description: > + Send this event to update the session’s configuration. + + The client may send this event at any time to update any field + + except for `voice` and `model`. `voice` can be updated only if there + have been no other audio outputs yet. + + + When the server receives a `session.update`, it will respond + + with a `session.updated` event showing the full, effective + configuration. + + Only the fields that are present in the `session.update` are updated. To + clear a field like + + `instructions`, pass an empty string. To clear a field like `tools`, + pass an empty array. + + To clear a field like `turn_detection`, pass `null`. + 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 + session or a transcription session. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' + - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' + required: + - type + - session + x-oaiMeta: + name: session.update + group: realtime + example: | + { + "type": "session.update", + "session": { + "type": "realtime", + "instructions": "You are a creative assistant that helps with design tasks.", + "tools": [ + { + "type": "function", + "name": "display_color_palette", + "description": "Call this function when a user asks for a color palette.", + "parameters": { + "type": "object", + "properties": { + "theme": { + "type": "string", + "description": "Description of the theme for the color scheme." + }, + "colors": { + "type": "array", + "description": "Array of five hex color codes based on the theme.", + "items": { + "type": "string", + "description": "Hex color code" + } + } + }, + "required": [ + "theme", + "colors" + ] + } + } + ], + "tool_choice": "auto" + } + } + RealtimeClientEventTranscriptionSessionUpdate: + type: object + description: | + Send this event to update a transcription session. + 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: | + { + "type": "transcription_session.update", + "session": { + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.logprobs", + ] + } + } + 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`) + + this field allows the client to assign the unique ID of the item. It + is + + not required because the server will generate one if not provided. + + + For an item of type `item_reference`, this field is required and is + a + + reference to any item that has previously existed in the + conversation. + type: + type: string + enum: + - message + - function_call + - function_call_output + description: > + The type of the item (`message`, `function_call`, + `function_call_output`, `item_reference`). + object: + type: string + enum: + - realtime.item + description: > + Identifier for the API object being returned - always + `realtime.item`. + 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 + + on the conversation, but are accepted for consistency with the + + `conversation.item.created` event. + role: + type: string + enum: + - user + - assistant + - system + description: > + The role of the message sender (`user`, `assistant`, `system`), + only + + applicable for `message` items. + content: + type: array + description: > + The content of the message, applicable for `message` items. + + - Message items of role `system` support only `input_text` content + + - Message items of role `user` support `input_text` and + `input_audio` + content + - Message items of role `assistant` support `text` content. + 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`). + text: + type: string + description: > + The text content, used for `input_text` and `text` content + types. + id: + type: string + description: > + ID of a previous conversation item to reference (for + `item_reference` + + content types in `response.create` events). These can + reference both + + client and server created items. + audio: + type: string + description: > + Base64-encoded audio bytes, used for `input_audio` content + type. + transcript: + type: string + description: > + The transcript of the audio, used for `input_audio` content + type. + call_id: + type: string + description: > + The ID of the function call (for `function_call` and + + `function_call_output` items). If passed on a + `function_call_output` + + item, the server will check that a `function_call` item with the + same + + ID exists in the conversation history. + name: + type: string + description: | + The name of the function being called (for `function_call` items). + arguments: + type: string + description: | + The arguments of the function call (for `function_call` items). + output: + type: string + description: | + The output of the function call (for `function_call_output` items). + RealtimeCreateClientSecretRequest: + type: object + title: Realtime client secret creation request + description: > + Create a session and client secret for the Realtime API. The request can + specify + + either a realtime or a transcription session configuration. + + [Learn more about the Realtime API](/docs/guides/realtime). + properties: + expires_after: + type: object + title: Client secret expiration + description: > + Configuration for the client secret expiration. Expiration refers to + the time after which + + a client secret will no longer be valid for creating sessions. The + session itself may + + continue after that time once started. A secret can be used to + create multiple sessions + + until it expires. + 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. + 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. + minimum: 10 + maximum: 7200 + default: 600 + session: + title: Session configuration + description: > + Session configuration to use for the client secret. Choose either a + realtime + + session or a transcription session. + 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. + 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. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' + - $ref: >- + #/components/schemas/RealtimeTranscriptionSessionCreateResponseGA + discriminator: + propertyName: type + required: + - value + - expires_at + - session + x-oaiMeta: + name: Session response object + group: realtime + example: | + { + "value": "ek_68af296e8e408191a1120ab6383263c2", + "expires_at": 1756310470, + "session": { + "type": "realtime", + "object": "realtime.session", + "id": "sess_C9CiUVUzUzYIssh3ELY1d", + "model": "gpt-realtime-2025-08-25", + "output_modalities": [ + "audio" + ], + "instructions": "You are a friendly assistant.", + "tools": [], + "tool_choice": "auto", + "max_output_tokens": "inf", + "tracing": null, + "truncation": "auto", + "prompt": null, + "expires_at": 0, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy", + "speed": 1.0 + } + }, + "include": null + } + } + 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 + to call it, and guidance about what to tell the user when calling + (if anything). + 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. + 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. + 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. + 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. + 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 + RealtimeReasoning: + type: object + title: Realtime reasoning configuration + description: > + Configuration for reasoning-capable Realtime models such as + `gpt-realtime-2`. + properties: + effort: + $ref: '#/components/schemas/RealtimeReasoningEffort' + RealtimeReasoningEffort: + type: string + description: > + Constrains effort on reasoning for reasoning-capable Realtime models + such as + + `gpt-realtime-2`. + 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 + + `incomplete`, `in_progress`). + 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 + + with the `status` field (`completed`, `cancelled`, + `incomplete`, + + `failed`). + 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). + error: + type: object + description: | + A description of the error that caused the response to fail, + populated when the `status` is `failed`. + 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 + + session once the model has responded with audio at least + once. Current + + voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, + `sage`, + + `shimmer`, `verse`, `marin`, and `cedar`. We recommend + `marin` and `cedar` for + + best quality. + usage: + type: object + description: > + Usage statistics for the Response, this will correspond to billing. + A + + Realtime API session will maintain a conversation context and append + new + + Items to the Conversation, thus output from previous turns (text + and + + audio tokens) will become the input for later turns. + properties: + total_tokens: + type: integer + description: > + The total number of tokens in the Response including input and + output + + text and audio tokens. + input_tokens: + type: integer + description: > + The number of input tokens used in the Response, including text + and + + audio tokens. + output_tokens: + type: integer + description: > + The number of output tokens sent in the Response, including text + and + + audio tokens. + 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` + + field in the `response.create` event. If `auto`, the response will + be added to + + the default conversation and the value of `conversation_id` will be + an id like + + `conv_1234`. If `none`, the response will not be added to any + conversation and + + the value of `conversation_id` will be `null`. If responses are + being triggered + + automatically by VAD the response will be added to the default + conversation + type: string + output_modalities: + type: array + description: > + The set of modalities the model used to respond, currently the only + possible values are + + `[\"audio\"]`, `[\"text\"]`. Audio output always include a text + transcript. Setting the + + output to mode `text` will disable audio output from the model. + 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, + inclusive of tool calls, that was used in this response. + 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 + + `[\"audio\"]`, `[\"text\"]`. Audio output always include a text + transcript. Setting the + + output to mode `text` will disable audio output from the model. + 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. + + Note 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. + 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 + + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + `shimmer`, `verse`, + + `marin`, and `cedar`. You may also provide a custom voice + object with + + an `id`, for example `{ "id": "voice_1234" }`. Voice cannot + be changed + + during the session once the model has responded with audio + at least once. + + We recommend `marin` and `cedar` for best quality. + 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 + + function/MCP tool. + 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 + + reasoning Realtime models such as `gpt-realtime-2`. + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + conversation: + description: > + Controls which conversation the response is added to. Currently + supports + + `auto` and `none`, with `auto` as the default value. The `auto` + value + + means that the contents of the response will be added to the default + + conversation. Set this to `none` to create an out-of-band response + which + + will not add items to default conversation. + 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 + + creates a new context for this Response instead of using the default + + conversation. An empty array `[]` will clear the context for this + Response. + + Note that this can include references to items that previously + appeared in the session + + using their id. + items: + $ref: '#/components/schemas/RealtimeConversationItem' + RealtimeServerEvent: + discriminator: + propertyName: type + description: | + A realtime server event. + 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 + - $ref: >- + #/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionSegment + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsInProgress' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsCompleted' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsFailed' + - $ref: >- + #/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDelta + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallInProgress' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallCompleted' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallFailed' + RealtimeServerEventConversationCreated: + type: object + description: > + Returned when a conversation is created. Emitted right after session + creation. + 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. + object: + type: string + description: The object type, must be `realtime.conversation`. + required: + - event_id + - type + - conversation + x-oaiMeta: + name: conversation.created + group: realtime + example: | + { + "event_id": "event_9101", + "type": "conversation.created", + "conversation": { + "id": "conv_001", + "object": "realtime.conversation" + } + } + RealtimeServerEventConversationItemAdded: + type: object + description: > + Sent by the server when an Item is added to the default Conversation. + This can happen in several cases: + + - When the client sends a `conversation.item.create` event. + + - When the input audio buffer is committed. In this case the item will + be a user message containing the audio from the buffer. + + - 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`). + + + The 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. + 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: + - type: string + description: > + The ID of the item that precedes this one, if any. This is used + to + + maintain ordering when items are inserted. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.added + group: realtime + example: | + { + "type": "conversation.item.added", + "event_id": "event_C9G8pjSJCfRNEhMEnYAVy", + "previous_item_id": null, + "item": { + "id": "item_C9G8pGVKYnaZu8PH5YQ9O", + "type": "message", + "status": "completed", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } + ] + } + } + RealtimeServerEventConversationItemCreated: + type: object + description: > + Returned when a conversation item is created. There are several + scenarios that produce this event: + - The server is generating a Response, which if successful will produce + either one or two Items, which will be of type `message` + (role `assistant`) or type `function_call`. + - The input audio buffer has been committed, either by the client or the + server (in `server_vad` mode). The server will take the content of the + input audio buffer and add it to a new user message Item. + - The client has sent a `conversation.item.create` event to add a new Item + to the Conversation. + 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 + + client to understand the order of the conversation. Can be + `null` if the + + item has no predecessor. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.created + group: realtime + example: | + { + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [] + } + } + RealtimeServerEventConversationItemDeleted: + type: object + description: > + Returned when an item in the conversation is deleted by the client with + a + + `conversation.item.delete` event. This event is used to synchronize the + + server's understanding of the conversation history with the client's + view. + 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: | + { + "event_id": "event_2728", + "type": "conversation.item.deleted", + "item_id": "msg_005" + } + RealtimeServerEventConversationItemDone: + type: object + description: > + Returned when a conversation item is finalized. + + + The 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. + 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: + - type: string + description: > + The ID of the item that precedes this one, if any. This is used + to + + maintain ordering when items are inserted. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.done + group: realtime + example: | + { + "type": "conversation.item.done", + "event_id": "event_CCXLgMZPo3qioWCeQa4WH", + "previous_item_id": "item_CCXLecNJVIVR2HUy3ABLj", + "item": { + "id": "item_CCXLfxmM5sXVJVz4mCa2S", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_audio", + "transcript": "Oh, I can hear you loud and clear! Sounds like we're connected just fine. What can I help you with today?" + } + ] + } + } + RealtimeServerEventConversationItemInputAudioTranscriptionCompleted: + type: object + description: > + This event is the output of audio transcription for user audio written + to the + + user audio buffer. Transcription begins when the input audio buffer is + + committed by the client or server (when VAD is enabled). Transcription + runs + + asynchronously with Response creation, so this event may come before or + after + + the Response events. + + + Realtime API models accept audio natively, and thus input transcription + is a + + separate process run on a separate ASR (Automatic Speech Recognition) + model. + + The transcript may diverge somewhat from the model's interpretation, and + + should be treated as a rough guide. + 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 + `conversation.item.input_audio_transcription.completed`. + 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. + 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, this is billed according to + the ASR model's pricing rather than the realtime model's pricing. + 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: | + { + "type": "conversation.item.input_audio_transcription.completed", + "event_id": "event_CCXGRvtUVrax5SJAnNOWZ", + "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", + "content_index": 0, + "transcript": "Hey, can you hear me?", + "usage": { + "type": "tokens", + "total_tokens": 22, + "input_tokens": 13, + "input_token_details": { + "text_tokens": 0, + "audio_tokens": 13 + }, + "output_tokens": 9 + } + } + RealtimeServerEventConversationItemInputAudioTranscriptionDelta: + type: object + description: > + Returned when the text value of an input audio transcription content + part is updated with incremental transcription results. + 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: + - 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' + - type: 'null' + required: + - event_id + - type + - item_id + x-oaiMeta: + name: conversation.item.input_audio_transcription.delta + group: realtime + example: | + { + "type": "conversation.item.input_audio_transcription.delta", + "event_id": "event_CCXGRxsAimPAs8kS2Wc7Z", + "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", + "content_index": 0, + "delta": "Hey", + "obfuscation": "aLxx0jTEciOGe" + } + RealtimeServerEventConversationItemInputAudioTranscriptionFailed: + type: object + description: > + Returned when input audio transcription is configured, and a + transcription + + request for a user message failed. These events are separate from other + + `error` events so that the client can identify the related Item. + 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 + `conversation.item.input_audio_transcription.failed`. + 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: | + { + "event_id": "event_2324", + "type": "conversation.item.input_audio_transcription.failed", + "item_id": "msg_003", + "content_index": 0, + "error": { + "type": "transcription_error", + "code": "audio_unintelligible", + "message": "The audio could not be transcribed.", + "param": null + } + } + 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: | + { + "event_id": "event_6501", + "type": "conversation.item.input_audio_transcription.segment", + "item_id": "msg_011", + "content_index": 0, + "text": "hello", + "id": "seg_0001", + "speaker": "spk_1", + "start": 0.0, + "end": 0.4 + } + 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. + 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: | + { + "type": "conversation.item.retrieved", + "event_id": "event_CCXGSizgEppa2d4XbKA7K", + "item": { + "id": "item_CCXGRxbY0n6WE4EszhF5w", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "audio", + "transcript": "Yes, I can hear you loud and clear. How can I help you today?", + "audio": "8//2//v/9//q/+//+P/s...", + "format": "pcm16" + } + ] + } + } + RealtimeServerEventConversationItemTruncated: + type: object + description: > + Returned when an earlier assistant audio message item is truncated by + the + + client with a `conversation.item.truncate` event. This event is used to + + synchronize the server's understanding of the audio with the client's + playback. + + + This action will truncate the audio and remove the server-side text + transcript + + to ensure there is no text in the context that hasn't been heard by the + user. + 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. + required: + - event_id + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncated + group: realtime + example: | + { + "event_id": "event_2526", + "type": "conversation.item.truncated", + "item_id": "msg_004", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeServerEventError: + type: object + description: > + Returned when an error occurs, which could be a client problem or a + server + + problem. Most errors are recoverable and the session will stay open, we + + recommend to implementors to monitor and log error messages by default. + 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"). + 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. + - type: 'null' + required: + - event_id + - type + - error + x-oaiMeta: + name: error + group: realtime + example: | + { + "event_id": "event_890", + "type": "error", + "error": { + "type": "invalid_request_error", + "code": "invalid_event", + "message": "The 'type' field is missing.", + "param": null, + "event_id": "event_567" + } + } + RealtimeServerEventInputAudioBufferCleared: + type: object + description: | + Returned when the input audio buffer is cleared by the client with a + `input_audio_buffer.clear` event. + 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: | + { + "event_id": "event_1314", + "type": "input_audio_buffer.cleared" + } + RealtimeServerEventInputAudioBufferCommitted: + type: object + description: > + Returned when an input audio buffer is committed, either by the client + or + + automatically in server VAD mode. The `item_id` property is the ID of + the user + + message item that will be created, thus a `conversation.item.created` + event + + will also be sent to the client. + 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. + + Can be `null` if the item has no predecessor. + - 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: | + { + "event_id": "event_1121", + "type": "input_audio_buffer.committed", + "previous_item_id": "msg_001", + "item_id": "msg_002" + } + RealtimeServerEventInputAudioBufferDtmfEventReceived: + type: object + description: > + **SIP Only:** Returned when an DTMF event is received. A DTMF event is a + message that + + represents a telephone keypad press (0–9, *, #, A–D). The `event` + property + + is the keypad that the user press. The `received_at` is the UTC Unix + Timestamp + + that the server received the event. + 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 + 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. + required: + - type + - event + - received_at + x-oaiMeta: + name: input_audio_buffer.dtmf_event_received + group: realtime + example: | + { + "type":" input_audio_buffer.dtmf_event_received", + "event": "9", + "received_at": 1763605109, + } + RealtimeServerEventInputAudioBufferSpeechStarted: + type: object + description: > + Sent by the server when in `server_vad` mode to indicate that speech has + been + + detected in the audio buffer. This can happen any time audio is added to + the + + buffer (unless speech is already detected). The client may want to use + this + + event to interrupt audio playback or provide visual feedback to the + user. + + + The client should expect to receive a + `input_audio_buffer.speech_stopped` event + + when speech stops. The `item_id` property is the ID of the user message + item + + that will be created when speech stops and will also be included in the + + `input_audio_buffer.speech_stopped` event (unless the client manually + commits + + the audio buffer during VAD activation). + 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 + + session when speech was first detected. This will correspond to the + + beginning of audio sent to the model, and thus includes the + + `prefix_padding_ms` configured in the Session. + item_id: + type: string + description: > + The ID of the user message item that will be created when speech + stops. + required: + - event_id + - type + - audio_start_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.speech_started + group: realtime + example: | + { + "event_id": "event_1516", + "type": "input_audio_buffer.speech_started", + "audio_start_ms": 1000, + "item_id": "msg_003" + } + RealtimeServerEventInputAudioBufferSpeechStopped: + type: object + description: > + Returned in `server_vad` mode when the server detects the end of speech + in + + the audio buffer. The server will also send an + `conversation.item.created` + + event with the user message item that is created from the audio buffer. + 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 + + correspond to the end of audio sent to the model, and thus includes + the + + `min_silence_duration_ms` configured in the Session. + 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: | + { + "event_id": "event_1718", + "type": "input_audio_buffer.speech_stopped", + "audio_end_ms": 2000, + "item_id": "msg_003" + } + RealtimeServerEventInputAudioBufferTimeoutTriggered: + type: object + description: > + Returned when the Server VAD timeout is triggered for the input audio + buffer. This is configured + + with `idle_timeout_ms` in the `turn_detection` settings of the session, + and it indicates that + + there hasn't been any speech detected for the configured duration. + + + The `audio_start_ms` and `audio_end_ms` fields indicate the segment of + audio after the last + + model response up to the triggering time, as an offset from the + beginning of audio written + + to the input audio buffer. This means it demarcates the segment of audio + that was silent and + + the difference between the start and end values will roughly match the + configured timeout. + + + The empty audio will be committed to the conversation as an + `input_audio` item (there will be a + + `input_audio_buffer.committed` event) and a model response will be + generated. There may be speech + + that didn't trigger VAD but is still detected by the model, so the model + may respond with + + something relevant to the conversation or a prompt to continue speaking. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - input_audio_buffer.timeout_triggered + description: The event type, must be `input_audio_buffer.timeout_triggered`. + x-stainless-const: true + 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: + - event_id + - type + - audio_start_ms + - audio_end_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.timeout_triggered + group: realtime + example: | + { + "type":"input_audio_buffer.timeout_triggered", + "event_id":"event_CEKKrf1KTGvemCPyiJTJ2", + "audio_start_ms":13216, + "audio_end_ms":19232, + "item_id":"item_CEKKrWH0GiwN0ET97NUZc" + } + 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. + 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: | + { + "event_id": "event_6102", + "type": "mcp_list_tools.completed", + "item_id": "mcp_list_tools_001" + } + 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. + 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: | + { + "event_id": "event_6103", + "type": "mcp_list_tools.failed", + "item_id": "mcp_list_tools_001" + } + 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. + 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: | + { + "event_id": "event_6101", + "type": "mcp_list_tools.in_progress", + "item_id": "mcp_list_tools_001" + } + RealtimeServerEventOutputAudioBufferCleared: + type: object + description: > + **WebRTC/SIP Only:** Emitted when the output audio buffer is cleared. + This happens either in VAD + + mode when the user has interrupted + (`input_audio_buffer.speech_started`), + + or when the client has emitted the `output_audio_buffer.clear` event to + manually + + cut off the current audio response. + + [Learn + more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - output_audio_buffer.cleared + description: The event type, must be `output_audio_buffer.cleared`. + x-stainless-const: true + 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: | + { + "event_id": "event_abc123", + "type": "output_audio_buffer.cleared", + "response_id": "resp_abc123" + } + RealtimeServerEventOutputAudioBufferStarted: + type: object + description: > + **WebRTC/SIP Only:** Emitted when the server begins streaming audio to + the client. This event is + + emitted after an audio content part has been added + (`response.content_part.added`) + + to the response. + + [Learn + more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - output_audio_buffer.started + description: The event type, must be `output_audio_buffer.started`. + x-stainless-const: true + 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: | + { + "event_id": "event_abc123", + "type": "output_audio_buffer.started", + "response_id": "resp_abc123" + } + RealtimeServerEventOutputAudioBufferStopped: + type: object + description: > + **WebRTC/SIP Only:** Emitted when the output audio buffer has been + completely drained on the server, + + and no more audio is forthcoming. This event is emitted after the full + response + + data has been sent to the client (`response.done`). + + [Learn + more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - output_audio_buffer.stopped + description: The event type, must be `output_audio_buffer.stopped`. + x-stainless-const: true + 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: | + { + "event_id": "event_abc123", + "type": "output_audio_buffer.stopped", + "response_id": "resp_abc123" + } + RealtimeServerEventRateLimitsUpdated: + type: object + description: > + Emitted at the beginning of a Response to indicate the updated rate + limits. + + When a Response is created some tokens will be "reserved" for the + output + + tokens, the rate limits shown here reflect that reservation, which is + then + + adjusted accordingly once the Response is completed. + 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`). + 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: | + { + "event_id": "event_5758", + "type": "rate_limits.updated", + "rate_limits": [ + { + "name": "requests", + "limit": 1000, + "remaining": 999, + "reset_seconds": 60 + }, + { + "name": "tokens", + "limit": 50000, + "remaining": 49950, + "reset_seconds": 60 + } + ] + } + RealtimeServerEventResponseAudioDelta: + 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: | + { + "event_id": "event_4950", + "type": "response.output_audio.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Base64EncodedAudioDelta" + } + RealtimeServerEventResponseAudioDone: + type: object + description: > + Returned when the model-generated audio is done. Also emitted when a + Response + + is interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_5152", + "type": "response.output_audio.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0 + } + RealtimeServerEventResponseAudioTranscriptDelta: + type: object + description: > + Returned when the model-generated transcription of audio output is + updated. + 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: | + { + "event_id": "event_4546", + "type": "response.output_audio_transcript.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Hello, how can I a" + } + RealtimeServerEventResponseAudioTranscriptDone: + type: object + description: | + Returned when the model-generated transcription of audio output is done + streaming. Also emitted when a Response is interrupted, incomplete, or + cancelled. + 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: | + { + "event_id": "event_4748", + "type": "response.output_audio_transcript.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "transcript": "Hello, how can I assist you today?" + } + RealtimeServerEventResponseContentPartAdded: + type: object + description: > + Returned when a new content part is added to an assistant message item + during + + response generation. + 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: | + { + "event_id": "event_3738", + "type": "response.content_part.added", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "" + } + } + RealtimeServerEventResponseContentPartDone: + type: object + description: > + Returned when a content part is done streaming in an assistant message + item. + + Also emitted when a Response is interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_3940", + "type": "response.content_part.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "Sure, I can help with that." + } + } + RealtimeServerEventResponseCreated: + type: object + description: > + Returned when a new Response is created. The first event of response + creation, + + where the response is in an initial state of `in_progress`. + 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/RealtimeResponse' + required: + - event_id + - type + - response + x-oaiMeta: + name: response.created + group: realtime + example: | + { + "type": "response.created", + "event_id": "event_C9G8pqbTEddBSIxbBN6Os", + "response": { + "object": "realtime.response", + "id": "resp_C9G8p7IH2WxLbkgPNouYL", + "status": "in_progress", + "status_details": null, + "output": [], + "conversation_id": "conv_C9G8mmBkLhQJwCon3hoJN", + "output_modalities": [ + "audio" + ], + "max_output_tokens": "inf", + "audio": { + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin" + } + }, + "usage": null, + "metadata": null + }, + } + RealtimeServerEventResponseDone: + type: object + description: > + Returned when a Response is done streaming. Always emitted, no matter + the + + final state. The Response object included in the `response.done` event + will + + include all output Items in the Response but will omit the raw audio + data. + + + Clients should check the `status` field of the Response to determine if + it was successful + + (`completed`) or if there was another outcome: `cancelled`, `failed`, or + `incomplete`. + + + A response will contain all output items that were generated during the + response, excluding + + any audio content. + 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/RealtimeResponse' + required: + - event_id + - type + - response + x-oaiMeta: + name: response.done + group: realtime + example: | + { + "type": "response.done", + "event_id": "event_CCXHxcMy86rrKhBLDdqCh", + "response": { + "object": "realtime.response", + "id": "resp_CCXHw0UJld10EzIUXQCNh", + "status": "completed", + "status_details": null, + "output": [ + { + "id": "item_CCXHwGjjDUfOXbiySlK7i", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_audio", + "transcript": "Loud and clear! I can hear you perfectly. How can I help you today?" + } + ] + } + ], + "conversation_id": "conv_CCXHsurMKcaVxIZvaCI5m", + "output_modalities": [ + "audio" + ], + "max_output_tokens": "inf", + "audio": { + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy" + } + }, + "usage": { + "total_tokens": 253, + "input_tokens": 132, + "output_tokens": 121, + "input_token_details": { + "text_tokens": 119, + "audio_tokens": 13, + "image_tokens": 0, + "cached_tokens": 64, + "cached_tokens_details": { + "text_tokens": 64, + "audio_tokens": 0, + "image_tokens": 0 + } + }, + "output_token_details": { + "text_tokens": 30, + "audio_tokens": 91 + } + }, + "metadata": null + } + } + RealtimeServerEventResponseFunctionCallArgumentsDelta: + type: object + description: | + Returned when the model-generated function call arguments are updated. + 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`. + 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: | + { + "event_id": "event_5354", + "type": "response.function_call_arguments.delta", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "delta": "{\"location\": \"San\"" + } + RealtimeServerEventResponseFunctionCallArgumentsDone: + type: object + description: > + Returned when the model-generated function call arguments are done + streaming. + + Also emitted when a Response is interrupted, incomplete, or cancelled. + 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`. + 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: | + { + "event_id": "event_5556", + "type": "response.function_call_arguments.done", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "name": "get_weather", + "arguments": "{\"location\": \"San Francisco\"}" + } + RealtimeServerEventResponseMCPCallArgumentsDelta: + 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: | + { + "event_id": "event_6201", + "type": "response.mcp_call_arguments.delta", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "delta": "{\"partial\":true}" + } + RealtimeServerEventResponseMCPCallArgumentsDone: + 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: | + { + "event_id": "event_6202", + "type": "response.mcp_call_arguments.done", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "arguments": "{\"q\":\"docs\"}" + } + RealtimeServerEventResponseMCPCallCompleted: + 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: | + { + "event_id": "event_6302", + "type": "response.mcp_call.completed", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeServerEventResponseMCPCallFailed: + 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: | + { + "event_id": "event_6303", + "type": "response.mcp_call.failed", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeServerEventResponseMCPCallInProgress: + 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: | + { + "event_id": "event_6301", + "type": "response.mcp_call.in_progress", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeServerEventResponseOutputItemAdded: + 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: | + { + "event_id": "event_3334", + "type": "response.output_item.added", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "in_progress", + "role": "assistant", + "content": [] + } + } + RealtimeServerEventResponseOutputItemDone: + type: object + description: > + Returned when an Item is done streaming. Also emitted when a Response + is + + interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_3536", + "type": "response.output_item.done", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, I can help with that." + } + ] + } + } + RealtimeServerEventResponseTextDelta: + 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: | + { + "event_id": "event_4142", + "type": "response.output_text.delta", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "delta": "Sure, I can h" + } + RealtimeServerEventResponseTextDone: + type: object + description: > + Returned when the text value of an "output_text" content part is done + streaming. Also + + emitted when a Response is interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_4344", + "type": "response.output_text.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "text": "Sure, I can help with that." + } + RealtimeServerEventSessionCreated: + type: object + description: > + Returned when a Session is created. Emitted automatically when a new + + connection is established as the first server event. This event will + contain + + the default Session configuration. + 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: + description: The session configuration. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' + - $ref: >- + #/components/schemas/RealtimeTranscriptionSessionCreateResponseGA + required: + - event_id + - type + - session + x-oaiMeta: + name: session.created + group: realtime + example: | + { + "type": "session.created", + "event_id": "event_C9G5RJeJ2gF77mV7f2B1j", + "session": { + "type": "realtime", + "object": "realtime.session", + "id": "sess_C9G5QPteg4UIbotdKLoYQ", + "model": "gpt-realtime-2025-08-28", + "output_modalities": [ + "audio" + ], + "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.", + "tools": [], + "tool_choice": "auto", + "max_output_tokens": "inf", + "tracing": null, + "prompt": null, + "expires_at": 1756324625, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin", + "speed": 1 + } + }, + "include": null + }, + } + RealtimeServerEventSessionUpdated: + type: object + description: | + Returned when a session is updated with a `session.update` event, unless + there is an error. + 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: + description: The session configuration. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' + - $ref: >- + #/components/schemas/RealtimeTranscriptionSessionCreateResponseGA + required: + - event_id + - type + - session + x-oaiMeta: + name: session.updated + group: realtime + example: | + { + "type": "session.updated", + "event_id": "event_C9G8mqI3IucaojlVKE8Cs", + "session": { + "type": "realtime", + "object": "realtime.session", + "id": "sess_C9G8l3zp50uFv4qgxfJ8o", + "model": "gpt-realtime-2025-08-28", + "output_modalities": [ + "audio" + ], + "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.", + "tools": [ + { + "type": "function", + "name": "display_color_palette", + "description": "\nCall this function when a user asks for a color palette.\n", + "parameters": { + "type": "object", + "strict": true, + "properties": { + "theme": { + "type": "string", + "description": "Description of the theme for the color scheme." + }, + "colors": { + "type": "array", + "description": "Array of five hex color codes based on the theme.", + "items": { + "type": "string", + "description": "Hex color code" + } + } + }, + "required": [ + "theme", + "colors" + ] + } + } + ], + "tool_choice": "auto", + "max_output_tokens": "inf", + "tracing": null, + "prompt": null, + "expires_at": 1756324832, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin", + "speed": 1 + } + }, + "include": null + }, + } + RealtimeServerEventTranscriptionSessionUpdated: + type: object + description: > + Returned when a transcription session is updated with a + `transcription_session.update` event, unless + + there is an error. + 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: | + { + "event_id": "event_5678", + "type": "transcription_session.updated", + "session": { + "id": "sess_001", + "object": "realtime.transcription_session", + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + // "interrupt_response": false -- this will NOT be returned + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.avg_logprob", + ], + } + } + 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`. + 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, + set this to ["text"]. + items: + type: string + default: + - text + - audio + enum: + - text + - audio + model: + description: | + The Realtime model used for this session. + 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 + + 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. + + + + Note 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. + voice: + $ref: '#/components/schemas/VoiceIdsShared' + description: > + The voice the model uses to respond. Voice cannot be changed during + the + + session once the model has responded with audio at least once. + Current + + voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + + `shimmer`, and `verse`. + 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`. + + For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, + + single channel (mono), and little-endian byte order. + output_audio_format: + type: string + default: pcm16 + enum: + - pcm16 + - g711_ulaw + - g711_alaw + description: > + The format of output audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + + For `pcm16`, output audio is sampled at a rate of 24kHz. + 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://platform.openai.com/docs/api-reference/audio/createTranscription) + 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. + - type: 'null' + turn_detection: + $ref: '#/components/schemas/RealtimeTurnDetection' + input_audio_noise_reduction: + type: object + default: null + description: > + Configuration for input audio noise reduction. This can be set to + `null` to turn off. + + Noise reduction filters audio added to the input audio buffer before + it is sent to VAD and the model. + + Filtering the audio can improve VAD and turn detection accuracy + (reducing false positives) and model performance by improving + perception of the input audio. + 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 + + 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. + tracing: + anyOf: + - title: Tracing Configuration + description: > + Configuration options for tracing. Set to null to disable + tracing. Once + + tracing is enabled for a session, the configuration cannot be + modified. + + + `auto` will create a trace for the session with default values + for the + + workflow name, group id, and metadata. + oneOf: + - type: string + default: auto + description: | + Default tracing mode for the session. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: > + The name of the workflow to attach to this trace. This + is used to + + name the trace in the traces dashboard. + group_id: + type: string + description: > + The group id to attach to this trace to enable filtering + and + + grouping in the traces dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the traces dashboard. + - 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 + + specify a function. + 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. + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + 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 + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: > + Additional fields to include in server outputs. + + - `item.input_audio_transcription.logprobs`: Include logprobs + for input audio transcription. + - type: 'null' + RealtimeSessionCreateRequest: + type: object + description: | + A new Realtime session configuration, with an ephemeral key. Default TTL + for keys is one minute. + 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 + + to the Realtime API. Use this in client-side environments rather + than + + a standard API token, which should only be used server-side. + expires_at: + type: integer + format: unixtime + description: > + Timestamp for when the token expires. Currently, all tokens + expire + + after one minute. + required: + - value + - expires_at + modalities: + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + 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. + + Note 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. + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + description: > + The voice the model uses to respond. Supported built-in voices are + + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, + `verse`, + + `marin`, and `cedar`. You may also provide a custom voice object + with an + + `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed + during + + the session once the model has responded with audio at least once. + input_audio_format: + type: string + description: > + The format of input audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + output_audio_format: + type: string + description: > + The format of output audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + input_audio_transcription: + type: object + 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 and should be treated as rough guidance + + rather than the representation understood by the model. + properties: + model: + type: string + description: | + The model to use for transcription. + 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 + + 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. + tracing: + title: Tracing Configuration + description: > + Configuration options for tracing. Set to null to disable tracing. + Once + + tracing is enabled for a session, the configuration cannot be + modified. + + + `auto` will create a trace for the session with default values for + the + + workflow name, group id, and metadata. + oneOf: + - type: string + default: auto + description: | + Default tracing mode for the session. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: > + The name of the workflow to attach to this trace. This is + used to + + name the trace in the traces dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the traces dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the traces dashboard. + 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. + properties: + type: + type: string + description: > + Type of turn detection, only `server_vad` is currently + supported. + threshold: + type: number + description: > + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. + A + + higher threshold will require louder audio to activate the + model, and + + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: > + Duration of silence to detect speech stop (in milliseconds). + Defaults + + to 500ms. With shorter values the model will respond more + quickly, + + but may jump in on short pauses from the user. + 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 + + to call it, and guidance about what to tell the user when + calling + + (if anything). + 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 + + specify a function. + temperature: + type: number + description: > + Sampling temperature for the model, limited to [0.6, 1.2]. Defaults + to 0.8. + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + truncation: + $ref: '#/components/schemas/RealtimeTruncation' + prompt: + $ref: '#/components/schemas/Prompt' + required: + - client_secret + x-oaiMeta: + name: The session object + group: realtime + example: | + { + "id": "sess_001", + "object": "realtime.session", + "model": "gpt-realtime-2025-08-25", + "modalities": ["audio", "text"], + "instructions": "You are a friendly assistant.", + "voice": "alloy", + "input_audio_format": "pcm16", + "output_audio_format": "pcm16", + "input_audio_transcription": { + "model": "whisper-1" + }, + "turn_detection": null, + "tools": [], + "tool_choice": "none", + "temperature": 0.7, + "speed": 1.1, + "tracing": "auto", + "max_response_output_tokens": 200, + "truncation": "auto", + "prompt": null, + "client_secret": { + "value": "ek_abc123", + "expires_at": 1234567890 + } + } + RealtimeSessionCreateRequestGA: + type: object + title: Realtime session configuration + description: Realtime session object configuration. + properties: + type: + type: string + description: > + The type of session to create. Always `realtime` for the Realtime + API. + enum: + - realtime + x-stainless-const: true + output_modalities: + type: array + description: > + The set of modalities the model can respond with. It defaults to + `["audio"]`, indicating + + that the model will respond with audio plus a transcript. `["text"]` + can be used to make + + the model respond with text only. It is not possible to request both + `text` and `audio` at the same time. + default: + - audio + items: + type: string + enum: + - text + - audio + model: + anyOf: + - type: string + - type: string + enum: + - gpt-realtime + - gpt-realtime-1.5 + - gpt-realtime-2 + - 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 + description: | + The Realtime model used for this session. + 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. + + + Note 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. + audio: + type: object + description: | + Configuration for input and output audio. + 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](/docs/api-reference/audio/createTranscription) 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. + $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. + + Noise reduction filters audio added to the input audio + buffer before it is sent to VAD and the model. + + Filtering the audio can improve VAD and turn detection + accuracy (reducing false positives) and model performance by + improving perception of the input audio. + 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 + + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + `shimmer`, `verse`, + + `marin`, and `cedar`. You may also provide a custom voice + object with + + an `id`, for example `{ "id": "voice_1234" }`. Voice cannot + be changed + + during the session once the model has responded with audio + at least once. + + We recommend `marin` and `cedar` for best quality. + 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. + + 1.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. + + + This parameter is a post-processing adjustment to the audio + after it is generated, it's + + also possible to prompt the model to speak faster or slower. + include: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: > + Additional fields to include in server outputs. + + + `item.input_audio_transcription.logprobs`: Include logprobs for + input audio transcription. + 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 + + tracing is enabled for a session, the configuration cannot be + modified. + + + `auto` will create a trace for the session with default values for + the + + workflow name, group id, and metadata. + nullable: true + oneOf: + - type: string + title: auto + default: auto + description: > + Enables tracing and sets default values for tracing + configuration options. Always `auto`. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: > + The name of the workflow to attach to this trace. This is + used to + + name the trace in the Traces Dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the Traces Dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the Traces Dashboard. + 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 + + function/MCP tool. + 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 + + reasoning Realtime models such as `gpt-realtime-2`. + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + truncation: + $ref: '#/components/schemas/RealtimeTruncation' + prompt: + $ref: '#/components/schemas/Prompt' + required: + - type + RealtimeSessionCreateResponse: + type: object + title: Realtime session configuration object + description: | + A Realtime session configuration object. + properties: + id: + type: string + description: > + Unique identifier for the session that looks like + `sess_1234567890abcdef`. + 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. + + - `item.input_audio_transcription.logprobs`: Include logprobs for + input audio transcription. + 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, + set this to ["text"]. + 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. + + + Note 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. + audio: + type: object + description: | + Configuration for input and output audio for the session. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + transcription: + description: | + Configuration for input audio transcription. + $ref: '#/components/schemas/AudioTranscriptionResponse' + noise_reduction: + type: object + description: | + Configuration for input audio noise reduction. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + turn_detection: + type: object + description: | + Configuration for turn detection. + properties: + type: + type: string + description: > + Type of turn detection, only `server_vad` is currently + supported. + 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 + tracing: + title: Tracing Configuration + description: > + Configuration options for tracing. Set to null to disable tracing. + Once + + tracing is enabled for a session, the configuration cannot be + modified. + + + `auto` will create a trace for the session with default values for + the + + workflow name, group id, and metadata. + oneOf: + - type: string + default: auto + description: | + Default tracing mode for the session. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: > + The name of the workflow to attach to this trace. This is + used to + + name the trace in the traces dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the traces dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the traces dashboard. + 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. + properties: + type: + type: string + description: > + Type of turn detection, only `server_vad` is currently + supported. + threshold: + type: number + description: > + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. + A + + higher threshold will require louder audio to activate the + model, and + + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: > + Duration of silence to detect speech stop (in milliseconds). + Defaults + + to 500ms. With shorter values the model will respond more + quickly, + + but may jump in on short pauses from the user. + tools: + type: array + description: Tools (functions) available to the model. + items: + $ref: '#/components/schemas/RealtimeFunctionTool' + tool_choice: + type: string + description: > + How the model chooses tools. Options are `auto`, `none`, `required`, + or + + specify a function. + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + x-oaiMeta: + name: The session object + group: realtime + example: | + { + "id": "sess_001", + "object": "realtime.session", + "expires_at": 1742188264, + "model": "gpt-realtime", + "output_modalities": ["audio"], + "instructions": "You are a friendly assistant.", + "tools": [], + "tool_choice": "none", + "max_output_tokens": "inf", + "tracing": "auto", + "truncation": "auto", + "prompt": null, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": { "model": "whisper-1" }, + "noise_reduction": null, + "turn_detection": null + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy", + "speed": 1.0 + } + } + } + RealtimeSessionCreateResponseGA: + type: object + title: Realtime session configuration object + description: | + A Realtime session configuration object. + properties: + type: + type: string + description: > + The type of session to create. Always `realtime` for the Realtime + API. + enum: + - realtime + x-stainless-const: true + id: + type: string + description: > + Unique identifier for the session that looks like + `sess_1234567890abcdef`. + object: + type: string + description: The object type. Always `realtime.session`. + enum: + - realtime.session + x-stainless-const: true + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + output_modalities: + type: array + description: > + The set of modalities the model can respond with. It defaults to + `["audio"]`, indicating + + that the model will respond with audio plus a transcript. `["text"]` + can be used to make + + the model respond with text only. It is not possible to request both + `text` and `audio` at the same time. + default: + - audio + items: + type: string + enum: + - text + - audio + model: + anyOf: + - type: string + - type: string + enum: + - gpt-realtime + - gpt-realtime-1.5 + - gpt-realtime-2 + - 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 + description: | + The Realtime model used for this session. + 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. + + + Note 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. + audio: + type: object + description: | + Configuration for input and output audio. + 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](/docs/api-reference/audio/createTranscription) 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. + $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. + + Noise reduction filters audio added to the input audio + buffer before it is sent to VAD and the model. + + Filtering the audio can improve VAD and turn detection + accuracy (reducing false positives) and model performance by + improving perception of the input audio. + 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/VoiceIdsShared' + default: alloy + description: > + The voice the model uses to respond. Voice cannot be changed + during the + + session once the model has responded with audio at least + once. Current + + voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, + `sage`, + + `shimmer`, `verse`, `marin`, and `cedar`. We recommend + `marin` and `cedar` for + + best quality. + 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. + + 1.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. + + + This parameter is a post-processing adjustment to the audio + after it is generated, it's + + also possible to prompt the model to speak faster or slower. + include: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: > + Additional fields to include in server outputs. + + + `item.input_audio_transcription.logprobs`: Include logprobs for + input audio transcription. + 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 + + tracing is enabled for a session, the configuration cannot be + modified. + + + `auto` will create a trace for the session with default values + for the + + workflow name, group id, and metadata. + oneOf: + - type: string + title: auto + default: auto + description: > + Enables tracing and sets default values for tracing + configuration options. Always `auto`. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: > + The name of the workflow to attach to this trace. This + is used to + + name the trace in the Traces Dashboard. + group_id: + type: string + description: > + The group id to attach to this trace to enable filtering + and + + grouping in the Traces Dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the Traces Dashboard. + - 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 + + function/MCP tool. + oneOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + default: auto + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + truncation: + $ref: '#/components/schemas/RealtimeTruncation' + 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. + properties: + type: + type: string + description: > + Type of turn detection. Only `server_vad` is currently supported + for transcription sessions. + enum: + - server_vad + threshold: + type: number + description: > + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. + A + + higher threshold will require louder audio to activate the + model, and + + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: > + Duration of silence to detect speech stop (in milliseconds). + Defaults + + to 500ms. With shorter values the model will respond more + quickly, + + but may jump in on short pauses from the user. + input_audio_noise_reduction: + type: object + default: null + description: > + Configuration for input audio noise reduction. This can be set to + `null` to turn off. + + Noise reduction filters audio added to the input audio buffer before + it is sent to VAD and the model. + + Filtering the audio can improve VAD and turn detection accuracy + (reducing false positives) and model performance by improving + perception of the input audio. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + 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`. + + For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, + + single channel (mono), and little-endian byte order. + 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. + $ref: '#/components/schemas/AudioTranscription' + 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: + + `item.input_audio_transcription.logprobs` + RealtimeTranscriptionSessionCreateRequestGA: + type: object + title: Realtime transcription session configuration + description: Realtime transcription session object configuration. + properties: + type: + type: string + description: > + The type of session to create. Always `transcription` for + transcription sessions. + enum: + - transcription + x-stainless-const: true + audio: + type: object + description: | + Configuration for input and output audio. + 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](/docs/api-reference/audio/createTranscription) 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. + $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. + + Noise reduction filters audio added to the input audio + buffer before it is sent to VAD and the model. + + Filtering the audio can improve VAD and turn detection + accuracy (reducing false positives) and model performance by + improving perception of the input audio. + 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. + + + `item.input_audio_transcription.logprobs`: Include logprobs for + input audio transcription. + required: + - type + RealtimeTranscriptionSessionCreateResponse: + type: object + description: | + A new Realtime transcription session configuration. + + When a session is created on the server via REST API, the session object + also contains an ephemeral key. Default TTL for keys is 10 minutes. This + property is not present when a session is updated via the WebSocket API. + properties: + client_secret: + type: object + description: | + Ephemeral key returned by the API. Only present when the session is + created on the server via REST API. + properties: + value: + type: string + description: > + Ephemeral key usable in client environments to authenticate + connections + + to the Realtime API. Use this in client-side environments rather + than + + a standard API token, which should only be used server-side. + expires_at: + type: integer + format: unixtime + description: > + Timestamp for when the token expires. Currently, all tokens + expire + + after one minute. + required: + - value + - expires_at + modalities: + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + items: + type: string + enum: + - text + - audio + input_audio_format: + type: string + description: > + The format of input audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + input_audio_transcription: + description: | + Configuration of the transcription model. + $ref: '#/components/schemas/AudioTranscriptionResponse' + 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. + properties: + type: + type: string + description: > + Type of turn detection, only `server_vad` is currently + supported. + threshold: + type: number + description: > + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. + A + + higher threshold will require louder audio to activate the + model, and + + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: > + Duration of silence to detect speech stop (in milliseconds). + Defaults + + to 500ms. With shorter values the model will respond more + quickly, + + but may jump in on short pauses from the user. + required: + - client_secret + x-oaiMeta: + name: The transcription session object + group: realtime + example: | + { + "id": "sess_BBwZc7cFV3XizEyKGDCGL", + "object": "realtime.transcription_session", + "expires_at": 1742188264, + "modalities": ["audio", "text"], + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200 + }, + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "language": null, + "prompt": "" + }, + "client_secret": null + } + RealtimeTranscriptionSessionCreateResponseGA: + type: object + title: Realtime transcription session configuration object + description: | + A Realtime transcription session configuration object. + properties: + type: + type: string + description: > + The type of session. Always `transcription` for transcription + sessions. + enum: + - transcription + x-stainless-const: true + id: + type: string + description: > + Unique identifier for the session that looks like + `sess_1234567890abcdef`. + 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: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: > + Additional fields to include in server outputs. + + - `item.input_audio_transcription.logprobs`: Include logprobs for + input audio transcription. + audio: + type: object + description: | + Configuration for input audio for the session. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + transcription: + description: | + Configuration of the transcription model. + $ref: '#/components/schemas/AudioTranscriptionResponse' + noise_reduction: + type: object + description: | + Configuration for input audio noise reduction. + 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. + anyOf: + - 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. For + `gpt-realtime-whisper`, this must be `null`; VAD is not + supported. + properties: + type: + type: string + description: > + Type of turn detection, only `server_vad` is + currently supported. + threshold: + type: number + description: > + Activation threshold for VAD (0.0 to 1.0), this + defaults to 0.5. A + + higher threshold will require louder audio to + activate the model, and + + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: > + Amount of audio to include before the VAD detected + speech (in + + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: > + Duration of silence to detect speech stop (in + milliseconds). Defaults + + to 500ms. With shorter values the model will respond + more quickly, + + but may jump in on short pauses from the user. + - type: 'null' + required: + - type + - id + - object + x-oaiMeta: + name: The transcription session object + group: realtime + example: | + { + "id": "sess_BBwZc7cFV3XizEyKGDCGL", + "type": "transcription", + "object": "realtime.transcription_session", + "expires_at": 1742188264, + "include": ["item.input_audio_transcription.logprobs"], + "audio": { + "input": { + "format": "pcm16", + "transcription": { + "model": "gpt-4o-transcribe", + "language": null, + "prompt": "" + }, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200 + } + } + } + } + RealtimeTranslationClientEvent: + discriminator: + propertyName: type + description: | + A Realtime translation client event. + anyOf: + - $ref: '#/components/schemas/RealtimeTranslationClientEventSessionUpdate' + - $ref: >- + #/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend + - $ref: '#/components/schemas/RealtimeTranslationClientEventSessionClose' + RealtimeTranslationClientEventInputAudioBufferAppend: + type: object + description: > + Send this event to append audio bytes to the translation session input + audio buffer. + + + WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono + + little-endian raw audio bytes. Unsupported websocket audio formats + return a + + validation error because lower-quality audio materially degrades + translation + + quality. + + + Translation consumes 200 ms engine frames. For best realtime behavior, + append + + audio in 200 ms chunks. If a chunk is shorter, the server buffers it + until it + + has enough audio for one frame. If a chunk is longer, the server splits + it into + + 200 ms frames and enqueues them back-to-back. + + + Keep appending silence while the session is active. If a client stops + sending + + audio and later resumes, model time treats the resumed audio as + contiguous with + + the previous audio rather than as a real-world pause. + 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 + audio: + type: string + description: Base64-encoded 24 kHz PCM16 mono audio bytes. + required: + - type + - audio + x-oaiMeta: + name: session.input_audio_buffer.append + group: realtime + example: | + { + "event_id": "event_456", + "type": "session.input_audio_buffer.append", + "audio": "Base64EncodedAudioData" + } + RealtimeTranslationClientEventSessionClose: + type: object + description: > + Gracefully close the realtime translation session. The server flushes + pending + + input audio and emits any remaining translated output before closing the + + session. + properties: + event_id: + type: string + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: + type: string + enum: + - session.close + description: The event type, must be `session.close`. + x-stainless-const: true + required: + - type + x-oaiMeta: + name: session.close + group: realtime + example: | + { + "event_id": "event_789", + "type": "session.close" + } + RealtimeTranslationClientEventSessionUpdate: + type: object + description: > + Send this event to update the translation session configuration. + Translation + + sessions support updates to `audio.output.language`, + `audio.input.transcription`, + + and `audio.input.noise_reduction`. + properties: + event_id: + type: string + maxLength: 512 + 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/RealtimeTranslationSessionUpdateRequest' + description: > + Translation session fields to update. The session `type` and `model` + are set + + at creation and cannot be changed with `session.update`. + required: + - type + - session + x-oaiMeta: + name: session.update + group: realtime + example: | + { + "type": "session.update", + "session": { + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper" + }, + "noise_reduction": null + }, + "output": { + "language": "es" + } + } + } + } + RealtimeTranslationClientSecretCreateRequest: + type: object + title: Realtime translation client secret creation request + description: | + Create a translation session and client secret for the Realtime API. + properties: + expires_after: + type: object + title: Client secret expiration + description: > + Configuration for the client secret expiration. Expiration refers to + the time after which + + a client secret will no longer be valid for creating sessions. The + session itself may + + continue after that time once started. A secret can be used to + create multiple sessions + + until it expires. + 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. + 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. + minimum: 10 + maximum: 7200 + default: 600 + session: + $ref: '#/components/schemas/RealtimeTranslationSessionCreateRequest' + required: + - session + RealtimeTranslationClientSecretCreateResponse: + type: object + title: Realtime translation session and client secret + description: > + Response from creating a translation session and client secret for the + Realtime API. + 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' + required: + - value + - expires_at + - session + x-oaiMeta: + name: Translation session response object + group: realtime + example: | + { + "value": "ek_68af296e8e408191a1120ab6383263c2", + "expires_at": 1756310470, + "session": { + "id": "sess_C9CiUVUzUzYIssh3ELY1d", + "type": "translation", + "expires_at": 1756310470, + "model": "gpt-realtime-translate", + "audio": { + "input": { + "transcription": null, + "noise_reduction": null + }, + "output": { + "language": "es" + } + } + } + } + RealtimeTranslationServerEvent: + discriminator: + propertyName: type + description: | + A Realtime translation server event. + anyOf: + - $ref: '#/components/schemas/RealtimeServerEventError' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionCreated' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionUpdated' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionClosed' + - $ref: >- + #/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta + - $ref: >- + #/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta + - $ref: >- + #/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta + RealtimeTranslationServerEventSessionClosed: + type: object + description: | + Returned when a realtime translation session is closed. + properties: + event_id: + type: string + description: The unique ID of the server event. + 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: | + { + "event_id": "event_987", + "type": "session.closed" + } + RealtimeTranslationServerEventSessionCreated: + type: object + description: > + Returned when a translation session is created. Emitted automatically + when a + + new connection is established as the first server event. This event + contains + + the default translation session configuration. + 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/RealtimeTranslationSession' + description: The translation session configuration. + required: + - event_id + - type + - session + x-oaiMeta: + name: session.created + group: realtime + example: | + { + "type": "session.created", + "event_id": "event_123", + "session": { + "id": "sess_123", + "type": "translation", + "model": "gpt-realtime-translate", + "expires_at": 1714857600, + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper", + "language": "en" + }, + "noise_reduction": { + "type": "near_field" + } + }, + "output": { + "language": "fr" + } + } + } + } + RealtimeTranslationServerEventSessionInputTranscriptDelta: + type: object + description: > + Returned when optional source-language transcript text is available. + This event + + is emitted only when `audio.input.transcription` is configured. + + + Transcript deltas are append-only text fragments. Clients should not + insert + + unconditional spaces between deltas. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - session.input_transcript.delta + description: The event type, must be `session.input_transcript.delta`. + x-stainless-const: true + delta: + type: string + description: Append-only source-language transcript text. + elapsed_ms: + anyOf: + - type: integer + description: > + Timing metadata for stream alignment, derived from the + translation frame + + when available. It advances in 200 ms increments, but multiple + transcript + + deltas may share the same `elapsed_ms`. Treat it as alignment + metadata, + + not a unique transcript-delta identifier. + - type: 'null' + required: + - event_id + - type + - delta + x-oaiMeta: + name: session.input_transcript.delta + group: realtime + example: | + { + "event_id": "event_125", + "type": "session.input_transcript.delta", + "delta": " hear", + "elapsed_ms": 1200 + } + RealtimeTranslationServerEventSessionOutputAudioDelta: + type: object + description: > + Returned when translated output audio is available. Output audio deltas + are + + 200 ms frames of PCM16 audio. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - session.output_audio.delta + description: The event type, must be `session.output_audio.delta`. + 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: + type: string + enum: + - pcm16 + description: Audio encoding for `delta`. + x-stainless-const: true + elapsed_ms: + anyOf: + - type: integer + description: > + Timing metadata for stream alignment, derived from the + translation frame + + when available. Treat `elapsed_ms` as alignment metadata, not a + unique + + event identifier. + - type: 'null' + required: + - event_id + - type + - delta + x-oaiMeta: + name: session.output_audio.delta + group: realtime + example: | + { + "event_id": "event_123", + "type": "session.output_audio.delta", + "delta": "Base64EncodedAudioDelta", + "sample_rate": 24000, + "channels": 1, + "format": "pcm16", + "elapsed_ms": 1200 + } + RealtimeTranslationServerEventSessionOutputTranscriptDelta: + type: object + description: > + Returned when translated transcript text is available. + + + Transcript deltas are append-only text fragments. Clients should not + insert + + unconditional spaces between deltas. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - session.output_transcript.delta + description: The event type, must be `session.output_transcript.delta`. + x-stainless-const: true + delta: + 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 + + when available. It advances in 200 ms increments, but multiple + transcript + + deltas may share the same `elapsed_ms`. Treat it as alignment + metadata, + + not a unique transcript-delta identifier. + - type: 'null' + required: + - event_id + - type + - delta + x-oaiMeta: + name: session.output_transcript.delta + group: realtime + example: | + { + "event_id": "event_124", + "type": "session.output_transcript.delta", + "delta": " escuch", + "elapsed_ms": 1200 + } + RealtimeTranslationServerEventSessionUpdated: + type: object + description: > + Returned when a translation session is updated with a `session.update` + event, + + unless there is an error. + 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/RealtimeTranslationSession' + description: The translation session configuration. + required: + - event_id + - type + - session + x-oaiMeta: + name: session.updated + group: realtime + example: | + { + "type": "session.updated", + "event_id": "event_124", + "session": { + "id": "sess_123", + "type": "translation", + "model": "gpt-realtime-translate", + "expires_at": 1714857600, + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper", + "language": "en" + }, + "noise_reduction": { + "type": "near_field" + } + }, + "output": { + "language": "es" + } + } + } + } + RealtimeTranslationSession: + type: object + title: Realtime translation session + description: > + A Realtime translation session. Translation sessions continuously + translate input + + audio into the configured output language. + properties: + id: + type: string + description: > + Unique identifier for the session that looks like + `sess_1234567890abcdef`. + type: + type: string + enum: + - translation + description: > + The session type. Always `translation` for Realtime translation + sessions. + x-stainless-const: true + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + model: + type: string + description: > + The Realtime translation model used for this session. This field is + set at + + session creation and cannot be changed with `session.update`. + audio: + type: object + description: | + Configuration for translation input and output audio. + properties: + input: + type: object + properties: + transcription: + anyOf: + - type: object + description: > + Optional source-language transcription. When configured, + the server emits + + `session.input_transcript.delta` events. Translation + itself still runs from + + the input audio stream. + 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. + 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. + required: + - id + - type + - expires_at + - model + - audio + x-oaiMeta: + name: The translation session object + group: realtime + example: | + { + "id": "sess_C9G5QPteg4UIbotdKLoYQ", + "type": "translation", + "expires_at": 1756324625, + "model": "gpt-realtime-translate", + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper" + }, + "noise_reduction": null + }, + "output": { + "language": "es" + } + } + } + RealtimeTranslationSessionCreateRequest: + type: object + title: Realtime translation session configuration + description: > + Realtime translation session configuration. Translation sessions stream + source + + audio in and translated audio plus transcript deltas out continuously. + properties: + model: + type: string + description: | + The Realtime translation model used for this session. + audio: + type: object + description: | + Configuration for translation input and output audio. + properties: + input: + type: object + properties: + transcription: + anyOf: + - type: object + description: > + Optional source-language transcription. When configured, + the server emits + + `session.input_transcript.delta` events. Translation + itself still runs from + + the input audio stream. + 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. + 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. + required: + - model + RealtimeTranslationSessionUpdateRequest: + type: object + title: Realtime translation session update + description: > + Realtime translation session fields that can be updated with + `session.update`. + properties: + audio: + type: object + description: | + Configuration for translation input and output audio. + properties: + input: + type: object + properties: + transcription: + anyOf: + - type: object + description: > + Optional source-language transcription. When configured, + the server emits + + `session.input_transcript.delta` events. Translation + itself still runs from + + the input audio stream. + 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. + 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. + 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. + + + Clients can configure truncation behavior to truncate with a lower max + token limit, which is an effective way to control token usage and cost. + + + Truncation 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. + + + Truncation 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. + 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: + - 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. + 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 + 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. + + + 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. + + + Semantic 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. + + + For `gpt-realtime-whisper` transcription sessions, turn detection + must be + + set to `null`; VAD is not supported. + 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. + 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 + + higher threshold will require louder audio to activate the + model, and + + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: > + Used only for `server_vad` mode. Amount of audio to include + before the VAD detected speech (in + + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: > + Used only for `server_vad` mode. Duration of silence to + detect speech stop (in milliseconds). Defaults + + to 500ms. With shorter values the model will respond more + quickly, + + but may jump in on short pauses from the user. + 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. + + + If both `create_response` and `interrupt_response` are set + to `false`, the model will never respond automatically but + VAD events will still be emitted. + interrupt_response: + type: boolean + default: true + description: > + Whether or not to automatically interrupt (cancel) any + ongoing response with output to the default + + conversation (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. + + + If both `create_response` and `interrupt_response` are set + to `false`, the model will never respond automatically but + VAD events will still be emitted. + idle_timeout_ms: + anyOf: + - type: integer + minimum: 5000 + maximum: 30000 + description: > + Optional timeout after which a model response will be + triggered automatically. This is + + useful for situations in which a long pause from the + user is unexpected, such as a phone + + call. The model will effectively prompt the user to + continue the conversation based + + on the current context. + + + The timeout value will be applied after the last model + response's audio has finished playing, + + i.e. it's set to the `response.done` time plus audio + playback duration. + + + An `input_audio_buffer.timeout_triggered` event (plus + events + + associated with the Response) will be emitted when the + timeout is reached. + + Idle timeout is currently only supported for + `server_vad` mode. + - 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. + 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. + create_response: + type: boolean + default: true + description: > + Whether or not to automatically generate a response when a + VAD stop event occurs. + interrupt_response: + type: boolean + default: true + description: > + Whether or not to automatically interrupt any ongoing + response with output to the default + + conversation (i.e. `conversation` of `auto`) when a VAD + start event occurs. + discriminator: + propertyName: type + - type: 'null' + Reasoning: + type: object + description: | + **gpt-5 and o-series models only** + + Configuration options for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + title: Reasoning + properties: + effort: + $ref: '#/components/schemas/ReasoningEffort' + summary: + anyOf: + - type: string + description: > + A summary of the reasoning performed by the model. This can be + + useful for debugging and understanding the model's reasoning + process. + + One of `auto`, `concise`, or `detailed`. + + + `concise` is supported for `computer-use-preview` models and all + reasoning models after `gpt-5`. + enum: + - auto + - concise + - detailed + - type: 'null' + generate_summary: + anyOf: + - type: string + deprecated: true + description: > + **Deprecated:** use `summary` instead. + + + A summary of the reasoning performed by the model. This can be + + useful for debugging and understanding the model's reasoning + process. + + One of `auto`, `concise`, or `detailed`. + enum: + - auto + - concise + - detailed + - type: 'null' + ReasoningEffort: + anyOf: + - type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + default: medium + description: > + Constrains effort on reasoning for + + [reasoning + models](https://platform.openai.com/docs/guides/reasoning). + + Currently supported values are `none`, `minimal`, `low`, `medium`, + `high`, and `xhigh`. Reducing + + reasoning effort can result in faster responses and fewer tokens + used + + on reasoning in a response. + + + - `gpt-5.1` defaults to `none`, which does not perform reasoning. + The supported reasoning values for `gpt-5.1` are `none`, `low`, + `medium`, and `high`. Tool calls are supported for all reasoning + values in gpt-5.1. + + - All models before `gpt-5.1` default to `medium` reasoning effort, + and do not support `none`. + + - The `gpt-5-pro` model defaults to (and only supports) `high` + reasoning effort. + + - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + - type: 'null' + ReasoningItem: + type: object + description: > + A description of the chain of thought used by a reasoning model while + generating + + a response. Be sure to include these items in your `input` to the + Responses API + + for subsequent turns of a conversation if you are manually + + [managing context](/docs/guides/conversation-state). + title: Reasoning + properties: + type: + type: string + description: | + The type of the object. Always `reasoning`. + enum: + - reasoning + x-stainless-const: true + id: + type: string + description: | + The unique identifier of the reasoning content. + encrypted_content: + anyOf: + - type: string + description: > + The encrypted content of the reasoning item - populated when a + response is + + generated with `reasoning.encrypted_content` in the `include` + parameter. + - type: 'null' + summary: + type: array + description: | + Reasoning summary content. + items: + $ref: '#/components/schemas/SummaryTextContent' + content: + type: array + description: | + Reasoning text content. + items: + $ref: '#/components/schemas/ReasoningTextContent' + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - id + - summary + - type + Response: + title: The response object + allOf: + - $ref: '#/components/schemas/ModelResponseProperties' + - $ref: '#/components/schemas/ResponseProperties' + - type: object + properties: + id: + type: string + description: | + Unique identifier for this Response. + object: + type: string + description: | + The object type of this resource - always set to `response`. + enum: + - response + x-stainless-const: true + status: + type: string + description: > + The status of the response generation. One of `completed`, + `failed`, + + `in_progress`, `cancelled`, `queued`, or `incomplete`. + 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. + completed_at: + anyOf: + - type: number + format: unixtime + description: > + Unix timestamp (in seconds) of when this Response was + completed. + + Only present when the status is `completed`. + - type: 'null' + error: + $ref: '#/components/schemas/ResponseError' + incomplete_details: + anyOf: + - type: object + description: | + Details about why the response is incomplete. + properties: + reason: + type: string + description: The reason why the response is incomplete. + enum: + - max_output_tokens + - content_filter + - type: 'null' + output: + type: array + description: > + An array of content items generated by the model. + + + - The length and order of items in the `output` array is + dependent + on the model's response. + - Rather than accessing the first item in the `output` array and + assuming it's an `assistant` message with the content generated by + the model, you might consider using the `output_text` property where + supported in SDKs. + items: + $ref: '#/components/schemas/OutputItem' + instructions: + anyOf: + - description: > + A system (or developer) message inserted into the model's + context. + + + When using 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. + oneOf: + - type: string + description: > + A text input to the model, equivalent to a text input + with the + + `developer` role. + - type: array + title: Input item list + description: > + A list of one or many input items to the model, + containing + + different content types. + items: + $ref: '#/components/schemas/InputItem' + - type: 'null' + output_text: + anyOf: + - type: string + description: > + SDK-only convenience property that contains the aggregated + text output + + from all `output_text` items in the `output` array, if any + are present. + + Supported in the Python and JavaScript SDKs. + x-oaiSupportedSDKs: + - python + - javascript + - type: 'null' + usage: + $ref: '#/components/schemas/ResponseUsage' + parallel_tool_calls: + type: boolean + description: | + Whether to allow the model to run tool calls in parallel. + default: true + conversation: + anyOf: + - default: null + $ref: '#/components/schemas/Conversation-2' + - 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](/docs/guides/reasoning). + 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-4o-2024-08-06 + 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: [] + parallel_tool_calls: true + previous_response_id: null + reasoning: + effort: null + summary: 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 + output_tokens: 52 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 380 + user: null + metadata: {} + ResponseAudioDeltaEvent: + type: object + description: Emitted when there is a partial audio response. + properties: + type: + type: string + description: | + The type of the event. Always `response.audio.delta`. + enum: + - response.audio.delta + x-stainless-const: true + sequence_number: + type: integer + description: | + A sequence number for this chunk of the stream response. + delta: + type: string + description: | + A chunk of Base64 encoded response audio bytes. + required: + - type + - delta + - sequence_number + x-oaiMeta: + name: response.audio.delta + group: responses + example: | + { + "type": "response.audio.delta", + "response_id": "resp_123", + "delta": "base64encoded...", + "sequence_number": 1 + } + ResponseAudioDoneEvent: + type: object + description: Emitted when the audio response is complete. + properties: + type: + type: string + description: | + The type of the event. Always `response.audio.done`. + enum: + - response.audio.done + x-stainless-const: true + sequence_number: + type: integer + description: | + The sequence number of the delta. + required: + - type + - sequence_number + - response_id + x-oaiMeta: + name: response.audio.done + group: responses + example: | + { + "type": "response.audio.done", + "response_id": "resp-123", + "sequence_number": 1 + } + ResponseAudioTranscriptDeltaEvent: + type: object + description: Emitted when there is a partial transcript of audio. + properties: + type: + type: string + description: | + The type of the event. Always `response.audio.transcript.delta`. + enum: + - response.audio.transcript.delta + x-stainless-const: true + delta: + type: string + description: | + The partial transcript of the audio response. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - response_id + - delta + - sequence_number + x-oaiMeta: + name: response.audio.transcript.delta + group: responses + example: | + { + "type": "response.audio.transcript.delta", + "response_id": "resp_123", + "delta": " ... partial transcript ... ", + "sequence_number": 1 + } + ResponseAudioTranscriptDoneEvent: + type: object + description: Emitted when the full audio transcript is completed. + properties: + type: + type: string + description: | + The type of the event. Always `response.audio.transcript.done`. + enum: + - response.audio.transcript.done + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - response_id + - sequence_number + x-oaiMeta: + name: response.audio.transcript.done + group: responses + example: | + { + "type": "response.audio.transcript.done", + "response_id": "resp_123", + "sequence_number": 1 + } + ResponseCodeInterpreterCallCodeDeltaEvent: + type: object + description: Emitted when a partial code snippet is streamed by the code interpreter. + properties: + type: + type: string + description: >- + The type of the event. Always + `response.code_interpreter_call_code.delta`. + enum: + - response.code_interpreter_call_code.delta + 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 + - output_index + - item_id + - delta + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call_code.delta + group: responses + example: | + { + "type": "response.code_interpreter_call_code.delta", + "output_index": 0, + "item_id": "ci_12345", + "delta": "print('Hello, world')", + "sequence_number": 1 + } + ResponseCodeInterpreterCallCodeDoneEvent: + type: object + description: Emitted when the code snippet is finalized by the code interpreter. + properties: + type: + 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 + 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: 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 + - output_index + - item_id + - code + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call_code.done + group: responses + example: | + { + "type": "response.code_interpreter_call_code.done", + "output_index": 3, + "item_id": "ci_12345", + "code": "print('done')", + "sequence_number": 1 + } + ResponseCodeInterpreterCallCompletedEvent: + type: object + description: Emitted when the code interpreter call is completed. + properties: + type: + type: string + description: >- + The type of the event. Always + `response.code_interpreter_call.completed`. + 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. + 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 + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call.completed + group: responses + example: | + { + "type": "response.code_interpreter_call.completed", + "output_index": 5, + "item_id": "ci_12345", + "sequence_number": 1 + } + ResponseCodeInterpreterCallInProgressEvent: + type: object + description: Emitted when a code interpreter call is in progress. + properties: + type: + type: string + description: >- + The type of the event. Always + `response.code_interpreter_call.in_progress`. + enum: + - response.code_interpreter_call.in_progress + 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: + 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 + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call.in_progress + group: responses + example: | + { + "type": "response.code_interpreter_call.in_progress", + "output_index": 0, + "item_id": "ci_12345", + "sequence_number": 1 + } + ResponseCodeInterpreterCallInterpretingEvent: + type: object + description: >- + Emitted when the code interpreter is actively interpreting the code + snippet. + properties: + type: + type: string + description: >- + The type of the event. Always + `response.code_interpreter_call.interpreting`. + enum: + - response.code_interpreter_call.interpreting + x-stainless-const: true + 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 + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call.interpreting + group: responses + example: | + { + "type": "response.code_interpreter_call.interpreting", + "output_index": 4, + "item_id": "ci_12345", + "sequence_number": 1 + } + ResponseCompletedEvent: + type: object + description: Emitted when the model response is complete. + properties: + type: + type: string + description: | + The type of the event. Always `response.completed`. + enum: + - response.completed + x-stainless-const: true + response: + $ref: '#/components/schemas/Response' + description: | + Properties of the completed response. + sequence_number: + type: integer + description: The sequence number for this event. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.completed + group: responses + example: | + { + "type": "response.completed", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "completed", + "completed_at": 1740855870, + "error": null, + "incomplete_details": null, + "input": [], + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_123", + "type": "message", + "role": "assistant", + "content": [ + { + "type": "output_text", + "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.", + "annotations": [] + } + ] + } + ], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + 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`. + enum: + - response.content_part.added + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the content part was added to. + output_index: + type: integer + description: | + The index of the output item that the content part was added to. + content_index: + type: integer + description: | + The index of the content part that was added. + part: + $ref: '#/components/schemas/OutputContent' + description: | + The content part that was added. + 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: | + { + "type": "response.content_part.added", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "part": { + "type": "output_text", + "text": "", + "annotations": [] + }, + "sequence_number": 1 + } + ResponseContentPartDoneEvent: + type: object + description: Emitted when a content part is done. + properties: + type: + type: string + description: | + The type of the event. Always `response.content_part.done`. + enum: + - response.content_part.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the content part was added to. + output_index: + type: integer + description: | + The index of the output item that the content part was added to. + content_index: + type: integer + description: | + The index of the content part that is done. + sequence_number: + type: integer + description: The sequence number of this event. + part: + $ref: '#/components/schemas/OutputContent' + description: | + The content part that is done. + required: + - type + - item_id + - output_index + - content_index + - part + - sequence_number + x-oaiMeta: + name: response.content_part.done + group: responses + example: | + { + "type": "response.content_part.done", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "sequence_number": 1, + "part": { + "type": "output_text", + "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.", + "annotations": [] + } + } + ResponseCreatedEvent: + type: object + description: | + An event that is emitted when a response is created. + properties: + type: + type: string + description: | + The type of the event. Always `response.created`. + enum: + - response.created + x-stainless-const: true + response: + $ref: '#/components/schemas/Response' + description: | + The response that was created. + sequence_number: + type: integer + description: The sequence number for this event. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.created + group: responses + example: | + { + "type": "response.created", + "response": { + "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", + "object": "response", + "created_at": 1741487325, + "status": "in_progress", + "completed_at": null, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-2024-08-06", + "output": [], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + ResponseCustomToolCallInputDeltaEvent: + title: ResponseCustomToolCallInputDelta + type: object + description: > + Event representing a delta (partial update) to the input of a custom + tool call. + properties: + type: + type: string + enum: + - response.custom_tool_call_input.delta + 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: 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: + - type + - output_index + - item_id + - delta + - sequence_number + x-oaiMeta: + name: response.custom_tool_call_input.delta + group: responses + example: | + { + "type": "response.custom_tool_call_input.delta", + "output_index": 0, + "item_id": "ctc_1234567890abcdef", + "delta": "partial input text" + } + ResponseCustomToolCallInputDoneEvent: + title: ResponseCustomToolCallInputDone + type: object + description: | + Event indicating that input for a custom tool call is complete. + properties: + type: + type: string + enum: + - response.custom_tool_call_input.done + 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 event applies to. + item_id: + type: string + description: Unique identifier for the API item associated with this event. + 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: | + { + "type": "response.custom_tool_call_input.done", + "output_index": 0, + "item_id": "ctc_1234567890abcdef", + "input": "final complete input text" + } + ResponseError: + anyOf: + - type: object + description: > + An error object returned when the model fails to generate a + Response. + properties: + code: + $ref: '#/components/schemas/ResponseErrorCode' + message: + type: string + description: | + A human-readable description of the error. + required: + - code + - message + - type: 'null' + ResponseErrorCode: + type: string + description: | + The error code for the response. + enum: + - server_error + - rate_limit_exceeded + - invalid_prompt + - 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`. + enum: + - error + x-stainless-const: true + code: + anyOf: + - type: string + description: | + The error code. + - type: 'null' + message: + type: string + description: | + The error message. + param: + anyOf: + - type: string + description: | + The error parameter. + - type: 'null' + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - code + - message + - param + - sequence_number + x-oaiMeta: + name: error + group: responses + example: | + { + "type": "error", + "code": "ERR_SOMETHING", + "message": "Something went wrong", + "param": null, + "sequence_number": 1 + } + ResponseFailedEvent: + type: object + description: | + An event that is emitted when a response fails. + properties: + type: + type: string + description: | + The type of the event. Always `response.failed`. + enum: + - response.failed + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number of this event. + response: + $ref: '#/components/schemas/Response' + description: | + The response that failed. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.failed + group: responses + example: | + { + "type": "response.failed", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "failed", + "completed_at": null, + "error": { + "code": "server_error", + "message": "The model failed to generate a response." + }, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + } + } + ResponseFileSearchCallCompletedEvent: + type: object + description: Emitted when a file search call is completed (results found). + properties: + type: + type: string + description: | + The type of the event. Always `response.file_search_call.completed`. + enum: + - response.file_search_call.completed + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that the file search call is initiated. + item_id: + type: string + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.file_search_call.completed + group: responses + example: | + { + "type": "response.file_search_call.completed", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 + } + ResponseFileSearchCallInProgressEvent: + type: object + description: Emitted when a file search call is initiated. + properties: + type: + type: string + description: > + The type of the event. Always + `response.file_search_call.in_progress`. + enum: + - response.file_search_call.in_progress + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that the file search call is initiated. + item_id: + type: string + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.file_search_call.in_progress + group: responses + example: | + { + "type": "response.file_search_call.in_progress", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 + } + ResponseFileSearchCallSearchingEvent: + type: object + description: Emitted when a file search is currently searching. + properties: + type: + type: string + description: | + The type of the event. Always `response.file_search_call.searching`. + enum: + - response.file_search_call.searching + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that the file search call is searching. + item_id: + type: string + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + 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: | + { + "type": "response.file_search_call.searching", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 + } + ResponseFormatJsonObject: + type: object + title: JSON object + description: > + JSON object response format. An older method of generating JSON + responses. + + Using `json_schema` is recommended for models that support it. Note that + the + + model will not generate JSON without a system or user message + instructing it + + to do so. + 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. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). + properties: + type: + type: string + description: The type of response format being defined. Always `json_schema`. + enum: + - json_schema + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: > + A description of what the response format is for, used by the + model to + + determine how to respond in the format. + name: + type: string + description: > + The name of the response format. Must be a-z, A-Z, 0-9, or + contain + + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: > + Whether to enable strict schema adherence when generating + the output. + + If set to true, the model will always follow the exact + schema defined + + in the `schema` field. Only a subset of JSON Schema is + supported when + + `strict` is `true`. To learn more, read the [Structured + Outputs + + guide](/docs/guides/structured-outputs). + - 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + ResponseFormatText: + type: object + title: Text + description: | + Default response format. Used to generate text responses. + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + required: + - type + ResponseFormatTextGrammar: + type: object + title: Text grammar + description: | + A custom grammar for the model to follow when generating text. + Learn more in the [custom grammars guide](/docs/guides/custom-grammars). + properties: + type: + type: string + description: The type of response format being defined. Always `grammar`. + enum: + - grammar + x-stainless-const: true + grammar: + type: string + description: The custom grammar for the model to follow. + required: + - type + - grammar + ResponseFormatTextPython: + type: object + title: Python grammar + description: | + Configure the model to generate valid Python code. See the + [custom grammars guide](/docs/guides/custom-grammars) for more details. + properties: + type: + type: string + description: The type of response format being defined. Always `python`. + enum: + - python + x-stainless-const: true + required: + - type + ResponseFunctionCallArgumentsDeltaEvent: + type: object + description: Emitted when there is a partial function-call arguments delta. + properties: + type: + type: string + description: > + The type of the event. Always + `response.function_call_arguments.delta`. + enum: + - response.function_call_arguments.delta + x-stainless-const: true + item_id: + type: string + description: > + The ID of the output item that the function-call arguments delta is + added to. + output_index: + type: integer + description: > + The index of the output item that the function-call arguments delta + is added to. + sequence_number: + type: integer + description: The sequence number of this event. + delta: + type: string + description: | + The function-call arguments delta that is added. + required: + - type + - item_id + - output_index + - delta + - sequence_number + x-oaiMeta: + name: response.function_call_arguments.delta + group: responses + example: | + { + "type": "response.function_call_arguments.delta", + "item_id": "item-abc", + "output_index": 0, + "delta": "{ \"arg\":" + "sequence_number": 1 + } + ResponseFunctionCallArgumentsDoneEvent: + type: object + description: Emitted when function-call arguments are finalized. + properties: + type: + type: string + enum: + - response.function_call_arguments.done + x-stainless-const: true + item_id: + type: string + description: The ID of the item. + name: + type: string + description: The name of the function that was called. + 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: + - type + - item_id + - name + - output_index + - arguments + - sequence_number + x-oaiMeta: + name: response.function_call_arguments.done + group: responses + example: | + { + "type": "response.function_call_arguments.done", + "item_id": "item-abc", + "name": "get_weather", + "output_index": 1, + "arguments": "{ \"arg\": 123 }", + "sequence_number": 1 + } + ResponseImageGenCallCompletedEvent: + type: object + title: ResponseImageGenCallCompletedEvent + description: > + Emitted when an image generation tool call has completed and the final + image is available. + properties: + type: + type: string + enum: + - response.image_generation_call.completed + 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 unique identifier of the image generation item being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.image_generation_call.completed + group: responses + example: | + { + "type": "response.image_generation_call.completed", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 1 + } + ResponseImageGenCallGeneratingEvent: + type: object + title: ResponseImageGenCallGeneratingEvent + description: > + Emitted when an image generation tool call is actively generating an + image (intermediate state). + properties: + type: + type: string + enum: + - response.image_generation_call.generating + 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. + sequence_number: + type: integer + description: The sequence number of the image generation item being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.image_generation_call.generating + group: responses + example: | + { + "type": "response.image_generation_call.generating", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0 + } + ResponseImageGenCallInProgressEvent: + type: object + title: ResponseImageGenCallInProgressEvent + description: | + Emitted when an image generation tool call is in progress. + properties: + type: + type: string + enum: + - response.image_generation_call.in_progress + description: >- + The type of the event. Always + 'response.image_generation_call.in_progress'. + 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. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.image_generation_call.in_progress + group: responses + example: | + { + "type": "response.image_generation_call.in_progress", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0 + } + ResponseImageGenCallPartialImageEvent: + type: object + title: ResponseImageGenCallPartialImageEvent + description: > + Emitted when a partial image is available during image generation + streaming. + properties: + type: + type: string + enum: + - response.image_generation_call.partial_image + 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. + 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: | + { + "type": "response.image_generation_call.partial_image", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0, + "partial_image_index": 0, + "partial_image_b64": "..." + } + ResponseInProgressEvent: + type: object + description: Emitted when the response is in progress. + properties: + type: + type: string + description: | + The type of the event. Always `response.in_progress`. + enum: + - response.in_progress + x-stainless-const: true + response: + $ref: '#/components/schemas/Response' + description: | + The response that is in progress. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.in_progress + group: responses + example: | + { + "type": "response.in_progress", + "response": { + "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", + "object": "response", + "created_at": 1741487325, + "status": "in_progress", + "completed_at": null, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-2024-08-06", + "output": [], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + ResponseIncompleteEvent: + type: object + description: | + An event that is emitted when a response finishes as incomplete. + properties: + type: + type: string + description: | + The type of the event. Always `response.incomplete`. + enum: + - response.incomplete + x-stainless-const: true + response: + $ref: '#/components/schemas/Response' + description: | + The response that was incomplete. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.incomplete + group: responses + example: | + { + "type": "response.incomplete", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "incomplete", + "completed_at": null, + "error": null, + "incomplete_details": { + "reason": "max_tokens" + }, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + ResponseItemList: + type: object + description: A list of Response 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 items used to generate this response. + items: + $ref: '#/components/schemas/ItemResource' + 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. + last_id: + type: string + description: The ID of the last item in the list. + required: + - object + - data + - has_more + - first_id + - last_id + x-oaiMeta: + name: The input item list + group: responses + example: | + { + "object": "list", + "data": [ + { + "id": "msg_abc123", + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Tell me a three sentence bedtime story about a unicorn." + } + ] + } + ], + "first_id": "msg_abc123", + "last_id": "msg_abc123", + "has_more": false + } + ResponseLogProb: + type: object + description: > + A logprob is the logarithmic probability that the model assigns to + producing + + a particular token at a given position in the sequence. Less-negative + (higher) + + logprob values indicate greater model confidence in that token choice. + properties: + token: + description: A possible text token. + type: string + logprob: + description: | + The log probability of this token. + type: number + top_logprobs: + description: | + The log probabilities of up to 20 of the most likely tokens. + 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. + 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. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - output_index + - item_id + - delta + - sequence_number + x-oaiMeta: + name: response.mcp_call_arguments.delta + group: responses + example: | + { + "type": "response.mcp_call_arguments.delta", + "output_index": 0, + "item_id": "item-abc", + "delta": "{", + "sequence_number": 1 + } + ResponseMCPCallArgumentsDoneEvent: + type: object + title: ResponseMCPCallArgumentsDoneEvent + description: | + Emitted when the arguments for an MCP tool call are finalized. + properties: + type: + type: string + enum: + - response.mcp_call_arguments.done + 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. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - output_index + - item_id + - arguments + - sequence_number + x-oaiMeta: + name: response.mcp_call_arguments.done + group: responses + example: | + { + "type": "response.mcp_call_arguments.done", + "output_index": 0, + "item_id": "item-abc", + "arguments": "{\"arg1\": \"value1\", \"arg2\": \"value2\"}", + "sequence_number": 1 + } + ResponseMCPCallCompletedEvent: + type: object + title: ResponseMCPCallCompletedEvent + description: | + Emitted when an MCP tool call has completed successfully. + properties: + type: + type: string + enum: + - response.mcp_call.completed + 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: + type: integer + description: The index of the output item that completed. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - item_id + - output_index + - sequence_number + x-oaiMeta: + name: response.mcp_call.completed + group: responses + example: | + { + "type": "response.mcp_call.completed", + "sequence_number": 1, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", + "output_index": 0 + } + ResponseMCPCallFailedEvent: + type: object + title: ResponseMCPCallFailedEvent + description: | + Emitted when an MCP tool call has failed. + properties: + type: + type: string + enum: + - response.mcp_call.failed + description: The type of the event. Always 'response.mcp_call.failed'. + x-stainless-const: true + 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: + - type + - item_id + - output_index + - sequence_number + x-oaiMeta: + name: response.mcp_call.failed + group: responses + example: | + { + "type": "response.mcp_call.failed", + "sequence_number": 1, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", + "output_index": 0 + } + ResponseMCPCallInProgressEvent: + type: object + title: ResponseMCPCallInProgressEvent + description: | + Emitted when an MCP tool call is in progress. + properties: + type: + type: string + enum: + - response.mcp_call.in_progress + 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. + 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: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.mcp_call.in_progress + group: responses + example: | + { + "type": "response.mcp_call.in_progress", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90" + } + ResponseMCPListToolsCompletedEvent: + type: object + title: ResponseMCPListToolsCompletedEvent + description: > + Emitted when the list of available MCP tools has been successfully + retrieved. + properties: + type: + type: string + enum: + - response.mcp_list_tools.completed + description: The type of the event. Always 'response.mcp_list_tools.completed'. + x-stainless-const: true + item_id: + type: string + description: The ID of the MCP tool call item that produced this output. + output_index: + type: integer + description: The index of the output item that was processed. + 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.completed + group: responses + example: | + { + "type": "response.mcp_list_tools.completed", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" + } + ResponseMCPListToolsFailedEvent: + type: object + title: ResponseMCPListToolsFailedEvent + description: | + Emitted when the attempt to list available MCP tools has failed. + properties: + type: + type: string + enum: + - response.mcp_list_tools.failed + description: The type of the event. Always 'response.mcp_list_tools.failed'. + x-stainless-const: true + 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: + - type + - item_id + - output_index + - sequence_number + x-oaiMeta: + name: response.mcp_list_tools.failed + group: responses + example: | + { + "type": "response.mcp_list_tools.failed", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" + } + ResponseMCPListToolsInProgressEvent: + type: object + title: ResponseMCPListToolsInProgressEvent + description: > + Emitted when the system is in the process of retrieving the list of + available MCP tools. + 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 + item_id: + type: string + description: The ID of the MCP tool call item that is being processed. + output_index: + type: integer + description: The index of the output item that is being processed. + 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: | + { + "type": "response.mcp_list_tools.in_progress", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" + } + ResponseModalities: + anyOf: + - type: array + description: > + Output types that you would like the model to generate. + + Most models are capable of generating text, which is the default: + + + `["text"]` + + + The `gpt-4o-audio-preview` model can also be used to + + [generate audio](/docs/guides/audio). To request that this model + generate + + both text and audio responses, you can use: + + + `["text", "audio"]` + items: + type: string + enum: + - text + - audio + - type: 'null' + ResponseOutputItemAddedEvent: + type: object + description: Emitted when a new output item is added. + properties: + type: + type: string + description: | + The type of the event. Always `response.output_item.added`. + enum: + - response.output_item.added + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that was added. + sequence_number: + type: integer + description: | + The sequence number of this event. + item: + $ref: '#/components/schemas/OutputItem' + description: | + The output item that was added. + required: + - type + - output_index + - item + - sequence_number + x-oaiMeta: + name: response.output_item.added + group: responses + example: | + { + "type": "response.output_item.added", + "output_index": 0, + "item": { + "id": "msg_123", + "status": "in_progress", + "type": "message", + "role": "assistant", + "content": [] + }, + "sequence_number": 1 + } + ResponseOutputItemDoneEvent: + type: object + description: Emitted when an output item is marked done. + properties: + type: + type: string + description: | + The type of the event. Always `response.output_item.done`. + enum: + - response.output_item.done + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that was marked done. + sequence_number: + type: integer + description: | + The sequence number of this event. + item: + $ref: '#/components/schemas/OutputItem' + description: | + The output item that was marked done. + required: + - type + - output_index + - item + - sequence_number + x-oaiMeta: + name: response.output_item.done + group: responses + example: | + { + "type": "response.output_item.done", + "output_index": 0, + "item": { + "id": "msg_123", + "status": "completed", + "type": "message", + "role": "assistant", + "content": [ + { + "type": "output_text", + "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.", + "annotations": [] + } + ] + }, + "sequence_number": 1 + } + ResponseOutputTextAnnotationAddedEvent: + type: object + title: ResponseOutputTextAnnotationAddedEvent + description: | + Emitted when an annotation is added to output text content. + properties: + type: + type: string + enum: + - response.output_text.annotation.added + 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's output array. + 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: + type: object + description: >- + The annotation object being added. (See annotation schema for + details.) + required: + - type + - item_id + - output_index + - content_index + - annotation_index + - annotation + - sequence_number + x-oaiMeta: + name: response.output_text.annotation.added + group: responses + example: | + { + "type": "response.output_text.annotation.added", + "item_id": "item-abc", + "output_index": 0, + "content_index": 0, + "annotation_index": 0, + "annotation": { + "type": "text_annotation", + "text": "This is a test annotation", + "start": 0, + "end": 10 + }, + "sequence_number": 1 + } + ResponsePromptVariables: + anyOf: + - type: object + title: Prompt Variables + description: | + Optional map of values to substitute in for variables in your + prompt. The substitution values can either be strings, or other + Response input types like images or files. + 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 + properties: + 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](/docs/guides/conversation-state). Cannot be + used in conjunction with `conversation`. + - type: 'null' + model: + 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](/docs/models) + + to browse and compare available models. + $ref: '#/components/schemas/ModelIdsResponses' + reasoning: + anyOf: + - $ref: '#/components/schemas/Reasoning' + - type: 'null' + background: + anyOf: + - type: boolean + description: | + Whether to run the model response in the background. + [Learn more](/docs/guides/background). + 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. + 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' + truncation: + anyOf: + - type: string + 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. + enum: + - auto + - disabled + default: disabled + - type: 'null' + ResponseQueuedEvent: + type: object + title: ResponseQueuedEvent + description: | + Emitted when a response is queued and waiting to be processed. + properties: + type: + type: string + enum: + - response.queued + 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. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.queued + group: responses + example: | + { + "type": "response.queued", + "response": { + "id": "res_123", + "status": "queued", + "created_at": "2021-01-01T00:00:00Z", + "updated_at": "2021-01-01T00:00:00Z" + }, + "sequence_number": 1 + } + ResponseReasoningSummaryPartAddedEvent: + type: object + description: Emitted when a new reasoning summary part is added. + properties: + type: + type: string + description: > + The type of the event. Always + `response.reasoning_summary_part.added`. + enum: + - response.reasoning_summary_part.added + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this summary part is associated with. + output_index: + type: integer + description: | + The index of the output item this summary part is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + sequence_number: + type: integer + description: | + The sequence number of this event. + part: + type: object + description: | + The summary part that was added. + 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: + - type + - item_id + - output_index + - summary_index + - part + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_part.added + group: responses + example: | + { + "type": "response.reasoning_summary_part.added", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "part": { + "type": "summary_text", + "text": "" + }, + "sequence_number": 1 + } + ResponseReasoningSummaryPartDoneEvent: + type: object + description: Emitted when a reasoning summary part is completed. + properties: + type: + type: string + description: > + The type of the event. Always + `response.reasoning_summary_part.done`. + enum: + - response.reasoning_summary_part.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this summary part is associated with. + output_index: + type: integer + description: | + The index of the output item this summary part is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + sequence_number: + type: integer + description: | + The sequence number of this event. + part: + type: object + description: | + The completed summary part. + 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: + - type + - item_id + - output_index + - summary_index + - part + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_part.done + group: responses + example: | + { + "type": "response.reasoning_summary_part.done", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "part": { + "type": "summary_text", + "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!" + }, + "sequence_number": 1 + } + ResponseReasoningSummaryTextDeltaEvent: + type: object + description: Emitted when a delta is added to a reasoning summary text. + properties: + type: + type: string + description: > + The type of the event. Always + `response.reasoning_summary_text.delta`. + enum: + - response.reasoning_summary_text.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this summary text delta is associated with. + output_index: + type: integer + description: > + The index of the output item this summary text delta is associated + with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + delta: + type: string + description: | + The text delta that was added to the summary. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - summary_index + - delta + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_text.delta + group: responses + example: | + { + "type": "response.reasoning_summary_text.delta", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "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!", + "sequence_number": 1 + } + ResponseReasoningSummaryTextDoneEvent: + type: object + description: Emitted when a reasoning summary text is completed. + properties: + type: + type: string + description: > + The type of the event. Always + `response.reasoning_summary_text.done`. + enum: + - response.reasoning_summary_text.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this summary text is associated with. + output_index: + type: integer + description: | + The index of the output item this summary text is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + text: + type: string + description: | + The full text of the completed reasoning summary. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - summary_index + - text + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_text.done + group: responses + example: | + { + "type": "response.reasoning_summary_text.done", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "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!", + "sequence_number": 1 + } + ResponseReasoningTextDeltaEvent: + type: object + description: Emitted when a delta is added to a reasoning text. + properties: + type: + type: string + description: | + The type of the event. Always `response.reasoning_text.delta`. + enum: + - response.reasoning_text.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this reasoning text delta is associated with. + output_index: + type: integer + description: > + The index of the output item this reasoning text delta is associated + with. + content_index: + type: integer + description: > + The index of the reasoning content part this delta is associated + with. + delta: + type: string + description: | + The text delta that was added to the reasoning content. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - delta + - sequence_number + x-oaiMeta: + name: response.reasoning_text.delta + group: responses + example: | + { + "type": "response.reasoning_text.delta", + "item_id": "rs_123", + "output_index": 0, + "content_index": 0, + "delta": "The", + "sequence_number": 1 + } + ResponseReasoningTextDoneEvent: + type: object + description: Emitted when a reasoning text is completed. + properties: + type: + type: string + description: | + The type of the event. Always `response.reasoning_text.done`. + enum: + - response.reasoning_text.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this reasoning text is associated with. + output_index: + type: integer + description: | + The index of the output item this reasoning text is associated with. + content_index: + type: integer + description: | + The index of the reasoning content part. + text: + type: string + description: | + The full text of the completed reasoning content. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - text + - sequence_number + x-oaiMeta: + name: response.reasoning_text.done + group: responses + example: | + { + "type": "response.reasoning_text.done", + "item_id": "rs_123", + "output_index": 0, + "content_index": 0, + "text": "The user is asking...", + "sequence_number": 4 + } + ResponseRefusalDeltaEvent: + type: object + description: Emitted when there is a partial refusal text. + properties: + type: + type: string + description: | + The type of the event. Always `response.refusal.delta`. + enum: + - response.refusal.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the refusal text is added to. + output_index: + type: integer + description: | + The index of the output item that the refusal text is added to. + content_index: + type: integer + description: | + The index of the content part that the refusal text is added to. + delta: + type: string + description: | + The refusal text that is added. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - delta + - sequence_number + x-oaiMeta: + name: response.refusal.delta + group: responses + example: | + { + "type": "response.refusal.delta", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "delta": "refusal text so far", + "sequence_number": 1 + } + ResponseRefusalDoneEvent: + type: object + description: Emitted when refusal text is finalized. + properties: + type: + type: string + description: | + The type of the event. Always `response.refusal.done`. + enum: + - response.refusal.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the refusal text is finalized. + output_index: + type: integer + description: | + The index of the output item that the refusal text is finalized. + content_index: + type: integer + description: | + The index of the content part that the refusal text is finalized. + refusal: + type: string + description: | + The refusal text that is finalized. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - refusal + - sequence_number + x-oaiMeta: + name: response.refusal.done + group: responses + example: | + { + "type": "response.refusal.done", + "item_id": "item-abc", + "output_index": 1, + "content_index": 2, + "refusal": "final refusal text", + "sequence_number": 1 + } + ResponseStreamEvent: + 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/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' + discriminator: + propertyName: type + ResponseStreamOptions: + anyOf: + - description: > + Options for streaming responses. Only set this when you set `stream: + true`. + type: object + default: null + properties: + include_obfuscation: + type: boolean + description: > + When true, stream obfuscation will be enabled. Stream + obfuscation adds + + random characters to an `obfuscation` field on streaming delta + events to + + normalize payload sizes as a mitigation to certain side-channel + attacks. + + These obfuscation fields are included by default, but add a + small amount + + of overhead to the data stream. You can set + `include_obfuscation` to + + false to optimize for bandwidth if you trust the network links + between + + your application and the OpenAI API. + - type: 'null' + ResponseTextDeltaEvent: + type: object + description: Emitted when there is an additional text delta. + properties: + type: + type: string + description: | + The type of the event. Always `response.output_text.delta`. + enum: + - response.output_text.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the text delta was added to. + output_index: + type: integer + description: | + The index of the output item that the text delta was added to. + content_index: + type: integer + description: | + The index of the content part that the text delta was added to. + delta: + type: string + description: | + The text delta that was added. + sequence_number: + type: integer + description: The sequence number for this event. + logprobs: + type: array + description: | + The log probabilities of the tokens in the delta. + items: + $ref: '#/components/schemas/ResponseLogProb' + required: + - type + - item_id + - output_index + - content_index + - delta + - sequence_number + - logprobs + x-oaiMeta: + name: response.output_text.delta + group: responses + example: | + { + "type": "response.output_text.delta", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "delta": "In", + "sequence_number": 1 + } + ResponseTextDoneEvent: + type: object + description: Emitted when text content is finalized. + properties: + type: + type: string + description: | + The type of the event. Always `response.output_text.done`. + enum: + - response.output_text.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the text content is finalized. + output_index: + type: integer + description: | + The index of the output item that the text content is finalized. + content_index: + type: integer + description: | + The index of the content part that the text content is finalized. + text: + type: string + description: | + The text content that is finalized. + sequence_number: + type: integer + description: The sequence number for this event. + logprobs: + type: array + description: | + The log probabilities of the tokens in the delta. + items: + $ref: '#/components/schemas/ResponseLogProb' + required: + - type + - item_id + - output_index + - content_index + - text + - sequence_number + - logprobs + x-oaiMeta: + name: response.output_text.done + group: responses + example: | + { + "type": "response.output_text.done", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "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.", + "sequence_number": 1 + } + ResponseTextParam: + type: object + description: | + Configuration options for a text response from the model. Can be plain + text or structured JSON data. Learn more: + - [Text inputs and outputs](/docs/guides/text) + - [Structured Outputs](/docs/guides/structured-outputs) + properties: + format: + $ref: '#/components/schemas/TextResponseFormatConfiguration' + verbosity: + $ref: '#/components/schemas/Verbosity' + ResponseUsage: + type: object + description: | + Represents token usage details including input tokens, output tokens, + a breakdown of output tokens, and the total tokens used. + 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 prompt caching](/docs/guides/prompt-caching). + 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. + 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: + type: string + description: | + The type of the event. Always `response.web_search_call.completed`. + enum: + - response.web_search_call.completed + x-stainless-const: true + output_index: + type: integer + description: > + The index of the output item that the web search call is associated + with. + item_id: + type: string + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.web_search_call.completed + group: responses + example: | + { + "type": "response.web_search_call.completed", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 + } + ResponseWebSearchCallInProgressEvent: + type: object + 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`. + enum: + - response.web_search_call.in_progress + x-stainless-const: true + output_index: + type: integer + description: > + The index of the output item that the web search call is associated + with. + item_id: + type: string + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.web_search_call.in_progress + group: responses + example: | + { + "type": "response.web_search_call.in_progress", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 + } + ResponseWebSearchCallSearchingEvent: + type: object + 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`. + enum: + - response.web_search_call.searching + x-stainless-const: true + output_index: + type: integer + description: > + The index of the output item that the web search call is associated + with. + item_id: + type: string + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.web_search_call.searching + group: responses + example: | + { + "type": "response.web_search_call.searching", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 + } + ResponsesClientEvent: + discriminator: + propertyName: type + description: | + Client events accepted by the Responses WebSocket server. + anyOf: + - $ref: '#/components/schemas/ResponsesClientEventResponseCreate' + ResponsesClientEventResponseCreate: + allOf: + - type: object + properties: + type: + type: string + enum: + - response.create + description: | + The type of the client event. Always `response.create`. + x-stainless-const: true + required: + - type + - $ref: '#/components/schemas/CreateResponse' + description: > + Client event for creating a response over a persistent WebSocket + connection. + + This payload uses the same top-level fields as `POST /v1/responses`. + + + Notes: + + - `stream` is implicit over WebSocket and should not be sent. + + - `background` is not supported over WebSocket. + ResponsesServerEvent: + discriminator: + propertyName: type + description: | + Server events emitted by the Responses WebSocket server. + anyOf: + - $ref: '#/components/schemas/ResponseStreamEvent' + Role: + type: object + description: Details about a role that can be assigned through the public Roles API. + properties: + object: + type: string + enum: + - role + description: Always `role`. + x-stainless-const: true + id: + type: string + description: Identifier for the role. + name: + type: string + description: Unique name for the role. + description: + description: Optional description of the role. + anyOf: + - type: string + - type: 'null' + permissions: + type: array + description: Permissions granted by the role. + items: + type: string + resource_type: + type: string + 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: + - object + - id + - name + - description + - permissions + - resource_type + - predefined_role + x-oaiMeta: + name: The role object + example: | + { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + RoleDeletedResource: + type: object + description: Confirmation payload returned after deleting a role. + properties: + object: + type: string + enum: + - role.deleted + description: Always `role.deleted`. + x-stainless-const: true + id: + type: string + description: Identifier of the deleted role. + deleted: + type: boolean + description: Whether the role was deleted. + required: + - object + - id + - deleted + x-oaiMeta: + name: Role deletion confirmation + example: | + { + "object": "role.deleted", + "id": "role_01J1F8ROLE01", + "deleted": true + } + RoleListResource: + type: object + description: Paginated list of roles assigned to a principal. + properties: + object: + type: string + enum: + - list + 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. + next: + description: >- + Cursor to fetch the next page of results, or `null` when there are + no more assignments. + anyOf: + - type: string + - type: 'null' + required: + - object + - data + - has_more + - next + x-oaiMeta: + name: Assigned role list + example: | + { + "object": "list", + "data": [ + { + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false, + "description": "Allows managing organization groups", + "created_at": 1711471533, + "updated_at": 1711472599, + "created_by": "user_abc123", + "created_by_user_obj": { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + }, + "metadata": {} + } + ], + "has_more": false, + "next": null + } + 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 + title: RunGraderRequest + 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' + item: + type: object + description: > + The dataset item provided to the grader. This will be used to + populate + + the `item` namespace. See [the guide](/docs/guides/graders) for more + details. + model_sample: + type: string + description: > + The model sample to be evaluated. This value will be used to + populate + + the `sample` namespace. See [the guide](/docs/guides/graders) for + more details. + + The `output_json` variable will be populated if the model sample is + a + + valid JSON string. + + required: + - grader + - model_sample + RunGraderResponse: + type: object + properties: + reward: + type: number + 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' + sampled_model_name: + anyOf: + - type: string + - type: 'null' + required: + - name + - type + - errors + - execution_time + - scores + - token_usage + - sampled_model_name + sub_rewards: + type: object + additionalProperties: {} + model_grader_token_usage_per_model: + type: object + additionalProperties: {} + required: + - reward + - metadata + - sub_rewards + - model_grader_token_usage_per_model + RunObject: + type: object + title: A run on a thread + description: Represents an execution run on a [thread](/docs/api-reference/threads). + 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: string + enum: + - thread.run + 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](/docs/api-reference/threads) that was + executed on as a part of this run. + type: string + assistant_id: + description: >- + The ID of the [assistant](/docs/api-reference/assistants) used for + execution of this run. + type: string + 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 + 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' + 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 + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + expires_at: + description: The Unix timestamp (in seconds) for when the run will expire. + type: integer + format: unixtime + nullable: true + started_at: + description: The Unix timestamp (in seconds) for when the run was started. + type: integer + format: unixtime + nullable: true + cancelled_at: + description: The Unix timestamp (in seconds) for when the run was cancelled. + type: integer + format: unixtime + nullable: true + failed_at: + description: The Unix timestamp (in seconds) for when the run failed. + type: integer + format: unixtime + nullable: true + completed_at: + description: The Unix timestamp (in seconds) for when the run was completed. + type: integer + format: unixtime + nullable: true + 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 + model: + description: >- + The model that the [assistant](/docs/api-reference/assistants) used + for this run. + type: string + instructions: + description: >- + The instructions that the + [assistant](/docs/api-reference/assistants) used for this run. + type: string + tools: + description: >- + The list of tools that the + [assistant](/docs/api-reference/assistants) used for this run. + default: [] + type: array + maxItems: 20 + 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 + max_prompt_tokens: + type: integer + nullable: true + description: > + The maximum number of prompt tokens specified to have been used over + the course of the run. + minimum: 256 + max_completion_tokens: + type: integer + nullable: true + description: > + The maximum number of completion tokens specified to have been used + over the course of the run. + 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: + - 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: The run object + beta: true + example: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1698107661, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699073476, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699073498, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "tools": [{"type": "file_search"}, {"type": "code_interpreter"}], + "metadata": {}, + "incomplete_details": null, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + 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 + title: Run step delta object + description: > + Represents a run step delta i.e. any changed fields on a run step during + streaming. + 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: string + enum: + - thread.run.step.delta + 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' + required: + - id + - object + - delta + x-oaiMeta: + name: The run step delta object + beta: true + example: | + { + "id": "step_123", + "object": "thread.run.step.delta", + "delta": { + "step_details": { + "type": "tool_calls", + "tool_calls": [ + { + "index": 0, + "id": "call_123", + "type": "code_interpreter", + "code_interpreter": { "input": "", "outputs": [] } + } + ] + } + } + } + RunStepDeltaStepDetailsMessageCreationObject: + title: Message creation + type: object + description: Details of the message creation by the run step. + properties: + type: + description: Always `message_creation`. + type: string + enum: + - message_creation + 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: + - type + RunStepDeltaStepDetailsToolCallsCodeObject: + title: Code interpreter tool call + type: object + description: Details of the Code Interpreter tool call the run step was involved in. + 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. + 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 + x-stainless-const: true + 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: + - index + - type + RunStepDeltaStepDetailsToolCallsCodeOutputImageObject: + title: Code interpreter image output + type: object + properties: + index: + type: integer + description: The index of the output in the outputs array. + type: + description: Always `image`. + type: string + enum: + - image + x-stainless-const: true + image: + type: object + properties: + file_id: + description: The [file](/docs/api-reference/files) ID of the image. + type: string + required: + - index + - type + RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject: + title: Code interpreter log output + type: object + description: Text output from the Code Interpreter tool call as part of a run step. + properties: + index: + type: integer + description: The index of the output in the outputs array. + type: + description: Always `logs`. + type: string + enum: + - logs + x-stainless-const: true + logs: + type: string + description: The text output from the Code Interpreter tool call. + required: + - index + - type + RunStepDeltaStepDetailsToolCallsFileSearchObject: + title: File search tool call + type: object + 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 + x-stainless-const: true + file_search: + type: object + description: For now, this is always going to be an empty object. + x-oaiTypeLabel: map + required: + - index + - type + - file_search + RunStepDeltaStepDetailsToolCallsFunctionObject: + type: object + title: Function tool call + 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 + 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: + - type: string + description: >- + The output of the function. This will be `null` if the + outputs have not been + [submitted](/docs/api-reference/runs/submitToolOutputs) yet. + - type: 'null' + required: + - index + - type + RunStepDeltaStepDetailsToolCallsObject: + title: Tool calls + type: object + description: Details of the tool call. + properties: + type: + description: Always `tool_calls`. + type: string + enum: + - tool_calls + 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`. + items: + oneOf: + - $ref: >- + #/components/schemas/RunStepDeltaStepDetailsToolCallsCodeObject + - $ref: >- + #/components/schemas/RunStepDeltaStepDetailsToolCallsFileSearchObject + - $ref: >- + #/components/schemas/RunStepDeltaStepDetailsToolCallsFunctionObject + required: + - type + RunStepDetailsMessageCreationObject: + title: Message creation + type: object + description: Details of the message creation by the run step. + properties: + type: + description: Always `message_creation`. + type: string + enum: + - message_creation + 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 + required: + - type + - message_creation + RunStepDetailsToolCallsCodeObject: + title: Code Interpreter tool call + type: object + description: Details of the Code Interpreter tool call the run step was involved in. + 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 + 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. + 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: + - 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 + image: + type: object + properties: + file_id: + description: The [file](/docs/api-reference/files) ID of the image. + type: string + required: + - file_id + required: + - type + - image + RunStepDetailsToolCallsCodeOutputLogsObject: + title: Code Interpreter log output + type: object + description: Text output from the Code Interpreter tool call as part of a run step. + properties: + type: + description: Always `logs`. + type: string + enum: + - logs + x-stainless-const: true + logs: + type: string + description: The text output from the Code Interpreter tool call. + required: + - type + - logs + RunStepDetailsToolCallsFileSearchObject: + title: File search tool call + type: object + 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 + 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 + 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 + 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 ID of the file that result was found in. + file_name: + 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. + required: + - file_id + - file_name + - score + RunStepDetailsToolCallsFunctionObject: + type: object + title: Function tool call + 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 + 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: + - type: string + description: >- + The output of the function. This will be `null` if the + outputs have not been + [submitted](/docs/api-reference/runs/submitToolOutputs) yet. + - type: 'null' + required: + - name + - arguments + - output + required: + - id + - type + - function + RunStepDetailsToolCallsObject: + title: Tool calls + type: object + description: Details of the tool call. + properties: + type: + description: Always `tool_calls`. + type: string + enum: + - tool_calls + 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`. + items: + 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. + 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: string + enum: + - thread.run.step + 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](/docs/api-reference/assistants) associated + with the run step. + type: string + thread_id: + description: The ID of the [thread](/docs/api-reference/threads) that was run. + type: string + run_id: + description: >- + The ID of the [run](/docs/api-reference/runs) 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: + - $ref: '#/components/schemas/RunStepDetailsMessageCreationObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsObject' + last_error: + 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. + required: + - code + - message + - type: 'null' + expired_at: + 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: 'null' + cancelled_at: + anyOf: + - description: >- + The Unix timestamp (in seconds) for when the run step was + cancelled. + type: integer + format: unixtime + - type: 'null' + failed_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the run step failed. + type: integer + format: unixtime + - type: 'null' + completed_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the run step completed. + type: integer + format: unixtime + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + usage: + $ref: '#/components/schemas/RunStepCompletionUsage' + 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 + x-oaiMeta: + name: The run step object + beta: true + example: | + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + 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](/docs/api-reference/run-steps/step-object) + is created. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - 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](/docs/api-reference/run-steps/step-object) + moves to an `in_progress` state. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - 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](/docs/api-reference/run-steps/step-object) are being streamed. + x-oaiMeta: + dataDescription: >- + `data` is a [run step + delta](/docs/api-reference/assistants-streaming/run-step-delta-object) + - 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](/docs/api-reference/run-steps/step-object) + is completed. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - 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](/docs/api-reference/run-steps/step-object) + fails. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - 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](/docs/api-reference/run-steps/step-object) + is cancelled. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.expired + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: >- + Occurs when a [run step](/docs/api-reference/run-steps/step-object) + expires. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + 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](/docs/api-reference/runs/object) is created. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.queued + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: >- + Occurs when a [run](/docs/api-reference/runs/object) moves to a + `queued` status. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - 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](/docs/api-reference/runs/object) moves to an + `in_progress` status. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.requires_action + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: >- + Occurs when a [run](/docs/api-reference/runs/object) moves to a + `requires_action` status. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.completed + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) is completed. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.incomplete + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: >- + Occurs when a [run](/docs/api-reference/runs/object) ends with + status `incomplete`. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.failed + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) fails. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.cancelling + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: >- + Occurs when a [run](/docs/api-reference/runs/object) moves to a + `cancelling` status. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.cancelled + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) is cancelled. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.expired + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) expires. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + 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](/docs/api-reference/runs/submitToolOutputs) endpoint. + 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 + description: The function definition. + properties: + 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. + required: + - name + - arguments + required: + - id + - type + - function + ServiceTier: + anyOf: + - type: string + 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](/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier. + - When not set, the default behavior is 'auto'. + + When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. + enum: + - auto + - default + - flex + - scale + - priority + default: auto + - type: 'null' + SpeechAudioDeltaEvent: + type: object + description: Emitted for each chunk of audio data generated during speech synthesis. + properties: + type: + type: string + description: | + The type of the event. Always `speech.audio.delta`. + enum: + - speech.audio.delta + x-stainless-const: true + audio: + type: string + description: | + A chunk of Base64-encoded audio data. + required: + - type + - audio + x-oaiMeta: + name: Stream Event (speech.audio.delta) + group: speech + example: | + { + "type": "speech.audio.delta", + "audio": "base64-encoded-audio-data" + } + SpeechAudioDoneEvent: + type: object + description: >- + Emitted when the speech synthesis is complete and all audio has been + streamed. + properties: + type: + type: string + description: | + The type of the event. Always `speech.audio.done`. + enum: + - speech.audio.done + x-stainless-const: true + usage: + type: object + description: | + Token usage statistics for the request. + 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 + required: + - type + - usage + x-oaiMeta: + name: Stream Event (speech.audio.done) + group: speech + example: | + { + "type": "speech.audio.done", + "usage": { + "input_tokens": 14, + "output_tokens": 101, + "total_tokens": 115 + } + } + 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`. + + + Note that the overlap must not exceed half of + `max_chunk_size_tokens`. + 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' + required: + - type + - static + StopConfiguration: + description: | + Not supported with latest reasoning models `o3` and `o4-mini`. + + Up to 4 sequences where the API will stop generating further tokens. The + returned text will not contain the stop sequence. + default: null + nullable: true + oneOf: + - type: string + default: <|endoftext|> + example: |+ + + 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. + - type: 'null' + required: + - tool_outputs + TextResponseFormatConfiguration: + description: > + An object specifying the format that the model must output. + + + Configuring `{ "type": "json_schema" }` enables Structured Outputs, + + which ensures the model will match your supplied JSON schema. Learn more + in the + + [Structured Outputs guide](/docs/guides/structured-outputs). + + + The default format is `{ "type": "text" }` with no additional options. + + + **Not recommended for gpt-4o and newer models:** + + + Setting to `{ "type": "json_object" }` enables the older JSON mode, + which + + ensures the message the model generates is valid JSON. Using + `json_schema` + + is preferred for models that support it. + oneOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/TextResponseFormatJsonSchema' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + TextResponseFormatJsonSchema: + type: object + title: JSON schema + description: | + JSON Schema response format. Used to generate structured JSON responses. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). + properties: + type: + type: string + description: The type of response format being defined. Always `json_schema`. + enum: + - json_schema + x-stainless-const: true + description: + type: string + description: > + A description of what the response format is for, used by the model + to + + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: > + Whether to enable strict schema adherence when generating the + output. + + If set to true, the model will always follow the exact schema + defined + + in the `schema` field. Only a subset of JSON Schema is supported + when + + `strict` is `true`. To learn more, read the [Structured Outputs + + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - type + - schema + - name + ThreadObject: + type: object + title: Thread + description: >- + Represents a thread that contains + [messages](/docs/api-reference/messages). + 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 + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector + store](/docs/api-reference/vector-stores/object) + attached to this thread. There can be a maximum of 1 + vector store attached to the thread. + maxItems: 1 + items: + type: string + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - id + - object + - created_at + - tool_resources + - metadata + x-oaiMeta: + name: The thread object + beta: true + example: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1698107661, + "metadata": {} + } + 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](/docs/api-reference/threads/object) is + created. + x-oaiMeta: + dataDescription: '`data` is a [thread](/docs/api-reference/threads/object)' + ToggleCertificatesRequest: + type: object + properties: + certificate_ids: + type: array + items: + type: string + example: cert_abc + minItems: 1 + maxItems: 10 + required: + - certificate_ids + Tool: + description: | + A tool that can be used to generate a response. + discriminator: + propertyName: type + oneOf: + - $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/ImageGenTool' + - $ref: '#/components/schemas/LocalShellToolParam' + - $ref: '#/components/schemas/FunctionShellToolParam' + - $ref: '#/components/schemas/CustomToolParam' + - $ref: '#/components/schemas/NamespaceToolParam' + - $ref: '#/components/schemas/ToolSearchToolParam' + - $ref: '#/components/schemas/WebSearchPreviewTool' + - $ref: '#/components/schemas/ApplyPatchToolParam' + ToolChoiceAllowed: + type: object + title: Allowed tools + description: | + Constrains the tools available to the model to a pre-defined set. + properties: + type: + type: string + enum: + - allowed_tools + description: Allowed tool configuration type. Always `allowed_tools`. + x-stainless-const: true + mode: + type: string + enum: + - auto + - required + description: > + Constrains the tools available to the model to a pre-defined set. + + + `auto` allows the model to pick from among the allowed tools and + generate a + + message. + + + `required` requires the model to call one or more of the allowed + tools. + tools: + type: array + description: | + A list of tool definitions that the model should be allowed to call. + + For the Responses API, the list of tool definitions might look like: + ```json + [ + { "type": "function", "name": "get_weather" }, + { "type": "mcp", "server_label": "deepwiki" }, + { "type": "image_generation" } + ] + ``` + items: + type: object + description: | + A tool definition that the model should be allowed to call. + additionalProperties: true + x-oaiExpandable: false + required: + - type + - mode + - tools + ToolChoiceCustom: + type: object + title: Custom tool + description: | + Use this option 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 + name: + type: string + description: The name of the custom tool to call. + required: + - type + - name + ToolChoiceFunction: + type: object + title: Function tool + description: | + Use this option 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 + name: + type: string + description: The name of the function to call. + required: + - type + - name + ToolChoiceMCP: + type: object + title: MCP tool + description: > + Use this option to force the model to call a specific tool on a remote + MCP server. + properties: + type: + type: string + enum: + - mcp + description: For MCP tools, the type is always `mcp`. + x-stainless-const: true + server_label: + type: string + description: | + The label of the MCP server to use. + name: + anyOf: + - type: string + description: | + The name of the tool to call on the server. + - type: 'null' + required: + - type + - server_label + ToolChoiceOptions: + type: string + title: Tool choice mode + description: > + Controls which (if any) tool is called by the model. + + + `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. + enum: + - none + - auto + - required + ToolChoiceParam: + description: | + How the model should select which tool (or tools) to use when generating + a response. See the `tools` parameter to see how to specify which tools + the model can call. + oneOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceAllowed' + - $ref: '#/components/schemas/ToolChoiceTypes' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + - $ref: '#/components/schemas/ToolChoiceCustom' + - $ref: '#/components/schemas/SpecificApplyPatchParam' + - $ref: '#/components/schemas/SpecificFunctionShellParam' + ToolChoiceTypes: + type: object + title: Hosted tool + description: > + Indicates that the model should use a built-in tool to generate a + response. + + [Learn more about built-in tools](/docs/guides/tools). + properties: + type: + type: string + description: | + The type of hosted tool the model should to use. Learn more about + [built-in tools](/docs/guides/tools). + + Allowed values are: + - `file_search` + - `web_search_preview` + - `computer` + - `computer_use_preview` + - `computer_use` + - `code_interpreter` + - `image_generation` + enum: + - file_search + - web_search_preview + - computer + - computer_use_preview + - computer_use + - web_search_preview_2025_03_11 + - image_generation + - code_interpreter + required: + - type + ToolsArray: + 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. + + + We support the following categories of tools: + + - **Built-in tools**: Tools that are provided by OpenAI that extend the + model's capabilities, like [web search](/docs/guides/tools-web-search) + or [file search](/docs/guides/tools-file-search). Learn more about + [built-in tools](/docs/guides/tools). + - **MCP Tools**: Integrations with third-party systems via custom MCP + servers + or predefined connectors such as Google Drive and SharePoint. Learn more about + [MCP Tools](/docs/guides/tools-connectors-mcp). + - **Function calls (custom tools)**: Functions that are defined by you, + enabling the model to call your own code with strongly typed arguments + and outputs. Learn more about + [function calling](/docs/guides/function-calling). You can also use + custom tools to call your own code. + 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](/docs/api-reference/audio/create-transcription) + with the `Stream` parameter set to `true`. + properties: + type: + type: string + description: | + The type of the event. Always `transcript.text.delta`. + enum: + - transcript.text.delta + x-stainless-const: true + delta: + type: string + description: | + The text delta that was additionally transcribed. + logprobs: + type: array + description: > + The log probabilities of the delta. Only included if you [create a + transcription](/docs/api-reference/audio/create-transcription) with + the `include[]` parameter set to `logprobs`. + items: + type: object + properties: + token: + type: string + description: | + The token that was used to generate the log probability. + logprob: + type: number + description: | + The log probability of the token. + bytes: + type: array + items: + type: integer + description: | + The bytes that were used to generate the log probability. + segment_id: + type: string + description: > + Identifier of the diarized segment that this delta belongs to. Only + present when using `gpt-4o-transcribe-diarize`. + required: + - type + - delta + x-oaiMeta: + name: Stream Event (transcript.text.delta) + group: transcript + example: | + { + "type": "transcript.text.delta", + "delta": " wonderful" + } + TranscriptTextDoneEvent: + type: object + description: >- + Emitted when the transcription is complete. Contains the complete + transcription text. Only emitted when you [create a + transcription](/docs/api-reference/audio/create-transcription) with the + `Stream` parameter set to `true`. + properties: + type: + type: string + description: | + The type of the event. Always `transcript.text.done`. + enum: + - transcript.text.done + x-stainless-const: true + text: + type: string + description: | + The text that was transcribed. + logprobs: + type: array + description: > + The log probabilities of the individual tokens in the transcription. + Only included if you [create a + transcription](/docs/api-reference/audio/create-transcription) with + the `include[]` parameter set to `logprobs`. + items: + type: object + properties: + token: + type: string + description: | + The token that was used to generate the log probability. + logprob: + type: number + description: | + The log probability of the token. + bytes: + type: array + items: + type: integer + description: | + The bytes that were used to generate the log probability. + usage: + $ref: '#/components/schemas/TranscriptTextUsageTokens' + required: + - type + - text + x-oaiMeta: + name: Stream Event (transcript.text.done) + group: transcript + example: | + { + "type": "transcript.text.done", + "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.", + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 10, + "audio_tokens": 4 + }, + "output_tokens": 31, + "total_tokens": 45 + } + } + TranscriptTextSegmentEvent: + type: object + description: > + Emitted when a diarized transcription returns a completed segment with + speaker information. Only emitted when you [create a + transcription](/docs/api-reference/audio/create-transcription) with + `stream` set to `true` and `response_format` set to `diarized_json`. + properties: + type: + type: string + description: The type of the event. Always `transcript.text.segment`. + enum: + - transcript.text.segment + 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. + speaker: + type: string + description: Speaker label for this segment. + required: + - type + - id + - start + - end + - text + - speaker + x-oaiMeta: + name: Stream Event (transcript.text.segment) + group: transcript + example: | + { + "type": "transcript.text.segment", + "id": "seg_002", + "start": 5.2, + "end": 12.8, + "text": "Hi, I need help with diarization.", + "speaker": "A" + } + 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 + TranscriptTextUsageTokens: + type: object + title: Token Usage + description: Usage statistics for models billed by token usage. + properties: + type: + type: string + enum: + - tokens + description: The type of the usage object. Always `tokens` for this variant. + x-stainless-const: true + input_tokens: + type: integer + description: Number of input tokens billed for this request. + 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: Number of output tokens generated. + total_tokens: + type: integer + description: Total number of tokens used (input + output). + required: + - type + - input_tokens + - output_tokens + - total_tokens + TranscriptionChunkingStrategy: + type: object + 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. + oneOf: + - type: string + enum: + - auto + default: + - auto + description: > + Automatically set chunking parameters based on the audio. Must be + set to `"auto"`. + x-stainless-const: true + - $ref: '#/components/schemas/VadConfig' + TranscriptionDiarizedSegment: + type: object + description: A segment of diarized transcript text with speaker metadata. + properties: + type: + type: string + description: | + The type of the segment. Always `transcript.text.segment`. + enum: + - transcript.text.segment + 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. + 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`, ...). + required: + - type + - id + - start + - end + - text + - speaker + TranscriptionInclude: + type: string + enum: + - logprobs + default: [] + TranscriptionSegment: + type: object + 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. + end: + type: number + format: double + description: End time of the segment in seconds. + text: + 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. + 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. + 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: + - 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 + 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: New display name for the group. + minLength: 1 + maxLength: 255 + required: + - name + x-oaiMeta: + example: | + { + "name": "Escalations" + } + UpdateVectorStoreFileAttributesRequest: + type: object + additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + required: + - attributes + x-oaiMeta: + name: Update vector store file attributes request + UpdateVectorStoreRequest: + type: object + additionalProperties: false + properties: + name: + description: The name of the vector store. + type: string + nullable: true + 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 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. + 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: + 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](/docs/api-reference/files/object#files/object-purpose) for + acceptable values. + status: + type: string + description: The status of the Upload. + enum: + - pending + - completed + - cancelled + - expired + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the Upload will expire. + object: + type: string + description: The object type, which is always "upload". + enum: + - upload + x-stainless-const: true + file: + allOf: + - $ref: '#/components/schemas/OpenAIFile' + - nullable: true + description: The ready File object after the Upload is completed. + required: + - bytes + - created_at + - expires_at + - filename + - id + - purpose + - status + x-oaiMeta: + name: The upload object + example: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "completed", + "expires_at": 1719127296, + "file": { + "id": "file-xyz321", + "object": "file", + "bytes": 2147483648, + "created_at": 1719186911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + } + } + UploadCertificateRequest: + type: object + properties: + name: + type: string + description: An optional name for the certificate + certificate: + type: string + description: The certificate content in PEM format + required: + - certificate + UploadPart: + type: object + title: UploadPart + description: > + The upload Part represents a chunk of bytes we can add to an Upload + object. + 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. + 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: + - upload.part + x-stainless-const: true + required: + - created_at + - id + - object + - upload_id + x-oaiMeta: + name: The upload part object + example: | + { + "id": "part_def456", + "object": "upload.part", + "created_at": 1719186911, + "upload_id": "upload_abc123" + } + UsageAudioSpeechesResult: + type: object + description: The aggregated audio speeches usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.audio_speeches.result + 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. + 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: + - object + - characters + - num_model_requests + x-oaiMeta: + name: Audio speeches usage object + example: | + { + "object": "organization.usage.audio_speeches.result", + "characters": 45, + "num_model_requests": 1, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "tts-1" + } + UsageAudioTranscriptionsResult: + type: object + description: >- + The aggregated audio transcriptions usage details of the specific time + bucket. + 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: + 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: + - object + - seconds + - num_model_requests + x-oaiMeta: + name: Audio transcriptions usage object + example: | + { + "object": "organization.usage.audio_transcriptions.result", + "seconds": 10, + "num_model_requests": 1, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "tts-1" + } + UsageCodeInterpreterSessionsResult: + type: object + description: >- + The aggregated code interpreter sessions usage details of the specific + time bucket. + properties: + object: + type: string + enum: + - organization.usage.code_interpreter_sessions.result + 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' + required: + - object + - num_sessions + x-oaiMeta: + name: Code interpreter sessions usage object + example: | + { + "object": "organization.usage.code_interpreter_sessions.result", + "num_sessions": 1, + "project_id": "proj_abc" + } + UsageCompletionsResult: + type: object + description: The aggregated completions usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.completions.result + x-stainless-const: true + input_tokens: + type: integer + description: >- + The aggregated number of text input tokens used, including cached + tokens. For customers subscribe to scale tier, this includes scale + tier tokens. + input_cached_tokens: + type: integer + description: >- + The aggregated number of text input tokens that has been cached from + previous requests. For customers subscribe to scale tier, this + includes scale tier tokens. + output_tokens: + type: integer + description: >- + The aggregated number of text output tokens used. For customers + subscribe to scale tier, this includes scale tier tokens. + input_audio_tokens: + type: integer + description: >- + The aggregated number of audio input tokens used, including cached + tokens. + output_audio_tokens: + type: integer + description: The aggregated number of audio 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. + - 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' + batch: + anyOf: + - type: boolean + description: >- + When `group_by=batch`, this field tells whether the grouped + usage result is batch or not. + - type: 'null' + service_tier: + anyOf: + - type: string + description: >- + When `group_by=service_tier`, this field provides the service + tier of the grouped usage result. + - type: 'null' + required: + - object + - input_tokens + - output_tokens + - num_model_requests + x-oaiMeta: + name: Completions usage object + example: | + { + "object": "organization.usage.completions.result", + "input_tokens": 5000, + "output_tokens": 1000, + "input_cached_tokens": 4000, + "input_audio_tokens": 300, + "output_audio_tokens": 200, + "num_model_requests": 5, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "gpt-4o-mini-2024-07-18", + "batch": false, + "service_tier": "default" + } + UsageEmbeddingsResult: + type: object + description: The aggregated embeddings usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.embeddings.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' + 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: + - object + - input_tokens + - num_model_requests + x-oaiMeta: + name: Embeddings usage object + example: | + { + "object": "organization.usage.embeddings.result", + "input_tokens": 20, + "num_model_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "text-embedding-ada-002-v2" + } + UsageImagesResult: + type: object + description: The aggregated images usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.images.result + x-stainless-const: true + images: + type: integer + description: The number of images processed. + num_model_requests: + type: integer + 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: + - object + - images + - num_model_requests + x-oaiMeta: + name: Images usage object + example: | + { + "object": "organization.usage.images.result", + "images": 2, + "num_model_requests": 2, + "size": "1024x1024", + "source": "image.generation", + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "dall-e-3" + } + UsageModerationsResult: + type: object + description: The aggregated moderations usage details of the specific time bucket. + properties: + object: + 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' + 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: + - object + - input_tokens + - num_model_requests + x-oaiMeta: + name: Moderations usage object + example: | + { + "object": "organization.usage.moderations.result", + "input_tokens": 20, + "num_model_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "text-moderation" + } + UsageResponse: + type: object + properties: + object: + 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' + required: + - object + - data + - has_more + - next_page + UsageTimeBucket: + type: object + properties: + object: + 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/CostsResult' + discriminator: + propertyName: object + required: + - object + - start_time + - end_time + - results + UsageVectorStoresResult: + type: object + description: The aggregated vector stores usage details of the specific time bucket. + properties: + object: + 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' + required: + - object + - usage_bytes + x-oaiMeta: + name: Vector stores usage object + example: | + { + "object": "organization.usage.vector_stores.result", + "usage_bytes": 1024, + "project_id": "proj_abc" + } + User: + type: object + description: Represents an individual `user` within an organization. + properties: + object: + type: string + enum: + - organization.user + description: The object type, which is always `organization.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: + anyOf: + - 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 + 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: The user object + example: | + { + "object": "organization.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + UserDeleteResponse: + type: object + properties: + object: + type: string + enum: + - organization.user.deleted + x-stainless-const: true + id: + type: string + deleted: + type: boolean + required: + - object + - id + - deleted + UserListResource: + type: object + description: >- + Paginated list of user objects returned when inspecting group + membership. + properties: + object: + 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. + next: + description: >- + Cursor to fetch the next page of results, or `null` when no further + users are available. + anyOf: + - type: string + - type: 'null' + required: + - object + - data + - has_more + - next + x-oaiMeta: + name: Group user list + example: | + { + "object": "list", + "data": [ + { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + } + ], + "has_more": false, + "next": null + } + UserListResponse: + type: object + properties: + object: + type: string + enum: + - list + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/User' + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean + required: + - object + - data + - has_more + UserRoleAssignment: + type: object + description: Role assignment linking a user to a role. + properties: + object: + type: string + enum: + - user.role + description: Always `user.role`. + x-stainless-const: true + user: + $ref: '#/components/schemas/User' + role: + $ref: '#/components/schemas/Role' + required: + - object + - user + - role + x-oaiMeta: + name: The user role object + example: | + { + "object": "user.role", + "user": { + "object": "organization.user", + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com", + "role": "owner", + "added_at": 1711470000 + }, + "role": { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + } + UserRoleUpdateRequest: + type: object + properties: + role: + anyOf: + - type: string + - type: 'null' + description: '`owner` or `reader`' + role_id: + anyOf: + - type: string + - type: 'null' + description: Role ID to assign to the user. + technical_level: + anyOf: + - type: string + - type: 'null' + description: Technical level metadata. + developer_persona: + anyOf: + - type: string + - type: 'null' + description: Developer persona metadata. + VadConfig: + type: object + additionalProperties: false + required: + - type + properties: + type: + 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 + milliseconds). + silence_duration_ms: + type: integer + default: 200 + description: | + Duration of silence to detect speech stop (in milliseconds). + With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + threshold: + type: number + default: 0.5 + description: > + Sensitivity threshold (0.0 to 1.0) for voice activity detection. A + + higher threshold will require louder audio to activate the model, + and + + thus might perform better in noisy environments. + ValidateGraderRequest: + 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' + required: + - grader + ValidateGraderResponse: + 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' + VectorStoreExpirationAfter: + 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: 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 + required: + - anchor + - days + VectorStoreFileAttributes: + anyOf: + - 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. Keys are + strings + + with a maximum length of 64 characters. Values are strings with a + maximum + + length of 512 characters, booleans, or numbers. + maxProperties: 16 + propertyNames: + type: string + maxLength: 64 + additionalProperties: + oneOf: + - type: string + maxLength: 512 + - type: number + - type: boolean + x-oaiTypeLabel: map + - type: 'null' + VectorStoreFileBatchObject: + 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: 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](/docs/api-reference/vector-stores/object) that the + [File](/docs/api-reference/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: + - id + - object + - created_at + - vector_store_id + - status + - file_counts + x-oaiMeta: + name: The vector store files batch object + beta: true + example: | + { + "id": "vsfb_123", + "object": "vector_store.files_batch", + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "failed": 0, + "cancelled": 0, + "total": 100 + } + } + VectorStoreFileContentResponse: + type: object + description: Represents the parsed content of a vector store file. + properties: + object: + 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' + required: + - object + - data + - has_more + - next_page + VectorStoreFileObject: + 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: 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 + vector_store_id: + description: >- + The ID of the [vector + store](/docs/api-reference/vector-stores/object) that the + [File](/docs/api-reference/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: + - 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' + 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: | + { + "id": "file-abc123", + "object": "vector_store.file", + "usage_bytes": 1234, + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "last_error": null, + "chunking_strategy": { + "type": "static", + "static": { + "max_chunk_size_tokens": 800, + "chunk_overlap_tokens": 400 + } + } + } + VectorStoreObject: + 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: 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 + 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 + enum: + - expired + - in_progress + - completed + expires_after: + $ref: '#/components/schemas/VectorStoreExpirationAfter' + 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: + - id + - object + - usage_bytes + - created_at + - status + - last_active_at + - name + - file_counts + - metadata + x-oaiMeta: + name: The vector store object + example: | + { + "id": "vs_123", + "object": "vector_store", + "created_at": 1698107661, + "usage_bytes": 123456, + "last_active_at": 1698107661, + "name": "my_vector_store", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "cancelled": 0, + "failed": 0, + "total": 100 + }, + "last_used_at": 1698107661 + } + VectorStoreSearchRequest: + type: object + additionalProperties: false + properties: + 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 + rewrite_query: + description: Whether to rewrite the natural language query for vector search. + type: boolean + default: false + 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 + filters: + description: A filter to apply based on file attributes. + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $ref: '#/components/schemas/CompoundFilter' + 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 + VectorStoreSearchResultContentObject: + type: object + additionalProperties: false + properties: + type: + description: The type of content. + type: string + enum: + - text + text: + description: The text content returned from search. + type: string + required: + - type + - text + x-oaiMeta: + name: Vector store search result content object + VectorStoreSearchResultItem: + type: object + additionalProperties: false + properties: + file_id: + type: string + description: The ID of the vector store file. + filename: + 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' + required: + - file_id + - filename + - score + - attributes + - content + x-oaiMeta: + name: Vector store search result item + VectorStoreSearchResultsPage: + type: object + additionalProperties: false + properties: + object: + 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' + has_more: + type: boolean + description: Indicates if there are more results to fetch. + next_page: + anyOf: + - type: string + description: The token for the next page, if any. + - type: 'null' + required: + - object + - search_query + - data + - has_more + - next_page + x-oaiMeta: + name: Vector store search results page + Verbosity: + anyOf: + - type: string + enum: + - low + - medium + - high + default: medium + description: > + Constrains the verbosity of the model's response. Lower values will + result in + + more concise responses, while higher values will result in more + verbose responses. + + Currently supported values are `low`, `medium`, and `high`. + - type: 'null' + VoiceConsentDeletedResource: + type: object + additionalProperties: false + properties: + id: + type: string + description: The consent recording identifier. + example: cons_1234 + object: + type: string + enum: + - audio.voice_consent + x-stainless-const: true + deleted: + type: boolean + required: + - id + - object + - deleted + x-oaiMeta: + name: The voice consent deletion object + example: | + { + "object": "audio.voice_consent", + "id": "cons_1234", + "deleted": true + } + VoiceConsentListResource: + type: object + additionalProperties: false + properties: + object: + type: string + enum: + - list + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/VoiceConsentResource' + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean + required: + - object + - data + - has_more + x-oaiMeta: + name: The voice consent list object + example: | + { + "object": "list", + "data": [ + { + "object": "audio.voice_consent", + "id": "cons_1234", + "name": "John Doe", + "language": "en-US", + "created_at": 1734220800 + } + ], + "first_id": "cons_1234", + "last_id": "cons_1234", + "has_more": false + } + VoiceConsentResource: + 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 + name: + type: string + description: The label provided when the consent recording was uploaded. + language: + type: string + description: >- + The BCP 47 language tag for the consent phrase (for example, + `en-US`). + created_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the consent recording was + created. + required: + - object + - id + - name + - language + - created_at + x-oaiMeta: + name: The voice consent object + example: | + { + "object": "audio.voice_consent", + "id": "cons_1234", + "name": "John Doe", + "language": "en-US", + "created_at": 1734220800 + } + VoiceIdsOrCustomVoice: + title: Voice + description: | + A built-in voice name or a custom voice reference. + 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 + title: Voice + description: A custom voice that can be used for audio output. + additionalProperties: false + properties: + object: + 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. + name: + type: string + description: The name of the voice. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the voice was created. + required: + - object + - id + - name + - created_at + x-oaiMeta: + name: The voice object + example: | + { + "object": "audio.voice", + "id": "voice_123abc", + "name": "My new voice", + "created_at": 1734220800 + } + WebSearchActionFind: + type: object + title: Find action + description: | + Action type "find_in_page": Searches for a pattern within a loaded page. + properties: + type: + type: string + enum: + - find_in_page + description: | + The action type. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the page searched for the pattern. + pattern: + type: string + description: | + The pattern or text to search for within the page. + required: + - type + - url + - pattern + WebSearchActionOpenPage: + type: object + title: Open page action + description: | + Action type "open_page" - Opens a specific URL from search results. + properties: + type: + type: string + enum: + - open_page + description: | + The action type. + x-stainless-const: true + url: + description: | + The URL opened by the model. + anyOf: + - type: string + format: uri + - type: 'null' + required: + - type + WebSearchActionSearch: + type: object + title: Search action + description: | + Action type "search" - Performs a web search query. + properties: + type: + type: string + enum: + - search + description: | + The action type. + x-stainless-const: true + query: + type: string + description: | + [DEPRECATED] The search query. + queries: + type: array + title: Search queries + description: | + The search queries. + items: + type: string + description: | + A search query. + sources: + type: array + title: Web search sources + description: | + The sources used in the search. + items: + type: object + title: Web search source + description: | + A source used in the search. + properties: + type: + type: string + enum: + - url + description: | + The type of source. Always `url`. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the source. + required: + - type + - url + required: + - type + - query + WebSearchApproximateLocation: + anyOf: + - type: object + title: Web search approximate location + description: | + The approximate location of the user. + 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 + + search. One of `low`, `medium`, or `high`. `medium` is the default. + enum: + - low + - medium + - high + default: medium + WebSearchLocation: + type: object + title: Web search location + description: Approximate location parameters for the search. + properties: + country: + type: string + description: > + The two-letter + + [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the + user, + + e.g. `US`. + region: + type: string + description: | + Free text input for the region of the user, e.g. `California`. + city: + type: string + description: | + Free text input for the city of the user, e.g. `San Francisco`. + timezone: + type: string + description: > + The [IANA + timezone](https://timeapi.io/documentation/iana-timezones) + + of the user, e.g. `America/Los_Angeles`. + WebSearchTool: + type: object + title: Web search + description: > + Search the Internet for sources related to the prompt. Learn more about + the + + [web search tool](/docs/guides/tools-web-search). + properties: + type: + 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 + filters: + anyOf: + - type: object + description: | + Filters for the search. + 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. + + Subdomains of the provided domains are allowed as well. + + + Example: `["pubmed.ncbi.nlm.nih.gov"]` + items: + type: string + description: Allowed domain for the search. + default: [] + - type: 'null' + - type: 'null' + user_location: + $ref: '#/components/schemas/WebSearchApproximateLocation' + search_context_size: + 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. + required: + - type + WebSearchToolCall: + type: object + title: Web search tool call + description: | + The results of a web search tool call. See the + [web search guide](/docs/guides/tools-web-search) for more information. + properties: + id: + type: string + description: | + The unique ID of the web search tool call. + type: + type: string + enum: + - web_search_call + description: | + The type of the web search tool call. Always `web_search_call`. + x-stainless-const: true + status: + type: string + description: | + The status of the web search tool call. + enum: + - in_progress + - searching + - completed + - failed + action: + type: object + description: > + An object describing the specific action taken in this web search + call. + + Includes details on how the model used the web (search, open_page, + find_in_page). + oneOf: + - $ref: '#/components/schemas/WebSearchActionSearch' + - $ref: '#/components/schemas/WebSearchActionOpenPage' + - $ref: '#/components/schemas/WebSearchActionFind' + discriminator: + propertyName: type + required: + - id + - type + - status + - action + WebhookBatchCancelled: + type: object + title: batch.cancelled + description: | + Sent when a batch API request has been cancelled. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.cancelled`. + enum: + - batch.cancelled + x-stainless-const: true + x-oaiMeta: + name: batch.cancelled + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "batch.cancelled", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } + } + WebhookBatchCompleted: + type: object + title: batch.completed + description: | + Sent when a batch API request has been completed. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.completed`. + enum: + - batch.completed + x-stainless-const: true + x-oaiMeta: + name: batch.completed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "batch.completed", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } + } + WebhookBatchExpired: + type: object + title: batch.expired + description: | + Sent when a batch API request has expired. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.expired`. + enum: + - batch.expired + x-stainless-const: true + x-oaiMeta: + name: batch.expired + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "batch.expired", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } + } + WebhookBatchFailed: + type: object + title: batch.failed + description: | + Sent when a batch API request has failed. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.failed`. + enum: + - batch.failed + x-stainless-const: true + x-oaiMeta: + name: batch.failed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "batch.failed", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } + } + WebhookEvalRunCanceled: + type: object + title: eval.run.canceled + description: | + Sent when an eval run has been canceled. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the eval run. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `eval.run.canceled`. + enum: + - eval.run.canceled + x-stainless-const: true + x-oaiMeta: + name: eval.run.canceled + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "eval.run.canceled", + "created_at": 1719168000, + "data": { + "id": "evalrun_abc123" + } + } + WebhookEvalRunFailed: + type: object + title: eval.run.failed + description: | + Sent when an eval run has failed. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the eval run. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `eval.run.failed`. + enum: + - eval.run.failed + x-stainless-const: true + x-oaiMeta: + name: eval.run.failed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "eval.run.failed", + "created_at": 1719168000, + "data": { + "id": "evalrun_abc123" + } + } + WebhookEvalRunSucceeded: + type: object + title: eval.run.succeeded + description: | + Sent when an eval run has succeeded. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the eval run. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `eval.run.succeeded`. + enum: + - eval.run.succeeded + x-stainless-const: true + x-oaiMeta: + name: eval.run.succeeded + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "eval.run.succeeded", + "created_at": 1719168000, + "data": { + "id": "evalrun_abc123" + } + } + WebhookFineTuningJobCancelled: + type: object + title: fine_tuning.job.cancelled + description: | + Sent when a fine-tuning job has been cancelled. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the fine-tuning job. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `fine_tuning.job.cancelled`. + enum: + - fine_tuning.job.cancelled + x-stainless-const: true + x-oaiMeta: + name: fine_tuning.job.cancelled + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "fine_tuning.job.cancelled", + "created_at": 1719168000, + "data": { + "id": "ftjob_abc123" + } + } + WebhookFineTuningJobFailed: + type: object + title: fine_tuning.job.failed + description: | + Sent when a fine-tuning job has failed. + 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 failed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the fine-tuning job. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `fine_tuning.job.failed`. + enum: + - fine_tuning.job.failed + x-stainless-const: true + x-oaiMeta: + name: fine_tuning.job.failed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "fine_tuning.job.failed", + "created_at": 1719168000, + "data": { + "id": "ftjob_abc123" + } + } + WebhookFineTuningJobSucceeded: + type: object + title: fine_tuning.job.succeeded + description: | + Sent when a fine-tuning job has succeeded. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the fine-tuning job. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `fine_tuning.job.succeeded`. + enum: + - fine_tuning.job.succeeded + x-stainless-const: true + x-oaiMeta: + name: fine_tuning.job.succeeded + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "fine_tuning.job.succeeded", + "created_at": 1719168000, + "data": { + "id": "ftjob_abc123" + } + } + WebhookRealtimeCallIncoming: + type: object + title: realtime.call.incoming + description: | + Sent when Realtime API Receives a incoming SIP call. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the model response was + completed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - call_id + - sip_headers + properties: + call_id: + type: string + description: | + The unique ID of this call. + sip_headers: + type: array + description: | + Headers from the SIP Invite. + items: + type: object + description: | + A header from the SIP Invite. + required: + - name + - value + properties: + name: + type: string + description: | + Name of the SIP Header. + value: + type: string + description: | + Value of the SIP Header. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `realtime.call.incoming`. + enum: + - realtime.call.incoming + x-stainless-const: true + x-oaiMeta: + name: realtime.call.incoming + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "realtime.call.incoming", + "created_at": 1719168000, + "data": { + "call_id": "rtc_479a275623b54bdb9b6fbae2f7cbd408", + "sip_headers": [ + {"name": "Max-Forwards", "value": "63"}, + {"name": "CSeq", "value": "851287 INVITE"}, + {"name": "Content-Type", "value": "application/sdp"}, + ] + } + } + WebhookResponseCancelled: + type: object + title: response.cancelled + description: | + Sent when a background response has been cancelled. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the model response was + cancelled. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.cancelled`. + enum: + - response.cancelled + x-stainless-const: true + x-oaiMeta: + name: response.cancelled + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.cancelled", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + WebhookResponseCompleted: + type: object + title: response.completed + description: | + Sent when a background response has been completed. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the model response was + completed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.completed`. + enum: + - response.completed + x-stainless-const: true + x-oaiMeta: + name: response.completed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.completed", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + WebhookResponseFailed: + type: object + title: response.failed + description: | + Sent when a background response has failed. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the model response failed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.failed`. + enum: + - response.failed + x-stainless-const: true + x-oaiMeta: + name: response.failed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.failed", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + WebhookResponseIncomplete: + type: object + title: response.incomplete + description: | + Sent when a background response has been interrupted. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the model response was + interrupted. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.incomplete`. + enum: + - response.incomplete + x-stainless-const: true + x-oaiMeta: + name: response.incomplete + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.incomplete", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + 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 + skill_id: + type: string + maxLength: 64 + minLength: 1 + description: The ID of the referenced skill. + 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 + 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. + 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 + name: + type: string + description: The name of the skill. + 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: + + - `web_search_call.results`: Include the search results of the web + search tool call. + + - `web_search_call.action.sources`: Include the sources of the web + search tool call. + + - `code_interpreter_call.outputs`: Includes the outputs of python code + execution in code interpreter tool call items. + + - `computer_call_output.output.image_url`: Include image urls from the + computer call output. + + - `file_search_call.results`: Include the search results of the file + search tool call. + + - `message.input_image.image_url`: Include image urls from the input + message. + + - `message.output_text.logprobs`: Include logprobs with assistant + messages. + + - `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 + 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. + 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 of the file in the list of files. + 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. + start_index: + type: integer + description: >- + The index of the first character of the container file citation in + the message. + 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: + - $ref: '#/components/schemas/FileCitationBody' + - $ref: '#/components/schemas/UrlCitationBody' + - $ref: '#/components/schemas/ContainerFileCitationBody' + - $ref: '#/components/schemas/FilePath' + description: An annotation that applies to a span of output text. + discriminator: + propertyName: type + TopLogProb: + properties: + token: + type: string + logprob: + type: number + 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 + logprob: + type: number + bytes: + items: + type: integer + type: array + 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 + text: + type: string + description: The text output from the model. + annotations: + items: + $ref: '#/components/schemas/Annotation' + type: array + description: The annotations of the text output. + 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 + 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 + 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 + 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 + 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' + file_id: + anyOf: + - type: string + description: The ID of the file to be sent to the model. + - type: 'null' + 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`. + type: object + required: + - type + - detail + title: Input image + description: >- + An image input to the model. Learn about [image + inputs](/docs/guides/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: + - type: string + format: uri + description: The URL of the screenshot image. + - type: 'null' + file_id: + anyOf: + - type: string + description: The identifier of an uploaded file that contains the screenshot. + - 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`. + type: object + required: + - type + - image_url + - file_id + - detail + title: Computer screenshot + description: A screenshot of a computer. + FileInputDetail: + type: string + enum: + - 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: + - type: string + description: The ID of the file to be sent to the model. + - type: 'null' + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + 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 `low` for + the default rendering behavior, or `high` to render the file at + higher quality. Defaults to `low`. + type: object + required: &ref_0 + - type + title: Input file + description: A file input to the model. + MessagePhase-2: + type: string + enum: + - commentary + - final_answer + 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/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: 'null' + type: object + required: + - type + - id + - status + - role + - content + title: Message + description: A message to or from the model. + FunctionCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + FunctionCallOutputStatusEnum: + type: string + enum: + - in_progress + - completed + - incomplete + 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: + anyOf: + - items: + type: string + type: array + description: The keys being held while clicking. + - 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: + 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 + 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 + + ``` + + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ] + + ``` + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while dragging the mouse. + - type: 'null' + 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 + keys: + items: + 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 + x: + type: integer + description: The x-coordinate to move to. + 'y': + type: integer + description: The y-coordinate to move to. + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while moving the mouse. + - 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 + 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: + - items: + type: string + type: array + description: The keys being held while scrolling. + - 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: object + required: + - type + - text + title: Type + description: An action to type in text. + WaitParam: + 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 + type: object + required: + - type + title: Wait + description: A wait action. + ComputerCallSafetyCheckParam: + properties: + id: + type: string + description: The ID of the pending safety check. + code: + anyOf: + - type: string + 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: + - id + description: A pending safety check for the computer call. + ComputerCallOutputStatus: + type: string + enum: + - completed + - incomplete + - failed + ToolSearchExecutionType: + type: string + enum: + - server + - client + ToolSearchCall: + properties: + 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 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 + FunctionTool: + properties: + type: + type: string + enum: + - function + description: The type of the function tool. Always `function`. + default: function + x-stainless-const: true + name: + type: string + description: The name of the function to call. + 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' + strict: + anyOf: + - type: boolean + description: Whether to enforce strict parameter validation. Default `true`. + - type: 'null' + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + 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://platform.openai.com/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. + type: object + required: + - embedding_weight + - text_weight + RankingOptions: + properties: + 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: + type: string + enum: + - file_search + description: The type of the file search tool. Always `file_search`. + default: file_search + x-stainless-const: true + 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: + - 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://platform.openai.com/docs/guides/tools-file-search). + ComputerTool: + properties: + type: + type: string + enum: + - computer + description: The type of the computer tool. Always `computer`. + default: computer + x-stainless-const: true + type: object + required: + - type + title: Computer + description: >- + A tool that controls a virtual computer. Learn more about the [computer + tool](https://platform.openai.com/docs/guides/tools-computer-use). + ComputerEnvironment: + type: string + enum: + - windows + - mac + - linux + - ubuntu + - browser + ComputerUsePreviewTool: + properties: + type: + type: string + enum: + - computer_use_preview + description: The type of the computer use tool. Always `computer_use_preview`. + default: computer_use_preview + x-stainless-const: true + 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: + - 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://platform.openai.com/docs/guides/tools-computer-use). + ContainerMemoryLimit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + AutoCodeInterpreterToolParam: + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + anyOf: + - $ref: '#/components/schemas/ContainerMemoryLimit' + description: The memory limit for the code interpreter container. + - type: 'null' + network_policy: + oneOf: + - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' + - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' + description: Network access policy for the container. + discriminator: + propertyName: type + 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. + 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`. + ImageGenActionEnum: + type: string + enum: + - generate + - edit + - auto + LocalShellToolParam: + properties: + type: + type: string + enum: + - local_shell + description: The type of the local shell tool. Always `local_shell`. + default: local_shell + x-stainless-const: true + type: object + required: + - type + title: Local shell tool + description: >- + A tool that allows the model to execute shell commands in a local + environment. + ContainerAutoParam: + properties: + type: + type: string + enum: + - container_auto + description: Automatically creates a container for this request + default: container_auto + 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. + memory_limit: + anyOf: + - $ref: '#/components/schemas/ContainerMemoryLimit' + description: The memory limit for the container. + - type: 'null' + network_policy: + oneOf: + - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' + - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' + description: Network access policy for the container. + discriminator: + propertyName: type + 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. + type: object + required: + - type + LocalSkillParam: + properties: + name: + type: string + description: The name of the skill. + description: + type: string + description: The description of the skill. + path: + type: string + description: The path to the directory containing the skill. + type: object + required: + - name + - description + - path + LocalEnvironmentParam: + properties: + type: + type: string + enum: + - local + 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. + type: object + required: + - type + ContainerReferenceParam: + properties: + type: + type: string + enum: + - container_reference + description: References a container created with the /v1/containers endpoint + default: container_reference + x-stainless-const: true + container_id: + type: string + description: The ID of the referenced container. + example: cntr_123 + type: object + required: + - type + - container_id + FunctionShellToolParam: + properties: + type: + type: string + enum: + - shell + description: The type of the shell tool. Always `shell`. + default: shell + x-stainless-const: true + environment: + anyOf: + - oneOf: + - $ref: '#/components/schemas/ContainerAutoParam' + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + discriminator: + propertyName: type + - type: 'null' + type: object + required: + - type + title: Shell tool + description: A tool that allows the model to execute shell commands. + CustomTextFormatParam: + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + x-stainless-const: true + type: object + required: + - type + title: Text format + description: Unconstrained free-form text. + GrammarSyntax1: + type: string + enum: + - lark + - regex + CustomGrammarFormatParam: + properties: + type: + type: string + enum: + - grammar + description: Grammar format. Always `grammar`. + default: grammar + 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. + type: object + required: + - type + - syntax + - definition + title: Grammar format + description: A grammar defined by the user. + CustomToolParam: + properties: + type: + type: string + enum: + - custom + description: The type of the custom tool. Always `custom`. + default: custom + x-stainless-const: true + 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. + format: + oneOf: + - $ref: '#/components/schemas/CustomTextFormatParam' + - $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. + type: object + required: + - type + - name + title: Custom tool + description: >- + A custom tool that processes input using a specified format. Learn more + about [custom tools](/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_-]+$ + description: + anyOf: + - type: string + - type: 'null' + parameters: + anyOf: + - $ref: '#/components/schemas/EmptyModelParam' + - type: 'null' + strict: + anyOf: + - type: boolean + - type: 'null' + type: + type: string + enum: + - function + default: function + x-stainless-const: true + defer_loading: + type: boolean + description: >- + Whether this function should be deferred and discovered via tool + search. + type: object + required: + - name + - type + NamespaceToolParam: + 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 + minLength: 1 + description: A description of the namespace shown to the model. + 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 + 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' + parameters: + anyOf: + - $ref: '#/components/schemas/EmptyModelParam' + description: Parameter schema for a client-executed tool search tool. + - type: 'null' + 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: 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: object + required: *ref_0 + 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: >- + 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 + user_location: + anyOf: + - $ref: '#/components/schemas/ApproximateLocation' + description: The user's location. + - 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: *ref_0 + 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://platform.openai.com/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 + 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 + enum: + - tool_search_output + description: The type of the item. Always `tool_search_output`. + default: tool_search_output + x-stainless-const: true + id: + type: string + description: The unique ID of the tool search output 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. + 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: + - type + - id + - call_id + - execution + - tools + - status + CompactionBody: + properties: + type: + type: string + enum: + - compaction + description: The type of the item. Always `compaction`. + default: compaction + x-stainless-const: true + id: + type: string + 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 + - id + - encrypted_content + title: Compaction item + description: >- + A compaction item generated by the [`v1/responses/compact` + API](/docs/api-reference/responses/compact). + CodeInterpreterOutputLogs: + properties: + type: + type: string + enum: + - logs + description: The type of the output. Always `logs`. + default: logs + x-stainless-const: true + logs: + type: string + description: The logs output from the code interpreter. + type: object + required: + - type + - logs + 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. + LocalShellExecAction: + properties: + type: + type: string + enum: + - exec + description: The type of the local shell action. Always `exec`. + default: exec + x-stainless-const: true + command: + items: + type: string + type: array + description: The command to run. + timeout_ms: + anyOf: + - type: integer + description: Optional timeout in milliseconds for the command. + - type: 'null' + 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 + - command + - env + title: Local shell exec action + description: Execute a shell command on the server. + FunctionShellAction: + properties: + commands: + items: + type: string + description: A list of commands to run. + type: array + 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: + - commands + - timeout_ms + - max_output_length + title: Shell exec action + description: Execute a shell command. + FunctionShellCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + LocalEnvironmentResource: + properties: + type: + type: string + enum: + - local + description: The environment type. Always `local`. + default: local + x-stainless-const: true + type: object + required: + - type + title: Local Environment + description: Represents the use of a local environment to perform shell actions. + ContainerReferenceResource: + properties: + type: + type: string + enum: + - container_reference + description: The environment type. Always `container_reference`. + default: container_reference + x-stainless-const: true + container_id: + type: string + type: object + required: + - type + - container_id + title: Container Reference + description: Represents a container created with /v1/containers. + FunctionShellCall: + 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. + 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: + anyOf: + - oneOf: + - $ref: '#/components/schemas/LocalEnvironmentResource' + - $ref: '#/components/schemas/ContainerReferenceResource' + discriminator: + propertyName: type + - type: 'null' + created_by: + type: string + description: The ID of the entity that created this tool call. + 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 + FunctionShellCallOutputTimeoutOutcome: + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true + type: object + required: + - type + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + FunctionShellCallOutputExitOutcome: + properties: + type: + type: string + enum: + - exit + description: The outcome type. Always `exit`. + default: exit + x-stainless-const: true + 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. + 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 + 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 + 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. + 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: + - 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' + 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 + ApplyPatchCreateFileOperation: + properties: + type: + type: string + enum: + - create_file + description: Create a new file with the provided diff. + default: create_file + x-stainless-const: true + path: + type: string + description: Path of the file to create. + diff: + type: string + description: Diff to apply. + type: object + required: + - type + - path + - diff + title: Apply patch create file operation + description: Instruction describing how to create a file via the apply_patch tool. + ApplyPatchDeleteFileOperation: + properties: + type: + type: string + enum: + - delete_file + description: Delete the specified file. + default: delete_file + x-stainless-const: true + path: + type: string + description: Path of the file to delete. + type: object + required: + - type + - path + title: Apply patch delete file operation + description: Instruction describing how to delete a file via the apply_patch tool. + ApplyPatchUpdateFileOperation: + 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: + type: string + description: Diff to apply. + type: object + required: + - type + - path + - diff + title: Apply patch update file operation + description: Instruction describing how to update a file via the apply_patch tool. + ApplyPatchToolCall: + properties: + type: + type: string + enum: + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_call + x-stainless-const: true + id: + type: string + description: >- + The unique ID of the apply patch tool call. Populated when this item + is returned via API. + call_id: + type: string + description: The unique ID of the apply patch tool call generated by the model. + 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 + - id + - call_id + - status + - operation + title: Apply patch tool call + description: >- + A tool call that applies file diffs by creating, deleting, or updating + files. + ApplyPatchCallOutputStatus: + type: string + enum: + - completed + - failed + 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 + id: + type: string + description: >- + The unique ID of the apply patch tool call output. Populated when + this item is returned via API. + call_id: + type: string + description: The unique ID of the apply patch tool call generated by the model. + status: + $ref: '#/components/schemas/ApplyPatchCallOutputStatus' + description: >- + The status of the apply patch tool call output. One of `completed` + or `failed`. + output: + anyOf: + - type: string + description: Optional textual output returned by the apply patch tool. + - type: 'null' + created_by: + type: string + description: The ID of the entity that created this tool call output. + type: object + required: + - type + - id + - call_id + - status + title: Apply patch tool call output + description: The output emitted by an apply patch tool call. + 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 + 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: + anyOf: + - items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + 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' + type: object + required: + - call_id + - type + - output + title: Computer tool call output + description: The output of a computer tool call. + InputTextContentParam: + 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 + maxLength: 10485760 + description: The text input to the model. + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + InputImageContentParamAutoParam: + properties: + type: + type: string + enum: + - input_image + description: The type of the input item. Always `input_image`. + default: input_image + 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' + file_id: + anyOf: + - type: string + description: The ID of the file to be sent to the model. + example: file-123 + - type: 'null' + 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' + type: object + required: + - type + title: Input image + description: >- + An image input to the model. Learn about [image + inputs](/docs/guides/vision) + FileDetailEnum: + type: string + enum: + - low + - high + InputFileContentParam: + 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: + - type: string + description: The ID of the file to be sent to the model. + example: file-123 + - type: 'null' + filename: + anyOf: + - type: string + description: The name of the file to be sent to the model. + - type: 'null' + file_data: + anyOf: + - type: string + maxLength: 73400320 + description: The base64-encoded data of the file to be sent to the model. + - type: 'null' + file_url: + anyOf: + - type: string + format: uri + description: The URL of the file to be sent to the model. + - type: 'null' + detail: + $ref: '#/components/schemas/FileDetailEnum' + description: >- + The detail level of the file to be sent to the model. Use `low` for + the default rendering behavior, or `high` to render the file at + higher quality. Defaults to `low`. + type: object + required: + - type + title: Input file + description: A file input to the model. + FunctionCallOutputItemParam: + 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' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the function tool call generated by the model. + 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. + - 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. + 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' + type: object + required: + - call_id + - type + - output + title: Function tool call output + description: The output of a function tool call. + ToolSearchCallItemParam: + properties: + id: + anyOf: + - type: string + description: The unique ID of this tool search call. + example: tsc_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_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: + - type + - arguments + ToolSearchOutputItemParam: + 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 + 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/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' + type: object + required: + - type + - tools + CompactionSummaryItemParam: + properties: + id: + anyOf: + - type: string + description: The ID of the compaction item. + example: cmp_123 + - 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: 10485760 + 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](/docs/api-reference/responses/compact). + FunctionShellActionParam: + properties: + commands: + items: + type: string + type: array + description: Ordered shell commands for the execution environment to run. + timeout_ms: + anyOf: + - type: integer + description: >- + Maximum wall-clock time in milliseconds to allow the shell + commands to run. + - type: 'null' + max_output_length: + anyOf: + - type: integer + description: >- + Maximum number of UTF-8 characters to capture from combined + stdout and stderr output. + - type: 'null' + 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 + title: Shell call status + description: Status values reported for shell tool calls. + FunctionShellCallItemParam: + 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' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the shell tool call generated by the model. + 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: + - $ref: '#/components/schemas/FunctionShellCallItemStatus' + description: >- + The status of the shell call. One of `in_progress`, `completed`, + or `incomplete`. + - type: 'null' + environment: + anyOf: + - oneOf: + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + description: The environment to execute the shell commands in. + discriminator: + propertyName: type + - type: 'null' + type: object + required: + - call_id + - type + - action + title: Shell tool call + description: A tool representing a request to execute one or more shell commands. + FunctionShellCallOutputTimeoutOutcomeParam: + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true + type: object + required: + - type + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + FunctionShellCallOutputExitOutcomeParam: + properties: + type: + type: string + enum: + - exit + description: The outcome type. Always `exit`. + default: exit + x-stainless-const: true + exit_code: + type: integer + 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' + - $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. + stderr: + type: string + maxLength: 10485760 + description: Captured stderr output for the shell call. + 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: >- + 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. + 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 + output: + items: + $ref: '#/components/schemas/FunctionShellCallOutputContentParam' + 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' + 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 + 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 + 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: + type: + type: string + enum: + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_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' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + 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: + - type + - call_id + - status + - operation + title: Apply patch tool call + description: >- + A tool call representing a request to create, delete, or update files + using diff patches. + ApplyPatchCallOutputStatusParam: + type: string + enum: + - completed + - failed + title: Apply patch call output status + description: Outcome values reported for apply_patch tool call outputs. + ApplyPatchToolCallOutputItemParam: + 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 + 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' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + status: + $ref: '#/components/schemas/ApplyPatchCallOutputStatusParam' + description: >- + The status of the apply patch tool call output. One of `completed` + or `failed`. + output: + anyOf: + - type: string + 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. + ItemReferenceParam: + properties: + type: + anyOf: + - type: string + 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: + - id + title: Item reference + description: An internal identifier for an item to reference. + ConversationResource: + properties: + id: + type: string + description: The unique ID of the conversation. + object: + type: string + enum: + - conversation + description: The object type, which is always `conversation`. + default: conversation + 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. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + 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 + ImageGenOutputTokensDetails: + 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. + ImageGenInputUsageDetails: + 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. + ImageGenUsage: + 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/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. + SpecificApplyPatchParam: + properties: + type: + type: string + enum: + - apply_patch + description: The tool to call. Always `apply_patch`. + default: apply_patch + x-stainless-const: true + type: object + required: + - type + title: Specific apply patch tool choice + description: >- + Forces the model to call the apply_patch tool when executing a tool + call. + SpecificFunctionShellParam: + properties: + type: + type: string + enum: + - shell + description: The tool to call. Always `shell`. + default: shell + x-stainless-const: true + type: object + required: + - type + title: Specific shell tool choice + description: Forces the model to call the shell tool when a tool call is required. + ConversationParam-2: + properties: + id: + type: string + description: The unique ID of the conversation. + example: conv_123 + type: object + required: + - id + title: Conversation object + description: The conversation that this response belongs to. + ContextManagementParam: + properties: + type: + type: string + description: >- + The context management entry type. Currently only 'compaction' is + supported. + compact_threshold: + anyOf: + - type: integer + minimum: 1000 + description: >- + Token threshold at which compaction should be triggered for this + entry. + - type: 'null' + type: object + required: + - type + Conversation-2: + properties: + id: + type: string + 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. + CreateConversationBody: + 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. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + - type: 'null' + 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' + type: object + required: [] + UpdateConversationBody: + 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. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + type: object + required: + - metadata + DeletedConversationResource: + properties: + object: + type: string + enum: + - conversation.deleted + default: conversation.deleted + x-stainless-const: true + deleted: + type: boolean + id: + type: string + type: object + required: + - object + - deleted + - id + OrderEnum: + type: string + enum: + - asc + - desc + VideoModel: + anyOf: + - type: string + - type: string + enum: + - sora-2 + - sora-2-pro + - sora-2-2025-10-06 + - sora-2-pro-2025-10-06 + - sora-2-2025-12-08 + VideoStatus: + type: string + enum: + - queued + - in_progress + - completed + - failed + VideoSize: + type: string + enum: + - 720x1280 + - 1280x720 + - 1024x1792 + - 1792x1024 + Error-2: + properties: + code: + type: string + description: A machine-readable error code that was returned. + message: + type: string + description: A human-readable description of the error that was returned. + type: object + required: + - code + - message + title: Error + description: An error that occurred while generating the response. + VideoResource: + properties: + id: + type: string + description: Unique identifier for the video job. + object: + type: string + enum: + - video + 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' + 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: The prompt that was used to generate the video. + - type: 'null' + size: + $ref: '#/components/schemas/VideoSize' + description: The resolution of the generated video. + 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: 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' + type: object + required: + - id + - object + - model + - status + - progress + - created_at + - completed_at + - expires_at + - prompt + - size + - seconds + - remixed_from_video_id + - error + title: Video job + description: Structured information describing a generated video job. + VideoListResource: + 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/VideoResource' + 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 + 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: + - '4' + - '8' + - '12' + 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' + 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: + 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: + $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: + - prompt + title: Create video JSON request + description: JSON parameters for creating a new video generation job. + CreateVideoCharacterBody: + properties: + video: + type: string + format: binary + description: Video file used to create a character. + name: + type: string + maxLength: 80 + minLength: 1 + description: Display name for this API character. + type: object + required: + - video + - name + title: Create character request + description: Parameters for creating a character from an uploaded video. + VideoCharacterResource: + properties: + id: + anyOf: + - type: string + description: Identifier for the character creation cameo. + - type: 'null' + name: + anyOf: + - type: string + description: Display name for the character. + - type: 'null' + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the character was created. + type: object + required: + - id + - name + - created_at + VideoReferenceInputParam: + properties: + id: + type: string + description: The identifier of the completed video. + example: video_123 + type: object + required: + - id + description: Reference to the completed video. + CreateVideoEditMultipartBody: + properties: + video: + oneOf: + - type: string + format: binary + description: Reference to the completed video to edit. + - $ref: '#/components/schemas/VideoReferenceInputParam' + prompt: + type: string + maxLength: 32000 + minLength: 1 + description: Text prompt that describes how to edit the source video. + 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. + type: object + required: + - video + - prompt + title: Create video edit JSON request + description: JSON parameters for editing an existing generated video. + CreateVideoExtendMultipartBody: + properties: + video: + oneOf: + - $ref: '#/components/schemas/VideoReferenceInputParam' + - type: string + format: binary + 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). + type: object + required: + - video + - prompt + - seconds + title: Create video extension multipart request + description: Multipart parameters for extending an existing generated video. + CreateVideoExtendJsonBody: + 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). + type: object + required: + - video + - prompt + - seconds + title: Create video extension JSON request + description: JSON parameters for extending an existing generated video. + DeletedVideoResource: + properties: + object: + type: string + enum: + - video.deleted + description: The object type that signals the deletion response. + default: video.deleted + x-stainless-const: true + deleted: + type: boolean + description: Indicates that the video resource was deleted. + id: + type: string + description: Identifier of the deleted video. + type: object + required: + - object + - deleted + - id + title: Deleted video response + description: Confirmation payload returned after deleting a video. + VideoContentVariant: + 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 + title: Create video remix request + description: Parameters for remixing an existing generated video. + TruncationEnum: + type: string + enum: + - auto + - disabled + 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](/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 + 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](/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://platform.openai.com/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. + instructions: + anyOf: + - type: string + description: >- + A system (or developer) message inserted into the model's + context. + + When 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' + conversation: + anyOf: + - $ref: '#/components/schemas/ConversationParam' + - type: 'null' + tool_choice: + anyOf: + - $ref: '#/components/schemas/ToolChoiceParam' + description: Controls which tool the model should use, if any. + - type: 'null' + 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 + enum: + - response.input_tokens + default: response.input_tokens + x-stainless-const: true + input_tokens: + type: integer + type: object + required: + - object + - input_tokens + title: Token counts + example: + object: response.input_tokens + input_tokens: 123 + PromptCacheRetentionEnum: + type: string + enum: + - in_memory + - 24h + ServiceTierEnum: + type: string + enum: + - auto + - default + - flex + - priority + CompactResponseMethodPublicBody: + properties: + model: + $ref: '#/components/schemas/ModelIdsCompaction' + 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 + 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](/docs/guides/conversation-state). Cannot be used in + conjunction with `conversation`. + example: resp_123 + - type: 'null' + instructions: + anyOf: + - type: string + description: >- + A system (or developer) message inserted into the model's + context. + + When 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' + prompt_cache_key: + anyOf: + - type: string + maxLength: 64 + description: A key to use when reading from or writing to the prompt cache. + - type: 'null' + prompt_cache_retention: + anyOf: + - $ref: '#/components/schemas/PromptCacheRetentionEnum' + description: How long to retain a prompt cache entry created by this request. + - type: 'null' + service_tier: + anyOf: + - $ref: '#/components/schemas/ServiceTierEnum' + description: The service tier to use for this request. + - type: 'null' + type: object + required: + - model + ItemField: + oneOf: + - $ref: '#/components/schemas/Message' + - $ref: '#/components/schemas/FunctionToolCall' + - $ref: '#/components/schemas/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $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' + description: >- + An item representing a message, tool call, tool output, reasoning, or + other response element. + discriminator: + propertyName: type + CompactResource: + properties: + id: + type: string + description: The unique identifier for the compacted response. + object: + type: string + enum: + - response.compaction + description: The object type. Always `response.compaction`. + default: response.compaction + x-stainless-const: true + output: + items: + $ref: '#/components/schemas/ItemField' + type: array + description: The compacted list of output items. + 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: + - id + - object + - output + - created_at + - usage + 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 + 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 + 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. + version: + anyOf: + - type: string + description: >- + Specific workflow version used for the session. Defaults to null + when using the latest deployment. + - type: 'null' + state_variables: + 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 + - type: 'null' + 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: integer + description: Maximum upload size in megabytes. + - type: 'null' + max_files: + anyOf: + - 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. + recent_threads: + anyOf: + - 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. + file_upload: + $ref: '#/components/schemas/ChatSessionFileUpload' + description: Upload settings for the session. + history: + $ref: '#/components/schemas/ChatSessionHistory' + description: History retention configuration. + type: object + required: + - automatic_thread_titling + - file_upload + - history + title: ChatKit configuration + description: ChatKit configuration for the session. + ChatSessionResource: + properties: + id: + type: string + description: Identifier for the ChatKit session. + object: + type: string + enum: + - chatkit.session + 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. + client_secret: + type: string + description: Ephemeral client secret that authenticates session requests. + workflow: + $ref: '#/components/schemas/ChatkitWorkflow' + description: Workflow metadata for the session. + user: + 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. + type: object + required: + - 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-01T00:00:00.000Z + 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 + WorkflowTracingParam: + properties: + 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 + description: Identifier for the workflow invoked by the session. + version: + type: string + description: >- + Specific workflow version to run. Defaults to the latest deployed + version. + 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: + - id + title: Workflow settings + description: Workflow reference and overrides applied to the chat session. + ExpiresAfterParam: + properties: + anchor: + type: string + enum: + - created_at + description: >- + Base timestamp used to calculate expiration. Currently fixed to + `created_at`. + default: created_at + x-stainless-const: true + seconds: + type: integer + 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: 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. + 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. + 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. + recent_threads: + type: integer + minimum: 1 + description: >- + Number of recent ChatKit threads users have access to. Defaults to + unlimited when unset. + 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. + 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). + 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 + 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. + chatkit_configuration: + $ref: '#/components/schemas/ChatkitConfigurationParam' + description: Optional overrides for ChatKit runtime configuration features + type: object + required: + - workflow + - user + title: Create chat session request + description: Parameters for provisioning a new ChatKit session. + UserMessageInputText: + properties: + type: + type: string + enum: + - input_text + description: Type discriminator that is always `input_text`. + default: input_text + x-stainless-const: true + text: + type: string + description: Plain-text content supplied by the user. + type: object + required: + - type + - text + title: User message input + description: Text block that a user contributed to the thread. + UserMessageQuotedText: + properties: + type: + type: string + enum: + - quoted_text + description: Type discriminator that is always `quoted_text`. + default: quoted_text + x-stainless-const: true + text: + type: string + description: Quoted text content. + type: object + required: + - type + - text + title: User message quoted text + description: Quoted snippet that the user referenced in their message. + AttachmentType: + type: string + enum: + - image + - file + 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 + format: uri + description: Preview URL for rendering the attachment inline. + - type: 'null' + type: object + required: + - type + - id + - name + - mime_type + - preview_url + title: Attachment + description: Attachment metadata included on thread items. + ToolChoice: + properties: + 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: + - $ref: '#/components/schemas/ToolChoice' + description: >- + Preferred tool to invoke. Defaults to null when ChatKit should + auto-select. + - type: 'null' + model: + anyOf: + - type: string + description: >- + Model name that generated the response. Defaults to null when + using the session default. + - type: 'null' + type: object + required: + - tool_choice + - model + title: Inference options + description: Model and tool overrides applied when generating the assistant response. + UserMessageItem: + 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: + - chatkit.user_message + default: chatkit.user_message + x-stainless-const: true + 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' + 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' + type: object + required: + - id + - object + - created_at + - thread_id + - type + - content + - attachments + - inference_options + title: User Message Item + description: User-authored messages within a thread. + FileAnnotationSource: + properties: + type: + type: string + enum: + - file + 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 + - filename + title: File annotation source + description: Attachment source referenced by an annotation. + FileAnnotation: + properties: + type: + type: string + enum: + - file + description: Type discriminator that is always `file` for this annotation. + default: file + x-stainless-const: true + source: + $ref: '#/components/schemas/FileAnnotationSource' + description: File attachment referenced by the annotation. + type: object + required: + - type + - source + title: File annotation + description: Annotation that references an uploaded file. + UrlAnnotationSource: + properties: + type: + type: string + enum: + - url + description: Type discriminator that is always `url`. + default: url + x-stainless-const: true + url: + type: string + format: uri + description: URL referenced by the annotation. + type: object + required: + - type + - url + title: URL annotation source + description: URL backing an annotation entry. + UrlAnnotation: + properties: + type: + type: string + enum: + - url + description: Type discriminator that is always `url` for this annotation. + default: url + x-stainless-const: true + source: + $ref: '#/components/schemas/UrlAnnotationSource' + description: URL referenced by the annotation. + type: object + required: + - type + - source + title: URL annotation + description: Annotation that references a URL. + ResponseOutputText: + properties: + type: + type: string + enum: + - output_text + description: Type discriminator that is always `output_text`. + default: output_text + x-stainless-const: true + text: + type: string + description: Assistant generated text. + annotations: + items: + oneOf: + - $ref: '#/components/schemas/FileAnnotation' + - $ref: '#/components/schemas/UrlAnnotation' + description: Annotation object describing a cited source. + discriminator: + propertyName: type + type: array + description: Ordered list of annotations attached to the response text. + type: object + required: + - type + - text + - annotations + title: Assistant message content + description: Assistant response text accompanied by optional annotations. + AssistantMessageItem: + 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: + - 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 + - content + title: Assistant message + description: Assistant-authored message within a thread. + 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: + - chatkit.widget + description: Type discriminator that is always `chatkit.widget`. + default: chatkit.widget + x-stainless-const: true + widget: + type: string + description: Serialized widget payload rendered in the UI. + type: object + required: + - id + - object + - created_at + - thread_id + - type + - widget + title: Widget message + description: Thread item that renders a widget payload. + ClientToolCallStatus: + type: string + enum: + - in_progress + - completed + ClientToolCallItem: + 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: + - chatkit.client_tool_call + 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. + call_id: + type: string + description: Identifier for the client tool call. + name: + type: string + description: Tool name that was invoked. + arguments: + type: string + description: JSON-encoded arguments that were sent to the tool. + output: + anyOf: + - type: string + description: >- + JSON-encoded output captured from the tool. Defaults to null + while execution is in progress. + - type: 'null' + type: object + required: + - id + - object + - created_at + - thread_id + - type + - status + - call_id + - name + - arguments + - output + title: Client tool call + description: Record of a client side tool invocation initiated by the assistant. + TaskType: + type: string + enum: + - custom + - thought + TaskItem: + 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: + - 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: + - type: string + description: >- + Optional heading for the task. Defaults to null when not + provided. + - type: 'null' + summary: + anyOf: + - type: string + description: >- + Optional summary that describes the task. Defaults to null when + omitted. + - type: 'null' + type: object + required: + - id + - object + - created_at + - thread_id + - type + - task_type + - heading + - summary + title: Task item + description: Task emitted by the workflow to show progress and status updates. + TaskGroupTask: + properties: + type: + $ref: '#/components/schemas/TaskType' + description: Subtype for the grouped task. + heading: + anyOf: + - type: string + description: >- + Optional heading for the grouped task. Defaults to null when not + provided. + - type: 'null' + summary: + anyOf: + - type: string + description: >- + Optional summary that describes the grouped task. Defaults to + null when omitted. + - type: 'null' + type: object + required: + - type + - heading + - summary + title: Task group task + description: Task entry that appears within a TaskGroup. + TaskGroupItem: + 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: + - 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 + - tasks + title: Task group + description: Collection of workflow tasks grouped together in the thread. + ThreadItem: + oneOf: + - $ref: '#/components/schemas/UserMessageItem' + - $ref: '#/components/schemas/AssistantMessageItem' + - $ref: '#/components/schemas/WidgetMessageItem' + - $ref: '#/components/schemas/ClientToolCallItem' + - $ref: '#/components/schemas/TaskItem' + - $ref: '#/components/schemas/TaskGroupItem' + title: The thread item + discriminator: + propertyName: type + ThreadItemListResource: + 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/ThreadItem' + 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 + title: Thread Items + description: A paginated list of thread items rendered for the ChatKit API. + ActiveStatus: + properties: + type: + type: string + enum: + - active + description: Status discriminator that is always `active`. + default: active + x-stainless-const: true + type: object + required: + - type + title: Active thread status + description: Indicates that a thread is active. + LockedStatus: + properties: + type: + type: string + enum: + - locked + description: Status discriminator that is always `locked`. + default: locked + x-stainless-const: true + reason: + anyOf: + - type: string + description: >- + Reason that the thread was locked. Defaults to null when no + reason is recorded. + - 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 + reason: + anyOf: + - type: string + description: >- + Reason that the thread was closed. Defaults to null when no + reason is recorded. + - type: 'null' + type: object + required: + - type + - reason + title: Closed thread status + description: Indicates that a thread has been closed. + ThreadResource: + properties: + id: + type: string + description: Identifier of the thread. + object: + type: string + enum: + - chatkit.thread + description: Type discriminator that is always `chatkit.thread`. + default: chatkit.thread + x-stainless-const: true + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the thread was created. + title: + anyOf: + - type: string + description: >- + Optional human-readable title for the thread. Defaults to null + when no title has been generated. + - type: 'null' + 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: + - id + - object + - created_at + - title + - status + - user + 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 + DeletedThreadResource: + properties: + id: + type: string + 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 + - object + - deleted + title: Deleted thread + description: Confirmation payload returned after deleting a thread. + ThreadListResource: + 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/ThreadResource' + 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 + title: Threads + description: A paginated list of ChatKit threads. + DragPoint: + 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 }`.' + securitySchemes: + ApiKeyAuth: + type: http + scheme: bearer + AdminApiKeyAuth: + type: http + scheme: bearer +x-oaiMeta: + navigationGroups: + - id: responses + title: Responses API + - id: webhooks + title: Webhooks + - id: endpoints + title: Platform APIs + - id: vector_stores + title: Vector stores + - id: chatkit + title: ChatKit + beta: true + - id: containers + title: Containers + - id: realtime + title: Realtime + - id: chat + title: Chat Completions + - id: assistants + title: Assistants + deprecated: true + - id: administration + title: Administration + - id: legacy + title: Legacy + groups: + - id: responses-streaming + title: Streaming events + description: > + When you [create a Response](/docs/api-reference/responses/create) with + + `stream` set to `true`, the server will emit server-sent events to the + + client as the Response is generated. This section contains the events + that + + are emitted by the server. + + + [Learn more about streaming + responses](/docs/guides/streaming-responses?api-mode=responses). + navigationGroup: responses + sections: + - type: object + key: ResponseCreatedEvent + path: + - type: object + key: ResponseInProgressEvent + path: + - type: object + key: ResponseCompletedEvent + path: + - type: object + key: ResponseFailedEvent + path: + - type: object + key: ResponseIncompleteEvent + path: + - type: object + key: ResponseOutputItemAddedEvent + path: + - type: object + key: ResponseOutputItemDoneEvent + path: + - type: object + key: ResponseContentPartAddedEvent + path: + - type: object + key: ResponseContentPartDoneEvent + path: + - type: object + key: ResponseTextDeltaEvent + path: response/output_text/delta + - type: object + key: ResponseTextDoneEvent + path: response/output_text/done + - type: object + key: ResponseRefusalDeltaEvent + path: + - type: object + key: ResponseRefusalDoneEvent + path: + - type: object + key: ResponseFunctionCallArgumentsDeltaEvent + path: + - type: object + key: ResponseFunctionCallArgumentsDoneEvent + path: + - type: object + key: ResponseFileSearchCallInProgressEvent + path: + - type: object + key: ResponseFileSearchCallSearchingEvent + path: + - type: object + key: ResponseFileSearchCallCompletedEvent + path: + - type: object + key: ResponseWebSearchCallInProgressEvent + path: + - type: object + key: ResponseWebSearchCallSearchingEvent + path: + - type: object + key: ResponseWebSearchCallCompletedEvent + path: + - type: object + key: ResponseReasoningSummaryPartAddedEvent + path: + - type: object + key: ResponseReasoningSummaryPartDoneEvent + path: + - type: object + key: ResponseReasoningSummaryTextDeltaEvent + path: + - type: object + key: ResponseReasoningSummaryTextDoneEvent + path: + - type: object + key: ResponseReasoningTextDeltaEvent + path: + - type: object + key: ResponseReasoningTextDoneEvent + path: + - type: object + key: ResponseImageGenCallCompletedEvent + path: + - type: object + key: ResponseImageGenCallGeneratingEvent + path: + - type: object + key: ResponseImageGenCallInProgressEvent + path: + - type: object + key: ResponseImageGenCallPartialImageEvent + path: + - type: object + key: ResponseMCPCallArgumentsDeltaEvent + path: + - type: object + key: ResponseMCPCallArgumentsDoneEvent + path: + - type: object + key: ResponseMCPCallCompletedEvent + path: + - type: object + key: ResponseMCPCallFailedEvent + path: + - type: object + key: ResponseMCPCallInProgressEvent + path: + - type: object + key: ResponseMCPListToolsCompletedEvent + path: + - type: object + key: ResponseMCPListToolsFailedEvent + path: + - type: object + key: ResponseMCPListToolsInProgressEvent + path: + - type: object + key: ResponseCodeInterpreterCallInProgressEvent + path: + - type: object + key: ResponseCodeInterpreterCallInterpretingEvent + path: + - type: object + key: ResponseCodeInterpreterCallCompletedEvent + path: + - type: object + key: ResponseCodeInterpreterCallCodeDeltaEvent + path: + - type: object + key: ResponseCodeInterpreterCallCodeDoneEvent + path: + - type: object + key: ResponseOutputTextAnnotationAddedEvent + path: + - type: object + key: ResponseQueuedEvent + path: + - type: object + key: ResponseCustomToolCallInputDeltaEvent + path: + - type: object + key: ResponseCustomToolCallInputDoneEvent + path: + - type: object + key: ResponseErrorEvent + path: + - id: webhook-events + title: Webhook Events + description: > + Webhooks are HTTP requests sent by OpenAI to a URL you specify when + certain + + events happen during the course of API usage. + + + [Learn more about webhooks](/docs/guides/webhooks). + navigationGroup: webhooks + sections: + - type: object + key: WebhookResponseCompleted + path: + - type: object + key: WebhookResponseCancelled + path: + - type: object + key: WebhookResponseFailed + path: + - type: object + key: WebhookResponseIncomplete + path: + - type: object + key: WebhookBatchCompleted + path: + - type: object + key: WebhookBatchCancelled + path: + - type: object + key: WebhookBatchExpired + path: + - type: object + key: WebhookBatchFailed + path: + - type: object + key: WebhookFineTuningJobSucceeded + path: + - type: object + key: WebhookFineTuningJobFailed + path: + - type: object + key: WebhookFineTuningJobCancelled + path: + - type: object + key: WebhookEvalRunSucceeded + path: + - type: object + key: WebhookEvalRunFailed + path: + - type: object + key: WebhookEvalRunCanceled + path: + - type: object + key: WebhookRealtimeCallIncoming + path: + - id: images-streaming + title: Image Streaming + description: > + Stream image generation and editing in real time with server-sent + events. + + [Learn more about image streaming](/docs/guides/image-generation). + navigationGroup: endpoints + sections: + - type: object + key: ImageGenPartialImageEvent + path: + - type: object + key: ImageGenCompletedEvent + path: + - type: object + key: ImageEditPartialImageEvent + path: + - type: object + key: ImageEditCompletedEvent + path: + - id: realtime-client-events + title: Client events + description: > + These are events that the OpenAI Realtime WebSocket server will accept + from the client. + navigationGroup: realtime + sections: + - type: object + key: RealtimeClientEventSessionUpdate + path: + - type: object + key: RealtimeClientEventInputAudioBufferAppend + path: + - type: object + key: RealtimeClientEventInputAudioBufferCommit + path: + - type: object + key: RealtimeClientEventInputAudioBufferClear + path: + - type: object + key: RealtimeClientEventConversationItemCreate + path: + - type: object + key: RealtimeClientEventConversationItemRetrieve + path: + - type: object + key: RealtimeClientEventConversationItemTruncate + path: + - type: object + key: RealtimeClientEventConversationItemDelete + path: + - type: object + key: RealtimeClientEventResponseCreate + path: + - type: object + key: RealtimeClientEventResponseCancel + path: + - type: object + key: RealtimeClientEventOutputAudioBufferClear + path: + - id: realtime-server-events + title: Server events + description: > + These are events emitted from the OpenAI Realtime WebSocket server to + the client. + navigationGroup: realtime + sections: + - type: object + key: RealtimeServerEventError + path: + - type: object + key: RealtimeServerEventSessionCreated + path: + - type: object + key: RealtimeServerEventSessionUpdated + path: + - type: object + key: RealtimeServerEventConversationItemAdded + path: + - type: object + key: RealtimeServerEventConversationItemDone + path: + - type: object + key: RealtimeServerEventConversationItemRetrieved + path: + - type: object + key: RealtimeServerEventConversationItemInputAudioTranscriptionCompleted + path: + - type: object + key: RealtimeServerEventConversationItemInputAudioTranscriptionDelta + path: + - type: object + key: RealtimeServerEventConversationItemInputAudioTranscriptionSegment + path: + - type: object + key: RealtimeServerEventConversationItemInputAudioTranscriptionFailed + path: + - type: object + key: RealtimeServerEventConversationItemTruncated + path: + - type: object + key: RealtimeServerEventConversationItemDeleted + path: + - type: object + key: RealtimeServerEventInputAudioBufferCommitted + path: + - type: object + key: RealtimeServerEventInputAudioBufferDtmfEventReceived + path: + - type: object + key: RealtimeServerEventInputAudioBufferCleared + path: + - type: object + key: RealtimeServerEventInputAudioBufferSpeechStarted + path: + - type: object + key: RealtimeServerEventInputAudioBufferSpeechStopped + path: + - type: object + key: RealtimeServerEventInputAudioBufferTimeoutTriggered + path: + - type: object + key: RealtimeServerEventOutputAudioBufferStarted + path: + - type: object + key: RealtimeServerEventOutputAudioBufferStopped + path: + - type: object + key: RealtimeServerEventOutputAudioBufferCleared + path: + - type: object + key: RealtimeServerEventResponseCreated + path: + - type: object + key: RealtimeServerEventResponseDone + path: + - type: object + key: RealtimeServerEventResponseOutputItemAdded + path: + - type: object + key: RealtimeServerEventResponseOutputItemDone + path: + - type: object + key: RealtimeServerEventResponseContentPartAdded + path: + - type: object + key: RealtimeServerEventResponseContentPartDone + path: + - type: object + key: RealtimeServerEventResponseTextDelta + path: + - type: object + key: RealtimeServerEventResponseTextDone + path: + - type: object + key: RealtimeServerEventResponseAudioTranscriptDelta + path: + - type: object + key: RealtimeServerEventResponseAudioTranscriptDone + path: + - type: object + key: RealtimeServerEventResponseAudioDelta + path: + - type: object + key: RealtimeServerEventResponseAudioDone + path: + - type: object + key: RealtimeServerEventResponseFunctionCallArgumentsDelta + path: + - type: object + key: RealtimeServerEventResponseFunctionCallArgumentsDone + path: + - type: object + key: RealtimeServerEventResponseMCPCallArgumentsDelta + path: + - type: object + key: RealtimeServerEventResponseMCPCallArgumentsDone + path: + - type: object + key: RealtimeServerEventResponseMCPCallInProgress + path: + - type: object + key: RealtimeServerEventResponseMCPCallCompleted + path: + - type: object + key: RealtimeServerEventResponseMCPCallFailed + path: + - type: object + key: RealtimeServerEventMCPListToolsInProgress + path: + - type: object + key: RealtimeServerEventMCPListToolsCompleted + path: + - type: object + key: RealtimeServerEventMCPListToolsFailed + path: + - type: object + key: RealtimeServerEventRateLimitsUpdated + path: + - id: realtime-translation-client-events + title: Translation client events + description: > + These are events that the OpenAI Realtime Translation WebSocket server + will accept from the client. + navigationGroup: realtime + sections: + - type: object + key: RealtimeTranslationClientEventSessionUpdate + path: + - type: object + key: RealtimeTranslationClientEventInputAudioBufferAppend + path: + - type: object + key: RealtimeTranslationClientEventSessionClose + path: + - id: realtime-translation-server-events + title: Translation server events + description: > + These are events emitted from the OpenAI Realtime Translation WebSocket + server to the client. + navigationGroup: realtime + sections: + - type: object + key: RealtimeServerEventError + path: + - type: object + key: RealtimeTranslationServerEventSessionCreated + path: + - type: object + key: RealtimeTranslationServerEventSessionUpdated + path: + - type: object + key: RealtimeTranslationServerEventSessionClosed + path: + - type: object + key: RealtimeTranslationServerEventSessionInputTranscriptDelta + path: + - type: object + key: RealtimeTranslationServerEventSessionOutputTranscriptDelta + path: + - type: object + key: RealtimeTranslationServerEventSessionOutputAudioDelta + path: + - id: chat-streaming + title: Streaming + description: | + Stream Chat Completions in real time. Receive chunks of completions + returned from the model using server-sent events. + [Learn more](/docs/guides/streaming-responses?api-mode=chat). + navigationGroup: chat + sections: + - type: object + key: CreateChatCompletionStreamResponse + path: streaming + - id: assistants-streaming + title: Streaming + beta: true + description: > + Stream the result of executing a Run or resuming a Run after submitting + tool outputs. + + You can stream events from the [Create Thread and + Run](/docs/api-reference/runs/createThreadAndRun), + + [Create Run](/docs/api-reference/runs/createRun), and [Submit Tool + Outputs](/docs/api-reference/runs/submitToolOutputs) + + endpoints by passing `"stream": true`. The response will be a + [Server-Sent + events](https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events) + stream. + + Our Node and Python SDKs provide helpful utilities to make streaming + easy. Reference the + + [Assistants API quickstart](/docs/assistants/overview) to learn more. + navigationGroup: assistants + sections: + - type: object + key: AssistantStreamEvent + path: events + - id: realtime-beta-client-events + title: Realtime Beta client events + description: > + These are events that the OpenAI Realtime WebSocket server will accept + from the client. + navigationGroup: legacy + sections: + - type: object + key: RealtimeBetaClientEventSessionUpdate + path: + - type: object + key: RealtimeBetaClientEventInputAudioBufferAppend + path: + - type: object + key: RealtimeBetaClientEventInputAudioBufferCommit + path: + - type: object + key: RealtimeBetaClientEventInputAudioBufferClear + path: + - type: object + key: RealtimeBetaClientEventConversationItemCreate + path: + - type: object + key: RealtimeBetaClientEventConversationItemRetrieve + path: + - type: object + key: RealtimeBetaClientEventConversationItemTruncate + path: + - type: object + key: RealtimeBetaClientEventConversationItemDelete + path: + - type: object + key: RealtimeBetaClientEventResponseCreate + path: + - type: object + key: RealtimeBetaClientEventResponseCancel + path: + - type: object + key: RealtimeBetaClientEventTranscriptionSessionUpdate + path: + - type: object + key: RealtimeBetaClientEventOutputAudioBufferClear + path: + - id: realtime-beta-server-events + title: Realtime Beta server events + description: > + These are events emitted from the OpenAI Realtime WebSocket server to + the client. + navigationGroup: legacy + sections: + - type: object + key: RealtimeBetaServerEventError + path: + - type: object + key: RealtimeBetaServerEventSessionCreated + path: + - type: object + key: RealtimeBetaServerEventSessionUpdated + path: + - type: object + key: RealtimeBetaServerEventTranscriptionSessionCreated + path: + - type: object + key: RealtimeBetaServerEventTranscriptionSessionUpdated + path: + - type: object + key: RealtimeBetaServerEventConversationItemCreated + path: + - type: object + key: RealtimeBetaServerEventConversationItemRetrieved + path: + - type: object + key: >- + RealtimeBetaServerEventConversationItemInputAudioTranscriptionCompleted + path: + - type: object + key: RealtimeBetaServerEventConversationItemInputAudioTranscriptionDelta + path: + - type: object + key: >- + RealtimeBetaServerEventConversationItemInputAudioTranscriptionSegment + path: + - type: object + key: RealtimeBetaServerEventConversationItemInputAudioTranscriptionFailed + path: + - type: object + key: RealtimeBetaServerEventConversationItemTruncated + path: + - type: object + key: RealtimeBetaServerEventConversationItemDeleted + path: + - type: object + key: RealtimeBetaServerEventInputAudioBufferCommitted + path: + - type: object + key: RealtimeBetaServerEventInputAudioBufferCleared + path: + - type: object + key: RealtimeBetaServerEventInputAudioBufferSpeechStarted + path: + - type: object + key: RealtimeBetaServerEventInputAudioBufferSpeechStopped + path: + - type: object + key: RealtimeServerEventInputAudioBufferTimeoutTriggered + path: + - type: object + key: RealtimeBetaServerEventResponseCreated + path: + - type: object + key: RealtimeBetaServerEventResponseDone + path: + - type: object + key: RealtimeBetaServerEventResponseOutputItemAdded + path: + - type: object + key: RealtimeBetaServerEventResponseOutputItemDone + path: + - type: object + key: RealtimeBetaServerEventResponseContentPartAdded + path: + - type: object + key: RealtimeBetaServerEventResponseContentPartDone + path: + - type: object + key: RealtimeBetaServerEventResponseTextDelta + path: + - type: object + key: RealtimeBetaServerEventResponseTextDone + path: + - type: object + key: RealtimeBetaServerEventResponseAudioTranscriptDelta + path: + - type: object + key: RealtimeBetaServerEventResponseAudioTranscriptDone + path: + - type: object + key: RealtimeBetaServerEventResponseAudioDelta + path: + - type: object + key: RealtimeBetaServerEventResponseAudioDone + path: + - type: object + key: RealtimeBetaServerEventResponseFunctionCallArgumentsDelta + path: + - type: object + key: RealtimeBetaServerEventResponseFunctionCallArgumentsDone + path: + - type: object + key: RealtimeBetaServerEventResponseMCPCallArgumentsDelta + path: + - type: object + key: RealtimeBetaServerEventResponseMCPCallArgumentsDone + path: + - type: object + key: RealtimeBetaServerEventResponseMCPCallInProgress + path: + - type: object + key: RealtimeBetaServerEventResponseMCPCallCompleted + path: + - type: object + key: RealtimeBetaServerEventResponseMCPCallFailed + path: + - type: object + key: RealtimeBetaServerEventMCPListToolsInProgress + path: + - type: object + key: RealtimeBetaServerEventMCPListToolsCompleted + path: + - type: object + key: RealtimeBetaServerEventMCPListToolsFailed + path: + - type: object + key: RealtimeBetaServerEventRateLimitsUpdated + path: diff --git a/provider-dev/downloaded/openapi_cleaned.yaml b/provider-dev/downloaded/openapi_cleaned.yaml new file mode 100644 index 0000000..b562c01 --- /dev/null +++ b/provider-dev/downloaded/openapi_cleaned.yaml @@ -0,0 +1,52960 @@ +openapi: 3.1.0 +info: + title: OpenAI API + description: The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. + version: 2.3.0 + termsOfService: https://openai.com/policies/terms-of-use + contact: + name: OpenAI Support + url: https://help.openai.com/ + license: + name: MIT + url: https://github.com/openai/openai-openapi/blob/master/LICENSE +servers: + - url: https://api.openai.com/v1 +security: + - ApiKeyAuth: [] +tags: + - name: Assistants + description: Build Assistants that can call models and use tools. + - name: Audio + description: Turn audio into text or text into audio. + - name: Chat + description: Given a list of messages comprising a conversation, the model will return a response. + - name: Conversations + description: Manage conversations and conversation items. + - name: Completions + description: Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position. + - name: Embeddings + description: Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. + - name: Evals + description: Manage and run evals in the OpenAI platform. + - name: Fine-tuning + description: Manage fine-tuning jobs to tailor a model to your specific training data. + - name: Graders + description: Manage and run graders in the OpenAI platform. + - name: Batch + description: Create large batches of API requests to run asynchronously. + - name: Files + description: Files are used to upload documents that can be used with features like Assistants and Fine-tuning. + - name: Uploads + description: Use Uploads to upload large files in multiple parts. + - name: Images + description: Given a prompt and/or an input image, the model will generate a new image. + - name: Models + description: List and describe the various models available in the API. + - name: Moderations + description: Given text and/or image inputs, classifies if those inputs are potentially harmful. + - name: Audit Logs + description: List user actions and configuration changes within this organization. +paths: + /assistants: + get: + operationId: listAssistants + tags: + - Assistants + summary: Returns a list of assistants. + deprecated: true + parameters: + - name: limit + in: query + description: | + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListAssistantsResponse' + x-oaiMeta: + name: List assistants + group: assistants + examples: + request: + curl: | + curl "https://api.openai.com/v1/assistants?order=desc&limit=20" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.assistants.list() + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistants = await openai.beta.assistants.list({ + order: "desc", + limit: "20", + }); + + console.log(myAssistants.data); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const assistant of client.beta.assistants.list()) { + console.log(assistant.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Assistants.List(context.TODO(), openai.BetaAssistantListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.AssistantListPage; + import com.openai.models.beta.assistants.AssistantListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantListPage page = client.beta().assistants().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.assistants.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698982736, + "name": "Coding Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc456", + "object": "assistant", + "created_at": 1698982718, + "name": "My Assistant", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc789", + "object": "assistant", + "created_at": 1698982643, + "name": null, + "description": null, + "model": "gpt-4o", + "instructions": null, + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + ], + "first_id": "asst_abc123", + "last_id": "asst_abc789", + "has_more": false + } + post: + operationId: createAssistant + tags: + - Assistants + summary: Create an assistant with a model and instructions. + deprecated: true + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAssistantRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantObject' + x-oaiMeta: + name: Create assistant + group: assistants + examples: + - title: Code Interpreter + request: + curl: | + curl "https://api.openai.com/v1/assistants" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "name": "Math Tutor", + "tools": [{"type": "code_interpreter"}], + "model": "gpt-4o" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.create( + model="gpt-4o", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.create({ + instructions: + "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + name: "Math Tutor", + tools: [{ type: "code_interpreter" }], + model: "gpt-4o", + }); + + console.log(myAssistant); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const assistant = await client.beta.assistants.create({ model: 'gpt-4o' }); + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{\n\t\tModel: shared.ChatModelGPT4o,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.ChatModel; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantCreateParams params = AssistantCreateParams.builder() + .model(ChatModel.GPT_4O) + .build(); + Assistant assistant = client.beta().assistants().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.create(model: :"gpt-4o") + + puts(assistant) + response: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698984975, + "name": "Math Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + - title: Files + request: + curl: | + curl https://api.openai.com/v1/assistants \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [{"type": "file_search"}], + "tool_resources": {"file_search": {"vector_store_ids": ["vs_123"]}}, + "model": "gpt-4o" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.create( + model="gpt-4o", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.create({ + instructions: + "You are an HR bot, and you have access to files to answer employee questions about company policies.", + name: "HR Helper", + tools: [{ type: "file_search" }], + tool_resources: { + file_search: { + vector_store_ids: ["vs_123"] + } + }, + model: "gpt-4o" + }); + + console.log(myAssistant); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const assistant = await client.beta.assistants.create({ model: 'gpt-4o' }); + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{\n\t\tModel: shared.ChatModelGPT4o,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.ChatModel; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantCreateParams params = AssistantCreateParams.builder() + .model(ChatModel.GPT_4O) + .build(); + Assistant assistant = client.beta().assistants().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.create(model: :"gpt-4o") + + puts(assistant) + response: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1699009403, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": ["vs_123"] + } + }, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + /assistants/{assistant_id}: + get: + operationId: getAssistant + tags: + - Assistants + summary: Retrieves an assistant. + deprecated: true + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to retrieve. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantObject' + x-oaiMeta: + name: Retrieve assistant + group: assistants + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.retrieve( + "assistant_id", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.retrieve( + "asst_abc123" + ); + + console.log(myAssistant); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const assistant = await client.beta.assistants.retrieve('assistant_id'); + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.Get(context.TODO(), \"assistant_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Assistant assistant = client.beta().assistants().retrieve("assistant_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.retrieve("assistant_id") + + puts(assistant) + response: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1699009709, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [ + { + "type": "file_search" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + post: + operationId: modifyAssistant + tags: + - Assistants + summary: Modifies an assistant. + deprecated: true + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to modify. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyAssistantRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantObject' + x-oaiMeta: + name: Modify assistant + group: assistants + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "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.", + "tools": [{"type": "file_search"}], + "model": "gpt-4o" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.update( + assistant_id="assistant_id", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myUpdatedAssistant = await openai.beta.assistants.update( + "asst_abc123", + { + 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.", + name: "HR Helper", + tools: [{ type: "file_search" }], + model: "gpt-4o" + } + ); + + console.log(myUpdatedAssistant); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const assistant = await client.beta.assistants.update('assistant_id'); + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.Update(\n\t\tcontext.TODO(),\n\t\t\"assistant_id\",\n\t\topenai.BetaAssistantUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Assistant assistant = client.beta().assistants().update("assistant_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.update("assistant_id") + + puts(assistant) + response: | + { + "id": "asst_123", + "object": "assistant", + "created_at": 1699009709, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "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.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": [] + } + }, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + delete: + operationId: deleteAssistant + tags: + - Assistants + summary: Delete an assistant. + deprecated: true + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAssistantResponse' + x-oaiMeta: + name: Delete assistant + group: assistants + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant_deleted = client.beta.assistants.delete( + "assistant_id", + ) + print(assistant_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const response = await openai.beta.assistants.delete("asst_abc123"); + + console.log(response); + } + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const assistantDeleted = await client.beta.assistants.delete('assistant_id'); + + console.log(assistantDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistantDeleted, err := client.Beta.Assistants.Delete(context.TODO(), \"assistant_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistantDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.AssistantDeleteParams; + import com.openai.models.beta.assistants.AssistantDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantDeleted assistantDeleted = client.beta().assistants().delete("assistant_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant_deleted = openai.beta.assistants.delete("assistant_id") + + puts(assistant_deleted) + response: | + { + "id": "asst_abc123", + "object": "assistant.deleted", + "deleted": true + } + /batches: + post: + summary: Creates and executes a batch from an uploaded file of requests + operationId: createBatch + tags: + - Batch + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - input_file_id + - endpoint + - completion_window + properties: + input_file_id: + type: string + description: | + The ID of an uploaded file that contains requests for the new batch. + + See [upload file](/docs/api-reference/files/create) for how to upload a file. + + Your input file must be formatted as a [JSONL file](/docs/api-reference/batch/request-input), 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. + 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. + completion_window: + type: string + enum: + - 24h + description: The time frame within which the batch should be processed. Currently only `24h` is supported. + metadata: + $ref: '#/components/schemas/Metadata' + output_expires_after: + $ref: '#/components/schemas/BatchFileExpirationAfter' + responses: + '200': + description: Batch created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Batch' + x-oaiMeta: + name: Create batch + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "input_file_id": "file-abc123", + "endpoint": "/v1/chat/completions", + "completion_window": "24h" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + batch = client.batches.create( + completion_window="24h", + endpoint="/v1/responses", + input_file_id="input_file_id", + ) + print(batch.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.create({ + input_file_id: "file-abc123", + endpoint: "/v1/chat/completions", + completion_window: "24h" + }); + + console.log(batch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const batch = await client.batches.create({ + completion_window: '24h', + endpoint: '/v1/responses', + input_file_id: 'input_file_id', + }); + + console.log(batch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.New(context.TODO(), openai.BatchNewParams{\n\t\tCompletionWindow: openai.BatchNewParamsCompletionWindow24h,\n\t\tEndpoint: openai.BatchNewParamsEndpointV1Responses,\n\t\tInputFileID: \"input_file_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.Batch; + import com.openai.models.batches.BatchCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BatchCreateParams params = BatchCreateParams.builder() + .completionWindow(BatchCreateParams.CompletionWindow._24H) + .endpoint(BatchCreateParams.Endpoint.V1_RESPONSES) + .inputFileId("input_file_id") + .build(); + Batch batch = client.batches().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + batch = openai.batches.create( + completion_window: :"24h", + endpoint: :"/v1/responses", + input_file_id: "input_file_id" + ) + + puts(batch) + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "validating", + "output_file_id": null, + "error_file_id": null, + "created_at": 1711471533, + "in_progress_at": null, + "expires_at": null, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 0, + "completed": 0, + "failed": 0 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + get: + operationId: listBatches + tags: + - Batch + summary: List your organization's batches. + parameters: + - in: query + name: after + required: false + schema: + type: string + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + - name: limit + in: query + description: | + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + responses: + '200': + description: Batch listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ListBatchesResponse' + x-oaiMeta: + name: List batches + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches?limit=2 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.batches.list() + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.batches.list(); + + for await (const batch of list) { + console.log(batch); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const batch of client.batches.list()) { + console.log(batch.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Batches.List(context.TODO(), openai.BatchListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.BatchListPage; + import com.openai.models.batches.BatchListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BatchListPage page = client.batches().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.batches.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly job", + } + }, + { ... }, + ], + "first_id": "batch_abc123", + "last_id": "batch_abc456", + "has_more": true + } + /batches/{batch_id}: + get: + operationId: retrieveBatch + tags: + - Batch + summary: Retrieves a batch. + parameters: + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the batch to retrieve. + responses: + '200': + description: Batch retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Batch' + x-oaiMeta: + name: Retrieve batch + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches/batch_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + batch = client.batches.retrieve( + "batch_id", + ) + print(batch.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.retrieve("batch_abc123"); + + console.log(batch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const batch = await client.batches.retrieve('batch_id'); + + console.log(batch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.Get(context.TODO(), \"batch_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.Batch; + import com.openai.models.batches.BatchRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Batch batch = client.batches().retrieve("batch_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + batch = openai.batches.retrieve("batch_id") + + puts(batch) + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + /batches/{batch_id}/cancel: + post: + operationId: cancelBatch + 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. + parameters: + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the batch to cancel. + responses: + '200': + description: Batch is cancelling. Returns the cancelling batch's details. + content: + application/json: + schema: + $ref: '#/components/schemas/Batch' + x-oaiMeta: + name: Cancel batch + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches/batch_abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -X POST + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + batch = client.batches.cancel( + "batch_id", + ) + print(batch.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.cancel("batch_abc123"); + + console.log(batch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const batch = await client.batches.cancel('batch_id'); + + console.log(batch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.Cancel(context.TODO(), \"batch_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.Batch; + import com.openai.models.batches.BatchCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Batch batch = client.batches().cancel("batch_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + batch = openai.batches.cancel("batch_id") + + puts(batch) + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "cancelling", + "output_file_id": null, + "error_file_id": null, + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": 1711475133, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 23, + "failed": 1 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + /containers: + get: + summary: List Containers + description: Lists containers. + operationId: ListContainers + parameters: + - name: limit + in: query + description: | + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: name + in: query + description: Filter results by container name. + required: false + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerListResource' + x-oaiMeta: + name: List containers + group: containers + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/containers \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const containerListResponse of client.containers.list()) { + console.log(containerListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.containers.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Containers.List(context.TODO(), openai.ContainerListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerListPage; + import com.openai.models.containers.ContainerListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContainerListPage page = client.containers().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.containers.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "4g", + "name": "My Container" + } + ], + "first_id": "container_123", + "last_id": "container_123", + "has_more": false + } + tags: + - Containers + post: + summary: Create Container + description: Creates a container. + operationId: CreateContainer + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateContainerBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerResource' + x-oaiMeta: + name: Create container + group: containers + path: post + examples: + request: + curl: | + curl https://api.openai.com/v1/containers \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "My Container", + "memory_limit": "4g", + "skills": [ + { + "type": "skill_reference", + "skill_id": "skill_4db6f1a2c9e73508b41f9da06e2c7b5f" + }, + { + "type": "skill_reference", + "skill_id": "openai-spreadsheets", + "version": "latest" + } + ], + "network_policy": { + "type": "allowlist", + "allowed_domains": ["api.buildkite.com"] + } + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const container = await client.containers.create({ name: 'name' }); + + console.log(container.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + container = client.containers.create( + name="name", + ) + print(container.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcontainer, err := client.Containers.New(context.TODO(), openai.ContainerNewParams{\n\t\tName: \"name\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", container.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerCreateParams; + import com.openai.models.containers.ContainerCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContainerCreateParams params = ContainerCreateParams.builder() + .name("name") + .build(); + ContainerCreateResponse container = client.containers().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + container = openai.containers.create(name: "name") + + puts(container) + response: | + { + "id": "cntr_682e30645a488191b6363a0cbefc0f0a025ec61b66250591", + "object": "container", + "created_at": 1747857508, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747857508, + "network_policy": { + "type": "allowlist", + "allowed_domains": ["api.buildkite.com"] + }, + "memory_limit": "4g", + "name": "My Container" + } + tags: + - Containers + /containers/{container_id}: + get: + summary: Retrieve Container + description: Retrieves a container. + operationId: RetrieveContainer + parameters: + - name: container_id + in: path + required: true + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerResource' + x-oaiMeta: + name: Retrieve container + group: containers + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const container = await client.containers.retrieve('container_id'); + + console.log(container.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + container = client.containers.retrieve( + "container_id", + ) + print(container.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcontainer, err := client.Containers.Get(context.TODO(), \"container_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", container.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerRetrieveParams; + import com.openai.models.containers.ContainerRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContainerRetrieveResponse container = client.containers().retrieve("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + container = openai.containers.retrieve("container_id") + + puts(container) + response: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "4g", + "name": "My Container" + } + tags: + - Containers + delete: + operationId: DeleteContainer + summary: Delete Container + description: Delete a container. + parameters: + - name: container_id + in: path + description: The ID of the container to delete. + required: true + schema: + type: string + responses: + '200': + description: OK + x-oaiMeta: + name: Delete a container + group: containers + path: delete + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + await client.containers.delete('container_id'); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.containers.delete( + "container_id", + ) + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Containers.Delete(context.TODO(), \"container_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + client.containers().delete("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + result = openai.containers.delete("container_id") + + puts(result) + response: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container.deleted", + "deleted": true + } + tags: + - Containers + /containers/{container_id}/files: + post: + summary: | + Create a Container File + + You can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID. + description: | + Creates a container file. + operationId: CreateContainerFile + parameters: + - name: container_id + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateContainerFileBody' + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateContainerFileBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerFileResource' + x-oaiMeta: + name: Create container file + group: containers + path: post + examples: + request: + curl: | + curl https://api.openai.com/v1/containers/cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F file="@example.txt" + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const file = await client.containers.files.create('container_id'); + + console.log(file.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file = client.containers.files.create( + container_id="container_id", + ) + print(file.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfile, err := client.Containers.Files.New(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\topenai.ContainerFileNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", file.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileCreateParams; + import com.openai.models.containers.files.FileCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileCreateResponse file = client.containers().files().create("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file = openai.containers.files.create("container_id") + + puts(file) + response: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + tags: + - Containers + get: + summary: List Container files + description: Lists container files. + operationId: ListContainerFiles + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: limit + in: query + description: | + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerFileListResource' + x-oaiMeta: + name: List container files + group: containers + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/containers/cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fileListResponse of client.containers.files.list('container_id')) { + console.log(fileListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.containers.files.list( + container_id="container_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Containers.Files.List(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\topenai.ContainerFileListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileListPage; + import com.openai.models.containers.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileListPage page = client.containers().files().list("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.containers.files.list("container_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + ], + "first_id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "has_more": false, + "last_id": "cfile_682e0e8a43c88191a7978f477a09bdf5" + } + tags: + - Containers + /containers/{container_id}/files/{file_id}: + get: + summary: Retrieve Container File + description: Retrieves a container file. + operationId: RetrieveContainerFile + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: file_id + in: path + required: true + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerFileResource' + x-oaiMeta: + name: Retrieve container file + group: containers + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/containers/container_123/files/file_456 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const file = await client.containers.files.retrieve('file_id', { container_id: 'container_id' }); + + console.log(file.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file = client.containers.files.retrieve( + file_id="file_id", + container_id="container_id", + ) + print(file.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfile, err := client.Containers.Files.Get(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", file.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileRetrieveParams; + import com.openai.models.containers.files.FileRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileRetrieveParams params = FileRetrieveParams.builder() + .containerId("container_id") + .fileId("file_id") + .build(); + FileRetrieveResponse file = client.containers().files().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file = openai.containers.files.retrieve("file_id", container_id: "container_id") + + puts(file) + response: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + tags: + - Containers + delete: + operationId: DeleteContainerFile + summary: Delete Container File + description: Delete a container file. + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: file_id + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + x-oaiMeta: + name: Delete a container file + group: containers + path: delete + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863/files/cfile_682e0e8a43c88191a7978f477a09bdf5 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + await client.containers.files.delete('file_id', { container_id: 'container_id' }); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.containers.files.delete( + file_id="file_id", + container_id="container_id", + ) + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Containers.Files.Delete(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileDeleteParams params = FileDeleteParams.builder() + .containerId("container_id") + .fileId("file_id") + .build(); + client.containers().files().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + result = openai.containers.files.delete("file_id", container_id: "container_id") + + puts(result) + response: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file.deleted", + "deleted": true + } + tags: + - Containers + /conversations/{conversation_id}/items: + post: + operationId: createConversationItems + tags: + - Conversations + summary: Create items in a conversation with the given ID. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation to add the item to. + - name: include + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: | + Additional fields to include in the response. See the `include` + parameter for [listing Conversation items above](/docs/api-reference/conversations/list-items#conversations_list_items-include) for more information. + requestBody: + required: true + content: + application/json: + schema: + properties: + items: + type: array + description: | + The items to add to the conversation. You may add up to 20 items at a time. + items: + $ref: '#/components/schemas/InputItem' + maxItems: 20 + required: + - items + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationItemList' + x-oaiMeta: + name: Create items + group: conversations + path: create-item + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123/items \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "items": [ + { + "type": "message", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + }, + { + "type": "message", + "role": "user", + "content": [ + {"type": "input_text", "text": "How are you?"} + ] + } + ] + }' + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const items = await client.conversations.items.create( + "conv_123", + { + items: [ + { + type: "message", + role: "user", + content: [{ type: "input_text", text: "Hello!" }], + }, + { + type: "message", + role: "user", + content: [{ type: "input_text", text: "How are you?" }], + }, + ], + } + ); + console.log(items.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation_item_list = client.conversations.items.create( + conversation_id="conv_123", + items=[{ + "content": "string", + "role": "user", + "type": "message", + }], + ) + print(conversation_item_list.first_id) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ConversationItemList created = client.ConversationItems.Create( + conversationId: "conv_123", + new CreateConversationItemsOptions + { + Items = new List + { + new ConversationMessage + { + Role = "user", + Content = + { + new ConversationInputText { Text = "Hello!" } + } + }, + new ConversationMessage + { + Role = "user", + Content = + { + new ConversationInputText { Text = "How are you?" } + } + } + } + } + ); + Console.WriteLine(created.Data.Count); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversationItemList = await client.conversations.items.create('conv_123', { + items: [ + { + content: 'string', + role: 'user', + type: 'message', + }, + ], + }); + + console.log(conversationItemList.first_id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationItemList, err := client.Conversations.Items.New(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ItemNewParams{\n\t\t\tItems: []responses.ResponseInputItemUnionParam{{\n\t\t\t\tOfMessage: &responses.EasyInputMessageParam{\n\t\t\t\t\tContent: responses.EasyInputMessageContentUnionParam{\n\t\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t\t},\n\t\t\t\t\tRole: responses.EasyInputMessageRoleUser,\n\t\t\t\t\tType: responses.EasyInputMessageTypeMessage,\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationItemList.FirstID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.items.ConversationItemList; + import com.openai.models.conversations.items.ItemCreateParams; + import com.openai.models.responses.EasyInputMessage; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemCreateParams params = ItemCreateParams.builder() + .conversationId("conv_123") + .addItem(EasyInputMessage.builder() + .content("string") + .role(EasyInputMessage.Role.USER) + .type(EasyInputMessage.Type.MESSAGE) + .build()) + .build(); + ConversationItemList conversationItemList = client.conversations().items().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation_item_list = openai.conversations.items.create("conv_123", items: [{content: "string", role: :user, type: :message}]) + + puts(conversation_item_list) + response: | + { + "object": "list", + "data": [ + { + "type": "message", + "id": "msg_abc", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + }, + { + "type": "message", + "id": "msg_def", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "How are you?"} + ] + } + ], + "first_id": "msg_abc", + "last_id": "msg_def", + "has_more": false + } + get: + operationId: listConversationItems + tags: + - Conversations + summary: List all items for a conversation with the given ID. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation to list items for. + - name: limit + in: query + description: | + A limit on the number of objects to be returned. Limit can range between + 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - in: query + name: order + schema: + type: string + enum: + - asc + - desc + description: | + The order to return the input items in. Default is `desc`. + - `asc`: Return the input items in ascending order. + - `desc`: Return the input items in descending order. + - in: query + name: after + schema: + type: string + description: | + An item ID to list items after, used in pagination. + - name: include + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: |- + Specify additional output data to include in the model response. Currently supported values are: + - `web_search_call.action.sources`: Include the sources of the web search tool call. + - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items. + - `computer_call_output.output.image_url`: Include image urls from the computer call output. + - `file_search_call.results`: Include the search results of the file search tool call. + - `message.input_image.image_url`: Include image urls from the input message. + - `message.output_text.logprobs`: Include logprobs with assistant messages. + - `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). + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationItemList' + x-oaiMeta: + name: List items + group: conversations + path: list-items + examples: + request: + curl: | + curl "https://api.openai.com/v1/conversations/conv_123/items?limit=10" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const items = await client.conversations.items.list("conv_123", { limit: 10 }); + console.log(items.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.conversations.items.list( + conversation_id="conv_123", + ) + page = page.data[0] + print(page) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ConversationItemList items = client.ConversationItems.List( + conversationId: "conv_123", + new ListConversationItemsOptions { Limit = 10 } + ); + Console.WriteLine(items.Data.Count); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const conversationItem of client.conversations.items.list('conv_123')) { + console.log(conversationItem); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Conversations.Items.List(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ItemListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.items.ItemListPage; + import com.openai.models.conversations.items.ItemListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemListPage page = client.conversations().items().list("conv_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.conversations.items.list("conv_123") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "type": "message", + "id": "msg_abc", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + } + ], + "first_id": "msg_abc", + "last_id": "msg_abc", + "has_more": false + } + /conversations/{conversation_id}/items/{item_id}: + get: + operationId: getConversationItem + tags: + - Conversations + summary: Get a single item from a conversation with the given IDs. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation that contains the item. + - in: path + name: item_id + required: true + schema: + type: string + example: msg_abc + description: The ID of the item to retrieve. + - name: include + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: | + Additional fields to include in the response. See the `include` + parameter for [listing Conversation items above](/docs/api-reference/conversations/list-items#conversations_list_items-include) for more information. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationItem' + x-oaiMeta: + name: Retrieve an item + group: conversations + path: get-item + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123/items/msg_abc \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const item = await client.conversations.items.retrieve( + "conv_123", + "msg_abc" + ); + console.log(item); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation_item = client.conversations.items.retrieve( + item_id="msg_abc", + conversation_id="conv_123", + ) + print(conversation_item) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ConversationItem item = client.ConversationItems.Get( + conversationId: "conv_123", + itemId: "msg_abc" + ); + Console.WriteLine(item.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversationItem = await client.conversations.items.retrieve('msg_abc', { + conversation_id: 'conv_123', + }); + + console.log(conversationItem); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationItem, err := client.Conversations.Items.Get(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\t\"msg_abc\",\n\t\tconversations.ItemGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationItem)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.items.ConversationItem; + import com.openai.models.conversations.items.ItemRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemRetrieveParams params = ItemRetrieveParams.builder() + .conversationId("conv_123") + .itemId("msg_abc") + .build(); + ConversationItem conversationItem = client.conversations().items().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation_item = openai.conversations.items.retrieve("msg_abc", conversation_id: "conv_123") + + puts(conversation_item) + response: | + { + "type": "message", + "id": "msg_abc", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + } + delete: + operationId: deleteConversationItem + tags: + - Conversations + summary: Delete an item from a conversation with the given IDs. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation that contains the item. + - in: path + name: item_id + required: true + schema: + type: string + example: msg_abc + description: The ID of the item to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Delete an item + group: conversations + path: delete-item + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/conversations/conv_123/items/msg_abc \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const conversation = await client.conversations.items.delete( + "conv_123", + "msg_abc" + ); + console.log(conversation); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.items.delete( + item_id="msg_abc", + conversation_id="conv_123", + ) + print(conversation.id) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation conversation = client.ConversationItems.Delete( + conversationId: "conv_123", + itemId: "msg_abc" + ); + Console.WriteLine(conversation.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversation = await client.conversations.items.delete('msg_abc', { + conversation_id: 'conv_123', + }); + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Items.Delete(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\t\"msg_abc\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.items.ItemDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemDeleteParams params = ItemDeleteParams.builder() + .conversationId("conv_123") + .itemId("msg_abc") + .build(); + Conversation conversation = client.conversations().items().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation = openai.conversations.items.delete("msg_abc", conversation_id: "conv_123") + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "demo"} + } + /evals: + get: + operationId: listEvals + tags: + - Evals + summary: | + List evaluations for a project. + parameters: + - name: after + in: query + description: Identifier for the last eval from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of evals to retrieve. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: Sort order for evals by timestamp. Use `asc` for ascending order or `desc` for descending order. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + - name: order_by + in: query + description: | + Evals can be ordered by creation time or last updated time. Use + `created_at` for creation time or `updated_at` for last updated time. + required: false + schema: + type: string + enum: + - created_at + - updated_at + default: created_at + responses: + '200': + description: A list of evals + content: + application/json: + schema: + $ref: '#/components/schemas/EvalList' + x-oaiMeta: + name: List evals + group: evals + path: list + examples: + request: + curl: | + curl https://api.openai.com/v1/evals?limit=1 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.evals.list() + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const evals = await openai.evals.list({ limit: 1 }); + console.log(evals); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const evalListResponse of client.evals.list()) { + console.log(evalListResponse.id); + } + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalListPage; + import com.openai.models.evals.EvalListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalListPage page = client.evals().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.evals.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "object": "eval", + "data_source_config": { + "type": "stored_completions", + "metadata": { + "usecase": "push_notifications_summarizer" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + ] + } + }, + "testing_criteria": [ + { + "name": "Push Notification Summary Grader", + "id": "Push Notification Summary Grader-9b876f24-4762-4be9-aff4-db7a9b31c673", + "type": "label_model", + "model": "o3-mini", + "input": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "text": "\nLabel the following push notification summary as either correct or incorrect.\nThe push notification and the summary will be provided below.\nA good push notificiation summary is concise and snappy.\nIf it is good, then label it as correct, if not, then incorrect.\n" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "\nPush notifications: {{item.input}}\nSummary: {{sample.output_text}}\n" + } + } + ], + "passing_labels": [ + "correct" + ], + "labels": [ + "correct", + "incorrect" + ], + "sampling_params": null + } + ], + "name": "Push Notification Summary Grader", + "created_at": 1739314509, + "metadata": { + "description": "A stored completions eval for push notification summaries" + } + } + ], + "first_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "last_id": "eval_67aa884cf6688190b58f657d4441c8b7", + "has_more": true + } + post: + operationId: createEval + tags: + - Evals + summary: | + Create the structure of an evaluation that can be used to test a model's performance. + An 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. + For more information, see the [Evals guide](/docs/guides/evals). + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEvalRequest' + responses: + '201': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Eval' + x-oaiMeta: + name: Create eval + group: evals + path: post + examples: + request: + curl: | + curl https://api.openai.com/v1/evals \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Sentiment", + "data_source_config": { + "type": "stored_completions", + "metadata": { + "usecase": "chatbot" + } + }, + "testing_criteria": [ + { + "type": "label_model", + "model": "o3-mini", + "input": [ + { + "role": "developer", + "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" + }, + { + "role": "user", + "content": "Statement: {{item.input}}" + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ], + "name": "Example label grader" + } + ] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.create( + data_source_config={ + "item_schema": { + "foo": "bar" + }, + "type": "custom", + }, + testing_criteria=[{ + "input": [{ + "content": "content", + "role": "role", + }], + "labels": ["string"], + "model": "model", + "name": "name", + "passing_labels": ["string"], + "type": "label_model", + }], + ) + print(eval.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const evalObj = await openai.evals.create({ + name: "Sentiment", + data_source_config: { + type: "stored_completions", + metadata: { usecase: "chatbot" } + }, + testing_criteria: [ + { + type: "label_model", + model: "o3-mini", + input: [ + { role: "developer", content: "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" }, + { role: "user", content: "Statement: {{item.input}}" } + ], + passing_labels: ["positive"], + labels: ["positive", "neutral", "negative"], + name: "Example label grader" + } + ] + }); + console.log(evalObj); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.create({ + data_source_config: { + item_schema: { foo: 'bar' }, + type: 'custom', + }, + testing_criteria: [ + { + input: [{ content: 'content', role: 'role' }], + labels: ['string'], + model: 'model', + name: 'name', + passing_labels: ['string'], + type: 'label_model', + }, + ], + }); + + console.log(_eval.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.evals.EvalCreateParams; + import com.openai.models.evals.EvalCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalCreateParams params = EvalCreateParams.builder() + .customDataSourceConfig(EvalCreateParams.DataSourceConfig.Custom.ItemSchema.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build()) + .addTestingCriterion(EvalCreateParams.TestingCriterion.LabelModel.builder() + .addInput(EvalCreateParams.TestingCriterion.LabelModel.Input.SimpleInputMessage.builder() + .content("content") + .role("role") + .build()) + .addLabel("string") + .model("model") + .name("name") + .addPassingLabel("string") + .build()) + .build(); + EvalCreateResponse eval = client.evals().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.create( + data_source_config: {item_schema: {foo: "bar"}, type: :custom}, + testing_criteria: [ + { + input: [{content: "content", role: "role"}], + labels: ["string"], + model: "model", + name: "name", + passing_labels: ["string"], + type: :label_model + } + ] + ) + + puts(eval_) + response: | + { + "object": "eval", + "id": "eval_67b7fa9a81a88190ab4aa417e397ea21", + "data_source_config": { + "type": "stored_completions", + "metadata": { + "usecase": "chatbot" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + ] + }, + "testing_criteria": [ + { + "name": "Example label grader", + "type": "label_model", + "model": "o3-mini", + "input": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.input}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + ], + "name": "Sentiment", + "created_at": 1740110490, + "metadata": { + "description": "An eval for sentiment analysis" + } + } + /evals/{eval_id}: + get: + operationId: getEval + tags: + - Evals + summary: | + Get an evaluation by ID. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve. + responses: + '200': + description: The evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/Eval' + x-oaiMeta: + name: Get an eval + group: evals + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.retrieve( + "eval_id", + ) + print(eval.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const evalObj = await openai.evals.retrieve("eval_67abd54d9b0081909a86353f6fb9317a"); + console.log(evalObj); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.retrieve('eval_id'); + + console.log(_eval.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalRetrieveParams; + import com.openai.models.evals.EvalRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalRetrieveResponse eval = client.evals().retrieve("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.retrieve("eval_id") + + puts(eval_) + response: | + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": {}, + } + post: + operationId: updateEval + tags: + - Evals + summary: | + Update certain properties of an evaluation. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to update. + requestBody: + description: Request to update an evaluation + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: Rename the evaluation. + metadata: + $ref: '#/components/schemas/Metadata' + responses: + '200': + description: The updated evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/Eval' + x-oaiMeta: + name: Update an eval + group: evals + path: update + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"name": "Updated Eval", "metadata": {"description": "Updated description"}}' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.update( + eval_id="eval_id", + ) + print(eval.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const updatedEval = await openai.evals.update( + "eval_67abd54d9b0081909a86353f6fb9317a", + { + name: "Updated Eval", + metadata: { description: "Updated description" } + } + ); + console.log(updatedEval); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.update('eval_id'); + + console.log(_eval.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalUpdateParams; + import com.openai.models.evals.EvalUpdateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalUpdateResponse eval = client.evals().update("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.update("eval_id") + + puts(eval_) + response: | + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "Updated Eval", + "created_at": 1739314509, + "metadata": {"description": "Updated description"}, + } + delete: + operationId: deleteEval + tags: + - Evals + summary: | + Delete an evaluation. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to delete. + responses: + '200': + description: Successfully deleted the evaluation. + content: + application/json: + schema: + type: object + properties: + object: + type: string + example: eval.deleted + deleted: + type: boolean + example: true + eval_id: + type: string + example: eval_abc123 + required: + - object + - deleted + - eval_id + '404': + description: Evaluation not found. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Delete an eval + group: evals + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_abc123 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.delete( + "eval_id", + ) + print(eval.eval_id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const deleted = await openai.evals.delete("eval_abc123"); + console.log(deleted); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.delete('eval_id'); + + console.log(_eval.eval_id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalDeleteParams; + import com.openai.models.evals.EvalDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalDeleteResponse eval = client.evals().delete("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.delete("eval_id") + + puts(eval_) + response: | + { + "object": "eval.deleted", + "deleted": true, + "eval_id": "eval_abc123" + } + /evals/{eval_id}/runs: + get: + operationId: getEvalRuns + tags: + - Evals + summary: | + Get a list of runs for an evaluation. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: after + in: query + description: Identifier for the last run from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of runs to retrieve. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: Sort order for runs by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + - name: status + in: query + description: Filter runs by status. One of `queued` | `in_progress` | `failed` | `completed` | `canceled`. + required: false + schema: + type: string + enum: + - queued + - in_progress + - completed + - canceled + - failed + responses: + '200': + description: A list of runs for the evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRunList' + x-oaiMeta: + name: Get eval runs + group: evals + path: get-runs + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/egroup_67abd54d9b0081909a86353f6fb9317a/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.evals.runs.list( + eval_id="eval_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const runs = await openai.evals.runs.list("egroup_67abd54d9b0081909a86353f6fb9317a"); + console.log(runs); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const runListResponse of client.evals.runs.list('eval_id')) { + console.log(runListResponse.id); + } + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunListPage; + import com.openai.models.evals.runs.RunListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunListPage page = client.evals().runs().list("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.evals.runs.list("eval_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "eval.run", + "id": "evalrun_67e0c7d31560819090d60c0780591042", + "eval_id": "eval_67e0c726d560819083f19a957c4c640b", + "report_url": "https://platform.openai.com/evaluations/eval_67e0c726d560819083f19a957c4c640b", + "status": "completed", + "model": "o3-mini", + "name": "bulk_with_negative_examples_o3-mini", + "created_at": 1742784467, + "result_counts": { + "total": 1, + "errored": 0, + "failed": 0, + "passed": 1 + }, + "per_model_usage": [ + { + "model_name": "o3-mini", + "invocation_count": 1, + "prompt_tokens": 563, + "completion_tokens": 874, + "total_tokens": 1437, + "cached_tokens": 0 + } + ], + "per_testing_criteria_results": [ + { + "testing_criteria": "Push Notification Summary Grader-1808cd0b-eeec-4e0b-a519-337e79f4f5d1", + "passed": 1, + "failed": 0 + } + ], + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "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" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.notifications}}" + } + } + ] + }, + "model": "o3-mini", + "sampling_params": null + }, + "error": null, + "metadata": {} + } + ], + "first_id": "evalrun_67e0c7d31560819090d60c0780591042", + "last_id": "evalrun_67e0c7d31560819090d60c0780591042", + "has_more": true + } + post: + operationId: createEvalRun + 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. + parameters: + - in: path + name: eval_id + required: true + schema: + type: string + description: The ID of the evaluation to create a run for. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEvalRunRequest' + responses: + '201': + description: Successfully created a run for the evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRun' + '400': + description: Bad request (for example, missing eval object) + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Create eval run + group: evals + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_67e579652b548190aaa83ada4b125f47/runs \ + -X POST \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"name":"gpt-4o-mini","data_source":{"type":"completions","input_messages":{"type":"template","template":[{"role":"developer","content":"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"} , {"role":"user","content":"{{item.input}}"}]} ,"sampling_params":{"temperature":1,"max_completions_tokens":2048,"top_p":1,"seed":42},"model":"gpt-4o-mini","source":{"type":"file_content","content":[{"item":{"input":"Tech Company Launches Advanced Artificial Intelligence Platform","ground_truth":"Technology"}}]}}' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.evals.runs.create( + eval_id="eval_id", + data_source={ + "source": { + "content": [{ + "item": { + "foo": "bar" + } + }], + "type": "file_content", + }, + "type": "jsonl", + }, + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const run = await openai.evals.runs.create( + "eval_67e579652b548190aaa83ada4b125f47", + { + name: "gpt-4o-mini", + data_source: { + type: "completions", + input_messages: { + type: "template", + template: [ + { + role: "developer", + content: "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" + }, + { + role: "user", + content: "{{item.input}}" + } + ] + }, + sampling_params: { + temperature: 1, + max_completions_tokens: 2048, + top_p: 1, + seed: 42 + }, + model: "gpt-4o-mini", + source: { + type: "file_content", + content: [ + { + item: { + input: "Tech Company Launches Advanced Artificial Intelligence Platform", + ground_truth: "Technology" + } + } + ] + } + } + } + ); + console.log(run); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.evals.runs.create('eval_id', { + data_source: { + source: { content: [{ item: { foo: 'bar' } }], type: 'file_content' }, + type: 'jsonl', + }, + }); + + console.log(run.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.evals.runs.CreateEvalJsonlRunDataSource; + import com.openai.models.evals.runs.RunCreateParams; + import com.openai.models.evals.runs.RunCreateResponse; + import java.util.List; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .evalId("eval_id") + .dataSource(CreateEvalJsonlRunDataSource.builder() + .fileContentSource(List.of(CreateEvalJsonlRunDataSource.Source.FileContent.Content.builder() + .item(CreateEvalJsonlRunDataSource.Source.FileContent.Content.Item.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build()) + .build())) + .build()) + .build(); + RunCreateResponse run = client.evals().runs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.evals.runs.create( + "eval_id", + data_source: {source: {content: [{item: {foo: "bar"}}], type: :file_content}, type: :jsonl} + ) + + puts(run) + response: | + { + "object": "eval.run", + "id": "evalrun_67e57965b480819094274e3a32235e4c", + "eval_id": "eval_67e579652b548190aaa83ada4b125f47", + "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47&run_id=evalrun_67e57965b480819094274e3a32235e4c", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + /evals/{eval_id}/runs/{run_id}: + get: + operationId: getEvalRun + tags: + - Evals + summary: | + Get an evaluation run by ID. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to retrieve. + responses: + '200': + description: The evaluation run + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRun' + x-oaiMeta: + name: Get an eval run + group: evals + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.evals.runs.retrieve( + run_id="run_id", + eval_id="eval_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const run = await openai.evals.runs.retrieve( + "evalrun_67abd54d60ec8190832b46859da808f7", + { eval_id: "eval_67abd54d9b0081909a86353f6fb9317a" } + ); + console.log(run); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.evals.runs.retrieve('run_id', { eval_id: 'eval_id' }); + + console.log(run.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunRetrieveParams; + import com.openai.models.evals.runs.RunRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunRetrieveParams params = RunRetrieveParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + RunRetrieveResponse run = client.evals().runs().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.evals.runs.retrieve("run_id", eval_id: "eval_id") + + puts(run) + response: | + { + "object": "eval.run", + "id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "report_url": "https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + post: + operationId: cancelEvalRun + tags: + - Evals + summary: | + Cancel an ongoing evaluation run. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation whose run you want to cancel. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to cancel. + responses: + '200': + description: The canceled eval run object + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRun' + x-oaiMeta: + name: Cancel eval run + group: evals + path: post + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7/cancel \ + -X POST \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.evals.runs.cancel( + run_id="run_id", + eval_id="eval_id", + ) + print(response.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const canceledRun = await openai.evals.runs.cancel( + "evalrun_67abd54d60ec8190832b46859da808f7", + { eval_id: "eval_67abd54d9b0081909a86353f6fb9317a" } + ); + console.log(canceledRun); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.evals.runs.cancel('run_id', { eval_id: 'eval_id' }); + + console.log(response.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunCancelParams; + import com.openai.models.evals.runs.RunCancelResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCancelParams params = RunCancelParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + RunCancelResponse response = client.evals().runs().cancel(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.evals.runs.cancel("run_id", eval_id: "eval_id") + + puts(response) + response: | + { + "object": "eval.run", + "id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "report_url": "https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7", + "status": "canceled", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + delete: + operationId: deleteEvalRun + tags: + - Evals + summary: | + Delete an eval run. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to delete the run from. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to delete. + 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 + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Delete eval run + group: evals + path: delete + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_123abc/runs/evalrun_abc456 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.evals.runs.delete( + run_id="run_id", + eval_id="eval_id", + ) + print(run.run_id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const deleted = await openai.evals.runs.delete( + "eval_123abc", + "evalrun_abc456" + ); + console.log(deleted); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.evals.runs.delete('run_id', { eval_id: 'eval_id' }); + + console.log(run.run_id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunDeleteParams; + import com.openai.models.evals.runs.RunDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunDeleteParams params = RunDeleteParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + RunDeleteResponse run = client.evals().runs().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.evals.runs.delete("run_id", eval_id: "eval_id") + + puts(run) + response: | + { + "object": "eval.run.deleted", + "deleted": true, + "run_id": "evalrun_abc456" + } + /evals/{eval_id}/runs/{run_id}/output_items: + get: + operationId: getEvalRunOutputItems + tags: + - Evals + summary: | + Get a list of output items for an evaluation run. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to retrieve output items for. + - name: after + in: query + description: Identifier for the last output item from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of output items to retrieve. + required: false + schema: + type: integer + default: 20 + - name: status + in: query + description: | + Filter output items by status. Use `failed` to filter by failed output + items or `pass` to filter by passed output items. + required: false + schema: + type: string + enum: + - fail + - pass + - name: order + in: query + description: Sort order for output items by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + responses: + '200': + description: A list of output items for the evaluation run + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRunOutputItemList' + x-oaiMeta: + name: Get eval run output items + group: evals + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/egroup_67abd54d9b0081909a86353f6fb9317a/runs/erun_67abd54d60ec8190832b46859da808f7/output_items \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.evals.runs.output_items.list( + run_id="run_id", + eval_id="eval_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const outputItems = await openai.evals.runs.outputItems.list( + "egroup_67abd54d9b0081909a86353f6fb9317a", + "erun_67abd54d60ec8190832b46859da808f7" + ); + console.log(outputItems); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const outputItemListResponse of client.evals.runs.outputItems.list('run_id', { + eval_id: 'eval_id', + })) { + console.log(outputItemListResponse.id); + } + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.outputitems.OutputItemListPage; + import com.openai.models.evals.runs.outputitems.OutputItemListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OutputItemListParams params = OutputItemListParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + OutputItemListPage page = client.evals().runs().outputItems().list(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.evals.runs.output_items.list("run_id", eval_id: "eval_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "eval.run.output_item", + "id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "created_at": 1743092076, + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "status": "pass", + "datasource_item_id": 5, + "datasource_item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + }, + "results": [ + { + "name": "String check-a2486074-d803-4445-b431-ad2262e85d47", + "sample": null, + "passed": true, + "score": 1.0 + } + ], + "sample": { + "input": [ + { + "role": "developer", + "content": "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", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + }, + { + "role": "user", + "content": "Stock Markets Rally After Positive Economic Data Released", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "output": [ + { + "role": "assistant", + "content": "Markets", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "finish_reason": "stop", + "model": "gpt-4o-mini-2024-07-18", + "usage": { + "total_tokens": 325, + "completion_tokens": 2, + "prompt_tokens": 323, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } + ], + "first_id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "last_id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "has_more": true + } + /evals/{eval_id}/runs/{run_id}/output_items/{output_item_id}: + get: + operationId: getEvalRunOutputItem + tags: + - Evals + summary: | + Get an evaluation run output item by ID. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to retrieve. + - name: output_item_id + in: path + required: true + schema: + type: string + description: The ID of the output item to retrieve. + responses: + '200': + description: The evaluation run output item + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRunOutputItem' + x-oaiMeta: + name: Get an output item of an eval run + group: evals + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7/output_items/outputitem_67abd55eb6548190bb580745d5644a33 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + output_item = client.evals.runs.output_items.retrieve( + output_item_id="output_item_id", + eval_id="eval_id", + run_id="run_id", + ) + print(output_item.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const outputItem = await openai.evals.runs.outputItems.retrieve( + "outputitem_67abd55eb6548190bb580745d5644a33", + { + eval_id: "eval_67abd54d9b0081909a86353f6fb9317a", + run_id: "evalrun_67abd54d60ec8190832b46859da808f7", + } + ); + console.log(outputItem); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const outputItem = await client.evals.runs.outputItems.retrieve('output_item_id', { + eval_id: 'eval_id', + run_id: 'run_id', + }); + + console.log(outputItem.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.outputitems.OutputItemRetrieveParams; + import com.openai.models.evals.runs.outputitems.OutputItemRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OutputItemRetrieveParams params = OutputItemRetrieveParams.builder() + .evalId("eval_id") + .runId("run_id") + .outputItemId("output_item_id") + .build(); + OutputItemRetrieveResponse outputItem = client.evals().runs().outputItems().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + output_item = openai.evals.runs.output_items.retrieve("output_item_id", eval_id: "eval_id", run_id: "run_id") + + puts(output_item) + response: | + { + "object": "eval.run.output_item", + "id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "created_at": 1743092076, + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "status": "pass", + "datasource_item_id": 5, + "datasource_item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + }, + "results": [ + { + "name": "String check-a2486074-d803-4445-b431-ad2262e85d47", + "sample": null, + "passed": true, + "score": 1.0 + } + ], + "sample": { + "input": [ + { + "role": "developer", + "content": "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", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + }, + { + "role": "user", + "content": "Stock Markets Rally After Positive Economic Data Released", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "output": [ + { + "role": "assistant", + "content": "Markets", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "finish_reason": "stop", + "model": "gpt-4o-mini-2024-07-18", + "usage": { + "total_tokens": 325, + "completion_tokens": 2, + "prompt_tokens": 323, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } + /files: + get: + operationId: listFiles + tags: + - Files + summary: Returns a list of files. + parameters: + - in: query + name: purpose + required: false + schema: + type: string + description: Only return files with the given purpose. + - name: limit + in: query + description: | + A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000. + required: false + schema: + type: integer + default: 10000 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFilesResponse' + x-oaiMeta: + name: List files + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.files.list() + page = page.data[0] + print(page) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.files.list(); + + for await (const file of list) { + console.log(file); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fileObject of client.files.list()) { + console.log(fileObject); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Files.List(context.TODO(), openai.FileListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileListPage; + import com.openai.models.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileListPage page = client.files().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.files.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "file", + "bytes": 175, + "created_at": 1613677385, + "expires_at": 1677614202, + "filename": "salesOverview.pdf", + "purpose": "assistants", + }, + { + "id": "file-abc456", + "object": "file", + "bytes": 140, + "created_at": 1613779121, + "expires_at": 1677614202, + "filename": "puppy.jsonl", + "purpose": "fine-tune", + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + post: + operationId: createFile + tags: + - Files + summary: | + Upload a file that can be used across various endpoints. Individual files + can be up to 512 MB, and each project can store up to 2.5 TB of files in + total. There is no organization-wide storage limit. Uploads to this + endpoint are rate-limited to 1,000 requests per minute per authenticated + user. + + - The Assistants API supports files up to 2 million tokens and of specific + file types. See the [Assistants Tools guide](/docs/assistants/tools) for + details. + - The Fine-tuning API only supports `.jsonl` files. The input also has + certain required formats for fine-tuning + [chat](/docs/api-reference/fine-tuning/chat-input) or + [completions](/docs/api-reference/fine-tuning/completions-input) models. + - The Batch API only supports `.jsonl` files up to 200 MB in size. The input + also has a specific required + [format](/docs/api-reference/batch/request-input). + - 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_stores/{vector_store_id}/file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch) + instead of attaching them one by one. Vector store attachment has separate + limits from file upload, including 2,000 attached files per minute per + organization. + + Please [contact us](https://help.openai.com/) if you need to increase these + storage limits. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateFileRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIFile' + 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. + examples: + request: + curl: | + curl https://api.openai.com/v1/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F purpose="fine-tune" \ + -F file="@mydata.jsonl" + -F expires_after[anchor]="created_at" + -F expires_after[seconds]=2592000 + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file_object = client.files.create( + file=b"Example data", + purpose="assistants", + ) + print(file_object.id) + javascript: |- + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.create({ + file: fs.createReadStream("mydata.jsonl"), + purpose: "fine-tune", + expires_after: { + anchor: "created_at", + seconds: 2592000 + } + }); + + console.log(file); + } + + main(); + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fileObject = await client.files.create({ + file: fs.createReadStream('fine-tune.jsonl'), + purpose: 'assistants', + }); + + console.log(fileObject.id); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfileObject, err := client.Files.New(context.TODO(), openai.FileNewParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tPurpose: openai.FilePurposeAssistants,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fileObject.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileCreateParams; + import com.openai.models.files.FileObject; + import com.openai.models.files.FilePurpose; + import java.io.ByteArrayInputStream; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileCreateParams params = FileCreateParams.builder() + .file(new ByteArrayInputStream("Example data".getBytes())) + .purpose(FilePurpose.ASSISTANTS) + .build(); + FileObject fileObject = client.files().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file_object = openai.files.create(file: StringIO.new("Example data"), purpose: :assistants) + + puts(file_object) + response: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1677614202, + "filename": "mydata.jsonl", + "purpose": "fine-tune", + } + /files/{file_id}: + delete: + operationId: deleteFile + tags: + - Files + summary: Delete a file and remove it from all vector stores. + parameters: + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to use for this request. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteFileResponse' + x-oaiMeta: + name: Delete file + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files/file-abc123 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file_deleted = client.files.delete( + "file_id", + ) + print(file_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.delete("file-abc123"); + + console.log(file); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fileDeleted = await client.files.delete('file_id'); + + console.log(fileDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfileDeleted, err := client.Files.Delete(context.TODO(), \"file_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fileDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileDeleteParams; + import com.openai.models.files.FileDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileDeleted fileDeleted = client.files().delete("file_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file_deleted = openai.files.delete("file_id") + + puts(file_deleted) + response: | + { + "id": "file-abc123", + "object": "file", + "deleted": true + } + get: + operationId: retrieveFile + tags: + - Files + summary: Returns information about a specific file. + parameters: + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to use for this request. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIFile' + x-oaiMeta: + name: Retrieve file + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files/file-abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file_object = client.files.retrieve( + "file_id", + ) + print(file_object.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.retrieve("file-abc123"); + + console.log(file); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fileObject = await client.files.retrieve('file_id'); + + console.log(fileObject.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfileObject, err := client.Files.Get(context.TODO(), \"file_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fileObject.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileObject; + import com.openai.models.files.FileRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileObject fileObject = client.files().retrieve("file_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file_object = openai.files.retrieve("file_id") + + puts(file_object) + response: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1677614202, + "filename": "mydata.jsonl", + "purpose": "fine-tune", + } + /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions: + get: + operationId: listFineTuningCheckpointPermissions + tags: + - Fine-tuning + summary: | + **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + + Organization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint. + parameters: + - in: path + name: fine_tuned_model_checkpoint + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuned model checkpoint to get permissions for. + - name: project_id + in: query + description: The ID of the project to get permissions for. + required: false + schema: + type: string + - name: after + in: query + description: Identifier for the last permission ID from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of permissions to retrieve. + required: false + schema: + type: integer + default: 10 + - name: order + in: query + description: The order in which to retrieve permissions. + required: false + schema: + type: string + enum: + - ascending + - descending + default: descending + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFineTuningCheckpointPermissionResponse' + 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 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const permission = await client.fineTuning.checkpoints.permissions.retrieve( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + ); + + console.log(permission.first_id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + permission = client.fine_tuning.checkpoints.permissions.retrieve( + fine_tuned_model_checkpoint="ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(permission.first_id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpermission, err := client.FineTuning.Checkpoints.Permissions.Get(\n\t\tcontext.TODO(),\n\t\t\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n\t\topenai.FineTuningCheckpointPermissionGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", permission.FirstID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.checkpoints.permissions.PermissionRetrieveParams; + import com.openai.models.finetuning.checkpoints.permissions.PermissionRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PermissionRetrieveResponse permission = client.fineTuning().checkpoints().permissions().retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + permission = openai.fine_tuning.checkpoints.permissions.retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(permission) + response: | + { + "object": "list", + "data": [ + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + }, + { + "object": "checkpoint.permission", + "id": "cp_enQCFmOTGj3syEpYVhBRLTSy", + "created_at": 1721764800, + "project_id": "proj_iqGMw1llN8IrBb6SvvY5A1oF" + }, + ], + "first_id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "cp_enQCFmOTGj3syEpYVhBRLTSy", + "has_more": false + } + post: + operationId: createFineTuningCheckpointPermission + tags: + - Fine-tuning + summary: | + **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys). + + This enables organization owners to share fine-tuned models with other projects in their organization. + parameters: + - in: path + name: fine_tuned_model_checkpoint + required: true + schema: + type: string + example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd + description: | + The ID of the fine-tuned model checkpoint to create a permission for. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateFineTuningCheckpointPermissionRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFineTuningCheckpointPermissionResponse' + x-oaiMeta: + name: Create 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 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + -d '{"project_ids": ["proj_abGMw1llN8IrBb6SvvY5A1iH"]}' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const permissionCreateResponse of client.fineTuning.checkpoints.permissions.create( + 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + { project_ids: ['string'] }, + )) { + console.log(permissionCreateResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.checkpoints.permissions.create( + fine_tuned_model_checkpoint="ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd", + project_ids=["string"], + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Checkpoints.Permissions.New(\n\t\tcontext.TODO(),\n\t\t\"ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd\",\n\t\topenai.FineTuningCheckpointPermissionNewParams{\n\t\t\tProjectIDs: []string{\"string\"},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.checkpoints.permissions.PermissionCreatePage; + import com.openai.models.finetuning.checkpoints.permissions.PermissionCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PermissionCreateParams params = PermissionCreateParams.builder() + .fineTunedModelCheckpoint("ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd") + .addProjectId("string") + .build(); + PermissionCreatePage page = client.fineTuning().checkpoints().permissions().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.fine_tuning.checkpoints.permissions.create( + "ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd", + project_ids: ["string"] + ) + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + } + ], + "first_id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "has_more": false + } + /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}: + delete: + operationId: deleteFineTuningCheckpointPermission + tags: + - Fine-tuning + summary: | + **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + + Organization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint. + parameters: + - in: path + name: fine_tuned_model_checkpoint + required: true + schema: + type: string + example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd + description: | + The ID of the fine-tuned model checkpoint to delete a permission for. + - in: path + name: permission_id + required: true + schema: + type: string + example: cp_zc4Q7MP6XxulcVzj4MZdwsAB + description: | + The ID of the fine-tuned model checkpoint permission to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteFineTuningCheckpointPermissionResponse' + x-oaiMeta: + name: Delete checkpoint permission + 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/cp_zc4Q7MP6XxulcVzj4MZdwsAB \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const permission = await client.fineTuning.checkpoints.permissions.delete( + 'cp_zc4Q7MP6XxulcVzj4MZdwsAB', + { fine_tuned_model_checkpoint: 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd' }, + ); + + console.log(permission.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + permission = client.fine_tuning.checkpoints.permissions.delete( + permission_id="cp_zc4Q7MP6XxulcVzj4MZdwsAB", + fine_tuned_model_checkpoint="ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd", + ) + print(permission.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpermission, err := client.FineTuning.Checkpoints.Permissions.Delete(\n\t\tcontext.TODO(),\n\t\t\"ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd\",\n\t\t\"cp_zc4Q7MP6XxulcVzj4MZdwsAB\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", permission.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.checkpoints.permissions.PermissionDeleteParams; + import com.openai.models.finetuning.checkpoints.permissions.PermissionDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PermissionDeleteParams params = PermissionDeleteParams.builder() + .fineTunedModelCheckpoint("ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd") + .permissionId("cp_zc4Q7MP6XxulcVzj4MZdwsAB") + .build(); + PermissionDeleteResponse permission = client.fineTuning().checkpoints().permissions().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + permission = openai.fine_tuning.checkpoints.permissions.delete( + "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + fine_tuned_model_checkpoint: "ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd" + ) + + puts(permission) + response: | + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "deleted": true + } + /fine_tuning/jobs: + post: + operationId: createFineTuningJob + tags: + - Fine-tuning + summary: | + Creates a fine-tuning job which begins the process of creating a new model from a given dataset. + + Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. + + [Learn more about fine-tuning](/docs/guides/model-optimization) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateFineTuningJobRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Create fine-tuning job + group: fine-tuning + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-BK7bzQj3FfZFXr7DbL6xJwfo", + "model": "gpt-4o-mini" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123" + }); + + console.log(fineTune); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + } + } + }, + "metadata": null + } + - title: Epochs + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "model": "gpt-4o-mini", + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 2 + } + } + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + import { SupervisedMethod, SupervisedHyperparameters } from "openai/resources/fine-tuning/methods"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123", + model: "gpt-4o-mini", + method: { + type: "supervised", + supervised: { + hyperparameters: { + n_epochs: 2 + } + } + } + }); + + console.log(fineTune); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": 2 + }, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": 2 + } + } + }, + "metadata": null, + "error": { + "code": null, + "message": null, + "param": null + }, + "finished_at": null, + "seed": 683058546, + "trained_tokens": null, + "estimated_finish": null, + "integrations": [], + "user_provided_suffix": null, + "usage_metrics": null, + "shared_with_openai": false + } + - title: DPO + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini", + "method": { + "type": "dpo", + "dpo": { + "hyperparameters": { + "beta": 0.1 + } + } + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc", + "model": "gpt-4o-mini", + "created_at": 1746130590, + "fine_tuned_model": null, + "organization_id": "org-abc", + "result_files": [], + "status": "queued", + "validation_file": "file-123", + "training_file": "file-abc", + "method": { + "type": "dpo", + "dpo": { + "hyperparameters": { + "beta": 0.1, + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto" + } + } + }, + "metadata": null, + "error": { + "code": null, + "message": null, + "param": null + }, + "finished_at": null, + "hyperparameters": null, + "seed": 1036326793, + "estimated_finish": null, + "integrations": [], + "user_provided_suffix": null, + "usage_metrics": null, + "shared_with_openai": false + } + - title: Reinforcement + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc", + "validation_file": "file-123", + "model": "o4-mini", + "method": { + "type": "reinforcement", + "reinforcement": { + "grader": { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + }, + "hyperparameters": { + "reasoning_effort": "medium" + } + } + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "o4-mini", + "created_at": 1721764800, + "finished_at": null, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "validating_files", + "validation_file": "file-123", + "training_file": "file-abc", + "trained_tokens": null, + "error": {}, + "user_provided_suffix": null, + "seed": 950189191, + "estimated_finish": null, + "integrations": [], + "method": { + "type": "reinforcement", + "reinforcement": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + "eval_interval": "auto", + "eval_samples": "auto", + "compute_multiplier": "auto", + "reasoning_effort": "medium" + }, + "grader": { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + }, + "response_format": null + } + }, + "metadata": null, + "usage_metrics": null, + "shared_with_openai": false + } + + - title: Validation file + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123", + validation_file: "file-abc123" + }); + + console.log(fineTune); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123", + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + } + } + }, + "metadata": null + } + - title: W&B Integration + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini", + "integrations": [ + { + "type": "wandb", + "wandb": { + "project": "my-wandb-project", + "name": "ft-run-display-name" + "tags": [ + "first-experiment", "v2" + ] + } + } + ] + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123", + "integrations": [ + { + "type": "wandb", + "wandb": { + "project": "my-wandb-project", + "entity": None, + "run_id": "ftjob-abc123" + } + } + ], + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + } + } + }, + "metadata": null + } + get: + operationId: listPaginatedFineTuningJobs + tags: + - Fine-tuning + summary: | + List your organization's fine-tuning jobs + parameters: + - name: after + in: query + description: Identifier for the last job from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of fine-tuning jobs to retrieve. + required: false + schema: + type: integer + default: 20 + - in: query + name: metadata + required: false + schema: + type: object + nullable: true + 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. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListPaginatedFineTuningJobsResponse' + 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 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.jobs.list() + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.fineTuning.jobs.list(); + + for await (const fineTune of list) { + console.log(fineTune); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fineTuningJob of client.fineTuning.jobs.list()) { + console.log(fineTuningJob.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Jobs.List(context.TODO(), openai.FineTuningJobListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.JobListPage; + import com.openai.models.finetuning.jobs.JobListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobListPage page = client.fineTuning().jobs().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.fine_tuning.jobs.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "metadata": { + "key": "value" + } + }, + { ... }, + { ... } + ], "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}: + get: + operationId: retrieveFineTuningJob + tags: + - Fine-tuning + summary: | + Get info about a fine-tuning job. + + [Learn more about fine-tuning](/docs/guides/model-optimization) + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Retrieve fine-tuning job + group: fine-tuning + examples: + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.retrieve( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.retrieve("ftjob-abc123"); + + console.log(fineTune); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.retrieve('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Get(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "davinci-002", + "created_at": 1692661014, + "finished_at": 1692661190, + "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + "organization_id": "org-123", + "result_files": [ + "file-abc123" + ], + "status": "succeeded", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + }, + "trained_tokens": 5768, + "integrations": [], + "seed": 0, + "estimated_finish": 0, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + } + } + } + } + /fine_tuning/jobs/{fine_tuning_job_id}/cancel: + post: + operationId: cancelFineTuningJob + tags: + - Fine-tuning + summary: | + Immediately cancel a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to cancel. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Cancel fine-tuning + group: fine-tuning + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.cancel( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.cancel("ftjob-abc123"); + + console.log(fineTune); + } + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.cancel('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Cancel(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().cancel("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.cancel("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "cancelled", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } + /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints: + get: + operationId: listFineTuningJobCheckpoints + tags: + - Fine-tuning + summary: | + List checkpoints for a fine-tuning job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to get checkpoints for. + - name: after + in: query + description: Identifier for the last checkpoint ID from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of checkpoints to retrieve. + required: false + schema: + type: integer + default: 10 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFineTuningJobCheckpointsResponse' + x-oaiMeta: + name: List fine-tuning checkpoints + group: fine-tuning + examples: + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/checkpoints \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fineTuningJobCheckpoint of client.fineTuning.jobs.checkpoints.list( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + )) { + console.log(fineTuningJobCheckpoint.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.jobs.checkpoints.list( + fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Jobs.Checkpoints.List(\n\t\tcontext.TODO(),\n\t\t\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n\t\topenai.FineTuningJobCheckpointListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.checkpoints.CheckpointListPage; + import com.openai.models.finetuning.jobs.checkpoints.CheckpointListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CheckpointListPage page = client.fineTuning().jobs().checkpoints().list("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.fine_tuning.jobs.checkpoints.list("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:96olL566:ckpt-step-2000", + "metrics": { + "full_valid_loss": 0.134, + "full_valid_mean_token_accuracy": 0.874 + }, + "fine_tuning_job_id": "ftjob-abc123", + "step_number": 2000 + }, + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_enQCFmOTGj3syEpYVhBRLTSy", + "created_at": 1721764800, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:7q8mpxmy:ckpt-step-1000", + "metrics": { + "full_valid_loss": 0.167, + "full_valid_mean_token_accuracy": 0.781 + }, + "fine_tuning_job_id": "ftjob-abc123", + "step_number": 1000 + } + ], + "first_id": "ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "ftckpt_enQCFmOTGj3syEpYVhBRLTSy", + "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}/events: + get: + operationId: listFineTuningEvents + tags: + - Fine-tuning + summary: | + Get status updates for a fine-tuning job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to get events for. + - name: after + in: query + description: Identifier for the last event from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of events to retrieve. + required: false + schema: + type: integer + default: 20 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFineTuningJobEventsResponse' + x-oaiMeta: + name: List fine-tuning events + group: fine-tuning + examples: + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/events \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.jobs.list_events( + fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.fineTuning.list_events(id="ftjob-abc123", limit=2); + + for await (const fineTune of list) { + console.log(fineTune); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fineTuningJobEvent of client.fineTuning.jobs.listEvents( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + )) { + console.log(fineTuningJobEvent.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Jobs.ListEvents(\n\t\tcontext.TODO(),\n\t\t\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n\t\topenai.FineTuningJobListEventsParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.JobListEventsPage; + import com.openai.models.finetuning.jobs.JobListEventsParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobListEventsPage page = client.fineTuning().jobs().listEvents("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.fine_tuning.jobs.list_events("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job.event", + "id": "ft-event-ddTJfwuMVpfLXseO0Am0Gqjm", + "created_at": 1721764800, + "level": "info", + "message": "Fine tuning job successfully completed", + "data": null, + "type": "message" + }, + { + "object": "fine_tuning.job.event", + "id": "ft-event-tyiGuB72evQncpH87xe505Sv", + "created_at": 1721764800, + "level": "info", + "message": "New fine-tuned model created: ft:gpt-4o-mini:openai::7p4lURel", + "data": null, + "type": "message" + } + ], + "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}/pause: + post: + operationId: pauseFineTuningJob + tags: + - Fine-tuning + summary: | + Pause a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to pause. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Pause fine-tuning + group: fine-tuning + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/pause \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.pause( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.pause("ftjob-abc123"); + + console.log(fineTune); + } + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.pause('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Pause(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobPauseParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().pause("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.pause("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "paused", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } + /fine_tuning/jobs/{fine_tuning_job_id}/resume: + post: + operationId: resumeFineTuningJob + tags: + - Fine-tuning + summary: | + Resume a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to resume. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Resume fine-tuning + group: fine-tuning + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/resume \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.resume( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.resume("ftjob-abc123"); + + console.log(fineTune); + } + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.resume('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Resume(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobResumeParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().resume("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.resume("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } + /models: + get: + operationId: listModels + tags: + - Models + summary: Lists the currently available models, and provides basic information about each one such as the owner and availability. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListModelsResponse' + x-oaiMeta: + name: List models + group: models + examples: + request: + curl: | + curl https://api.openai.com/v1/models \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.models.list() + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.models.list(); + + for await (const model of list) { + console.log(model); + } + } + main(); + csharp: | + using System; + + using OpenAI.Models; + + OpenAIModelClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + foreach (var model in client.GetModels().Value) + { + Console.WriteLine(model.Id); + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const model of client.models.list()) { + console.log(model.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Models.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.models.ModelListPage; + import com.openai.models.models.ModelListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ModelListPage page = client.models().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.models.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "model-id-0", + "object": "model", + "created": 1686935002, + "owned_by": "organization-owner" + }, + { + "id": "model-id-1", + "object": "model", + "created": 1686935002, + "owned_by": "organization-owner", + }, + { + "id": "model-id-2", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + }, + ] + } + /models/{model}: + get: + operationId: retrieveModel + tags: + - Models + summary: Retrieves a model instance, providing basic information about the model such as the owner and permissioning. + parameters: + - in: path + name: model + required: true + schema: + type: string + example: gpt-4o-mini + description: The ID of the model to use for this request + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Model' + x-oaiMeta: + name: Retrieve model + group: models + examples: + request: + curl: | + curl https://api.openai.com/v1/models/VAR_chat_model_id \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + model = client.models.retrieve( + "gpt-4o-mini", + ) + print(model.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const model = await openai.models.retrieve("VAR_chat_model_id"); + + console.log(model); + } + + main(); + csharp: | + using System; + using System.ClientModel; + + using OpenAI.Models; + + OpenAIModelClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ClientResult model = client.GetModel("babbage-002"); + Console.WriteLine(model.Value.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const model = await client.models.retrieve('gpt-4o-mini'); + + console.log(model.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmodel, err := client.Models.Get(context.TODO(), \"gpt-4o-mini\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", model.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.models.Model; + import com.openai.models.models.ModelRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Model model = client.models().retrieve("gpt-4o-mini"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + model = openai.models.retrieve("gpt-4o-mini") + + puts(model) + response: | + { + "id": "VAR_chat_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + } + delete: + operationId: deleteModel + tags: + - Models + summary: Delete a fine-tuned model. You must have the Owner role in your organization to delete a model. + parameters: + - in: path + name: model + required: true + schema: + type: string + example: ft:gpt-4o-mini:acemeco:suffix:abc123 + description: The model to delete + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteModelResponse' + 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 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + model_deleted = client.models.delete( + "ft:gpt-4o-mini:acemeco:suffix:abc123", + ) + print(model_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const model = await openai.models.delete("ft:gpt-4o-mini:acemeco:suffix:abc123"); + + console.log(model); + } + main(); + csharp: | + using System; + using System.ClientModel; + + using OpenAI.Models; + + OpenAIModelClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ClientResult success = client.DeleteModel("ft:gpt-4o-mini:acemeco:suffix:abc123"); + Console.WriteLine(success); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const modelDeleted = await client.models.delete('ft:gpt-4o-mini:acemeco:suffix:abc123'); + + console.log(modelDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmodelDeleted, err := client.Models.Delete(context.TODO(), \"ft:gpt-4o-mini:acemeco:suffix:abc123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", modelDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.models.ModelDeleteParams; + import com.openai.models.models.ModelDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ModelDeleted modelDeleted = client.models().delete("ft:gpt-4o-mini:acemeco:suffix:abc123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + model_deleted = openai.models.delete("ft:gpt-4o-mini:acemeco:suffix:abc123") + + puts(model_deleted) + response: | + { + "id": "ft:gpt-4o-mini:acemeco:suffix:abc123", + "object": "model", + "deleted": true + } + /threads: + post: + operationId: createThread + tags: + - Assistants + summary: Create a thread. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateThreadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadObject' + x-oaiMeta: + name: Create thread + group: threads + beta: true + examples: + - title: Empty + request: + curl: | + curl https://api.openai.com/v1/threads \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.create() + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const emptyThread = await openai.beta.threads.create(); + + console.log(emptyThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.create(); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.New(context.TODO(), openai.BetaThreadNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.create + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699012949, + "metadata": {}, + "tool_resources": {} + } + - title: Messages + request: + curl: | + curl https://api.openai.com/v1/threads \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "messages": [{ + "role": "user", + "content": "Hello, what is AI?" + }, { + "role": "user", + "content": "How does AI work? Explain it in simple terms." + }] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.create() + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const messageThread = await openai.beta.threads.create({ + messages: [ + { + role: "user", + content: "Hello, what is AI?" + }, + { + role: "user", + content: "How does AI work? Explain it in simple terms.", + }, + ], + }); + + console.log(messageThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.create(); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.New(context.TODO(), openai.BetaThreadNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.create + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": {}, + "tool_resources": {} + } + /threads/runs: + post: + operationId: createThreadAndRun + tags: + - Assistants + summary: Create a thread and run it in one request. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateThreadAndRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Create thread and run + group: threads + beta: true + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "thread": { + "messages": [ + {"role": "user", "content": "Explain deep learning to a 5 year old."} + ] + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for thread in client.beta.threads.create_and_run( + assistant_id="assistant_id", + ): + print(thread) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.createAndRun({ + assistant_id: "asst_abc123", + thread: { + messages: [ + { role: "user", content: "Explain deep learning to a 5 year old." }, + ], + }, + }); + + console.log(run); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.createAndRun({ assistant_id: 'assistant_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.NewAndRun(context.TODO(), openai.BetaThreadNewAndRunParams{\n\t\tAssistantID: \"assistant_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadCreateAndRunParams; + import com.openai.models.beta.threads.runs.Run; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadCreateAndRunParams params = ThreadCreateAndRunParams.builder() + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().createAndRun(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.create_and_run(assistant_id: "assistant_id") + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699076792, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "queued", + "started_at": null, + "expires_at": 1699077392, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4o", + "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", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_123", + "thread": { + "messages": [ + {"role": "user", "content": "Hello"} + ] + }, + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for thread in client.beta.threads.create_and_run( + assistant_id="assistant_id", + ): + print(thread) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.createAndRun({ + assistant_id: "asst_123", + thread: { + messages: [ + { role: "user", content: "Hello" }, + ], + }, + stream: true + }); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.createAndRun({ assistant_id: 'assistant_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.NewAndRun(context.TODO(), openai.BetaThreadNewAndRunParams{\n\t\tAssistantID: \"assistant_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadCreateAndRunParams; + import com.openai.models.beta.threads.runs.Run; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadCreateAndRunParams params = ThreadCreateAndRunParams.builder() + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().createAndRun(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.create_and_run(assistant_id: "assistant_id") + + puts(run) + response: | + event: thread.created + data: {"id":"thread_123","object":"thread","created_at":1710348075,"metadata":{}} + + event: thread.run.created + data: {"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-4o","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} + + event: thread.run.queued + data: {"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-4o","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} + + event: thread.run.in_progress + data: {"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-4o","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} + + event: thread.run.step.created + data: {"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} + + event: thread.run.step.in_progress + data: {"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} + + event: thread.message.created + data: {"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":{}} + + event: thread.message.in_progress + data: {"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":{}} + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + ... + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}} + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + event: thread.message.completed + data: {"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":{}} + + event: thread.run.step.completed + data: {"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}} + + event: thread.run.completed + {"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-4o","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} + + event: done + data: [DONE] + - title: Streaming with Functions + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "thread": { + "messages": [ + {"role": "user", "content": "What is the weather like in San Francisco?"} + ] + }, + "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"] + } + } + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for thread in client.beta.threads.create_and_run( + assistant_id="assistant_id", + ): + print(thread) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const 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"], + }, + } + } + ]; + + async function main() { + const stream = await openai.beta.threads.createAndRun({ + assistant_id: "asst_123", + thread: { + messages: [ + { role: "user", content: "What is the weather like in San Francisco?" }, + ], + }, + tools: tools, + stream: true + }); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.createAndRun({ assistant_id: 'assistant_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.NewAndRun(context.TODO(), openai.BetaThreadNewAndRunParams{\n\t\tAssistantID: \"assistant_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadCreateAndRunParams; + import com.openai.models.beta.threads.runs.Run; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadCreateAndRunParams params = ThreadCreateAndRunParams.builder() + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().createAndRun(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.create_and_run(assistant_id: "assistant_id") + + puts(run) + response: | + event: thread.created + data: {"id":"thread_123","object":"thread","created_at":1710351818,"metadata":{}} + + event: thread.run.created + data: {"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-4o","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}} + + event: thread.run.queued + data: {"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-4o","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}} + + event: thread.run.in_progress + data: {"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-4o","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}} + + event: thread.run.step.created + data: {"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} + + event: thread.run.step.in_progress + data: {"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} + + event: thread.run.step.delta + data: {"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}}]}}} + + event: thread.run.step.delta + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]}}} + + event: thread.run.step.delta + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"location"}}]}}} + + ... + + event: thread.run.step.delta + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"ahrenheit"}}]}}} + + event: thread.run.step.delta + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]}}} + + event: thread.run.requires_action + data: {"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-4o","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}} + + event: done + data: [DONE] + /threads/{thread_id}: + get: + operationId: getThread + tags: + - Assistants + summary: Retrieves a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to retrieve. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadObject' + x-oaiMeta: + name: Retrieve thread + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.retrieve( + "thread_id", + ) + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myThread = await openai.beta.threads.retrieve( + "thread_abc123" + ); + + console.log(myThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.retrieve('thread_id'); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.Get(context.TODO(), \"thread_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().retrieve("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.retrieve("thread_id") + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": {}, + "tool_resources": { + "code_interpreter": { + "file_ids": [] + } + } + } + post: + operationId: modifyThread + tags: + - Assistants + summary: Modifies a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to modify. Only the `metadata` can be modified. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyThreadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadObject' + x-oaiMeta: + name: Modify thread + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "modified": "true", + "user": "abc123" + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.update( + thread_id="thread_id", + ) + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const updatedThread = await openai.beta.threads.update( + "thread_abc123", + { + metadata: { modified: "true", user: "abc123" }, + } + ); + + console.log(updatedThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.update('thread_id'); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().update("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.update("thread_id") + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": { + "modified": "true", + "user": "abc123" + }, + "tool_resources": {} + } + delete: + operationId: deleteThread + tags: + - Assistants + summary: Delete a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteThreadResponse' + x-oaiMeta: + name: Delete thread + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread_deleted = client.beta.threads.delete( + "thread_id", + ) + print(thread_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const response = await openai.beta.threads.delete("thread_abc123"); + + console.log(response); + } + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const threadDeleted = await client.beta.threads.delete('thread_id'); + + console.log(threadDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthreadDeleted, err := client.Beta.Threads.Delete(context.TODO(), \"thread_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", threadDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadDeleteParams; + import com.openai.models.beta.threads.ThreadDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadDeleted threadDeleted = client.beta().threads().delete("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread_deleted = openai.beta.threads.delete("thread_id") + + puts(thread_deleted) + response: | + { + "id": "thread_abc123", + "object": "thread.deleted", + "deleted": true + } + /threads/{thread_id}/messages: + get: + operationId: listMessages + tags: + - Assistants + summary: Returns a list of messages for a given thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) the messages belong to. + - name: limit + in: query + description: | + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + - name: run_id + in: query + description: | + Filter messages by the run ID that generated them. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListMessagesResponse' + x-oaiMeta: + name: List messages + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.threads.messages.list( + thread_id="thread_id", + ) + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const threadMessages = await openai.beta.threads.messages.list( + "thread_abc123" + ); + + console.log(threadMessages.data); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const message of client.beta.threads.messages.list('thread_id')) { + console.log(message.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Threads.Messages.List(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadMessageListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.messages.MessageListPage; + import com.openai.models.beta.threads.messages.MessageListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageListPage page = client.beta().threads().messages().list("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.threads.messages.list("thread_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699016383, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + }, + { + "id": "msg_abc456", + "object": "thread.message", + "created_at": 1699016383, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Hello, what is AI?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + ], + "first_id": "msg_abc123", + "last_id": "msg_abc456", + "has_more": false + } + post: + operationId: createMessage + tags: + - Assistants + summary: Create a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) to create a message for. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateMessageRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MessageObject' + x-oaiMeta: + name: Create message + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "role": "user", + "content": "How does AI work? Explain it in simple terms." + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message = client.beta.threads.messages.create( + thread_id="thread_id", + content="string", + role="user", + ) + print(message.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const threadMessages = await openai.beta.threads.messages.create( + "thread_abc123", + { role: "user", content: "How does AI work? Explain it in simple terms." } + ); + + console.log(threadMessages); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const message = await client.beta.threads.messages.create('thread_id', { + content: 'string', + role: 'user', + }); + + console.log(message.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.Beta.Threads.Messages.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadMessageNewParams{\n\t\t\tContent: openai.BetaThreadMessageNewParamsContentUnion{\n\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t},\n\t\t\tRole: openai.BetaThreadMessageNewParamsRoleUser,\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.messages.Message; + import com.openai.models.beta.threads.messages.MessageCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageCreateParams params = MessageCreateParams.builder() + .threadId("thread_id") + .content("string") + .role(MessageCreateParams.Role.USER) + .build(); + Message message = client.beta().threads().messages().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + message = openai.beta.threads.messages.create("thread_id", content: "string", role: :user) + + puts(message) + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1713226573, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + /threads/{thread_id}/messages/{message_id}: + get: + operationId: getMessage + tags: + - Assistants + summary: Retrieve a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) to which this message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to retrieve. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MessageObject' + x-oaiMeta: + name: Retrieve message + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message = client.beta.threads.messages.retrieve( + message_id="message_id", + thread_id="thread_id", + ) + print(message.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const message = await openai.beta.threads.messages.retrieve( + "msg_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(message); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const message = await client.beta.threads.messages.retrieve('message_id', { + thread_id: 'thread_id', + }); + + console.log(message.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.Beta.Threads.Messages.Get(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"message_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.messages.Message; + import com.openai.models.beta.threads.messages.MessageRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageRetrieveParams params = MessageRetrieveParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + Message message = client.beta().threads().messages().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + message = openai.beta.threads.messages.retrieve("message_id", thread_id: "thread_id") + + puts(message) + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699017614, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + post: + operationId: modifyMessage + tags: + - Assistants + summary: Modifies a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to modify. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyMessageRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MessageObject' + x-oaiMeta: + name: Modify message + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "modified": "true", + "user": "abc123" + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message = client.beta.threads.messages.update( + message_id="message_id", + thread_id="thread_id", + ) + print(message.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const message = await openai.beta.threads.messages.update( + "thread_abc123", + "msg_abc123", + { + metadata: { + modified: "true", + user: "abc123", + }, + } + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const message = await client.beta.threads.messages.update('message_id', { thread_id: 'thread_id' }); + + console.log(message.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.Beta.Threads.Messages.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"message_id\",\n\t\topenai.BetaThreadMessageUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.messages.Message; + import com.openai.models.beta.threads.messages.MessageUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageUpdateParams params = MessageUpdateParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + Message message = client.beta().threads().messages().update(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + message = openai.beta.threads.messages.update("message_id", thread_id: "thread_id") + + puts(message) + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699017614, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "file_ids": [], + "metadata": { + "modified": "true", + "user": "abc123" + } + } + delete: + operationId: deleteMessage + tags: + - Assistants + summary: Deletes a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteMessageResponse' + x-oaiMeta: + name: Delete message + group: threads + beta: true + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message_deleted = client.beta.threads.messages.delete( + message_id="message_id", + thread_id="thread_id", + ) + print(message_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const deletedMessage = await openai.beta.threads.messages.delete( + "msg_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(deletedMessage); + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const messageDeleted = await client.beta.threads.messages.delete('message_id', { + thread_id: 'thread_id', + }); + + console.log(messageDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessageDeleted, err := client.Beta.Threads.Messages.Delete(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"message_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", messageDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.messages.MessageDeleteParams; + import com.openai.models.beta.threads.messages.MessageDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageDeleteParams params = MessageDeleteParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + MessageDeleted messageDeleted = client.beta().threads().messages().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + message_deleted = openai.beta.threads.messages.delete("message_id", thread_id: "thread_id") + + puts(message_deleted) + response: | + { + "id": "msg_abc123", + "object": "thread.message.deleted", + "deleted": true + } + /threads/{thread_id}/runs: + get: + operationId: listRuns + tags: + - Assistants + summary: Returns a list of runs belonging to a thread. + parameters: + - name: thread_id + in: path + required: true + schema: + type: string + description: The ID of the thread the run belongs to. + - name: limit + in: query + description: | + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListRunsResponse' + x-oaiMeta: + name: List runs + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.threads.runs.list( + thread_id="thread_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const runs = await openai.beta.threads.runs.list( + "thread_abc123" + ); + + console.log(runs); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const run of client.beta.threads.runs.list('thread_id')) { + console.log(run.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Threads.Runs.List(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.RunListPage; + import com.openai.models.beta.threads.runs.RunListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunListPage page = client.beta().threads().runs().list("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.threads.runs.list("thread_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + }, + { + "id": "run_abc456", + "object": "thread.run", + "created_at": 1699063290, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699063290, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699063291, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + ], + "first_id": "run_abc123", + "last_id": "run_abc456", + "has_more": false + } + post: + operationId: createRun + tags: + - Assistants + summary: Create a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to run. + - name: include[] + in: query + description: | + A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Create run + group: threads + beta: true + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.create( + thread_id="thread_id", + assistant_id="assistant_id", + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.create( + "thread_abc123", + { assistant_id: "asst_abc123" } + ); + + console.log(run); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.create('thread_id', { assistant_id: 'assistant_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunNewParams{\n\t\t\tAssistantID: \"assistant_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .threadId("thread_id") + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().runs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.create("thread_id", assistant_id: "assistant_id") + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699063290, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "queued", + "started_at": 1699063290, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699063291, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/threads/thread_123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_123", + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.create( + thread_id="thread_id", + assistant_id="assistant_id", + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.runs.create( + "thread_123", + { assistant_id: "asst_123", stream: true } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.create('thread_id', { assistant_id: 'assistant_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunNewParams{\n\t\t\tAssistantID: \"assistant_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .threadId("thread_id") + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().runs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.create("thread_id", assistant_id: "assistant_id") + + puts(run) + response: | + event: thread.run.created + data: {"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-4o","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}} + + event: thread.run.queued + data: {"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-4o","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}} + + event: thread.run.in_progress + data: {"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-4o","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}} + + event: thread.run.step.created + data: {"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} + + event: thread.run.step.in_progress + data: {"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} + + event: thread.message.created + data: {"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":{}} + + event: thread.message.in_progress + data: {"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":{}} + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + ... + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}} + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + event: thread.message.completed + data: {"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":{}} + + event: thread.run.step.completed + data: {"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}} + + event: thread.run.completed + data: {"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-4o","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}} + + event: done + data: [DONE] + - title: Streaming with Functions + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "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"] + } + } + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.create( + thread_id="thread_id", + assistant_id="assistant_id", + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const 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"], + }, + } + } + ]; + + async function main() { + const stream = await openai.beta.threads.runs.create( + "thread_abc123", + { + assistant_id: "asst_abc123", + tools: tools, + stream: true + } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.create('thread_id', { assistant_id: 'assistant_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunNewParams{\n\t\t\tAssistantID: \"assistant_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .threadId("thread_id") + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().runs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.create("thread_id", assistant_id: "assistant_id") + + puts(run) + response: | + event: thread.run.created + data: {"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-4o","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}} + + event: thread.run.queued + data: {"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-4o","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}} + + event: thread.run.in_progress + data: {"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-4o","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}} + + event: thread.run.step.created + data: {"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} + + event: thread.run.step.in_progress + data: {"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} + + event: thread.message.created + data: {"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":{}} + + event: thread.message.in_progress + data: {"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":{}} + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + ... + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}} + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + event: thread.message.completed + data: {"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":{}} + + event: thread.run.step.completed + data: {"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}} + + event: thread.run.completed + data: {"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-4o","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}} + + event: done + data: [DONE] + /threads/{thread_id}/runs/{run_id}: + get: + operationId: getRun + tags: + - Assistants + summary: Retrieves a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) that was run. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to retrieve. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Retrieve run + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.beta.threads.runs.retrieve( + run_id="run_id", + thread_id="thread_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.retrieve( + "run_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(run); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.retrieve('run_id', { thread_id: 'thread_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.Get(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunRetrieveParams params = RunRetrieveParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + Run run = client.beta().threads().runs().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.retrieve("run_id", thread_id: "thread_id") + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + post: + operationId: modifyRun + tags: + - Assistants + summary: Modifies a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) that was run. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to modify. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Modify run + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "user_id": "user_abc123" + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.beta.threads.runs.update( + run_id="run_id", + thread_id="thread_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.update( + "run_abc123", + { + thread_id: "thread_abc123", + metadata: { + user_id: "user_abc123", + }, + } + ); + + console.log(run); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.update('run_id', { thread_id: 'thread_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunUpdateParams params = RunUpdateParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + Run run = client.beta().threads().runs().update(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.update("run_id", thread_id: "thread_id") + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": { + "user_id": "user_abc123" + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + /threads/{thread_id}/runs/{run_id}/cancel: + post: + operationId: cancelRun + tags: + - Assistants + summary: Cancels a run that is `in_progress`. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this run belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to cancel. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Cancel a run + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X POST + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.beta.threads.runs.cancel( + run_id="run_id", + thread_id="thread_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.cancel( + "run_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(run); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.cancel('run_id', { thread_id: 'thread_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.Cancel(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCancelParams params = RunCancelParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + Run run = client.beta().threads().runs().cancel(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.cancel("run_id", thread_id: "thread_id") + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699076126, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "cancelling", + "started_at": 1699076126, + "expires_at": 1699076726, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "last_error": null, + "model": "gpt-4o", + "instructions": "You summarize books.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": ["vs_123"] + } + }, + "metadata": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + /threads/{thread_id}/runs/{run_id}/steps: + get: + operationId: listRunSteps + tags: + - Assistants + summary: Returns a list of run steps belonging to a run. + parameters: + - name: thread_id + in: path + required: true + schema: + type: string + description: The ID of the thread the run and run steps belong to. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run the run steps belong to. + - name: limit + in: query + description: | + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + - name: include[] + in: query + description: | + A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListRunStepsResponse' + x-oaiMeta: + name: List run steps + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.threads.runs.steps.list( + run_id="run_id", + thread_id="thread_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const runStep = await openai.beta.threads.runs.steps.list( + "run_abc123", + { thread_id: "thread_abc123" } + ); + console.log(runStep); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const runStep of client.beta.threads.runs.steps.list('run_id', { + thread_id: 'thread_id', + })) { + console.log(runStep.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Threads.Runs.Steps.List(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunStepListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.steps.StepListPage; + import com.openai.models.beta.threads.runs.steps.StepListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + StepListParams params = StepListParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + StepListPage page = client.beta().threads().runs().steps().list(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.threads.runs.steps.list("run_id", thread_id: "thread_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + ], + "first_id": "step_abc123", + "last_id": "step_abc456", + "has_more": false + } + /threads/{thread_id}/runs/{run_id}/steps/{step_id}: + get: + operationId: getRunStep + tags: + - Assistants + summary: Retrieves a run step. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which the run and run step belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to which the run step belongs. + - in: path + name: step_id + required: true + schema: + type: string + description: The ID of the run step to retrieve. + - name: include[] + in: query + description: | + A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunStepObject' + x-oaiMeta: + name: Retrieve run step + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run_step = client.beta.threads.runs.steps.retrieve( + step_id="step_id", + thread_id="thread_id", + run_id="run_id", + ) + print(run_step.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const runStep = await openai.beta.threads.runs.steps.retrieve( + "step_abc123", + { thread_id: "thread_abc123", run_id: "run_abc123" } + ); + console.log(runStep); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const runStep = await client.beta.threads.runs.steps.retrieve('step_id', { + thread_id: 'thread_id', + run_id: 'run_id', + }); + + console.log(runStep.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trunStep, err := client.Beta.Threads.Runs.Steps.Get(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\t\"step_id\",\n\t\topenai.BetaThreadRunStepGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", runStep.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.steps.RunStep; + import com.openai.models.beta.threads.runs.steps.StepRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + StepRetrieveParams params = StepRetrieveParams.builder() + .threadId("thread_id") + .runId("run_id") + .stepId("step_id") + .build(); + RunStep runStep = client.beta().threads().runs().steps().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run_step = openai.beta.threads.runs.steps.retrieve("step_id", thread_id: "thread_id", run_id: "run_id") + + puts(run_step) + response: | + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + /threads/{thread_id}/runs/{run_id}/submit_tool_outputs: + post: + operationId: submitToolOuputsToRun + 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. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) to which this run belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run that requires the tool output submission. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SubmitToolOutputsRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Submit tool outputs to run + group: threads + beta: true + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "tool_outputs": [ + { + "tool_call_id": "call_001", + "output": "70 degrees and sunny." + } + ] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.submit_tool_outputs( + run_id="run_id", + thread_id="thread_id", + tool_outputs=[{}], + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.submitToolOutputs( + "run_123", + { + thread_id: "thread_123", + tool_outputs: [ + { + tool_call_id: "call_001", + output: "70 degrees and sunny.", + }, + ], + } + ); + + console.log(run); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.submitToolOutputs('run_id', { + thread_id: 'thread_id', + tool_outputs: [{}], + }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.SubmitToolOutputs(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunSubmitToolOutputsParams{\n\t\t\tToolOutputs: []openai.BetaThreadRunSubmitToolOutputsParamsToolOutput{{}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunSubmitToolOutputsParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunSubmitToolOutputsParams params = RunSubmitToolOutputsParams.builder() + .threadId("thread_id") + .runId("run_id") + .addToolOutput(RunSubmitToolOutputsParams.ToolOutput.builder().build()) + .build(); + Run run = client.beta().threads().runs().submitToolOutputs(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.submit_tool_outputs("run_id", thread_id: "thread_id", tool_outputs: [{}]) + + puts(run) + response: | + { + "id": "run_123", + "object": "thread.run", + "created_at": 1699075592, + "assistant_id": "asst_123", + "thread_id": "thread_123", + "status": "queued", + "started_at": 1699075592, + "expires_at": 1699076192, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "last_error": null, + "model": "gpt-4o", + "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": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "tool_outputs": [ + { + "tool_call_id": "call_001", + "output": "70 degrees and sunny." + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.submit_tool_outputs( + run_id="run_id", + thread_id="thread_id", + tool_outputs=[{}], + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.runs.submitToolOutputs( + "run_123", + { + thread_id: "thread_123", + tool_outputs: [ + { + tool_call_id: "call_001", + output: "70 degrees and sunny.", + }, + ], + } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.submitToolOutputs('run_id', { + thread_id: 'thread_id', + tool_outputs: [{}], + }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.SubmitToolOutputs(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunSubmitToolOutputsParams{\n\t\t\tToolOutputs: []openai.BetaThreadRunSubmitToolOutputsParamsToolOutput{{}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunSubmitToolOutputsParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunSubmitToolOutputsParams params = RunSubmitToolOutputsParams.builder() + .threadId("thread_id") + .runId("run_id") + .addToolOutput(RunSubmitToolOutputsParams.ToolOutput.builder().build()) + .build(); + Run run = client.beta().threads().runs().submitToolOutputs(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.submit_tool_outputs("run_id", thread_id: "thread_id", tool_outputs: [{}]) + + puts(run) + response: | + event: thread.run.step.completed + data: {"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}} + + event: thread.run.queued + data: {"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-4o","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}} + + event: thread.run.in_progress + data: {"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-4o","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}} + + event: thread.run.step.created + data: {"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} + + event: thread.run.step.in_progress + data: {"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} + + event: thread.message.created + data: {"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":{}} + + event: thread.message.in_progress + data: {"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":{}} + + event: thread.message.delta + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"The","annotations":[]}}]}} + + event: thread.message.delta + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" current"}}]}} + + event: thread.message.delta + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" weather"}}]}} + + ... + + event: thread.message.delta + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" sunny"}}]}} + + event: thread.message.delta + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"."}}]}} + + event: thread.message.completed + data: {"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":{}} + + event: thread.run.step.completed + data: {"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}} + + event: thread.run.completed + data: {"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-4o","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}} + + event: done + data: [DONE] + /uploads: + post: + operationId: createUpload + tags: + - Uploads + summary: | + Creates an intermediate [Upload](/docs/api-reference/uploads/object) object + that you can add [Parts](/docs/api-reference/uploads/part-object) to. + Currently, an Upload can accept at most 8 GB in total and expires after an + hour after you create it. + + Once you complete the Upload, we will create a + [File](/docs/api-reference/files/object) object that contains all the parts + you uploaded. This File is usable in the rest of our platform as a regular + File object. + + For certain `purpose` values, the correct `mime_type` must be specified. + Please refer to documentation for the + [supported MIME types for your use case](/docs/assistants/tools/file-search#supported-files). + + For guidance on the proper filename extensions for each purpose, please + follow the documentation on [creating a + File](/docs/api-reference/files/create). + + Returns the Upload object with status `pending`. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUploadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Upload' + x-oaiMeta: + name: Create upload + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "purpose": "fine-tune", + "filename": "training_examples.jsonl", + "bytes": 2147483648, + "mime_type": "text/jsonl", + "expires_after": { + "anchor": "created_at", + "seconds": 3600 + } + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const upload = await client.uploads.create({ + bytes: 0, + filename: 'filename', + mime_type: 'mime_type', + purpose: 'assistants', + }); + + console.log(upload.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload = client.uploads.create( + bytes=0, + filename="filename", + mime_type="mime_type", + purpose="assistants", + ) + print(upload.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tupload, err := client.Uploads.New(context.TODO(), openai.UploadNewParams{\n\t\tBytes: 0,\n\t\tFilename: \"filename\",\n\t\tMimeType: \"mime_type\",\n\t\tPurpose: openai.FilePurposeAssistants,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", upload.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FilePurpose; + import com.openai.models.uploads.Upload; + import com.openai.models.uploads.UploadCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UploadCreateParams params = UploadCreateParams.builder() + .bytes(0L) + .filename("filename") + .mimeType("mime_type") + .purpose(FilePurpose.ASSISTANTS) + .build(); + Upload upload = client.uploads().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + upload = openai.uploads.create(bytes: 0, filename: "filename", mime_type: "mime_type", purpose: :assistants) + + puts(upload) + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "pending", + "expires_at": 1719127296 + } + /uploads/{upload_id}/cancel: + post: + operationId: cancelUpload + tags: + - Uploads + summary: | + Cancels the Upload. No Parts may be added after an Upload is cancelled. + + Returns the Upload object with status `cancelled`. + parameters: + - in: path + name: upload_id + required: true + schema: + type: string + example: upload_abc123 + description: | + The ID of the Upload. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Upload' + x-oaiMeta: + name: Cancel upload + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads/upload_abc123/cancel + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const upload = await client.uploads.cancel('upload_abc123'); + + console.log(upload.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload = client.uploads.cancel( + "upload_abc123", + ) + print(upload.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tupload, err := client.Uploads.Cancel(context.TODO(), \"upload_abc123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", upload.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.uploads.Upload; + import com.openai.models.uploads.UploadCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Upload upload = client.uploads().cancel("upload_abc123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + upload = openai.uploads.cancel("upload_abc123") + + puts(upload) + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "cancelled", + "expires_at": 1719127296 + } + /uploads/{upload_id}/complete: + post: + operationId: completeUpload + tags: + - Uploads + summary: | + Completes the [Upload](/docs/api-reference/uploads/object). + + Within the returned Upload object, there is a nested [File](/docs/api-reference/files/object) object that is ready to use in the rest of the platform. + + You can specify the order of the Parts by passing in an ordered list of the Part IDs. + + The 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. + Returns the Upload object with status `completed`, including an additional `file` property containing the created usable File object. + parameters: + - in: path + name: upload_id + required: true + schema: + type: string + example: upload_abc123 + description: | + The ID of the Upload. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CompleteUploadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Upload' + x-oaiMeta: + name: Complete upload + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads/upload_abc123/complete + -d '{ + "part_ids": ["part_def456", "part_ghi789"] + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const upload = await client.uploads.complete('upload_abc123', { part_ids: ['string'] }); + + console.log(upload.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload = client.uploads.complete( + upload_id="upload_abc123", + part_ids=["string"], + ) + print(upload.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tupload, err := client.Uploads.Complete(\n\t\tcontext.TODO(),\n\t\t\"upload_abc123\",\n\t\topenai.UploadCompleteParams{\n\t\t\tPartIDs: []string{\"string\"},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", upload.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.uploads.Upload; + import com.openai.models.uploads.UploadCompleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UploadCompleteParams params = UploadCompleteParams.builder() + .uploadId("upload_abc123") + .addPartId("string") + .build(); + Upload upload = client.uploads().complete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + upload = openai.uploads.complete("upload_abc123", part_ids: ["string"]) + + puts(upload) + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "completed", + "expires_at": 1719127296, + "file": { + "id": "file-xyz321", + "object": "file", + "bytes": 2147483648, + "created_at": 1719186911, + "expires_at": 1719127296, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + } + } + /vector_stores: + get: + operationId: listVectorStores + tags: + - Vector stores + summary: Returns a list of vector stores. + parameters: + - name: limit + in: query + description: | + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListVectorStoresResponse' + x-oaiMeta: + name: List vector stores + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.list() + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStores = await openai.vectorStores.list(); + console.log(vectorStores); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const vectorStore of client.vectorStores.list()) { + console.log(vectorStore.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.List(context.TODO(), openai.VectorStoreListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStoreListPage; + import com.openai.models.vectorstores.VectorStoreListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreListPage page = client.vectorStores().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "description": "Contains commonly asked questions and answers, organized by topic.", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + }, + { + "id": "vs_abc456", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ v2", + "description": null, + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + ], + "first_id": "vs_abc123", + "last_id": "vs_abc456", + "has_more": false + } + post: + operationId: createVectorStore + tags: + - Vector stores + summary: Create a vector store. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVectorStoreRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreObject' + x-oaiMeta: + name: Create vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "name": "Support FAQ" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store = client.vector_stores.create() + print(vector_store.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.vectorStores.create({ + name: "Support FAQ" + }); + console.log(vectorStore); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStore = await client.vectorStores.create(); + + console.log(vectorStore.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.New(context.TODO(), openai.VectorStoreNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStore; + import com.openai.models.vectorstores.VectorStoreCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStore vectorStore = client.vectorStores().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store = openai.vector_stores.create + + puts(vector_store) + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "description": "Contains commonly asked questions and answers, organized by topic.", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + /vector_stores/{vector_store_id}: + get: + operationId: getVectorStore + tags: + - Vector stores + summary: Retrieves a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to retrieve. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreObject' + x-oaiMeta: + name: Retrieve vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store = client.vector_stores.retrieve( + "vector_store_id", + ) + print(vector_store.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.vectorStores.retrieve( + "vs_abc123" + ); + console.log(vectorStore); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStore = await client.vectorStores.retrieve('vector_store_id'); + + console.log(vectorStore.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.Get(context.TODO(), \"vector_store_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStore; + import com.openai.models.vectorstores.VectorStoreRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStore vectorStore = client.vectorStores().retrieve("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store = openai.vector_stores.retrieve("vector_store_id") + + puts(vector_store) + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776 + } + post: + operationId: modifyVectorStore + tags: + - Vector stores + summary: Modifies a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to modify. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateVectorStoreRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreObject' + x-oaiMeta: + name: Modify vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + -d '{ + "name": "Support FAQ" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store = client.vector_stores.update( + vector_store_id="vector_store_id", + ) + print(vector_store.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.vectorStores.update( + "vs_abc123", + { + name: "Support FAQ" + } + ); + console.log(vectorStore); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStore = await client.vectorStores.update('vector_store_id'); + + console.log(vectorStore.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.Update(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\topenai.VectorStoreUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStore; + import com.openai.models.vectorstores.VectorStoreUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStore vectorStore = client.vectorStores().update("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store = openai.vector_stores.update("vector_store_id") + + puts(vector_store) + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "description": "Contains commonly asked questions and answers, organized by topic.", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + delete: + operationId: deleteVectorStore + tags: + - Vector stores + summary: Delete a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteVectorStoreResponse' + x-oaiMeta: + name: Delete vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_deleted = client.vector_stores.delete( + "vector_store_id", + ) + print(vector_store_deleted.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStore = await openai.vectorStores.delete( + "vs_abc123" + ); + console.log(deletedVectorStore); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreDeleted = await client.vectorStores.delete('vector_store_id'); + + console.log(vectorStoreDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreDeleted, err := client.VectorStores.Delete(context.TODO(), \"vector_store_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStoreDeleteParams; + import com.openai.models.vectorstores.VectorStoreDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreDeleted vectorStoreDeleted = client.vectorStores().delete("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_deleted = openai.vector_stores.delete("vector_store_id") + + puts(vector_store_deleted) + response: | + { + id: "vs_abc123", + object: "vector_store.deleted", + deleted: true + } + /vector_stores/{vector_store_id}/file_batches: + post: + operationId: createVectorStoreFileBatch + tags: + - Vector stores + summary: Create a vector store file batch. + description: | + The maximum number of files in a single batch request is 2000. + Vector 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`). + For ingesting multiple files into the same vector store, this batch endpoint is recommended. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: | + The ID of the vector store for which to create a File Batch. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVectorStoreFileBatchRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatchObject' + 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`). + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "files": [ + { + "file_id": "file-abc123", + "attributes": {"category": "finance"} + }, + { + "file_id": "file-abc456", + "chunking_strategy": { + "type": "static", + "max_chunk_size_tokens": 1200, + "chunk_overlap_tokens": 200 + } + } + ] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file_batch = client.vector_stores.file_batches.create( + vector_store_id="vs_abc123", + ) + print(vector_store_file_batch.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const myVectorStoreFileBatch = await openai.vectorStores.fileBatches.create( + "vs_abc123", + { + files: [ + { + file_id: "file-abc123", + attributes: { category: "finance" }, + }, + { + file_id: "file-abc456", + chunking_strategy: { + type: "static", + max_chunk_size_tokens: 1200, + chunk_overlap_tokens: 200, + }, + }, + ] + } + ); + console.log(myVectorStoreFileBatch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFileBatch = await client.vectorStores.fileBatches.create('vs_abc123'); + + console.log(vectorStoreFileBatch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.New(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreFileBatchNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.filebatches.FileBatchCreateParams; + import com.openai.models.vectorstores.filebatches.VectorStoreFileBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().create("vs_abc123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file_batch = openai.vector_stores.file_batches.create("vs_abc123") + + puts(vector_store_file_batch) + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 1, + "completed": 1, + "failed": 0, + "cancelled": 0, + "total": 0, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}: + get: + operationId: getVectorStoreFileBatch + tags: + - Vector stores + summary: Retrieves a vector store file batch. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store that the file batch belongs to. + - in: path + name: batch_id + required: true + schema: + type: string + example: vsfb_abc123 + description: The ID of the file batch being retrieved. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatchObject' + x-oaiMeta: + name: Retrieve vector store file batch + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches/vsfb_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file_batch = client.vector_stores.file_batches.retrieve( + batch_id="vsfb_abc123", + vector_store_id="vs_abc123", + ) + print(vector_store_file_batch.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFileBatch = await openai.vectorStores.fileBatches.retrieve( + "vsfb_abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(vectorStoreFileBatch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFileBatch = await client.vectorStores.fileBatches.retrieve('vsfb_abc123', { + vector_store_id: 'vs_abc123', + }); + + console.log(vectorStoreFileBatch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.Get(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"vsfb_abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.filebatches.FileBatchRetrieveParams; + import com.openai.models.vectorstores.filebatches.VectorStoreFileBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileBatchRetrieveParams params = FileBatchRetrieveParams.builder() + .vectorStoreId("vs_abc123") + .batchId("vsfb_abc123") + .build(); + VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file_batch = openai.vector_stores.file_batches.retrieve("vsfb_abc123", vector_store_id: "vs_abc123") + + puts(vector_store_file_batch) + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 1, + "completed": 1, + "failed": 0, + "cancelled": 0, + "total": 0, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel: + post: + operationId: cancelVectorStoreFileBatch + 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. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store that the file batch belongs to. + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the file batch to cancel. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatchObject' + x-oaiMeta: + name: Cancel vector store file batch + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X POST + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file_batch = client.vector_stores.file_batches.cancel( + batch_id="batch_id", + vector_store_id="vector_store_id", + ) + print(vector_store_file_batch.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStoreFileBatch = await openai.vectorStores.fileBatches.cancel( + "vsfb_abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(deletedVectorStoreFileBatch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFileBatch = await client.vectorStores.fileBatches.cancel('batch_id', { + vector_store_id: 'vector_store_id', + }); + + console.log(vectorStoreFileBatch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.Cancel(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"batch_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.filebatches.FileBatchCancelParams; + import com.openai.models.vectorstores.filebatches.VectorStoreFileBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileBatchCancelParams params = FileBatchCancelParams.builder() + .vectorStoreId("vector_store_id") + .batchId("batch_id") + .build(); + VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().cancel(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file_batch = openai.vector_stores.file_batches.cancel("batch_id", vector_store_id: "vector_store_id") + + puts(vector_store_file_batch) + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 12, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 15, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}/files: + get: + operationId: listFilesInVectorStoreBatch + tags: + - Vector stores + summary: Returns a list of vector store files in a batch. + parameters: + - name: vector_store_id + in: path + description: The ID of the vector store that the files belong to. + required: true + schema: + type: string + - name: batch_id + in: path + description: The ID of the file batch that the files belong to. + required: true + schema: + type: string + - name: limit + in: query + description: | + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + - name: filter + in: query + description: Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. + schema: + type: string + enum: + - in_progress + - completed + - failed + - cancelled + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListVectorStoreFilesResponse' + x-oaiMeta: + name: List vector store files in a batch + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.file_batches.list_files( + batch_id="batch_id", + vector_store_id="vector_store_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFiles = await openai.vectorStores.fileBatches.listFiles( + "vsfb_abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(vectorStoreFiles); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const vectorStoreFile of client.vectorStores.fileBatches.listFiles('batch_id', { + vector_store_id: 'vector_store_id', + })) { + console.log(vectorStoreFile.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.FileBatches.ListFiles(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"batch_id\",\n\t\topenai.VectorStoreFileBatchListFilesParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.filebatches.FileBatchListFilesPage; + import com.openai.models.vectorstores.filebatches.FileBatchListFilesParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileBatchListFilesParams params = FileBatchListFilesParams.builder() + .vectorStoreId("vector_store_id") + .batchId("batch_id") + .build(); + FileBatchListFilesPage page = client.vectorStores().fileBatches().listFiles(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.file_batches.list_files("batch_id", vector_store_id: "vector_store_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + }, + { + "id": "file-abc456", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + /vector_stores/{vector_store_id}/files: + get: + operationId: listVectorStoreFiles + tags: + - Vector stores + summary: Returns a list of vector store files. + parameters: + - name: vector_store_id + in: path + description: The ID of the vector store that the files belong to. + required: true + schema: + type: string + - name: limit + in: query + description: | + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + - name: filter + in: query + description: Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. + schema: + type: string + enum: + - in_progress + - completed + - failed + - cancelled + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListVectorStoreFilesResponse' + x-oaiMeta: + name: List vector store files + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.files.list( + vector_store_id="vector_store_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFiles = await openai.vectorStores.files.list( + "vs_abc123" + ); + console.log(vectorStoreFiles); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const vectorStoreFile of client.vectorStores.files.list('vector_store_id')) { + console.log(vectorStoreFile.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.Files.List(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\topenai.VectorStoreFileListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileListPage; + import com.openai.models.vectorstores.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileListPage page = client.vectorStores().files().list("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.files.list("vector_store_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + }, + { + "id": "file-abc456", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + post: + operationId: createVectorStoreFile + tags: + - Vector stores + summary: Create a vector store file by attaching a [File](/docs/api-reference/files) to a [vector store](/docs/api-reference/vector-stores/object). + 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`. + For uploading multiple files to the same vector store, use the file batches endpoint to reduce request volume. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: | + The ID of the vector store for which to create a File. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVectorStoreFileRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileObject' + 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. + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "file_id": "file-abc123" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file = client.vector_stores.files.create( + vector_store_id="vs_abc123", + file_id="file_id", + ) + print(vector_store_file.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const myVectorStoreFile = await openai.vectorStores.files.create( + "vs_abc123", + { + file_id: "file-abc123" + } + ); + console.log(myVectorStoreFile); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFile = await client.vectorStores.files.create('vs_abc123', { file_id: 'file_id' }); + + console.log(vectorStoreFile.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.New(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreFileNewParams{\n\t\t\tFileID: \"file_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileCreateParams; + import com.openai.models.vectorstores.files.VectorStoreFile; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileCreateParams params = FileCreateParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file_id") + .build(); + VectorStoreFile vectorStoreFile = client.vectorStores().files().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file = openai.vector_stores.files.create("vs_abc123", file_id: "file_id") + + puts(vector_store_file) + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "usage_bytes": 1234, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null + } + /vector_stores/{vector_store_id}/files/{file_id}: + get: + operationId: getVectorStoreFile + tags: + - Vector stores + summary: Retrieves a vector store file. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store that the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + example: file-abc123 + description: The ID of the file being retrieved. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileObject' + x-oaiMeta: + name: Retrieve vector store file + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file = client.vector_stores.files.retrieve( + file_id="file-abc123", + vector_store_id="vs_abc123", + ) + print(vector_store_file.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFile = await openai.vectorStores.files.retrieve( + "file-abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(vectorStoreFile); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFile = await client.vectorStores.files.retrieve('file-abc123', { + vector_store_id: 'vs_abc123', + }); + + console.log(vectorStoreFile.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.Get(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"file-abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileRetrieveParams; + import com.openai.models.vectorstores.files.VectorStoreFile; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileRetrieveParams params = FileRetrieveParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file-abc123") + .build(); + VectorStoreFile vectorStoreFile = client.vectorStores().files().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file = openai.vector_stores.files.retrieve("file-abc123", vector_store_id: "vs_abc123") + + puts(vector_store_file) + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null + } + delete: + operationId: deleteVectorStoreFile + 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](/docs/api-reference/files/delete) endpoint. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store that the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteVectorStoreFileResponse' + x-oaiMeta: + name: Delete vector store file + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file_deleted = client.vector_stores.files.delete( + file_id="file_id", + vector_store_id="vector_store_id", + ) + print(vector_store_file_deleted.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStoreFile = await openai.vectorStores.files.delete( + "file-abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(deletedVectorStoreFile); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFileDeleted = await client.vectorStores.files.delete('file_id', { + vector_store_id: 'vector_store_id', + }); + + console.log(vectorStoreFileDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileDeleted, err := client.VectorStores.Files.Delete(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileDeleteParams; + import com.openai.models.vectorstores.files.VectorStoreFileDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileDeleteParams params = FileDeleteParams.builder() + .vectorStoreId("vector_store_id") + .fileId("file_id") + .build(); + VectorStoreFileDeleted vectorStoreFileDeleted = client.vectorStores().files().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file_deleted = openai.vector_stores.files.delete("file_id", vector_store_id: "vector_store_id") + + puts(vector_store_file_deleted) + response: | + { + id: "file-abc123", + object: "vector_store.file.deleted", + deleted: true + } + post: + operationId: updateVectorStoreFileAttributes + tags: + - Vector stores + summary: Update attributes on a vector store file. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + example: file-abc123 + description: The ID of the file to update attributes. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateVectorStoreFileAttributesRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileObject' + 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} \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"attributes": {"key1": "value1", "key2": 2}}' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFile = await client.vectorStores.files.update('file-abc123', { + vector_store_id: 'vs_abc123', + attributes: { foo: 'string' }, + }); + + console.log(vectorStoreFile.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file = client.vector_stores.files.update( + file_id="file-abc123", + vector_store_id="vs_abc123", + attributes={ + "foo": "string" + }, + ) + print(vector_store_file.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.Update(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"file-abc123\",\n\t\topenai.VectorStoreFileUpdateParams{\n\t\t\tAttributes: map[string]openai.VectorStoreFileUpdateParamsAttributeUnion{\n\t\t\t\t\"foo\": {\n\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.vectorstores.files.FileUpdateParams; + import com.openai.models.vectorstores.files.VectorStoreFile; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileUpdateParams params = FileUpdateParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file-abc123") + .attributes(FileUpdateParams.Attributes.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build()) + .build(); + VectorStoreFile vectorStoreFile = client.vectorStores().files().update(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file = openai.vector_stores.files.update( + "file-abc123", + vector_store_id: "vs_abc123", + attributes: {foo: "string"} + ) + + puts(vector_store_file) + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "usage_bytes": 1234, + "created_at": 1699061776, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null, + "chunking_strategy": {...}, + "attributes": {"key1": "value1", "key2": 2} + } + /vector_stores/{vector_store_id}/search: + post: + operationId: searchVectorStore + tags: + - Vector stores + summary: Search a vector store for relevant chunks based on a query and file attributes filter. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store to search. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreSearchRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreSearchResultsPage' + x-oaiMeta: + name: Search vector store + group: vector_stores + examples: + request: + curl: | + curl -X POST \ + https://api.openai.com/v1/vector_stores/vs_abc123/search \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"query": "What is the return policy?", "filters": {...}}' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const vectorStoreSearchResponse of client.vectorStores.search('vs_abc123', { + query: 'string', + })) { + console.log(vectorStoreSearchResponse.file_id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.search( + vector_store_id="vs_abc123", + query="string", + ) + page = page.data[0] + print(page.file_id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.Search(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreSearchParams{\n\t\t\tQuery: openai.VectorStoreSearchParamsQueryUnion{\n\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStoreSearchPage; + import com.openai.models.vectorstores.VectorStoreSearchParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreSearchParams params = VectorStoreSearchParams.builder() + .vectorStoreId("vs_abc123") + .query("string") + .build(); + VectorStoreSearchPage page = client.vectorStores().search(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.search("vs_abc123", query: "string") + + puts(page) + response: | + { + "object": "vector_store.search_results.page", + "search_query": "What is the return policy?", + "data": [ + { + "file_id": "file_123", + "filename": "document.pdf", + "score": 0.95, + "attributes": { + "author": "John Doe", + "date": "2023-01-01" + }, + "content": [ + { + "type": "text", + "text": "Relevant chunk" + } + ] + }, + { + "file_id": "file_456", + "filename": "notes.txt", + "score": 0.89, + "attributes": { + "author": "Jane Smith", + "date": "2023-01-02" + }, + "content": [ + { + "type": "text", + "text": "Sample text content from the vector store." + } + ] + } + ], + "has_more": false, + "next_page": null + } + /conversations: + post: + tags: + - Conversations + summary: Create a conversation. + operationId: createConversation + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateConversationBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Create a conversation + group: conversations + path: create + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "metadata": {"topic": "demo"}, + "items": [ + { + "type": "message", + "role": "user", + "content": "Hello!" + } + ] + }' + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const conversation = await client.conversations.create({ + metadata: { topic: "demo" }, + items: [ + { type: "message", role: "user", content: "Hello!" } + ], + }); + console.log(conversation); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.create() + print(conversation.id) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation conversation = client.CreateConversation( + new CreateConversationOptions + { + Metadata = new Dictionary + { + { "topic", "demo" } + }, + Items = + { + new ConversationMessageInput + { + Role = "user", + Content = "Hello!", + } + } + } + ); + Console.WriteLine(conversation.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversation = await client.conversations.create(); + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.New(context.TODO(), conversations.ConversationNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.ConversationCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Conversation conversation = client.conversations().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation = openai.conversations.create + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "demo"} + } + /conversations/{conversation_id}: + get: + tags: + - Conversations + summary: Get a conversation + operationId: getConversation + parameters: + - name: conversation_id + in: path + description: The ID of the conversation to retrieve. + required: true + schema: + example: conv_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Retrieve a conversation + group: conversations + path: retrieve + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const conversation = await client.conversations.retrieve("conv_123"); + console.log(conversation); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.retrieve( + "conv_123", + ) + print(conversation.id) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation conversation = client.GetConversation("conv_123"); + Console.WriteLine(conversation.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversation = await client.conversations.retrieve('conv_123'); + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Get(context.TODO(), \"conv_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.ConversationRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Conversation conversation = client.conversations().retrieve("conv_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation = openai.conversations.retrieve("conv_123") + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "demo"} + } + delete: + tags: + - Conversations + summary: Delete a conversation. Items in the conversation will not be deleted. + operationId: deleteConversation + parameters: + - name: conversation_id + in: path + description: The ID of the conversation to delete. + required: true + schema: + example: conv_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedConversationResource' + x-oaiMeta: + name: Delete a conversation + group: conversations + path: delete + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/conversations/conv_123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const deleted = await client.conversations.delete("conv_123"); + console.log(deleted); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation_deleted_resource = client.conversations.delete( + "conv_123", + ) + print(conversation_deleted_resource.id) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + DeletedConversation deleted = client.DeleteConversation("conv_123"); + Console.WriteLine(deleted.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversationDeletedResource = await client.conversations.delete('conv_123'); + + console.log(conversationDeletedResource.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationDeletedResource, err := client.Conversations.Delete(context.TODO(), \"conv_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationDeletedResource.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.ConversationDeleteParams; + import com.openai.models.conversations.ConversationDeletedResource; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ConversationDeletedResource conversationDeletedResource = client.conversations().delete("conv_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation_deleted_resource = openai.conversations.delete("conv_123") + + puts(conversation_deleted_resource) + response: | + { + "id": "conv_123", + "object": "conversation.deleted", + "deleted": true + } + post: + tags: + - Conversations + summary: Update a conversation + operationId: updateConversation + parameters: + - name: conversation_id + in: path + description: The ID of the conversation to update. + required: true + schema: + example: conv_123 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateConversationBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Update a conversation + group: conversations + path: update + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "metadata": {"topic": "project-x"} + }' + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const updated = await client.conversations.update( + "conv_123", + { metadata: { topic: "project-x" } } + ); + console.log(updated); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.update( + conversation_id="conv_123", + metadata={ + "foo": "string" + }, + ) + print(conversation.id) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation updated = client.UpdateConversation( + conversationId: "conv_123", + new UpdateConversationOptions + { + Metadata = new Dictionary + { + { "topic", "project-x" } + } + } + ); + Console.WriteLine(updated.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversation = await client.conversations.update('conv_123', { metadata: { foo: 'string' } }); + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Update(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ConversationUpdateParams{\n\t\t\tMetadata: shared.Metadata{\n\t\t\t\t\"foo\": \"string\",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.ConversationUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ConversationUpdateParams params = ConversationUpdateParams.builder() + .conversationId("conv_123") + .metadata(ConversationUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build()) + .build(); + Conversation conversation = client.conversations().update(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation = openai.conversations.update("conv_123", metadata: {foo: "string"}) + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "project-x"} + } + /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' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.skills.create(); + + console.log(skill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill = client.skills.create() + print(skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskill, err := client.Skills.New(context.TODO(), openai.SkillNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.Skill; + import com.openai.models.skills.SkillCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Skill skill = client.skills().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill = openai.skills.create + + puts(skill) + get: + tags: + - Skills + summary: 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 + 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/OrderEnum' + - 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 + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillListResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const skill of client.skills.list()) { + console.log(skill.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.skills.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Skills.List(context.TODO(), openai.SkillListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.SkillListPage; + import com.openai.models.skills.SkillListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SkillListPage page = client.skills().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.skills.list + + puts(page) + /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 + schema: + example: skill_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedSkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const deletedSkill = await client.skills.delete('skill_123'); + + console.log(deletedSkill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + deleted_skill = client.skills.delete( + "skill_123", + ) + print(deleted_skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tdeletedSkill, err := client.Skills.Delete(context.TODO(), \"skill_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", deletedSkill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.DeletedSkill; + import com.openai.models.skills.SkillDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + DeletedSkill deletedSkill = client.skills().delete("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + deleted_skill = openai.skills.delete("skill_123") + + puts(deleted_skill) + 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 + schema: + example: skill_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.skills.retrieve('skill_123'); + + console.log(skill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill = client.skills.retrieve( + "skill_123", + ) + print(skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskill, err := client.Skills.Get(context.TODO(), \"skill_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.Skill; + import com.openai.models.skills.SkillRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Skill skill = client.skills().retrieve("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill = openai.skills.retrieve("skill_123") + + puts(skill) + 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 + schema: + example: skill_123 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SetDefaultSkillVersionBody' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/SetDefaultSkillVersionBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.skills.update('skill_123', { default_version: 'default_version' }); + + console.log(skill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill = client.skills.update( + skill_id="skill_123", + default_version="default_version", + ) + print(skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskill, err := client.Skills.Update(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\topenai.SkillUpdateParams{\n\t\t\tDefaultVersion: \"default_version\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.Skill; + import com.openai.models.skills.SkillUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SkillUpdateParams params = SkillUpdateParams.builder() + .skillId("skill_123") + .defaultVersion("default_version") + .build(); + Skill skill = client.skills().update(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill = openai.skills.update("skill_123", default_version: "default_version") + + puts(skill) + /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 + content: + application/json: + schema: + $ref: '#/components/schemas/SkillVersionResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skillVersion = await client.skills.versions.create('skill_123'); + + console.log(skillVersion.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill_version = client.skills.versions.create( + skill_id="skill_123", + ) + print(skill_version.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskillVersion, err := client.Skills.Versions.New(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\topenai.SkillVersionNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skillVersion.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.SkillVersion; + import com.openai.models.skills.versions.VersionCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SkillVersion skillVersion = client.skills().versions().create("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill_version = openai.skills.versions.create("skill_123") + + puts(skill_version) + get: + tags: + - Skills + summary: 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 + - name: limit + in: query + description: Number of versions to retrieve. + required: false + schema: + type: integer + minimum: 0 + maximum: 100 + - 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/SkillVersionListResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const skillVersion of client.skills.versions.list('skill_123')) { + console.log(skillVersion.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.skills.versions.list( + skill_id="skill_123", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Skills.Versions.List(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\topenai.SkillVersionListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.VersionListPage; + import com.openai.models.skills.versions.VersionListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VersionListPage page = client.skills().versions().list("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.skills.versions.list("skill_123") + + puts(page) + /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' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skillVersion = await client.skills.versions.retrieve('version', { skill_id: 'skill_123' }); + + console.log(skillVersion.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill_version = client.skills.versions.retrieve( + version="version", + skill_id="skill_123", + ) + print(skill_version.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskillVersion, err := client.Skills.Versions.Get(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\t\"version\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skillVersion.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.SkillVersion; + import com.openai.models.skills.versions.VersionRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VersionRetrieveParams params = VersionRetrieveParams.builder() + .skillId("skill_123") + .version("version") + .build(); + SkillVersion skillVersion = client.skills().versions().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill_version = openai.skills.versions.retrieve("version", skill_id: "skill_123") + + puts(skill_version) + 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 + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedSkillVersionResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const deletedSkillVersion = await client.skills.versions.delete('version', { + skill_id: 'skill_123', + }); + + console.log(deletedSkillVersion.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + deleted_skill_version = client.skills.versions.delete( + version="version", + skill_id="skill_123", + ) + print(deleted_skill_version.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tdeletedSkillVersion, err := client.Skills.Versions.Delete(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\t\"version\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", deletedSkillVersion.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.DeletedSkillVersion; + import com.openai.models.skills.versions.VersionDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VersionDeleteParams params = VersionDeleteParams.builder() + .skillId("skill_123") + .version("version") + .build(); + DeletedSkillVersion deletedSkillVersion = client.skills().versions().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + deleted_skill_version = openai.skills.versions.delete("version", skill_id: "skill_123") + + puts(deleted_skill_version) +webhooks: + batch_cancelled: + post: + description: | + Sent when a batch has been cancelled. + 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 + status codes will be retried. + batch_completed: + post: + description: | + Sent when a batch has completed processing. + 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 + status codes will be retried. + batch_expired: + post: + description: | + Sent when a batch has expired before completion. + 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 + status codes will be retried. + batch_failed: + post: + description: | + Sent when a batch has failed. + 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 + status codes will be retried. + eval_run_canceled: + post: + description: | + Sent when an eval run has been canceled. + 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 + status codes will be retried. + eval_run_failed: + post: + description: | + Sent when an eval run has failed. + 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 + status codes will be retried. + eval_run_succeeded: + post: + description: | + Sent when an eval run has succeeded. + 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 + status codes will be retried. + fine_tuning_job_cancelled: + post: + description: | + Sent when a fine-tuning job has been cancelled. + 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 + status codes will be retried. + fine_tuning_job_failed: + post: + description: | + Sent when a fine-tuning job has failed. + 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 + status codes will be retried. + fine_tuning_job_succeeded: + post: + description: | + Sent when a fine-tuning job has succeeded. + 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 + status codes will be retried. + realtime_call_incoming: + post: + description: | + Sent when Realtime API Receives a incoming SIP call. + 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 + status codes will be retried. + response_cancelled: + post: + description: | + Sent when a background response has been cancelled. + 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 + status codes will be retried. + response_completed: + post: + description: | + Sent when a background response has completed successfully. + 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 + status codes will be retried. + response_failed: + post: + description: | + Sent when a background response has failed. + 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 + status codes will be retried. + response_incomplete: + post: + description: | + Sent when a background response is incomplete. + 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 + status codes will be retried. +components: + schemas: + AddUploadPartRequest: + type: object + additionalProperties: false + properties: + data: + description: | + The chunk of bytes for this Part. + 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 + name: + anyOf: + - type: string + - type: 'null' + 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 + created_at: + type: integer + format: unixtime + example: 1711471533 + description: The Unix timestamp (in seconds) of when the API key was created + 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' + 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 + - id + - owner + x-oaiMeta: + name: The admin API key object + example: | + { + "object": "organization.admin_api_key", + "id": "key_abc", + "name": "Main Admin Key", + "redacted_value": "sk-admin...xyz", + "created_at": 1711471533, + "last_used_at": 1711471534, + "owner": { + "type": "user", + "object": "organization.user", + "id": "user_123", + "name": "John Doe", + "created_at": 1711471533, + "role": "owner" + } + } + AdminApiKeyCreateResponse: + allOf: + - $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: + value: + type: string + example: sk-admin-1234abcd + description: The value of the API key. Only shown on create. + required: + - value + ApiKeyList: + type: object + properties: + 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: string + - type: 'null' + example: key_abc + last_id: + anyOf: + - type: string + - type: 'null' + 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. + permissions: + type: array + description: Permissions associated with the role. + items: + 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: int64 + - 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' + required: + - id + - name + - permissions + - resource_type + - predefined_role + - description + - created_at + - updated_at + - created_by + - created_by_user_obj + - metadata + 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. + type: string + maxLength: 256 + - type: 'null' + description: + anyOf: + - description: | + The description of the assistant. The maximum length is 512 characters. + type: string + maxLength: 512 + - type: 'null' + model: + description: | + ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them. + type: string + instructions: + anyOf: + - description: | + The system instructions that the assistant uses. The maximum length is 256,000 characters. + 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`. + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The ID of the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + 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. + 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. + + We generally recommend altering this or temperature but not both. + - type: 'null' + response_format: + anyOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + - type: 'null' + required: + - id + - object + - created_at + - name + - description + - model + - instructions + - tools + - metadata + x-oaiMeta: + name: The assistant object + example: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698984975, + "name": "Math Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + deprecated: true + AssistantStreamEvent: + description: | + Represents an event emitted when streaming a Run. + + Each event in a server-sent events stream has an `event` and `data` property: + + ``` + event: thread.created + data: {"id": "thread_123", "object": "thread", ...} + ``` + + We emit events whenever a new object is created, transitions to a new state, or is being + streamed in parts (deltas). For example, we emit `thread.run.created` when a new run + is created, `thread.run.completed` when a run completes, and so on. When an Assistant chooses + to create a message during a run, we emit a `thread.message.created event`, a + `thread.message.in_progress` event, many `thread.message.delta` events, and finally a + `thread.message.completed` event. + + We may add additional events over time, so we recommend handling unknown events gracefully + in your code. See the [Assistants API quickstart](/docs/assistants/overview) to learn how to + integrate the Assistants API with streaming. + oneOf: + - $ref: '#/components/schemas/ThreadStreamEvent' + - $ref: '#/components/schemas/RunStreamEvent' + - $ref: '#/components/schemas/RunStepStreamEvent' + - $ref: '#/components/schemas/MessageStreamEvent' + - $ref: '#/components/schemas/ErrorEvent' + - $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 + 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. + + Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + 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](/docs/models#gpt-4o), [GPT-4 Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. + + Setting 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](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. + + **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. + oneOf: + - type: string + description: | + `auto` is the default value + 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. + `none` means the model will not call any tools and instead generates a message. + `auto` is the default value and 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. + Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. + 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. + 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: + - 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. + 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. + 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-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. + anyOf: + - type: string + - type: string + enum: + - whisper-1 + - gpt-4o-mini-transcribe + - gpt-4o-mini-transcribe-2025-12-15 + - gpt-4o-transcribe + - gpt-4o-transcribe-diarize + - gpt-realtime-whisper + language: + type: string + 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. + prompt: + type: string + description: | + An optional text to guide the model's style or continue a previous audio + segment. + For `whisper-1`, the [prompt is a list of keywords](/docs/guides/speech-to-text#prompting). + For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example "expect words related to technology". + Prompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions. + delay: + type: string + description: | + Controls how long the model waits before emitting transcription text. + Higher values can improve transcription accuracy at the cost of latency. + Only supported with `gpt-realtime-whisper` in GA Realtime sessions. + enum: + - minimal + - low + - medium + - high + - xhigh + AudioTranscriptionResponse: + type: object + properties: + model: + description: | + The model used for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. + anyOf: + - type: string + - type: string + enum: + - whisper-1 + - gpt-4o-mini-transcribe + - gpt-4o-mini-transcribe-2025-12-15 + - gpt-4o-transcribe + - gpt-4o-transcribe-diarize + - gpt-realtime-whisper + language: + type: string + description: | + The language of the input audio. + prompt: + type: string + description: | + The prompt configured for input audio transcription, when present. + 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. + 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"]` + 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"]` + 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. + 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. + checkpoint.permission.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the checkpoint permission. + 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. + 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. + 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. + group.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the group. + 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. + 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. + 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`. + invite.accepted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the invite. + invite.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the invite. + 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 + 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 + 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 + 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. + 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. + 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. + 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. + 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` + 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. + 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. + project.archived: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + project.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + 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. + rate_limit.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + 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: + 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. + 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. + role.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The role ID. + 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. + 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. + 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. + 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. + 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. + name: + type: string + description: The name of the certificate. + required: + - id + - type + - effective_at + x-oaiMeta: + name: The audit log object + example: | + { + "id": "req_xxx_20240101", + "type": "api_key.created", + "effective_at": 1720804090, + "actor": { + "type": "session", + "session": { + "user": { + "id": "user-xxx", + "email": "user@example.com" + }, + "ip_address": "127.0.0.1", + "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" + } + }, + "api_key.created": { + "id": "key_xxxx", + "data": { + "scopes": ["resource.operation"] + } + } + } + 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' + api_key: + $ref: '#/components/schemas/AuditLogActorApiKey' + 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. + type: + type: string + description: The type of API key. Can be either `user` or `service_account`. + enum: + - user + - service_account + user: + $ref: '#/components/schemas/AuditLogActorUser' + 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. + AuditLogActorSession: + type: object + description: The session in which the audit logged action was performed. + properties: + user: + $ref: '#/components/schemas/AuditLogActorUser' + 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. + 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 + - role.created + - role.updated + - role.deleted + - role.assignment.created + - role.assignment.deleted + - scim.enabled + - scim.disabled + - service_account.created + - service_account.updated + - service_account.deleted + - user.added + - user.updated + - user.deleted + 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 + object: + type: string + enum: + - batch + description: The object type, which is always `batch`. + x-stainless-const: true + endpoint: + type: string + description: The OpenAI API endpoint used by the batch. + model: + type: string + description: | + Model ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI + offers a wide range of models with different capabilities, performance + characteristics, and price points. Refer to the [model + guide](/docs/models) to browse and compare available models. + errors: + type: object + properties: + object: + type: string + description: The object type, which is always `list`. + data: + type: array + items: + 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 + description: The name of the parameter that caused the error, if applicable. + - type: 'null' + line: + anyOf: + - type: integer + description: The line number of the input file where the error occurred, if applicable. + - type: 'null' + input_file_id: + type: string + description: The ID of the input file for the batch. + completion_window: + type: string + description: The time frame within which the batch should be processed. + status: + type: string + description: The current status of the batch. + enum: + - validating + - failed + - in_progress + - finalizing + - completed + - expired + - cancelling + - cancelled + output_file_id: + type: string + description: The ID of the file containing the outputs of successfully executed requests. + error_file_id: + type: string + description: The ID of the file containing the outputs of requests with errors. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was created. + in_progress_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch started processing. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch will expire. + finalizing_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch started finalizing. + completed_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was completed. + failed_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch failed. + expired_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch expired. + cancelling_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch started cancelling. + cancelled_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was cancelled. + request_counts: + 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. + failed: + type: integer + description: Number of requests that have failed. + required: + - total + - completed + - failed + description: The request counts for different statuses within the batch. + usage: + type: object + description: | + Represents token usage details including input tokens, output tokens, a + breakdown of output tokens, and the total tokens used. Only populated on + batches created after September 7, 2025. + 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 + prompt caching](/docs/guides/prompt-caching). + 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. + 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: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/completions", + "model": "gpt-5-2025-08-07", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "usage": { + "input_tokens": 1500, + "input_tokens_details": { + "cached_tokens": 1024 + }, + "output_tokens": 500, + "output_tokens_details": { + "reasoning_tokens": 300 + }, + "total_tokens": 2000 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + 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 + required: + - anchor + - seconds + 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. + + - If creating, updating, or getting a specific certificate, the object type is `certificate`. + - If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`. + - If listing, activating, or deactivating certificates for a project, the object type is `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. + 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: + - object + - id + - name + - created_at + - certificate_details + x-oaiMeta: + name: The certificate object + example: | + { + "object": "certificate", + "id": "cert_abc", + "name": "My Certificate", + "created_at": 1234567, + "certificate_details": { + "valid_at": 1234567, + "expires_at": 12345678, + "content": "-----BEGIN CERTIFICATE----- MIIGAjCCA...6znFlOW+ -----END CERTIFICATE-----" + } + } + ChatCompletionAllowedTools: + type: object + title: Allowed tools + description: | + Constrains the tools available to the model to a pre-defined set. + properties: + mode: + type: string + enum: + - auto + - required + description: | + Constrains the tools available to the model to a pre-defined set. + + `auto` allows the model to pick from among the allowed tools and generate a + message. + + `required` requires the model to call one or more of the allowed tools. + tools: + type: array + description: | + A list of tool definitions that the model should be allowed to call. + + For the Chat Completions API, the list of tool definitions might look like: + ```json + [ + { "type": "function", "function": { "name": "get_weather" } }, + { "type": "function", "function": { "name": "get_time" } } + ] + ``` + items: + type: object + x-oaiExpandable: false + description: | + A tool definition that the model should be allowed to call. + additionalProperties: true + required: + - mode + - tools + ChatCompletionAllowedToolsChoice: + type: object + title: Allowed tools + description: | + Constrains the tools available to the model to a pre-defined set. + 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' + 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 + id: + type: string + description: The ID of the chat completion that was deleted. + 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. + 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: + 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' + required: + - name + ChatCompletionList: + type: object + title: ChatCompletionList + description: | + An object representing a list of Chat Completions. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of chat completion objects. + items: + $ref: '#/components/schemas/CreateChatCompletionResponse' + 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: | + { + "object": "list", + "data": [ + { + "object": "chat.completion", + "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "model": "gpt-4o-2024-08-06", + "created": 1738960610, + "request_id": "req_ded8ab984ec4bf840f37566c1011c417", + "tool_choice": null, + "usage": { + "total_tokens": 31, + "completion_tokens": 18, + "prompt_tokens": 13 + }, + "seed": 4944116822809979520, + "top_p": 1.0, + "temperature": 1.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0, + "system_fingerprint": "fp_50cad350e4", + "input_user": null, + "service_tier": "default", + "tools": null, + "metadata": {}, + "choices": [ + { + "index": 0, + "message": { + "content": "Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark.", + "role": "assistant", + "tool_calls": null, + "function_call": null + }, + "finish_reason": "stop", + "logprobs": null + } + ], + "response_format": null + } + ], + "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "has_more": false + } + ChatCompletionMessageCustomToolCall: + type: object + title: Custom tool call + description: | + A call to a custom tool created by the model. + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - custom + description: The type of the tool. Always `custom`. + x-stainless-const: true + 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 + - custom + ChatCompletionMessageList: + type: object + title: ChatCompletionMessageList + description: | + An object representing a list of chat completion messages. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of chat completion message objects. + 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. + Otherwise, null. + items: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartImage' + - type: 'null' + first_id: + type: string + description: The identifier of the first chat message in the data array. + last_id: + type: string + description: The identifier of the last chat message in the data array. + has_more: + type: boolean + description: Indicates whether there are more chat messages available. + required: + - object + - data + - first_id + - last_id + - has_more + x-oaiMeta: + name: The chat completion message list object + group: chat + example: | + { + "object": "list", + "data": [ + { + "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "role": "user", + "content": "write a haiku about ai", + "name": null, + "content_parts": null + } + ], + "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "has_more": false + } + ChatCompletionMessageToolCall: + type: object + title: Function tool call + description: | + A call to a function tool created by the model. + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + x-stainless-const: true + function: + type: object + 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 + - function + ChatCompletionMessageToolCallChunk: + type: object + properties: + index: + type: integer + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + x-stainless-const: true + 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. + 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. + Most models are capable of generating text, which is the default: + + `["text"]` + + The `gpt-4o-audio-preview` model can also be used to [generate audio](/docs/guides/audio). To + request that this model generate both text and audio responses, you can + use: + + `["text", "audio"]` + items: + type: string + enum: + - text + - audio + - type: 'null' + 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 + 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. + 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. + - type: 'null' + refusal: + anyOf: + - type: string + description: The refusal message by the assistant. + - type: 'null' + 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: object + description: | + Data about a previous audio response from the model. + [Learn more](/docs/guides/audio). + required: + - id + properties: + id: + type: string + description: | + Unique identifier for a previous audio response from the model. + - type: 'null' + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCalls' + 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' + required: + - role + ChatCompletionRequestAssistantMessageContentPart: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartRefusal' + discriminator: + propertyName: type + ChatCompletionRequestDeveloperMessage: + type: object + title: Developer message + description: | + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, `developer` messages + replace the previous `system` messages. + 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: + $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + 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: + - 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' + name: + type: string + description: The name of the function to call. + required: + - role + - content + - name + ChatCompletionRequestMessage: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestDeveloperMessage' + - $ref: '#/components/schemas/ChatCompletionRequestSystemMessage' + - $ref: '#/components/schemas/ChatCompletionRequestUserMessage' + - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage' + - $ref: '#/components/schemas/ChatCompletionRequestToolMessage' + - $ref: '#/components/schemas/ChatCompletionRequestFunctionMessage' + discriminator: + propertyName: role + ChatCompletionRequestMessageContentPartAudio: + type: object + title: Audio content part + description: | + Learn about [audio inputs](/docs/guides/audio). + 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". + required: + - data + - format + required: + - type + - input_audio + ChatCompletionRequestMessageContentPartFile: + type: object + title: File content part + description: | + Learn about [file inputs](/docs/guides/text) for text generation. + 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 + string. + file_data: + type: string + description: | + The base64 encoded file data, used when passing the file to the model + as a string. + file_id: + type: string + description: | + The ID of an uploaded file to use as input. + required: + - type + - file + ChatCompletionRequestMessageContentPartImage: + type: object + title: Image content part + description: | + Learn about [image inputs](/docs/guides/vision). + 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](/docs/guides/vision#low-or-high-fidelity-image-understanding). + enum: + - auto + - low + - high + default: auto + required: + - url + 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 + 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](/docs/guides/text-generation). + properties: + type: + type: string + enum: + - text + description: The type of the content part. + x-stainless-const: true + text: + type: string + description: The text content. + required: + - type + - text + ChatCompletionRequestSystemMessage: + type: object + title: System message + description: | + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, use `developer` messages + for this purpose instead. + 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 + role: + type: string + enum: + - system + description: The role of the messages author, in this case `system`. + 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: + - 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 + 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 + description: The contents of the tool message. + tool_call_id: + type: string + description: Tool call that this message is responding to. + required: + - role + - content + - tool_call_id + ChatCompletionRequestToolMessageContentPart: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + ChatCompletionRequestUserMessage: + type: object + title: User message + description: | + Messages sent by an end user, containing prompts or additional context + information. + properties: + content: + description: | + The contents of the user message. + 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](/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: + 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' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartImage' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartAudio' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartFile' + ChatCompletionResponseMessage: + type: object + description: A chat completion message generated by the model. + properties: + content: + anyOf: + - type: string + description: The contents of the message. + - type: 'null' + refusal: + anyOf: + - type: string + description: The refusal message generated by the model. + - type: 'null' + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCalls' + annotations: + type: array + description: | + Annotations for the message, when applicable, as when using the + [web search tool](/docs/guides/tools-web-search?api-mode=chat). + items: + type: object + description: | + A URL citation when using web search. + 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. + 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. + required: + - name + - arguments + audio: + anyOf: + - type: object + description: | + If the audio output modality is requested, this object contains data + about the audio response from the model. [Learn more](/docs/guides/audio). + 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 + no longer be accessible on the server for use in multi-turn + conversations. + data: + type: string + description: | + Base64 encoded audio bytes generated by the model, in the format + specified in the request. + transcript: + type: string + description: Transcript of the audio generated by the model. + - 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`. + type: object + default: null + properties: + include_usage: + type: boolean + description: | + If set, an additional chunk will be streamed before the `data: [DONE]` + message. The `usage` field on this chunk shows the token usage statistics + for the entire request, and the `choices` field will always be an empty + array. + + All other chunks will also include a `usage` field, but with a null + value. **NOTE:** If the stream is interrupted, you may not receive the + final usage chunk which contains the total token usage for the request. + include_obfuscation: + type: boolean + description: | + When true, stream obfuscation will be enabled. Stream obfuscation adds + random characters to an `obfuscation` field on streaming delta events to + normalize payload sizes as a mitigation to certain side-channel attacks. + These obfuscation fields are included by default, but add a small amount + of overhead to the data stream. You can set `include_obfuscation` to + false to optimize for bandwidth if you trust the network links between + your application and the OpenAI API. + - 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' + 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. + tool_calls: + type: array + items: + $ref: '#/components/schemas/ChatCompletionMessageToolCallChunk' + 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' + ChatCompletionTokenLogprob: + 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' + 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' + 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. + 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. + `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. + Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. + + `none` is the default when no tools are present. `auto` is the default if tools are present. + 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. + enum: + - none + - auto + - required + - $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. + properties: + type: + type: string + enum: + - files + description: | + The type of the code interpreter file output. Always `files`. + x-stainless-const: true + files: + type: array + items: + type: object + properties: + mime_type: + type: string + description: | + The MIME type of the file. + file_id: + type: string + description: | + The ID of the file. + 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. + properties: + type: + type: string + enum: + - logs + description: | + The type of the code interpreter text output. Always `logs`. + x-stainless-const: true + logs: + type: string + description: | + The logs of the code interpreter tool call. + required: + - type + - logs + CodeInterpreterTool: + type: object + title: Code interpreter + description: | + A tool that runs Python code to help generate a response to a prompt. + properties: + type: + type: string + enum: + - code_interpreter + description: | + The type of the code interpreter tool. Always `code_interpreter`. + x-stainless-const: true + container: + description: | + The code interpreter container. Can be a container ID or an object that + specifies uploaded file IDs to make available to your code, along with an + optional `memory_limit` setting. + oneOf: + - type: string + description: The container ID. + - $ref: '#/components/schemas/AutoCodeInterpreterToolParam' + required: + - type + - container + CodeInterpreterToolCall: + type: object + title: Code interpreter tool call + description: | + A tool call to run code. + 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`. + id: + type: string + description: | + The unique ID of the code interpreter tool call. + 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`. + container_id: + type: string + description: | + The ID of the container used to run the code. + code: + anyOf: + - type: string + description: | + The code to run, or null if not available. + - type: 'null' + 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. + Can be null if no outputs are available. + - type: 'null' + 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. + 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`. + - `eq`: equals + - `ne`: not equal + - `gt`: greater than + - `gte`: greater than or equal + - `lt`: less than + - `lte`: less than or equal + - `in`: in + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + oneOf: + - type: string + - type: number + - type: boolean + - type: array + items: + oneOf: + - type: string + - type: number + 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. + items: + type: string + md5: + description: | + The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect. + type: string + 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. + prompt_tokens: + type: integer + default: 0 + description: Number of tokens in the prompt. + total_tokens: + type: integer + default: 0 + description: Total number of tokens used in the request (prompt + completion). + 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 + prediction that appeared in the completion. + 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. + rejected_prediction_tokens: + type: integer + default: 0 + description: | + When using Predicted Outputs, the number of tokens in the + prediction that did not appear in the completion. However, like + reasoning tokens, these tokens are still counted in the total + completion tokens for purposes of billing, output, and context window + limits. + prompt_tokens_details: + 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. + 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: '#' + discriminator: + propertyName: type + required: + - type + - filters + x-oaiMeta: + name: CompoundFilter + ComputerAction: + oneOf: + - $ref: '#/components/schemas/ClickParam' + - $ref: '#/components/schemas/DoubleClickAction' + - $ref: '#/components/schemas/DragParam' + - $ref: '#/components/schemas/KeyPressAction' + - $ref: '#/components/schemas/MoveParam' + - $ref: '#/components/schemas/ScreenshotParam' + - $ref: '#/components/schemas/ScrollParam' + - $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 + `type` discriminator and action-specific fields. + items: + $ref: '#/components/schemas/ComputerAction' + ComputerScreenshotImage: + type: object + description: | + A computer screenshot image used with the computer use tool. + properties: + type: + type: string + enum: + - computer_screenshot + default: computer_screenshot + description: | + Specifies the event type. For a computer screenshot, this property is + always set to `computer_screenshot`. + x-stainless-const: true + image_url: + type: string + format: uri + description: The URL of the screenshot image. + 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 + [computer use guide](/docs/guides/tools-computer-use) for more information. + 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. + 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. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + 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. + properties: + type: + type: string + description: | + The type of the computer tool call output. Always `computer_call_output`. + enum: + - computer_call_output + default: computer_call_output + x-stainless-const: true + id: + type: string + description: | + The ID of the computer tool call output. + call_id: + type: string + description: | + The ID of the computer tool call that produced the output. + acknowledged_safety_checks: + type: array + description: | + The safety checks reported by the API that have been acknowledged by the + developer. + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + status: + type: string + description: | + The status of the message input. One of `in_progress`, `completed`, or + `incomplete`. Populated when input items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - output + ComputerToolCallOutputResource: + allOf: + - $ref: '#/components/schemas/ComputerToolCallOutput' + - type: object + properties: + id: + type: string + description: | + The unique ID of the computer call tool output. + status: + description: | + The status of the message input. One of `in_progress`, `completed`, or + `incomplete`. Populated when input items are returned via API. + $ref: '#/components/schemas/ComputerCallOutputStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + 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' + 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: + - object + - data + - first_id + - last_id + - has_more + 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. + path: + type: string + description: Path of the file in the container. + source: + type: string + description: Source of the file (e.g., `user`, `assistant`). + required: + - id + - object + - created_at + - bytes + - container_id + - path + - source + x-oaiMeta: + name: The container file object + example: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + 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. + 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. + The anchor is the reference point for the expiration. + The minutes is the number of minutes after the anchor before the container expires. + 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. + memory_limit: + type: string + description: The memory limit configured for the container. + enum: + - 1g + - 4g + - 16g + - 64g + 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 + required: + - type + required: + - id + - object + - name + - created_at + - status + - id + - name + - created_at + - status + x-oaiMeta: + name: The container object + example: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "1g", + "name": "My Container" + } + Content: + description: | + Multi-modal input and output contents. + 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](/docs/api-reference/responses/object#responses/object-output). + 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/ReasoningItem' + - $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' + - $ref: '#/components/schemas/CustomToolCallOutput' + 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' + 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. + last_id: + type: string + description: The ID of the last item in the list. + required: + - object + - data + - has_more + - first_id + - last_id + x-oaiMeta: + name: The item list + group: conversations + ConversationParam: + description: | + The conversation that this response belongs to. Items from this conversation are prepended to `input_items` for this response request. + Input items and output items from this response are automatically added to this conversation after this response completes. + default: null + oneOf: + - type: string + title: Conversation ID + description: | + The unique ID of the conversation. + - $ref: '#/components/schemas/ConversationParam-2' + 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" + 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' + 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' + quantity: + anyOf: + - type: number + description: When `group_by=line_item`, this field provides the quantity of the grouped costs result. + - type: 'null' + required: + - object + x-oaiMeta: + name: Costs object + example: | + { + "object": "organization.costs.result", + "amount": { + "value": 0.06, + "currency": "usd" + }, + "line_item": "Image models", + "project_id": "proj_abc", + "quantity": 10000 + } + CreateAssistantRequest: + type: object + additionalProperties: false + properties: + model: + description: | + ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them. + example: gpt-4o + anyOf: + - type: string + - $ref: '#/components/schemas/AssistantSupportedModels' + x-oaiTypeLabel: string + name: + anyOf: + - description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + - type: 'null' + description: + anyOf: + - description: | + The description of the assistant. The maximum length is 512 characters. + type: string + maxLength: 512 + - type: 'null' + instructions: + anyOf: + - description: | + The system instructions that the assistant uses. The maximum length is 256,000 characters. + type: string + maxLength: 256000 + - type: 'null' + 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`. + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: | + A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/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. + 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`. + + Note that the overlap must not exceed half of `max_chunk_size_tokens`. + 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' + 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. + 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. + + We generally recommend altering this or temperature but not both. + - type: 'null' + response_format: + anyOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + - type: 'null' + required: + - model + CreateChatCompletionRequest: + allOf: + - $ref: '#/components/schemas/CreateModelResponseProperties' + - type: object + properties: + messages: + description: | + A list of messages comprising the conversation so far. Depending on the + [model](/docs/models) you use, different message types (modalities) are + supported, like [text](/docs/guides/text-generation), + [images](/docs/guides/vision), and [audio](/docs/guides/audio). + type: array + minItems: 1 + items: + $ref: '#/components/schemas/ChatCompletionRequestMessage' + model: + 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](/docs/models) + to browse and compare available models. + $ref: '#/components/schemas/ModelIdsShared' + 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](/docs/guides/reasoning). + 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 + their existing frequency in the text so far, decreasing the model's + likelihood to repeat the same line verbatim. + 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. + web_search_options: + type: object + title: Web search + description: | + This tool searches the web for relevant results to use in a response. + Learn more about the [web search tool](/docs/guides/tools-web-search?api-mode=chat). + properties: + user_location: + type: object + nullable: true + required: + - type + - approximate + description: | + Approximate location parameters for the search. + properties: + type: + type: string + description: | + The type of location approximation. Always `approximate`. + 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 + tokens to return at each token position, each with an associated log + probability. In some cases, the number of returned tokens may be fewer than + requested. + `logprobs` must be set to `true` if this parameter is used. + type: integer + minimum: 0 + maximum: 20 + nullable: true + response_format: + description: | + An object specifying the format that the model must output. + + Setting 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](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables the older JSON mode, which + ensures the message the model generates is valid JSON. Using `json_schema` + is preferred for models that support it. + 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 + `modalities: ["audio"]`. [Learn more](/docs/guides/audio). + required: + - voice + - format + properties: + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + description: | + The voice the model uses to respond. Supported built-in voices are + `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, + `sage`, `shimmer`, `marin`, and `cedar`. You may also provide a + custom voice object with an `id`, for example `{ "id": "voice_1234" }`. + format: + type: string + enum: + - wav + - aac + - mp3 + - flac + - opus + - pcm16 + description: | + Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, + `opus`, or `pcm16`. + store: + type: boolean + default: false + nullable: true + description: | + Whether or not to store the output of this chat completion request for + use in our [model distillation](/docs/guides/distillation) or + [evals](/docs/guides/evals) products. + + Supports text and image inputs. Note: image inputs over 8MB will be dropped. + stream: + description: | + If set to true, the model response data will be streamed to the client + as 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). + See the [Streaming section below](/docs/api-reference/chat/streaming) + for more information, along with the [streaming responses](/docs/guides/streaming-responses) + guide for more information on how to handle the streaming events. + 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. + + Accepts a JSON object that maps tokens (specified by their token ID in the + tokenizer) to an associated bias value from -100 to 100. 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. + logprobs: + description: | + Whether to return log probabilities of the output tokens or not. If true, + returns the log probabilities of each output token returned in the + `content` of `message`. + type: boolean + default: false + nullable: true + max_tokens: + description: | + The maximum number of [tokens](/tokenizer) that can be generated in the + chat completion. This value can be used to control + [costs](https://openai.com/api/pricing/) for text generated via API. + + This value is now deprecated in favor of `max_completion_tokens`, and is + not compatible with [o-series models](/docs/guides/reasoning). + 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](/docs/guides/predicted-outputs), + which can greatly improve response times when large parts of the model + response are known ahead of time. This is most common when you are + regenerating a file with only minor changes to most of the content. + oneOf: + - $ref: '#/components/schemas/PredictionContent' + seed: + type: integer + minimum: -9223372036854776000 + maximum: 9223372036854776000 + nullable: true + deprecated: true + description: | + This feature is in Beta. + 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. + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + 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 + [custom tools](/docs/guides/function-calling#custom-tools) or + [function tools](/docs/guides/function-calling). + 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`. + + Controls which (if any) function is called by the model. + + `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. + + Specifying a particular function via `{"name": "my_function"}` forces the + model to call that function. + + `none` is the default when no functions are present. `auto` is the default + if functions are present. + 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. + enum: + - none + - auto + - $ref: '#/components/schemas/ChatCompletionFunctionCallOption' + functions: + deprecated: true + description: | + Deprecated in favor of `tools`. + + A list of functions the model may generate JSON inputs for. + type: array + minItems: 1 + maxItems: 128 + items: + $ref: '#/components/schemas/ChatCompletionFunctions' + 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, + `length` if the maximum number of tokens specified in the request was reached, + `content_filter` if content was omitted due to a flag from our content filters, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + 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: + 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. + service_tier: + $ref: '#/components/schemas/ServiceTier' + system_fingerprint: + type: string + deprecated: true + description: | + This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + object: + type: string + description: The object type, which is always `chat.completion`. + enum: + - chat.completion + x-stainless-const: true + usage: + $ref: '#/components/schemas/CompletionUsage' + required: + - choices + - created + - id + - model + - object + x-oaiMeta: + name: The chat completion object + group: chat + example: | + { + "id": "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG", + "object": "chat.completion", + "created": 1741570283, + "model": "gpt-4o-2024-08-06", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "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.", + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 1117, + "completion_tokens": 46, + "total_tokens": 1163, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_fc9f1d7035" + } + CreateChatCompletionStreamResponse: + type: object + description: | + Represents a streamed chunk of a chat completion response returned + by the model, based on the provided input. + [Learn more](/docs/guides/streaming-responses). + properties: + id: + type: string + description: A unique identifier for the chat completion. Each chunk has the same ID. + 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 + last chunk if you set `stream_options: {"include_usage": true}`. + items: + type: object + required: + - delta + - finish_reason + - index + properties: + delta: + $ref: '#/components/schemas/ChatCompletionStreamResponseDelta' + logprobs: + description: Log probability information for the choice. + 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 + refusal: + description: A list of message refusal tokens with log probability information. + type: array + items: + $ref: '#/components/schemas/ChatCompletionTokenLogprob' + nullable: true + required: + - content + - refusal + 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, + `length` if the maximum number of tokens specified in the request was reached, + `content_filter` if content was omitted due to a flag from our content filters, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + 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. + model: + type: string + description: The model to generate the completion. + service_tier: + $ref: '#/components/schemas/ServiceTier' + system_fingerprint: + type: string + deprecated: true + description: | + This fingerprint represents the backend configuration that the model runs with. + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + 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 + `stream_options: {"include_usage": true}` in your request. When present, it + contains a null value **except for the last chunk** which contains the + token usage statistics for the entire request. + + **NOTE:** If the stream is interrupted or cancelled, you may not + receive the final usage chunk which contains the total token usage for + the request. + 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-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} + + .... + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + CreateCompletionRequest: + type: object + properties: + model: + description: | + ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them. + anyOf: + - type: string + - type: string + enum: + - gpt-3.5-turbo-instruct + - davinci-002 + - babbage-002 + 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. + + Note 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. + default: <|endoftext|> + nullable: true + oneOf: + - type: string + default: '' + example: This is a test. + - 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]]' + 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. + + When 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`. + + **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`. + echo: + type: boolean + default: false + nullable: true + description: | + Echo back the prompt in addition to the completion + 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. + + [See more information about frequency and presence penalties.](/docs/guides/text-generation) + 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. + + Accepts 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](/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. + + As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> token from being generated. + 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. + + The maximum value for `logprobs` is 5. + max_tokens: + type: integer + minimum: 0 + default: 16 + example: 16 + nullable: true + description: | + The maximum number of [tokens](/tokenizer) that can be generated in the completion. + + The 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': + type: integer + minimum: 1 + maximum: 128 + default: 1 + example: 1 + nullable: true + description: | + How many completions to generate for each prompt. + + **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`. + 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. + + [See more information about frequency and presence penalties.](/docs/guides/text-generation) + 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. + + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + 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). + type: boolean + nullable: true + default: false + stream_options: + $ref: '#/components/schemas/ChatCompletionStreamOptions' + suffix: + description: | + The suffix that comes after a completion of inserted text. + + This parameter is only supported for `gpt-3.5-turbo-instruct`. + default: null + nullable: true + type: string + example: test. + 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. + + We generally recommend altering this or `top_p` but not both. + 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. + + We generally recommend altering this or `temperature` but not both. + 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](/docs/guides/safety-best-practices#end-user-ids). + 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). + 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, + `length` if the maximum number of tokens specified in the request was reached, + or `content_filter` if content was omitted due to a flag from our content filters. + 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 + 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. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + object: + type: string + description: The object type, which is always "text_completion" + enum: + - text_completion + x-stainless-const: true + usage: + $ref: '#/components/schemas/CompletionUsage' + required: + - id + - object + - created + - model + - choices + x-oaiMeta: + name: The completion object + legacy: true + example: | + { + "id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7", + "object": "text_completion", + "created": 1589478378, + "model": "gpt-4-turbo", + "choices": [ + { + "text": "\n\nThis is indeed a test", + "index": 0, + "logprobs": null, + "finish_reason": "length" + } + ], + "usage": { + "prompt_tokens": 5, + "completion_tokens": 7, + "total_tokens": 12 + } + } + 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: + 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 + 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' + 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. + 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. + 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](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them. + example: text-embedding-3-small + anyOf: + - type: string + - type: string + enum: + - text-embedding-ada-002 + - text-embedding-3-small + - text-embedding-3-large + 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. + 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](/docs/guides/safety-best-practices#end-user-ids). + 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. + required: + - prompt_tokens + - total_tokens + required: + - object + - model + - data + - usage + CreateEvalCompletionsRunDataSource: + type: object + title: CompletionsRunDataSource + description: | + A CompletionsRunDataSource object describing a model sampling configuration. + 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. + + Setting 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](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables the older JSON mode, which + ensures the message the model generates is valid JSON. Using `json_schema` + is preferred for models that support it. + 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. + items: + $ref: '#/components/schemas/ChatCompletionTool' + 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: | + { + "name": "gpt-4o-mini-2024-07-18", + "data_source": { + "type": "completions", + "input_messages": { + "type": "item_reference", + "item_reference": "item.input" + }, + "model": "gpt-4o-mini-2024-07-18", + "source": { + "type": "stored_completions", + "model": "gpt-4o-mini-2024-07-18" + } + } + } + CreateEvalCustomDataSourceConfig: + type: object + title: CustomDataSourceConfig + description: | + A CustomDataSourceConfig object that defines the schema for the data source used for the evaluation runs. + This schema is used to define the shape of the data that will be: + - Used to define your testing criteria and + - What data is required when creating a run + 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: | + { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + } + 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: + - item_schema + - type + x-oaiMeta: + name: The eval file data source config object + group: evals + example: | + { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + }, + "include_sample_schema": true + } + 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 + 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' + required: + - type + - source + x-oaiMeta: + name: The file data source object for the eval run configuration + group: evals + example: | + { + "type": "jsonl", + "source": { + "type": "file_id", + "id": "file-9GYS6xbkWgWhmE7VoLUWFg" + } + } + CreateEvalLabelModelGrader: + type: object + title: LabelModelGrader + description: | + A LabelModelGrader object which uses a model to assign labels to each item + in the evaluation. + 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' + 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: | + { + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "role": "system", + "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" + }, + { + "role": "user", + "content": "Statement: {{item.response}}" + } + ], + "passing_labels": ["positive"], + "labels": ["positive", "neutral", "negative"], + "name": "Sentiment label grader" + } + CreateEvalLogsDataSourceConfig: + type: object + title: LogsDataSourceConfig + description: | + A data source config which specifies the metadata property of your logs query. + This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. + 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: | + { + "use_case": "customer_support_agent" + } + required: + - type + x-oaiMeta: + name: The logs data source object for evals + group: evals + example: | + { + "type": "logs", + "metadata": { + "use_case": "customer_support_agent" + } + } + 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' + 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. + 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 + can specify which tool to use by setting the `tool_choice` parameter. + + The two categories of tools you can provide the model are: + + - **Built-in tools**: Tools that are provided by OpenAI that extend the + model's capabilities, like [web search](/docs/guides/tools-web-search) + or [file search](/docs/guides/tools-file-search). Learn more about + [built-in tools](/docs/guides/tools). + - **Function calls (custom tools)**: Functions that are defined by you, + enabling the model to call your own code. Learn more about + [function calling](/docs/guides/function-calling). + items: + $ref: '#/components/schemas/Tool' + text: + type: object + description: | + Configuration options for a text response from the model. Can be plain + text or structured JSON data. Learn more: + - [Text inputs and outputs](/docs/guides/text) + - [Structured Outputs](/docs/guides/structured-outputs) + properties: + format: + $ref: '#/components/schemas/TextResponseFormatConfiguration' + 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: | + { + "name": "gpt-4o-mini-2024-07-18", + "data_source": { + "type": "responses", + "input_messages": { + "type": "item_reference", + "item_reference": "item.input" + }, + "model": "gpt-4o-mini-2024-07-18", + "source": { + "type": "responses", + "model": "gpt-4o-mini-2024-07-18" + } + } + } + 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' + required: + - data_source + CreateEvalStoredCompletionsDataSourceConfig: + type: object + title: StoredCompletionsDataSourceConfig + description: | + Deprecated in favor of LogsDataSourceConfig. + 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: | + { + "use_case": "customer_support_agent" + } + required: + - type + deprecated: true + x-oaiMeta: + name: The stored completions data source object for evals + group: evals + example: | + { + "type": "stored_completions", + "metadata": { + "use_case": "customer_support_agent" + } + } + CreateFileRequest: + type: object + additionalProperties: false + properties: + file: + description: | + The File object (not file name) to be uploaded. + type: string + format: binary + purpose: + description: | + The intended purpose of the uploaded file. One of: + - `assistants`: Used in the Assistants API + - `batch`: Used in the Batch API + - `fine-tune`: Used for fine-tuning + - `vision`: Images used for vision fine-tuning + - `user_data`: Flexible file type for any purpose + - `evals`: Used for eval data sets + type: string + enum: + - assistants + - batch + - fine-tune + - vision + - user_data + - evals + expires_after: + $ref: '#/components/schemas/FileExpirationAfter' + required: + - file + - purpose + CreateFineTuningCheckpointPermissionRequest: + type: object + additionalProperties: false + properties: + project_ids: + type: array + description: The project identifiers to grant access to. + items: + type: string + required: + - project_ids + CreateFineTuningJobRequest: + type: object + properties: + model: + description: | + The name of the model to fine-tune. You can select one of the + [supported models](/docs/guides/fine-tuning#which-models-can-be-fine-tuned). + example: gpt-4o-mini + anyOf: + - type: string + - type: string + enum: + - babbage-002 + - davinci-002 + - gpt-3.5-turbo + - gpt-4o-mini + x-oaiTypeLabel: string + training_file: + description: | + The ID of an uploaded file that contains training data. + + See [upload file](/docs/api-reference/files/create) for how to upload a file. + + Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`. + + The contents of the file should differ depending on if the model uses the [chat](/docs/api-reference/fine-tuning/chat-input), [completions](/docs/api-reference/fine-tuning/completions-input) format, or if the fine-tuning method uses the [preference](/docs/api-reference/fine-tuning/preference-input) format. + + See the [fine-tuning guide](/docs/guides/model-optimization) for more details. + type: string + example: file-abc123 + hyperparameters: + type: object + description: | + The hyperparameters used for the fine-tuning job. + This value is now deprecated in favor of `method`, and should be passed in under the `method` parameter. + 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. + 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. + 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 + through the training dataset. + 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. + + For example, a `suffix` of "custom-model-name" would produce a model name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. + type: string + minLength: 1 + maxLength: 64 + default: null + nullable: true + validation_file: + description: | + The ID of an uploaded file that contains validation data. + + If you provide this file, the data is used to generate validation + metrics periodically during fine-tuning. These metrics can be viewed in + the fine-tuning results file. + The same data should not be present in both train and validation files. + + Your dataset must be formatted as a JSONL file. You must upload your file with the purpose `fine-tune`. + + See the [fine-tuning guide](/docs/guides/model-optimization) for more details. + 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. + 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 + metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags + to your run, and set a default entity (team, username, etc) to be associated with your run. + required: + - project + properties: + project: + description: | + The name of the project that the new run will be created under. + 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. + 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 + like associated with the run. If not set, the default entity for the registered WandB API key is used. + 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 + default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}". + 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. + If a seed is not specified, one will be generated for you. + 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 + required: + - name + x-oaiMeta: + example: | + { + "name": "Support Team" + } + 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. + required: + - user_id + x-oaiMeta: + example: | + { + "user_id": "user_abc123" + } + CreateImageEditRequest: + type: object + properties: + 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. + + For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` + file less than 50MB. You can provide up to 16 images. + `chatgpt-image-latest` follows the same input constraints as GPT image models. + + For `dall-e-2`, you can only provide one image, and it should be a square + `png` file less than 4MB. + 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: | + Allows to set transparency for the background of the generated image(s). + This parameter is only supported for the GPT image models. Must be one of + `transparent`, `opaque` or `auto` (default value). When `auto` is used, the + model will automatically determine the best background for the image. + + If `transparent`, the output format needs to support transparency, so it + should be set to either `png` (default value) or `webp`. + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1.5 + - dall-e-2 + - gpt-image-1 + - gpt-image-1-mini + - chatgpt-image-latest + x-stainless-const: true + x-oaiTypeLabel: string + default: gpt-image-1.5 + example: gpt-image-1.5 + nullable: true + description: The model to use for image generation. 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 + default: 1024x1024 + example: 1024x1024 + nullable: true + description: The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, 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 + only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. + The default value is `png`. + 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. + 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](/docs/guides/safety-best-practices#end-user-ids). + input_fidelity: + anyOf: + - $ref: '#/components/schemas/InputFidelity' + - type: 'null' + stream: + type: boolean + default: false + example: false + nullable: true + description: | + Edit the image in streaming mode. Defaults to `false`. See the + [Image generation guide](/docs/guides/image-generation) for more information. + partial_images: + $ref: '#/components/schemas/PartialImages' + quality: + type: string + enum: + - standard + - low + - medium + - high + - auto + default: auto + example: high + nullable: true + description: | + The quality of the image that will be generated for GPT image models. Defaults to `auto`. + 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 + - dall-e-2 + - dall-e-3 + - gpt-image-1 + - gpt-image-1-mini + 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`). 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 + - auto + default: auto + example: medium + nullable: true + description: | + The quality of the image that will be generated. + + - `auto` (default value) will automatically select the best quality for the given model. + - `high`, `medium` and `low` are supported for the GPT image models. + - `hd` and `standard` are supported for `dall-e-3`. + - `standard` is the only option for `dall-e-2`. + 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 + [Image generation guide](/docs/guides/image-generation) for more information. + This parameter is only supported for the GPT image models. + partial_images: + $ref: '#/components/schemas/PartialImages' + size: + anyOf: + - type: string + - type: string + enum: + - auto + - 1024x1024 + - 1536x1024 + - 1024x1536 + - 256x256 + - 512x512 + - 1792x1024 + - 1024x1792 + default: auto + example: 1024x1024 + nullable: true + description: The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, 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: | + Allows to set transparency for the background of the generated image(s). + This parameter is only supported for the GPT image models. Must be one of + `transparent`, `opaque` or `auto` (default value). When `auto` is used, the + model will automatically determine the best background for the image. + + If `transparent`, the output format needs to support transparency, so it + should be set to either `png` (default value) or `webp`. + 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: + type: string + example: user-1234 + description: | + A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids). + required: + - prompt + CreateImageVariationRequest: + type: object + 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. + type: string + format: binary + model: + anyOf: + - type: string + - type: string + enum: + - dall-e-2 + x-stainless-const: true + 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. + size: + 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`. + 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](/docs/guides/safety-best-practices#end-user-ids). + 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: + - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. + - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation. + 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](/docs/models). + title: Array of content parts + items: + oneOf: + - $ref: '#/components/schemas/MessageContentImageFileObject' + - $ref: '#/components/schemas/MessageContentImageUrlObject' + - $ref: '#/components/schemas/MessageRequestContentTextObject' + minItems: 1 + 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' + metadata: + $ref: '#/components/schemas/Metadata' + CreateModelResponseProperties: + allOf: + - $ref: '#/components/schemas/ModelResponseProperties' + - type: object + properties: + top_logprobs: + description: | + An integer between 0 and 20 specifying the maximum number of most likely + tokens to return at each token position, each with an associated log + probability. In some cases, the number of returned tokens may be fewer than + requested. + type: integer + minimum: 0 + maximum: 20 + CreateModerationRequest: + type: object + properties: + input: + description: | + Input (or inputs) to classify. Can be a single string, an array of strings, or + an array of multi-modal input objects similar to other models. + oneOf: + - type: string + description: A string of text to classify for moderation. + default: '' + example: I want to kill them. + - type: array + description: An array of strings to classify for moderation. + items: + type: string + default: '' + example: I want to kill them. + - 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 + model: + description: | + The content moderation model you would like to use. Learn more in + [the moderation guide](/docs/guides/moderation), and learn about + available models [here](/docs/models#moderation). + nullable: false + 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: + - input + CreateModerationResponse: + type: object + description: Represents if a given text input is potentially harmful. + properties: + id: + type: string + description: The unique identifier for the moderation request. + model: + type: string + 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: | + { + "id": "modr-0d9740456c391e43c445bf0f010940c7", + "model": "omni-moderation-latest", + "results": [ + { + "flagged": true, + "categories": { + "harassment": true, + "harassment/threatening": true, + "sexual": false, + "hate": false, + "hate/threatening": false, + "illicit": false, + "illicit/violent": false, + "self-harm/intent": false, + "self-harm/instructions": false, + "self-harm": false, + "sexual/minors": false, + "violence": true, + "violence/graphic": true + }, + "category_scores": { + "harassment": 0.8189693396524255, + "harassment/threatening": 0.804985420696006, + "sexual": 1.573112165348997e-6, + "hate": 0.007562942636942845, + "hate/threatening": 0.004208854591835476, + "illicit": 0.030535955153511665, + "illicit/violent": 0.008925306722380033, + "self-harm/intent": 0.00023023930975076432, + "self-harm/instructions": 0.0002293869201073356, + "self-harm": 0.012598046106750154, + "sexual/minors": 2.212566909570261e-8, + "violence": 0.9999992735124786, + "violence/graphic": 0.843064871157054 + }, + "category_applied_input_types": { + "harassment": [ + "text" + ], + "harassment/threatening": [ + "text" + ], + "sexual": [ + "text", + "image" + ], + "hate": [ + "text" + ], + "hate/threatening": [ + "text" + ], + "illicit": [ + "text" + ], + "illicit/violent": [ + "text" + ], + "self-harm/intent": [ + "text", + "image" + ], + "self-harm/instructions": [ + "text", + "image" + ], + "self-harm": [ + "text", + "image" + ], + "sexual/minors": [ + "text" + ], + "violence": [ + "text", + "image" + ], + "violence/graphic": [ + "text", + "image" + ] + } + } + ] + } + CreateResponse: + allOf: + - $ref: '#/components/schemas/CreateModelResponseProperties' + - $ref: '#/components/schemas/ResponseProperties' + - type: object + properties: + input: + $ref: '#/components/schemas/InputParam' + include: + anyOf: + - type: array + description: |- + Specify additional output data to include in the model response. Currently supported values are: + - `web_search_call.action.sources`: Include the sources of the web search tool call. + - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items. + - `computer_call_output.output.image_url`: Include image urls from the computer call output. + - `file_search_call.results`: Include the search results of the file search tool call. + - `message.input_image.image_url`: Include image urls from the input message. + - `message.output_text.logprobs`: Include logprobs with assistant messages. + - `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. + default: true + - type: 'null' + store: + anyOf: + - type: boolean + description: | + Whether to store the generated model response for later retrieval via + API. + default: true + - type: 'null' + instructions: + anyOf: + - type: string + description: | + A system (or developer) message inserted into the model's context. + + When using 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' + stream: + anyOf: + - description: | + If set to true, the model response data will be streamed to the client + as 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). + See the [Streaming section below](/docs/api-reference/responses-streaming) + for more information. + 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. + 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](/docs/guides/reasoning). + type: integer + minimum: 16 + - type: 'null' + CreateRunRequest: + type: object + additionalProperties: false + properties: + assistant_id: + description: The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run. + type: string + model: + description: The ID of the [Model](/docs/api-reference/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-4o + anyOf: + - type: string + - $ref: '#/components/schemas/AssistantSupportedModels' + x-oaiTypeLabel: string + nullable: true + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + instructions: + description: Overrides the [instructions](/docs/api-reference/assistants/createAssistant) 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. + 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. + + We generally recommend altering this or temperature but not both. + 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. + 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. + 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. + 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](/docs/models#tts): `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`. + anyOf: + - type: string + - type: string + enum: + - tts-1 + - tts-1-hd + - gpt-4o-mini-tts + - gpt-4o-mini-tts-2025-12-15 + 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](/docs/guides/text-to-speech#voice-options).' + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + 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 + CreateThreadAndRunRequest: + type: object + additionalProperties: false + properties: + assistant_id: + description: The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run. + type: string + thread: + $ref: '#/components/schemas/CreateThreadRequest' + model: + description: The ID of the [Model](/docs/api-reference/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-4o + 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-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. + type: string + 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' + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The ID of the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: string + 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. + 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. + + We generally recommend altering this or temperature but not both. + 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. + 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. + 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. + 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 + request, an empty thread will be created. + additionalProperties: false + properties: + messages: + description: A list of [messages](/docs/api-reference/messages) 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: | + A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/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. + 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`. + + Note that the overlap must not exceed half of `max_chunk_size_tokens`. + 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. + type: string + x-oaiTypeLabel: file + format: binary + model: + description: | + ID of the model to use. The options are `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`. + example: gpt-4o-transcribe + anyOf: + - type: string + - type: string + enum: + - whisper-1 + - 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. + type: string + prompt: + description: | + An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text#prompting) should match the audio language. This field is not supported when using `gpt-4o-transcribe-diarize`. + 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. + type: number + default: 0 + include: + description: | + Additional information to include in the transcription response. + `logprobs` will return the log probabilities of the tokens in the + response to understand the model's confidence in the transcription. + `logprobs` only works with response_format set to `json` and only with + the 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`. + 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. + This option is not available for `gpt-4o-transcribe-diarize`. + 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 + as 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). + See the [Streaming section of the Speech-to-Text guide](/docs/guides/speech-to-text?lang=curl#streaming-transcriptions) + for more information. + + Note: Streaming is not supported for the `whisper-1` model and will be ignored. + 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"`. + 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. + 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`. + 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. + 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: | + { + "task": "transcribe", + "duration": 42.7, + "text": "Agent: Thanks for calling OpenAI support.\nCustomer: Hi, I need help with diarization.", + "segments": [ + { + "type": "transcript.text.segment", + "id": "seg_001", + "start": 0.0, + "end": 5.2, + "text": "Thanks for calling OpenAI support.", + "speaker": "agent" + }, + { + "type": "transcript.text.segment", + "id": "seg_002", + "start": 5.2, + "end": 12.8, + "text": "Hi, I need help with diarization.", + "speaker": "A" + } + ], + "usage": { + "type": "duration", + "seconds": 43 + } + } + CreateTranscriptionResponseJson: + type: object + description: Represents a transcription response returned by model, based on the provided input. + properties: + text: + type: string + description: The transcribed text. + 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. + 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: | + { + "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.", + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 10, + "audio_tokens": 4 + }, + "output_tokens": 101, + "total_tokens": 115 + } + } + 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: | + { + "task": "transcribe", + "language": "english", + "duration": 8.470000267028809, + "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.", + "segments": [ + { + "id": 0, + "seek": 0, + "start": 0.0, + "end": 3.319999933242798, + "text": " The beach was a popular spot on a hot summer day.", + "tokens": [ + 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530 + ], + "temperature": 0.0, + "avg_logprob": -0.2860786020755768, + "compression_ratio": 1.2363636493682861, + "no_speech_prob": 0.00985979475080967 + }, + ... + ], + "usage": { + "type": "duration", + "seconds": 9 + } + } + 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. + 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. + 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](/docs/guides/speech-to-text#prompting) should be in English. + type: string + response_format: + description: | + The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. + 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. + 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. + type: string + purpose: + description: | + The intended purpose of the uploaded file. + + See the [documentation on File + purposes](/docs/api-reference/files/create#files-create-purpose). + type: string + enum: + - assistants + - batch + - fine-tune + - vision + bytes: + description: | + The number of bytes in the file you are uploading. + type: integer + mime_type: + description: | + The MIME type of the file. + + + This must fall within the supported MIME types for your file purpose. See + the supported MIME types for assistants and vision. + 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](/docs/api-reference/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](/docs/api-reference/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`](/docs/api-reference/vector-stores-file-batches/createBatch) 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](/docs/api-reference/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. + + Supported MIME types: + `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`. + 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. + + Supported MIME types: + `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`. + 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. + properties: + type: + type: string + enum: + - custom_tool_call + x-stainless-const: true + description: | + The type of the custom tool call. Always `custom_tool_call`. + id: + type: string + description: | + The unique ID of the custom tool call in the OpenAI platform. + call_id: + type: string + description: | + An identifier used to map this custom tool call to a tool call output. + namespace: + type: string + description: | + The namespace of the custom tool being called. + name: + type: string + description: | + The name of the custom tool being called. + input: + type: string + description: | + The input for the custom tool call generated by the model. + 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. + 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`. + id: + type: string + description: | + The unique ID of the custom tool call output in the OpenAI platform. + call_id: + type: string + description: | + The call ID, used to map this custom tool call output to a custom tool call. + output: + description: | + The output from the custom tool call generated by your code. + Can be a string or an list of output content. + oneOf: + - type: string + description: | + A string of the output of the custom tool call. + 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. + 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. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallOutputStatusEnum' + created_by: + type: string + description: | + The identifier of the actor that created the item. + 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. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + CustomToolChatCompletions: + type: object + title: Custom tool + description: | + A custom tool that processes input using a specified format. + 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. + 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. + format: + description: | + The input format for the custom tool. Default is unconstrained text. + 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: | + { + "object": "group.role.deleted", + "deleted": true + } + 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 + hierarchy. Instructions given with the `developer` or `system` role take + precedence over instructions given with the `user` role. Messages with the + `assistant` role are presumed to have been generated by the model in previous + interactions. + properties: + role: + type: string + description: | + The role of the message input. One of `user`, `assistant`, `system`, or + `developer`. + enum: + - user + - assistant + - system + - developer + content: + description: | + Text, image, or audio input to the model, used to generate a response. + Can also contain previous assistant responses. + oneOf: + - type: string + title: Text input + description: | + A text input to the model. + - $ref: '#/components/schemas/InputMessageContentList' + phase: + anyOf: + - $ref: '#/components/schemas/MessagePhase' + - type: 'null' + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + required: + - role + - content + EditImageBodyJsonParam: + type: object + description: | + JSON request body for image edits. + + Use `images` (array of `ImageRefParam`) instead of multipart `image` uploads. + You can reference images via external URLs, data URLs, or uploaded file IDs. + JSON edits support GPT image models only; DALL-E edits require multipart (`dall-e-2` only). + properties: + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1.5 + - gpt-image-1 + - gpt-image-1-mini + - chatgpt-image-latest + - type: 'null' + x-oaiTypeLabel: string + default: gpt-image-1.5 + example: gpt-image-1.5 + description: The model to use for image editing. + images: + type: array + minItems: 1 + maxItems: 16 + description: | + Input image references to edit. + For GPT image models, you can provide up to 16 images. + items: + $ref: '#/components/schemas/ImageRefParam' + mask: + $ref: '#/components/schemas/ImageRefParam' + 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 + - auto + - type: 'null' + default: auto + example: high + description: | + Output quality for GPT image models. + input_fidelity: + anyOf: + - type: string + enum: + - high + - low + - type: 'null' + description: Controls fidelity to the original input image(s). + size: + anyOf: + - type: string + enum: + - auto + - 1024x1024 + - 1536x1024 + - 1024x1536 + - type: 'null' + default: auto + example: 1024x1024 + description: Requested output image size. + user: + type: string + example: user-1234 + description: | + A unique identifier representing your end-user, which can help OpenAI + monitor and detect abuse. + 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: Background behavior for generated image output. + 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. + 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](/docs/guides/embeddings). + items: + type: number + format: float + 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: | + { + "object": "embedding", + "embedding": [ + 0.0023064255, + -0.009327292, + .... (1536 floats total for ada-002) + -0.0028842222, + ], + "index": 0 + } + Error: + type: object + properties: + code: + anyOf: + - type: string + - type: 'null' + message: + type: string + param: + anyOf: + - type: string + - type: 'null' + type: + type: string + 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](/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](/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. + An Eval represents a task to be done for your LLM integration. + Like: + - Improve the quality of my chatbot + - See how well my chatbot handles customer support + - Check if o4-mini is better at my usecase than gpt-4o + 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: + default: eval + 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: | + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + }, + "include_sample_schema": true + }, + "testing_criteria": [ + { + "name": "My string check grader", + "type": "string_check", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq", + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": { + "test": "synthetics", + } + } + EvalApiError: + type: object + title: EvalApiError + description: | + An object representing an error response from the Eval API. + 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: | + { + "code": "internal_error", + "message": "The eval run failed due to an internal error." + } + EvalCustomDataSourceConfig: + type: object + title: CustomDataSourceConfig + description: | + A CustomDataSourceConfig which specifies the schema of your `item` and optionally `sample` namespaces. + The response schema defines the shape of the data that will be: + - Used to define your testing criteria and + - What data is required when creating a run + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + 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: | + { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + } + }, + "required": ["item"] + } + } + 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: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + "pass_threshold": 0.8 + } + 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: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "pass_threshold": 0.8, + "evaluation_metric": "fuzzy_match" + } + EvalItem: + type: object + title: Eval message object + description: | + A message input to the model with a role indicating instruction following + hierarchy. Instructions given with the `developer` or `system` role take + precedence over instructions given with the `user` role. Messages with the + `assistant` role are presumed to have been generated by the model in previous + interactions. + properties: + role: + type: string + description: | + The role of the message input. One of `user`, `assistant`, `system`, or + `developer`. + enum: + - user + - assistant + - system + - developer + content: + $ref: '#/components/schemas/EvalItemContent' + type: + type: string + description: | + The type of the message input. Always `message`. + 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. + 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 + image, or input audio object. + items: + $ref: '#/components/schemas/EvalItemContentItem' + EvalItemContentItem: + title: Eval content item + description: | + A single content item: input text, output text, input image, or input audio. + 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. + properties: + type: + type: string + description: | + The type of the output text. Always `output_text`. + enum: + - output_text + x-stainless-const: true + text: + type: string + description: | + The text output from the model. + required: + - type + - text + EvalItemContentText: + type: string + title: Text input + description: | + A text input to the model. + 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`. + enum: + - input_image + x-stainless-const: true + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + 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. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval objects. + 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: | + { + "object": "list", + "data": [ + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": {}, + } + ], + "first_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "last_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "has_more": true + } + EvalLogsDataSourceConfig: + type: object + title: LogsDataSourceConfig + description: | + A LogsDataSourceConfig which specifies the metadata property of your logs query. + This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. + The schema returned by this data source config is used to defined what variables are available in your evals. + `item` and `sample` are both defined when using this data source config. + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + required: + - type + - schema + x-oaiMeta: + name: The logs data source object for evals + group: evals + example: | + { + "type": "logs", + "metadata": { + "language": "english" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + } + } + EvalResponsesSource: + type: object + title: EvalResponsesSource + description: | + A EvalResponsesSource object describing a run data source configuration. + 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: | + { + "type": "responses", + "model": "gpt-4o-mini-2024-07-18", + "temperature": 0.7, + "top_p": 1.0, + "users": ["user1", "user2"], + "tools": ["tool1", "tool2"], + "instructions_search": "You are a coding assistant" + } + EvalRun: + type: object + title: EvalRun + description: | + A schema representing an evaluation run. + 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 + description: The model that is evaluated, if applicable. + name: + type: string + 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 + 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' + 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: | + { + "object": "eval.run", + "id": "evalrun_67e57965b480819094274e3a32235e4c", + "eval_id": "eval_67e579652b548190aaa83ada4b125f47", + "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47?run_id=evalrun_67e57965b480819094274e3a32235e4c", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + EvalRunList: + type: object + title: EvalRunList + description: | + An object representing a list of runs for an evaluation. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval run objects. + 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: | + { + "object": "list", + "data": [ + { + "object": "eval.run", + "id": "evalrun_67b7fbdad46c819092f6fe7a14189620", + "eval_id": "eval_67b7fa9a81a88190ab4aa417e397ea21", + "report_url": "https://platform.openai.com/evaluations/eval_67b7fa9a81a88190ab4aa417e397ea21?run_id=evalrun_67b7fbdad46c819092f6fe7a14189620", + "status": "completed", + "model": "o3-mini", + "name": "Academic Assistant", + "created_at": 1740110812, + "result_counts": { + "total": 171, + "errored": 0, + "failed": 80, + "passed": 91 + }, + "per_model_usage": null, + "per_testing_criteria_results": [ + { + "testing_criteria": "String check grader", + "passed": 91, + "failed": 80 + } + ], + "run_data_source": { + "type": "completions", + "template_messages": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "You are a helpful assistant." + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Hello, can you help me with my homework?" + } + } + ], + "datasource_reference": null, + "model": "o3-mini", + "max_completion_tokens": null, + "seed": null, + "temperature": null, + "top_p": null + }, + "error": null, + "metadata": {"test": "synthetics"} + } + ], + "first_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "last_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "has_more": false + } + EvalRunOutputItem: + type: object + title: EvalRunOutputItem + description: | + A schema representing an evaluation run output item. + 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: + $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. + 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: | + { + "object": "eval.run.output_item", + "id": "outputitem_67abd55eb6548190bb580745d5644a33", + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "created_at": 1739314509, + "status": "pass", + "datasource_item_id": 137, + "datasource_item": { + "teacher": "To grade essays, I only check for style, content, and grammar.", + "student": "I am a student who is trying to write the best essay." + }, + "results": [ + { + "name": "String Check Grader", + "type": "string-check-grader", + "score": 1.0, + "passed": true, + } + ], + "sample": { + "input": [ + { + "role": "system", + "content": "You are an evaluator bot..." + }, + { + "role": "user", + "content": "You are assessing..." + } + ], + "output": [ + { + "role": "assistant", + "content": "The rubric is not clear nor concise." + } + ], + "finish_reason": "stop", + "model": "gpt-4o-2024-08-06", + "usage": { + "total_tokens": 521, + "completion_tokens": 2, + "prompt_tokens": 519, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } + EvalRunOutputItemList: + type: object + title: EvalRunOutputItemList + description: | + An object representing a list of output items for an evaluation run. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval run output item objects. + 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: | + { + "object": "list", + "data": [ + { + "object": "eval.run.output_item", + "id": "outputitem_67abd55eb6548190bb580745d5644a33", + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "created_at": 1739314509, + "status": "pass", + "datasource_item_id": 137, + "datasource_item": { + "teacher": "To grade essays, I only check for style, content, and grammar.", + "student": "I am a student who is trying to write the best essay." + }, + "results": [ + { + "name": "String Check Grader", + "type": "string-check-grader", + "score": 1.0, + "passed": true, + } + ], + "sample": { + "input": [ + { + "role": "system", + "content": "You are an evaluator bot..." + }, + { + "role": "user", + "content": "You are assessing..." + } + ], + "output": [ + { + "role": "assistant", + "content": "The rubric is not clear nor concise." + } + ], + "finish_reason": "stop", + "model": "gpt-4o-2024-08-06", + "usage": { + "total_tokens": 521, + "completion_tokens": 2, + "prompt_tokens": 519, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + }, + ], + "first_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "last_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "has_more": false + } + EvalRunOutputItemResult: + type: object + title: EvalRunOutputItemResult + description: | + A single grader result for an evaluation run output item. + 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. + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + required: + - type + - schema + deprecated: true + x-oaiMeta: + name: The stored completions data source object for evals + group: evals + example: | + { + "type": "stored_completions", + "metadata": { + "language": "english" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + } + } + EvalStoredCompletionsSource: + type: object + title: StoredCompletionsRunDataSource + description: | + A StoredCompletionsRunDataSource configuration describing a set of filters + 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-4o'). + - 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: | + { + "type": "stored_completions", + "model": "gpt-4o", + "created_after": 1668124800, + "created_before": 1668124900, + "limit": 100, + "metadata": {} + } + 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. + properties: + type: + type: string + description: | + The type of the file path. Always `file_path`. + enum: + - file_path + x-stainless-const: true + file_id: + type: string + description: | + The ID of the file. + index: + type: integer + description: | + The index of the file in the list of files. + 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. + + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + 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 + [file search guide](/docs/guides/tools-file-search) for more information. + properties: + id: + type: string + description: | + The unique ID of the file search tool call. + type: + type: string + enum: + - file_search_call + description: | + The type of the file search tool call. Always `file_search_call`. + x-stainless-const: true + status: + type: string + description: | + The status of the file search tool call. One of `in_progress`, + `searching`, `incomplete` or `failed`, + enum: + - in_progress + - searching + - completed + - incomplete + - failed + queries: + type: array + items: + type: string + description: | + The queries used to search for files. + results: + anyOf: + - type: array + description: | + The results of the file search tool call. + items: + type: object + properties: + file_id: + type: string + description: | + The unique ID of the file. + text: + type: string + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. + - 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. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0 + maximum: 2 + exclusiveMinimum: true + 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. + 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. + 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 through the training dataset. + 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. + 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. + 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 through the training dataset. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 50 + default: auto + reasoning_effort: + description: | + Level of reasoning effort. + type: string + enum: + - default + - low + - medium + - high + default: default + compute_multiplier: + description: | + Multiplier on amount of compute used for exploring search space during training. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0.00001 + maximum: 10 + exclusiveMinimum: true + default: auto + eval_interval: + description: | + The number of training steps between evaluation runs. + 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. + 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. + 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. + 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 through the training dataset. + 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. + 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: | + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1712211699, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + } + 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 + metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags + to your run, and set a default entity (team, username, etc) to be associated with your run. + required: + - project + properties: + project: + description: | + The name of the project that the new run will be created under. + 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. + 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 + like associated with the run. If not set, the default entity for the registered WandB API key is used. + 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 + default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}". + 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. + 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' + 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 + 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 + are updated less frequently, but with lower variance. + 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 + overfitting. + 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 + through the training dataset. + 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](/docs/api-reference/files/retrieve-contents). + items: + type: string + example: file-abc123 + status: + type: string + description: The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. + enum: + - validating_files + - queued + - running + - succeeded + - failed + - cancelled + 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](/docs/api-reference/files/retrieve-contents). + validation_file: + anyOf: + - type: string + description: The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents). + - 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 + 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: + $ref: '#/components/schemas/FineTuneMethod' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - created_at + - error + - finished_at + - fine_tuned_model + - hyperparameters + - id + - model + - object + - organization_id + - result_files + - status + - trained_tokens + - training_file + - validation_file + - seed + x-oaiMeta: + name: The fine-tuning job object + example: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "davinci-002", + "created_at": 1692661014, + "finished_at": 1692661190, + "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + "organization_id": "org-123", + "result_files": [ + "file-abc123" + ], + "status": "succeeded", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + }, + "trained_tokens": 5768, + "integrations": [], + "seed": 0, + "estimated_finish": 0, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + } + } + }, + "metadata": { + "key": "value" + } + } + 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. + 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: | + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P", + "created_at": 1712211699, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88", + "fine_tuning_job_id": "ftjob-fpbNQ3H1GrMehXRf8cO97xTN", + "metrics": { + "step": 88, + "train_loss": 0.478, + "train_mean_token_accuracy": 0.924, + "valid_loss": 10.112, + "valid_mean_token_accuracy": 0.145, + "full_valid_loss": 0.567, + "full_valid_mean_token_accuracy": 0.944 + }, + "step_number": 88 + } + 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 + description: The data associated with the event. + required: + - id + - object + - created_at + - level + - message + x-oaiMeta: + name: The fine-tuning job event object + example: | + { + "object": "fine_tuning.job.event", + "id": "ftevent-abc123" + "created_at": 1677610602, + "level": "info", + "message": "Created fine-tuning job", + "data": {}, + "type": "message" + } + FunctionAndCustomToolCallOutput: + oneOf: + - $ref: '#/components/schemas/InputTextContent' + - $ref: '#/components/schemas/InputImageContent' + - $ref: '#/components/schemas/InputFileContent' + discriminator: + propertyName: type + 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](/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](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `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 + [function calling guide](/docs/guides/function-calling) for more information. + properties: + id: + type: string + description: | + The unique ID of the function tool call. + type: + type: string + enum: + - function_call + description: | + The type of the function tool call. Always `function_call`. + x-stainless-const: true + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - name + - arguments + FunctionToolCallOutput: + type: object + title: Function tool call output + description: | + The output of a function tool call. + properties: + id: + type: string + description: | + The unique ID of the function tool call output. Populated when this item + is returned via API. + type: + type: string + enum: + - function_call_output + description: | + The type of the function tool call output. Always `function_call_output`. + x-stainless-const: true + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + output: + description: | + The output from the function call generated by your code. + Can be a string or an list of output content. + oneOf: + - type: string + description: | + A string of the output of the function call. + title: string output + - type: array + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + title: output content list + description: | + Text, image, or file output of the function call. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - output + FunctionToolCallOutputResource: + allOf: + - $ref: '#/components/schemas/FunctionToolCallOutput' + - type: object + properties: + id: + type: string + description: | + The unique ID of the function call tool output. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallOutputStatusEnum' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + FunctionToolCallResource: + allOf: + - $ref: '#/components/schemas/FunctionToolCall' + - type: object + properties: + id: + type: string + description: | + The unique ID of the function tool call. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + GraderLabelModel: + type: object + title: LabelModelGrader + description: | + A LabelModelGrader object which uses a model to assign labels to each item + in the evaluation. + 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: | + { + "name": "First label grader", + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.response}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + 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: + 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: | + { + "type": "multi", + "name": "example multi grader", + "graders": [ + { + "type": "text_similarity", + "name": "example text similarity grader", + "input": "The graded text", + "reference": "The reference text", + "evaluation_metric": "fuzzy_match" + }, + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + ], + "calculate_output": "0.5 * text_similarity_score + 0.5 * string_check_score)" + } + GraderPython: + type: object + title: PythonGrader + description: | + A PythonGrader object that runs a python script on the input. + 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: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + } + GraderScoreModel: + type: object + title: ScoreModelGrader + description: | + A ScoreModelGrader object that uses a model to assign a score to the input. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: | + An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: | + The maximum number of tokens the grader model may generate in its response. + - 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. + 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: | + { + "type": "score_model", + "name": "Example score model grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "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}}" + ) + }, + { + "type": "input_image", + "image_url": "https://example.com/reference.png", + "file_id": null, + "detail": "auto" + } + ], + } + ], + "model": "gpt-5-mini", + "sampling_params": { + "temperature": 1, + "top_p": 1, + "seed": 42, + "max_completions_tokens": 32768, + "reasoning_effort": "medium" + }, + } + GraderStringCheck: + type: object + title: StringCheckGrader + description: | + A StringCheckGrader object that performs a string comparison between input and reference using a specified operation. + 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: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + GraderTextSimilarity: + type: object + title: TextSimilarityGrader + description: | + A TextSimilarityGrader object which grades text based on similarity metrics. + 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`, + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, + or `rouge_l`. + required: + - type + - name + - input + - reference + - evaluation_metric + x-oaiMeta: + name: Text Similarity Grader + group: graders + example: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "evaluation_metric": "fuzzy_match" + } + 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: | + { + "object": "group", + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "scim_managed": false + } + 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: | + { + "object": "group.deleted", + "id": "group_01J1F8ABCDXYZ", + "deleted": true + } + 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: | + { + "object": "list", + "data": [ + { + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "is_scim_managed": false + }, + { + "id": "group_01J1F8PQRMNO", + "name": "Sales", + "created_at": 1711472599, + "is_scim_managed": true + } + ], + "has_more": false, + "next": null + } + 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: | + { + "id": "group_01J1F8ABCDXYZ", + "name": "Escalations", + "created_at": 1711471533, + "is_scim_managed": false + } + 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 + description: The type of the group. + required: + - id + - name + - created_at + - is_scim_managed + - group_type + x-oaiMeta: + name: Group + example: | + { + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "is_scim_managed": false, + "group_type": "group" + } + 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: | + { + "object": "group.role", + "group": { + "object": "group", + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "scim_managed": false + }, + "role": { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + } + 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: | + { + "object": "group.user", + "user_id": "user_abc123", + "group_id": "group_01J1F8ABCDXYZ" + } + 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: | + { + "object": "group.user.deleted", + "deleted": true + } + 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 the GPT image models, and only present if `response_format` is set to `b64_json` for `dall-e-2` and `dall-e-3`. + 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. + revised_prompt: + type: string + description: For `dall-e-3` only, the revised prompt that was used to generate the image. + ImageEditCompletedEvent: + type: object + description: | + Emitted when image editing has completed and the final image is available. + properties: + type: + type: string + description: | + The type of the event. Always `image_edit.completed`. + 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. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + type: string + description: | + The size of the edited image. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + quality: + type: string + description: | + The quality setting for the edited image. + enum: + - low + - medium + - high + - auto + background: + type: string + description: | + The background setting for the edited image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the edited image. + 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: | + { + "type": "image_edit.completed", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "usage": { + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 + } + } + } + ImageEditPartialImageEvent: + type: object + description: | + Emitted when a partial image is available during image editing streaming. + properties: + type: + type: string + description: | + The type of the event. Always `image_edit.partial_image`. + 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. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + type: string + description: | + The size of the requested edited image. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + quality: + type: string + description: | + The quality setting for the requested edited image. + enum: + - low + - medium + - high + - auto + background: + type: string + description: | + The background setting for the requested edited image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the requested edited image. + enum: + - png + - webp + - jpeg + partial_image_index: + type: integer + description: | + 0-based index for the partial image (streaming). + required: + - type + - b64_json + - created_at + - size + - quality + - background + - output_format + - partial_image_index + x-oaiMeta: + name: image_edit.partial_image + group: images + example: | + { + "type": "image_edit.partial_image", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "partial_image_index": 0 + } + 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. + properties: + type: + type: string + description: | + The type of the event. Always `image_generation.completed`. + enum: + - image_generation.completed + x-stainless-const: true + b64_json: + type: string + description: | + Base64-encoded image data, suitable for rendering as an image. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + type: string + description: | + The size of the generated image. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + quality: + type: string + description: | + The quality setting for the generated image. + enum: + - low + - medium + - high + - auto + background: + type: string + description: | + The background setting for the generated image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the generated image. + 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: | + { + "type": "image_generation.completed", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "usage": { + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 + } + } + } + ImageGenPartialImageEvent: + type: object + description: | + Emitted when a partial image is available during image generation streaming. + properties: + type: + type: string + description: | + The type of the event. Always `image_generation.partial_image`. + 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. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + type: string + description: | + The size of the requested image. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + quality: + type: string + description: | + The quality setting for the requested image. + enum: + - low + - medium + - high + - auto + background: + type: string + description: | + The background setting for the requested image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the requested image. + enum: + - png + - webp + - jpeg + partial_image_index: + type: integer + description: | + 0-based index for the partial image (streaming). + required: + - type + - b64_json + - created_at + - size + - quality + - background + - output_format + - partial_image_index + x-oaiMeta: + name: image_generation.partial_image + group: images + example: | + { + "type": "image_generation.partial_image", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "partial_image_index": 0 + } + 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. + properties: + type: + type: string + enum: + - image_generation + description: | + The type of the image generation tool. Always `image_generation`. + x-stainless-const: true + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-1.5 + description: | + The image generation model to use. Default: `gpt-image-1`. + default: gpt-image-1 + quality: + type: string + enum: + - low + - medium + - high + - auto + description: | + The quality of the generated image. One of `low`, `medium`, `high`, + or `auto`. Default: `auto`. + default: auto + size: + anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + description: The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, 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 + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer + minimum: 0 + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: + type: string + enum: + - transparent + - opaque + - auto + description: | + Background type for the generated image. One of `transparent`, + `opaque`, or `auto`. Default: `auto`. + default: auto + input_fidelity: + anyOf: + - $ref: '#/components/schemas/InputFidelity' + - type: 'null' + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + 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. + default: 0 + action: + description: | + Whether to generate a new image or edit an existing image. Default: `auto`. + $ref: '#/components/schemas/ImageGenActionEnum' + required: + - type + ImageGenToolCall: + type: object + title: Image generation call + description: | + An image generation request made by the model. + properties: + type: + type: string + enum: + - image_generation_call + description: | + The type of the image generation call. Always `image_generation_call`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the image generation call. + status: + type: string + enum: + - in_progress + - completed + - generating + - failed + description: | + The status of the image generation call. + result: + anyOf: + - type: string + description: | + The generated image encoded in base64. + - type: 'null' + required: + - type + - id + - status + - result + ImageRefParam: + type: object + description: | + Reference an input image by either URL or uploaded file ID. + Provide exactly one of `image_url` or `file_id`. + 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: + 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: + type: string + description: The size of the image generated. Either `1024x1024`, `1024x1536`, or `1536x1024`. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + quality: + type: string + description: The quality of the image generated. Either `low`, `medium`, or `high`. + enum: + - low + - medium + - high + usage: + $ref: '#/components/schemas/ImageGenUsage' + required: + - created + x-oaiMeta: + name: The image generation response + group: images + example: | + { + "created": 1713833628, + "data": [ + { + "b64_json": "..." + } + ], + "background": "transparent", + "output_format": "png", + "size": "1024x1024", + "quality": "high", + "usage": { + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 + } + } + } + ImagesUsage: + type: object + description: | + For the GPT image models only, the token usage information for the image generation. + 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. + 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. + properties: + type: + type: string + description: | + The type of the input item. Always `input_audio`. + enum: + - input_audio + x-stainless-const: true + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: | + The format of the audio data. Currently supported formats are `mp3` and + `wav`. + 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 + generated by the model. Can contain text, images, and audio inputs, + as well as previous assistant responses and tool call outputs. + $ref: '#/components/schemas/Item' + - $ref: '#/components/schemas/ItemReferenceParam' + discriminator: + propertyName: type + InputMessage: + type: object + title: Input message + description: | + A message input to the model with a role indicating instruction following + hierarchy. Instructions given with the `developer` or `system` role take + precedence over instructions given with the `user` role. + properties: + type: + type: string + description: | + The type of the message input. Always set to `message`. + enum: + - message + x-stainless-const: true + role: + type: string + description: | + The role of the message input. One of `user`, `system`, or `developer`. + enum: + - user + - system + - developer + status: + type: string + description: | + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + 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 + types. + 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. + required: + - id + - type + InputParam: + description: | + Text, image, or file inputs to the model, used to generate a response. + + Learn more: + - [Text inputs and outputs](/docs/guides/text) + - [Image inputs](/docs/guides/images) + - [File inputs](/docs/guides/pdf-files) + - [Conversation state](/docs/guides/conversation-state) + - [Function calling](/docs/guides/function-calling) + oneOf: + - type: string + title: Text input + description: | + A text input to the model, equivalent to a text input with the + `user` role. + - type: array + title: Input item list + description: | + A list of one or many input items to the model, containing + different content types. + 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: | + { + "object": "organization.invite", + "id": "invite-abc", + "email": "user@example.com", + "role": "owner", + "status": "accepted", + "created_at": 1711471533, + "expires_at": 1711471533, + "accepted_at": 1711471533, + "projects": [ + { + "id": "project-xyz", + "role": "member" + } + ] + } + 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: | + { + "group_id": "group_01J1F8ABCDXYZ", + "role": "role_01J1F8PROJ" + } + 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. + 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. + 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/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. + 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/ReasoningItem' + - $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: | + { + "object": "list", + "data": [ + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698982736, + "name": "Coding Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc456", + "object": "assistant", + "created_at": 1698982718, + "name": "My Assistant", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc789", + "object": "assistant", + "created_at": 1698982643, + "name": null, + "description": null, + "model": "gpt-4o", + "instructions": null, + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + ], + "first_id": "asst_abc123", + "last_id": "asst_abc789", + "has_more": false + } + 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 + LocalShellToolCall: + type: object + title: Local shell call + description: | + A tool call to run a command on the local shell. + properties: + type: + type: string + enum: + - local_shell_call + description: | + The type of the local shell call. Always `local_shell_call`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the local shell call. + call_id: + type: string + description: | + The unique ID of the local shell tool call generated by the model. + action: + $ref: '#/components/schemas/LocalShellExecAction' + status: + type: string + enum: + - in_progress + - completed + - incomplete + description: | + The status of the local shell call. + required: + - type + - id + - call_id + - action + - status + LocalShellToolCallOutput: + type: object + title: Local shell call output + description: | + The output of a local shell tool call. + properties: + type: + type: string + enum: + - local_shell_call_output + description: | + The type of the local shell tool call output. Always `local_shell_call_output`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the local shell tool call generated by the model. + output: + type: string + description: | + A JSON string of the output of the local shell tool call. + status: + anyOf: + - type: string + enum: + - in_progress + - completed + - incomplete + description: | + The status of the item. One of `in_progress`, `completed`, or `incomplete`. + - type: 'null' + required: + - id + - type + - call_id + - output + LogProbProperties: + type: object + description: | + A log probability object. + properties: + token: + type: string + description: | + The token that was used to generate the log probability. + logprob: + type: number + description: | + The log probability of the token. + bytes: + type: array + items: + type: integer + description: | + The bytes that were used to generate the log probability. + required: + - token + - logprob + - bytes + MCPApprovalRequest: + type: object + title: MCP approval request + description: | + A request for human approval of a tool invocation. + 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 + MCPApprovalResponse: + type: object + title: MCP approval response + description: | + A response to an MCP approval request. + properties: + type: + type: string + enum: + - mcp_approval_response + description: | + The type of the item. Always `mcp_approval_response`. + x-stainless-const: true + id: + anyOf: + - type: string + description: | + The unique ID of the approval response + - type: 'null' + 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 + - request_id + - approve + - approval_request_id + MCPApprovalResponseResource: + type: object + title: MCP approval response + description: | + A response to an MCP approval request. + 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 + - request_id + - approve + - approval_request_id + MCPListTools: + type: object + title: MCP list tools + description: | + A list of tools available on an MCP server. + 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. + error: + anyOf: + - type: string + description: | + Error message if the server could not list tools. + - type: 'null' + required: + - type + - id + - server_label + - tools + MCPListToolsTool: + type: object + title: MCP list tools tool + description: | + A tool available on an MCP server. + properties: + name: + type: string + description: | + The name of the tool. + description: + anyOf: + - type: string + description: | + The description of the tool. + - type: 'null' + input_schema: + type: object + description: | + The JSON schema describing the tool's input. + annotations: + anyOf: + - type: object + description: | + Additional annotations about the tool. + - 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 + (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). + 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. + server_url: + type: string + format: uri + description: | + The URL for the MCP server. One of `server_url` or `connector_id` must be + provided. + 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 + `server_url` or `connector_id` must be provided. Learn more about service + connectors [here](/docs/guides/tools-remote-mcp#connectors). + + Currently supported `connector_id` values are: + + - Dropbox: `connector_dropbox` + - Gmail: `connector_gmail` + - Google Calendar: `connector_googlecalendar` + - Google Drive: `connector_googledrive` + - Microsoft Teams: `connector_microsoftteams` + - Outlook Calendar: `connector_outlookcalendar` + - Outlook Email: `connector_outlookemail` + - SharePoint: `connector_sharepoint` + authorization: + type: string + description: | + An OAuth access token that can be used with a remote MCP server, either + with a custom MCP server URL or a service connector. Your application + must handle the OAuth authorization flow and provide the token here. + server_description: + type: string + description: | + Optional description of the MCP server, used to provide more context. + headers: + anyOf: + - type: object + additionalProperties: + type: string + description: | + Optional HTTP headers to send to the MCP server. Use for authentication + or other purposes. + - type: 'null' + allowed_tools: + anyOf: + - description: | + List of allowed tool names or a filter object. + oneOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/MCPToolFilter' + - 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 + `always`, `never`, or a filter object associated with tools + that require approval. + 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 + `never`. When set to `always`, all tools will require approval. When + set to `never`, all tools will not require approval. + enum: + - always + - never + default: always + - type: 'null' + defer_loading: + type: boolean + description: | + Whether this MCP tool is deferred and discovered via tool search. + required: + - type + - server_label + MCPToolCall: + type: object + title: MCP tool call + description: | + An invocation of a tool on an MCP server. + 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. + output: + anyOf: + - type: string + description: | + The output from the tool call. + - type: 'null' + error: + anyOf: + - type: string + description: | + The error from the tool call, if any. + - type: 'null' + status: + $ref: '#/components/schemas/MCPToolCallStatus' + description: | + The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`. + approval_request_id: + anyOf: + - type: string + description: | + Unique identifier for the MCP tool call approval request. + Include this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call. + - type: 'null' + required: + - type + - id + - server_label + - name + - arguments + MCPToolFilter: + type: object + title: MCP tool filter + description: | + A filter object to specify which tools are allowed. + 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 + MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), + it will match this filter. + required: [] + additionalProperties: false + MessageContentImageFileObject: + title: Image file + type: object + description: References an image [File](/docs/api-reference/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](/docs/api-reference/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](/docs/api-reference/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](/docs/api-reference/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. + 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: | + { + "id": "msg_123", + "object": "thread.message.delta", + "delta": { + "content": [ + { + "index": 0, + "type": "text", + "text": { "value": "Hello", "annotations": [] } + } + ] + } + } + MessageObject: + type: object + title: The message object + description: Represents a message within a [thread](/docs/api-reference/threads). + 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](/docs/api-reference/threads) 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](/docs/api-reference/assistants) that authored this message. + type: string + - type: 'null' + run_id: + anyOf: + - description: The ID of the [run](/docs/api-reference/runs) 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: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1698983503, + "thread_id": "thread_abc123", + "role": "assistant", + "content": [ + { + "type": "text", + "text": { + "value": "Hi! How can I help you today?", + "annotations": [] + } + } + ], + "assistant_id": "asst_abc123", + "run_id": "run_abc123", + "attachments": [], + "metadata": {} + } + MessagePhase: + type: string + 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. + 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](/docs/api-reference/messages/object) is created. + x-oaiMeta: + dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' + - 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](/docs/api-reference/messages/object) moves to an `in_progress` state. + x-oaiMeta: + dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' + - 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](/docs/api-reference/messages/object) are being streamed. + x-oaiMeta: + dataDescription: '`data` is a [message delta](/docs/api-reference/assistants-streaming/message-delta-object)' + - 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](/docs/api-reference/messages/object) is completed. + x-oaiMeta: + dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' + - 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](/docs/api-reference/messages/object) ends before it is completed. + x-oaiMeta: + dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' + Metadata: + anyOf: + - 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + 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. + required: + - id + - object + - created + - owned_by + x-oaiMeta: + name: The model object + example: | + { + "id": "VAR_chat_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + } + 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-5` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](/docs/models) to browse and compare available models. + ModelIdsResponses: + example: gpt-5.1 + 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-codex + - gpt-5-pro + - gpt-5-pro-2025-10-06 + - gpt-5.1-codex-max + ModelIdsShared: + example: gpt-5.4 + anyOf: + - type: string + - type: string + enum: + - 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 + 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 + tokens to return at each token position, each with an associated log + probability. In some cases, the number of returned tokens may be fewer than + requested. + 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. + We generally recommend altering this or `top_p` but not both. + - 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. + + We generally recommend altering this or `temperature` but not both. + - type: 'null' + user: + 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. + A stable identifier for your end-users. + Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers). + safety_identifier: + 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. + The 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](/docs/guides/safety-best-practices#safety-identifiers). + prompt_cache_key: + 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](/docs/guides/prompt-caching). + service_tier: + $ref: '#/components/schemas/ServiceTier' + prompt_cache_retention: + anyOf: + - type: string + enum: + - in_memory + - 24h + description: | + The 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](/docs/guides/prompt-caching#prompt-cache-retention). + - type: 'null' + ModifyAssistantRequest: + type: object + additionalProperties: false + properties: + model: + description: | + ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them. + 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. + type: string + maxLength: 256 + - type: 'null' + description: + anyOf: + - description: | + The description of the assistant. The maximum length is 512 characters. + type: string + maxLength: 512 + - type: 'null' + instructions: + anyOf: + - description: | + The system instructions that the assistant uses. The maximum length is 256,000 characters. + 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`. + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + Overrides the list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + Overrides the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + 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. + 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. + + We generally recommend altering this or temperature but not both. + - 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread. + 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. + 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 + 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. + 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`. + required: + - id + - object + - bytes + - created_at + - filename + - purpose + - status + x-oaiMeta: + name: The file object + example: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1680202602, + "filename": "salesOverview.pdf", + "purpose": "assistants", + } + 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 + 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 + 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. + properties: + type: + type: string + description: | + The type of the output audio. Always `output_audio`. + enum: + - output_audio + x-stainless-const: true + data: + type: string + description: | + Base64-encoded audio data from the model. + transcript: + type: string + description: | + The transcript of the audio data from the model. + 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/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $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. + properties: + id: + type: string + description: | + The unique ID of the output message. + type: + type: string + description: | + The type of the output message. Always `message`. + enum: + - message + x-stainless-const: true + role: + type: string + description: | + The role of the output message. Always `assistant`. + enum: + - assistant + x-stainless-const: true + content: + type: array + description: | + The content of the output message. + 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 + `incomplete`. Populated when input items are returned via API. + 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](/docs/guides/function-calling#configuring-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 + streaming responses that return partial images. Value must be between 0 and 3. + When set to 0, the response will be a single image sent in one streaming event. + + Note that the final image may be sent before the full number of partial images + are generated if the full image is generated more quickly. + - type: 'null' + PredictionContent: + type: object + title: Static Content + description: | + Static predicted output content, such as the content of a text file that is + being regenerated. + required: + - type + - content + properties: + type: + type: string + enum: + - content + description: | + The type of the predicted content you want to provide. This type is + currently always `content`. + x-stainless-const: true + content: + description: | + The content that should be matched when generating a model response. + If generated tokens would match this content, the entire model response + can be returned much more quickly. + oneOf: + - type: string + title: Text content + description: | + The content used for a Predicted Output. This is often the + text of a file you are regenerating with minor changes. + - type: array + description: An array of content parts with a defined type. Supported options differ based on the [model](/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. + required: + - id + - object + - created_at + x-oaiMeta: + name: The project object + example: | + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project example", + "created_at": 1711471533, + "archived_at": null, + "status": "active", + "external_key_id": null + } + 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 + 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: + 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 + x-oaiMeta: + name: The project API key object + example: | + { + "object": "organization.project.api_key", + "redacted_value": "sk-abc...def", + "name": "My API Key", + "created_at": 1711471533, + "last_used_at": 1711471534, + "id": "key_abc", + "owner": { + "type": "user", + "user": { + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "created_at": 1711471533 + } + } + } + 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' + 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](/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 + 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 + 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: | + { + "object": "project.group", + "project_id": "proj_abc123", + "group_id": "group_01J1F8ABCDXYZ", + "group_name": "Support Team", + "group_type": "group", + "created_at": 1711471533 + } + 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: | + { + "object": "project.group.deleted", + "deleted": true + } + 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: | + { + "object": "list", + "data": [ + { + "object": "project.group", + "project_id": "proj_abc123", + "group_id": "group_01J1F8ABCDXYZ", + "group_name": "Support Team", + "created_at": 1711471533 + } + ], + "has_more": false, + "next": null + } + 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 + 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: | + { + "object": "project.rate_limit", + "id": "rl_ada", + "model": "ada", + "max_requests_per_1_minute": 600, + "max_tokens_per_1_minute": 150000, + "max_images_per_1_minute": 10 + } + 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 + description: '`owner` or `member`' + 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: | + { + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Service Account", + "role": "owner", + "created_at": 1711471533 + } + 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 + 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. + 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 + description: Service accounts can only have one role of type `member` + x-stainless-const: true + 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 + 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' + description: Geography for the project. + 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: | + { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + 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. + [Learn more](/docs/guides/text?api-mode=responses#reusable-prompts). + 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: | + { + "role_id": "role_01J1F8ROLE01" + } + 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: | + { + "role_name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "description": "Allows managing organization groups" + } + 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: | + { + "object": "list", + "data": [ + { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + ], + "has_more": false, + "next": null + } + 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: | + { + "role_name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "description": "Allows managing organization groups" + } + 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 + calls, and function call responses. This event can be used both to populate a + "history" of the conversation and to add new items mid-stream, but has the + current limitation that it cannot populate assistant audio messages. + + If successful, the server will respond with a `conversation.item.created` + event, otherwise an `error` event will be sent. + 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. + If set to `root`, the new item will be added to the beginning of the conversation. + If 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. + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - type + - item + x-oaiMeta: + name: conversation.item.create + group: realtime + example: | + { + "type": "conversation.item.create", + "item": { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } + ] + }, + "event_id": "b904fba0-0ec4-40af-8bbb-f908a9b26793", + } + RealtimeBetaClientEventConversationItemDelete: + type: object + description: | + Send this event when you want to remove any item from the conversation + history. The server will respond with a `conversation.item.deleted` event, + unless the item does not exist in the conversation history, in which case the + server will respond with an error. + 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: | + { + "event_id": "event_901", + "type": "conversation.item.delete", + "item_id": "msg_003" + } + 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. + The server will respond with a `conversation.item.retrieved` event, + unless the item does not exist in the conversation history, in which case the + server will respond with an error. + 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: | + { + "event_id": "event_901", + "type": "conversation.item.retrieve", + "item_id": "msg_003" + } + RealtimeBetaClientEventConversationItemTruncate: + type: object + description: | + Send this event to truncate a previous assistant message’s audio. The server + will produce audio faster than realtime, so this event is useful when the user + interrupts to truncate audio that has already been sent to the client but not + yet played. This will synchronize the server's understanding of the audio with + the client's playback. + + Truncating audio will delete the server-side text transcript to ensure there + is not text in the context that hasn't been heard by the user. + + If successful, the server will respond with a `conversation.item.truncated` + event. + 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 + items can be truncated. + 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 + the audio_end_ms is greater than the actual audio duration, the server + will respond with an error. + required: + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncate + group: realtime + example: | + { + "event_id": "event_678", + "type": "conversation.item.truncate", + "item_id": "msg_002", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeBetaClientEventInputAudioBufferAppend: + type: object + description: | + Send this event to append audio bytes to the input audio buffer. The audio + buffer is temporary storage you can write to and later commit. In Server VAD + mode, the audio buffer is used to detect speech and the server will decide + when to commit. When Server VAD is disabled, you must commit the audio buffer + manually. + + The client may choose how much audio to place in each event up to a maximum + of 15 MiB, for example streaming smaller chunks from the client may allow the + VAD to be more responsive. Unlike made other client events, the server will + not send a confirmation response to this event. + 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 + `input_audio_format` field in the session configuration. + required: + - type + - audio + x-oaiMeta: + name: input_audio_buffer.append + group: realtime + example: | + { + "event_id": "event_456", + "type": "input_audio_buffer.append", + "audio": "Base64EncodedAudioData" + } + RealtimeBetaClientEventInputAudioBufferClear: + type: object + description: | + Send this event to clear the audio bytes in the buffer. The server will + respond with an `input_audio_buffer.cleared` event. + 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: | + { + "event_id": "event_012", + "type": "input_audio_buffer.clear" + } + RealtimeBetaClientEventInputAudioBufferCommit: + 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. + + Committing 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. + 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: | + { + "event_id": "event_789", + "type": "input_audio_buffer.commit" + } + RealtimeBetaClientEventOutputAudioBufferClear: + type: object + description: | + **WebRTC/SIP Only:** Emit to cut off the current audio response. This will trigger the server to + stop generating audio and emit a `output_audio_buffer.cleared` event. This + event should be preceded by a `response.cancel` client event to stop the + generation of the current response. + [Learn more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + 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: | + { + "event_id": "optional_client_event_id", + "type": "output_audio_buffer.clear" + } + RealtimeBetaClientEventResponseCancel: + type: object + description: | + Send this event to cancel an in-progress response. The server will respond + with a `response.done` event with a status of `response.status=cancelled`. If + there is no response to cancel, the server will respond with an error. + 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 + in-progress response in the default conversation. + required: + - type + x-oaiMeta: + name: response.cancel + group: realtime + example: | + { + "event_id": "event_567", + "type": "response.cancel" + } + RealtimeBetaClientEventResponseCreate: + type: object + description: | + This event instructs the server to create a Response, which means triggering + model inference. When in Server VAD mode, the server will create Responses + automatically. + + A Response will include at least one Item, and may have two, in which case + the second will be a function call. These Items will be appended to the + conversation history. + + The server will respond with a `response.created` event, events for Items + and content created, and finally a `response.done` event to indicate the + Response is complete. + + The `response.create` event can optionally include inference configuration like + `instructions`, and `temperature`. These fields will override the Session's + configuration for this Response only. + + Responses can be created out-of-band of the default Conversation, meaning that they can + have arbitrary input, and it's possible to disable writing the output to the Conversation. + Only one Response can write to the default Conversation at a time, but otherwise multiple + Responses can be created in parallel. + + Clients can set `conversation` to `none` to create a Response that does not write to the default + Conversation. Arbitrary input can be provided with the `input` field, which is an array accepting + raw Items and references to existing Items. + 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 + { + "type": "response.create", + } + + // Trigger an out-of-band response that does not write to the default Conversation + { + "type": "response.create", + "response": { + "instructions": "Provide a concise answer.", + "tools": [], // clear any session tools + "conversation": "none", + "output_modalities": ["text"], + "input": [ + { + "type": "item_reference", + "id": "item_12345", + }, + { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Summarize the above message in one sentence." + } + ] + } + ], + } + } + RealtimeBetaClientEventSessionUpdate: + type: object + description: | + Send this event to update the session’s default configuration. + The client may send this event at any time to update any field, + except for `voice`. However, note that once a session has been + initialized with a particular `model`, it can’t be changed to + another model using `session.update`. + + When the server receives a `session.update`, it will respond + with a `session.updated` event showing the full, effective configuration. + Only the fields that are present are updated. To clear a field like + `instructions`, pass an empty string. + 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: | + { + "type": "session.update", + "session": { + "tools": [ + { + "type": "function", + "name": "display_color_palette", + "description": "Call this function when a user asks for a color palette.", + "parameters": { + "type": "object", + "properties": { + "theme": { + "type": "string", + "description": "Description of the theme for the color scheme." + }, + "colors": { + "type": "array", + "description": "Array of five hex color codes based on the theme.", + "items": { + "type": "string", + "description": "Hex color code" + } + } + }, + "required": [ + "theme", + "colors" + ] + } + } + ], + "tool_choice": "auto" + } + } + RealtimeBetaClientEventTranscriptionSessionUpdate: + type: object + description: | + Send this event to update a transcription session. + 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: | + { + "type": "transcription_session.update", + "session": { + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.logprobs", + ] + } + } + 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 + `incomplete`, `in_progress`). + 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 + with the `status` field (`completed`, `cancelled`, `incomplete`, + `failed`). + 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). + error: + type: object + description: | + A description of the error that caused the response to fail, + populated when the `status` is `failed`. + 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 + Realtime API session will maintain a conversation context and append new + Items to the Conversation, thus output from previous turns (text and + audio tokens) will become the input for later turns. + properties: + total_tokens: + type: integer + description: | + The total number of tokens in the Response including input and output + text and audio tokens. + input_tokens: + type: integer + description: | + The number of input tokens used in the Response, including text and + audio tokens. + output_tokens: + type: integer + description: | + The number of output tokens sent in the Response, including text and + audio tokens. + 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` + field in the `response.create` event. If `auto`, the response will be added to + the default conversation and the value of `conversation_id` will be an id like + `conv_1234`. If `none`, the response will not be added to any conversation and + the value of `conversation_id` will be `null`. If responses are being triggered + by server VAD, the response will be added to the default conversation, thus + the `conversation_id` will be an id like `conv_1234`. + type: string + voice: + $ref: '#/components/schemas/VoiceIdsShared' + description: | + The voice the model used to respond. + Current voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + `shimmer`, and `verse`. + modalities: + type: array + description: | + The set of modalities the model used to respond. If there are multiple modalities, + the model will pick one, for example if `modalities` is `["text", "audio"]`, the model + could be responding in either text or audio. + 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`. + temperature: + type: number + description: | + Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + 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, + inclusive of tool calls, that was used in this response. + 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, + set this to ["text"]. + 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. + + Note 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. + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + description: | + The voice the model uses to respond. Supported built-in voices are + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, + `marin`, and `cedar`. You may also provide a custom voice object with an + `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed during + the session once the model has responded with audio at least once. + 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`. + 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 + to call it, and guidance about what to tell the user when calling + (if anything). + 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 + function/MCP tool. + 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. + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + conversation: + description: | + Controls which conversation the response is added to. Currently supports + `auto` and `none`, with `auto` as the default value. The `auto` value + means that the contents of the response will be added to the default + conversation. Set this to `none` to create an out-of-band response which + will not add items to default conversation. + 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 + creates a new context for this Response instead of using the default + conversation. An empty array `[]` will clear the context for this Response. + Note that this can include references to items from the default conversation. + items: + $ref: '#/components/schemas/RealtimeConversationItem' + RealtimeBetaServerEventConversationItemCreated: + type: object + description: | + Returned when a conversation item is created. There are several scenarios that produce this event: + - The server is generating a Response, which if successful will produce + either one or two Items, which will be of type `message` + (role `assistant`) or type `function_call`. + - The input audio buffer has been committed, either by the client or the + server (in `server_vad` mode). The server will take the content of the + input audio buffer and add it to a new user message Item. + - The client has sent a `conversation.item.create` event to add a new Item + to the Conversation. + 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 + client to understand the order of the conversation. Can be `null` if the + item has no predecessor. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.created + group: realtime + example: | + { + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [] + } + } + RealtimeBetaServerEventConversationItemDeleted: + type: object + description: | + Returned when an item in the conversation is deleted by the client with a + `conversation.item.delete` event. This event is used to synchronize the + server's understanding of the conversation history with the client's view. + 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: | + { + "event_id": "event_2728", + "type": "conversation.item.deleted", + "item_id": "msg_005" + } + RealtimeBetaServerEventConversationItemInputAudioTranscriptionCompleted: + type: object + description: | + This event is the output of audio transcription for user audio written to the + user audio buffer. Transcription begins when the input audio buffer is + committed by the client or server (in `server_vad` mode). Transcription runs + asynchronously with Response creation, so this event may come before or after + the Response events. + + Realtime API models accept audio natively, and thus input transcription is a + separate process run on a separate ASR (Automatic Speech Recognition) model. + The transcript may diverge somewhat from the model's interpretation, and + should be treated as a rough guide. + 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 + `conversation.item.input_audio_transcription.completed`. + 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. + 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: | + { + "event_id": "event_2122", + "type": "conversation.item.input_audio_transcription.completed", + "item_id": "msg_003", + "content_index": 0, + "transcript": "Hello, how are you?", + "usage": { + "type": "tokens", + "total_tokens": 48, + "input_tokens": 38, + "input_token_details": { + "text_tokens": 10, + "audio_tokens": 28, + }, + "output_tokens": 10, + } + } + RealtimeBetaServerEventConversationItemInputAudioTranscriptionDelta: + type: object + description: | + Returned when the text value of an input audio transcription content part is updated. + 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: | + { + "type": "conversation.item.input_audio_transcription.delta", + "event_id": "event_001", + "item_id": "item_001", + "content_index": 0, + "delta": "Hello" + } + RealtimeBetaServerEventConversationItemInputAudioTranscriptionFailed: + type: object + description: | + Returned when input audio transcription is configured, and a transcription + request for a user message failed. These events are separate from other + `error` events so that the client can identify the related Item. + 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 + `conversation.item.input_audio_transcription.failed`. + 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: | + { + "event_id": "event_2324", + "type": "conversation.item.input_audio_transcription.failed", + "item_id": "msg_003", + "content_index": 0, + "error": { + "type": "transcription_error", + "code": "audio_unintelligible", + "message": "The audio could not be transcribed.", + "param": null + } + } + 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: | + { + "event_id": "event_6501", + "type": "conversation.item.input_audio_transcription.segment", + "item_id": "msg_011", + "content_index": 0, + "text": "hello", + "id": "seg_0001", + "speaker": "spk_1", + "start": 0.0, + "end": 0.4 + } + RealtimeBetaServerEventConversationItemRetrieved: + type: object + description: | + Returned when a conversation item is retrieved with `conversation.item.retrieve`. + 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: | + { + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [ + { + "type": "input_audio", + "transcript": "hello how are you", + "audio": "base64encodedaudio==" + } + ] + } + } + RealtimeBetaServerEventConversationItemTruncated: + type: object + description: | + Returned when an earlier assistant audio message item is truncated by the + client with a `conversation.item.truncate` event. This event is used to + synchronize the server's understanding of the audio with the client's playback. + + This action will truncate the audio and remove the server-side text transcript + to ensure there is no text in the context that hasn't been heard by the user. + 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. + required: + - event_id + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncated + group: realtime + example: | + { + "event_id": "event_2526", + "type": "conversation.item.truncated", + "item_id": "msg_004", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeBetaServerEventError: + type: object + description: | + Returned when an error occurs, which could be a client problem or a server + problem. Most errors are recoverable and the session will stay open, we + recommend to implementors to monitor and log error messages by default. + 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"). + 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. + - type: 'null' + required: + - event_id + - type + - error + x-oaiMeta: + name: error + group: realtime + example: | + { + "event_id": "event_890", + "type": "error", + "error": { + "type": "invalid_request_error", + "code": "invalid_event", + "message": "The 'type' field is missing.", + "param": null, + "event_id": "event_567" + } + } + RealtimeBetaServerEventInputAudioBufferCleared: + type: object + description: | + Returned when the input audio buffer is cleared by the client with a + `input_audio_buffer.clear` event. + 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: | + { + "event_id": "event_1314", + "type": "input_audio_buffer.cleared" + } + RealtimeBetaServerEventInputAudioBufferCommitted: + type: object + description: | + Returned when an input audio buffer is committed, either by the client or + automatically in server VAD mode. The `item_id` property is the ID of the user + message item that will be created, thus a `conversation.item.created` event + will also be sent to the client. + 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. + Can be `null` if the item has no predecessor. + - 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: | + { + "event_id": "event_1121", + "type": "input_audio_buffer.committed", + "previous_item_id": "msg_001", + "item_id": "msg_002" + } + RealtimeBetaServerEventInputAudioBufferSpeechStarted: + type: object + description: | + Sent by the server when in `server_vad` mode to indicate that speech has been + detected in the audio buffer. This can happen any time audio is added to the + buffer (unless speech is already detected). The client may want to use this + event to interrupt audio playback or provide visual feedback to the user. + + The client should expect to receive a `input_audio_buffer.speech_stopped` event + when speech stops. The `item_id` property is the ID of the user message item + that will be created when speech stops and will also be included in the + `input_audio_buffer.speech_stopped` event (unless the client manually commits + the audio buffer during VAD activation). + 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 + session when speech was first detected. This will correspond to the + beginning of audio sent to the model, and thus includes the + `prefix_padding_ms` configured in the Session. + item_id: + type: string + description: | + The ID of the user message item that will be created when speech stops. + required: + - event_id + - type + - audio_start_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.speech_started + group: realtime + example: | + { + "event_id": "event_1516", + "type": "input_audio_buffer.speech_started", + "audio_start_ms": 1000, + "item_id": "msg_003" + } + RealtimeBetaServerEventInputAudioBufferSpeechStopped: + type: object + description: | + Returned in `server_vad` mode when the server detects the end of speech in + the audio buffer. The server will also send an `conversation.item.created` + event with the user message item that is created from the audio buffer. + 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 + correspond to the end of audio sent to the model, and thus includes the + `min_silence_duration_ms` configured in the Session. + 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: | + { + "event_id": "event_1718", + "type": "input_audio_buffer.speech_stopped", + "audio_end_ms": 2000, + "item_id": "msg_003" + } + 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: | + { + "event_id": "event_6102", + "type": "mcp_list_tools.completed", + "item_id": "mcp_list_tools_001" + } + 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: | + { + "event_id": "event_6103", + "type": "mcp_list_tools.failed", + "item_id": "mcp_list_tools_001" + } + 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: | + { + "event_id": "event_6101", + "type": "mcp_list_tools.in_progress", + "item_id": "mcp_list_tools_001" + } + RealtimeBetaServerEventRateLimitsUpdated: + type: object + description: | + Emitted at the beginning of a Response to indicate the updated rate limits. + When a Response is created some tokens will be "reserved" for the output + tokens, the rate limits shown here reflect that reservation, which is then + adjusted accordingly once the Response is completed. + 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`). + 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: | + { + "event_id": "event_5758", + "type": "rate_limits.updated", + "rate_limits": [ + { + "name": "requests", + "limit": 1000, + "remaining": 999, + "reset_seconds": 60 + }, + { + "name": "tokens", + "limit": 50000, + "remaining": 49950, + "reset_seconds": 60 + } + ] + } + 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: | + { + "event_id": "event_4950", + "type": "response.output_audio.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Base64EncodedAudioDelta" + } + RealtimeBetaServerEventResponseAudioDone: + type: object + description: | + Returned when the model-generated audio is done. Also emitted when a Response + is interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_5152", + "type": "response.output_audio.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0 + } + RealtimeBetaServerEventResponseAudioTranscriptDelta: + type: object + description: | + Returned when the model-generated transcription of audio output is updated. + 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: | + { + "event_id": "event_4546", + "type": "response.output_audio_transcript.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Hello, how can I a" + } + RealtimeBetaServerEventResponseAudioTranscriptDone: + type: object + description: | + Returned when the model-generated transcription of audio output is done + streaming. Also emitted when a Response is interrupted, incomplete, or + cancelled. + 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: | + { + "event_id": "event_4748", + "type": "response.output_audio_transcript.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "transcript": "Hello, how can I assist you today?" + } + RealtimeBetaServerEventResponseContentPartAdded: + type: object + description: | + Returned when a new content part is added to an assistant message item during + response generation. + 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: | + { + "event_id": "event_3738", + "type": "response.content_part.added", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "" + } + } + RealtimeBetaServerEventResponseContentPartDone: + type: object + description: | + Returned when a content part is done streaming in an assistant message item. + Also emitted when a Response is interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_3940", + "type": "response.content_part.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "Sure, I can help with that." + } + } + RealtimeBetaServerEventResponseCreated: + type: object + description: | + Returned when a new Response is created. The first event of response creation, + where the response is in an initial state of `in_progress`. + 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: | + { + "type": "response.created", + "event_id": "event_C9G8pqbTEddBSIxbBN6Os", + "response": { + "object": "realtime.response", + "id": "resp_C9G8p7IH2WxLbkgPNouYL", + "status": "in_progress", + "status_details": null, + "output": [], + "conversation_id": "conv_C9G8mmBkLhQJwCon3hoJN", + "output_modalities": [ + "audio" + ], + "max_output_tokens": "inf", + "audio": { + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin" + } + }, + "usage": null, + "metadata": null + }, + "timestamp": "2:30:35 PM" + } + RealtimeBetaServerEventResponseDone: + type: object + description: | + Returned when a Response is done streaming. Always emitted, no matter the + final state. The Response object included in the `response.done` event will + include all output Items in the Response but will omit the raw audio data. + 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: | + { + "event_id": "event_3132", + "type": "response.done", + "response": { + "id": "resp_001", + "object": "realtime.response", + "status": "completed", + "status_details": null, + "output": [ + { + "id": "msg_006", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, how can I assist you today?" + } + ] + } + ], + "usage": { + "total_tokens":275, + "input_tokens":127, + "output_tokens":148, + "input_token_details": { + "cached_tokens":384, + "text_tokens":119, + "audio_tokens":8, + "cached_tokens_details": { + "text_tokens": 128, + "audio_tokens": 256 + } + }, + "output_token_details": { + "text_tokens":36, + "audio_tokens":112 + } + } + } + } + RealtimeBetaServerEventResponseFunctionCallArgumentsDelta: + type: object + description: | + Returned when the model-generated function call arguments are updated. + 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`. + 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: | + { + "event_id": "event_5354", + "type": "response.function_call_arguments.delta", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "delta": "{\"location\": \"San\"" + } + RealtimeBetaServerEventResponseFunctionCallArgumentsDone: + type: object + description: | + Returned when the model-generated function call arguments are done streaming. + Also emitted when a Response is interrupted, incomplete, or cancelled. + 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`. + 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: | + { + "event_id": "event_5556", + "type": "response.function_call_arguments.done", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "name": "get_weather", + "arguments": "{\"location\": \"San Francisco\"}" + } + 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: | + { + "event_id": "event_6201", + "type": "response.mcp_call_arguments.delta", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "delta": "{\"partial\":true}" + } + 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: | + { + "event_id": "event_6202", + "type": "response.mcp_call_arguments.done", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "arguments": "{\"q\":\"docs\"}" + } + 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: | + { + "event_id": "event_6302", + "type": "response.mcp_call.completed", + "output_index": 0, + "item_id": "mcp_call_001" + } + 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: | + { + "event_id": "event_6303", + "type": "response.mcp_call.failed", + "output_index": 0, + "item_id": "mcp_call_001" + } + 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: | + { + "event_id": "event_6301", + "type": "response.mcp_call.in_progress", + "output_index": 0, + "item_id": "mcp_call_001" + } + 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: | + { + "event_id": "event_3334", + "type": "response.output_item.added", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "in_progress", + "role": "assistant", + "content": [] + } + } + RealtimeBetaServerEventResponseOutputItemDone: + type: object + description: | + Returned when an Item is done streaming. Also emitted when a Response is + interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_3536", + "type": "response.output_item.done", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, I can help with that." + } + ] + } + } + 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: | + { + "event_id": "event_4142", + "type": "response.output_text.delta", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "delta": "Sure, I can h" + } + RealtimeBetaServerEventResponseTextDone: + type: object + description: | + Returned when the text value of an "output_text" content part is done streaming. Also + emitted when a Response is interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_4344", + "type": "response.output_text.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "text": "Sure, I can help with that." + } + RealtimeBetaServerEventSessionCreated: + type: object + description: | + Returned when a Session is created. Emitted automatically when a new + connection is established as the first server event. This event will contain + the default Session configuration. + 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: | + { + "type": "session.created", + "event_id": "event_C9G5RJeJ2gF77mV7f2B1j", + "session": { + "object": "realtime.session", + "id": "sess_C9G5QPteg4UIbotdKLoYQ", + "model": "gpt-realtime-2025-08-28", + "modalities": [ + "audio" + ], + "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.", + "tools": [], + "tool_choice": "auto", + "max_response_output_tokens": "inf", + "tracing": null, + "prompt": null, + "expires_at": 1756324625, + "input_audio_format": "pcm16", + "input_audio_transcription": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + }, + "output_audio_format": "pcm16", + "voice": "marin", + "include": null + } + } + RealtimeBetaServerEventSessionUpdated: + type: object + description: | + Returned when a session is updated with a `session.update` event, unless + there is an error. + 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: | + { + "event_id": "event_5678", + "type": "session.updated", + "session": { + "id": "sess_001", + "object": "realtime.session", + "model": "gpt-realtime", + "modalities": ["text"], + "instructions": "New instructions", + "voice": "sage", + "input_audio_format": "pcm16", + "output_audio_format": "pcm16", + "input_audio_transcription": { + "model": "whisper-1" + }, + "turn_detection": null, + "tools": [], + "tool_choice": "none", + "temperature": 0.7, + "max_response_output_tokens": 200, + "speed": 1.1, + "tracing": "auto" + } + } + RealtimeBetaServerEventTranscriptionSessionCreated: + type: object + description: | + Returned when a transcription session is created. + 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: | + { + "event_id": "event_5566", + "type": "transcription_session.created", + "session": { + "id": "sess_001", + "object": "realtime.transcription_session", + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500 + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [] + } + } + RealtimeBetaServerEventTranscriptionSessionUpdated: + type: object + description: | + Returned when a transcription session is updated with a `transcription_session.update` event, unless + there is an error. + 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: | + { + "event_id": "event_5678", + "type": "transcription_session.updated", + "session": { + "id": "sess_001", + "object": "realtime.transcription_session", + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + // "interrupt_response": false -- this will NOT be returned + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.avg_logprob", + ], + } + } + RealtimeCallCreateRequest: + title: Realtime call creation request + type: object + description: |- + Parameters required to initiate a realtime call and receive the SDP answer + needed to complete a WebRTC peer connection. Provide an SDP offer generated + by 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 + created. Use the same parameters you would send in a [`create client secret`](/docs/api-reference/realtime-sessions/create-realtime-client-secret) + request. + additionalProperties: false + RealtimeCallReferRequest: + title: Realtime call refer request + type: object + description: |- + Parameters required to transfer a SIP call to a new destination using the + Realtime API. + required: + - target_uri + properties: + target_uri: + type: string + description: |- + URI that should appear in the SIP Refer-To header. Supports values like + `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) + when omitted. + example: 486 + additionalProperties: false + RealtimeClientEvent: + discriminator: + propertyName: type + description: | + A realtime client event. + 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 + calls, and function call responses. This event can be used both to populate a + "history" of the conversation and to add new items mid-stream, but has the + current limitation that it cannot populate assistant audio messages. + + If successful, the server will respond with a `conversation.item.created` + event, otherwise an `error` event will be sent. + 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. + + If set to `root`, the new item will be added to the beginning of the conversation. + + If 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. + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - type + - item + x-oaiMeta: + name: conversation.item.create + group: realtime + example: | + { + "type": "conversation.item.create", + "item": { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } + ] + } + } + RealtimeClientEventConversationItemDelete: + type: object + description: | + Send this event when you want to remove any item from the conversation + history. The server will respond with a `conversation.item.deleted` event, + unless the item does not exist in the conversation history, in which case the + server will respond with an error. + 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: | + { + "event_id": "event_901", + "type": "conversation.item.delete", + "item_id": "item_003" + } + 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. + The server will respond with a `conversation.item.retrieved` event, + unless the item does not exist in the conversation history, in which case the + server will respond with an error. + 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: | + { + "event_id": "event_901", + "type": "conversation.item.retrieve", + "item_id": "item_003" + } + RealtimeClientEventConversationItemTruncate: + type: object + description: | + Send this event to truncate a previous assistant message’s audio. The server + will produce audio faster than realtime, so this event is useful when the user + interrupts to truncate audio that has already been sent to the client but not + yet played. This will synchronize the server's understanding of the audio with + the client's playback. + + Truncating audio will delete the server-side text transcript to ensure there + is not text in the context that hasn't been heard by the user. + + If successful, the server will respond with a `conversation.item.truncated` + event. + 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 + items can be truncated. + 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 + the audio_end_ms is greater than the actual audio duration, the server + will respond with an error. + required: + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncate + group: realtime + example: | + { + "event_id": "event_678", + "type": "conversation.item.truncate", + "item_id": "item_002", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeClientEventInputAudioBufferAppend: + type: object + description: | + Send this event to append audio bytes to the input audio buffer. The audio + buffer is temporary storage you can write to and later commit. A "commit" will create a new + user message item in the conversation history from the buffer content and clear the buffer. + Input audio transcription (if enabled) will be generated when the buffer is committed. + + If VAD is enabled the audio buffer is used to detect speech and the server will decide + when to commit. When Server VAD is disabled, you must commit the audio buffer + manually. Input audio noise reduction operates on writes to the audio buffer. + + The client may choose how much audio to place in each event up to a maximum + of 15 MiB, for example streaming smaller chunks from the client may allow the + VAD to be more responsive. Unlike most other client events, the server will + not send a confirmation response to this event. + 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 + `input_audio_format` field in the session configuration. + required: + - type + - audio + x-oaiMeta: + name: input_audio_buffer.append + group: realtime + example: | + { + "event_id": "event_456", + "type": "input_audio_buffer.append", + "audio": "Base64EncodedAudioData" + } + RealtimeClientEventInputAudioBufferClear: + type: object + description: | + Send this event to clear the audio bytes in the buffer. The server will + respond with an `input_audio_buffer.cleared` event. + 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: | + { + "event_id": "event_012", + "type": "input_audio_buffer.clear" + } + 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. + + Committing 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. + 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: | + { + "event_id": "event_789", + "type": "input_audio_buffer.commit" + } + RealtimeClientEventOutputAudioBufferClear: + type: object + description: | + **WebRTC/SIP Only:** Emit to cut off the current audio response. This will trigger the server to + stop generating audio and emit a `output_audio_buffer.cleared` event. This + event should be preceded by a `response.cancel` client event to stop the + generation of the current response. + [Learn more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + 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: | + { + "event_id": "optional_client_event_id", + "type": "output_audio_buffer.clear" + } + RealtimeClientEventResponseCancel: + type: object + description: | + Send this event to cancel an in-progress response. The server will respond + with a `response.done` event with a status of `response.status=cancelled`. If + there is no response to cancel, the server will respond with an error. It's safe + to call `response.cancel` even if no response is in progress, an error will be + returned the session will remain unaffected. + 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 + in-progress response in the default conversation. + required: + - type + x-oaiMeta: + name: response.cancel + group: realtime + example: | + { + "type": "response.cancel", + "response_id": "resp_12345" + } + RealtimeClientEventResponseCreate: + type: object + description: | + This event instructs the server to create a Response, which means triggering + model inference. When in Server VAD mode, the server will create Responses + automatically. + + A Response will include at least one Item, and may have two, in which case + the second will be a function call. These Items will be appended to the + conversation history by default. + + The server will respond with a `response.created` event, events for Items + and content created, and finally a `response.done` event to indicate the + Response is complete. + + The `response.create` event includes inference configuration like + `instructions` and `tools`. If these are set, they will override the Session's + configuration for this Response only. + + Responses can be created out-of-band of the default Conversation, meaning that they can + have arbitrary input, and it's possible to disable writing the output to the Conversation. + Only one Response can write to the default Conversation at a time, but otherwise multiple + Responses can be created in parallel. The `metadata` field is a good way to disambiguate + multiple simultaneous Responses. + + Clients can set `conversation` to `none` to create a Response that does not write to the default + Conversation. Arbitrary input can be provided with the `input` field, which is an array accepting + raw Items and references to existing Items. + 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 + { + "type": "response.create", + } + + // Trigger an out-of-band response that does not write to the default Conversation + { + "type": "response.create", + "response": { + "instructions": "Provide a concise answer.", + "tools": [], // clear any session tools + "conversation": "none", + "output_modalities": ["text"], + "metadata": { + "response_purpose": "summarization" + }, + "input": [ + { + "type": "item_reference", + "id": "item_12345" + }, + { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Summarize the above message in one sentence." + } + ] + } + ] + } + } + RealtimeClientEventSessionUpdate: + type: object + description: | + Send this event to update the session’s configuration. + The client may send this event at any time to update any field + except for `voice` and `model`. `voice` can be updated only if there have been no other audio outputs yet. + + When the server receives a `session.update`, it will respond + with a `session.updated` event showing the full, effective configuration. + Only the fields that are present in the `session.update` are updated. To clear a field like + `instructions`, pass an empty string. To clear a field like `tools`, pass an empty array. + To clear a field like `turn_detection`, pass `null`. + 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 + session or a transcription session. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' + - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' + required: + - type + - session + x-oaiMeta: + name: session.update + group: realtime + example: | + { + "type": "session.update", + "session": { + "type": "realtime", + "instructions": "You are a creative assistant that helps with design tasks.", + "tools": [ + { + "type": "function", + "name": "display_color_palette", + "description": "Call this function when a user asks for a color palette.", + "parameters": { + "type": "object", + "properties": { + "theme": { + "type": "string", + "description": "Description of the theme for the color scheme." + }, + "colors": { + "type": "array", + "description": "Array of five hex color codes based on the theme.", + "items": { + "type": "string", + "description": "Hex color code" + } + } + }, + "required": [ + "theme", + "colors" + ] + } + } + ], + "tool_choice": "auto" + } + } + RealtimeClientEventTranscriptionSessionUpdate: + type: object + description: | + Send this event to update a transcription session. + 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: | + { + "type": "transcription_session.update", + "session": { + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.logprobs", + ] + } + } + 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`) + this field allows the client to assign the unique ID of the item. It is + not required because the server will generate one if not provided. + + For an item of type `item_reference`, this field is required and is a + reference to any item that has previously existed in the conversation. + type: + type: string + enum: + - message + - function_call + - function_call_output + description: | + The type of the item (`message`, `function_call`, `function_call_output`, `item_reference`). + object: + type: string + enum: + - realtime.item + description: | + Identifier for the API object being returned - always `realtime.item`. + 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 + on the conversation, but are accepted for consistency with the + `conversation.item.created` event. + role: + type: string + enum: + - user + - assistant + - system + description: | + The role of the message sender (`user`, `assistant`, `system`), only + applicable for `message` items. + content: + type: array + description: | + The content of the message, applicable for `message` items. + - Message items of role `system` support only `input_text` content + - Message items of role `user` support `input_text` and `input_audio` + content + - Message items of role `assistant` support `text` content. + 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`). + text: + type: string + description: | + The text content, used for `input_text` and `text` content types. + id: + type: string + description: | + ID of a previous conversation item to reference (for `item_reference` + content types in `response.create` events). These can reference both + client and server created items. + audio: + type: string + description: | + Base64-encoded audio bytes, used for `input_audio` content type. + transcript: + type: string + description: | + The transcript of the audio, used for `input_audio` content type. + call_id: + type: string + description: | + The ID of the function call (for `function_call` and + `function_call_output` items). If passed on a `function_call_output` + item, the server will check that a `function_call` item with the same + ID exists in the conversation history. + name: + type: string + description: | + The name of the function being called (for `function_call` items). + arguments: + type: string + description: | + The arguments of the function call (for `function_call` items). + output: + type: string + description: | + The output of the function call (for `function_call_output` items). + RealtimeCreateClientSecretRequest: + type: object + title: Realtime client secret creation request + description: | + Create a session and client secret for the Realtime API. The request can specify + either a realtime or a transcription session configuration. + [Learn more about the Realtime API](/docs/guides/realtime). + properties: + expires_after: + type: object + title: Client secret expiration + description: | + Configuration for the client secret expiration. Expiration refers to the time after which + a client secret will no longer be valid for creating sessions. The session itself may + continue after that time once started. A secret can be used to create multiple sessions + until it expires. + 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. + 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. + minimum: 10 + maximum: 7200 + default: 600 + session: + title: Session configuration + description: | + Session configuration to use for the client secret. Choose either a realtime + session or a transcription session. + 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. + 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. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' + - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponseGA' + discriminator: + propertyName: type + required: + - value + - expires_at + - session + x-oaiMeta: + name: Session response object + group: realtime + example: | + { + "value": "ek_68af296e8e408191a1120ab6383263c2", + "expires_at": 1756310470, + "session": { + "type": "realtime", + "object": "realtime.session", + "id": "sess_C9CiUVUzUzYIssh3ELY1d", + "model": "gpt-realtime-2025-08-25", + "output_modalities": [ + "audio" + ], + "instructions": "You are a friendly assistant.", + "tools": [], + "tool_choice": "auto", + "max_output_tokens": "inf", + "tracing": null, + "truncation": "auto", + "prompt": null, + "expires_at": 0, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy", + "speed": 1.0 + } + }, + "include": null + } + } + 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 + to call it, and guidance about what to tell the user when calling + (if anything). + 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. + 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. + 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. + 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. + 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 + RealtimeReasoning: + type: object + title: Realtime reasoning configuration + description: | + Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + properties: + effort: + $ref: '#/components/schemas/RealtimeReasoningEffort' + RealtimeReasoningEffort: + type: string + description: | + Constrains effort on reasoning for reasoning-capable Realtime models such as + `gpt-realtime-2`. + 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 + `incomplete`, `in_progress`). + 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 + with the `status` field (`completed`, `cancelled`, `incomplete`, + `failed`). + 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). + error: + type: object + description: | + A description of the error that caused the response to fail, + populated when the `status` is `failed`. + 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 + session once the model has responded with audio at least once. Current + voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + `shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for + best quality. + usage: + type: object + description: | + Usage statistics for the Response, this will correspond to billing. A + Realtime API session will maintain a conversation context and append new + Items to the Conversation, thus output from previous turns (text and + audio tokens) will become the input for later turns. + properties: + total_tokens: + type: integer + description: | + The total number of tokens in the Response including input and output + text and audio tokens. + input_tokens: + type: integer + description: | + The number of input tokens used in the Response, including text and + audio tokens. + output_tokens: + type: integer + description: | + The number of output tokens sent in the Response, including text and + audio tokens. + 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` + field in the `response.create` event. If `auto`, the response will be added to + the default conversation and the value of `conversation_id` will be an id like + `conv_1234`. If `none`, the response will not be added to any conversation and + the value of `conversation_id` will be `null`. If responses are being triggered + automatically by VAD the response will be added to the default conversation + type: string + output_modalities: + type: array + description: | + The set of modalities the model used to respond, currently the only possible values are + `[\"audio\"]`, `[\"text\"]`. Audio output always include a text transcript. Setting the + output to mode `text` will disable audio output from the model. + 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, + inclusive of tool calls, that was used in this response. + 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 + `[\"audio\"]`, `[\"text\"]`. Audio output always include a text transcript. Setting the + output to mode `text` will disable audio output from the model. + 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. + Note 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. + 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 + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, + `marin`, and `cedar`. You may also provide a custom voice object with + an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed + during the session once the model has responded with audio at least once. + We recommend `marin` and `cedar` for best quality. + 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 + function/MCP tool. + 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 + reasoning Realtime models such as `gpt-realtime-2`. + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + conversation: + description: | + Controls which conversation the response is added to. Currently supports + `auto` and `none`, with `auto` as the default value. The `auto` value + means that the contents of the response will be added to the default + conversation. Set this to `none` to create an out-of-band response which + will not add items to default conversation. + 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 + creates a new context for this Response instead of using the default + conversation. An empty array `[]` will clear the context for this Response. + Note that this can include references to items that previously appeared in the session + using their id. + items: + $ref: '#/components/schemas/RealtimeConversationItem' + RealtimeServerEvent: + discriminator: + propertyName: type + description: | + A realtime server event. + 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' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionSegment' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsInProgress' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsCompleted' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsFailed' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallInProgress' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallCompleted' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallFailed' + RealtimeServerEventConversationCreated: + type: object + description: | + Returned when a conversation is created. Emitted right after session creation. + 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. + object: + type: string + description: The object type, must be `realtime.conversation`. + required: + - event_id + - type + - conversation + x-oaiMeta: + name: conversation.created + group: realtime + example: | + { + "event_id": "event_9101", + "type": "conversation.created", + "conversation": { + "id": "conv_001", + "object": "realtime.conversation" + } + } + RealtimeServerEventConversationItemAdded: + type: object + description: | + Sent by the server when an Item is added to the default Conversation. This can happen in several cases: + - When the client sends a `conversation.item.create` event. + - When the input audio buffer is committed. In this case the item will be a user message containing the audio from the buffer. + - 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`). + + The 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. + 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: + - type: string + description: | + The ID of the item that precedes this one, if any. This is used to + maintain ordering when items are inserted. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.added + group: realtime + example: | + { + "type": "conversation.item.added", + "event_id": "event_C9G8pjSJCfRNEhMEnYAVy", + "previous_item_id": null, + "item": { + "id": "item_C9G8pGVKYnaZu8PH5YQ9O", + "type": "message", + "status": "completed", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } + ] + } + } + RealtimeServerEventConversationItemCreated: + type: object + description: | + Returned when a conversation item is created. There are several scenarios that produce this event: + - The server is generating a Response, which if successful will produce + either one or two Items, which will be of type `message` + (role `assistant`) or type `function_call`. + - The input audio buffer has been committed, either by the client or the + server (in `server_vad` mode). The server will take the content of the + input audio buffer and add it to a new user message Item. + - The client has sent a `conversation.item.create` event to add a new Item + to the Conversation. + 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 + client to understand the order of the conversation. Can be `null` if the + item has no predecessor. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.created + group: realtime + example: | + { + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [] + } + } + RealtimeServerEventConversationItemDeleted: + type: object + description: | + Returned when an item in the conversation is deleted by the client with a + `conversation.item.delete` event. This event is used to synchronize the + server's understanding of the conversation history with the client's view. + 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: | + { + "event_id": "event_2728", + "type": "conversation.item.deleted", + "item_id": "msg_005" + } + RealtimeServerEventConversationItemDone: + type: object + description: | + Returned when a conversation item is finalized. + + The 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. + 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: + - type: string + description: | + The ID of the item that precedes this one, if any. This is used to + maintain ordering when items are inserted. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.done + group: realtime + example: | + { + "type": "conversation.item.done", + "event_id": "event_CCXLgMZPo3qioWCeQa4WH", + "previous_item_id": "item_CCXLecNJVIVR2HUy3ABLj", + "item": { + "id": "item_CCXLfxmM5sXVJVz4mCa2S", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_audio", + "transcript": "Oh, I can hear you loud and clear! Sounds like we're connected just fine. What can I help you with today?" + } + ] + } + } + RealtimeServerEventConversationItemInputAudioTranscriptionCompleted: + type: object + description: | + This event is the output of audio transcription for user audio written to the + user audio buffer. Transcription begins when the input audio buffer is + committed by the client or server (when VAD is enabled). Transcription runs + asynchronously with Response creation, so this event may come before or after + the Response events. + + Realtime API models accept audio natively, and thus input transcription is a + separate process run on a separate ASR (Automatic Speech Recognition) model. + The transcript may diverge somewhat from the model's interpretation, and + should be treated as a rough guide. + 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 + `conversation.item.input_audio_transcription.completed`. + 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. + 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, this is billed according to the ASR model's pricing rather than the realtime model's pricing. + 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: | + { + "type": "conversation.item.input_audio_transcription.completed", + "event_id": "event_CCXGRvtUVrax5SJAnNOWZ", + "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", + "content_index": 0, + "transcript": "Hey, can you hear me?", + "usage": { + "type": "tokens", + "total_tokens": 22, + "input_tokens": 13, + "input_token_details": { + "text_tokens": 0, + "audio_tokens": 13 + }, + "output_tokens": 9 + } + } + RealtimeServerEventConversationItemInputAudioTranscriptionDelta: + type: object + description: | + Returned when the text value of an input audio transcription content part is updated with incremental transcription results. + 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: + - 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' + - type: 'null' + required: + - event_id + - type + - item_id + x-oaiMeta: + name: conversation.item.input_audio_transcription.delta + group: realtime + example: | + { + "type": "conversation.item.input_audio_transcription.delta", + "event_id": "event_CCXGRxsAimPAs8kS2Wc7Z", + "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", + "content_index": 0, + "delta": "Hey", + "obfuscation": "aLxx0jTEciOGe" + } + RealtimeServerEventConversationItemInputAudioTranscriptionFailed: + type: object + description: | + Returned when input audio transcription is configured, and a transcription + request for a user message failed. These events are separate from other + `error` events so that the client can identify the related Item. + 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 + `conversation.item.input_audio_transcription.failed`. + 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: | + { + "event_id": "event_2324", + "type": "conversation.item.input_audio_transcription.failed", + "item_id": "msg_003", + "content_index": 0, + "error": { + "type": "transcription_error", + "code": "audio_unintelligible", + "message": "The audio could not be transcribed.", + "param": null + } + } + 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: | + { + "event_id": "event_6501", + "type": "conversation.item.input_audio_transcription.segment", + "item_id": "msg_011", + "content_index": 0, + "text": "hello", + "id": "seg_0001", + "speaker": "spk_1", + "start": 0.0, + "end": 0.4 + } + 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. + 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: | + { + "type": "conversation.item.retrieved", + "event_id": "event_CCXGSizgEppa2d4XbKA7K", + "item": { + "id": "item_CCXGRxbY0n6WE4EszhF5w", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "audio", + "transcript": "Yes, I can hear you loud and clear. How can I help you today?", + "audio": "8//2//v/9//q/+//+P/s...", + "format": "pcm16" + } + ] + } + } + RealtimeServerEventConversationItemTruncated: + type: object + description: | + Returned when an earlier assistant audio message item is truncated by the + client with a `conversation.item.truncate` event. This event is used to + synchronize the server's understanding of the audio with the client's playback. + + This action will truncate the audio and remove the server-side text transcript + to ensure there is no text in the context that hasn't been heard by the user. + 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. + required: + - event_id + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncated + group: realtime + example: | + { + "event_id": "event_2526", + "type": "conversation.item.truncated", + "item_id": "msg_004", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeServerEventError: + type: object + description: | + Returned when an error occurs, which could be a client problem or a server + problem. Most errors are recoverable and the session will stay open, we + recommend to implementors to monitor and log error messages by default. + 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"). + 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. + - type: 'null' + required: + - event_id + - type + - error + x-oaiMeta: + name: error + group: realtime + example: | + { + "event_id": "event_890", + "type": "error", + "error": { + "type": "invalid_request_error", + "code": "invalid_event", + "message": "The 'type' field is missing.", + "param": null, + "event_id": "event_567" + } + } + RealtimeServerEventInputAudioBufferCleared: + type: object + description: | + Returned when the input audio buffer is cleared by the client with a + `input_audio_buffer.clear` event. + 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: | + { + "event_id": "event_1314", + "type": "input_audio_buffer.cleared" + } + RealtimeServerEventInputAudioBufferCommitted: + type: object + description: | + Returned when an input audio buffer is committed, either by the client or + automatically in server VAD mode. The `item_id` property is the ID of the user + message item that will be created, thus a `conversation.item.created` event + will also be sent to the client. + 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. + Can be `null` if the item has no predecessor. + - 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: | + { + "event_id": "event_1121", + "type": "input_audio_buffer.committed", + "previous_item_id": "msg_001", + "item_id": "msg_002" + } + RealtimeServerEventInputAudioBufferDtmfEventReceived: + type: object + description: | + **SIP Only:** Returned when an DTMF event is received. A DTMF event is a message that + represents a telephone keypad press (0–9, *, #, A–D). The `event` property + is the keypad that the user press. The `received_at` is the UTC Unix Timestamp + that the server received the event. + 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 + 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. + required: + - type + - event + - received_at + x-oaiMeta: + name: input_audio_buffer.dtmf_event_received + group: realtime + example: | + { + "type":" input_audio_buffer.dtmf_event_received", + "event": "9", + "received_at": 1763605109, + } + RealtimeServerEventInputAudioBufferSpeechStarted: + type: object + description: | + Sent by the server when in `server_vad` mode to indicate that speech has been + detected in the audio buffer. This can happen any time audio is added to the + buffer (unless speech is already detected). The client may want to use this + event to interrupt audio playback or provide visual feedback to the user. + + The client should expect to receive a `input_audio_buffer.speech_stopped` event + when speech stops. The `item_id` property is the ID of the user message item + that will be created when speech stops and will also be included in the + `input_audio_buffer.speech_stopped` event (unless the client manually commits + the audio buffer during VAD activation). + 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 + session when speech was first detected. This will correspond to the + beginning of audio sent to the model, and thus includes the + `prefix_padding_ms` configured in the Session. + item_id: + type: string + description: | + The ID of the user message item that will be created when speech stops. + required: + - event_id + - type + - audio_start_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.speech_started + group: realtime + example: | + { + "event_id": "event_1516", + "type": "input_audio_buffer.speech_started", + "audio_start_ms": 1000, + "item_id": "msg_003" + } + RealtimeServerEventInputAudioBufferSpeechStopped: + type: object + description: | + Returned in `server_vad` mode when the server detects the end of speech in + the audio buffer. The server will also send an `conversation.item.created` + event with the user message item that is created from the audio buffer. + 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 + correspond to the end of audio sent to the model, and thus includes the + `min_silence_duration_ms` configured in the Session. + 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: | + { + "event_id": "event_1718", + "type": "input_audio_buffer.speech_stopped", + "audio_end_ms": 2000, + "item_id": "msg_003" + } + RealtimeServerEventInputAudioBufferTimeoutTriggered: + type: object + description: | + Returned when the Server VAD timeout is triggered for the input audio buffer. This is configured + with `idle_timeout_ms` in the `turn_detection` settings of the session, and it indicates that + there hasn't been any speech detected for the configured duration. + + The `audio_start_ms` and `audio_end_ms` fields indicate the segment of audio after the last + model response up to the triggering time, as an offset from the beginning of audio written + to the input audio buffer. This means it demarcates the segment of audio that was silent and + the difference between the start and end values will roughly match the configured timeout. + + The empty audio will be committed to the conversation as an `input_audio` item (there will be a + `input_audio_buffer.committed` event) and a model response will be generated. There may be speech + that didn't trigger VAD but is still detected by the model, so the model may respond with + something relevant to the conversation or a prompt to continue speaking. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - input_audio_buffer.timeout_triggered + description: The event type, must be `input_audio_buffer.timeout_triggered`. + x-stainless-const: true + 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: + - event_id + - type + - audio_start_ms + - audio_end_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.timeout_triggered + group: realtime + example: | + { + "type":"input_audio_buffer.timeout_triggered", + "event_id":"event_CEKKrf1KTGvemCPyiJTJ2", + "audio_start_ms":13216, + "audio_end_ms":19232, + "item_id":"item_CEKKrWH0GiwN0ET97NUZc" + } + 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. + 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: | + { + "event_id": "event_6102", + "type": "mcp_list_tools.completed", + "item_id": "mcp_list_tools_001" + } + 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. + 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: | + { + "event_id": "event_6103", + "type": "mcp_list_tools.failed", + "item_id": "mcp_list_tools_001" + } + 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. + 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: | + { + "event_id": "event_6101", + "type": "mcp_list_tools.in_progress", + "item_id": "mcp_list_tools_001" + } + RealtimeServerEventOutputAudioBufferCleared: + type: object + description: | + **WebRTC/SIP Only:** Emitted when the output audio buffer is cleared. This happens either in VAD + mode when the user has interrupted (`input_audio_buffer.speech_started`), + or when the client has emitted the `output_audio_buffer.clear` event to manually + cut off the current audio response. + [Learn more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - output_audio_buffer.cleared + description: The event type, must be `output_audio_buffer.cleared`. + x-stainless-const: true + 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: | + { + "event_id": "event_abc123", + "type": "output_audio_buffer.cleared", + "response_id": "resp_abc123" + } + RealtimeServerEventOutputAudioBufferStarted: + type: object + description: | + **WebRTC/SIP Only:** Emitted when the server begins streaming audio to the client. This event is + emitted after an audio content part has been added (`response.content_part.added`) + to the response. + [Learn more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - output_audio_buffer.started + description: The event type, must be `output_audio_buffer.started`. + x-stainless-const: true + 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: | + { + "event_id": "event_abc123", + "type": "output_audio_buffer.started", + "response_id": "resp_abc123" + } + RealtimeServerEventOutputAudioBufferStopped: + type: object + description: | + **WebRTC/SIP Only:** Emitted when the output audio buffer has been completely drained on the server, + and no more audio is forthcoming. This event is emitted after the full response + data has been sent to the client (`response.done`). + [Learn more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - output_audio_buffer.stopped + description: The event type, must be `output_audio_buffer.stopped`. + x-stainless-const: true + 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: | + { + "event_id": "event_abc123", + "type": "output_audio_buffer.stopped", + "response_id": "resp_abc123" + } + RealtimeServerEventRateLimitsUpdated: + type: object + description: | + Emitted at the beginning of a Response to indicate the updated rate limits. + When a Response is created some tokens will be "reserved" for the output + tokens, the rate limits shown here reflect that reservation, which is then + adjusted accordingly once the Response is completed. + 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`). + 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: | + { + "event_id": "event_5758", + "type": "rate_limits.updated", + "rate_limits": [ + { + "name": "requests", + "limit": 1000, + "remaining": 999, + "reset_seconds": 60 + }, + { + "name": "tokens", + "limit": 50000, + "remaining": 49950, + "reset_seconds": 60 + } + ] + } + RealtimeServerEventResponseAudioDelta: + 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: | + { + "event_id": "event_4950", + "type": "response.output_audio.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Base64EncodedAudioDelta" + } + RealtimeServerEventResponseAudioDone: + type: object + description: | + Returned when the model-generated audio is done. Also emitted when a Response + is interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_5152", + "type": "response.output_audio.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0 + } + RealtimeServerEventResponseAudioTranscriptDelta: + type: object + description: | + Returned when the model-generated transcription of audio output is updated. + 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: | + { + "event_id": "event_4546", + "type": "response.output_audio_transcript.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Hello, how can I a" + } + RealtimeServerEventResponseAudioTranscriptDone: + type: object + description: | + Returned when the model-generated transcription of audio output is done + streaming. Also emitted when a Response is interrupted, incomplete, or + cancelled. + 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: | + { + "event_id": "event_4748", + "type": "response.output_audio_transcript.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "transcript": "Hello, how can I assist you today?" + } + RealtimeServerEventResponseContentPartAdded: + type: object + description: | + Returned when a new content part is added to an assistant message item during + response generation. + 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: | + { + "event_id": "event_3738", + "type": "response.content_part.added", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "" + } + } + RealtimeServerEventResponseContentPartDone: + type: object + description: | + Returned when a content part is done streaming in an assistant message item. + Also emitted when a Response is interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_3940", + "type": "response.content_part.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "Sure, I can help with that." + } + } + RealtimeServerEventResponseCreated: + type: object + description: | + Returned when a new Response is created. The first event of response creation, + where the response is in an initial state of `in_progress`. + 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/RealtimeResponse' + required: + - event_id + - type + - response + x-oaiMeta: + name: response.created + group: realtime + example: | + { + "type": "response.created", + "event_id": "event_C9G8pqbTEddBSIxbBN6Os", + "response": { + "object": "realtime.response", + "id": "resp_C9G8p7IH2WxLbkgPNouYL", + "status": "in_progress", + "status_details": null, + "output": [], + "conversation_id": "conv_C9G8mmBkLhQJwCon3hoJN", + "output_modalities": [ + "audio" + ], + "max_output_tokens": "inf", + "audio": { + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin" + } + }, + "usage": null, + "metadata": null + }, + } + RealtimeServerEventResponseDone: + type: object + description: | + Returned when a Response is done streaming. Always emitted, no matter the + final state. The Response object included in the `response.done` event will + include all output Items in the Response but will omit the raw audio data. + + Clients should check the `status` field of the Response to determine if it was successful + (`completed`) or if there was another outcome: `cancelled`, `failed`, or `incomplete`. + + A response will contain all output items that were generated during the response, excluding + any audio content. + 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/RealtimeResponse' + required: + - event_id + - type + - response + x-oaiMeta: + name: response.done + group: realtime + example: | + { + "type": "response.done", + "event_id": "event_CCXHxcMy86rrKhBLDdqCh", + "response": { + "object": "realtime.response", + "id": "resp_CCXHw0UJld10EzIUXQCNh", + "status": "completed", + "status_details": null, + "output": [ + { + "id": "item_CCXHwGjjDUfOXbiySlK7i", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_audio", + "transcript": "Loud and clear! I can hear you perfectly. How can I help you today?" + } + ] + } + ], + "conversation_id": "conv_CCXHsurMKcaVxIZvaCI5m", + "output_modalities": [ + "audio" + ], + "max_output_tokens": "inf", + "audio": { + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy" + } + }, + "usage": { + "total_tokens": 253, + "input_tokens": 132, + "output_tokens": 121, + "input_token_details": { + "text_tokens": 119, + "audio_tokens": 13, + "image_tokens": 0, + "cached_tokens": 64, + "cached_tokens_details": { + "text_tokens": 64, + "audio_tokens": 0, + "image_tokens": 0 + } + }, + "output_token_details": { + "text_tokens": 30, + "audio_tokens": 91 + } + }, + "metadata": null + } + } + RealtimeServerEventResponseFunctionCallArgumentsDelta: + type: object + description: | + Returned when the model-generated function call arguments are updated. + 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`. + 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: | + { + "event_id": "event_5354", + "type": "response.function_call_arguments.delta", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "delta": "{\"location\": \"San\"" + } + RealtimeServerEventResponseFunctionCallArgumentsDone: + type: object + description: | + Returned when the model-generated function call arguments are done streaming. + Also emitted when a Response is interrupted, incomplete, or cancelled. + 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`. + 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: | + { + "event_id": "event_5556", + "type": "response.function_call_arguments.done", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "name": "get_weather", + "arguments": "{\"location\": \"San Francisco\"}" + } + RealtimeServerEventResponseMCPCallArgumentsDelta: + 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: | + { + "event_id": "event_6201", + "type": "response.mcp_call_arguments.delta", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "delta": "{\"partial\":true}" + } + RealtimeServerEventResponseMCPCallArgumentsDone: + 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: | + { + "event_id": "event_6202", + "type": "response.mcp_call_arguments.done", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "arguments": "{\"q\":\"docs\"}" + } + RealtimeServerEventResponseMCPCallCompleted: + 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: | + { + "event_id": "event_6302", + "type": "response.mcp_call.completed", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeServerEventResponseMCPCallFailed: + 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: | + { + "event_id": "event_6303", + "type": "response.mcp_call.failed", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeServerEventResponseMCPCallInProgress: + 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: | + { + "event_id": "event_6301", + "type": "response.mcp_call.in_progress", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeServerEventResponseOutputItemAdded: + 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: | + { + "event_id": "event_3334", + "type": "response.output_item.added", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "in_progress", + "role": "assistant", + "content": [] + } + } + RealtimeServerEventResponseOutputItemDone: + type: object + description: | + Returned when an Item is done streaming. Also emitted when a Response is + interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_3536", + "type": "response.output_item.done", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, I can help with that." + } + ] + } + } + RealtimeServerEventResponseTextDelta: + 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: | + { + "event_id": "event_4142", + "type": "response.output_text.delta", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "delta": "Sure, I can h" + } + RealtimeServerEventResponseTextDone: + type: object + description: | + Returned when the text value of an "output_text" content part is done streaming. Also + emitted when a Response is interrupted, incomplete, or cancelled. + 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: | + { + "event_id": "event_4344", + "type": "response.output_text.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "text": "Sure, I can help with that." + } + RealtimeServerEventSessionCreated: + type: object + description: | + Returned when a Session is created. Emitted automatically when a new + connection is established as the first server event. This event will contain + the default Session configuration. + 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: + description: The session configuration. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' + - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponseGA' + required: + - event_id + - type + - session + x-oaiMeta: + name: session.created + group: realtime + example: | + { + "type": "session.created", + "event_id": "event_C9G5RJeJ2gF77mV7f2B1j", + "session": { + "type": "realtime", + "object": "realtime.session", + "id": "sess_C9G5QPteg4UIbotdKLoYQ", + "model": "gpt-realtime-2025-08-28", + "output_modalities": [ + "audio" + ], + "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.", + "tools": [], + "tool_choice": "auto", + "max_output_tokens": "inf", + "tracing": null, + "prompt": null, + "expires_at": 1756324625, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin", + "speed": 1 + } + }, + "include": null + }, + } + RealtimeServerEventSessionUpdated: + type: object + description: | + Returned when a session is updated with a `session.update` event, unless + there is an error. + 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: + description: The session configuration. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' + - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponseGA' + required: + - event_id + - type + - session + x-oaiMeta: + name: session.updated + group: realtime + example: | + { + "type": "session.updated", + "event_id": "event_C9G8mqI3IucaojlVKE8Cs", + "session": { + "type": "realtime", + "object": "realtime.session", + "id": "sess_C9G8l3zp50uFv4qgxfJ8o", + "model": "gpt-realtime-2025-08-28", + "output_modalities": [ + "audio" + ], + "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.", + "tools": [ + { + "type": "function", + "name": "display_color_palette", + "description": "\nCall this function when a user asks for a color palette.\n", + "parameters": { + "type": "object", + "strict": true, + "properties": { + "theme": { + "type": "string", + "description": "Description of the theme for the color scheme." + }, + "colors": { + "type": "array", + "description": "Array of five hex color codes based on the theme.", + "items": { + "type": "string", + "description": "Hex color code" + } + } + }, + "required": [ + "theme", + "colors" + ] + } + } + ], + "tool_choice": "auto", + "max_output_tokens": "inf", + "tracing": null, + "prompt": null, + "expires_at": 1756324832, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin", + "speed": 1 + } + }, + "include": null + }, + } + RealtimeServerEventTranscriptionSessionUpdated: + type: object + description: | + Returned when a transcription session is updated with a `transcription_session.update` event, unless + there is an error. + 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: | + { + "event_id": "event_5678", + "type": "transcription_session.updated", + "session": { + "id": "sess_001", + "object": "realtime.transcription_session", + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + // "interrupt_response": false -- this will NOT be returned + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.avg_logprob", + ], + } + } + 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`. + 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, + set this to ["text"]. + items: + type: string + default: + - text + - audio + enum: + - text + - audio + model: + description: | + The Realtime model used for this session. + 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 + 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. + + + Note 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. + voice: + $ref: '#/components/schemas/VoiceIdsShared' + description: | + The voice the model uses to respond. Voice cannot be changed during the + session once the model has responded with audio at least once. Current + voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + `shimmer`, and `verse`. + 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`. + For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, + single channel (mono), and little-endian byte order. + output_audio_format: + type: string + default: pcm16 + enum: + - pcm16 + - g711_ulaw + - g711_alaw + description: | + The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + For `pcm16`, output audio is sampled at a rate of 24kHz. + 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://platform.openai.com/docs/api-reference/audio/createTranscription) 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. + - type: 'null' + turn_detection: + $ref: '#/components/schemas/RealtimeTurnDetection' + input_audio_noise_reduction: + type: object + default: null + description: | + Configuration for input audio noise reduction. This can be set to `null` to turn off. + Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. + Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. + 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 + 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. + tracing: + anyOf: + - title: Tracing Configuration + description: | + Configuration options for tracing. Set to null to disable tracing. Once + tracing is enabled for a session, the configuration cannot be modified. + + `auto` will create a trace for the session with default values for the + workflow name, group id, and metadata. + oneOf: + - type: string + default: auto + description: | + Default tracing mode for the session. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: | + The name of the workflow to attach to this trace. This is used to + name the trace in the traces dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the traces dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the traces dashboard. + - 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 + specify a function. + 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. + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + 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 + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: | + Additional fields to include in server outputs. + - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. + - type: 'null' + RealtimeSessionCreateRequest: + type: object + description: | + A new Realtime session configuration, with an ephemeral key. Default TTL + for keys is one minute. + 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 + to the Realtime API. Use this in client-side environments rather than + a standard API token, which should only be used server-side. + expires_at: + type: integer + format: unixtime + description: | + Timestamp for when the token expires. Currently, all tokens expire + after one minute. + required: + - value + - expires_at + modalities: + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + 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. + Note 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. + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + description: | + The voice the model uses to respond. Supported built-in voices are + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, + `marin`, and `cedar`. You may also provide a custom voice object with an + `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed during + the session once the model has responded with audio at least once. + input_audio_format: + type: string + description: | + The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + output_audio_format: + type: string + description: | + The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + input_audio_transcription: + type: object + 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 and should be treated as rough guidance + rather than the representation understood by the model. + properties: + model: + type: string + description: | + The model to use for transcription. + 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 + 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. + tracing: + title: Tracing Configuration + description: | + Configuration options for tracing. Set to null to disable tracing. Once + tracing is enabled for a session, the configuration cannot be modified. + + `auto` will create a trace for the session with default values for the + workflow name, group id, and metadata. + oneOf: + - type: string + default: auto + description: | + Default tracing mode for the session. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: | + The name of the workflow to attach to this trace. This is used to + name the trace in the traces dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the traces dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the traces dashboard. + 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. + properties: + type: + type: string + description: | + Type of turn detection, only `server_vad` is currently supported. + threshold: + type: number + description: | + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: | + Duration of silence to detect speech stop (in milliseconds). Defaults + to 500ms. With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + 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 + to call it, and guidance about what to tell the user when calling + (if anything). + 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 + specify a function. + temperature: + type: number + description: | + Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + truncation: + $ref: '#/components/schemas/RealtimeTruncation' + prompt: + $ref: '#/components/schemas/Prompt' + required: + - client_secret + x-oaiMeta: + name: The session object + group: realtime + example: | + { + "id": "sess_001", + "object": "realtime.session", + "model": "gpt-realtime-2025-08-25", + "modalities": ["audio", "text"], + "instructions": "You are a friendly assistant.", + "voice": "alloy", + "input_audio_format": "pcm16", + "output_audio_format": "pcm16", + "input_audio_transcription": { + "model": "whisper-1" + }, + "turn_detection": null, + "tools": [], + "tool_choice": "none", + "temperature": 0.7, + "speed": 1.1, + "tracing": "auto", + "max_response_output_tokens": 200, + "truncation": "auto", + "prompt": null, + "client_secret": { + "value": "ek_abc123", + "expires_at": 1234567890 + } + } + RealtimeSessionCreateRequestGA: + type: object + title: Realtime session configuration + description: Realtime session object configuration. + properties: + type: + type: string + description: | + The type of session to create. Always `realtime` for the Realtime API. + enum: + - realtime + x-stainless-const: true + output_modalities: + type: array + description: | + The set of modalities the model can respond with. It defaults to `["audio"]`, indicating + that the model will respond with audio plus a transcript. `["text"]` can be used to make + the model respond with text only. It is not possible to request both `text` and `audio` at the same time. + default: + - audio + items: + type: string + enum: + - text + - audio + model: + anyOf: + - type: string + - type: string + enum: + - gpt-realtime + - gpt-realtime-1.5 + - gpt-realtime-2 + - 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 + description: | + The Realtime model used for this session. + 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. + + Note 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. + audio: + type: object + description: | + Configuration for input and output audio. + 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](/docs/api-reference/audio/createTranscription) 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. + $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. + Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. + Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. + 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 + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, + `marin`, and `cedar`. You may also provide a custom voice object with + an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed + during the session once the model has responded with audio at least once. + We recommend `marin` and `cedar` for best quality. + 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. + 1.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. + + This parameter is a post-processing adjustment to the audio after it is generated, it's + also possible to prompt the model to speak faster or slower. + include: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: | + Additional fields to include in server outputs. + + `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. + 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 + tracing is enabled for a session, the configuration cannot be modified. + + `auto` will create a trace for the session with default values for the + workflow name, group id, and metadata. + nullable: true + oneOf: + - type: string + title: auto + default: auto + description: | + Enables tracing and sets default values for tracing configuration options. Always `auto`. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: | + The name of the workflow to attach to this trace. This is used to + name the trace in the Traces Dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the Traces Dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the Traces Dashboard. + 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 + function/MCP tool. + 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 + reasoning Realtime models such as `gpt-realtime-2`. + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + truncation: + $ref: '#/components/schemas/RealtimeTruncation' + prompt: + $ref: '#/components/schemas/Prompt' + required: + - type + RealtimeSessionCreateResponse: + type: object + title: Realtime session configuration object + description: | + A Realtime session configuration object. + properties: + id: + type: string + description: | + Unique identifier for the session that looks like `sess_1234567890abcdef`. + 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. + - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. + 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, + set this to ["text"]. + 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. + + Note 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. + audio: + type: object + description: | + Configuration for input and output audio for the session. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + transcription: + description: | + Configuration for input audio transcription. + $ref: '#/components/schemas/AudioTranscriptionResponse' + noise_reduction: + type: object + description: | + Configuration for input audio noise reduction. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + turn_detection: + type: object + description: | + Configuration for turn detection. + properties: + type: + type: string + description: | + Type of turn detection, only `server_vad` is currently supported. + 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 + tracing: + title: Tracing Configuration + description: | + Configuration options for tracing. Set to null to disable tracing. Once + tracing is enabled for a session, the configuration cannot be modified. + + `auto` will create a trace for the session with default values for the + workflow name, group id, and metadata. + oneOf: + - type: string + default: auto + description: | + Default tracing mode for the session. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: | + The name of the workflow to attach to this trace. This is used to + name the trace in the traces dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the traces dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the traces dashboard. + 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. + properties: + type: + type: string + description: | + Type of turn detection, only `server_vad` is currently supported. + threshold: + type: number + description: | + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: | + Duration of silence to detect speech stop (in milliseconds). Defaults + to 500ms. With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + tools: + type: array + description: Tools (functions) available to the model. + items: + $ref: '#/components/schemas/RealtimeFunctionTool' + tool_choice: + type: string + description: | + How the model chooses tools. Options are `auto`, `none`, `required`, or + specify a function. + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + x-oaiMeta: + name: The session object + group: realtime + example: | + { + "id": "sess_001", + "object": "realtime.session", + "expires_at": 1742188264, + "model": "gpt-realtime", + "output_modalities": ["audio"], + "instructions": "You are a friendly assistant.", + "tools": [], + "tool_choice": "none", + "max_output_tokens": "inf", + "tracing": "auto", + "truncation": "auto", + "prompt": null, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": { "model": "whisper-1" }, + "noise_reduction": null, + "turn_detection": null + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy", + "speed": 1.0 + } + } + } + RealtimeSessionCreateResponseGA: + type: object + title: Realtime session configuration object + description: | + A Realtime session configuration object. + properties: + type: + type: string + description: | + The type of session to create. Always `realtime` for the Realtime API. + enum: + - realtime + x-stainless-const: true + id: + type: string + description: | + Unique identifier for the session that looks like `sess_1234567890abcdef`. + object: + type: string + description: The object type. Always `realtime.session`. + enum: + - realtime.session + x-stainless-const: true + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + output_modalities: + type: array + description: | + The set of modalities the model can respond with. It defaults to `["audio"]`, indicating + that the model will respond with audio plus a transcript. `["text"]` can be used to make + the model respond with text only. It is not possible to request both `text` and `audio` at the same time. + default: + - audio + items: + type: string + enum: + - text + - audio + model: + anyOf: + - type: string + - type: string + enum: + - gpt-realtime + - gpt-realtime-1.5 + - gpt-realtime-2 + - 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 + description: | + The Realtime model used for this session. + 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. + + Note 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. + audio: + type: object + description: | + Configuration for input and output audio. + 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](/docs/api-reference/audio/createTranscription) 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. + $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. + Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. + Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. + 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/VoiceIdsShared' + default: alloy + description: | + The voice the model uses to respond. Voice cannot be changed during the + session once the model has responded with audio at least once. Current + voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + `shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for + best quality. + 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. + 1.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. + + This parameter is a post-processing adjustment to the audio after it is generated, it's + also possible to prompt the model to speak faster or slower. + include: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: | + Additional fields to include in server outputs. + + `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. + 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 + tracing is enabled for a session, the configuration cannot be modified. + + `auto` will create a trace for the session with default values for the + workflow name, group id, and metadata. + oneOf: + - type: string + title: auto + default: auto + description: | + Enables tracing and sets default values for tracing configuration options. Always `auto`. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: | + The name of the workflow to attach to this trace. This is used to + name the trace in the Traces Dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the Traces Dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the Traces Dashboard. + - 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 + function/MCP tool. + oneOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + default: auto + 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, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + truncation: + $ref: '#/components/schemas/RealtimeTruncation' + 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. + properties: + type: + type: string + description: | + Type of turn detection. Only `server_vad` is currently supported for transcription sessions. + enum: + - server_vad + threshold: + type: number + description: | + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: | + Duration of silence to detect speech stop (in milliseconds). Defaults + to 500ms. With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + input_audio_noise_reduction: + type: object + default: null + description: | + Configuration for input audio noise reduction. This can be set to `null` to turn off. + Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. + Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + 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`. + For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, + single channel (mono), and little-endian byte order. + 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. + $ref: '#/components/schemas/AudioTranscription' + 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: + `item.input_audio_transcription.logprobs` + RealtimeTranscriptionSessionCreateRequestGA: + type: object + title: Realtime transcription session configuration + description: Realtime transcription session object configuration. + properties: + type: + type: string + description: | + The type of session to create. Always `transcription` for transcription sessions. + enum: + - transcription + x-stainless-const: true + audio: + type: object + description: | + Configuration for input and output audio. + 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](/docs/api-reference/audio/createTranscription) 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. + $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. + Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. + Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. + 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. + + `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. + required: + - type + RealtimeTranscriptionSessionCreateResponse: + type: object + description: | + A new Realtime transcription session configuration. + + When a session is created on the server via REST API, the session object + also contains an ephemeral key. Default TTL for keys is 10 minutes. This + property is not present when a session is updated via the WebSocket API. + properties: + client_secret: + type: object + description: | + Ephemeral key returned by the API. Only present when the session is + created on the server via REST API. + properties: + value: + type: string + description: | + Ephemeral key usable in client environments to authenticate connections + to the Realtime API. Use this in client-side environments rather than + a standard API token, which should only be used server-side. + expires_at: + type: integer + format: unixtime + description: | + Timestamp for when the token expires. Currently, all tokens expire + after one minute. + required: + - value + - expires_at + modalities: + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + items: + type: string + enum: + - text + - audio + input_audio_format: + type: string + description: | + The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + input_audio_transcription: + description: | + Configuration of the transcription model. + $ref: '#/components/schemas/AudioTranscriptionResponse' + 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. + properties: + type: + type: string + description: | + Type of turn detection, only `server_vad` is currently supported. + threshold: + type: number + description: | + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: | + Duration of silence to detect speech stop (in milliseconds). Defaults + to 500ms. With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + required: + - client_secret + x-oaiMeta: + name: The transcription session object + group: realtime + example: | + { + "id": "sess_BBwZc7cFV3XizEyKGDCGL", + "object": "realtime.transcription_session", + "expires_at": 1742188264, + "modalities": ["audio", "text"], + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200 + }, + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "language": null, + "prompt": "" + }, + "client_secret": null + } + RealtimeTranscriptionSessionCreateResponseGA: + type: object + title: Realtime transcription session configuration object + description: | + A Realtime transcription session configuration object. + properties: + type: + type: string + description: | + The type of session. Always `transcription` for transcription sessions. + enum: + - transcription + x-stainless-const: true + id: + type: string + description: | + Unique identifier for the session that looks like `sess_1234567890abcdef`. + 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: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: | + Additional fields to include in server outputs. + - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. + audio: + type: object + description: | + Configuration for input audio for the session. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + transcription: + description: | + Configuration of the transcription model. + $ref: '#/components/schemas/AudioTranscriptionResponse' + noise_reduction: + type: object + description: | + Configuration for input audio noise reduction. + 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. + anyOf: + - 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. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported. + properties: + type: + type: string + description: | + Type of turn detection, only `server_vad` is currently supported. + threshold: + type: number + description: | + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: | + Duration of silence to detect speech stop (in milliseconds). Defaults + to 500ms. With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + - type: 'null' + required: + - type + - id + - object + x-oaiMeta: + name: The transcription session object + group: realtime + example: | + { + "id": "sess_BBwZc7cFV3XizEyKGDCGL", + "type": "transcription", + "object": "realtime.transcription_session", + "expires_at": 1742188264, + "include": ["item.input_audio_transcription.logprobs"], + "audio": { + "input": { + "format": "pcm16", + "transcription": { + "model": "gpt-4o-transcribe", + "language": null, + "prompt": "" + }, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200 + } + } + } + } + RealtimeTranslationClientEvent: + discriminator: + propertyName: type + description: | + A Realtime translation client event. + anyOf: + - $ref: '#/components/schemas/RealtimeTranslationClientEventSessionUpdate' + - $ref: '#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend' + - $ref: '#/components/schemas/RealtimeTranslationClientEventSessionClose' + RealtimeTranslationClientEventInputAudioBufferAppend: + type: object + description: | + Send this event to append audio bytes to the translation session input audio buffer. + + WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono + little-endian raw audio bytes. Unsupported websocket audio formats return a + validation error because lower-quality audio materially degrades translation + quality. + + Translation consumes 200 ms engine frames. For best realtime behavior, append + audio in 200 ms chunks. If a chunk is shorter, the server buffers it until it + has enough audio for one frame. If a chunk is longer, the server splits it into + 200 ms frames and enqueues them back-to-back. + + Keep appending silence while the session is active. If a client stops sending + audio and later resumes, model time treats the resumed audio as contiguous with + the previous audio rather than as a real-world pause. + 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 + audio: + type: string + description: Base64-encoded 24 kHz PCM16 mono audio bytes. + required: + - type + - audio + x-oaiMeta: + name: session.input_audio_buffer.append + group: realtime + example: | + { + "event_id": "event_456", + "type": "session.input_audio_buffer.append", + "audio": "Base64EncodedAudioData" + } + RealtimeTranslationClientEventSessionClose: + type: object + description: | + Gracefully close the realtime translation session. The server flushes pending + input audio and emits any remaining translated output before closing the + session. + properties: + event_id: + type: string + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: + type: string + enum: + - session.close + description: The event type, must be `session.close`. + x-stainless-const: true + required: + - type + x-oaiMeta: + name: session.close + group: realtime + example: | + { + "event_id": "event_789", + "type": "session.close" + } + RealtimeTranslationClientEventSessionUpdate: + type: object + description: | + Send this event to update the translation session configuration. Translation + sessions support updates to `audio.output.language`, `audio.input.transcription`, + and `audio.input.noise_reduction`. + properties: + event_id: + type: string + maxLength: 512 + 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/RealtimeTranslationSessionUpdateRequest' + description: | + Translation session fields to update. The session `type` and `model` are set + at creation and cannot be changed with `session.update`. + required: + - type + - session + x-oaiMeta: + name: session.update + group: realtime + example: | + { + "type": "session.update", + "session": { + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper" + }, + "noise_reduction": null + }, + "output": { + "language": "es" + } + } + } + } + RealtimeTranslationClientSecretCreateRequest: + type: object + title: Realtime translation client secret creation request + description: | + Create a translation session and client secret for the Realtime API. + properties: + expires_after: + type: object + title: Client secret expiration + description: | + Configuration for the client secret expiration. Expiration refers to the time after which + a client secret will no longer be valid for creating sessions. The session itself may + continue after that time once started. A secret can be used to create multiple sessions + until it expires. + 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. + 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. + minimum: 10 + maximum: 7200 + default: 600 + session: + $ref: '#/components/schemas/RealtimeTranslationSessionCreateRequest' + required: + - session + RealtimeTranslationClientSecretCreateResponse: + type: object + title: Realtime translation session and client secret + description: | + Response from creating a translation session and client secret for the Realtime API. + 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' + required: + - value + - expires_at + - session + x-oaiMeta: + name: Translation session response object + group: realtime + example: | + { + "value": "ek_68af296e8e408191a1120ab6383263c2", + "expires_at": 1756310470, + "session": { + "id": "sess_C9CiUVUzUzYIssh3ELY1d", + "type": "translation", + "expires_at": 1756310470, + "model": "gpt-realtime-translate", + "audio": { + "input": { + "transcription": null, + "noise_reduction": null + }, + "output": { + "language": "es" + } + } + } + } + RealtimeTranslationServerEvent: + discriminator: + propertyName: type + description: | + A Realtime translation server event. + anyOf: + - $ref: '#/components/schemas/RealtimeServerEventError' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionCreated' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionUpdated' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionClosed' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta' + RealtimeTranslationServerEventSessionClosed: + type: object + description: | + Returned when a realtime translation session is closed. + properties: + event_id: + type: string + description: The unique ID of the server event. + 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: | + { + "event_id": "event_987", + "type": "session.closed" + } + RealtimeTranslationServerEventSessionCreated: + type: object + description: | + Returned when a translation session is created. Emitted automatically when a + new connection is established as the first server event. This event contains + the default translation session configuration. + 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/RealtimeTranslationSession' + description: The translation session configuration. + required: + - event_id + - type + - session + x-oaiMeta: + name: session.created + group: realtime + example: | + { + "type": "session.created", + "event_id": "event_123", + "session": { + "id": "sess_123", + "type": "translation", + "model": "gpt-realtime-translate", + "expires_at": 1714857600, + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper", + "language": "en" + }, + "noise_reduction": { + "type": "near_field" + } + }, + "output": { + "language": "fr" + } + } + } + } + RealtimeTranslationServerEventSessionInputTranscriptDelta: + type: object + description: | + Returned when optional source-language transcript text is available. This event + is emitted only when `audio.input.transcription` is configured. + + Transcript deltas are append-only text fragments. Clients should not insert + unconditional spaces between deltas. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - session.input_transcript.delta + description: The event type, must be `session.input_transcript.delta`. + x-stainless-const: true + delta: + type: string + description: Append-only source-language transcript text. + elapsed_ms: + anyOf: + - type: integer + description: | + Timing metadata for stream alignment, derived from the translation frame + when available. It advances in 200 ms increments, but multiple transcript + deltas may share the same `elapsed_ms`. Treat it as alignment metadata, + not a unique transcript-delta identifier. + - type: 'null' + required: + - event_id + - type + - delta + x-oaiMeta: + name: session.input_transcript.delta + group: realtime + example: | + { + "event_id": "event_125", + "type": "session.input_transcript.delta", + "delta": " hear", + "elapsed_ms": 1200 + } + RealtimeTranslationServerEventSessionOutputAudioDelta: + type: object + description: | + Returned when translated output audio is available. Output audio deltas are + 200 ms frames of PCM16 audio. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - session.output_audio.delta + description: The event type, must be `session.output_audio.delta`. + 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: + type: string + enum: + - pcm16 + description: Audio encoding for `delta`. + x-stainless-const: true + elapsed_ms: + anyOf: + - type: integer + description: | + Timing metadata for stream alignment, derived from the translation frame + when available. Treat `elapsed_ms` as alignment metadata, not a unique + event identifier. + - type: 'null' + required: + - event_id + - type + - delta + x-oaiMeta: + name: session.output_audio.delta + group: realtime + example: | + { + "event_id": "event_123", + "type": "session.output_audio.delta", + "delta": "Base64EncodedAudioDelta", + "sample_rate": 24000, + "channels": 1, + "format": "pcm16", + "elapsed_ms": 1200 + } + RealtimeTranslationServerEventSessionOutputTranscriptDelta: + type: object + description: | + Returned when translated transcript text is available. + + Transcript deltas are append-only text fragments. Clients should not insert + unconditional spaces between deltas. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - session.output_transcript.delta + description: The event type, must be `session.output_transcript.delta`. + x-stainless-const: true + delta: + 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 + when available. It advances in 200 ms increments, but multiple transcript + deltas may share the same `elapsed_ms`. Treat it as alignment metadata, + not a unique transcript-delta identifier. + - type: 'null' + required: + - event_id + - type + - delta + x-oaiMeta: + name: session.output_transcript.delta + group: realtime + example: | + { + "event_id": "event_124", + "type": "session.output_transcript.delta", + "delta": " escuch", + "elapsed_ms": 1200 + } + RealtimeTranslationServerEventSessionUpdated: + type: object + description: | + Returned when a translation session is updated with a `session.update` event, + unless there is an error. + 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/RealtimeTranslationSession' + description: The translation session configuration. + required: + - event_id + - type + - session + x-oaiMeta: + name: session.updated + group: realtime + example: | + { + "type": "session.updated", + "event_id": "event_124", + "session": { + "id": "sess_123", + "type": "translation", + "model": "gpt-realtime-translate", + "expires_at": 1714857600, + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper", + "language": "en" + }, + "noise_reduction": { + "type": "near_field" + } + }, + "output": { + "language": "es" + } + } + } + } + RealtimeTranslationSession: + type: object + title: Realtime translation session + description: | + A Realtime translation session. Translation sessions continuously translate input + audio into the configured output language. + properties: + id: + type: string + description: | + Unique identifier for the session that looks like `sess_1234567890abcdef`. + type: + type: string + enum: + - translation + description: | + The session type. Always `translation` for Realtime translation sessions. + x-stainless-const: true + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + model: + type: string + description: | + The Realtime translation model used for this session. This field is set at + session creation and cannot be changed with `session.update`. + audio: + type: object + description: | + Configuration for translation input and output audio. + properties: + input: + type: object + properties: + transcription: + anyOf: + - type: object + description: | + Optional source-language transcription. When configured, the server emits + `session.input_transcript.delta` events. Translation itself still runs from + the input audio stream. + 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. + 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. + required: + - id + - type + - expires_at + - model + - audio + x-oaiMeta: + name: The translation session object + group: realtime + example: | + { + "id": "sess_C9G5QPteg4UIbotdKLoYQ", + "type": "translation", + "expires_at": 1756324625, + "model": "gpt-realtime-translate", + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper" + }, + "noise_reduction": null + }, + "output": { + "language": "es" + } + } + } + RealtimeTranslationSessionCreateRequest: + type: object + title: Realtime translation session configuration + description: | + Realtime translation session configuration. Translation sessions stream source + audio in and translated audio plus transcript deltas out continuously. + properties: + model: + type: string + description: | + The Realtime translation model used for this session. + audio: + type: object + description: | + Configuration for translation input and output audio. + properties: + input: + type: object + properties: + transcription: + anyOf: + - type: object + description: | + Optional source-language transcription. When configured, the server emits + `session.input_transcript.delta` events. Translation itself still runs from + the input audio stream. + 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. + 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. + required: + - model + RealtimeTranslationSessionUpdateRequest: + type: object + title: Realtime translation session update + description: | + Realtime translation session fields that can be updated with `session.update`. + properties: + audio: + type: object + description: | + Configuration for translation input and output audio. + properties: + input: + type: object + properties: + transcription: + anyOf: + - type: object + description: | + Optional source-language transcription. When configured, the server emits + `session.input_transcript.delta` events. Translation itself still runs from + the input audio stream. + 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. + 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. + 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. + + Clients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost. + + Truncation 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. + + Truncation 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. + 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: + - 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. + 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 + 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. + + 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. + + Semantic 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. + + For `gpt-realtime-whisper` transcription sessions, turn detection must be + set to `null`; VAD is not supported. + 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. + 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 + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: | + Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults + to 500ms. With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + 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. + + If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted. + interrupt_response: + type: boolean + default: true + description: | + Whether or not to automatically interrupt (cancel) any ongoing response with output to the default + conversation (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. + + If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted. + idle_timeout_ms: + anyOf: + - type: integer + minimum: 5000 + maximum: 30000 + description: | + Optional timeout after which a model response will be triggered automatically. This is + useful for situations in which a long pause from the user is unexpected, such as a phone + call. The model will effectively prompt the user to continue the conversation based + on the current context. + + The timeout value will be applied after the last model response's audio has finished playing, + i.e. it's set to the `response.done` time plus audio playback duration. + + An `input_audio_buffer.timeout_triggered` event (plus events + associated with the Response) will be emitted when the timeout is reached. + Idle timeout is currently only supported for `server_vad` mode. + - 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. + 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. + create_response: + type: boolean + default: true + description: | + Whether or not to automatically generate a response when a VAD stop event occurs. + interrupt_response: + type: boolean + default: true + description: | + Whether or not to automatically interrupt any ongoing response with output to the default + conversation (i.e. `conversation` of `auto`) when a VAD start event occurs. + discriminator: + propertyName: type + - type: 'null' + Reasoning: + type: object + description: | + **gpt-5 and o-series models only** + + Configuration options for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + title: Reasoning + properties: + effort: + $ref: '#/components/schemas/ReasoningEffort' + summary: + anyOf: + - type: string + description: | + A summary of the reasoning performed by the model. This can be + useful for debugging and understanding the model's reasoning process. + One of `auto`, `concise`, or `detailed`. + + `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`. + enum: + - auto + - concise + - detailed + - type: 'null' + generate_summary: + anyOf: + - type: string + deprecated: true + description: | + **Deprecated:** use `summary` instead. + + A summary of the reasoning performed by the model. This can be + useful for debugging and understanding the model's reasoning process. + One of `auto`, `concise`, or `detailed`. + enum: + - auto + - concise + - detailed + - type: 'null' + ReasoningEffort: + anyOf: + - type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + default: medium + description: | + Constrains effort on reasoning for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing + reasoning effort can result in faster responses and fewer tokens used + on reasoning in a response. + + - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. + - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. + - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. + - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + - type: 'null' + ReasoningItem: + type: object + description: | + A description of the chain of thought used by a reasoning model while generating + a response. Be sure to include these items in your `input` to the Responses API + for subsequent turns of a conversation if you are manually + [managing context](/docs/guides/conversation-state). + title: Reasoning + properties: + type: + type: string + description: | + The type of the object. Always `reasoning`. + enum: + - reasoning + x-stainless-const: true + id: + type: string + description: | + The unique identifier of the reasoning content. + encrypted_content: + anyOf: + - type: string + description: | + The encrypted content of the reasoning item - populated when a response is + generated with `reasoning.encrypted_content` in the `include` parameter. + - type: 'null' + summary: + type: array + description: | + Reasoning summary content. + items: + $ref: '#/components/schemas/SummaryTextContent' + content: + type: array + description: | + Reasoning text content. + items: + $ref: '#/components/schemas/ReasoningTextContent' + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - id + - summary + - type + Response: + title: The response object + allOf: + - $ref: '#/components/schemas/ModelResponseProperties' + - $ref: '#/components/schemas/ResponseProperties' + - type: object + properties: + id: + type: string + description: | + Unique identifier for this Response. + object: + type: string + description: | + The object type of this resource - always set to `response`. + enum: + - response + x-stainless-const: true + status: + type: string + description: | + The status of the response generation. One of `completed`, `failed`, + `in_progress`, `cancelled`, `queued`, or `incomplete`. + 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. + completed_at: + anyOf: + - type: number + format: unixtime + description: | + Unix timestamp (in seconds) of when this Response was completed. + Only present when the status is `completed`. + - type: 'null' + error: + $ref: '#/components/schemas/ResponseError' + incomplete_details: + anyOf: + - type: object + description: | + Details about why the response is incomplete. + properties: + reason: + type: string + description: The reason why the response is incomplete. + enum: + - max_output_tokens + - content_filter + - type: 'null' + output: + type: array + description: | + An array of content items generated by the model. + + - The length and order of items in the `output` array is dependent + on the model's response. + - Rather than accessing the first item in the `output` array and + assuming it's an `assistant` message with the content generated by + the model, you might consider using the `output_text` property where + supported in SDKs. + items: + $ref: '#/components/schemas/OutputItem' + instructions: + anyOf: + - description: | + A system (or developer) message inserted into the model's context. + + When using 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. + oneOf: + - type: string + description: | + A text input to the model, equivalent to a text input with the + `developer` role. + - type: array + title: Input item list + description: | + A list of one or many input items to the model, containing + different content types. + items: + $ref: '#/components/schemas/InputItem' + - type: 'null' + output_text: + anyOf: + - type: string + description: | + SDK-only convenience property that contains the aggregated text output + from all `output_text` items in the `output` array, if any are present. + Supported in the Python and JavaScript SDKs. + x-oaiSupportedSDKs: + - python + - javascript + - type: 'null' + usage: + $ref: '#/components/schemas/ResponseUsage' + parallel_tool_calls: + type: boolean + description: | + Whether to allow the model to run tool calls in parallel. + default: true + conversation: + anyOf: + - default: null + $ref: '#/components/schemas/Conversation-2' + - 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](/docs/guides/reasoning). + 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-4o-2024-08-06 + 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: [] + parallel_tool_calls: true + previous_response_id: null + reasoning: + effort: null + summary: 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 + output_tokens: 52 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 380 + user: null + metadata: {} + ResponseAudioDeltaEvent: + type: object + description: Emitted when there is a partial audio response. + properties: + type: + type: string + description: | + The type of the event. Always `response.audio.delta`. + enum: + - response.audio.delta + x-stainless-const: true + sequence_number: + type: integer + description: | + A sequence number for this chunk of the stream response. + delta: + type: string + description: | + A chunk of Base64 encoded response audio bytes. + required: + - type + - delta + - sequence_number + x-oaiMeta: + name: response.audio.delta + group: responses + example: | + { + "type": "response.audio.delta", + "response_id": "resp_123", + "delta": "base64encoded...", + "sequence_number": 1 + } + ResponseAudioDoneEvent: + type: object + description: Emitted when the audio response is complete. + properties: + type: + type: string + description: | + The type of the event. Always `response.audio.done`. + enum: + - response.audio.done + x-stainless-const: true + sequence_number: + type: integer + description: | + The sequence number of the delta. + required: + - type + - sequence_number + - response_id + x-oaiMeta: + name: response.audio.done + group: responses + example: | + { + "type": "response.audio.done", + "response_id": "resp-123", + "sequence_number": 1 + } + ResponseAudioTranscriptDeltaEvent: + type: object + description: Emitted when there is a partial transcript of audio. + properties: + type: + type: string + description: | + The type of the event. Always `response.audio.transcript.delta`. + enum: + - response.audio.transcript.delta + x-stainless-const: true + delta: + type: string + description: | + The partial transcript of the audio response. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - response_id + - delta + - sequence_number + x-oaiMeta: + name: response.audio.transcript.delta + group: responses + example: | + { + "type": "response.audio.transcript.delta", + "response_id": "resp_123", + "delta": " ... partial transcript ... ", + "sequence_number": 1 + } + ResponseAudioTranscriptDoneEvent: + type: object + description: Emitted when the full audio transcript is completed. + properties: + type: + type: string + description: | + The type of the event. Always `response.audio.transcript.done`. + enum: + - response.audio.transcript.done + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - response_id + - sequence_number + x-oaiMeta: + name: response.audio.transcript.done + group: responses + example: | + { + "type": "response.audio.transcript.done", + "response_id": "resp_123", + "sequence_number": 1 + } + ResponseCodeInterpreterCallCodeDeltaEvent: + type: object + description: Emitted when a partial code snippet is streamed by the code interpreter. + properties: + type: + type: string + description: The type of the event. Always `response.code_interpreter_call_code.delta`. + enum: + - response.code_interpreter_call_code.delta + 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 + - output_index + - item_id + - delta + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call_code.delta + group: responses + example: | + { + "type": "response.code_interpreter_call_code.delta", + "output_index": 0, + "item_id": "ci_12345", + "delta": "print('Hello, world')", + "sequence_number": 1 + } + ResponseCodeInterpreterCallCodeDoneEvent: + type: object + description: Emitted when the code snippet is finalized by the code interpreter. + properties: + type: + 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 + 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: 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 + - output_index + - item_id + - code + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call_code.done + group: responses + example: | + { + "type": "response.code_interpreter_call_code.done", + "output_index": 3, + "item_id": "ci_12345", + "code": "print('done')", + "sequence_number": 1 + } + ResponseCodeInterpreterCallCompletedEvent: + type: object + description: Emitted when the code interpreter call is completed. + properties: + type: + type: string + description: The type of the event. Always `response.code_interpreter_call.completed`. + 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. + 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 + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call.completed + group: responses + example: | + { + "type": "response.code_interpreter_call.completed", + "output_index": 5, + "item_id": "ci_12345", + "sequence_number": 1 + } + ResponseCodeInterpreterCallInProgressEvent: + type: object + description: Emitted when a code interpreter call is in progress. + properties: + type: + type: string + description: The type of the event. Always `response.code_interpreter_call.in_progress`. + enum: + - response.code_interpreter_call.in_progress + 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: + 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 + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call.in_progress + group: responses + example: | + { + "type": "response.code_interpreter_call.in_progress", + "output_index": 0, + "item_id": "ci_12345", + "sequence_number": 1 + } + ResponseCodeInterpreterCallInterpretingEvent: + type: object + description: Emitted when the code interpreter is actively interpreting the code snippet. + properties: + type: + type: string + description: The type of the event. Always `response.code_interpreter_call.interpreting`. + enum: + - response.code_interpreter_call.interpreting + x-stainless-const: true + 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 + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call.interpreting + group: responses + example: | + { + "type": "response.code_interpreter_call.interpreting", + "output_index": 4, + "item_id": "ci_12345", + "sequence_number": 1 + } + ResponseCompletedEvent: + type: object + description: Emitted when the model response is complete. + properties: + type: + type: string + description: | + The type of the event. Always `response.completed`. + enum: + - response.completed + x-stainless-const: true + response: + $ref: '#/components/schemas/Response' + description: | + Properties of the completed response. + sequence_number: + type: integer + description: The sequence number for this event. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.completed + group: responses + example: | + { + "type": "response.completed", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "completed", + "completed_at": 1740855870, + "error": null, + "incomplete_details": null, + "input": [], + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_123", + "type": "message", + "role": "assistant", + "content": [ + { + "type": "output_text", + "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.", + "annotations": [] + } + ] + } + ], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + 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`. + enum: + - response.content_part.added + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the content part was added to. + output_index: + type: integer + description: | + The index of the output item that the content part was added to. + content_index: + type: integer + description: | + The index of the content part that was added. + part: + $ref: '#/components/schemas/OutputContent' + description: | + The content part that was added. + 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: | + { + "type": "response.content_part.added", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "part": { + "type": "output_text", + "text": "", + "annotations": [] + }, + "sequence_number": 1 + } + ResponseContentPartDoneEvent: + type: object + description: Emitted when a content part is done. + properties: + type: + type: string + description: | + The type of the event. Always `response.content_part.done`. + enum: + - response.content_part.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the content part was added to. + output_index: + type: integer + description: | + The index of the output item that the content part was added to. + content_index: + type: integer + description: | + The index of the content part that is done. + sequence_number: + type: integer + description: The sequence number of this event. + part: + $ref: '#/components/schemas/OutputContent' + description: | + The content part that is done. + required: + - type + - item_id + - output_index + - content_index + - part + - sequence_number + x-oaiMeta: + name: response.content_part.done + group: responses + example: | + { + "type": "response.content_part.done", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "sequence_number": 1, + "part": { + "type": "output_text", + "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.", + "annotations": [] + } + } + ResponseCreatedEvent: + type: object + description: | + An event that is emitted when a response is created. + properties: + type: + type: string + description: | + The type of the event. Always `response.created`. + enum: + - response.created + x-stainless-const: true + response: + $ref: '#/components/schemas/Response' + description: | + The response that was created. + sequence_number: + type: integer + description: The sequence number for this event. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.created + group: responses + example: | + { + "type": "response.created", + "response": { + "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", + "object": "response", + "created_at": 1741487325, + "status": "in_progress", + "completed_at": null, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-2024-08-06", + "output": [], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + ResponseCustomToolCallInputDeltaEvent: + title: ResponseCustomToolCallInputDelta + type: object + description: | + Event representing a delta (partial update) to the input of a custom tool call. + properties: + type: + type: string + enum: + - response.custom_tool_call_input.delta + 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: 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: + - type + - output_index + - item_id + - delta + - sequence_number + x-oaiMeta: + name: response.custom_tool_call_input.delta + group: responses + example: | + { + "type": "response.custom_tool_call_input.delta", + "output_index": 0, + "item_id": "ctc_1234567890abcdef", + "delta": "partial input text" + } + ResponseCustomToolCallInputDoneEvent: + title: ResponseCustomToolCallInputDone + type: object + description: | + Event indicating that input for a custom tool call is complete. + properties: + type: + type: string + enum: + - response.custom_tool_call_input.done + 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 event applies to. + item_id: + type: string + description: Unique identifier for the API item associated with this event. + 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: | + { + "type": "response.custom_tool_call_input.done", + "output_index": 0, + "item_id": "ctc_1234567890abcdef", + "input": "final complete input text" + } + ResponseError: + anyOf: + - type: object + description: | + An error object returned when the model fails to generate a Response. + properties: + code: + $ref: '#/components/schemas/ResponseErrorCode' + message: + type: string + description: | + A human-readable description of the error. + required: + - code + - message + - type: 'null' + ResponseErrorCode: + type: string + description: | + The error code for the response. + enum: + - server_error + - rate_limit_exceeded + - invalid_prompt + - 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`. + enum: + - error + x-stainless-const: true + code: + anyOf: + - type: string + description: | + The error code. + - type: 'null' + message: + type: string + description: | + The error message. + param: + anyOf: + - type: string + description: | + The error parameter. + - type: 'null' + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - code + - message + - param + - sequence_number + x-oaiMeta: + name: error + group: responses + example: | + { + "type": "error", + "code": "ERR_SOMETHING", + "message": "Something went wrong", + "param": null, + "sequence_number": 1 + } + ResponseFailedEvent: + type: object + description: | + An event that is emitted when a response fails. + properties: + type: + type: string + description: | + The type of the event. Always `response.failed`. + enum: + - response.failed + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number of this event. + response: + $ref: '#/components/schemas/Response' + description: | + The response that failed. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.failed + group: responses + example: | + { + "type": "response.failed", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "failed", + "completed_at": null, + "error": { + "code": "server_error", + "message": "The model failed to generate a response." + }, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + } + } + ResponseFileSearchCallCompletedEvent: + type: object + description: Emitted when a file search call is completed (results found). + properties: + type: + type: string + description: | + The type of the event. Always `response.file_search_call.completed`. + enum: + - response.file_search_call.completed + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that the file search call is initiated. + item_id: + type: string + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.file_search_call.completed + group: responses + example: | + { + "type": "response.file_search_call.completed", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 + } + ResponseFileSearchCallInProgressEvent: + type: object + description: Emitted when a file search call is initiated. + properties: + type: + type: string + description: | + The type of the event. Always `response.file_search_call.in_progress`. + enum: + - response.file_search_call.in_progress + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that the file search call is initiated. + item_id: + type: string + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.file_search_call.in_progress + group: responses + example: | + { + "type": "response.file_search_call.in_progress", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 + } + ResponseFileSearchCallSearchingEvent: + type: object + description: Emitted when a file search is currently searching. + properties: + type: + type: string + description: | + The type of the event. Always `response.file_search_call.searching`. + enum: + - response.file_search_call.searching + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that the file search call is searching. + item_id: + type: string + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + 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: | + { + "type": "response.file_search_call.searching", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 + } + ResponseFormatJsonObject: + type: object + title: JSON object + description: | + JSON object response format. An older method of generating JSON responses. + Using `json_schema` is recommended for models that support it. Note that the + model will not generate JSON without a system or user message instructing it + to do so. + 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. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). + properties: + type: + type: string + description: The type of response format being defined. Always `json_schema`. + enum: + - json_schema + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: | + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](/docs/guides/structured-outputs). + - 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + ResponseFormatText: + type: object + title: Text + description: | + Default response format. Used to generate text responses. + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + required: + - type + ResponseFormatTextGrammar: + type: object + title: Text grammar + description: | + A custom grammar for the model to follow when generating text. + Learn more in the [custom grammars guide](/docs/guides/custom-grammars). + properties: + type: + type: string + description: The type of response format being defined. Always `grammar`. + enum: + - grammar + x-stainless-const: true + grammar: + type: string + description: The custom grammar for the model to follow. + required: + - type + - grammar + ResponseFormatTextPython: + type: object + title: Python grammar + description: | + Configure the model to generate valid Python code. See the + [custom grammars guide](/docs/guides/custom-grammars) for more details. + properties: + type: + type: string + description: The type of response format being defined. Always `python`. + enum: + - python + x-stainless-const: true + required: + - type + ResponseFunctionCallArgumentsDeltaEvent: + type: object + description: Emitted when there is a partial function-call arguments delta. + properties: + type: + type: string + description: | + The type of the event. Always `response.function_call_arguments.delta`. + enum: + - response.function_call_arguments.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the function-call arguments delta is added to. + output_index: + type: integer + description: | + The index of the output item that the function-call arguments delta is added to. + sequence_number: + type: integer + description: The sequence number of this event. + delta: + type: string + description: | + The function-call arguments delta that is added. + required: + - type + - item_id + - output_index + - delta + - sequence_number + x-oaiMeta: + name: response.function_call_arguments.delta + group: responses + example: | + { + "type": "response.function_call_arguments.delta", + "item_id": "item-abc", + "output_index": 0, + "delta": "{ \"arg\":" + "sequence_number": 1 + } + ResponseFunctionCallArgumentsDoneEvent: + type: object + description: Emitted when function-call arguments are finalized. + properties: + type: + type: string + enum: + - response.function_call_arguments.done + x-stainless-const: true + item_id: + type: string + description: The ID of the item. + name: + type: string + description: The name of the function that was called. + 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: + - type + - item_id + - name + - output_index + - arguments + - sequence_number + x-oaiMeta: + name: response.function_call_arguments.done + group: responses + example: | + { + "type": "response.function_call_arguments.done", + "item_id": "item-abc", + "name": "get_weather", + "output_index": 1, + "arguments": "{ \"arg\": 123 }", + "sequence_number": 1 + } + ResponseImageGenCallCompletedEvent: + type: object + title: ResponseImageGenCallCompletedEvent + description: | + Emitted when an image generation tool call has completed and the final image is available. + properties: + type: + type: string + enum: + - response.image_generation_call.completed + 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 unique identifier of the image generation item being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.image_generation_call.completed + group: responses + example: | + { + "type": "response.image_generation_call.completed", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 1 + } + ResponseImageGenCallGeneratingEvent: + type: object + title: ResponseImageGenCallGeneratingEvent + description: | + Emitted when an image generation tool call is actively generating an image (intermediate state). + properties: + type: + type: string + enum: + - response.image_generation_call.generating + 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. + sequence_number: + type: integer + description: The sequence number of the image generation item being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.image_generation_call.generating + group: responses + example: | + { + "type": "response.image_generation_call.generating", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0 + } + ResponseImageGenCallInProgressEvent: + type: object + title: ResponseImageGenCallInProgressEvent + description: | + Emitted when an image generation tool call is in progress. + properties: + type: + type: string + enum: + - response.image_generation_call.in_progress + description: The type of the event. Always 'response.image_generation_call.in_progress'. + 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. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.image_generation_call.in_progress + group: responses + example: | + { + "type": "response.image_generation_call.in_progress", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0 + } + ResponseImageGenCallPartialImageEvent: + type: object + title: ResponseImageGenCallPartialImageEvent + description: | + Emitted when a partial image is available during image generation streaming. + properties: + type: + type: string + enum: + - response.image_generation_call.partial_image + 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. + 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: | + { + "type": "response.image_generation_call.partial_image", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0, + "partial_image_index": 0, + "partial_image_b64": "..." + } + ResponseInProgressEvent: + type: object + description: Emitted when the response is in progress. + properties: + type: + type: string + description: | + The type of the event. Always `response.in_progress`. + enum: + - response.in_progress + x-stainless-const: true + response: + $ref: '#/components/schemas/Response' + description: | + The response that is in progress. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.in_progress + group: responses + example: | + { + "type": "response.in_progress", + "response": { + "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", + "object": "response", + "created_at": 1741487325, + "status": "in_progress", + "completed_at": null, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-2024-08-06", + "output": [], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + ResponseIncompleteEvent: + type: object + description: | + An event that is emitted when a response finishes as incomplete. + properties: + type: + type: string + description: | + The type of the event. Always `response.incomplete`. + enum: + - response.incomplete + x-stainless-const: true + response: + $ref: '#/components/schemas/Response' + description: | + The response that was incomplete. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.incomplete + group: responses + example: | + { + "type": "response.incomplete", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "incomplete", + "completed_at": null, + "error": null, + "incomplete_details": { + "reason": "max_tokens" + }, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + ResponseItemList: + type: object + description: A list of Response 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 items used to generate this response. + items: + $ref: '#/components/schemas/ItemResource' + 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. + last_id: + type: string + description: The ID of the last item in the list. + required: + - object + - data + - has_more + - first_id + - last_id + x-oaiMeta: + name: The input item list + group: responses + example: | + { + "object": "list", + "data": [ + { + "id": "msg_abc123", + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Tell me a three sentence bedtime story about a unicorn." + } + ] + } + ], + "first_id": "msg_abc123", + "last_id": "msg_abc123", + "has_more": false + } + ResponseLogProb: + type: object + description: | + A logprob is the logarithmic probability that the model assigns to producing + a particular token at a given position in the sequence. Less-negative (higher) + logprob values indicate greater model confidence in that token choice. + properties: + token: + description: A possible text token. + type: string + logprob: + description: | + The log probability of this token. + type: number + top_logprobs: + description: | + The log probabilities of up to 20 of the most likely tokens. + 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. + 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. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - output_index + - item_id + - delta + - sequence_number + x-oaiMeta: + name: response.mcp_call_arguments.delta + group: responses + example: | + { + "type": "response.mcp_call_arguments.delta", + "output_index": 0, + "item_id": "item-abc", + "delta": "{", + "sequence_number": 1 + } + ResponseMCPCallArgumentsDoneEvent: + type: object + title: ResponseMCPCallArgumentsDoneEvent + description: | + Emitted when the arguments for an MCP tool call are finalized. + properties: + type: + type: string + enum: + - response.mcp_call_arguments.done + 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. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - output_index + - item_id + - arguments + - sequence_number + x-oaiMeta: + name: response.mcp_call_arguments.done + group: responses + example: | + { + "type": "response.mcp_call_arguments.done", + "output_index": 0, + "item_id": "item-abc", + "arguments": "{\"arg1\": \"value1\", \"arg2\": \"value2\"}", + "sequence_number": 1 + } + ResponseMCPCallCompletedEvent: + type: object + title: ResponseMCPCallCompletedEvent + description: | + Emitted when an MCP tool call has completed successfully. + properties: + type: + type: string + enum: + - response.mcp_call.completed + 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: + type: integer + description: The index of the output item that completed. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - item_id + - output_index + - sequence_number + x-oaiMeta: + name: response.mcp_call.completed + group: responses + example: | + { + "type": "response.mcp_call.completed", + "sequence_number": 1, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", + "output_index": 0 + } + ResponseMCPCallFailedEvent: + type: object + title: ResponseMCPCallFailedEvent + description: | + Emitted when an MCP tool call has failed. + properties: + type: + type: string + enum: + - response.mcp_call.failed + description: The type of the event. Always 'response.mcp_call.failed'. + x-stainless-const: true + 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: + - type + - item_id + - output_index + - sequence_number + x-oaiMeta: + name: response.mcp_call.failed + group: responses + example: | + { + "type": "response.mcp_call.failed", + "sequence_number": 1, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", + "output_index": 0 + } + ResponseMCPCallInProgressEvent: + type: object + title: ResponseMCPCallInProgressEvent + description: | + Emitted when an MCP tool call is in progress. + properties: + type: + type: string + enum: + - response.mcp_call.in_progress + 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. + 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: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.mcp_call.in_progress + group: responses + example: | + { + "type": "response.mcp_call.in_progress", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90" + } + ResponseMCPListToolsCompletedEvent: + type: object + title: ResponseMCPListToolsCompletedEvent + description: | + Emitted when the list of available MCP tools has been successfully retrieved. + properties: + type: + type: string + enum: + - response.mcp_list_tools.completed + description: The type of the event. Always 'response.mcp_list_tools.completed'. + x-stainless-const: true + item_id: + type: string + description: The ID of the MCP tool call item that produced this output. + output_index: + type: integer + description: The index of the output item that was processed. + 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.completed + group: responses + example: | + { + "type": "response.mcp_list_tools.completed", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" + } + ResponseMCPListToolsFailedEvent: + type: object + title: ResponseMCPListToolsFailedEvent + description: | + Emitted when the attempt to list available MCP tools has failed. + properties: + type: + type: string + enum: + - response.mcp_list_tools.failed + description: The type of the event. Always 'response.mcp_list_tools.failed'. + x-stainless-const: true + 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: + - type + - item_id + - output_index + - sequence_number + x-oaiMeta: + name: response.mcp_list_tools.failed + group: responses + example: | + { + "type": "response.mcp_list_tools.failed", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" + } + ResponseMCPListToolsInProgressEvent: + type: object + title: ResponseMCPListToolsInProgressEvent + description: | + Emitted when the system is in the process of retrieving the list of available MCP tools. + 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 + item_id: + type: string + description: The ID of the MCP tool call item that is being processed. + output_index: + type: integer + description: The index of the output item that is being processed. + 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: | + { + "type": "response.mcp_list_tools.in_progress", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" + } + ResponseModalities: + anyOf: + - type: array + description: | + Output types that you would like the model to generate. + Most models are capable of generating text, which is the default: + + `["text"]` + + The `gpt-4o-audio-preview` model can also be used to + [generate audio](/docs/guides/audio). To request that this model generate + both text and audio responses, you can use: + + `["text", "audio"]` + items: + type: string + enum: + - text + - audio + - type: 'null' + ResponseOutputItemAddedEvent: + type: object + description: Emitted when a new output item is added. + properties: + type: + type: string + description: | + The type of the event. Always `response.output_item.added`. + enum: + - response.output_item.added + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that was added. + sequence_number: + type: integer + description: | + The sequence number of this event. + item: + $ref: '#/components/schemas/OutputItem' + description: | + The output item that was added. + required: + - type + - output_index + - item + - sequence_number + x-oaiMeta: + name: response.output_item.added + group: responses + example: | + { + "type": "response.output_item.added", + "output_index": 0, + "item": { + "id": "msg_123", + "status": "in_progress", + "type": "message", + "role": "assistant", + "content": [] + }, + "sequence_number": 1 + } + ResponseOutputItemDoneEvent: + type: object + description: Emitted when an output item is marked done. + properties: + type: + type: string + description: | + The type of the event. Always `response.output_item.done`. + enum: + - response.output_item.done + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that was marked done. + sequence_number: + type: integer + description: | + The sequence number of this event. + item: + $ref: '#/components/schemas/OutputItem' + description: | + The output item that was marked done. + required: + - type + - output_index + - item + - sequence_number + x-oaiMeta: + name: response.output_item.done + group: responses + example: | + { + "type": "response.output_item.done", + "output_index": 0, + "item": { + "id": "msg_123", + "status": "completed", + "type": "message", + "role": "assistant", + "content": [ + { + "type": "output_text", + "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.", + "annotations": [] + } + ] + }, + "sequence_number": 1 + } + ResponseOutputTextAnnotationAddedEvent: + type: object + title: ResponseOutputTextAnnotationAddedEvent + description: | + Emitted when an annotation is added to output text content. + properties: + type: + type: string + enum: + - response.output_text.annotation.added + 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's output array. + 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: + type: object + description: The annotation object being added. (See annotation schema for details.) + required: + - type + - item_id + - output_index + - content_index + - annotation_index + - annotation + - sequence_number + x-oaiMeta: + name: response.output_text.annotation.added + group: responses + example: | + { + "type": "response.output_text.annotation.added", + "item_id": "item-abc", + "output_index": 0, + "content_index": 0, + "annotation_index": 0, + "annotation": { + "type": "text_annotation", + "text": "This is a test annotation", + "start": 0, + "end": 10 + }, + "sequence_number": 1 + } + ResponsePromptVariables: + anyOf: + - type: object + title: Prompt Variables + description: | + Optional map of values to substitute in for variables in your + prompt. The substitution values can either be strings, or other + Response input types like images or files. + 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 + properties: + 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](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`. + - type: 'null' + model: + 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](/docs/models) + to browse and compare available models. + $ref: '#/components/schemas/ModelIdsResponses' + reasoning: + anyOf: + - $ref: '#/components/schemas/Reasoning' + - type: 'null' + background: + anyOf: + - type: boolean + description: | + Whether to run the model response in the background. + [Learn more](/docs/guides/background). + 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. + 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' + truncation: + anyOf: + - type: string + 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. + enum: + - auto + - disabled + default: disabled + - type: 'null' + ResponseQueuedEvent: + type: object + title: ResponseQueuedEvent + description: | + Emitted when a response is queued and waiting to be processed. + properties: + type: + type: string + enum: + - response.queued + 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. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.queued + group: responses + example: | + { + "type": "response.queued", + "response": { + "id": "res_123", + "status": "queued", + "created_at": "2021-01-01T00:00:00Z", + "updated_at": "2021-01-01T00:00:00Z" + }, + "sequence_number": 1 + } + ResponseReasoningSummaryPartAddedEvent: + type: object + description: Emitted when a new reasoning summary part is added. + properties: + type: + type: string + description: | + The type of the event. Always `response.reasoning_summary_part.added`. + enum: + - response.reasoning_summary_part.added + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this summary part is associated with. + output_index: + type: integer + description: | + The index of the output item this summary part is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + sequence_number: + type: integer + description: | + The sequence number of this event. + part: + type: object + description: | + The summary part that was added. + 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: + - type + - item_id + - output_index + - summary_index + - part + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_part.added + group: responses + example: | + { + "type": "response.reasoning_summary_part.added", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "part": { + "type": "summary_text", + "text": "" + }, + "sequence_number": 1 + } + ResponseReasoningSummaryPartDoneEvent: + type: object + description: Emitted when a reasoning summary part is completed. + properties: + type: + type: string + description: | + The type of the event. Always `response.reasoning_summary_part.done`. + enum: + - response.reasoning_summary_part.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this summary part is associated with. + output_index: + type: integer + description: | + The index of the output item this summary part is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + sequence_number: + type: integer + description: | + The sequence number of this event. + part: + type: object + description: | + The completed summary part. + 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: + - type + - item_id + - output_index + - summary_index + - part + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_part.done + group: responses + example: | + { + "type": "response.reasoning_summary_part.done", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "part": { + "type": "summary_text", + "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!" + }, + "sequence_number": 1 + } + ResponseReasoningSummaryTextDeltaEvent: + type: object + description: Emitted when a delta is added to a reasoning summary text. + properties: + type: + type: string + description: | + The type of the event. Always `response.reasoning_summary_text.delta`. + enum: + - response.reasoning_summary_text.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this summary text delta is associated with. + output_index: + type: integer + description: | + The index of the output item this summary text delta is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + delta: + type: string + description: | + The text delta that was added to the summary. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - summary_index + - delta + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_text.delta + group: responses + example: | + { + "type": "response.reasoning_summary_text.delta", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "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!", + "sequence_number": 1 + } + ResponseReasoningSummaryTextDoneEvent: + type: object + description: Emitted when a reasoning summary text is completed. + properties: + type: + type: string + description: | + The type of the event. Always `response.reasoning_summary_text.done`. + enum: + - response.reasoning_summary_text.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this summary text is associated with. + output_index: + type: integer + description: | + The index of the output item this summary text is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + text: + type: string + description: | + The full text of the completed reasoning summary. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - summary_index + - text + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_text.done + group: responses + example: | + { + "type": "response.reasoning_summary_text.done", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "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!", + "sequence_number": 1 + } + ResponseReasoningTextDeltaEvent: + type: object + description: Emitted when a delta is added to a reasoning text. + properties: + type: + type: string + description: | + The type of the event. Always `response.reasoning_text.delta`. + enum: + - response.reasoning_text.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this reasoning text delta is associated with. + output_index: + type: integer + description: | + The index of the output item this reasoning text delta is associated with. + content_index: + type: integer + description: | + The index of the reasoning content part this delta is associated with. + delta: + type: string + description: | + The text delta that was added to the reasoning content. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - delta + - sequence_number + x-oaiMeta: + name: response.reasoning_text.delta + group: responses + example: | + { + "type": "response.reasoning_text.delta", + "item_id": "rs_123", + "output_index": 0, + "content_index": 0, + "delta": "The", + "sequence_number": 1 + } + ResponseReasoningTextDoneEvent: + type: object + description: Emitted when a reasoning text is completed. + properties: + type: + type: string + description: | + The type of the event. Always `response.reasoning_text.done`. + enum: + - response.reasoning_text.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this reasoning text is associated with. + output_index: + type: integer + description: | + The index of the output item this reasoning text is associated with. + content_index: + type: integer + description: | + The index of the reasoning content part. + text: + type: string + description: | + The full text of the completed reasoning content. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - text + - sequence_number + x-oaiMeta: + name: response.reasoning_text.done + group: responses + example: | + { + "type": "response.reasoning_text.done", + "item_id": "rs_123", + "output_index": 0, + "content_index": 0, + "text": "The user is asking...", + "sequence_number": 4 + } + ResponseRefusalDeltaEvent: + type: object + description: Emitted when there is a partial refusal text. + properties: + type: + type: string + description: | + The type of the event. Always `response.refusal.delta`. + enum: + - response.refusal.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the refusal text is added to. + output_index: + type: integer + description: | + The index of the output item that the refusal text is added to. + content_index: + type: integer + description: | + The index of the content part that the refusal text is added to. + delta: + type: string + description: | + The refusal text that is added. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - delta + - sequence_number + x-oaiMeta: + name: response.refusal.delta + group: responses + example: | + { + "type": "response.refusal.delta", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "delta": "refusal text so far", + "sequence_number": 1 + } + ResponseRefusalDoneEvent: + type: object + description: Emitted when refusal text is finalized. + properties: + type: + type: string + description: | + The type of the event. Always `response.refusal.done`. + enum: + - response.refusal.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the refusal text is finalized. + output_index: + type: integer + description: | + The index of the output item that the refusal text is finalized. + content_index: + type: integer + description: | + The index of the content part that the refusal text is finalized. + refusal: + type: string + description: | + The refusal text that is finalized. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - refusal + - sequence_number + x-oaiMeta: + name: response.refusal.done + group: responses + example: | + { + "type": "response.refusal.done", + "item_id": "item-abc", + "output_index": 1, + "content_index": 2, + "refusal": "final refusal text", + "sequence_number": 1 + } + ResponseStreamEvent: + 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/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' + discriminator: + propertyName: type + ResponseStreamOptions: + anyOf: + - description: | + Options for streaming responses. Only set this when you set `stream: true`. + type: object + default: null + properties: + include_obfuscation: + type: boolean + description: | + When true, stream obfuscation will be enabled. Stream obfuscation adds + random characters to an `obfuscation` field on streaming delta events to + normalize payload sizes as a mitigation to certain side-channel attacks. + These obfuscation fields are included by default, but add a small amount + of overhead to the data stream. You can set `include_obfuscation` to + false to optimize for bandwidth if you trust the network links between + your application and the OpenAI API. + - type: 'null' + ResponseTextDeltaEvent: + type: object + description: Emitted when there is an additional text delta. + properties: + type: + type: string + description: | + The type of the event. Always `response.output_text.delta`. + enum: + - response.output_text.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the text delta was added to. + output_index: + type: integer + description: | + The index of the output item that the text delta was added to. + content_index: + type: integer + description: | + The index of the content part that the text delta was added to. + delta: + type: string + description: | + The text delta that was added. + sequence_number: + type: integer + description: The sequence number for this event. + logprobs: + type: array + description: | + The log probabilities of the tokens in the delta. + items: + $ref: '#/components/schemas/ResponseLogProb' + required: + - type + - item_id + - output_index + - content_index + - delta + - sequence_number + - logprobs + x-oaiMeta: + name: response.output_text.delta + group: responses + example: | + { + "type": "response.output_text.delta", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "delta": "In", + "sequence_number": 1 + } + ResponseTextDoneEvent: + type: object + description: Emitted when text content is finalized. + properties: + type: + type: string + description: | + The type of the event. Always `response.output_text.done`. + enum: + - response.output_text.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the text content is finalized. + output_index: + type: integer + description: | + The index of the output item that the text content is finalized. + content_index: + type: integer + description: | + The index of the content part that the text content is finalized. + text: + type: string + description: | + The text content that is finalized. + sequence_number: + type: integer + description: The sequence number for this event. + logprobs: + type: array + description: | + The log probabilities of the tokens in the delta. + items: + $ref: '#/components/schemas/ResponseLogProb' + required: + - type + - item_id + - output_index + - content_index + - text + - sequence_number + - logprobs + x-oaiMeta: + name: response.output_text.done + group: responses + example: | + { + "type": "response.output_text.done", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "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.", + "sequence_number": 1 + } + ResponseTextParam: + type: object + description: | + Configuration options for a text response from the model. Can be plain + text or structured JSON data. Learn more: + - [Text inputs and outputs](/docs/guides/text) + - [Structured Outputs](/docs/guides/structured-outputs) + properties: + format: + $ref: '#/components/schemas/TextResponseFormatConfiguration' + verbosity: + $ref: '#/components/schemas/Verbosity' + ResponseUsage: + type: object + description: | + Represents token usage details including input tokens, output tokens, + a breakdown of output tokens, and the total tokens used. + 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 prompt caching](/docs/guides/prompt-caching). + 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. + 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: + type: string + description: | + The type of the event. Always `response.web_search_call.completed`. + enum: + - response.web_search_call.completed + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that the web search call is associated with. + item_id: + type: string + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.web_search_call.completed + group: responses + example: | + { + "type": "response.web_search_call.completed", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 + } + ResponseWebSearchCallInProgressEvent: + type: object + 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`. + enum: + - response.web_search_call.in_progress + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that the web search call is associated with. + item_id: + type: string + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.web_search_call.in_progress + group: responses + example: | + { + "type": "response.web_search_call.in_progress", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 + } + ResponseWebSearchCallSearchingEvent: + type: object + 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`. + enum: + - response.web_search_call.searching + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that the web search call is associated with. + item_id: + type: string + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.web_search_call.searching + group: responses + example: | + { + "type": "response.web_search_call.searching", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 + } + ResponsesClientEvent: + discriminator: + propertyName: type + description: | + Client events accepted by the Responses WebSocket server. + anyOf: + - $ref: '#/components/schemas/ResponsesClientEventResponseCreate' + ResponsesClientEventResponseCreate: + allOf: + - type: object + properties: + type: + type: string + enum: + - response.create + description: | + The type of the client event. Always `response.create`. + x-stainless-const: true + required: + - type + - $ref: '#/components/schemas/CreateResponse' + description: | + Client event for creating a response over a persistent WebSocket connection. + This payload uses the same top-level fields as `POST /v1/responses`. + + Notes: + - `stream` is implicit over WebSocket and should not be sent. + - `background` is not supported over WebSocket. + ResponsesServerEvent: + discriminator: + propertyName: type + description: | + Server events emitted by the Responses WebSocket server. + anyOf: + - $ref: '#/components/schemas/ResponseStreamEvent' + Role: + type: object + description: Details about a role that can be assigned through the public Roles API. + properties: + object: + type: string + enum: + - role + description: Always `role`. + x-stainless-const: true + id: + type: string + description: Identifier for the role. + name: + type: string + description: Unique name for the role. + description: + description: Optional description of the role. + anyOf: + - type: string + - type: 'null' + permissions: + type: array + description: Permissions granted by the role. + items: + type: string + resource_type: + type: string + 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: + - object + - id + - name + - description + - permissions + - resource_type + - predefined_role + x-oaiMeta: + name: The role object + example: | + { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + RoleDeletedResource: + type: object + description: Confirmation payload returned after deleting a role. + properties: + object: + type: string + enum: + - role.deleted + description: Always `role.deleted`. + x-stainless-const: true + id: + type: string + description: Identifier of the deleted role. + deleted: + type: boolean + description: Whether the role was deleted. + required: + - object + - id + - deleted + x-oaiMeta: + name: Role deletion confirmation + example: | + { + "object": "role.deleted", + "id": "role_01J1F8ROLE01", + "deleted": true + } + RoleListResource: + type: object + description: Paginated list of roles assigned to a principal. + properties: + object: + type: string + enum: + - list + 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. + next: + description: Cursor to fetch the next page of results, or `null` when there are no more assignments. + anyOf: + - type: string + - type: 'null' + required: + - object + - data + - has_more + - next + x-oaiMeta: + name: Assigned role list + example: | + { + "object": "list", + "data": [ + { + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false, + "description": "Allows managing organization groups", + "created_at": 1711471533, + "updated_at": 1711472599, + "created_by": "user_abc123", + "created_by_user_obj": { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + }, + "metadata": {} + } + ], + "has_more": false, + "next": null + } + 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 + title: RunGraderRequest + 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' + item: + type: object + description: | + The dataset item provided to the grader. This will be used to populate + the `item` namespace. See [the guide](/docs/guides/graders) for more details. + model_sample: + type: string + description: | + The model sample to be evaluated. This value will be used to populate + the `sample` namespace. See [the guide](/docs/guides/graders) for more details. + The `output_json` variable will be populated if the model sample is a + valid JSON string. + + required: + - grader + - model_sample + RunGraderResponse: + type: object + properties: + reward: + type: number + 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' + sampled_model_name: + anyOf: + - type: string + - type: 'null' + required: + - name + - type + - errors + - execution_time + - scores + - token_usage + - sampled_model_name + sub_rewards: + type: object + additionalProperties: {} + model_grader_token_usage_per_model: + type: object + additionalProperties: {} + required: + - reward + - metadata + - sub_rewards + - model_grader_token_usage_per_model + RunObject: + type: object + title: A run on a thread + description: Represents an execution run on a [thread](/docs/api-reference/threads). + 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: string + enum: + - thread.run + 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](/docs/api-reference/threads) that was executed on as a part of this run. + type: string + assistant_id: + description: The ID of the [assistant](/docs/api-reference/assistants) used for execution of this run. + type: string + 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 + 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' + 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 + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + expires_at: + description: The Unix timestamp (in seconds) for when the run will expire. + type: integer + format: unixtime + nullable: true + started_at: + description: The Unix timestamp (in seconds) for when the run was started. + type: integer + format: unixtime + nullable: true + cancelled_at: + description: The Unix timestamp (in seconds) for when the run was cancelled. + type: integer + format: unixtime + nullable: true + failed_at: + description: The Unix timestamp (in seconds) for when the run failed. + type: integer + format: unixtime + nullable: true + completed_at: + description: The Unix timestamp (in seconds) for when the run was completed. + type: integer + format: unixtime + nullable: true + 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 + model: + description: The model that the [assistant](/docs/api-reference/assistants) used for this run. + type: string + instructions: + description: The instructions that the [assistant](/docs/api-reference/assistants) used for this run. + type: string + tools: + description: The list of tools that the [assistant](/docs/api-reference/assistants) used for this run. + default: [] + type: array + maxItems: 20 + 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 + max_prompt_tokens: + type: integer + nullable: true + description: | + The maximum number of prompt tokens specified to have been used over the course of the run. + minimum: 256 + max_completion_tokens: + type: integer + nullable: true + description: | + The maximum number of completion tokens specified to have been used over the course of the run. + 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: + - 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: The run object + beta: true + example: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1698107661, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699073476, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699073498, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "tools": [{"type": "file_search"}, {"type": "code_interpreter"}], + "metadata": {}, + "incomplete_details": null, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + 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 + title: Run step delta object + description: | + Represents a run step delta i.e. any changed fields on a run step during streaming. + 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: string + enum: + - thread.run.step.delta + 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' + required: + - id + - object + - delta + x-oaiMeta: + name: The run step delta object + beta: true + example: | + { + "id": "step_123", + "object": "thread.run.step.delta", + "delta": { + "step_details": { + "type": "tool_calls", + "tool_calls": [ + { + "index": 0, + "id": "call_123", + "type": "code_interpreter", + "code_interpreter": { "input": "", "outputs": [] } + } + ] + } + } + } + RunStepDeltaStepDetailsMessageCreationObject: + title: Message creation + type: object + description: Details of the message creation by the run step. + properties: + type: + description: Always `message_creation`. + type: string + enum: + - message_creation + 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: + - type + RunStepDeltaStepDetailsToolCallsCodeObject: + title: Code interpreter tool call + type: object + description: Details of the Code Interpreter tool call the run step was involved in. + 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. + 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 + x-stainless-const: true + 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: + - index + - type + RunStepDeltaStepDetailsToolCallsCodeOutputImageObject: + title: Code interpreter image output + type: object + properties: + index: + type: integer + description: The index of the output in the outputs array. + type: + description: Always `image`. + type: string + enum: + - image + x-stainless-const: true + image: + type: object + properties: + file_id: + description: The [file](/docs/api-reference/files) ID of the image. + type: string + required: + - index + - type + RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject: + title: Code interpreter log output + type: object + description: Text output from the Code Interpreter tool call as part of a run step. + properties: + index: + type: integer + description: The index of the output in the outputs array. + type: + description: Always `logs`. + type: string + enum: + - logs + x-stainless-const: true + logs: + type: string + description: The text output from the Code Interpreter tool call. + required: + - index + - type + RunStepDeltaStepDetailsToolCallsFileSearchObject: + title: File search tool call + type: object + 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 + x-stainless-const: true + file_search: + type: object + description: For now, this is always going to be an empty object. + x-oaiTypeLabel: map + required: + - index + - type + - file_search + RunStepDeltaStepDetailsToolCallsFunctionObject: + type: object + title: Function tool call + 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 + 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: + - type: string + description: The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet. + - type: 'null' + required: + - index + - type + RunStepDeltaStepDetailsToolCallsObject: + title: Tool calls + type: object + description: Details of the tool call. + properties: + type: + description: Always `tool_calls`. + type: string + enum: + - tool_calls + 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`. + items: + oneOf: + - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeObject' + - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsFileSearchObject' + - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsFunctionObject' + required: + - type + RunStepDetailsMessageCreationObject: + title: Message creation + type: object + description: Details of the message creation by the run step. + properties: + type: + description: Always `message_creation`. + type: string + enum: + - message_creation + 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 + required: + - type + - message_creation + RunStepDetailsToolCallsCodeObject: + title: Code Interpreter tool call + type: object + description: Details of the Code Interpreter tool call the run step was involved in. + 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 + 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. + 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: + - 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 + image: + type: object + properties: + file_id: + description: The [file](/docs/api-reference/files) ID of the image. + type: string + required: + - file_id + required: + - type + - image + RunStepDetailsToolCallsCodeOutputLogsObject: + title: Code Interpreter log output + type: object + description: Text output from the Code Interpreter tool call as part of a run step. + properties: + type: + description: Always `logs`. + type: string + enum: + - logs + x-stainless-const: true + logs: + type: string + description: The text output from the Code Interpreter tool call. + required: + - type + - logs + RunStepDetailsToolCallsFileSearchObject: + title: File search tool call + type: object + 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 + 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' + 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 + 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 ID of the file that result was found in. + file_name: + 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. + required: + - file_id + - file_name + - score + RunStepDetailsToolCallsFunctionObject: + type: object + title: Function tool call + 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 + 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: + - type: string + description: The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet. + - type: 'null' + required: + - name + - arguments + - output + required: + - id + - type + - function + RunStepDetailsToolCallsObject: + title: Tool calls + type: object + description: Details of the tool call. + properties: + type: + description: Always `tool_calls`. + type: string + enum: + - tool_calls + 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`. + items: + 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. + 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: string + enum: + - thread.run.step + 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](/docs/api-reference/assistants) associated with the run step. + type: string + thread_id: + description: The ID of the [thread](/docs/api-reference/threads) that was run. + type: string + run_id: + description: The ID of the [run](/docs/api-reference/runs) 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: + - $ref: '#/components/schemas/RunStepDetailsMessageCreationObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsObject' + last_error: + 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. + required: + - code + - message + - type: 'null' + expired_at: + 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: 'null' + cancelled_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the run step was cancelled. + type: integer + format: unixtime + - type: 'null' + failed_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the run step failed. + type: integer + format: unixtime + - type: 'null' + completed_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the run step completed. + type: integer + format: unixtime + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + usage: + $ref: '#/components/schemas/RunStepCompletionUsage' + 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 + x-oaiMeta: + name: The run step object + beta: true + example: | + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + 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](/docs/api-reference/run-steps/step-object) is created. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - 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](/docs/api-reference/run-steps/step-object) moves to an `in_progress` state. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - 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](/docs/api-reference/run-steps/step-object) are being streamed. + x-oaiMeta: + dataDescription: '`data` is a [run step delta](/docs/api-reference/assistants-streaming/run-step-delta-object)' + - 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](/docs/api-reference/run-steps/step-object) is completed. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - 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](/docs/api-reference/run-steps/step-object) fails. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - 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](/docs/api-reference/run-steps/step-object) is cancelled. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.expired + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) expires. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + 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](/docs/api-reference/runs/object) is created. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.queued + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) moves to a `queued` status. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - 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](/docs/api-reference/runs/object) moves to an `in_progress` status. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.requires_action + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) moves to a `requires_action` status. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.completed + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) is completed. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.incomplete + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) ends with status `incomplete`. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.failed + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) fails. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.cancelling + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) moves to a `cancelling` status. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.cancelled + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) is cancelled. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.expired + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) expires. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + 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](/docs/api-reference/runs/submitToolOutputs) endpoint. + 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 + description: The function definition. + properties: + 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. + required: + - name + - arguments + required: + - id + - type + - function + ServiceTier: + anyOf: + - type: string + 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](/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier. + - When not set, the default behavior is 'auto'. + + When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. + enum: + - auto + - default + - flex + - scale + - priority + default: auto + - type: 'null' + SpeechAudioDeltaEvent: + type: object + description: Emitted for each chunk of audio data generated during speech synthesis. + properties: + type: + type: string + description: | + The type of the event. Always `speech.audio.delta`. + enum: + - speech.audio.delta + x-stainless-const: true + audio: + type: string + description: | + A chunk of Base64-encoded audio data. + required: + - type + - audio + x-oaiMeta: + name: Stream Event (speech.audio.delta) + group: speech + example: | + { + "type": "speech.audio.delta", + "audio": "base64-encoded-audio-data" + } + SpeechAudioDoneEvent: + type: object + description: Emitted when the speech synthesis is complete and all audio has been streamed. + properties: + type: + type: string + description: | + The type of the event. Always `speech.audio.done`. + enum: + - speech.audio.done + x-stainless-const: true + usage: + type: object + description: | + Token usage statistics for the request. + 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 + required: + - type + - usage + x-oaiMeta: + name: Stream Event (speech.audio.done) + group: speech + example: | + { + "type": "speech.audio.done", + "usage": { + "input_tokens": 14, + "output_tokens": 101, + "total_tokens": 115 + } + } + 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`. + + Note that the overlap must not exceed half of `max_chunk_size_tokens`. + 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' + required: + - type + - static + StopConfiguration: + description: | + Not supported with latest reasoning models `o3` and `o4-mini`. + + Up to 4 sequences where the API will stop generating further tokens. The + returned text will not contain the stop sequence. + default: null + nullable: true + oneOf: + - type: string + default: <|endoftext|> + example: |+ + + 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. + - type: 'null' + required: + - tool_outputs + TextResponseFormatConfiguration: + description: | + An object specifying the format that the model must output. + + Configuring `{ "type": "json_schema" }` enables Structured Outputs, + which ensures the model will match your supplied JSON schema. Learn more in the + [Structured Outputs guide](/docs/guides/structured-outputs). + + The default format is `{ "type": "text" }` with no additional options. + + **Not recommended for gpt-4o and newer models:** + + Setting to `{ "type": "json_object" }` enables the older JSON mode, which + ensures the message the model generates is valid JSON. Using `json_schema` + is preferred for models that support it. + oneOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/TextResponseFormatJsonSchema' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + TextResponseFormatJsonSchema: + type: object + title: JSON schema + description: | + JSON Schema response format. Used to generate structured JSON responses. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). + properties: + type: + type: string + description: The type of response format being defined. Always `json_schema`. + enum: + - json_schema + x-stainless-const: true + description: + type: string + description: | + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - type + - schema + - name + ThreadObject: + type: object + title: Thread + description: Represents a thread that contains [messages](/docs/api-reference/messages). + 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 + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: string + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - id + - object + - created_at + - tool_resources + - metadata + x-oaiMeta: + name: The thread object + beta: true + example: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1698107661, + "metadata": {} + } + 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](/docs/api-reference/threads/object) is created. + x-oaiMeta: + dataDescription: '`data` is a [thread](/docs/api-reference/threads/object)' + ToggleCertificatesRequest: + type: object + properties: + certificate_ids: + type: array + items: + type: string + example: cert_abc + minItems: 1 + maxItems: 10 + required: + - certificate_ids + Tool: + description: | + A tool that can be used to generate a response. + discriminator: + propertyName: type + oneOf: + - $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/ImageGenTool' + - $ref: '#/components/schemas/LocalShellToolParam' + - $ref: '#/components/schemas/FunctionShellToolParam' + - $ref: '#/components/schemas/CustomToolParam' + - $ref: '#/components/schemas/NamespaceToolParam' + - $ref: '#/components/schemas/ToolSearchToolParam' + - $ref: '#/components/schemas/WebSearchPreviewTool' + - $ref: '#/components/schemas/ApplyPatchToolParam' + ToolChoiceAllowed: + type: object + title: Allowed tools + description: | + Constrains the tools available to the model to a pre-defined set. + properties: + type: + type: string + enum: + - allowed_tools + description: Allowed tool configuration type. Always `allowed_tools`. + x-stainless-const: true + mode: + type: string + enum: + - auto + - required + description: | + Constrains the tools available to the model to a pre-defined set. + + `auto` allows the model to pick from among the allowed tools and generate a + message. + + `required` requires the model to call one or more of the allowed tools. + tools: + type: array + description: | + A list of tool definitions that the model should be allowed to call. + + For the Responses API, the list of tool definitions might look like: + ```json + [ + { "type": "function", "name": "get_weather" }, + { "type": "mcp", "server_label": "deepwiki" }, + { "type": "image_generation" } + ] + ``` + items: + type: object + description: | + A tool definition that the model should be allowed to call. + additionalProperties: true + x-oaiExpandable: false + required: + - type + - mode + - tools + ToolChoiceCustom: + type: object + title: Custom tool + description: | + Use this option 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 + name: + type: string + description: The name of the custom tool to call. + required: + - type + - name + ToolChoiceFunction: + type: object + title: Function tool + description: | + Use this option 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 + name: + type: string + description: The name of the function to call. + required: + - type + - name + ToolChoiceMCP: + type: object + title: MCP tool + description: | + Use this option to force the model to call a specific tool on a remote MCP server. + properties: + type: + type: string + enum: + - mcp + description: For MCP tools, the type is always `mcp`. + x-stainless-const: true + server_label: + type: string + description: | + The label of the MCP server to use. + name: + anyOf: + - type: string + description: | + The name of the tool to call on the server. + - type: 'null' + required: + - type + - server_label + ToolChoiceOptions: + type: string + title: Tool choice mode + description: | + Controls which (if any) tool is called by the model. + + `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. + enum: + - none + - auto + - required + ToolChoiceParam: + description: | + How the model should select which tool (or tools) to use when generating + a response. See the `tools` parameter to see how to specify which tools + the model can call. + oneOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceAllowed' + - $ref: '#/components/schemas/ToolChoiceTypes' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + - $ref: '#/components/schemas/ToolChoiceCustom' + - $ref: '#/components/schemas/SpecificApplyPatchParam' + - $ref: '#/components/schemas/SpecificFunctionShellParam' + ToolChoiceTypes: + type: object + title: Hosted tool + description: | + Indicates that the model should use a built-in tool to generate a response. + [Learn more about built-in tools](/docs/guides/tools). + properties: + type: + type: string + description: | + The type of hosted tool the model should to use. Learn more about + [built-in tools](/docs/guides/tools). + + Allowed values are: + - `file_search` + - `web_search_preview` + - `computer` + - `computer_use_preview` + - `computer_use` + - `code_interpreter` + - `image_generation` + enum: + - file_search + - web_search_preview + - computer + - computer_use_preview + - computer_use + - web_search_preview_2025_03_11 + - image_generation + - code_interpreter + required: + - type + ToolsArray: + 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. + + We support the following categories of tools: + - **Built-in tools**: Tools that are provided by OpenAI that extend the + model's capabilities, like [web search](/docs/guides/tools-web-search) + or [file search](/docs/guides/tools-file-search). Learn more about + [built-in tools](/docs/guides/tools). + - **MCP Tools**: Integrations with third-party systems via custom MCP servers + or predefined connectors such as Google Drive and SharePoint. Learn more about + [MCP Tools](/docs/guides/tools-connectors-mcp). + - **Function calls (custom tools)**: Functions that are defined by you, + enabling the model to call your own code with strongly typed arguments + and outputs. Learn more about + [function calling](/docs/guides/function-calling). You can also use + custom tools to call your own code. + 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](/docs/api-reference/audio/create-transcription) with the `Stream` parameter set to `true`. + properties: + type: + type: string + description: | + The type of the event. Always `transcript.text.delta`. + enum: + - transcript.text.delta + x-stainless-const: true + delta: + type: string + description: | + The text delta that was additionally transcribed. + logprobs: + type: array + description: | + The log probabilities of the delta. Only included if you [create a transcription](/docs/api-reference/audio/create-transcription) with the `include[]` parameter set to `logprobs`. + items: + type: object + properties: + token: + type: string + description: | + The token that was used to generate the log probability. + logprob: + type: number + description: | + The log probability of the token. + bytes: + type: array + items: + type: integer + description: | + The bytes that were used to generate the log probability. + segment_id: + type: string + description: | + Identifier of the diarized segment that this delta belongs to. Only present when using `gpt-4o-transcribe-diarize`. + required: + - type + - delta + x-oaiMeta: + name: Stream Event (transcript.text.delta) + group: transcript + example: | + { + "type": "transcript.text.delta", + "delta": " wonderful" + } + TranscriptTextDoneEvent: + type: object + description: Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](/docs/api-reference/audio/create-transcription) with the `Stream` parameter set to `true`. + properties: + type: + type: string + description: | + The type of the event. Always `transcript.text.done`. + enum: + - transcript.text.done + x-stainless-const: true + text: + type: string + description: | + The text that was transcribed. + logprobs: + type: array + description: | + The log probabilities of the individual tokens in the transcription. Only included if you [create a transcription](/docs/api-reference/audio/create-transcription) with the `include[]` parameter set to `logprobs`. + items: + type: object + properties: + token: + type: string + description: | + The token that was used to generate the log probability. + logprob: + type: number + description: | + The log probability of the token. + bytes: + type: array + items: + type: integer + description: | + The bytes that were used to generate the log probability. + usage: + $ref: '#/components/schemas/TranscriptTextUsageTokens' + required: + - type + - text + x-oaiMeta: + name: Stream Event (transcript.text.done) + group: transcript + example: | + { + "type": "transcript.text.done", + "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.", + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 10, + "audio_tokens": 4 + }, + "output_tokens": 31, + "total_tokens": 45 + } + } + TranscriptTextSegmentEvent: + type: object + description: | + Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you [create a transcription](/docs/api-reference/audio/create-transcription) with `stream` set to `true` and `response_format` set to `diarized_json`. + properties: + type: + type: string + description: The type of the event. Always `transcript.text.segment`. + enum: + - transcript.text.segment + 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. + speaker: + type: string + description: Speaker label for this segment. + required: + - type + - id + - start + - end + - text + - speaker + x-oaiMeta: + name: Stream Event (transcript.text.segment) + group: transcript + example: | + { + "type": "transcript.text.segment", + "id": "seg_002", + "start": 5.2, + "end": 12.8, + "text": "Hi, I need help with diarization.", + "speaker": "A" + } + 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 + TranscriptTextUsageTokens: + type: object + title: Token Usage + description: Usage statistics for models billed by token usage. + properties: + type: + type: string + enum: + - tokens + description: The type of the usage object. Always `tokens` for this variant. + x-stainless-const: true + input_tokens: + type: integer + description: Number of input tokens billed for this request. + 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: Number of output tokens generated. + total_tokens: + type: integer + description: Total number of tokens used (input + output). + required: + - type + - input_tokens + - output_tokens + - total_tokens + TranscriptionChunkingStrategy: + type: object + 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. + oneOf: + - type: string + enum: + - auto + default: + - auto + description: | + Automatically set chunking parameters based on the audio. Must be set to `"auto"`. + x-stainless-const: true + - $ref: '#/components/schemas/VadConfig' + TranscriptionDiarizedSegment: + type: object + description: A segment of diarized transcript text with speaker metadata. + properties: + type: + type: string + description: | + The type of the segment. Always `transcript.text.segment`. + enum: + - transcript.text.segment + 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. + 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`, ...). + required: + - type + - id + - start + - end + - text + - speaker + TranscriptionInclude: + type: string + enum: + - logprobs + default: [] + TranscriptionSegment: + type: object + 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. + end: + type: number + format: double + description: End time of the segment in seconds. + text: + 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. + 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. + 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: + - 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 + 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: New display name for the group. + minLength: 1 + maxLength: 255 + required: + - name + x-oaiMeta: + example: | + { + "name": "Escalations" + } + UpdateVectorStoreFileAttributesRequest: + type: object + additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + required: + - attributes + x-oaiMeta: + name: Update vector store file attributes request + UpdateVectorStoreRequest: + type: object + additionalProperties: false + properties: + name: + description: The name of the vector store. + type: string + nullable: true + 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 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. + 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: + 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](/docs/api-reference/files/object#files/object-purpose) for acceptable values. + status: + type: string + description: The status of the Upload. + enum: + - pending + - completed + - cancelled + - expired + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the Upload will expire. + object: + type: string + description: The object type, which is always "upload". + enum: + - upload + x-stainless-const: true + file: + allOf: + - $ref: '#/components/schemas/OpenAIFile' + - nullable: true + description: The ready File object after the Upload is completed. + required: + - bytes + - created_at + - expires_at + - filename + - id + - purpose + - status + x-oaiMeta: + name: The upload object + example: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "completed", + "expires_at": 1719127296, + "file": { + "id": "file-xyz321", + "object": "file", + "bytes": 2147483648, + "created_at": 1719186911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + } + } + UploadCertificateRequest: + type: object + properties: + name: + type: string + description: An optional name for the certificate + certificate: + type: string + description: The certificate content in PEM format + required: + - certificate + UploadPart: + type: object + title: UploadPart + description: | + The upload Part represents a chunk of bytes we can add to an Upload object. + 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. + 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: + - upload.part + x-stainless-const: true + required: + - created_at + - id + - object + - upload_id + x-oaiMeta: + name: The upload part object + example: | + { + "id": "part_def456", + "object": "upload.part", + "created_at": 1719186911, + "upload_id": "upload_abc123" + } + UsageAudioSpeechesResult: + type: object + description: The aggregated audio speeches usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.audio_speeches.result + 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. + 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: + - object + - characters + - num_model_requests + x-oaiMeta: + name: Audio speeches usage object + example: | + { + "object": "organization.usage.audio_speeches.result", + "characters": 45, + "num_model_requests": 1, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "tts-1" + } + UsageAudioTranscriptionsResult: + type: object + description: The aggregated audio transcriptions usage details of the specific time bucket. + 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: + 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: + - object + - seconds + - num_model_requests + x-oaiMeta: + name: Audio transcriptions usage object + example: | + { + "object": "organization.usage.audio_transcriptions.result", + "seconds": 10, + "num_model_requests": 1, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "tts-1" + } + UsageCodeInterpreterSessionsResult: + type: object + description: The aggregated code interpreter sessions usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.code_interpreter_sessions.result + 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' + required: + - object + - num_sessions + x-oaiMeta: + name: Code interpreter sessions usage object + example: | + { + "object": "organization.usage.code_interpreter_sessions.result", + "num_sessions": 1, + "project_id": "proj_abc" + } + UsageCompletionsResult: + type: object + description: The aggregated completions usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.completions.result + x-stainless-const: true + input_tokens: + type: integer + description: The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + input_cached_tokens: + type: integer + description: The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + output_tokens: + type: integer + description: The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + input_audio_tokens: + type: integer + description: The aggregated number of audio input tokens used, including cached tokens. + output_audio_tokens: + type: integer + description: The aggregated number of audio 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. + - 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' + batch: + anyOf: + - type: boolean + description: When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + - type: 'null' + service_tier: + anyOf: + - type: string + description: When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + - type: 'null' + required: + - object + - input_tokens + - output_tokens + - num_model_requests + x-oaiMeta: + name: Completions usage object + example: | + { + "object": "organization.usage.completions.result", + "input_tokens": 5000, + "output_tokens": 1000, + "input_cached_tokens": 4000, + "input_audio_tokens": 300, + "output_audio_tokens": 200, + "num_model_requests": 5, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "gpt-4o-mini-2024-07-18", + "batch": false, + "service_tier": "default" + } + UsageEmbeddingsResult: + type: object + description: The aggregated embeddings usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.embeddings.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' + 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: + - object + - input_tokens + - num_model_requests + x-oaiMeta: + name: Embeddings usage object + example: | + { + "object": "organization.usage.embeddings.result", + "input_tokens": 20, + "num_model_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "text-embedding-ada-002-v2" + } + UsageImagesResult: + type: object + description: The aggregated images usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.images.result + x-stainless-const: true + images: + type: integer + description: The number of images processed. + num_model_requests: + type: integer + 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: + - object + - images + - num_model_requests + x-oaiMeta: + name: Images usage object + example: | + { + "object": "organization.usage.images.result", + "images": 2, + "num_model_requests": 2, + "size": "1024x1024", + "source": "image.generation", + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "dall-e-3" + } + UsageModerationsResult: + type: object + description: The aggregated moderations usage details of the specific time bucket. + properties: + object: + 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' + 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: + - object + - input_tokens + - num_model_requests + x-oaiMeta: + name: Moderations usage object + example: | + { + "object": "organization.usage.moderations.result", + "input_tokens": 20, + "num_model_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "text-moderation" + } + UsageResponse: + type: object + properties: + object: + 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' + required: + - object + - data + - has_more + - next_page + UsageTimeBucket: + type: object + properties: + object: + 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/CostsResult' + discriminator: + propertyName: object + required: + - object + - start_time + - end_time + - results + UsageVectorStoresResult: + type: object + description: The aggregated vector stores usage details of the specific time bucket. + properties: + object: + 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' + required: + - object + - usage_bytes + x-oaiMeta: + name: Vector stores usage object + example: | + { + "object": "organization.usage.vector_stores.result", + "usage_bytes": 1024, + "project_id": "proj_abc" + } + User: + type: object + description: Represents an individual `user` within an organization. + properties: + object: + type: string + enum: + - organization.user + description: The object type, which is always `organization.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: + anyOf: + - 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 + 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: The user object + example: | + { + "object": "organization.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + UserDeleteResponse: + type: object + properties: + object: + type: string + enum: + - organization.user.deleted + x-stainless-const: true + id: + type: string + deleted: + type: boolean + required: + - object + - id + - deleted + UserListResource: + type: object + description: Paginated list of user objects returned when inspecting group membership. + properties: + object: + 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. + next: + description: Cursor to fetch the next page of results, or `null` when no further users are available. + anyOf: + - type: string + - type: 'null' + required: + - object + - data + - has_more + - next + x-oaiMeta: + name: Group user list + example: | + { + "object": "list", + "data": [ + { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + } + ], + "has_more": false, + "next": null + } + UserListResponse: + type: object + properties: + object: + type: string + enum: + - list + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/User' + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean + required: + - object + - data + - has_more + UserRoleAssignment: + type: object + description: Role assignment linking a user to a role. + properties: + object: + type: string + enum: + - user.role + description: Always `user.role`. + x-stainless-const: true + user: + $ref: '#/components/schemas/User' + role: + $ref: '#/components/schemas/Role' + required: + - object + - user + - role + x-oaiMeta: + name: The user role object + example: | + { + "object": "user.role", + "user": { + "object": "organization.user", + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com", + "role": "owner", + "added_at": 1711470000 + }, + "role": { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + } + UserRoleUpdateRequest: + type: object + properties: + role: + anyOf: + - type: string + - type: 'null' + description: '`owner` or `reader`' + role_id: + anyOf: + - type: string + - type: 'null' + description: Role ID to assign to the user. + technical_level: + anyOf: + - type: string + - type: 'null' + description: Technical level metadata. + developer_persona: + anyOf: + - type: string + - type: 'null' + description: Developer persona metadata. + VadConfig: + type: object + additionalProperties: false + required: + - type + properties: + type: + 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 + milliseconds). + silence_duration_ms: + type: integer + default: 200 + description: | + Duration of silence to detect speech stop (in milliseconds). + With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + threshold: + type: number + default: 0.5 + description: | + Sensitivity threshold (0.0 to 1.0) for voice activity detection. A + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + ValidateGraderRequest: + 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' + required: + - grader + ValidateGraderResponse: + 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' + VectorStoreExpirationAfter: + 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: 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 + required: + - anchor + - days + VectorStoreFileAttributes: + anyOf: + - 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. Keys are strings + with a maximum length of 64 characters. Values are strings with a maximum + length of 512 characters, booleans, or numbers. + maxProperties: 16 + propertyNames: + type: string + maxLength: 64 + additionalProperties: + oneOf: + - type: string + maxLength: 512 + - type: number + - type: boolean + x-oaiTypeLabel: map + - type: 'null' + VectorStoreFileBatchObject: + 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: 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](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/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: + - id + - object + - created_at + - vector_store_id + - status + - file_counts + x-oaiMeta: + name: The vector store files batch object + beta: true + example: | + { + "id": "vsfb_123", + "object": "vector_store.files_batch", + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "failed": 0, + "cancelled": 0, + "total": 100 + } + } + VectorStoreFileContentResponse: + type: object + description: Represents the parsed content of a vector store file. + properties: + object: + 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' + required: + - object + - data + - has_more + - next_page + VectorStoreFileObject: + 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: 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 + vector_store_id: + description: The ID of the [vector store](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/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: + - 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' + 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: | + { + "id": "file-abc123", + "object": "vector_store.file", + "usage_bytes": 1234, + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "last_error": null, + "chunking_strategy": { + "type": "static", + "static": { + "max_chunk_size_tokens": 800, + "chunk_overlap_tokens": 400 + } + } + } + VectorStoreObject: + 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: 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 + 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 + enum: + - expired + - in_progress + - completed + expires_after: + $ref: '#/components/schemas/VectorStoreExpirationAfter' + 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: + - id + - object + - usage_bytes + - created_at + - status + - last_active_at + - name + - file_counts + - metadata + x-oaiMeta: + name: The vector store object + example: | + { + "id": "vs_123", + "object": "vector_store", + "created_at": 1698107661, + "usage_bytes": 123456, + "last_active_at": 1698107661, + "name": "my_vector_store", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "cancelled": 0, + "failed": 0, + "total": 100 + }, + "last_used_at": 1698107661 + } + VectorStoreSearchRequest: + type: object + additionalProperties: false + properties: + 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 + rewrite_query: + description: Whether to rewrite the natural language query for vector search. + type: boolean + default: false + 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 + filters: + description: A filter to apply based on file attributes. + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $ref: '#/components/schemas/CompoundFilter' + 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 + VectorStoreSearchResultContentObject: + type: object + additionalProperties: false + properties: + type: + description: The type of content. + type: string + enum: + - text + text: + description: The text content returned from search. + type: string + required: + - type + - text + x-oaiMeta: + name: Vector store search result content object + VectorStoreSearchResultItem: + type: object + additionalProperties: false + properties: + file_id: + type: string + description: The ID of the vector store file. + filename: + 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' + required: + - file_id + - filename + - score + - attributes + - content + x-oaiMeta: + name: Vector store search result item + VectorStoreSearchResultsPage: + type: object + additionalProperties: false + properties: + object: + 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' + has_more: + type: boolean + description: Indicates if there are more results to fetch. + next_page: + anyOf: + - type: string + description: The token for the next page, if any. + - type: 'null' + required: + - object + - search_query + - data + - has_more + - next_page + x-oaiMeta: + name: Vector store search results page + Verbosity: + anyOf: + - type: string + enum: + - low + - medium + - high + default: medium + description: | + Constrains the verbosity of the model's response. Lower values will result in + more concise responses, while higher values will result in more verbose responses. + Currently supported values are `low`, `medium`, and `high`. + - type: 'null' + VoiceConsentDeletedResource: + type: object + additionalProperties: false + properties: + id: + type: string + description: The consent recording identifier. + example: cons_1234 + object: + type: string + enum: + - audio.voice_consent + x-stainless-const: true + deleted: + type: boolean + required: + - id + - object + - deleted + x-oaiMeta: + name: The voice consent deletion object + example: | + { + "object": "audio.voice_consent", + "id": "cons_1234", + "deleted": true + } + VoiceConsentListResource: + type: object + additionalProperties: false + properties: + object: + type: string + enum: + - list + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/VoiceConsentResource' + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean + required: + - object + - data + - has_more + x-oaiMeta: + name: The voice consent list object + example: | + { + "object": "list", + "data": [ + { + "object": "audio.voice_consent", + "id": "cons_1234", + "name": "John Doe", + "language": "en-US", + "created_at": 1734220800 + } + ], + "first_id": "cons_1234", + "last_id": "cons_1234", + "has_more": false + } + VoiceConsentResource: + 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 + name: + type: string + description: The label provided when the consent recording was uploaded. + language: + type: string + description: The BCP 47 language tag for the consent phrase (for example, `en-US`). + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the consent recording was created. + required: + - object + - id + - name + - language + - created_at + x-oaiMeta: + name: The voice consent object + example: | + { + "object": "audio.voice_consent", + "id": "cons_1234", + "name": "John Doe", + "language": "en-US", + "created_at": 1734220800 + } + VoiceIdsOrCustomVoice: + title: Voice + description: | + A built-in voice name or a custom voice reference. + 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 + title: Voice + description: A custom voice that can be used for audio output. + additionalProperties: false + properties: + object: + 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. + name: + type: string + description: The name of the voice. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the voice was created. + required: + - object + - id + - name + - created_at + x-oaiMeta: + name: The voice object + example: | + { + "object": "audio.voice", + "id": "voice_123abc", + "name": "My new voice", + "created_at": 1734220800 + } + WebSearchActionFind: + type: object + title: Find action + description: | + Action type "find_in_page": Searches for a pattern within a loaded page. + properties: + type: + type: string + enum: + - find_in_page + description: | + The action type. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the page searched for the pattern. + pattern: + type: string + description: | + The pattern or text to search for within the page. + required: + - type + - url + - pattern + WebSearchActionOpenPage: + type: object + title: Open page action + description: | + Action type "open_page" - Opens a specific URL from search results. + properties: + type: + type: string + enum: + - open_page + description: | + The action type. + x-stainless-const: true + url: + description: | + The URL opened by the model. + anyOf: + - type: string + format: uri + - type: 'null' + required: + - type + WebSearchActionSearch: + type: object + title: Search action + description: | + Action type "search" - Performs a web search query. + properties: + type: + type: string + enum: + - search + description: | + The action type. + x-stainless-const: true + query: + type: string + description: | + [DEPRECATED] The search query. + queries: + type: array + title: Search queries + description: | + The search queries. + items: + type: string + description: | + A search query. + sources: + type: array + title: Web search sources + description: | + The sources used in the search. + items: + type: object + title: Web search source + description: | + A source used in the search. + properties: + type: + type: string + enum: + - url + description: | + The type of source. Always `url`. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the source. + required: + - type + - url + required: + - type + - query + WebSearchApproximateLocation: + anyOf: + - type: object + title: Web search approximate location + description: | + The approximate location of the user. + 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 + search. One of `low`, `medium`, or `high`. `medium` is the default. + enum: + - low + - medium + - high + default: medium + WebSearchLocation: + type: object + title: Web search location + description: Approximate location parameters for the search. + properties: + country: + type: string + description: | + The two-letter + [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, + e.g. `US`. + region: + type: string + description: | + Free text input for the region of the user, e.g. `California`. + city: + type: string + description: | + Free text input for the city of the user, e.g. `San Francisco`. + timezone: + type: string + description: | + The [IANA timezone](https://timeapi.io/documentation/iana-timezones) + of the user, e.g. `America/Los_Angeles`. + WebSearchTool: + type: object + title: Web search + description: | + Search the Internet for sources related to the prompt. Learn more about the + [web search tool](/docs/guides/tools-web-search). + properties: + type: + 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 + filters: + anyOf: + - type: object + description: | + Filters for the search. + 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. + Subdomains of the provided domains are allowed as well. + + Example: `["pubmed.ncbi.nlm.nih.gov"]` + items: + type: string + description: Allowed domain for the search. + default: [] + - type: 'null' + - type: 'null' + user_location: + $ref: '#/components/schemas/WebSearchApproximateLocation' + search_context_size: + 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. + required: + - type + WebSearchToolCall: + type: object + title: Web search tool call + description: | + The results of a web search tool call. See the + [web search guide](/docs/guides/tools-web-search) for more information. + properties: + id: + type: string + description: | + The unique ID of the web search tool call. + type: + type: string + enum: + - web_search_call + description: | + The type of the web search tool call. Always `web_search_call`. + x-stainless-const: true + status: + type: string + description: | + The status of the web search tool call. + enum: + - in_progress + - searching + - completed + - failed + action: + type: object + description: | + An object describing the specific action taken in this web search call. + Includes details on how the model used the web (search, open_page, find_in_page). + oneOf: + - $ref: '#/components/schemas/WebSearchActionSearch' + - $ref: '#/components/schemas/WebSearchActionOpenPage' + - $ref: '#/components/schemas/WebSearchActionFind' + discriminator: + propertyName: type + required: + - id + - type + - status + - action + WebhookBatchCancelled: + type: object + title: batch.cancelled + description: | + Sent when a batch API request has been cancelled. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.cancelled`. + enum: + - batch.cancelled + x-stainless-const: true + x-oaiMeta: + name: batch.cancelled + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "batch.cancelled", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } + } + WebhookBatchCompleted: + type: object + title: batch.completed + description: | + Sent when a batch API request has been completed. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.completed`. + enum: + - batch.completed + x-stainless-const: true + x-oaiMeta: + name: batch.completed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "batch.completed", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } + } + WebhookBatchExpired: + type: object + title: batch.expired + description: | + Sent when a batch API request has expired. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.expired`. + enum: + - batch.expired + x-stainless-const: true + x-oaiMeta: + name: batch.expired + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "batch.expired", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } + } + WebhookBatchFailed: + type: object + title: batch.failed + description: | + Sent when a batch API request has failed. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.failed`. + enum: + - batch.failed + x-stainless-const: true + x-oaiMeta: + name: batch.failed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "batch.failed", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } + } + WebhookEvalRunCanceled: + type: object + title: eval.run.canceled + description: | + Sent when an eval run has been canceled. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the eval run. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `eval.run.canceled`. + enum: + - eval.run.canceled + x-stainless-const: true + x-oaiMeta: + name: eval.run.canceled + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "eval.run.canceled", + "created_at": 1719168000, + "data": { + "id": "evalrun_abc123" + } + } + WebhookEvalRunFailed: + type: object + title: eval.run.failed + description: | + Sent when an eval run has failed. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the eval run. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `eval.run.failed`. + enum: + - eval.run.failed + x-stainless-const: true + x-oaiMeta: + name: eval.run.failed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "eval.run.failed", + "created_at": 1719168000, + "data": { + "id": "evalrun_abc123" + } + } + WebhookEvalRunSucceeded: + type: object + title: eval.run.succeeded + description: | + Sent when an eval run has succeeded. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the eval run. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `eval.run.succeeded`. + enum: + - eval.run.succeeded + x-stainless-const: true + x-oaiMeta: + name: eval.run.succeeded + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "eval.run.succeeded", + "created_at": 1719168000, + "data": { + "id": "evalrun_abc123" + } + } + WebhookFineTuningJobCancelled: + type: object + title: fine_tuning.job.cancelled + description: | + Sent when a fine-tuning job has been cancelled. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the fine-tuning job. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `fine_tuning.job.cancelled`. + enum: + - fine_tuning.job.cancelled + x-stainless-const: true + x-oaiMeta: + name: fine_tuning.job.cancelled + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "fine_tuning.job.cancelled", + "created_at": 1719168000, + "data": { + "id": "ftjob_abc123" + } + } + WebhookFineTuningJobFailed: + type: object + title: fine_tuning.job.failed + description: | + Sent when a fine-tuning job has failed. + 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 failed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the fine-tuning job. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `fine_tuning.job.failed`. + enum: + - fine_tuning.job.failed + x-stainless-const: true + x-oaiMeta: + name: fine_tuning.job.failed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "fine_tuning.job.failed", + "created_at": 1719168000, + "data": { + "id": "ftjob_abc123" + } + } + WebhookFineTuningJobSucceeded: + type: object + title: fine_tuning.job.succeeded + description: | + Sent when a fine-tuning job has succeeded. + 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. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the fine-tuning job. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `fine_tuning.job.succeeded`. + enum: + - fine_tuning.job.succeeded + x-stainless-const: true + x-oaiMeta: + name: fine_tuning.job.succeeded + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "fine_tuning.job.succeeded", + "created_at": 1719168000, + "data": { + "id": "ftjob_abc123" + } + } + WebhookRealtimeCallIncoming: + type: object + title: realtime.call.incoming + description: | + Sent when Realtime API Receives a incoming SIP call. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the model response was completed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - call_id + - sip_headers + properties: + call_id: + type: string + description: | + The unique ID of this call. + sip_headers: + type: array + description: | + Headers from the SIP Invite. + items: + type: object + description: | + A header from the SIP Invite. + required: + - name + - value + properties: + name: + type: string + description: | + Name of the SIP Header. + value: + type: string + description: | + Value of the SIP Header. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `realtime.call.incoming`. + enum: + - realtime.call.incoming + x-stainless-const: true + x-oaiMeta: + name: realtime.call.incoming + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "realtime.call.incoming", + "created_at": 1719168000, + "data": { + "call_id": "rtc_479a275623b54bdb9b6fbae2f7cbd408", + "sip_headers": [ + {"name": "Max-Forwards", "value": "63"}, + {"name": "CSeq", "value": "851287 INVITE"}, + {"name": "Content-Type", "value": "application/sdp"}, + ] + } + } + WebhookResponseCancelled: + type: object + title: response.cancelled + description: | + Sent when a background response has been cancelled. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the model response was cancelled. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.cancelled`. + enum: + - response.cancelled + x-stainless-const: true + x-oaiMeta: + name: response.cancelled + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.cancelled", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + WebhookResponseCompleted: + type: object + title: response.completed + description: | + Sent when a background response has been completed. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the model response was completed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.completed`. + enum: + - response.completed + x-stainless-const: true + x-oaiMeta: + name: response.completed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.completed", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + WebhookResponseFailed: + type: object + title: response.failed + description: | + Sent when a background response has failed. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the model response failed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.failed`. + enum: + - response.failed + x-stainless-const: true + x-oaiMeta: + name: response.failed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.failed", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + WebhookResponseIncomplete: + type: object + title: response.incomplete + description: | + Sent when a background response has been interrupted. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the model response was interrupted. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.incomplete`. + enum: + - response.incomplete + x-stainless-const: true + x-oaiMeta: + name: response.incomplete + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.incomplete", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + 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 + skill_id: + type: string + maxLength: 64 + minLength: 1 + description: The ID of the referenced skill. + 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 + 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. + 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 + name: + type: string + description: The name of the skill. + 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: + - `web_search_call.results`: Include the search results of the web search tool call. + - `web_search_call.action.sources`: Include the sources of the web search tool call. + - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items. + - `computer_call_output.output.image_url`: Include image urls from the computer call output. + - `file_search_call.results`: Include the search results of the file search tool call. + - `message.input_image.image_url`: Include image urls from the input message. + - `message.output_text.logprobs`: Include logprobs with assistant messages. + - `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 + 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. + 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 of the file in the list of files. + 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. + start_index: + type: integer + description: The index of the first character of the container file citation in the message. + 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: + - $ref: '#/components/schemas/FileCitationBody' + - $ref: '#/components/schemas/UrlCitationBody' + - $ref: '#/components/schemas/ContainerFileCitationBody' + - $ref: '#/components/schemas/FilePath' + description: An annotation that applies to a span of output text. + discriminator: + propertyName: type + TopLogProb: + properties: + token: + type: string + logprob: + type: number + 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 + logprob: + type: number + bytes: + items: + type: integer + type: array + 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 + text: + type: string + description: The text output from the model. + annotations: + items: + $ref: '#/components/schemas/Annotation' + type: array + description: The annotations of the text output. + 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 + 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 + 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 + 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 + 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' + file_id: + anyOf: + - type: string + description: The ID of the file to be sent to the model. + - type: 'null' + 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`. + type: object + required: + - type + - detail + title: Input image + description: An image input to the model. Learn about [image inputs](/docs/guides/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: + - type: string + format: uri + description: The URL of the screenshot image. + - type: 'null' + file_id: + anyOf: + - type: string + description: The identifier of an uploaded file that contains the screenshot. + - 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`. + type: object + required: + - type + - image_url + - file_id + - detail + title: Computer screenshot + description: A screenshot of a computer. + FileInputDetail: + type: string + enum: + - 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: + - type: string + description: The ID of the file to be sent to the model. + - type: 'null' + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + 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 `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`. + type: object + required: + - type + title: Input file + description: A file input to the model. + MessagePhase-2: + type: string + enum: + - commentary + - final_answer + 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/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: 'null' + type: object + required: + - type + - id + - status + - role + - content + title: Message + description: A message to or from the model. + FunctionCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + FunctionCallOutputStatusEnum: + type: string + enum: + - in_progress + - completed + - incomplete + 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: + anyOf: + - items: + type: string + type: array + description: The keys being held while clicking. + - 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: + 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 + 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 + ``` + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ] + ``` + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while dragging the mouse. + - type: 'null' + 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 + keys: + items: + 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 + x: + type: integer + description: The x-coordinate to move to. + 'y': + type: integer + description: The y-coordinate to move to. + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while moving the mouse. + - 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 + 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: + - items: + type: string + type: array + description: The keys being held while scrolling. + - 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: object + required: + - type + - text + title: Type + description: An action to type in text. + WaitParam: + 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 + type: object + required: + - type + title: Wait + description: A wait action. + ComputerCallSafetyCheckParam: + properties: + id: + type: string + description: The ID of the pending safety check. + code: + anyOf: + - type: string + 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: + - id + description: A pending safety check for the computer call. + ComputerCallOutputStatus: + type: string + enum: + - completed + - incomplete + - failed + ToolSearchExecutionType: + type: string + enum: + - server + - client + ToolSearchCall: + properties: + 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 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 + FunctionTool: + properties: + type: + type: string + enum: + - function + description: The type of the function tool. Always `function`. + default: function + x-stainless-const: true + name: + type: string + description: The name of the function to call. + 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' + strict: + anyOf: + - type: boolean + description: Whether to enforce strict parameter validation. Default `true`. + - type: 'null' + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + 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://platform.openai.com/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. + type: object + required: + - embedding_weight + - text_weight + RankingOptions: + properties: + 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: + type: string + enum: + - file_search + description: The type of the file search tool. Always `file_search`. + default: file_search + x-stainless-const: true + 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: + - 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://platform.openai.com/docs/guides/tools-file-search). + ComputerTool: + properties: + type: + type: string + enum: + - computer + description: The type of the computer tool. Always `computer`. + default: computer + x-stainless-const: true + type: object + required: + - type + title: Computer + description: A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). + ComputerEnvironment: + type: string + enum: + - windows + - mac + - linux + - ubuntu + - browser + ComputerUsePreviewTool: + properties: + type: + type: string + enum: + - computer_use_preview + description: The type of the computer use tool. Always `computer_use_preview`. + default: computer_use_preview + x-stainless-const: true + 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: + - 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://platform.openai.com/docs/guides/tools-computer-use). + ContainerMemoryLimit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + AutoCodeInterpreterToolParam: + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + anyOf: + - $ref: '#/components/schemas/ContainerMemoryLimit' + description: The memory limit for the code interpreter container. + - type: 'null' + network_policy: + oneOf: + - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' + - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' + description: Network access policy for the container. + discriminator: + propertyName: type + 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. + 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`. + ImageGenActionEnum: + type: string + enum: + - generate + - edit + - auto + LocalShellToolParam: + properties: + type: + type: string + enum: + - local_shell + description: The type of the local shell tool. Always `local_shell`. + default: local_shell + x-stainless-const: true + type: object + required: + - type + title: Local shell tool + description: A tool that allows the model to execute shell commands in a local environment. + ContainerAutoParam: + properties: + type: + type: string + enum: + - container_auto + description: Automatically creates a container for this request + default: container_auto + 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. + memory_limit: + anyOf: + - $ref: '#/components/schemas/ContainerMemoryLimit' + description: The memory limit for the container. + - type: 'null' + network_policy: + oneOf: + - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' + - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' + description: Network access policy for the container. + discriminator: + propertyName: type + 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. + type: object + required: + - type + LocalSkillParam: + properties: + name: + type: string + description: The name of the skill. + description: + type: string + description: The description of the skill. + path: + type: string + description: The path to the directory containing the skill. + type: object + required: + - name + - description + - path + LocalEnvironmentParam: + properties: + type: + type: string + enum: + - local + 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. + type: object + required: + - type + ContainerReferenceParam: + properties: + type: + type: string + enum: + - container_reference + description: References a container created with the /v1/containers endpoint + default: container_reference + x-stainless-const: true + container_id: + type: string + description: The ID of the referenced container. + example: cntr_123 + type: object + required: + - type + - container_id + FunctionShellToolParam: + properties: + type: + type: string + enum: + - shell + description: The type of the shell tool. Always `shell`. + default: shell + x-stainless-const: true + environment: + anyOf: + - oneOf: + - $ref: '#/components/schemas/ContainerAutoParam' + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + discriminator: + propertyName: type + - type: 'null' + type: object + required: + - type + title: Shell tool + description: A tool that allows the model to execute shell commands. + CustomTextFormatParam: + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + x-stainless-const: true + type: object + required: + - type + title: Text format + description: Unconstrained free-form text. + GrammarSyntax1: + type: string + enum: + - lark + - regex + CustomGrammarFormatParam: + properties: + type: + type: string + enum: + - grammar + description: Grammar format. Always `grammar`. + default: grammar + 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. + type: object + required: + - type + - syntax + - definition + title: Grammar format + description: A grammar defined by the user. + CustomToolParam: + properties: + type: + type: string + enum: + - custom + description: The type of the custom tool. Always `custom`. + default: custom + x-stainless-const: true + 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. + format: + oneOf: + - $ref: '#/components/schemas/CustomTextFormatParam' + - $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. + type: object + required: + - type + - name + title: Custom tool + description: A custom tool that processes input using a specified format. Learn more about [custom tools](/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_-]+$ + description: + anyOf: + - type: string + - type: 'null' + parameters: + anyOf: + - $ref: '#/components/schemas/EmptyModelParam' + - type: 'null' + strict: + anyOf: + - type: boolean + - type: 'null' + type: + type: string + enum: + - function + default: function + x-stainless-const: true + defer_loading: + type: boolean + description: Whether this function should be deferred and discovered via tool search. + type: object + required: + - name + - type + NamespaceToolParam: + 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 + minLength: 1 + description: A description of the namespace shown to the model. + 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 + 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' + parameters: + anyOf: + - $ref: '#/components/schemas/EmptyModelParam' + description: Parameter schema for a client-executed tool search tool. + - type: 'null' + 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: 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: 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: 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 + user_location: + anyOf: + - $ref: '#/components/schemas/ApproximateLocation' + description: The user's location. + - 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://platform.openai.com/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 + 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 + enum: + - tool_search_output + description: The type of the item. Always `tool_search_output`. + default: tool_search_output + x-stainless-const: true + id: + type: string + description: The unique ID of the tool search output 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. + 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: + - type + - id + - call_id + - execution + - tools + - status + CompactionBody: + properties: + type: + type: string + enum: + - compaction + description: The type of the item. Always `compaction`. + default: compaction + x-stainless-const: true + id: + type: string + 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 + - id + - encrypted_content + title: Compaction item + description: A compaction item generated by the [`v1/responses/compact` API](/docs/api-reference/responses/compact). + CodeInterpreterOutputLogs: + properties: + type: + type: string + enum: + - logs + description: The type of the output. Always `logs`. + default: logs + x-stainless-const: true + logs: + type: string + description: The logs output from the code interpreter. + type: object + required: + - type + - logs + 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. + LocalShellExecAction: + properties: + type: + type: string + enum: + - exec + description: The type of the local shell action. Always `exec`. + default: exec + x-stainless-const: true + command: + items: + type: string + type: array + description: The command to run. + timeout_ms: + anyOf: + - type: integer + description: Optional timeout in milliseconds for the command. + - type: 'null' + 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 + - command + - env + title: Local shell exec action + description: Execute a shell command on the server. + FunctionShellAction: + properties: + commands: + items: + type: string + description: A list of commands to run. + type: array + 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: + - commands + - timeout_ms + - max_output_length + title: Shell exec action + description: Execute a shell command. + FunctionShellCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + LocalEnvironmentResource: + properties: + type: + type: string + enum: + - local + description: The environment type. Always `local`. + default: local + x-stainless-const: true + type: object + required: + - type + title: Local Environment + description: Represents the use of a local environment to perform shell actions. + ContainerReferenceResource: + properties: + type: + type: string + enum: + - container_reference + description: The environment type. Always `container_reference`. + default: container_reference + x-stainless-const: true + container_id: + type: string + type: object + required: + - type + - container_id + title: Container Reference + description: Represents a container created with /v1/containers. + FunctionShellCall: + 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. + 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: + anyOf: + - oneOf: + - $ref: '#/components/schemas/LocalEnvironmentResource' + - $ref: '#/components/schemas/ContainerReferenceResource' + discriminator: + propertyName: type + - type: 'null' + created_by: + type: string + description: The ID of the entity that created this tool call. + 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 + FunctionShellCallOutputTimeoutOutcome: + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true + type: object + required: + - type + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + FunctionShellCallOutputExitOutcome: + properties: + type: + type: string + enum: + - exit + description: The outcome type. Always `exit`. + default: exit + x-stainless-const: true + 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. + 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 + 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 + 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. + 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: + - 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' + 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 + ApplyPatchCreateFileOperation: + properties: + type: + type: string + enum: + - create_file + description: Create a new file with the provided diff. + default: create_file + x-stainless-const: true + path: + type: string + description: Path of the file to create. + diff: + type: string + description: Diff to apply. + type: object + required: + - type + - path + - diff + title: Apply patch create file operation + description: Instruction describing how to create a file via the apply_patch tool. + ApplyPatchDeleteFileOperation: + properties: + type: + type: string + enum: + - delete_file + description: Delete the specified file. + default: delete_file + x-stainless-const: true + path: + type: string + description: Path of the file to delete. + type: object + required: + - type + - path + title: Apply patch delete file operation + description: Instruction describing how to delete a file via the apply_patch tool. + ApplyPatchUpdateFileOperation: + 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: + type: string + description: Diff to apply. + type: object + required: + - type + - path + - diff + title: Apply patch update file operation + description: Instruction describing how to update a file via the apply_patch tool. + ApplyPatchToolCall: + properties: + type: + type: string + enum: + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_call + x-stainless-const: true + id: + type: string + description: The unique ID of the apply patch tool call. Populated when this item is returned via API. + call_id: + type: string + description: The unique ID of the apply patch tool call generated by the model. + 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 + - id + - call_id + - status + - operation + title: Apply patch tool call + description: A tool call that applies file diffs by creating, deleting, or updating files. + ApplyPatchCallOutputStatus: + type: string + enum: + - completed + - failed + 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 + id: + type: string + description: The unique ID of the apply patch tool call output. Populated when this item is returned via API. + call_id: + type: string + description: The unique ID of the apply patch tool call generated by the model. + status: + $ref: '#/components/schemas/ApplyPatchCallOutputStatus' + description: The status of the apply patch tool call output. One of `completed` or `failed`. + output: + anyOf: + - type: string + description: Optional textual output returned by the apply patch tool. + - type: 'null' + created_by: + type: string + description: The ID of the entity that created this tool call output. + type: object + required: + - type + - id + - call_id + - status + title: Apply patch tool call output + description: The output emitted by an apply patch tool call. + 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 + 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: + anyOf: + - items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + 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' + type: object + required: + - call_id + - type + - output + title: Computer tool call output + description: The output of a computer tool call. + InputTextContentParam: + 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 + maxLength: 10485760 + description: The text input to the model. + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + InputImageContentParamAutoParam: + properties: + type: + type: string + enum: + - input_image + description: The type of the input item. Always `input_image`. + default: input_image + 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' + file_id: + anyOf: + - type: string + description: The ID of the file to be sent to the model. + example: file-123 + - type: 'null' + 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' + type: object + required: + - type + title: Input image + description: An image input to the model. Learn about [image inputs](/docs/guides/vision) + FileDetailEnum: + type: string + enum: + - low + - high + InputFileContentParam: + 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: + - type: string + description: The ID of the file to be sent to the model. + example: file-123 + - type: 'null' + filename: + anyOf: + - type: string + description: The name of the file to be sent to the model. + - type: 'null' + file_data: + anyOf: + - type: string + maxLength: 73400320 + description: The base64-encoded data of the file to be sent to the model. + - type: 'null' + file_url: + anyOf: + - type: string + format: uri + description: The URL of the file to be sent to the model. + - type: 'null' + detail: + $ref: '#/components/schemas/FileDetailEnum' + description: The detail level of the file to be sent to the model. Use `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`. + type: object + required: + - type + title: Input file + description: A file input to the model. + FunctionCallOutputItemParam: + 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' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the function tool call generated by the model. + 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. + - 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. + 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' + type: object + required: + - call_id + - type + - output + title: Function tool call output + description: The output of a function tool call. + ToolSearchCallItemParam: + properties: + id: + anyOf: + - type: string + description: The unique ID of this tool search call. + example: tsc_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_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: + - type + - arguments + ToolSearchOutputItemParam: + 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 + 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/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' + type: object + required: + - type + - tools + CompactionSummaryItemParam: + properties: + id: + anyOf: + - type: string + description: The ID of the compaction item. + example: cmp_123 + - 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: 10485760 + 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](/docs/api-reference/responses/compact). + FunctionShellActionParam: + properties: + commands: + items: + type: string + type: array + description: Ordered shell commands for the execution environment to run. + timeout_ms: + anyOf: + - type: integer + description: Maximum wall-clock time in milliseconds to allow the shell commands to run. + - type: 'null' + max_output_length: + anyOf: + - type: integer + description: Maximum number of UTF-8 characters to capture from combined stdout and stderr output. + - type: 'null' + 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 + title: Shell call status + description: Status values reported for shell tool calls. + FunctionShellCallItemParam: + 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' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the shell tool call generated by the model. + 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: + - $ref: '#/components/schemas/FunctionShellCallItemStatus' + description: The status of the shell call. One of `in_progress`, `completed`, or `incomplete`. + - type: 'null' + environment: + anyOf: + - oneOf: + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + description: The environment to execute the shell commands in. + discriminator: + propertyName: type + - type: 'null' + type: object + required: + - call_id + - type + - action + title: Shell tool call + description: A tool representing a request to execute one or more shell commands. + FunctionShellCallOutputTimeoutOutcomeParam: + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true + type: object + required: + - type + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + FunctionShellCallOutputExitOutcomeParam: + properties: + type: + type: string + enum: + - exit + description: The outcome type. Always `exit`. + default: exit + x-stainless-const: true + exit_code: + type: integer + 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' + - $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. + stderr: + type: string + maxLength: 10485760 + description: Captured stderr output for the shell call. + 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: 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. + 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 + output: + items: + $ref: '#/components/schemas/FunctionShellCallOutputContentParam' + 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' + 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 + 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 + 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: + type: + type: string + enum: + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_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' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + 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: + - type + - call_id + - status + - operation + title: Apply patch tool call + description: A tool call representing a request to create, delete, or update files using diff patches. + ApplyPatchCallOutputStatusParam: + type: string + enum: + - completed + - failed + title: Apply patch call output status + description: Outcome values reported for apply_patch tool call outputs. + ApplyPatchToolCallOutputItemParam: + 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 + 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' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + status: + $ref: '#/components/schemas/ApplyPatchCallOutputStatusParam' + description: The status of the apply patch tool call output. One of `completed` or `failed`. + output: + anyOf: + - type: string + 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. + ItemReferenceParam: + properties: + type: + anyOf: + - type: string + 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: + - id + title: Item reference + description: An internal identifier for an item to reference. + ConversationResource: + properties: + id: + type: string + description: The unique ID of the conversation. + object: + type: string + enum: + - conversation + description: The object type, which is always `conversation`. + default: conversation + 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. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + 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 + ImageGenOutputTokensDetails: + 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. + ImageGenInputUsageDetails: + 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. + ImageGenUsage: + 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/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. + SpecificApplyPatchParam: + properties: + type: + type: string + enum: + - apply_patch + description: The tool to call. Always `apply_patch`. + default: apply_patch + x-stainless-const: true + type: object + required: + - type + title: Specific apply patch tool choice + description: Forces the model to call the apply_patch tool when executing a tool call. + SpecificFunctionShellParam: + properties: + type: + type: string + enum: + - shell + description: The tool to call. Always `shell`. + default: shell + x-stainless-const: true + type: object + required: + - type + title: Specific shell tool choice + description: Forces the model to call the shell tool when a tool call is required. + ConversationParam-2: + properties: + id: + type: string + description: The unique ID of the conversation. + example: conv_123 + type: object + required: + - id + title: Conversation object + description: The conversation that this response belongs to. + ContextManagementParam: + properties: + type: + type: string + description: The context management entry type. Currently only 'compaction' is supported. + compact_threshold: + anyOf: + - type: integer + minimum: 1000 + description: Token threshold at which compaction should be triggered for this entry. + - type: 'null' + type: object + required: + - type + Conversation-2: + properties: + id: + type: string + 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. + CreateConversationBody: + 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. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + - type: 'null' + 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' + type: object + required: [] + UpdateConversationBody: + 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. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + type: object + required: + - metadata + DeletedConversationResource: + properties: + object: + type: string + enum: + - conversation.deleted + default: conversation.deleted + x-stainless-const: true + deleted: + type: boolean + id: + type: string + type: object + required: + - object + - deleted + - id + OrderEnum: + type: string + enum: + - asc + - desc + VideoModel: + anyOf: + - type: string + - type: string + enum: + - sora-2 + - sora-2-pro + - sora-2-2025-10-06 + - sora-2-pro-2025-10-06 + - sora-2-2025-12-08 + VideoStatus: + type: string + enum: + - queued + - in_progress + - completed + - failed + VideoSize: + type: string + enum: + - 720x1280 + - 1280x720 + - 1024x1792 + - 1792x1024 + Error-2: + properties: + code: + type: string + description: A machine-readable error code that was returned. + message: + type: string + description: A human-readable description of the error that was returned. + type: object + required: + - code + - message + title: Error + description: An error that occurred while generating the response. + VideoResource: + properties: + id: + type: string + description: Unique identifier for the video job. + object: + type: string + enum: + - video + 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' + 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: The prompt that was used to generate the video. + - type: 'null' + size: + $ref: '#/components/schemas/VideoSize' + description: The resolution of the generated video. + 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: 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' + type: object + required: + - id + - object + - model + - status + - progress + - created_at + - completed_at + - expires_at + - prompt + - size + - seconds + - remixed_from_video_id + - error + title: Video job + description: Structured information describing a generated video job. + VideoListResource: + 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/VideoResource' + 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 + 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: + - '4' + - '8' + - '12' + 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' + 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: + 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: + $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: + - prompt + title: Create video JSON request + description: JSON parameters for creating a new video generation job. + CreateVideoCharacterBody: + properties: + video: + type: string + format: binary + description: Video file used to create a character. + name: + type: string + maxLength: 80 + minLength: 1 + description: Display name for this API character. + type: object + required: + - video + - name + title: Create character request + description: Parameters for creating a character from an uploaded video. + VideoCharacterResource: + properties: + id: + anyOf: + - type: string + description: Identifier for the character creation cameo. + - type: 'null' + name: + anyOf: + - type: string + description: Display name for the character. + - type: 'null' + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the character was created. + type: object + required: + - id + - name + - created_at + VideoReferenceInputParam: + properties: + id: + type: string + description: The identifier of the completed video. + example: video_123 + type: object + required: + - id + description: Reference to the completed video. + CreateVideoEditMultipartBody: + properties: + video: + oneOf: + - type: string + format: binary + description: Reference to the completed video to edit. + - $ref: '#/components/schemas/VideoReferenceInputParam' + prompt: + type: string + maxLength: 32000 + minLength: 1 + description: Text prompt that describes how to edit the source video. + 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. + type: object + required: + - video + - prompt + title: Create video edit JSON request + description: JSON parameters for editing an existing generated video. + CreateVideoExtendMultipartBody: + properties: + video: + oneOf: + - $ref: '#/components/schemas/VideoReferenceInputParam' + - type: string + format: binary + 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).' + type: object + required: + - video + - prompt + - seconds + title: Create video extension multipart request + description: Multipart parameters for extending an existing generated video. + CreateVideoExtendJsonBody: + 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).' + type: object + required: + - video + - prompt + - seconds + title: Create video extension JSON request + description: JSON parameters for extending an existing generated video. + DeletedVideoResource: + properties: + object: + type: string + enum: + - video.deleted + description: The object type that signals the deletion response. + default: video.deleted + x-stainless-const: true + deleted: + type: boolean + description: Indicates that the video resource was deleted. + id: + type: string + description: Identifier of the deleted video. + type: object + required: + - object + - deleted + - id + title: Deleted video response + description: Confirmation payload returned after deleting a video. + VideoContentVariant: + 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 + title: Create video remix request + description: Parameters for remixing an existing generated video. + TruncationEnum: + type: string + enum: + - auto + - disabled + 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](/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 + 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](/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://platform.openai.com/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.' + instructions: + anyOf: + - type: string + description: |- + A system (or developer) message inserted into the model's context. + When 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' + conversation: + anyOf: + - $ref: '#/components/schemas/ConversationParam' + - type: 'null' + tool_choice: + anyOf: + - $ref: '#/components/schemas/ToolChoiceParam' + description: Controls which tool the model should use, if any. + - type: 'null' + 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 + enum: + - response.input_tokens + default: response.input_tokens + x-stainless-const: true + input_tokens: + type: integer + type: object + required: + - object + - input_tokens + title: Token counts + example: + object: response.input_tokens + input_tokens: 123 + PromptCacheRetentionEnum: + type: string + enum: + - in_memory + - 24h + ServiceTierEnum: + type: string + enum: + - auto + - default + - flex + - priority + CompactResponseMethodPublicBody: + properties: + model: + $ref: '#/components/schemas/ModelIdsCompaction' + 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 + 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](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`. + example: resp_123 + - type: 'null' + instructions: + anyOf: + - type: string + description: |- + A system (or developer) message inserted into the model's context. + When 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' + prompt_cache_key: + anyOf: + - type: string + maxLength: 64 + description: A key to use when reading from or writing to the prompt cache. + - type: 'null' + prompt_cache_retention: + anyOf: + - $ref: '#/components/schemas/PromptCacheRetentionEnum' + description: How long to retain a prompt cache entry created by this request. + - type: 'null' + service_tier: + anyOf: + - $ref: '#/components/schemas/ServiceTierEnum' + description: The service tier to use for this request. + - type: 'null' + type: object + required: + - model + ItemField: + oneOf: + - $ref: '#/components/schemas/Message' + - $ref: '#/components/schemas/FunctionToolCall' + - $ref: '#/components/schemas/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $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' + description: An item representing a message, tool call, tool output, reasoning, or other response element. + discriminator: + propertyName: type + CompactResource: + properties: + id: + type: string + description: The unique identifier for the compacted response. + object: + type: string + enum: + - response.compaction + description: The object type. Always `response.compaction`. + default: response.compaction + x-stainless-const: true + output: + items: + $ref: '#/components/schemas/ItemField' + type: array + description: The compacted list of output items. + 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: + - id + - object + - output + - created_at + - usage + 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 + 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 + 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. + version: + anyOf: + - type: string + description: Specific workflow version used for the session. Defaults to null when using the latest deployment. + - type: 'null' + state_variables: + 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 + - type: 'null' + 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: integer + description: Maximum upload size in megabytes. + - type: 'null' + max_files: + anyOf: + - 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. + recent_threads: + anyOf: + - 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. + file_upload: + $ref: '#/components/schemas/ChatSessionFileUpload' + description: Upload settings for the session. + history: + $ref: '#/components/schemas/ChatSessionHistory' + description: History retention configuration. + type: object + required: + - automatic_thread_titling + - file_upload + - history + title: ChatKit configuration + description: ChatKit configuration for the session. + ChatSessionResource: + properties: + id: + type: string + description: Identifier for the ChatKit session. + object: + type: string + enum: + - chatkit.session + 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. + client_secret: + type: string + description: Ephemeral client secret that authenticates session requests. + workflow: + $ref: '#/components/schemas/ChatkitWorkflow' + description: Workflow metadata for the session. + user: + 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. + type: object + required: + - 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-01T00:00:00.000Z + 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 + WorkflowTracingParam: + properties: + 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 + description: Identifier for the workflow invoked by the session. + version: + type: string + description: Specific workflow version to run. Defaults to the latest deployed version. + 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: + - id + title: Workflow settings + description: Workflow reference and overrides applied to the chat session. + ExpiresAfterParam: + properties: + anchor: + type: string + enum: + - created_at + description: Base timestamp used to calculate expiration. Currently fixed to `created_at`. + default: created_at + x-stainless-const: true + seconds: + type: integer + 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: 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. + 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. + 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. + recent_threads: + type: integer + minimum: 1 + description: Number of recent ChatKit threads users have access to. Defaults to unlimited when unset. + 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. + 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). + 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 + 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. + chatkit_configuration: + $ref: '#/components/schemas/ChatkitConfigurationParam' + description: Optional overrides for ChatKit runtime configuration features + type: object + required: + - workflow + - user + title: Create chat session request + description: Parameters for provisioning a new ChatKit session. + UserMessageInputText: + properties: + type: + type: string + enum: + - input_text + description: Type discriminator that is always `input_text`. + default: input_text + x-stainless-const: true + text: + type: string + description: Plain-text content supplied by the user. + type: object + required: + - type + - text + title: User message input + description: Text block that a user contributed to the thread. + UserMessageQuotedText: + properties: + type: + type: string + enum: + - quoted_text + description: Type discriminator that is always `quoted_text`. + default: quoted_text + x-stainless-const: true + text: + type: string + description: Quoted text content. + type: object + required: + - type + - text + title: User message quoted text + description: Quoted snippet that the user referenced in their message. + AttachmentType: + type: string + enum: + - image + - file + 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 + format: uri + description: Preview URL for rendering the attachment inline. + - type: 'null' + type: object + required: + - type + - id + - name + - mime_type + - preview_url + title: Attachment + description: Attachment metadata included on thread items. + ToolChoice: + properties: + 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: + - $ref: '#/components/schemas/ToolChoice' + description: Preferred tool to invoke. Defaults to null when ChatKit should auto-select. + - type: 'null' + model: + anyOf: + - type: string + description: Model name that generated the response. Defaults to null when using the session default. + - type: 'null' + type: object + required: + - tool_choice + - model + title: Inference options + description: Model and tool overrides applied when generating the assistant response. + UserMessageItem: + 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: + - chatkit.user_message + default: chatkit.user_message + x-stainless-const: true + 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' + 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' + type: object + required: + - id + - object + - created_at + - thread_id + - type + - content + - attachments + - inference_options + title: User Message Item + description: User-authored messages within a thread. + FileAnnotationSource: + properties: + type: + type: string + enum: + - file + 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 + - filename + title: File annotation source + description: Attachment source referenced by an annotation. + FileAnnotation: + properties: + type: + type: string + enum: + - file + description: Type discriminator that is always `file` for this annotation. + default: file + x-stainless-const: true + source: + $ref: '#/components/schemas/FileAnnotationSource' + description: File attachment referenced by the annotation. + type: object + required: + - type + - source + title: File annotation + description: Annotation that references an uploaded file. + UrlAnnotationSource: + properties: + type: + type: string + enum: + - url + description: Type discriminator that is always `url`. + default: url + x-stainless-const: true + url: + type: string + format: uri + description: URL referenced by the annotation. + type: object + required: + - type + - url + title: URL annotation source + description: URL backing an annotation entry. + UrlAnnotation: + properties: + type: + type: string + enum: + - url + description: Type discriminator that is always `url` for this annotation. + default: url + x-stainless-const: true + source: + $ref: '#/components/schemas/UrlAnnotationSource' + description: URL referenced by the annotation. + type: object + required: + - type + - source + title: URL annotation + description: Annotation that references a URL. + ResponseOutputText: + properties: + type: + type: string + enum: + - output_text + description: Type discriminator that is always `output_text`. + default: output_text + x-stainless-const: true + text: + type: string + description: Assistant generated text. + annotations: + items: + oneOf: + - $ref: '#/components/schemas/FileAnnotation' + - $ref: '#/components/schemas/UrlAnnotation' + description: Annotation object describing a cited source. + discriminator: + propertyName: type + type: array + description: Ordered list of annotations attached to the response text. + type: object + required: + - type + - text + - annotations + title: Assistant message content + description: Assistant response text accompanied by optional annotations. + AssistantMessageItem: + 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: + - 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 + - content + title: Assistant message + description: Assistant-authored message within a thread. + 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: + - chatkit.widget + description: Type discriminator that is always `chatkit.widget`. + default: chatkit.widget + x-stainless-const: true + widget: + type: string + description: Serialized widget payload rendered in the UI. + type: object + required: + - id + - object + - created_at + - thread_id + - type + - widget + title: Widget message + description: Thread item that renders a widget payload. + ClientToolCallStatus: + type: string + enum: + - in_progress + - completed + ClientToolCallItem: + 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: + - chatkit.client_tool_call + 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. + call_id: + type: string + description: Identifier for the client tool call. + name: + type: string + description: Tool name that was invoked. + arguments: + type: string + description: JSON-encoded arguments that were sent to the tool. + output: + anyOf: + - type: string + description: JSON-encoded output captured from the tool. Defaults to null while execution is in progress. + - type: 'null' + type: object + required: + - id + - object + - created_at + - thread_id + - type + - status + - call_id + - name + - arguments + - output + title: Client tool call + description: Record of a client side tool invocation initiated by the assistant. + TaskType: + type: string + enum: + - custom + - thought + TaskItem: + 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: + - 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: + - type: string + description: Optional heading for the task. Defaults to null when not provided. + - type: 'null' + summary: + anyOf: + - type: string + description: Optional summary that describes the task. Defaults to null when omitted. + - type: 'null' + type: object + required: + - id + - object + - created_at + - thread_id + - type + - task_type + - heading + - summary + title: Task item + description: Task emitted by the workflow to show progress and status updates. + TaskGroupTask: + properties: + type: + $ref: '#/components/schemas/TaskType' + description: Subtype for the grouped task. + heading: + anyOf: + - type: string + description: Optional heading for the grouped task. Defaults to null when not provided. + - type: 'null' + summary: + anyOf: + - type: string + description: Optional summary that describes the grouped task. Defaults to null when omitted. + - type: 'null' + type: object + required: + - type + - heading + - summary + title: Task group task + description: Task entry that appears within a TaskGroup. + TaskGroupItem: + 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: + - 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 + - tasks + title: Task group + description: Collection of workflow tasks grouped together in the thread. + ThreadItem: + oneOf: + - $ref: '#/components/schemas/UserMessageItem' + - $ref: '#/components/schemas/AssistantMessageItem' + - $ref: '#/components/schemas/WidgetMessageItem' + - $ref: '#/components/schemas/ClientToolCallItem' + - $ref: '#/components/schemas/TaskItem' + - $ref: '#/components/schemas/TaskGroupItem' + title: The thread item + discriminator: + propertyName: type + ThreadItemListResource: + 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/ThreadItem' + 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 + title: Thread Items + description: A paginated list of thread items rendered for the ChatKit API. + ActiveStatus: + properties: + type: + type: string + enum: + - active + description: Status discriminator that is always `active`. + default: active + x-stainless-const: true + type: object + required: + - type + title: Active thread status + description: Indicates that a thread is active. + LockedStatus: + properties: + type: + type: string + enum: + - locked + description: Status discriminator that is always `locked`. + default: locked + x-stainless-const: true + reason: + anyOf: + - type: string + description: Reason that the thread was locked. Defaults to null when no reason is recorded. + - 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 + reason: + anyOf: + - type: string + description: Reason that the thread was closed. Defaults to null when no reason is recorded. + - type: 'null' + type: object + required: + - type + - reason + title: Closed thread status + description: Indicates that a thread has been closed. + ThreadResource: + properties: + id: + type: string + description: Identifier of the thread. + object: + type: string + enum: + - chatkit.thread + description: Type discriminator that is always `chatkit.thread`. + default: chatkit.thread + x-stainless-const: true + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the thread was created. + title: + anyOf: + - type: string + description: Optional human-readable title for the thread. Defaults to null when no title has been generated. + - type: 'null' + 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: + - id + - object + - created_at + - title + - status + - user + 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 + DeletedThreadResource: + properties: + id: + type: string + 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 + - object + - deleted + title: Deleted thread + description: Confirmation payload returned after deleting a thread. + ThreadListResource: + 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/ThreadResource' + 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 + title: Threads + description: A paginated list of ChatKit threads. + DragPoint: + 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 }`.' + securitySchemes: + ApiKeyAuth: + type: http + scheme: bearer + AdminApiKeyAuth: + type: http + scheme: bearer +x-oaiMeta: + navigationGroups: + - id: responses + title: Responses API + - id: webhooks + title: Webhooks + - id: endpoints + title: Platform APIs + - id: vector_stores + title: Vector stores + - id: chatkit + title: ChatKit + beta: true + - id: containers + title: Containers + - id: realtime + title: Realtime + - id: chat + title: Chat Completions + - id: assistants + title: Assistants + deprecated: true + - id: administration + title: Administration + - id: legacy + title: Legacy + groups: + - id: responses-streaming + title: Streaming events + description: | + When you [create a Response](/docs/api-reference/responses/create) with + `stream` set to `true`, the server will emit server-sent events to the + client as the Response is generated. This section contains the events that + are emitted by the server. + + [Learn more about streaming responses](/docs/guides/streaming-responses?api-mode=responses). + navigationGroup: responses + sections: + - type: object + key: ResponseCreatedEvent + path: + - type: object + key: ResponseInProgressEvent + path: + - type: object + key: ResponseCompletedEvent + path: + - type: object + key: ResponseFailedEvent + path: + - type: object + key: ResponseIncompleteEvent + path: + - type: object + key: ResponseOutputItemAddedEvent + path: + - type: object + key: ResponseOutputItemDoneEvent + path: + - type: object + key: ResponseContentPartAddedEvent + path: + - type: object + key: ResponseContentPartDoneEvent + path: + - type: object + key: ResponseTextDeltaEvent + path: response/output_text/delta + - type: object + key: ResponseTextDoneEvent + path: response/output_text/done + - type: object + key: ResponseRefusalDeltaEvent + path: + - type: object + key: ResponseRefusalDoneEvent + path: + - type: object + key: ResponseFunctionCallArgumentsDeltaEvent + path: + - type: object + key: ResponseFunctionCallArgumentsDoneEvent + path: + - type: object + key: ResponseFileSearchCallInProgressEvent + path: + - type: object + key: ResponseFileSearchCallSearchingEvent + path: + - type: object + key: ResponseFileSearchCallCompletedEvent + path: + - type: object + key: ResponseWebSearchCallInProgressEvent + path: + - type: object + key: ResponseWebSearchCallSearchingEvent + path: + - type: object + key: ResponseWebSearchCallCompletedEvent + path: + - type: object + key: ResponseReasoningSummaryPartAddedEvent + path: + - type: object + key: ResponseReasoningSummaryPartDoneEvent + path: + - type: object + key: ResponseReasoningSummaryTextDeltaEvent + path: + - type: object + key: ResponseReasoningSummaryTextDoneEvent + path: + - type: object + key: ResponseReasoningTextDeltaEvent + path: + - type: object + key: ResponseReasoningTextDoneEvent + path: + - type: object + key: ResponseImageGenCallCompletedEvent + path: + - type: object + key: ResponseImageGenCallGeneratingEvent + path: + - type: object + key: ResponseImageGenCallInProgressEvent + path: + - type: object + key: ResponseImageGenCallPartialImageEvent + path: + - type: object + key: ResponseMCPCallArgumentsDeltaEvent + path: + - type: object + key: ResponseMCPCallArgumentsDoneEvent + path: + - type: object + key: ResponseMCPCallCompletedEvent + path: + - type: object + key: ResponseMCPCallFailedEvent + path: + - type: object + key: ResponseMCPCallInProgressEvent + path: + - type: object + key: ResponseMCPListToolsCompletedEvent + path: + - type: object + key: ResponseMCPListToolsFailedEvent + path: + - type: object + key: ResponseMCPListToolsInProgressEvent + path: + - type: object + key: ResponseCodeInterpreterCallInProgressEvent + path: + - type: object + key: ResponseCodeInterpreterCallInterpretingEvent + path: + - type: object + key: ResponseCodeInterpreterCallCompletedEvent + path: + - type: object + key: ResponseCodeInterpreterCallCodeDeltaEvent + path: + - type: object + key: ResponseCodeInterpreterCallCodeDoneEvent + path: + - type: object + key: ResponseOutputTextAnnotationAddedEvent + path: + - type: object + key: ResponseQueuedEvent + path: + - type: object + key: ResponseCustomToolCallInputDeltaEvent + path: + - type: object + key: ResponseCustomToolCallInputDoneEvent + path: + - type: object + key: ResponseErrorEvent + path: + - id: webhook-events + title: Webhook Events + description: | + Webhooks are HTTP requests sent by OpenAI to a URL you specify when certain + events happen during the course of API usage. + + [Learn more about webhooks](/docs/guides/webhooks). + navigationGroup: webhooks + sections: + - type: object + key: WebhookResponseCompleted + path: + - type: object + key: WebhookResponseCancelled + path: + - type: object + key: WebhookResponseFailed + path: + - type: object + key: WebhookResponseIncomplete + path: + - type: object + key: WebhookBatchCompleted + path: + - type: object + key: WebhookBatchCancelled + path: + - type: object + key: WebhookBatchExpired + path: + - type: object + key: WebhookBatchFailed + path: + - type: object + key: WebhookFineTuningJobSucceeded + path: + - type: object + key: WebhookFineTuningJobFailed + path: + - type: object + key: WebhookFineTuningJobCancelled + path: + - type: object + key: WebhookEvalRunSucceeded + path: + - type: object + key: WebhookEvalRunFailed + path: + - type: object + key: WebhookEvalRunCanceled + path: + - type: object + key: WebhookRealtimeCallIncoming + path: + - id: images-streaming + title: Image Streaming + description: | + Stream image generation and editing in real time with server-sent events. + [Learn more about image streaming](/docs/guides/image-generation). + navigationGroup: endpoints + sections: + - type: object + key: ImageGenPartialImageEvent + path: + - type: object + key: ImageGenCompletedEvent + path: + - type: object + key: ImageEditPartialImageEvent + path: + - type: object + key: ImageEditCompletedEvent + path: + - id: realtime-client-events + title: Client events + description: | + These are events that the OpenAI Realtime WebSocket server will accept from the client. + navigationGroup: realtime + sections: + - type: object + key: RealtimeClientEventSessionUpdate + path: + - type: object + key: RealtimeClientEventInputAudioBufferAppend + path: + - type: object + key: RealtimeClientEventInputAudioBufferCommit + path: + - type: object + key: RealtimeClientEventInputAudioBufferClear + path: + - type: object + key: RealtimeClientEventConversationItemCreate + path: + - type: object + key: RealtimeClientEventConversationItemRetrieve + path: + - type: object + key: RealtimeClientEventConversationItemTruncate + path: + - type: object + key: RealtimeClientEventConversationItemDelete + path: + - type: object + key: RealtimeClientEventResponseCreate + path: + - type: object + key: RealtimeClientEventResponseCancel + path: + - type: object + key: RealtimeClientEventOutputAudioBufferClear + path: + - id: realtime-server-events + title: Server events + description: | + These are events emitted from the OpenAI Realtime WebSocket server to the client. + navigationGroup: realtime + sections: + - type: object + key: RealtimeServerEventError + path: + - type: object + key: RealtimeServerEventSessionCreated + path: + - type: object + key: RealtimeServerEventSessionUpdated + path: + - type: object + key: RealtimeServerEventConversationItemAdded + path: + - type: object + key: RealtimeServerEventConversationItemDone + path: + - type: object + key: RealtimeServerEventConversationItemRetrieved + path: + - type: object + key: RealtimeServerEventConversationItemInputAudioTranscriptionCompleted + path: + - type: object + key: RealtimeServerEventConversationItemInputAudioTranscriptionDelta + path: + - type: object + key: RealtimeServerEventConversationItemInputAudioTranscriptionSegment + path: + - type: object + key: RealtimeServerEventConversationItemInputAudioTranscriptionFailed + path: + - type: object + key: RealtimeServerEventConversationItemTruncated + path: + - type: object + key: RealtimeServerEventConversationItemDeleted + path: + - type: object + key: RealtimeServerEventInputAudioBufferCommitted + path: + - type: object + key: RealtimeServerEventInputAudioBufferDtmfEventReceived + path: + - type: object + key: RealtimeServerEventInputAudioBufferCleared + path: + - type: object + key: RealtimeServerEventInputAudioBufferSpeechStarted + path: + - type: object + key: RealtimeServerEventInputAudioBufferSpeechStopped + path: + - type: object + key: RealtimeServerEventInputAudioBufferTimeoutTriggered + path: + - type: object + key: RealtimeServerEventOutputAudioBufferStarted + path: + - type: object + key: RealtimeServerEventOutputAudioBufferStopped + path: + - type: object + key: RealtimeServerEventOutputAudioBufferCleared + path: + - type: object + key: RealtimeServerEventResponseCreated + path: + - type: object + key: RealtimeServerEventResponseDone + path: + - type: object + key: RealtimeServerEventResponseOutputItemAdded + path: + - type: object + key: RealtimeServerEventResponseOutputItemDone + path: + - type: object + key: RealtimeServerEventResponseContentPartAdded + path: + - type: object + key: RealtimeServerEventResponseContentPartDone + path: + - type: object + key: RealtimeServerEventResponseTextDelta + path: + - type: object + key: RealtimeServerEventResponseTextDone + path: + - type: object + key: RealtimeServerEventResponseAudioTranscriptDelta + path: + - type: object + key: RealtimeServerEventResponseAudioTranscriptDone + path: + - type: object + key: RealtimeServerEventResponseAudioDelta + path: + - type: object + key: RealtimeServerEventResponseAudioDone + path: + - type: object + key: RealtimeServerEventResponseFunctionCallArgumentsDelta + path: + - type: object + key: RealtimeServerEventResponseFunctionCallArgumentsDone + path: + - type: object + key: RealtimeServerEventResponseMCPCallArgumentsDelta + path: + - type: object + key: RealtimeServerEventResponseMCPCallArgumentsDone + path: + - type: object + key: RealtimeServerEventResponseMCPCallInProgress + path: + - type: object + key: RealtimeServerEventResponseMCPCallCompleted + path: + - type: object + key: RealtimeServerEventResponseMCPCallFailed + path: + - type: object + key: RealtimeServerEventMCPListToolsInProgress + path: + - type: object + key: RealtimeServerEventMCPListToolsCompleted + path: + - type: object + key: RealtimeServerEventMCPListToolsFailed + path: + - type: object + key: RealtimeServerEventRateLimitsUpdated + path: + - id: realtime-translation-client-events + title: Translation client events + description: | + These are events that the OpenAI Realtime Translation WebSocket server will accept from the client. + navigationGroup: realtime + sections: + - type: object + key: RealtimeTranslationClientEventSessionUpdate + path: + - type: object + key: RealtimeTranslationClientEventInputAudioBufferAppend + path: + - type: object + key: RealtimeTranslationClientEventSessionClose + path: + - id: realtime-translation-server-events + title: Translation server events + description: | + These are events emitted from the OpenAI Realtime Translation WebSocket server to the client. + navigationGroup: realtime + sections: + - type: object + key: RealtimeServerEventError + path: + - type: object + key: RealtimeTranslationServerEventSessionCreated + path: + - type: object + key: RealtimeTranslationServerEventSessionUpdated + path: + - type: object + key: RealtimeTranslationServerEventSessionClosed + path: + - type: object + key: RealtimeTranslationServerEventSessionInputTranscriptDelta + path: + - type: object + key: RealtimeTranslationServerEventSessionOutputTranscriptDelta + path: + - type: object + key: RealtimeTranslationServerEventSessionOutputAudioDelta + path: + - id: chat-streaming + title: Streaming + description: | + Stream Chat Completions in real time. Receive chunks of completions + returned from the model using server-sent events. + [Learn more](/docs/guides/streaming-responses?api-mode=chat). + navigationGroup: chat + sections: + - type: object + key: CreateChatCompletionStreamResponse + path: streaming + - id: assistants-streaming + title: Streaming + beta: true + description: | + Stream the result of executing a Run or resuming a Run after submitting tool outputs. + You can stream events from the [Create Thread and Run](/docs/api-reference/runs/createThreadAndRun), + [Create Run](/docs/api-reference/runs/createRun), and [Submit Tool Outputs](/docs/api-reference/runs/submitToolOutputs) + endpoints by passing `"stream": true`. The response will be a [Server-Sent events](https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events) stream. + Our Node and Python SDKs provide helpful utilities to make streaming easy. Reference the + [Assistants API quickstart](/docs/assistants/overview) to learn more. + navigationGroup: assistants + sections: + - type: object + key: AssistantStreamEvent + path: events + - id: realtime-beta-client-events + title: Realtime Beta client events + description: | + These are events that the OpenAI Realtime WebSocket server will accept from the client. + navigationGroup: legacy + sections: + - type: object + key: RealtimeBetaClientEventSessionUpdate + path: + - type: object + key: RealtimeBetaClientEventInputAudioBufferAppend + path: + - type: object + key: RealtimeBetaClientEventInputAudioBufferCommit + path: + - type: object + key: RealtimeBetaClientEventInputAudioBufferClear + path: + - type: object + key: RealtimeBetaClientEventConversationItemCreate + path: + - type: object + key: RealtimeBetaClientEventConversationItemRetrieve + path: + - type: object + key: RealtimeBetaClientEventConversationItemTruncate + path: + - type: object + key: RealtimeBetaClientEventConversationItemDelete + path: + - type: object + key: RealtimeBetaClientEventResponseCreate + path: + - type: object + key: RealtimeBetaClientEventResponseCancel + path: + - type: object + key: RealtimeBetaClientEventTranscriptionSessionUpdate + path: + - type: object + key: RealtimeBetaClientEventOutputAudioBufferClear + path: + - id: realtime-beta-server-events + title: Realtime Beta server events + description: | + These are events emitted from the OpenAI Realtime WebSocket server to the client. + navigationGroup: legacy + sections: + - type: object + key: RealtimeBetaServerEventError + path: + - type: object + key: RealtimeBetaServerEventSessionCreated + path: + - type: object + key: RealtimeBetaServerEventSessionUpdated + path: + - type: object + key: RealtimeBetaServerEventTranscriptionSessionCreated + path: + - type: object + key: RealtimeBetaServerEventTranscriptionSessionUpdated + path: + - type: object + key: RealtimeBetaServerEventConversationItemCreated + path: + - type: object + key: RealtimeBetaServerEventConversationItemRetrieved + path: + - type: object + key: RealtimeBetaServerEventConversationItemInputAudioTranscriptionCompleted + path: + - type: object + key: RealtimeBetaServerEventConversationItemInputAudioTranscriptionDelta + path: + - type: object + key: RealtimeBetaServerEventConversationItemInputAudioTranscriptionSegment + path: + - type: object + key: RealtimeBetaServerEventConversationItemInputAudioTranscriptionFailed + path: + - type: object + key: RealtimeBetaServerEventConversationItemTruncated + path: + - type: object + key: RealtimeBetaServerEventConversationItemDeleted + path: + - type: object + key: RealtimeBetaServerEventInputAudioBufferCommitted + path: + - type: object + key: RealtimeBetaServerEventInputAudioBufferCleared + path: + - type: object + key: RealtimeBetaServerEventInputAudioBufferSpeechStarted + path: + - type: object + key: RealtimeBetaServerEventInputAudioBufferSpeechStopped + path: + - type: object + key: RealtimeServerEventInputAudioBufferTimeoutTriggered + path: + - type: object + key: RealtimeBetaServerEventResponseCreated + path: + - type: object + key: RealtimeBetaServerEventResponseDone + path: + - type: object + key: RealtimeBetaServerEventResponseOutputItemAdded + path: + - type: object + key: RealtimeBetaServerEventResponseOutputItemDone + path: + - type: object + key: RealtimeBetaServerEventResponseContentPartAdded + path: + - type: object + key: RealtimeBetaServerEventResponseContentPartDone + path: + - type: object + key: RealtimeBetaServerEventResponseTextDelta + path: + - type: object + key: RealtimeBetaServerEventResponseTextDone + path: + - type: object + key: RealtimeBetaServerEventResponseAudioTranscriptDelta + path: + - type: object + key: RealtimeBetaServerEventResponseAudioTranscriptDone + path: + - type: object + key: RealtimeBetaServerEventResponseAudioDelta + path: + - type: object + key: RealtimeBetaServerEventResponseAudioDone + path: + - type: object + key: RealtimeBetaServerEventResponseFunctionCallArgumentsDelta + path: + - type: object + key: RealtimeBetaServerEventResponseFunctionCallArgumentsDone + path: + - type: object + key: RealtimeBetaServerEventResponseMCPCallArgumentsDelta + path: + - type: object + key: RealtimeBetaServerEventResponseMCPCallArgumentsDone + path: + - type: object + key: RealtimeBetaServerEventResponseMCPCallInProgress + path: + - type: object + key: RealtimeBetaServerEventResponseMCPCallCompleted + path: + - type: object + key: RealtimeBetaServerEventResponseMCPCallFailed + path: + - type: object + key: RealtimeBetaServerEventMCPListToolsInProgress + path: + - type: object + key: RealtimeBetaServerEventMCPListToolsCompleted + path: + - type: object + key: RealtimeBetaServerEventMCPListToolsFailed + path: + - type: object + key: RealtimeBetaServerEventRateLimitsUpdated + path: diff --git a/provider-dev/openapi/.gitkeep b/provider-dev/openapi/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/provider-dev/openapi/src/openai/v00.00.00000/provider.yaml b/provider-dev/openapi/src/openai/v00.00.00000/provider.yaml new file mode 100644 index 0000000..c1404fc --- /dev/null +++ b/provider-dev/openapi/src/openai/v00.00.00000/provider.yaml @@ -0,0 +1,107 @@ +id: openai +name: openai +version: v00.00.00000 +providerServices: + assistants: + id: assistants:v00.00.00000 + name: assistants + preferred: true + service: + $ref: openai/v00.00.00000/services/assistants.yaml + title: assistants API + version: v00.00.00000 + description: openai API + batches: + id: batches:v00.00.00000 + name: batches + preferred: true + service: + $ref: openai/v00.00.00000/services/batches.yaml + title: batches API + version: v00.00.00000 + description: openai API + containers: + id: containers:v00.00.00000 + name: containers + preferred: true + service: + $ref: openai/v00.00.00000/services/containers.yaml + title: containers API + version: v00.00.00000 + description: openai API + conversations: + id: conversations:v00.00.00000 + name: conversations + preferred: true + service: + $ref: openai/v00.00.00000/services/conversations.yaml + title: conversations API + version: v00.00.00000 + description: openai API + evals: + id: evals:v00.00.00000 + name: evals + preferred: true + service: + $ref: openai/v00.00.00000/services/evals.yaml + title: evals API + version: v00.00.00000 + description: openai API + files: + id: files:v00.00.00000 + name: files + preferred: true + service: + $ref: openai/v00.00.00000/services/files.yaml + title: files API + version: v00.00.00000 + description: openai API + fine_tuning: + id: fine_tuning:v00.00.00000 + name: fine_tuning + preferred: true + service: + $ref: openai/v00.00.00000/services/fine_tuning.yaml + title: fine_tuning API + version: v00.00.00000 + description: openai API + models: + id: models:v00.00.00000 + name: models + preferred: true + service: + $ref: openai/v00.00.00000/services/models.yaml + title: models API + version: v00.00.00000 + description: openai API + skills: + id: skills:v00.00.00000 + name: skills + preferred: true + service: + $ref: openai/v00.00.00000/services/skills.yaml + title: skills API + version: v00.00.00000 + description: openai API + uploads: + id: uploads:v00.00.00000 + name: uploads + preferred: true + service: + $ref: openai/v00.00.00000/services/uploads.yaml + title: uploads API + version: v00.00.00000 + description: openai API + vector_stores: + id: vector_stores:v00.00.00000 + name: vector_stores + preferred: true + service: + $ref: openai/v00.00.00000/services/vector_stores.yaml + title: vector_stores API + version: v00.00.00000 + description: openai API +config: + auth: + type: bearer + credentialsenvvar: OPENAI_API_KEY diff --git a/provider-dev/openapi/src/openai/v00.00.00000/services/assistants.yaml b/provider-dev/openapi/src/openai/v00.00.00000/services/assistants.yaml new file mode 100644 index 0000000..4fe784b --- /dev/null +++ b/provider-dev/openapi/src/openai/v00.00.00000/services/assistants.yaml @@ -0,0 +1,8986 @@ +openapi: 3.1.0 +info: + title: assistants API + description: openai API + version: 2.3.0 +paths: + /assistants: + get: + operationId: listAssistants + tags: + - Assistants + summary: Returns a list of assistants. + deprecated: true + parameters: + - name: limit + in: query + description: >- + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListAssistantsResponse' + x-oaiMeta: + name: List assistants + group: assistants + examples: + request: + curl: | + curl "https://api.openai.com/v1/assistants?order=desc&limit=20" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.assistants.list() + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistants = await openai.beta.assistants.list({ + order: "desc", + limit: "20", + }); + + console.log(myAssistants.data); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const assistant of client.beta.assistants.list()) { + console.log(assistant.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Assistants.List(context.TODO(), openai.BetaAssistantListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.AssistantListPage; + import com.openai.models.beta.assistants.AssistantListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantListPage page = client.beta().assistants().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.assistants.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698982736, + "name": "Coding Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc456", + "object": "assistant", + "created_at": 1698982718, + "name": "My Assistant", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc789", + "object": "assistant", + "created_at": 1698982643, + "name": null, + "description": null, + "model": "gpt-4o", + "instructions": null, + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + ], + "first_id": "asst_abc123", + "last_id": "asst_abc789", + "has_more": false + } + post: + operationId: createAssistant + tags: + - Assistants + summary: Create an assistant with a model and instructions. + deprecated: true + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAssistantRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantObject' + x-oaiMeta: + name: Create assistant + group: assistants + examples: + - title: Code Interpreter + request: + curl: | + curl "https://api.openai.com/v1/assistants" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "name": "Math Tutor", + "tools": [{"type": "code_interpreter"}], + "model": "gpt-4o" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.create( + model="gpt-4o", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.create({ + instructions: + "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + name: "Math Tutor", + tools: [{ type: "code_interpreter" }], + model: "gpt-4o", + }); + + console.log(myAssistant); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const assistant = await client.beta.assistants.create({ model: + 'gpt-4o' }); + + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{\n\t\tModel: shared.ChatModelGPT4o,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.ChatModel; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantCreateParams params = AssistantCreateParams.builder() + .model(ChatModel.GPT_4O) + .build(); + Assistant assistant = client.beta().assistants().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.create(model: :"gpt-4o") + + puts(assistant) + response: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698984975, + "name": "Math Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + - title: Files + request: + curl: | + curl https://api.openai.com/v1/assistants \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [{"type": "file_search"}], + "tool_resources": {"file_search": {"vector_store_ids": ["vs_123"]}}, + "model": "gpt-4o" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.create( + model="gpt-4o", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.create({ + instructions: + "You are an HR bot, and you have access to files to answer employee questions about company policies.", + name: "HR Helper", + tools: [{ type: "file_search" }], + tool_resources: { + file_search: { + vector_store_ids: ["vs_123"] + } + }, + model: "gpt-4o" + }); + + console.log(myAssistant); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const assistant = await client.beta.assistants.create({ model: + 'gpt-4o' }); + + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{\n\t\tModel: shared.ChatModelGPT4o,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.ChatModel; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantCreateParams params = AssistantCreateParams.builder() + .model(ChatModel.GPT_4O) + .build(); + Assistant assistant = client.beta().assistants().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.create(model: :"gpt-4o") + + puts(assistant) + response: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1699009403, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": ["vs_123"] + } + }, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + /assistants/{assistant_id}: + get: + operationId: getAssistant + tags: + - Assistants + summary: Retrieves an assistant. + deprecated: true + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to retrieve. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantObject' + x-oaiMeta: + name: Retrieve assistant + group: assistants + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.retrieve( + "assistant_id", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.retrieve( + "asst_abc123" + ); + + console.log(myAssistant); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const assistant = await + client.beta.assistants.retrieve('assistant_id'); + + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.Get(context.TODO(), \"assistant_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Assistant assistant = client.beta().assistants().retrieve("assistant_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.retrieve("assistant_id") + + puts(assistant) + response: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1699009709, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [ + { + "type": "file_search" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + post: + operationId: modifyAssistant + tags: + - Assistants + summary: Modifies an assistant. + deprecated: true + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to modify. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyAssistantRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantObject' + x-oaiMeta: + name: Modify assistant + group: assistants + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "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.", + "tools": [{"type": "file_search"}], + "model": "gpt-4o" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.update( + assistant_id="assistant_id", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myUpdatedAssistant = await openai.beta.assistants.update( + "asst_abc123", + { + 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.", + name: "HR Helper", + tools: [{ type: "file_search" }], + model: "gpt-4o" + } + ); + + console.log(myUpdatedAssistant); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const assistant = await + client.beta.assistants.update('assistant_id'); + + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.Update(\n\t\tcontext.TODO(),\n\t\t\"assistant_id\",\n\t\topenai.BetaAssistantUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Assistant assistant = client.beta().assistants().update("assistant_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.update("assistant_id") + + puts(assistant) + response: | + { + "id": "asst_123", + "object": "assistant", + "created_at": 1699009709, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "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.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": [] + } + }, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + delete: + operationId: deleteAssistant + tags: + - Assistants + summary: Delete an assistant. + deprecated: true + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to delete. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAssistantResponse' + x-oaiMeta: + name: Delete assistant + group: assistants + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant_deleted = client.beta.assistants.delete( + "assistant_id", + ) + print(assistant_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const response = await openai.beta.assistants.delete("asst_abc123"); + + console.log(response); + } + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const assistantDeleted = await + client.beta.assistants.delete('assistant_id'); + + + console.log(assistantDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistantDeleted, err := client.Beta.Assistants.Delete(context.TODO(), \"assistant_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistantDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.AssistantDeleteParams; + import com.openai.models.beta.assistants.AssistantDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantDeleted assistantDeleted = client.beta().assistants().delete("assistant_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant_deleted = openai.beta.assistants.delete("assistant_id") + + puts(assistant_deleted) + response: | + { + "id": "asst_abc123", + "object": "assistant.deleted", + "deleted": true + } + /threads: + post: + operationId: createThread + tags: + - Assistants + summary: Create a thread. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateThreadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadObject' + x-oaiMeta: + name: Create thread + group: threads + beta: true + examples: + - title: Empty + request: + curl: | + curl https://api.openai.com/v1/threads \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.create() + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const emptyThread = await openai.beta.threads.create(); + + console.log(emptyThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.create(); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.New(context.TODO(), openai.BetaThreadNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.create + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699012949, + "metadata": {}, + "tool_resources": {} + } + - title: Messages + request: + curl: | + curl https://api.openai.com/v1/threads \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "messages": [{ + "role": "user", + "content": "Hello, what is AI?" + }, { + "role": "user", + "content": "How does AI work? Explain it in simple terms." + }] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.create() + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const messageThread = await openai.beta.threads.create({ + messages: [ + { + role: "user", + content: "Hello, what is AI?" + }, + { + role: "user", + content: "How does AI work? Explain it in simple terms.", + }, + ], + }); + + console.log(messageThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.create(); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.New(context.TODO(), openai.BetaThreadNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.create + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": {}, + "tool_resources": {} + } + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + deprecated: true + /threads/runs: + post: + operationId: createThreadAndRun + tags: + - Assistants + summary: Create a thread and run it in one request. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateThreadAndRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Create thread and run + group: threads + beta: true + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "thread": { + "messages": [ + {"role": "user", "content": "Explain deep learning to a 5 year old."} + ] + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for thread in client.beta.threads.create_and_run( + assistant_id="assistant_id", + ): + print(thread) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.createAndRun({ + assistant_id: "asst_abc123", + thread: { + messages: [ + { role: "user", content: "Explain deep learning to a 5 year old." }, + ], + }, + }); + + console.log(run); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.createAndRun({ + assistant_id: 'assistant_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.NewAndRun(context.TODO(), openai.BetaThreadNewAndRunParams{\n\t\tAssistantID: \"assistant_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadCreateAndRunParams; + import com.openai.models.beta.threads.runs.Run; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadCreateAndRunParams params = ThreadCreateAndRunParams.builder() + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().createAndRun(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.create_and_run(assistant_id: + "assistant_id") + + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699076792, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "queued", + "started_at": null, + "expires_at": 1699077392, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4o", + "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", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_123", + "thread": { + "messages": [ + {"role": "user", "content": "Hello"} + ] + }, + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for thread in client.beta.threads.create_and_run( + assistant_id="assistant_id", + ): + print(thread) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.createAndRun({ + assistant_id: "asst_123", + thread: { + messages: [ + { role: "user", content: "Hello" }, + ], + }, + stream: true + }); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.createAndRun({ + assistant_id: 'assistant_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.NewAndRun(context.TODO(), openai.BetaThreadNewAndRunParams{\n\t\tAssistantID: \"assistant_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadCreateAndRunParams; + import com.openai.models.beta.threads.runs.Run; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadCreateAndRunParams params = ThreadCreateAndRunParams.builder() + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().createAndRun(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.create_and_run(assistant_id: + "assistant_id") + + + puts(run) + response: > + event: thread.created + + data: + {"id":"thread_123","object":"thread","created_at":1710348075,"metadata":{}} + + + event: thread.run.created + + data: + {"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-4o","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} + + + event: thread.run.queued + + data: + {"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-4o","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} + + + event: thread.run.in_progress + + data: + {"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-4o","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} + + + event: thread.run.step.created + + data: + {"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} + + + event: thread.run.step.in_progress + + data: + {"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} + + + event: thread.message.created + + data: + {"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":{}} + + + event: thread.message.in_progress + + data: + {"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":{}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + + ... + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + today"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + + event: thread.message.completed + + data: + {"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":{}} + + + event: thread.run.step.completed + + data: + {"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}} + + + event: thread.run.completed + + {"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-4o","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} + + + event: done + + data: [DONE] + - title: Streaming with Functions + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "thread": { + "messages": [ + {"role": "user", "content": "What is the weather like in San Francisco?"} + ] + }, + "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"] + } + } + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for thread in client.beta.threads.create_and_run( + assistant_id="assistant_id", + ): + print(thread) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const 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"], + }, + } + } + ]; + + async function main() { + const stream = await openai.beta.threads.createAndRun({ + assistant_id: "asst_123", + thread: { + messages: [ + { role: "user", content: "What is the weather like in San Francisco?" }, + ], + }, + tools: tools, + stream: true + }); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.createAndRun({ + assistant_id: 'assistant_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.NewAndRun(context.TODO(), openai.BetaThreadNewAndRunParams{\n\t\tAssistantID: \"assistant_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadCreateAndRunParams; + import com.openai.models.beta.threads.runs.Run; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadCreateAndRunParams params = ThreadCreateAndRunParams.builder() + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().createAndRun(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.create_and_run(assistant_id: + "assistant_id") + + + puts(run) + response: > + event: thread.created + + data: + {"id":"thread_123","object":"thread","created_at":1710351818,"metadata":{}} + + + event: thread.run.created + + data: + {"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-4o","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}} + + + event: thread.run.queued + + data: + {"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-4o","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}} + + + event: thread.run.in_progress + + data: + {"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-4o","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}} + + + event: thread.run.step.created + + data: + {"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} + + + event: thread.run.step.in_progress + + data: + {"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} + + + event: thread.run.step.delta + + data: + {"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}}]}}} + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]}}} + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"location"}}]}}} + + + ... + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"ahrenheit"}}]}}} + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]}}} + + + event: thread.run.requires_action + + data: + {"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-4o","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}} + + + event: done + + data: [DONE] + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + deprecated: true + /threads/{thread_id}: + get: + operationId: getThread + tags: + - Assistants + summary: Retrieves a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to retrieve. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadObject' + x-oaiMeta: + name: Retrieve thread + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.retrieve( + "thread_id", + ) + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myThread = await openai.beta.threads.retrieve( + "thread_abc123" + ); + + console.log(myThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.retrieve('thread_id'); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.Get(context.TODO(), \"thread_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().retrieve("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.retrieve("thread_id") + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": {}, + "tool_resources": { + "code_interpreter": { + "file_ids": [] + } + } + } + deprecated: true + post: + operationId: modifyThread + tags: + - Assistants + summary: Modifies a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to modify. Only the `metadata` can be modified. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyThreadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadObject' + x-oaiMeta: + name: Modify thread + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "modified": "true", + "user": "abc123" + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.update( + thread_id="thread_id", + ) + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const updatedThread = await openai.beta.threads.update( + "thread_abc123", + { + metadata: { modified: "true", user: "abc123" }, + } + ); + + console.log(updatedThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.update('thread_id'); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().update("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.update("thread_id") + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": { + "modified": "true", + "user": "abc123" + }, + "tool_resources": {} + } + deprecated: true + delete: + operationId: deleteThread + tags: + - Assistants + summary: Delete a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to delete. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteThreadResponse' + x-oaiMeta: + name: Delete thread + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread_deleted = client.beta.threads.delete( + "thread_id", + ) + print(thread_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const response = await openai.beta.threads.delete("thread_abc123"); + + console.log(response); + } + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const threadDeleted = await + client.beta.threads.delete('thread_id'); + + + console.log(threadDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthreadDeleted, err := client.Beta.Threads.Delete(context.TODO(), \"thread_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", threadDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadDeleteParams; + import com.openai.models.beta.threads.ThreadDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadDeleted threadDeleted = client.beta().threads().delete("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread_deleted = openai.beta.threads.delete("thread_id") + + puts(thread_deleted) + response: | + { + "id": "thread_abc123", + "object": "thread.deleted", + "deleted": true + } + deprecated: true + /threads/{thread_id}/messages: + get: + operationId: listMessages + tags: + - Assistants + summary: Returns a list of messages for a given thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: >- + The ID of the [thread](/docs/api-reference/threads) the messages + belong to. + - name: limit + in: query + description: >- + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: run_id + in: query + description: | + Filter messages by the run ID that generated them. + schema: + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListMessagesResponse' + x-oaiMeta: + name: List messages + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.threads.messages.list( + thread_id="thread_id", + ) + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const threadMessages = await openai.beta.threads.messages.list( + "thread_abc123" + ); + + console.log(threadMessages.data); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const message of + client.beta.threads.messages.list('thread_id')) { + console.log(message.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Threads.Messages.List(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadMessageListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.messages.MessageListPage; + import com.openai.models.beta.threads.messages.MessageListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageListPage page = client.beta().threads().messages().list("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.threads.messages.list("thread_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699016383, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + }, + { + "id": "msg_abc456", + "object": "thread.message", + "created_at": 1699016383, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Hello, what is AI?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + ], + "first_id": "msg_abc123", + "last_id": "msg_abc456", + "has_more": false + } + deprecated: true + post: + operationId: createMessage + tags: + - Assistants + summary: Create a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: >- + The ID of the [thread](/docs/api-reference/threads) to create a + message for. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateMessageRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MessageObject' + x-oaiMeta: + name: Create message + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "role": "user", + "content": "How does AI work? Explain it in simple terms." + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message = client.beta.threads.messages.create( + thread_id="thread_id", + content="string", + role="user", + ) + print(message.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const threadMessages = await openai.beta.threads.messages.create( + "thread_abc123", + { role: "user", content: "How does AI work? Explain it in simple terms." } + ); + + console.log(threadMessages); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const message = await + client.beta.threads.messages.create('thread_id', { + content: 'string', + role: 'user', + }); + + + console.log(message.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.Beta.Threads.Messages.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadMessageNewParams{\n\t\t\tContent: openai.BetaThreadMessageNewParamsContentUnion{\n\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t},\n\t\t\tRole: openai.BetaThreadMessageNewParamsRoleUser,\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.threads.messages.Message; + + import + com.openai.models.beta.threads.messages.MessageCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageCreateParams params = MessageCreateParams.builder() + .threadId("thread_id") + .content("string") + .role(MessageCreateParams.Role.USER) + .build(); + Message message = client.beta().threads().messages().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + message = openai.beta.threads.messages.create("thread_id", + content: "string", role: :user) + + + puts(message) + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1713226573, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + deprecated: true + /threads/{thread_id}/messages/{message_id}: + get: + operationId: getMessage + tags: + - Assistants + summary: Retrieve a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: >- + The ID of the [thread](/docs/api-reference/threads) to which this + message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to retrieve. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MessageObject' + x-oaiMeta: + name: Retrieve message + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 + \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message = client.beta.threads.messages.retrieve( + message_id="message_id", + thread_id="thread_id", + ) + print(message.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const message = await openai.beta.threads.messages.retrieve( + "msg_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(message); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const message = await + client.beta.threads.messages.retrieve('message_id', { + thread_id: 'thread_id', + }); + + + console.log(message.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.Beta.Threads.Messages.Get(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"message_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.threads.messages.Message; + + import + com.openai.models.beta.threads.messages.MessageRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageRetrieveParams params = MessageRetrieveParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + Message message = client.beta().threads().messages().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + message = openai.beta.threads.messages.retrieve("message_id", + thread_id: "thread_id") + + + puts(message) + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699017614, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + deprecated: true + post: + operationId: modifyMessage + tags: + - Assistants + summary: Modifies a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to modify. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyMessageRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MessageObject' + x-oaiMeta: + name: Modify message + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 + \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "modified": "true", + "user": "abc123" + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message = client.beta.threads.messages.update( + message_id="message_id", + thread_id="thread_id", + ) + print(message.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const message = await openai.beta.threads.messages.update( + "thread_abc123", + "msg_abc123", + { + metadata: { + modified: "true", + user: "abc123", + }, + } + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const message = await + client.beta.threads.messages.update('message_id', { thread_id: + 'thread_id' }); + + + console.log(message.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.Beta.Threads.Messages.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"message_id\",\n\t\topenai.BetaThreadMessageUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.threads.messages.Message; + + import + com.openai.models.beta.threads.messages.MessageUpdateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageUpdateParams params = MessageUpdateParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + Message message = client.beta().threads().messages().update(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + message = openai.beta.threads.messages.update("message_id", + thread_id: "thread_id") + + + puts(message) + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699017614, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "file_ids": [], + "metadata": { + "modified": "true", + "user": "abc123" + } + } + deprecated: true + delete: + operationId: deleteMessage + tags: + - Assistants + summary: Deletes a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to delete. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteMessageResponse' + x-oaiMeta: + name: Delete message + group: threads + beta: true + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 + \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message_deleted = client.beta.threads.messages.delete( + message_id="message_id", + thread_id="thread_id", + ) + print(message_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const deletedMessage = await openai.beta.threads.messages.delete( + "msg_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(deletedMessage); + } + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const messageDeleted = await + client.beta.threads.messages.delete('message_id', { + thread_id: 'thread_id', + }); + + + console.log(messageDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessageDeleted, err := client.Beta.Threads.Messages.Delete(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"message_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", messageDeleted.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.beta.threads.messages.MessageDeleteParams; + + import com.openai.models.beta.threads.messages.MessageDeleted; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageDeleteParams params = MessageDeleteParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + MessageDeleted messageDeleted = client.beta().threads().messages().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + message_deleted = + openai.beta.threads.messages.delete("message_id", thread_id: + "thread_id") + + + puts(message_deleted) + response: | + { + "id": "msg_abc123", + "object": "thread.message.deleted", + "deleted": true + } + deprecated: true + /threads/{thread_id}/runs: + get: + operationId: listRuns + tags: + - Assistants + summary: Returns a list of runs belonging to a thread. + parameters: + - name: thread_id + in: path + required: true + schema: + type: string + description: The ID of the thread the run belongs to. + - name: limit + in: query + description: >- + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListRunsResponse' + x-oaiMeta: + name: List runs + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.threads.runs.list( + thread_id="thread_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const runs = await openai.beta.threads.runs.list( + "thread_abc123" + ); + + console.log(runs); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const run of + client.beta.threads.runs.list('thread_id')) { + console.log(run.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Threads.Runs.List(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.RunListPage; + import com.openai.models.beta.threads.runs.RunListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunListPage page = client.beta().threads().runs().list("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.threads.runs.list("thread_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + }, + { + "id": "run_abc456", + "object": "thread.run", + "created_at": 1699063290, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699063290, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699063291, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + ], + "first_id": "run_abc123", + "last_id": "run_abc456", + "has_more": false + } + deprecated: true + post: + operationId: createRun + tags: + - Assistants + summary: Create a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to run. + - name: include[] + in: query + description: > + A list of additional fields to include in the response. Currently + the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch + the file search result content. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Create run + group: threads + beta: true + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.create( + thread_id="thread_id", + assistant_id="assistant_id", + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.create( + "thread_abc123", + { assistant_id: "asst_abc123" } + ); + + console.log(run); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.runs.create('thread_id', { + assistant_id: 'assistant_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunNewParams{\n\t\t\tAssistantID: \"assistant_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .threadId("thread_id") + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().runs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.create("thread_id", assistant_id: + "assistant_id") + + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699063290, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "queued", + "started_at": 1699063290, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699063291, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/threads/thread_123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_123", + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.create( + thread_id="thread_id", + assistant_id="assistant_id", + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.runs.create( + "thread_123", + { assistant_id: "asst_123", stream: true } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.runs.create('thread_id', { + assistant_id: 'assistant_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunNewParams{\n\t\t\tAssistantID: \"assistant_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .threadId("thread_id") + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().runs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.create("thread_id", assistant_id: + "assistant_id") + + + puts(run) + response: > + event: thread.run.created + + data: + {"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-4o","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}} + + + event: thread.run.queued + + data: + {"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-4o","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}} + + + event: thread.run.in_progress + + data: + {"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-4o","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}} + + + event: thread.run.step.created + + data: + {"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} + + + event: thread.run.step.in_progress + + data: + {"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} + + + event: thread.message.created + + data: + {"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":{}} + + + event: thread.message.in_progress + + data: + {"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":{}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + + ... + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + today"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + + event: thread.message.completed + + data: + {"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":{}} + + + event: thread.run.step.completed + + data: + {"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}} + + + event: thread.run.completed + + data: + {"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-4o","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}} + + + event: done + + data: [DONE] + - title: Streaming with Functions + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "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"] + } + } + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.create( + thread_id="thread_id", + assistant_id="assistant_id", + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const 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"], + }, + } + } + ]; + + async function main() { + const stream = await openai.beta.threads.runs.create( + "thread_abc123", + { + assistant_id: "asst_abc123", + tools: tools, + stream: true + } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.runs.create('thread_id', { + assistant_id: 'assistant_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunNewParams{\n\t\t\tAssistantID: \"assistant_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .threadId("thread_id") + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().runs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.create("thread_id", assistant_id: + "assistant_id") + + + puts(run) + response: > + event: thread.run.created + + data: + {"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-4o","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}} + + + event: thread.run.queued + + data: + {"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-4o","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}} + + + event: thread.run.in_progress + + data: + {"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-4o","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}} + + + event: thread.run.step.created + + data: + {"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} + + + event: thread.run.step.in_progress + + data: + {"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} + + + event: thread.message.created + + data: + {"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":{}} + + + event: thread.message.in_progress + + data: + {"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":{}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + + ... + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + today"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + + event: thread.message.completed + + data: + {"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":{}} + + + event: thread.run.step.completed + + data: + {"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}} + + + event: thread.run.completed + + data: + {"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-4o","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}} + + + event: done + + data: [DONE] + deprecated: true + /threads/{thread_id}/runs/{run_id}: + get: + operationId: getRun + tags: + - Assistants + summary: Retrieves a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) that was run. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to retrieve. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Retrieve run + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.beta.threads.runs.retrieve( + run_id="run_id", + thread_id="thread_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.retrieve( + "run_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(run); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.runs.retrieve('run_id', { + thread_id: 'thread_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.Get(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunRetrieveParams params = RunRetrieveParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + Run run = client.beta().threads().runs().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.retrieve("run_id", thread_id: + "thread_id") + + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + deprecated: true + post: + operationId: modifyRun + tags: + - Assistants + summary: Modifies a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) that was run. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to modify. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Modify run + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "user_id": "user_abc123" + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.beta.threads.runs.update( + run_id="run_id", + thread_id="thread_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.update( + "run_abc123", + { + thread_id: "thread_abc123", + metadata: { + user_id: "user_abc123", + }, + } + ); + + console.log(run); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.runs.update('run_id', { + thread_id: 'thread_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunUpdateParams params = RunUpdateParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + Run run = client.beta().threads().runs().update(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.update("run_id", thread_id: + "thread_id") + + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": { + "user_id": "user_abc123" + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + deprecated: true + /threads/{thread_id}/runs/{run_id}/cancel: + post: + operationId: cancelRun + tags: + - Assistants + summary: Cancels a run that is `in_progress`. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this run belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to cancel. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Cancel a run + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/cancel + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X POST + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.beta.threads.runs.cancel( + run_id="run_id", + thread_id="thread_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.cancel( + "run_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(run); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.beta.threads.runs.cancel('run_id', { + thread_id: 'thread_id' }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.Cancel(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCancelParams params = RunCancelParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + Run run = client.beta().threads().runs().cancel(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.cancel("run_id", thread_id: + "thread_id") + + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699076126, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "cancelling", + "started_at": 1699076126, + "expires_at": 1699076726, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "last_error": null, + "model": "gpt-4o", + "instructions": "You summarize books.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": ["vs_123"] + } + }, + "metadata": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + deprecated: true + /threads/{thread_id}/runs/{run_id}/steps: + get: + operationId: listRunSteps + tags: + - Assistants + summary: Returns a list of run steps belonging to a run. + parameters: + - name: thread_id + in: path + required: true + schema: + type: string + description: The ID of the thread the run and run steps belong to. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run the run steps belong to. + - name: limit + in: query + description: >- + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: include[] + in: query + description: > + A list of additional fields to include in the response. Currently + the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch + the file search result content. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListRunStepsResponse' + x-oaiMeta: + name: List run steps + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.threads.runs.steps.list( + run_id="run_id", + thread_id="thread_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const runStep = await openai.beta.threads.runs.steps.list( + "run_abc123", + { thread_id: "thread_abc123" } + ); + console.log(runStep); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const runStep of + client.beta.threads.runs.steps.list('run_id', { + thread_id: 'thread_id', + })) { + console.log(runStep.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Threads.Runs.Steps.List(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunStepListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.steps.StepListPage; + import com.openai.models.beta.threads.runs.steps.StepListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + StepListParams params = StepListParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + StepListPage page = client.beta().threads().runs().steps().list(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + page = openai.beta.threads.runs.steps.list("run_id", thread_id: + "thread_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + ], + "first_id": "step_abc123", + "last_id": "step_abc456", + "has_more": false + } + deprecated: true + /threads/{thread_id}/runs/{run_id}/steps/{step_id}: + get: + operationId: getRunStep + tags: + - Assistants + summary: Retrieves a run step. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which the run and run step belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to which the run step belongs. + - in: path + name: step_id + required: true + schema: + type: string + description: The ID of the run step to retrieve. + - name: include[] + in: query + description: > + A list of additional fields to include in the response. Currently + the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch + the file search result content. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunStepObject' + x-oaiMeta: + name: Retrieve run step + group: threads + beta: true + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run_step = client.beta.threads.runs.steps.retrieve( + step_id="step_id", + thread_id="thread_id", + run_id="run_id", + ) + print(run_step.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const runStep = await openai.beta.threads.runs.steps.retrieve( + "step_abc123", + { thread_id: "thread_abc123", run_id: "run_abc123" } + ); + console.log(runStep); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const runStep = await + client.beta.threads.runs.steps.retrieve('step_id', { + thread_id: 'thread_id', + run_id: 'run_id', + }); + + + console.log(runStep.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trunStep, err := client.Beta.Threads.Runs.Steps.Get(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\t\"step_id\",\n\t\topenai.BetaThreadRunStepGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", runStep.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.threads.runs.steps.RunStep; + + import + com.openai.models.beta.threads.runs.steps.StepRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + StepRetrieveParams params = StepRetrieveParams.builder() + .threadId("thread_id") + .runId("run_id") + .stepId("step_id") + .build(); + RunStep runStep = client.beta().threads().runs().steps().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run_step = openai.beta.threads.runs.steps.retrieve("step_id", + thread_id: "thread_id", run_id: "run_id") + + + puts(run_step) + response: | + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + deprecated: true + /threads/{thread_id}/runs/{run_id}/submit_tool_outputs: + post: + operationId: submitToolOuputsToRun + 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. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: >- + The ID of the [thread](/docs/api-reference/threads) to which this + run belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run that requires the tool output submission. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SubmitToolOutputsRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Submit tool outputs to run + group: threads + beta: true + examples: + - title: Default + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "tool_outputs": [ + { + "tool_call_id": "call_001", + "output": "70 degrees and sunny." + } + ] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.submit_tool_outputs( + run_id="run_id", + thread_id="thread_id", + tool_outputs=[{}], + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.submitToolOutputs( + "run_123", + { + thread_id: "thread_123", + tool_outputs: [ + { + tool_call_id: "call_001", + output: "70 degrees and sunny.", + }, + ], + } + ); + + console.log(run); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await + client.beta.threads.runs.submitToolOutputs('run_id', { + thread_id: 'thread_id', + tool_outputs: [{}], + }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.SubmitToolOutputs(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunSubmitToolOutputsParams{\n\t\t\tToolOutputs: []openai.BetaThreadRunSubmitToolOutputsParamsToolOutput{{}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.threads.runs.Run; + + import + com.openai.models.beta.threads.runs.RunSubmitToolOutputsParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunSubmitToolOutputsParams params = RunSubmitToolOutputsParams.builder() + .threadId("thread_id") + .runId("run_id") + .addToolOutput(RunSubmitToolOutputsParams.ToolOutput.builder().build()) + .build(); + Run run = client.beta().threads().runs().submitToolOutputs(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.submit_tool_outputs("run_id", + thread_id: "thread_id", tool_outputs: [{}]) + + + puts(run) + response: | + { + "id": "run_123", + "object": "thread.run", + "created_at": 1699075592, + "assistant_id": "asst_123", + "thread_id": "thread_123", + "status": "queued", + "started_at": 1699075592, + "expires_at": 1699076192, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "last_error": null, + "model": "gpt-4o", + "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": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "tool_outputs": [ + { + "tool_call_id": "call_001", + "output": "70 degrees and sunny." + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.submit_tool_outputs( + run_id="run_id", + thread_id="thread_id", + tool_outputs=[{}], + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.runs.submitToolOutputs( + "run_123", + { + thread_id: "thread_123", + tool_outputs: [ + { + tool_call_id: "call_001", + output: "70 degrees and sunny.", + }, + ], + } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await + client.beta.threads.runs.submitToolOutputs('run_id', { + thread_id: 'thread_id', + tool_outputs: [{}], + }); + + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.SubmitToolOutputs(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunSubmitToolOutputsParams{\n\t\t\tToolOutputs: []openai.BetaThreadRunSubmitToolOutputsParamsToolOutput{{}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.beta.threads.runs.Run; + + import + com.openai.models.beta.threads.runs.RunSubmitToolOutputsParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunSubmitToolOutputsParams params = RunSubmitToolOutputsParams.builder() + .threadId("thread_id") + .runId("run_id") + .addToolOutput(RunSubmitToolOutputsParams.ToolOutput.builder().build()) + .build(); + Run run = client.beta().threads().runs().submitToolOutputs(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + run = openai.beta.threads.runs.submit_tool_outputs("run_id", + thread_id: "thread_id", tool_outputs: [{}]) + + + puts(run) + response: > + event: thread.run.step.completed + + data: + {"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}} + + + event: thread.run.queued + + data: + {"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-4o","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}} + + + event: thread.run.in_progress + + data: + {"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-4o","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}} + + + event: thread.run.step.created + + data: + {"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} + + + event: thread.run.step.in_progress + + data: + {"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} + + + event: thread.message.created + + data: + {"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":{}} + + + event: thread.message.in_progress + + data: + {"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":{}} + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"The","annotations":[]}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + current"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + weather"}}]}} + + + ... + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + sunny"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"."}}]}} + + + event: thread.message.completed + + data: + {"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":{}} + + + event: thread.run.step.completed + + data: + {"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}} + + + event: thread.run.completed + + data: + {"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-4o","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}} + + + event: done + + data: [DONE] + deprecated: true +components: + schemas: + 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: | + { + "object": "list", + "data": [ + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698982736, + "name": "Coding Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc456", + "object": "assistant", + "created_at": 1698982718, + "name": "My Assistant", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc789", + "object": "assistant", + "created_at": 1698982643, + "name": null, + "description": null, + "model": "gpt-4o", + "instructions": null, + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + ], + "first_id": "asst_abc123", + "last_id": "asst_abc789", + "has_more": false + } + CreateAssistantRequest: + type: object + additionalProperties: false + properties: + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. + example: gpt-4o + x-oaiTypeLabel: 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 + - 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 + name: + description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + description: + description: > + The description of the assistant. The maximum length is 512 + characters. + type: string + maxLength: 512 + instructions: + description: > + The system instructions that the assistant uses. The maximum length + is 256,000 characters. + type: string + maxLength: 256000 + 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`. + default: [] + type: array + maxItems: 128 + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearch' + - $ref: '#/components/schemas/AssistantToolsFunction' + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector store](/docs/api-reference/vector-stores/object) + attached to this assistant. There can be a maximum of 1 + vector store attached to the assistant. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: > + A helper to create a [vector + store](/docs/api-reference/vector-stores/object) with + file_ids and attach it to this assistant. There can be a + maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/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. + 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`. + + + Note that the overlap must not exceed half + of `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + required: + - type + - static + metadata: + $ref: '#/components/schemas/Metadata' + oneOf: + - required: + - vector_store_ids + - required: + - vector_stores + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + 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. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + top_p: + 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. + + + We generally recommend altering this or temperature but not both. + response_format: + description: > + Specifies the format that the model must output. Compatible with + [GPT-4o](/docs/models#gpt-4o), [GPT-4 + Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo + models since `gpt-3.5-turbo-1106`. + + + Setting 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](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables JSON mode, which + ensures the message the model generates is valid JSON. + + + **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. + type: string + enum: + - auto + x-stainless-const: true + title: Text + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: > + Structured Outputs configuration options, including a JSON + Schema. + properties: + description: + type: string + description: > + A description of what the response format is for, used by + the model to + + determine how to respond in the format. + name: + type: string + description: > + The name of the response format. Must be a-z, A-Z, 0-9, or + contain + + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: > + Whether to enable strict schema adherence when + generating the output. + + If set to true, the model will always follow the exact + schema defined + + in the `schema` field. Only a subset of JSON Schema is + supported when + + `strict` is `true`. To learn more, read the [Structured + Outputs + + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + required: + - model + 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: + description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + description: + description: > + The description of the assistant. The maximum length is 512 + characters. + type: string + maxLength: 512 + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. + type: string + instructions: + description: > + The system instructions that the assistant uses. The maximum length + is 256,000 characters. + type: string + maxLength: 256000 + 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`. + default: [] + type: array + maxItems: 128 + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearch' + - $ref: '#/components/schemas/AssistantToolsFunction' + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter`` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The ID of the [vector + store](/docs/api-reference/vector-stores/object) attached to + this assistant. There can be a maximum of 1 vector store + attached to the assistant. + maxItems: 1 + items: + type: string + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + 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. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + top_p: + 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. + + + We generally recommend altering this or temperature but not both. + response_format: + description: > + Specifies the format that the model must output. Compatible with + [GPT-4o](/docs/models#gpt-4o), [GPT-4 + Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo + models since `gpt-3.5-turbo-1106`. + + + Setting 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](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables JSON mode, which + ensures the message the model generates is valid JSON. + + + **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. + type: string + enum: + - auto + x-stainless-const: true + title: Text + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: > + Structured Outputs configuration options, including a JSON + Schema. + properties: + description: + type: string + description: > + A description of what the response format is for, used by + the model to + + determine how to respond in the format. + name: + type: string + description: > + The name of the response format. Must be a-z, A-Z, 0-9, or + contain + + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: > + Whether to enable strict schema adherence when + generating the output. + + If set to true, the model will always follow the exact + schema defined + + in the `schema` field. Only a subset of JSON Schema is + supported when + + `strict` is `true`. To learn more, read the [Structured + Outputs + + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + required: + - id + - object + - created_at + - name + - description + - model + - instructions + - tools + - metadata + x-oaiMeta: + name: The assistant object + example: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698984975, + "name": "Math Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + deprecated: true + ModifyAssistantRequest: + type: object + additionalProperties: false + properties: + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. + 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 + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + name: + description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + description: + description: > + The description of the assistant. The maximum length is 512 + characters. + type: string + maxLength: 512 + instructions: + description: > + The system instructions that the assistant uses. The maximum length + is 256,000 characters. + type: string + maxLength: 256000 + 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`. + default: [] + type: array + maxItems: 128 + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearch' + - $ref: '#/components/schemas/AssistantToolsFunction' + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + Overrides the list of [file](/docs/api-reference/files) IDs + made available to the `code_interpreter` tool. There can be + a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + Overrides the [vector + store](/docs/api-reference/vector-stores/object) attached to + this assistant. There can be a maximum of 1 vector store + attached to the assistant. + maxItems: 1 + items: + type: string + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + 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. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + top_p: + 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. + + + We generally recommend altering this or temperature but not both. + response_format: + description: > + Specifies the format that the model must output. Compatible with + [GPT-4o](/docs/models#gpt-4o), [GPT-4 + Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo + models since `gpt-3.5-turbo-1106`. + + + Setting 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](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables JSON mode, which + ensures the message the model generates is valid JSON. + + + **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. + type: string + enum: + - auto + x-stainless-const: true + title: Text + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: > + Structured Outputs configuration options, including a JSON + Schema. + properties: + description: + type: string + description: > + A description of what the response format is for, used by + the model to + + determine how to respond in the format. + name: + type: string + description: > + The name of the response format. Must be a-z, A-Z, 0-9, or + contain + + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: > + Whether to enable strict schema adherence when + generating the output. + + If set to true, the model will always follow the exact + schema defined + + in the `schema` field. Only a subset of JSON Schema is + supported when + + `strict` is `true`. To learn more, read the [Structured + Outputs + + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + DeleteAssistantResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + enum: + - assistant.deleted + x-stainless-const: true + required: + - id + - object + - deleted + CreateThreadRequest: + type: object + description: | + Options to create a new thread. If no thread is provided when running a + request, an empty thread will be created. + additionalProperties: false + properties: + messages: + description: >- + A list of [messages](/docs/api-reference/messages) to start the + thread with. + type: array + items: + $ref: '#/components/schemas/CreateMessageRequest' + tool_resources: + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector store](/docs/api-reference/vector-stores/object) + attached to this thread. There can be a maximum of 1 vector + store attached to the thread. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: > + A helper to create a [vector + store](/docs/api-reference/vector-stores/object) with + file_ids and attach it to this thread. There can be a + maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/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. + 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`. + + + Note that the overlap must not exceed half + of `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + required: + - type + - static + metadata: + $ref: '#/components/schemas/Metadata' + oneOf: + - required: + - vector_store_ids + - required: + - vector_stores + metadata: + $ref: '#/components/schemas/Metadata' + ThreadObject: + type: object + title: Thread + description: >- + Represents a thread that contains + [messages](/docs/api-reference/messages). + 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 + created_at: + description: The Unix timestamp (in seconds) for when the thread was created. + type: integer + format: unixtime + tool_resources: + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector store](/docs/api-reference/vector-stores/object) + attached to this thread. There can be a maximum of 1 vector + store attached to the thread. + maxItems: 1 + items: + type: string + metadata: + $ref: '#/components/schemas/Metadata' + required: + - id + - object + - created_at + - tool_resources + - metadata + x-oaiMeta: + name: The thread object + beta: true + example: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1698107661, + "metadata": {} + } + CreateThreadAndRunRequest: + type: object + additionalProperties: false + properties: + assistant_id: + description: >- + The ID of the [assistant](/docs/api-reference/assistants) to use to + execute this run. + type: string + thread: + $ref: '#/components/schemas/CreateThreadRequest' + model: + description: >- + The ID of the [Model](/docs/api-reference/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-4o + x-oaiTypeLabel: string + nullable: true + 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 + instructions: + description: >- + Override the default system message of the assistant. This is useful + for modifying the behavior on a per-run basis. + type: string + 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' + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The ID of the [vector + store](/docs/api-reference/vector-stores/object) attached to + this assistant. There can be a maximum of 1 vector store + attached to the assistant. + maxItems: 1 + items: + type: string + 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. + 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. + + + We generally recommend altering this or temperature but not both. + 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. + 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. + 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. + minimum: 256 + truncation_strategy: + 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 + last_messages: + type: integer + description: >- + The number of most recent messages from the thread when + constructing the context for the run. + minimum: 1 + required: + - type + nullable: true + tool_choice: + description: > + Controls which (if any) tool is called by the model. + + `none` means the model will not call any tools and instead generates + a message. + + `auto` is the default value and 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. + + Specifying a particular tool like `{"type": "file_search"}` or + `{"type": "function", "function": {"name": "my_function"}}` forces + the model to call that tool. + type: string + enum: + - none + - auto + - required + 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. + required: + - name + required: + - type + nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + required: + - assistant_id + RunObject: + type: object + title: A run on a thread + description: Represents an execution run on a [thread](/docs/api-reference/threads). + 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: string + enum: + - thread.run + 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](/docs/api-reference/threads) that was + executed on as a part of this run. + type: string + assistant_id: + description: >- + The ID of the [assistant](/docs/api-reference/assistants) used for + execution of this run. + type: string + 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 + 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' + 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 + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + expires_at: + description: The Unix timestamp (in seconds) for when the run will expire. + type: integer + format: unixtime + nullable: true + started_at: + description: The Unix timestamp (in seconds) for when the run was started. + type: integer + format: unixtime + nullable: true + cancelled_at: + description: The Unix timestamp (in seconds) for when the run was cancelled. + type: integer + format: unixtime + nullable: true + failed_at: + description: The Unix timestamp (in seconds) for when the run failed. + type: integer + format: unixtime + nullable: true + completed_at: + description: The Unix timestamp (in seconds) for when the run was completed. + type: integer + format: unixtime + nullable: true + 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 + model: + description: >- + The model that the [assistant](/docs/api-reference/assistants) used + for this run. + type: string + instructions: + description: >- + The instructions that the + [assistant](/docs/api-reference/assistants) used for this run. + type: string + tools: + description: >- + The list of tools that the + [assistant](/docs/api-reference/assistants) used for this run. + default: [] + type: array + maxItems: 20 + 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 + max_prompt_tokens: + type: integer + nullable: true + description: > + The maximum number of prompt tokens specified to have been used over + the course of the run. + minimum: 256 + max_completion_tokens: + type: integer + nullable: true + description: > + The maximum number of completion tokens specified to have been used + over the course of the run. + minimum: 256 + truncation_strategy: + 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 + last_messages: + type: integer + description: >- + The number of most recent messages from the thread when + constructing the context for the run. + minimum: 1 + required: + - type + nullable: true + tool_choice: + description: > + Controls which (if any) tool is called by the model. + + `none` means the model will not call any tools and instead generates + a message. + + `auto` is the default value and 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. + + Specifying a particular tool like `{"type": "file_search"}` or + `{"type": "function", "function": {"name": "my_function"}}` forces + the model to call that tool. + type: string + enum: + - none + - auto + - required + 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. + required: + - name + required: + - type + nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + 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 + x-oaiMeta: + name: The run object + beta: true + example: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1698107661, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699073476, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699073498, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "tools": [{"type": "file_search"}, {"type": "code_interpreter"}], + "metadata": {}, + "incomplete_details": null, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + ModifyThreadRequest: + type: object + additionalProperties: false + properties: + tool_resources: + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector store](/docs/api-reference/vector-stores/object) + attached to this thread. There can be a maximum of 1 vector + store attached to the thread. + maxItems: 1 + items: + type: string + metadata: + $ref: '#/components/schemas/Metadata' + DeleteThreadResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + enum: + - thread.deleted + x-stainless-const: true + required: + - id + - object + - deleted + 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 + type: object + 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: + + - `user`: Indicates the message is sent by an actual user and should + be used in most cases to represent user-generated messages. + + - `assistant`: Indicates the message is generated by the assistant. + Use this value to insert messages from the assistant into the + conversation. + content: + type: string + description: The text contents of the message. + title: Text content + items: + oneOf: + - $ref: '#/components/schemas/MessageContentImageFileObject' + - $ref: '#/components/schemas/MessageContentImageUrlObject' + - $ref: '#/components/schemas/MessageRequestContentTextObject' + minItems: 1 + attachments: + 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 + metadata: + $ref: '#/components/schemas/Metadata' + MessageObject: + type: object + title: The message object + description: Represents a message within a [thread](/docs/api-reference/threads). + 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](/docs/api-reference/threads) 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: + 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 + completed_at: + description: The Unix timestamp (in seconds) for when the message was completed. + type: integer + format: unixtime + incomplete_at: + description: >- + The Unix timestamp (in seconds) for when the message was marked as + incomplete. + type: integer + format: unixtime + 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: + description: >- + If applicable, the ID of the + [assistant](/docs/api-reference/assistants) that authored this + message. + type: string + run_id: + description: >- + The ID of the [run](/docs/api-reference/runs) 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 + attachments: + 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. + 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: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1698983503, + "thread_id": "thread_abc123", + "role": "assistant", + "content": [ + { + "type": "text", + "text": { + "value": "Hi! How can I help you today?", + "annotations": [] + } + } + ], + "assistant_id": "asst_abc123", + "run_id": "run_abc123", + "attachments": [], + "metadata": {} + } + ModifyMessageRequest: + type: object + additionalProperties: false + properties: + metadata: + $ref: '#/components/schemas/Metadata' + 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 + 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 + CreateRunRequest: + type: object + additionalProperties: false + properties: + assistant_id: + description: >- + The ID of the [assistant](/docs/api-reference/assistants) to use to + execute this run. + type: string + model: + description: >- + The ID of the [Model](/docs/api-reference/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-4o + x-oaiTypeLabel: string + nullable: true + 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 + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + instructions: + description: >- + Overrides the + [instructions](/docs/api-reference/assistants/createAssistant) 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. + 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. + + + We generally recommend altering this or temperature but not both. + 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. + 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. + 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. + minimum: 256 + truncation_strategy: + 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 + last_messages: + type: integer + description: >- + The number of most recent messages from the thread when + constructing the context for the run. + minimum: 1 + required: + - type + nullable: true + tool_choice: + description: > + Controls which (if any) tool is called by the model. + + `none` means the model will not call any tools and instead generates + a message. + + `auto` is the default value and 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. + + Specifying a particular tool like `{"type": "file_search"}` or + `{"type": "function", "function": {"name": "my_function"}}` forces + the model to call that tool. + type: string + enum: + - none + - auto + - required + 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. + required: + - name + required: + - type + nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + required: + - assistant_id + ModifyRunRequest: + type: object + additionalProperties: false + properties: + metadata: + $ref: '#/components/schemas/Metadata' + 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 + type: object + RunStepObject: + type: object + title: Run steps + description: | + Represents a step in execution of a run. + 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: string + enum: + - thread.run.step + 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](/docs/api-reference/assistants) associated + with the run step. + type: string + thread_id: + description: The ID of the [thread](/docs/api-reference/threads) that was run. + type: string + run_id: + description: >- + The ID of the [run](/docs/api-reference/runs) 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. + title: Message creation + properties: + type: + description: Always `message_creation`. + type: string + enum: + - message_creation + 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 + 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`. + items: + oneOf: + - $ref: '#/components/schemas/RunStepDetailsToolCallsCodeObject' + - $ref: >- + #/components/schemas/RunStepDetailsToolCallsFileSearchObject + - $ref: '#/components/schemas/RunStepDetailsToolCallsFunctionObject' + required: + - type + - message_creation + - tool_calls + last_error: + 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. + required: + - code + - message + expired_at: + 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 + cancelled_at: + description: The Unix timestamp (in seconds) for when the run step was cancelled. + type: integer + format: unixtime + failed_at: + description: The Unix timestamp (in seconds) for when the run step failed. + type: integer + format: unixtime + completed_at: + description: The Unix timestamp (in seconds) for when the run step completed. + type: integer + format: unixtime + metadata: + $ref: '#/components/schemas/Metadata' + usage: + $ref: '#/components/schemas/RunStepCompletionUsage' + 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 + x-oaiMeta: + name: The run step object + beta: true + example: | + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + 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: + 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. + required: + - tool_outputs + 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 + ReasoningEffort: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + default: medium + description: > + Constrains effort on reasoning for + + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + + Currently supported values are `none`, `minimal`, `low`, `medium`, + `high`, and `xhigh`. Reducing + + reasoning effort can result in faster responses and fewer tokens used + + on reasoning in a response. + + + - `gpt-5.1` defaults to `none`, which does not perform reasoning. The + supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, + and `high`. Tool calls are supported for all reasoning values in + gpt-5.1. + + - All models before `gpt-5.1` default to `medium` reasoning effort, and + do not support `none`. + + - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning + effort. + + - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + 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. + + + Note that the file search tool may output fewer than + `max_num_results` results. See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. + ranking_options: + $ref: '#/components/schemas/FileSearchRankingOptions' + 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 + Metadata: + 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. + + + Keys are strings with a maximum length of 64 characters. Values are + strings + + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + AssistantsApiResponseFormatOption: + description: > + Specifies the format that the model must output. Compatible with + [GPT-4o](/docs/models#gpt-4o), [GPT-4 + Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models + since `gpt-3.5-turbo-1106`. + + + Setting 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](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures + the message the model generates is valid JSON. + + + **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. + type: string + enum: + - auto + x-stainless-const: true + title: Text + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: > + A description of what the response format is for, used by the + model to + + determine how to respond in the format. + name: + type: string + description: > + The name of the response format. Must be a-z, A-Z, 0-9, or + contain + + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: > + Whether to enable strict schema adherence when generating + the output. + + If set to true, the model will always follow the exact + schema defined + + in the `schema` field. Only a subset of JSON Schema is + supported when + + `strict` is `true`. To learn more, read the [Structured + Outputs + + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + 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 + last_messages: + type: integer + description: >- + The number of most recent messages from the thread when constructing + the context for the run. + minimum: 1 + required: + - type + AssistantsApiToolChoiceOption: + description: > + Controls which (if any) tool is called by the model. + + `none` means the model will not call any tools and instead generates a + message. + + `auto` is the default value and 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. + + Specifying a particular tool like `{"type": "file_search"}` or `{"type": + "function", "function": {"name": "my_function"}}` forces the model to + call that tool. + type: string + enum: + - none + - auto + - required + 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. + required: + - name + required: + - type + ParallelToolCalls: + description: >- + Whether to enable [parallel function + calling](/docs/guides/function-calling#configuring-parallel-function-calling) + during tool use. + type: boolean + default: true + 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](/docs/api-reference/runs/submitToolOutputs) endpoint. + 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 + description: The function definition. + properties: + 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. + required: + - name + - arguments + required: + - id + - type + - function + RunCompletionUsage: + 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 + MessageContentImageFileObject: + title: Image file + type: object + description: >- + References an image [File](/docs/api-reference/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](/docs/api-reference/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 + 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 + 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 + 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 + 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 + RunStepDetailsMessageCreationObject: + title: Message creation + type: object + description: Details of the message creation by the run step. + properties: + type: + description: Always `message_creation`. + type: string + enum: + - message_creation + 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 + required: + - type + - message_creation + RunStepDetailsToolCallsObject: + title: Tool calls + type: object + description: Details of the tool call. + properties: + type: + description: Always `tool_calls`. + type: string + enum: + - tool_calls + 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`. + items: + oneOf: + - $ref: '#/components/schemas/RunStepDetailsToolCallsCodeObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsFileSearchObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsFunctionObject' + required: + - type + - tool_calls + RunStepCompletionUsage: + 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 + 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. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. + 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 + 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: + 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](/docs/guides/function-calling). + required: + - name + ResponseFormatText: + type: object + title: Text + description: | + Default response format. Used to generate text responses. + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + required: + - type + ResponseFormatJsonObject: + type: object + title: JSON object + description: > + JSON object response format. An older method of generating JSON + responses. + + Using `json_schema` is recommended for models that support it. Note that + the + + model will not generate JSON without a system or user message + instructing it + + to do so. + 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. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). + properties: + type: + type: string + description: The type of response format being defined. Always `json_schema`. + enum: + - json_schema + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: > + A description of what the response format is for, used by the + model to + + determine how to respond in the format. + name: + type: string + description: > + The name of the response format. Must be a-z, A-Z, 0-9, or + contain + + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: > + Whether to enable strict schema adherence when generating + the output. + + If set to true, the model will always follow the exact + schema defined + + in the `schema` field. Only a subset of JSON Schema is + supported when + + `strict` is `true`. To learn more, read the [Structured + Outputs + + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + 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. + required: + - name + required: + - type + 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 + RunStepDetailsToolCallsCodeObject: + title: Code Interpreter tool call + type: object + description: Details of the Code Interpreter tool call the run step was involved in. + 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 + 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. + 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: + - id + - type + - code_interpreter + RunStepDetailsToolCallsFileSearchObject: + title: File search tool call + type: object + 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 + 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 + required: + - id + - type + - file_search + RunStepDetailsToolCallsFunctionObject: + type: object + title: Function tool call + 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 + 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: + - type: string + description: >- + The output of the function. This will be `null` if the + outputs have not been + [submitted](/docs/api-reference/runs/submitToolOutputs) yet. + - type: 'null' + required: + - name + - arguments + - output + required: + - id + - type + - function + 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 + FunctionParameters: + type: object + description: >- + The parameters the functions accepts, described as a JSON Schema object. + See the [guide](/docs/guides/function-calling) for examples, and the + [JSON Schema + reference](https://json-schema.org/understanding-json-schema/) for + documentation about the format. + + + Omitting `parameters` defines a function with an empty parameter list. + additionalProperties: true + ResponseFormatJsonSchemaSchema: + type: object + title: JSON schema + description: | + The schema for the response format, described as a JSON Schema object. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + RunStepDetailsToolCallsCodeOutputLogsObject: + title: Code Interpreter log output + type: object + description: Text output from the Code Interpreter tool call as part of a run step. + properties: + type: + description: Always `logs`. + type: string + enum: + - logs + x-stainless-const: true + logs: + type: string + description: The text output from the Code Interpreter tool call. + required: + - type + - logs + RunStepDetailsToolCallsCodeOutputImageObject: + title: Code Interpreter image output + type: object + properties: + type: + description: Always `image`. + type: string + enum: + - image + x-stainless-const: true + image: + type: object + properties: + file_id: + description: The [file](/docs/api-reference/files) ID of the image. + type: string + required: + - file_id + required: + - type + - image + 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 + 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 ID of the file that result was found in. + file_name: + 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. + required: + - file_id + - file_name + - score + x-stackQL-resources: + assistants: + id: openai.assistants.assistants + name: assistants + title: Assistants + methods: + list: + operation: + $ref: '#/paths/~1assistants/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1assistants/post' + response: + mediaType: application/json + openAPIDocKey: '200' + get: + operation: + $ref: '#/paths/~1assistants~1{assistant_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + update: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1assistants~1{assistant_id}/post' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: '#/paths/~1assistants~1{assistant_id}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/assistants/methods/get' + - $ref: '#/components/x-stackQL-resources/assistants/methods/list' + insert: + - $ref: '#/components/x-stackQL-resources/assistants/methods/create' + update: + - $ref: '#/components/x-stackQL-resources/assistants/methods/update' + delete: + - $ref: '#/components/x-stackQL-resources/assistants/methods/delete' + replace: [] + threads: + id: openai.assistants.threads + name: threads + title: Threads + methods: + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1threads/post' + response: + mediaType: application/json + openAPIDocKey: '200' + create_thread_and_run: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1threads~1runs/post' + response: + mediaType: application/json + openAPIDocKey: '200' + get: + operation: + $ref: '#/paths/~1threads~1{thread_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + update: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1threads~1{thread_id}/post' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: '#/paths/~1threads~1{thread_id}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/threads/methods/get' + insert: + - $ref: '#/components/x-stackQL-resources/threads/methods/create' + update: + - $ref: '#/components/x-stackQL-resources/threads/methods/update' + delete: + - $ref: '#/components/x-stackQL-resources/threads/methods/delete' + replace: [] + messages: + id: openai.assistants.messages + name: messages + title: Messages + methods: + list: + operation: + $ref: '#/paths/~1threads~1{thread_id}~1messages/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1threads~1{thread_id}~1messages/post' + response: + mediaType: application/json + openAPIDocKey: '200' + get: + operation: + $ref: '#/paths/~1threads~1{thread_id}~1messages~1{message_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + update: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1threads~1{thread_id}~1messages~1{message_id}/post' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: '#/paths/~1threads~1{thread_id}~1messages~1{message_id}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/messages/methods/get' + - $ref: '#/components/x-stackQL-resources/messages/methods/list' + insert: + - $ref: '#/components/x-stackQL-resources/messages/methods/create' + update: + - $ref: '#/components/x-stackQL-resources/messages/methods/update' + delete: + - $ref: '#/components/x-stackQL-resources/messages/methods/delete' + replace: [] + runs: + id: openai.assistants.runs + name: runs + title: Runs + methods: + list: + operation: + $ref: '#/paths/~1threads~1{thread_id}~1runs/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1threads~1{thread_id}~1runs/post' + response: + mediaType: application/json + openAPIDocKey: '200' + get: + operation: + $ref: '#/paths/~1threads~1{thread_id}~1runs~1{run_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + update: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1threads~1{thread_id}~1runs~1{run_id}/post' + response: + mediaType: application/json + openAPIDocKey: '200' + cancel: + operation: + $ref: '#/paths/~1threads~1{thread_id}~1runs~1{run_id}~1cancel/post' + response: + mediaType: application/json + openAPIDocKey: '200' + submit_tool_outputs: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: >- + #/paths/~1threads~1{thread_id}~1runs~1{run_id}~1submit_tool_outputs/post + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/runs/methods/get' + - $ref: '#/components/x-stackQL-resources/runs/methods/list' + insert: + - $ref: '#/components/x-stackQL-resources/runs/methods/create' + update: + - $ref: '#/components/x-stackQL-resources/runs/methods/update' + delete: [] + replace: [] + run_steps: + id: openai.assistants.run_steps + name: run_steps + title: Run Steps + methods: + list: + operation: + $ref: '#/paths/~1threads~1{thread_id}~1runs~1{run_id}~1steps/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + get: + operation: + $ref: >- + #/paths/~1threads~1{thread_id}~1runs~1{run_id}~1steps~1{step_id}/get + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/run_steps/methods/get' + - $ref: '#/components/x-stackQL-resources/run_steps/methods/list' + insert: [] + update: [] + delete: [] + replace: [] +servers: + - url: https://api.openai.com/v1 +x-stackQL-config: + pagination: + requestToken: + key: after + location: query + responseToken: + key: $.last_id + location: body + queryParamPushdown: + top: + paramName: limit + maxValue: 100 diff --git a/provider-dev/openapi/src/openai/v00.00.00000/services/batches.yaml b/provider-dev/openapi/src/openai/v00.00.00000/services/batches.yaml new file mode 100644 index 0000000..2e31257 --- /dev/null +++ b/provider-dev/openapi/src/openai/v00.00.00000/services/batches.yaml @@ -0,0 +1,1029 @@ +openapi: 3.1.0 +info: + title: batches API + description: openai API + version: 2.3.0 +paths: + /batches: + post: + summary: Creates and executes a batch from an uploaded file of requests + operationId: createBatch + tags: + - Batch + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - input_file_id + - endpoint + - completion_window + properties: + input_file_id: + type: string + description: > + The ID of an uploaded file that contains requests for the + new batch. + + + See [upload file](/docs/api-reference/files/create) for how + to upload a file. + + + Your input file must be formatted as a [JSONL + file](/docs/api-reference/batch/request-input), 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. + 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. + completion_window: + type: string + enum: + - 24h + description: >- + The time frame within which the batch should be processed. + Currently only `24h` is supported. + metadata: + $ref: '#/components/schemas/Metadata' + output_expires_after: + $ref: '#/components/schemas/BatchFileExpirationAfter' + responses: + '200': + description: Batch created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Batch' + x-oaiMeta: + name: Create batch + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "input_file_id": "file-abc123", + "endpoint": "/v1/chat/completions", + "completion_window": "24h" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + batch = client.batches.create( + completion_window="24h", + endpoint="/v1/responses", + input_file_id="input_file_id", + ) + print(batch.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.create({ + input_file_id: "file-abc123", + endpoint: "/v1/chat/completions", + completion_window: "24h" + }); + + console.log(batch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const batch = await client.batches.create({ + completion_window: '24h', + endpoint: '/v1/responses', + input_file_id: 'input_file_id', + }); + + console.log(batch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.New(context.TODO(), openai.BatchNewParams{\n\t\tCompletionWindow: openai.BatchNewParamsCompletionWindow24h,\n\t\tEndpoint: openai.BatchNewParamsEndpointV1Responses,\n\t\tInputFileID: \"input_file_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.Batch; + import com.openai.models.batches.BatchCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BatchCreateParams params = BatchCreateParams.builder() + .completionWindow(BatchCreateParams.CompletionWindow._24H) + .endpoint(BatchCreateParams.Endpoint.V1_RESPONSES) + .inputFileId("input_file_id") + .build(); + Batch batch = client.batches().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + batch = openai.batches.create( + completion_window: :"24h", + endpoint: :"/v1/responses", + input_file_id: "input_file_id" + ) + + puts(batch) + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "validating", + "output_file_id": null, + "error_file_id": null, + "created_at": 1711471533, + "in_progress_at": null, + "expires_at": null, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 0, + "completed": 0, + "failed": 0 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + get: + operationId: listBatches + tags: + - Batch + summary: List your organization's batches. + parameters: + - in: query + name: after + required: false + schema: + type: string + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + - name: limit + in: query + description: >- + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Batch listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ListBatchesResponse' + x-oaiMeta: + name: List batches + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches?limit=2 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.batches.list() + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.batches.list(); + + for await (const batch of list) { + console.log(batch); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const batch of client.batches.list()) { + console.log(batch.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Batches.List(context.TODO(), openai.BatchListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.BatchListPage; + import com.openai.models.batches.BatchListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BatchListPage page = client.batches().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.batches.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly job", + } + }, + { ... }, + ], + "first_id": "batch_abc123", + "last_id": "batch_abc456", + "has_more": true + } + /batches/{batch_id}: + get: + operationId: retrieveBatch + tags: + - Batch + summary: Retrieves a batch. + parameters: + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the batch to retrieve. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Batch retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Batch' + x-oaiMeta: + name: Retrieve batch + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches/batch_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + batch = client.batches.retrieve( + "batch_id", + ) + print(batch.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.retrieve("batch_abc123"); + + console.log(batch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const batch = await client.batches.retrieve('batch_id'); + + console.log(batch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.Get(context.TODO(), \"batch_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.Batch; + import com.openai.models.batches.BatchRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Batch batch = client.batches().retrieve("batch_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + batch = openai.batches.retrieve("batch_id") + + puts(batch) + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + /batches/{batch_id}/cancel: + post: + operationId: cancelBatch + 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. + parameters: + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the batch to cancel. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Batch is cancelling. Returns the cancelling batch's details. + content: + application/json: + schema: + $ref: '#/components/schemas/Batch' + x-oaiMeta: + name: Cancel batch + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches/batch_abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -X POST + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + batch = client.batches.cancel( + "batch_id", + ) + print(batch.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.cancel("batch_abc123"); + + console.log(batch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const batch = await client.batches.cancel('batch_id'); + + console.log(batch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.Cancel(context.TODO(), \"batch_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.Batch; + import com.openai.models.batches.BatchCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Batch batch = client.batches().cancel("batch_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + batch = openai.batches.cancel("batch_id") + + puts(batch) + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "cancelling", + "output_file_id": null, + "error_file_id": null, + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": 1711475133, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 23, + "failed": 1 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } +components: + schemas: + Metadata: + 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. + + + Keys are strings with a maximum length of 64 characters. Values are + strings + + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + 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 + required: + - anchor + - seconds + Batch: + type: object + properties: + id: + type: string + object: + type: string + enum: + - batch + description: The object type, which is always `batch`. + x-stainless-const: true + endpoint: + type: string + description: The OpenAI API endpoint used by the batch. + model: + type: string + description: > + Model ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI + + offers a wide range of models with different capabilities, + performance + + characteristics, and price points. Refer to the [model + + guide](/docs/models) to browse and compare available models. + errors: + type: object + properties: + object: + type: string + description: The object type, which is always `list`. + data: + type: array + items: + 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 + description: >- + The name of the parameter that caused the error, if + applicable. + - type: 'null' + line: + anyOf: + - type: integer + description: >- + The line number of the input file where the error + occurred, if applicable. + - type: 'null' + input_file_id: + type: string + description: The ID of the input file for the batch. + completion_window: + type: string + description: The time frame within which the batch should be processed. + status: + type: string + description: The current status of the batch. + enum: + - validating + - failed + - in_progress + - finalizing + - completed + - expired + - cancelling + - cancelled + output_file_id: + type: string + description: >- + The ID of the file containing the outputs of successfully executed + requests. + error_file_id: + type: string + description: The ID of the file containing the outputs of requests with errors. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was created. + in_progress_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the batch started + processing. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch will expire. + finalizing_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the batch started + finalizing. + completed_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was completed. + failed_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch failed. + expired_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch expired. + cancelling_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the batch started + cancelling. + cancelled_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was cancelled. + request_counts: + 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. + failed: + type: integer + description: Number of requests that have failed. + required: + - total + - completed + - failed + description: The request counts for different statuses within the batch. + usage: + type: object + description: > + Represents token usage details including input tokens, output + tokens, a + + breakdown of output tokens, and the total tokens used. Only + populated on + + batches created after September 7, 2025. + 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 + + prompt caching](/docs/guides/prompt-caching). + 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. + 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: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/completions", + "model": "gpt-5-2025-08-07", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "usage": { + "input_tokens": 1500, + "input_tokens_details": { + "cached_tokens": 1024 + }, + "output_tokens": 500, + "output_tokens_details": { + "reasoning_tokens": 300 + }, + "total_tokens": 2000 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + 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 + x-stackQL-resources: + batches: + id: openai.batches.batches + name: batches + title: Batches + methods: + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1batches/post' + response: + mediaType: application/json + openAPIDocKey: '200' + list: + operation: + $ref: '#/paths/~1batches/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + get: + operation: + $ref: '#/paths/~1batches~1{batch_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + cancel: + operation: + $ref: '#/paths/~1batches~1{batch_id}~1cancel/post' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/batches/methods/get' + - $ref: '#/components/x-stackQL-resources/batches/methods/list' + insert: + - $ref: '#/components/x-stackQL-resources/batches/methods/create' + update: [] + delete: [] + replace: [] +servers: + - url: https://api.openai.com/v1 +x-stackQL-config: + pagination: + requestToken: + key: after + location: query + responseToken: + key: $.last_id + location: body + queryParamPushdown: + top: + paramName: limit + maxValue: 100 diff --git a/provider-dev/openapi/src/openai/v00.00.00000/services/containers.yaml b/provider-dev/openapi/src/openai/v00.00.00000/services/containers.yaml new file mode 100644 index 0000000..dfbb5ce --- /dev/null +++ b/provider-dev/openapi/src/openai/v00.00.00000/services/containers.yaml @@ -0,0 +1,1533 @@ +openapi: 3.1.0 +info: + title: containers API + description: openai API + version: 2.3.0 +paths: + /containers: + get: + summary: List Containers + description: Lists containers. + operationId: ListContainers + parameters: + - name: limit + in: query + description: >- + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: name + in: query + description: Filter results by container name. + required: false + schema: + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerListResource' + x-oaiMeta: + name: List containers + group: containers + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/containers \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const containerListResponse of + client.containers.list()) { + console.log(containerListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.containers.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Containers.List(context.TODO(), openai.ContainerListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerListPage; + import com.openai.models.containers.ContainerListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContainerListPage page = client.containers().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.containers.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "4g", + "name": "My Container" + } + ], + "first_id": "container_123", + "last_id": "container_123", + "has_more": false + } + tags: + - Containers + post: + summary: Create Container + description: Creates a container. + operationId: CreateContainer + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateContainerBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerResource' + x-oaiMeta: + name: Create container + group: containers + path: post + examples: + request: + curl: | + curl https://api.openai.com/v1/containers \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "My Container", + "memory_limit": "4g", + "skills": [ + { + "type": "skill_reference", + "skill_id": "skill_4db6f1a2c9e73508b41f9da06e2c7b5f" + }, + { + "type": "skill_reference", + "skill_id": "openai-spreadsheets", + "version": "latest" + } + ], + "network_policy": { + "type": "allowlist", + "allowed_domains": ["api.buildkite.com"] + } + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const container = await client.containers.create({ name: 'name' + }); + + + console.log(container.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + container = client.containers.create( + name="name", + ) + print(container.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcontainer, err := client.Containers.New(context.TODO(), openai.ContainerNewParams{\n\t\tName: \"name\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", container.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerCreateParams; + import com.openai.models.containers.ContainerCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContainerCreateParams params = ContainerCreateParams.builder() + .name("name") + .build(); + ContainerCreateResponse container = client.containers().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + container = openai.containers.create(name: "name") + + puts(container) + response: | + { + "id": "cntr_682e30645a488191b6363a0cbefc0f0a025ec61b66250591", + "object": "container", + "created_at": 1747857508, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747857508, + "network_policy": { + "type": "allowlist", + "allowed_domains": ["api.buildkite.com"] + }, + "memory_limit": "4g", + "name": "My Container" + } + tags: + - Containers + /containers/{container_id}: + get: + summary: Retrieve Container + description: Retrieves a container. + operationId: RetrieveContainer + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerResource' + x-oaiMeta: + name: Retrieve container + group: containers + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const container = await + client.containers.retrieve('container_id'); + + + console.log(container.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + container = client.containers.retrieve( + "container_id", + ) + print(container.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcontainer, err := client.Containers.Get(context.TODO(), \"container_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", container.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerRetrieveParams; + import com.openai.models.containers.ContainerRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContainerRetrieveResponse container = client.containers().retrieve("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + container = openai.containers.retrieve("container_id") + + puts(container) + response: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "4g", + "name": "My Container" + } + tags: + - Containers + delete: + operationId: DeleteContainer + summary: Delete Container + description: Delete a container. + parameters: + - name: container_id + in: path + description: The ID of the container to delete. + required: true + schema: + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + x-oaiMeta: + name: Delete a container + group: containers + path: delete + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + await client.containers.delete('container_id'); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.containers.delete( + "container_id", + ) + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Containers.Delete(context.TODO(), \"container_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + client.containers().delete("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + result = openai.containers.delete("container_id") + + puts(result) + response: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container.deleted", + "deleted": true + } + tags: + - Containers + /containers/{container_id}/files: + post: + summary: > + Create a Container File + + + You can send either a multipart/form-data request with the raw file + content, or a JSON request with a file ID. + description: | + Creates a container file. + operationId: CreateContainerFile + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateContainerFileBody' + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateContainerFileBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerFileResource' + x-oaiMeta: + name: Create container file + group: containers + path: post + examples: + request: + curl: > + curl + https://api.openai.com/v1/containers/cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04/files + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F file="@example.txt" + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const file = await client.containers.files.create('container_id'); + + console.log(file.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file = client.containers.files.create( + container_id="container_id", + ) + print(file.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfile, err := client.Containers.Files.New(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\topenai.ContainerFileNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", file.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileCreateParams; + import com.openai.models.containers.files.FileCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileCreateResponse file = client.containers().files().create("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file = openai.containers.files.create("container_id") + + puts(file) + response: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + tags: + - Containers + get: + summary: List Container files + description: Lists container files. + operationId: ListContainerFiles + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: limit + in: query + description: >- + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerFileListResource' + x-oaiMeta: + name: List container files + group: containers + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/containers/cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04/files + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const fileListResponse of + client.containers.files.list('container_id')) { + console.log(fileListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.containers.files.list( + container_id="container_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Containers.Files.List(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\topenai.ContainerFileListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileListPage; + import com.openai.models.containers.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileListPage page = client.containers().files().list("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.containers.files.list("container_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + ], + "first_id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "has_more": false, + "last_id": "cfile_682e0e8a43c88191a7978f477a09bdf5" + } + tags: + - Containers + /containers/{container_id}/files/{file_id}: + get: + summary: Retrieve Container File + description: Retrieves a container file. + operationId: RetrieveContainerFile + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: file_id + in: path + required: true + schema: + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerFileResource' + x-oaiMeta: + name: Retrieve container file + group: containers + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/containers/container_123/files/file_456 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const file = await client.containers.files.retrieve('file_id', { + container_id: 'container_id' }); + + + console.log(file.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file = client.containers.files.retrieve( + file_id="file_id", + container_id="container_id", + ) + print(file.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfile, err := client.Containers.Files.Get(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", file.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileRetrieveParams; + import com.openai.models.containers.files.FileRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileRetrieveParams params = FileRetrieveParams.builder() + .containerId("container_id") + .fileId("file_id") + .build(); + FileRetrieveResponse file = client.containers().files().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + file = openai.containers.files.retrieve("file_id", container_id: + "container_id") + + + puts(file) + response: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + tags: + - Containers + delete: + operationId: DeleteContainerFile + summary: Delete Container File + description: Delete a container file. + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: file_id + in: path + required: true + schema: + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + x-oaiMeta: + name: Delete a container file + group: containers + path: delete + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863/files/cfile_682e0e8a43c88191a7978f477a09bdf5 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + await client.containers.files.delete('file_id', { container_id: + 'container_id' }); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.containers.files.delete( + file_id="file_id", + container_id="container_id", + ) + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Containers.Files.Delete(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileDeleteParams params = FileDeleteParams.builder() + .containerId("container_id") + .fileId("file_id") + .build(); + client.containers().files().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + result = openai.containers.files.delete("file_id", container_id: + "container_id") + + + puts(result) + response: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file.deleted", + "deleted": true + } + tags: + - Containers +components: + schemas: + 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. + required: + - object + - data + - first_id + - last_id + - has_more + 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: + 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 + 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. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + required: + - name + 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. + + The anchor is the reference point for the expiration. + + The minutes is the number of minutes after the anchor before the + container expires. + 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. + memory_limit: + type: string + description: The memory limit configured for the container. + enum: + - 1g + - 4g + - 16g + - 64g + 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 + required: + - type + required: + - id + - object + - name + - created_at + - status + - id + - name + - created_at + - status + x-oaiMeta: + name: The container object + example: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "1g", + "name": "My Container" + } + CreateContainerFileBody: + type: object + properties: + file_id: + type: string + description: Name of the file to create. + required: [] + 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. + path: + type: string + description: Path of the file in the container. + source: + type: string + description: Source of the file (e.g., `user`, `assistant`). + required: + - id + - object + - created_at + - bytes + - container_id + - path + - source + x-oaiMeta: + name: The container file object + example: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + 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' + 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: + - object + - data + - first_id + - last_id + - has_more + 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 + skill_id: + type: string + maxLength: 64 + minLength: 1 + description: The ID of the referenced skill. + version: + type: string + description: >- + Optional skill version. Use a positive integer or 'latest'. Omit for + default. + type: object + required: + - type + - skill_id + InlineSkillParam: + properties: + type: + type: string + enum: + - inline + description: Defines an inline skill for this request. + default: inline + x-stainless-const: true + name: + type: string + description: The name of the skill. + 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 + 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 + InlineSkillSourceParam: + 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. + type: object + required: + - type + - media_type + - data + description: Inline skill payload + 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 + x-stackQL-resources: + containers: + id: openai.containers.containers + name: containers + title: Containers + methods: + list: + operation: + $ref: '#/paths/~1containers/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1containers/post' + response: + mediaType: application/json + openAPIDocKey: '200' + get: + operation: + $ref: '#/paths/~1containers~1{container_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: '#/paths/~1containers~1{container_id}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/containers/methods/get' + - $ref: '#/components/x-stackQL-resources/containers/methods/list' + insert: + - $ref: '#/components/x-stackQL-resources/containers/methods/create' + update: [] + delete: + - $ref: '#/components/x-stackQL-resources/containers/methods/delete' + replace: [] + files: + id: openai.containers.files + name: files + title: Files + methods: + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1containers~1{container_id}~1files/post' + response: + mediaType: application/json + openAPIDocKey: '200' + list: + operation: + $ref: '#/paths/~1containers~1{container_id}~1files/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + get: + operation: + $ref: '#/paths/~1containers~1{container_id}~1files~1{file_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: '#/paths/~1containers~1{container_id}~1files~1{file_id}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/files/methods/get' + - $ref: '#/components/x-stackQL-resources/files/methods/list' + insert: + - $ref: '#/components/x-stackQL-resources/files/methods/create' + update: [] + delete: + - $ref: '#/components/x-stackQL-resources/files/methods/delete' + replace: [] +servers: + - url: https://api.openai.com/v1 +x-stackQL-config: + pagination: + requestToken: + key: after + location: query + responseToken: + key: $.last_id + location: body + queryParamPushdown: + top: + paramName: limit + maxValue: 100 diff --git a/provider-dev/openapi/src/openai/v00.00.00000/services/conversations.yaml b/provider-dev/openapi/src/openai/v00.00.00000/services/conversations.yaml new file mode 100644 index 0000000..be4fab0 --- /dev/null +++ b/provider-dev/openapi/src/openai/v00.00.00000/services/conversations.yaml @@ -0,0 +1,8173 @@ +openapi: 3.1.0 +info: + title: conversations API + description: openai API + version: 2.3.0 +paths: + /conversations/{conversation_id}/items: + post: + operationId: createConversationItems + tags: + - Conversations + summary: Create items in a conversation with the given ID. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation to add the item to. + - name: include + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: > + Additional fields to include in the response. See the `include` + + parameter for [listing Conversation items + above](/docs/api-reference/conversations/list-items#conversations_list_items-include) + for more information. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + properties: + items: + type: array + description: > + The items to add to the conversation. You may add up to 20 + items at a time. + items: + $ref: '#/components/schemas/InputItem' + maxItems: 20 + required: + - items + type: object + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationItemList' + x-oaiMeta: + name: Create items + group: conversations + path: create-item + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123/items \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "items": [ + { + "type": "message", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + }, + { + "type": "message", + "role": "user", + "content": [ + {"type": "input_text", "text": "How are you?"} + ] + } + ] + }' + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const items = await client.conversations.items.create( + "conv_123", + { + items: [ + { + type: "message", + role: "user", + content: [{ type: "input_text", text: "Hello!" }], + }, + { + type: "message", + role: "user", + content: [{ type: "input_text", text: "How are you?" }], + }, + ], + } + ); + console.log(items.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation_item_list = client.conversations.items.create( + conversation_id="conv_123", + items=[{ + "content": "string", + "role": "user", + "type": "message", + }], + ) + print(conversation_item_list.first_id) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ConversationItemList created = client.ConversationItems.Create( + conversationId: "conv_123", + new CreateConversationItemsOptions + { + Items = new List + { + new ConversationMessage + { + Role = "user", + Content = + { + new ConversationInputText { Text = "Hello!" } + } + }, + new ConversationMessage + { + Role = "user", + Content = + { + new ConversationInputText { Text = "How are you?" } + } + } + } + } + ); + Console.WriteLine(created.Data.Count); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const conversationItemList = await + client.conversations.items.create('conv_123', { + items: [ + { + content: 'string', + role: 'user', + type: 'message', + }, + ], + }); + + + console.log(conversationItemList.first_id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationItemList, err := client.Conversations.Items.New(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ItemNewParams{\n\t\t\tItems: []responses.ResponseInputItemUnionParam{{\n\t\t\t\tOfMessage: &responses.EasyInputMessageParam{\n\t\t\t\t\tContent: responses.EasyInputMessageContentUnionParam{\n\t\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t\t},\n\t\t\t\t\tRole: responses.EasyInputMessageRoleUser,\n\t\t\t\t\tType: responses.EasyInputMessageTypeMessage,\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationItemList.FirstID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.items.ConversationItemList; + import com.openai.models.conversations.items.ItemCreateParams; + import com.openai.models.responses.EasyInputMessage; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemCreateParams params = ItemCreateParams.builder() + .conversationId("conv_123") + .addItem(EasyInputMessage.builder() + .content("string") + .role(EasyInputMessage.Role.USER) + .type(EasyInputMessage.Type.MESSAGE) + .build()) + .build(); + ConversationItemList conversationItemList = client.conversations().items().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + conversation_item_list = + openai.conversations.items.create("conv_123", items: [{content: + "string", role: :user, type: :message}]) + + + puts(conversation_item_list) + response: | + { + "object": "list", + "data": [ + { + "type": "message", + "id": "msg_abc", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + }, + { + "type": "message", + "id": "msg_def", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "How are you?"} + ] + } + ], + "first_id": "msg_abc", + "last_id": "msg_def", + "has_more": false + } + get: + operationId: listConversationItems + tags: + - Conversations + summary: List all items for a conversation with the given ID. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation to list items for. + - name: limit + in: query + description: >- + A limit on the number of objects to be returned. Limit can range + between + + 1 and 100, and the default is 20. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - in: query + name: order + schema: + type: string + enum: + - asc + - desc + description: | + The order to return the input items in. Default is `desc`. + - `asc`: Return the input items in ascending order. + - `desc`: Return the input items in descending order. + - in: query + name: after + schema: + type: string + description: | + An item ID to list items after, used in pagination. + - name: include + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: >- + Specify additional output data to include in the model response. + Currently supported values are: + + - `web_search_call.action.sources`: Include the sources of the web + search tool call. + + - `code_interpreter_call.outputs`: Includes the outputs of python + code execution in code interpreter tool call items. + + - `computer_call_output.output.image_url`: Include image urls from + the computer call output. + + - `file_search_call.results`: Include the search results of the file + search tool call. + + - `message.input_image.image_url`: Include image urls from the input + message. + + - `message.output_text.logprobs`: Include logprobs with assistant + messages. + + - `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). + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationItemList' + x-oaiMeta: + name: List items + group: conversations + path: list-items + examples: + request: + curl: > + curl + "https://api.openai.com/v1/conversations/conv_123/items?limit=10" + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: > + import OpenAI from "openai"; + + const client = new OpenAI(); + + + const items = await client.conversations.items.list("conv_123", { + limit: 10 }); + + console.log(items.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.conversations.items.list( + conversation_id="conv_123", + ) + page = page.data[0] + print(page) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ConversationItemList items = client.ConversationItems.List( + conversationId: "conv_123", + new ListConversationItemsOptions { Limit = 10 } + ); + Console.WriteLine(items.Data.Count); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const conversationItem of + client.conversations.items.list('conv_123')) { + console.log(conversationItem); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Conversations.Items.List(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ItemListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.items.ItemListPage; + import com.openai.models.conversations.items.ItemListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemListPage page = client.conversations().items().list("conv_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.conversations.items.list("conv_123") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "type": "message", + "id": "msg_abc", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + } + ], + "first_id": "msg_abc", + "last_id": "msg_abc", + "has_more": false + } + /conversations/{conversation_id}/items/{item_id}: + get: + operationId: getConversationItem + tags: + - Conversations + summary: Get a single item from a conversation with the given IDs. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation that contains the item. + - in: path + name: item_id + required: true + schema: + type: string + example: msg_abc + description: The ID of the item to retrieve. + - name: include + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: > + Additional fields to include in the response. See the `include` + + parameter for [listing Conversation items + above](/docs/api-reference/conversations/list-items#conversations_list_items-include) + for more information. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationItem' + x-oaiMeta: + name: Retrieve an item + group: conversations + path: get-item + examples: + request: + curl: > + curl + https://api.openai.com/v1/conversations/conv_123/items/msg_abc \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const item = await client.conversations.items.retrieve( + "conv_123", + "msg_abc" + ); + console.log(item); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation_item = client.conversations.items.retrieve( + item_id="msg_abc", + conversation_id="conv_123", + ) + print(conversation_item) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ConversationItem item = client.ConversationItems.Get( + conversationId: "conv_123", + itemId: "msg_abc" + ); + Console.WriteLine(item.Id); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const conversationItem = await + client.conversations.items.retrieve('msg_abc', { + conversation_id: 'conv_123', + }); + + + console.log(conversationItem); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationItem, err := client.Conversations.Items.Get(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\t\"msg_abc\",\n\t\tconversations.ItemGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationItem)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.items.ConversationItem; + import com.openai.models.conversations.items.ItemRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemRetrieveParams params = ItemRetrieveParams.builder() + .conversationId("conv_123") + .itemId("msg_abc") + .build(); + ConversationItem conversationItem = client.conversations().items().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + conversation_item = openai.conversations.items.retrieve("msg_abc", + conversation_id: "conv_123") + + + puts(conversation_item) + response: | + { + "type": "message", + "id": "msg_abc", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + } + delete: + operationId: deleteConversationItem + tags: + - Conversations + summary: Delete an item from a conversation with the given IDs. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation that contains the item. + - in: path + name: item_id + required: true + schema: + type: string + example: msg_abc + description: The ID of the item to delete. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Delete an item + group: conversations + path: delete-item + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/conversations/conv_123/items/msg_abc \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const conversation = await client.conversations.items.delete( + "conv_123", + "msg_abc" + ); + console.log(conversation); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.items.delete( + item_id="msg_abc", + conversation_id="conv_123", + ) + print(conversation.id) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation conversation = client.ConversationItems.Delete( + conversationId: "conv_123", + itemId: "msg_abc" + ); + Console.WriteLine(conversation.Id); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const conversation = await + client.conversations.items.delete('msg_abc', { + conversation_id: 'conv_123', + }); + + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Items.Delete(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\t\"msg_abc\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.items.ItemDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemDeleteParams params = ItemDeleteParams.builder() + .conversationId("conv_123") + .itemId("msg_abc") + .build(); + Conversation conversation = client.conversations().items().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + conversation = openai.conversations.items.delete("msg_abc", + conversation_id: "conv_123") + + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "demo"} + } + /conversations: + post: + tags: + - Conversations + summary: Create a conversation. + operationId: createConversation + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateConversationBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Create a conversation + group: conversations + path: create + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "metadata": {"topic": "demo"}, + "items": [ + { + "type": "message", + "role": "user", + "content": "Hello!" + } + ] + }' + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const conversation = await client.conversations.create({ + metadata: { topic: "demo" }, + items: [ + { type: "message", role: "user", content: "Hello!" } + ], + }); + console.log(conversation); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.create() + print(conversation.id) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation conversation = client.CreateConversation( + new CreateConversationOptions + { + Metadata = new Dictionary + { + { "topic", "demo" } + }, + Items = + { + new ConversationMessageInput + { + Role = "user", + Content = "Hello!", + } + } + } + ); + Console.WriteLine(conversation.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversation = await client.conversations.create(); + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.New(context.TODO(), conversations.ConversationNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.ConversationCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Conversation conversation = client.conversations().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation = openai.conversations.create + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "demo"} + } + /conversations/{conversation_id}: + get: + tags: + - Conversations + summary: Get a conversation + operationId: getConversation + parameters: + - name: conversation_id + in: path + description: The ID of the conversation to retrieve. + required: true + schema: + example: conv_123 + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Retrieve a conversation + group: conversations + path: retrieve + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: > + import OpenAI from "openai"; + + const client = new OpenAI(); + + + const conversation = await + client.conversations.retrieve("conv_123"); + + console.log(conversation); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.retrieve( + "conv_123", + ) + print(conversation.id) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation conversation = client.GetConversation("conv_123"); + Console.WriteLine(conversation.Id); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const conversation = await + client.conversations.retrieve('conv_123'); + + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Get(context.TODO(), \"conv_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.ConversationRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Conversation conversation = client.conversations().retrieve("conv_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation = openai.conversations.retrieve("conv_123") + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "demo"} + } + delete: + tags: + - Conversations + summary: Delete a conversation. Items in the conversation will not be deleted. + operationId: deleteConversation + parameters: + - name: conversation_id + in: path + description: The ID of the conversation to delete. + required: true + schema: + example: conv_123 + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedConversationResource' + x-oaiMeta: + name: Delete a conversation + group: conversations + path: delete + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/conversations/conv_123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const deleted = await client.conversations.delete("conv_123"); + console.log(deleted); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation_deleted_resource = client.conversations.delete( + "conv_123", + ) + print(conversation_deleted_resource.id) + csharp: > + using System; + + using OpenAI.Conversations; + + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + DeletedConversation deleted = + client.DeleteConversation("conv_123"); + + Console.WriteLine(deleted.Id); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const conversationDeletedResource = await + client.conversations.delete('conv_123'); + + + console.log(conversationDeletedResource.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationDeletedResource, err := client.Conversations.Delete(context.TODO(), \"conv_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationDeletedResource.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.conversations.ConversationDeleteParams; + + import + com.openai.models.conversations.ConversationDeletedResource; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ConversationDeletedResource conversationDeletedResource = client.conversations().delete("conv_123"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + conversation_deleted_resource = + openai.conversations.delete("conv_123") + + + puts(conversation_deleted_resource) + response: | + { + "id": "conv_123", + "object": "conversation.deleted", + "deleted": true + } + post: + tags: + - Conversations + summary: Update a conversation + operationId: updateConversation + parameters: + - name: conversation_id + in: path + description: The ID of the conversation to update. + required: true + schema: + example: conv_123 + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateConversationBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Update a conversation + group: conversations + path: update + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "metadata": {"topic": "project-x"} + }' + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const updated = await client.conversations.update( + "conv_123", + { metadata: { topic: "project-x" } } + ); + console.log(updated); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.update( + conversation_id="conv_123", + metadata={ + "foo": "string" + }, + ) + print(conversation.id) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation updated = client.UpdateConversation( + conversationId: "conv_123", + new UpdateConversationOptions + { + Metadata = new Dictionary + { + { "topic", "project-x" } + } + } + ); + Console.WriteLine(updated.Id); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const conversation = await client.conversations.update('conv_123', + { metadata: { foo: 'string' } }); + + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Update(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ConversationUpdateParams{\n\t\t\tMetadata: shared.Metadata{\n\t\t\t\t\"foo\": \"string\",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.ConversationUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ConversationUpdateParams params = ConversationUpdateParams.builder() + .conversationId("conv_123") + .metadata(ConversationUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build()) + .build(); + Conversation conversation = client.conversations().update(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + conversation = openai.conversations.update("conv_123", metadata: + {foo: "string"}) + + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "project-x"} + } +components: + schemas: + 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: + + - `web_search_call.results`: Include the search results of the web + search tool call. + + - `web_search_call.action.sources`: Include the sources of the web + search tool call. + + - `code_interpreter_call.outputs`: Includes the outputs of python code + execution in code interpreter tool call items. + + - `computer_call_output.output.image_url`: Include image urls from the + computer call output. + + - `file_search_call.results`: Include the search results of the file + search tool call. + + - `message.input_image.image_url`: Include image urls from the input + message. + + - `message.output_text.logprobs`: Include logprobs with assistant + messages. + + - `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). + InputItem: + discriminator: + propertyName: type + type: object + title: Input message + description: > + A message input to the model with a role indicating instruction + following + + hierarchy. Instructions given with the `developer` or `system` role take + + precedence over instructions given with the `user` role. Messages with + the + + `assistant` role are presumed to have been generated by the model in + previous + + interactions. + properties: + role: + type: string + description: > + The role of the message input. One of `user`, `assistant`, `system`, + or + + `developer`. + enum: + - user + - assistant + - system + - developer + content: + description: > + Text, image, or audio input to the model, used to generate a + response. + + Can also contain previous assistant responses. + type: string + title: Text input + items: + $ref: '#/components/schemas/InputContent' + phase: + type: string + 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. + enum: + - commentary + - final_answer + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + status: + type: string + description: | + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + id: + type: string + description: | + The unique ID of the output message. + queries: + type: array + items: + type: string + description: | + The queries used to search for files. + results: + type: array + description: | + The results of the file search tool call. + items: + type: object + properties: + file_id: + type: string + description: | + The unique ID of the file. + text: + type: string + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. + call_id: + type: string + description: | + An identifier used when responding to the tool call with output. + 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. + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + acknowledged_safety_checks: + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + type: array + description: >- + The safety checks reported by the API that have been acknowledged by + the developer. + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. + 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. + encrypted_content: + type: string + description: > + The encrypted content of the reasoning item - populated when a + response is + + generated with `reasoning.encrypted_content` in the `include` + parameter. + summary: + type: array + description: | + Reasoning summary content. + items: + $ref: '#/components/schemas/SummaryTextContent' + result: + type: string + description: | + The generated image encoded in base64. + container_id: + type: string + description: | + The ID of the container used to run the code. + code: + type: string + description: | + The code to run, or null if not available. + outputs: + 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. + + Can be null if no outputs are available. + environment: + oneOf: + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + description: The environment to execute the shell commands in. + discriminator: + propertyName: type + type: 'null' + max_output_length: + type: integer + description: >- + The maximum number of UTF-8 characters captured for this shell + call's combined output. + operation: + $ref: '#/components/schemas/ApplyPatchOperationParam' + description: >- + The specific create, delete, or update instruction for the + apply_patch tool call. + server_label: + type: string + description: | + The label of the MCP server. + error: + type: string + description: | + Error message if the server could not list tools. + approval_request_id: + type: string + description: | + The ID of the approval request being answered. + approve: + type: boolean + description: | + Whether the request was approved. + reason: + type: string + description: | + Optional reason for the decision. + input: + type: string + description: | + The input for the custom tool call generated by the model. + required: + - role + - content + - id + - type + - status + - queries + - call_id + - pending_safety_checks + - output + - action + - name + - arguments + - tools + - summary + - encrypted_content + - result + - container_id + - code + - outputs + - operation + - server_label + - request_id + - approve + - approval_request_id + - input + 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' + 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. + last_id: + type: string + description: The ID of the last item in the list. + required: + - object + - data + - has_more + - first_id + - last_id + x-oaiMeta: + name: The item list + group: conversations + 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](/docs/api-reference/responses/object#responses/object-output). + discriminator: + propertyName: type + 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: + type: string + enum: + - commentary + - final_answer + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. + created_by: + type: string + description: | + The identifier of the actor that created the item. + output: + description: | + The output from the function call generated by your code. + Can be a string or an list of output content. + type: string + title: string output + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + queries: + type: array + items: + type: string + description: | + The queries used to search for files. + results: + type: array + description: | + The results of the file search tool call. + items: + type: object + properties: + file_id: + type: string + description: | + The unique ID of the file. + text: + type: string + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. + action: + type: object + description: > + An object describing the specific action taken in this web search + call. + + Includes details on how the model used the web (search, open_page, + find_in_page). + discriminator: + propertyName: type + title: Search action + properties: + type: + type: string + enum: + - search + description: | + The action type. + x-stainless-const: true + query: + type: string + description: | + [DEPRECATED] The search query. + queries: + type: array + title: Search queries + description: | + The search queries. + items: + type: string + description: | + A search query. + sources: + type: array + title: Web search sources + description: | + The sources used in the search. + items: + type: object + title: Web search source + description: | + A source used in the search. + properties: + type: + type: string + enum: + - url + description: | + The type of source. Always `url`. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the source. + required: + - type + - url + url: + description: | + The URL opened by the model. + type: string + format: uri + pattern: + type: string + description: | + The pattern or text to search for within the page. + required: + - type + - query + - url + - pattern + result: + type: string + description: | + The generated image encoded in base64. + actions: + $ref: '#/components/schemas/ComputerActionList' + pending_safety_checks: + type: array + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + description: | + The pending safety checks for the computer call. + acknowledged_safety_checks: + type: array + description: > + The safety checks reported by the API that have been acknowledged by + the + + developer. + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + 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. + encrypted_content: + type: string + description: > + The encrypted content of the reasoning item - populated when a + response is + + generated with `reasoning.encrypted_content` in the `include` + parameter. + summary: + type: array + description: | + Reasoning summary content. + items: + $ref: '#/components/schemas/SummaryTextContent' + container_id: + type: string + description: | + The ID of the container used to run the code. + code: + type: string + description: | + The code to run, or null if not available. + outputs: + 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. + + Can be null if no outputs are available. + environment: + type: string + format: json + max_output_length: + 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. + operation: + title: Apply patch operation + description: >- + One of the create_file, delete_file, or update_file operations + applied via apply_patch. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - create_file + description: Create a new file with the provided diff. + default: create_file + x-stainless-const: true + path: + type: string + description: Path of the file to create. + diff: + type: string + description: Diff to apply. + type: object + required: + - type + - path + - diff + server_label: + type: string + description: | + The label of the MCP server. + error: + type: string + description: | + Error message if the server could not list tools. + approval_request_id: + type: string + description: | + The ID of the approval request being answered. + approve: + type: boolean + description: | + Whether the request was approved. + reason: + type: string + description: | + Optional reason for the decision. + input: + type: string + description: | + The input for the custom tool call generated by the model. + type: object + required: + - type + - id + - status + - role + - content + - call_id + - name + - arguments + - output + - queries + - action + - result + - pending_safety_checks + - execution + - tools + - summary + - encrypted_content + - container_id + - code + - outputs + - environment + - max_output_length + - operation + - server_label + - request_id + - approve + - approval_request_id + - input + ConversationResource: + properties: + id: + type: string + description: The unique ID of the conversation. + object: + type: string + enum: + - conversation + description: The object type, which is always `conversation`. + default: conversation + 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. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + 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 + CreateConversationBody: + properties: + metadata: + 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. + + + Keys are strings with a maximum length of 64 characters. Values are + strings + + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + items: + 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: object + required: [] + DeletedConversationResource: + properties: + object: + type: string + enum: + - conversation.deleted + default: conversation.deleted + x-stainless-const: true + deleted: + type: boolean + id: + type: string + type: object + required: + - object + - deleted + - id + UpdateConversationBody: + 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. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + type: object + required: + - metadata + EasyInputMessage: + type: object + title: Input message + description: > + A message input to the model with a role indicating instruction + following + + hierarchy. Instructions given with the `developer` or `system` role take + + precedence over instructions given with the `user` role. Messages with + the + + `assistant` role are presumed to have been generated by the model in + previous + + interactions. + properties: + role: + type: string + description: > + The role of the message input. One of `user`, `assistant`, `system`, + or + + `developer`. + enum: + - user + - assistant + - system + - developer + content: + description: > + Text, image, or audio input to the model, used to generate a + response. + + Can also contain previous assistant responses. + type: string + title: Text input + items: + $ref: '#/components/schemas/InputContent' + phase: + type: string + 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. + enum: + - commentary + - final_answer + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + required: + - role + - content + Item: + type: object + description: | + Content item used to generate a response. + discriminator: + propertyName: type + title: Input message + properties: + type: + type: string + description: | + The type of the message input. Always set to `message`. + enum: + - message + x-stainless-const: true + role: + type: string + description: > + The role of the message input. One of `user`, `system`, or + `developer`. + enum: + - user + - system + - developer + status: + type: string + description: | + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + content: + $ref: '#/components/schemas/InputMessageContentList' + id: + type: string + description: | + The unique ID of the output message. + phase: + type: string + 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. + enum: + - commentary + - final_answer + queries: + type: array + items: + type: string + description: | + The queries used to search for files. + results: + type: array + description: | + The results of the file search tool call. + items: + type: object + properties: + file_id: + type: string + description: | + The unique ID of the file. + text: + type: string + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. + call_id: + type: string + description: | + An identifier used when responding to the tool call with output. + 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. + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + acknowledged_safety_checks: + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + type: array + description: >- + The safety checks reported by the API that have been acknowledged by + the developer. + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. + 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. + encrypted_content: + type: string + description: > + The encrypted content of the reasoning item - populated when a + response is + + generated with `reasoning.encrypted_content` in the `include` + parameter. + summary: + type: array + description: | + Reasoning summary content. + items: + $ref: '#/components/schemas/SummaryTextContent' + result: + type: string + description: | + The generated image encoded in base64. + container_id: + type: string + description: | + The ID of the container used to run the code. + code: + type: string + description: | + The code to run, or null if not available. + outputs: + 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. + + Can be null if no outputs are available. + environment: + oneOf: + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + description: The environment to execute the shell commands in. + discriminator: + propertyName: type + type: 'null' + max_output_length: + type: integer + description: >- + The maximum number of UTF-8 characters captured for this shell + call's combined output. + operation: + $ref: '#/components/schemas/ApplyPatchOperationParam' + description: >- + The specific create, delete, or update instruction for the + apply_patch tool call. + server_label: + type: string + description: | + The label of the MCP server. + error: + type: string + description: | + Error message if the server could not list tools. + approval_request_id: + type: string + description: | + The ID of the approval request being answered. + approve: + type: boolean + description: | + Whether the request was approved. + reason: + type: string + description: | + Optional reason for the decision. + input: + type: string + description: | + The input for the custom tool call generated by the model. + required: + - role + - content + - id + - type + - status + - queries + - call_id + - pending_safety_checks + - output + - action + - name + - arguments + - tools + - summary + - encrypted_content + - result + - container_id + - code + - outputs + - operation + - server_label + - request_id + - approve + - approval_request_id + - input + ItemReferenceParam: + properties: + type: + type: string + enum: + - item_reference + description: The type of item to reference. Always `item_reference`. + default: item_reference + x-stainless-const: true + id: + type: string + description: The ID of the item to reference. + type: object + required: + - id + title: Item reference + description: An internal identifier for an item to reference. + 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: + type: string + enum: + - commentary + - final_answer + type: object + required: + - type + - id + - status + - role + - content + title: Message + description: A message to or from the model. + FunctionToolCallResource: + type: object + title: Function tool call + description: > + A tool call to run a function. See the + + [function calling guide](/docs/guides/function-calling) for more + information. + properties: + id: + type: string + description: | + The unique ID of the function tool call. + type: + type: string + enum: + - function_call + description: | + The type of the function tool call. Always `function_call`. + x-stainless-const: true + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - type + - call_id + - name + - arguments + - id + - status + FunctionToolCallOutputResource: + type: object + title: Function tool call output + description: | + The output of a function tool call. + properties: + id: + type: string + description: > + The unique ID of the function tool call output. Populated when this + item + + is returned via API. + type: + type: string + enum: + - function_call_output + description: > + The type of the function tool call output. Always + `function_call_output`. + x-stainless-const: true + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + output: + description: | + The output from the function call generated by your code. + Can be a string or an list of output content. + type: string + title: string output + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - type + - call_id + - output + - id + - status + FileSearchToolCall: + type: object + title: File search tool call + description: > + The results of a file search tool call. See the + + [file search guide](/docs/guides/tools-file-search) for more + information. + properties: + id: + type: string + description: | + The unique ID of the file search tool call. + type: + type: string + enum: + - file_search_call + description: | + The type of the file search tool call. Always `file_search_call`. + x-stainless-const: true + status: + type: string + description: | + The status of the file search tool call. One of `in_progress`, + `searching`, `incomplete` or `failed`, + enum: + - in_progress + - searching + - completed + - incomplete + - failed + queries: + type: array + items: + type: string + description: | + The queries used to search for files. + results: + type: array + description: | + The results of the file search tool call. + items: + type: object + properties: + file_id: + type: string + description: | + The unique ID of the file. + text: + type: string + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. + required: + - id + - type + - status + - queries + WebSearchToolCall: + type: object + title: Web search tool call + description: | + The results of a web search tool call. See the + [web search guide](/docs/guides/tools-web-search) for more information. + properties: + id: + type: string + description: | + The unique ID of the web search tool call. + type: + type: string + enum: + - web_search_call + description: | + The type of the web search tool call. Always `web_search_call`. + x-stainless-const: true + status: + type: string + description: | + The status of the web search tool call. + enum: + - in_progress + - searching + - completed + - failed + action: + type: object + description: > + An object describing the specific action taken in this web search + call. + + Includes details on how the model used the web (search, open_page, + find_in_page). + discriminator: + propertyName: type + title: Search action + properties: + type: + type: string + enum: + - search + description: | + The action type. + x-stainless-const: true + query: + type: string + description: | + [DEPRECATED] The search query. + queries: + type: array + title: Search queries + description: | + The search queries. + items: + type: string + description: | + A search query. + sources: + type: array + title: Web search sources + description: | + The sources used in the search. + items: + type: object + title: Web search source + description: | + A source used in the search. + properties: + type: + type: string + enum: + - url + description: | + The type of source. Always `url`. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the source. + required: + - type + - url + url: + description: | + The URL opened by the model. + type: string + format: uri + pattern: + type: string + description: | + The pattern or text to search for within the page. + required: + - type + - query + - url + - pattern + required: + - id + - type + - status + - action + ImageGenToolCall: + type: object + title: Image generation call + description: | + An image generation request made by the model. + properties: + type: + type: string + enum: + - image_generation_call + description: > + The type of the image generation call. Always + `image_generation_call`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the image generation call. + status: + type: string + enum: + - in_progress + - completed + - generating + - failed + description: | + The status of the image generation call. + result: + type: string + description: | + The generated image encoded in base64. + required: + - type + - id + - status + - result + ComputerToolCall: + type: object + title: Computer tool call + description: > + A tool call to a computer use tool. See the + + [computer use guide](/docs/guides/tools-computer-use) for more + information. + 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. + 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. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - id + - call_id + - pending_safety_checks + - status + ComputerToolCallOutputResource: + type: object + title: Computer tool call output + description: | + The output of a computer tool call. + properties: + type: + type: string + description: > + The type of the computer tool call output. Always + `computer_call_output`. + enum: + - computer_call_output + default: computer_call_output + x-stainless-const: true + id: + type: string + description: | + The ID of the computer tool call output. + call_id: + type: string + description: | + The ID of the computer tool call that produced the output. + acknowledged_safety_checks: + type: array + description: > + The safety checks reported by the API that have been acknowledged by + the + + developer. + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + status: + type: string + description: > + The status of the message input. One of `in_progress`, `completed`, + or + + `incomplete`. Populated when input items are returned via API. + enum: + - in_progress + - completed + - incomplete + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - type + - call_id + - output + - id + - status + ToolSearchCall: + properties: + 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 unique ID of the tool search call item. + call_id: + type: string + description: The unique ID of the tool search call generated by the model. + 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 + ToolSearchOutput: + properties: + type: + type: string + enum: + - tool_search_output + description: The type of the item. Always `tool_search_output`. + default: tool_search_output + x-stainless-const: true + id: + type: string + description: The unique ID of the tool search output item. + call_id: + type: string + description: The unique ID of the tool search call generated by the model. + 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: + - type + - id + - call_id + - execution + - tools + - status + ReasoningItem: + type: object + description: > + A description of the chain of thought used by a reasoning model while + generating + + a response. Be sure to include these items in your `input` to the + Responses API + + for subsequent turns of a conversation if you are manually + + [managing context](/docs/guides/conversation-state). + title: Reasoning + properties: + type: + type: string + description: | + The type of the object. Always `reasoning`. + enum: + - reasoning + x-stainless-const: true + id: + type: string + description: | + The unique identifier of the reasoning content. + encrypted_content: + type: string + description: > + The encrypted content of the reasoning item - populated when a + response is + + generated with `reasoning.encrypted_content` in the `include` + parameter. + summary: + type: array + description: | + Reasoning summary content. + items: + $ref: '#/components/schemas/SummaryTextContent' + content: + type: array + description: | + Reasoning text content. + items: + $ref: '#/components/schemas/ReasoningTextContent' + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - id + - summary + - type + CompactionBody: + properties: + type: + type: string + enum: + - compaction + description: The type of the item. Always `compaction`. + default: compaction + x-stainless-const: true + id: + type: string + 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 + - id + - encrypted_content + title: Compaction item + description: >- + A compaction item generated by the [`v1/responses/compact` + API](/docs/api-reference/responses/compact). + CodeInterpreterToolCall: + type: object + title: Code interpreter tool call + description: | + A tool call to run code. + 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`. + id: + type: string + description: | + The unique ID of the code interpreter tool call. + 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`. + container_id: + type: string + description: | + The ID of the container used to run the code. + code: + type: string + description: | + The code to run, or null if not available. + outputs: + 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. + + Can be null if no outputs are available. + required: + - type + - id + - status + - container_id + - code + - outputs + LocalShellToolCall: + type: object + title: Local shell call + description: | + A tool call to run a command on the local shell. + properties: + type: + type: string + enum: + - local_shell_call + description: | + The type of the local shell call. Always `local_shell_call`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the local shell call. + call_id: + type: string + description: | + The unique ID of the local shell tool call generated by the model. + action: + $ref: '#/components/schemas/LocalShellExecAction' + status: + type: string + enum: + - in_progress + - completed + - incomplete + description: | + The status of the local shell call. + required: + - type + - id + - call_id + - action + - status + LocalShellToolCallOutput: + type: object + title: Local shell call output + description: | + The output of a local shell tool call. + properties: + type: + type: string + enum: + - local_shell_call_output + description: > + The type of the local shell tool call output. Always + `local_shell_call_output`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the local shell tool call generated by the model. + output: + type: string + description: | + A JSON string of the output of the local shell tool call. + status: + type: string + enum: + - in_progress + - completed + - incomplete + description: > + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. + required: + - id + - type + - call_id + - output + FunctionShellCall: + 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. + 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: + oneOf: + - $ref: '#/components/schemas/LocalEnvironmentResource' + - $ref: '#/components/schemas/ContainerReferenceResource' + discriminator: + propertyName: type + type: 'null' + created_by: + type: string + description: The ID of the entity that created this tool call. + 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. + 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 + 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. + 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: + 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. + 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. + ApplyPatchToolCall: + properties: + type: + type: string + enum: + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_call + x-stainless-const: true + id: + type: string + description: >- + The unique ID of the apply patch tool call. Populated when this item + is returned via API. + call_id: + type: string + description: The unique ID of the apply patch tool call generated by the model. + status: + $ref: '#/components/schemas/ApplyPatchCallStatus' + description: >- + The status of the apply patch tool call. One of `in_progress` or + `completed`. + operation: + title: Apply patch operation + description: >- + One of the create_file, delete_file, or update_file operations + applied via apply_patch. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - create_file + description: Create a new file with the provided diff. + default: create_file + x-stainless-const: true + path: + type: string + description: Path of the file to create. + diff: + type: string + description: Diff to apply. + type: object + required: + - type + - path + - diff + created_by: + type: string + description: The ID of the entity that created this tool call. + type: object + required: + - type + - id + - call_id + - status + - operation + title: Apply patch tool call + description: >- + A tool call that applies file diffs by creating, deleting, or updating + files. + 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 + id: + type: string + description: >- + The unique ID of the apply patch tool call output. Populated when + this item is returned via API. + call_id: + type: string + description: The unique ID of the apply patch tool call generated by the model. + status: + $ref: '#/components/schemas/ApplyPatchCallOutputStatus' + description: >- + The status of the apply patch tool call output. One of `completed` + or `failed`. + output: + type: string + description: Optional textual output returned by the apply patch tool. + created_by: + type: string + description: The ID of the entity that created this tool call output. + type: object + required: + - type + - id + - call_id + - status + title: Apply patch tool call output + description: The output emitted by an apply patch tool call. + MCPListTools: + type: object + title: MCP list tools + description: | + A list of tools available on an MCP server. + 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. + error: + type: string + description: | + Error message if the server could not list tools. + required: + - type + - id + - server_label + - tools + MCPApprovalRequest: + type: object + title: MCP approval request + description: | + A request for human approval of a tool invocation. + 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 + MCPApprovalResponseResource: + type: object + title: MCP approval response + description: | + A response to an MCP approval request. + 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: + type: string + description: | + Optional reason for the decision. + required: + - type + - id + - request_id + - approve + - approval_request_id + MCPToolCall: + type: object + title: MCP tool call + description: | + An invocation of a tool on an MCP server. + 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. + output: + type: string + description: | + The output from the tool call. + error: + type: string + description: | + The error from the tool call, if any. + status: + $ref: '#/components/schemas/MCPToolCallStatus' + description: > + The status of the tool call. One of `in_progress`, `completed`, + `incomplete`, `calling`, or `failed`. + approval_request_id: + type: string + description: > + Unique identifier for the MCP tool call approval request. + + Include this value in a subsequent `mcp_approval_response` input to + approve or reject the corresponding tool call. + required: + - type + - id + - server_label + - name + - arguments + CustomToolCall: + type: object + title: Custom tool call + description: | + A call to a custom tool created by the model. + properties: + type: + type: string + enum: + - custom_tool_call + x-stainless-const: true + description: | + The type of the custom tool call. Always `custom_tool_call`. + id: + type: string + description: | + The unique ID of the custom tool call in the OpenAI platform. + call_id: + type: string + description: > + An identifier used to map this custom tool call to a tool call + output. + namespace: + type: string + description: | + The namespace of the custom tool being called. + name: + type: string + description: | + The name of the custom tool being called. + input: + type: string + description: | + The input for the custom tool call generated by the model. + 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. + 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`. + id: + type: string + description: | + The unique ID of the custom tool call output in the OpenAI platform. + call_id: + type: string + description: > + The call ID, used to map this custom tool call output to a custom + tool call. + output: + description: | + The output from the custom tool call generated by your code. + Can be a string or an list of output content. + type: string + title: string output + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + required: + - type + - call_id + - output + Metadata: + 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. + + + Keys are strings with a maximum length of 64 characters. Values are + strings + + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + InputMessageContentList: + type: array + title: Input item content list + description: > + A list of one or many input items to the model, containing different + content + + types. + items: + $ref: '#/components/schemas/InputContent' + MessagePhase: + type: string + 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. + enum: + - commentary + - final_answer + InputMessage: + type: object + title: Input message + description: > + A message input to the model with a role indicating instruction + following + + hierarchy. Instructions given with the `developer` or `system` role take + + precedence over instructions given with the `user` role. + properties: + type: + type: string + description: | + The type of the message input. Always set to `message`. + enum: + - message + x-stainless-const: true + role: + type: string + description: > + The role of the message input. One of `user`, `system`, or + `developer`. + enum: + - user + - system + - developer + status: + type: string + description: | + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + content: + $ref: '#/components/schemas/InputMessageContentList' + required: + - role + - content + OutputMessage: + type: object + title: Output message + description: | + An output message from the model. + properties: + id: + type: string + description: | + The unique ID of the output message. + type: + type: string + description: | + The type of the output message. Always `message`. + enum: + - message + x-stainless-const: true + role: + type: string + description: | + The role of the output message. Always `assistant`. + enum: + - assistant + x-stainless-const: true + content: + type: array + description: | + The content of the output message. + items: + $ref: '#/components/schemas/OutputMessageContent' + phase: + type: string + 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. + enum: + - commentary + - final_answer + status: + type: string + description: > + The status of the message input. One of `in_progress`, `completed`, + or + + `incomplete`. Populated when input items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - id + - type + - role + - content + - status + ComputerCallOutputItemParam: + properties: + id: + type: string + description: The ID of the computer tool call output. + example: cuo_123 + 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: + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + type: array + description: >- + The safety checks reported by the API that have been acknowledged by + the developer. + status: + type: string + enum: + - in_progress + - completed + - incomplete + type: object + required: + - call_id + - type + - output + title: Computer tool call output + description: The output of a computer tool call. + FunctionToolCall: + type: object + title: Function tool call + description: > + A tool call to run a function. See the + + [function calling guide](/docs/guides/function-calling) for more + information. + properties: + id: + type: string + description: | + The unique ID of the function tool call. + type: + type: string + enum: + - function_call + description: | + The type of the function tool call. Always `function_call`. + x-stainless-const: true + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - name + - arguments + FunctionCallOutputItemParam: + properties: + id: + type: string + description: >- + The unique ID of the function tool call output. Populated when this + item is returned via API. + example: fc_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the function tool call generated by the model. + 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: + description: Text, image, or file output of the function tool call. + type: string + maxLength: 10485760 + 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 + status: + type: string + enum: + - in_progress + - completed + - incomplete + type: object + required: + - call_id + - type + - output + title: Function tool call output + description: The output of a function tool call. + ToolSearchCallItemParam: + properties: + id: + type: string + description: The unique ID of this tool search call. + example: tsc_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the tool search call generated by the model. + type: + type: string + 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: + type: string + enum: + - in_progress + - completed + - incomplete + type: object + required: + - type + - arguments + ToolSearchOutputItemParam: + properties: + id: + type: string + description: The unique ID of this tool search output. + example: tso_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the tool search call generated by the model. + type: + type: string + enum: + - 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/Tool' + type: array + description: The loaded tool definitions returned by the tool search output. + status: + type: string + enum: + - in_progress + - completed + - incomplete + type: object + required: + - type + - tools + CompactionSummaryItemParam: + properties: + id: + type: string + description: The ID of the compaction item. + example: cmp_123 + type: + type: string + enum: + - compaction + description: The type of the item. Always `compaction`. + default: compaction + x-stainless-const: true + encrypted_content: + type: string + maxLength: 10485760 + 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](/docs/api-reference/responses/compact). + FunctionShellCallItemParam: + properties: + id: + type: string + description: >- + The unique ID of the shell tool call. Populated when this item is + returned via API. + example: sh_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the shell tool call generated by the model. + 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: + type: string + enum: + - in_progress + - completed + - incomplete + title: Shell call status + description: Status values reported for shell tool calls. + environment: + oneOf: + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + description: The environment to execute the shell commands in. + discriminator: + propertyName: type + type: 'null' + type: object + required: + - call_id + - type + - action + title: Shell tool call + description: A tool representing a request to execute one or more shell commands. + FunctionShellCallOutputItemParam: + properties: + id: + type: string + description: >- + The unique ID of the shell tool call output. Populated when this + item is returned via API. + example: sho_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the shell tool call generated by the model. + 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 + output: + items: + $ref: '#/components/schemas/FunctionShellCallOutputContentParam' + type: array + description: >- + Captured chunks of stdout and stderr output, along with their + associated outcomes. + status: + type: string + enum: + - in_progress + - completed + - incomplete + title: Shell call status + description: Status values reported for shell tool calls. + max_output_length: + type: integer + description: >- + The maximum number of UTF-8 characters captured for this shell + call's combined output. + type: object + required: + - call_id + - type + - output + title: Shell tool call output + description: The streamed output items emitted by a shell tool call. + ApplyPatchToolCallItemParam: + properties: + type: + type: string + enum: + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_call + x-stainless-const: true + id: + type: string + description: >- + The unique ID of the apply patch tool call. Populated when this item + is returned via API. + example: apc_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + 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: + - type + - call_id + - status + - operation + title: Apply patch tool call + description: >- + A tool call representing a request to create, delete, or update files + using diff patches. + ApplyPatchToolCallOutputItemParam: + 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 + id: + type: string + description: >- + The unique ID of the apply patch tool call output. Populated when + this item is returned via API. + example: apco_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + status: + $ref: '#/components/schemas/ApplyPatchCallOutputStatusParam' + description: >- + The status of the apply patch tool call output. One of `completed` + or `failed`. + output: + type: string + maxLength: 10485760 + description: >- + Optional human-readable log text from the apply patch tool (e.g., + patch results or errors). + type: object + required: + - type + - call_id + - status + title: Apply patch tool call output + description: The streamed output emitted by an apply patch tool call. + MCPApprovalResponse: + type: object + title: MCP approval response + description: | + A response to an MCP approval request. + 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: + type: string + description: | + Optional reason for the decision. + required: + - type + - request_id + - approve + - approval_request_id + MessageStatus: + type: string + enum: + - in_progress + - completed + - incomplete + MessageRole: + type: string + enum: + - unknown + - user + - assistant + - system + - critic + - discriminator + - developer + - tool + 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. + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + 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 + text: + type: string + description: The text output from the model. + annotations: + items: + $ref: '#/components/schemas/Annotation' + type: array + description: The annotations of the text output. + 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 + 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 + 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 + 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. + 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 + image_url: + 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. + file_id: + type: string + description: The ID of the file to be sent to the model. + 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`. + type: object + required: + - type + - detail + title: Input image + description: >- + An image input to the model. Learn about [image + inputs](/docs/guides/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: + type: string + format: uri + description: The URL of the screenshot image. + file_id: + type: string + description: The identifier of an uploaded file that contains the screenshot. + 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`. + type: object + required: + - type + - image_url + - file_id + - detail + title: Computer screenshot + description: A screenshot of a computer. + 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: + type: string + description: The ID of the file to be sent to the model. + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + 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 `low` for + the default rendering behavior, or `high` to render the file at + higher quality. Defaults to `low`. + type: object + required: + - type + title: Input file + description: A file input to the model. + MessagePhase-2: + type: string + enum: + - commentary + - final_answer + FunctionCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + FunctionToolCallOutput: + type: object + title: Function tool call output + description: | + The output of a function tool call. + properties: + id: + type: string + description: > + The unique ID of the function tool call output. Populated when this + item + + is returned via API. + type: + type: string + enum: + - function_call_output + description: > + The type of the function tool call output. Always + `function_call_output`. + x-stainless-const: true + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + output: + description: | + The output from the function call generated by your code. + Can be a string or an list of output content. + type: string + title: string output + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - output + FunctionCallOutputStatusEnum: + type: string + enum: + - in_progress + - completed + - incomplete + VectorStoreFileAttributes: + 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. Keys are + strings + + with a maximum length of 64 characters. Values are strings with a + maximum + + length of 512 characters, booleans, or numbers. + maxProperties: 16 + propertyNames: + type: string + maxLength: 64 + additionalProperties: + oneOf: + - type: string + maxLength: 512 + - type: number + - type: boolean + x-oaiTypeLabel: map + WebSearchActionSearch: + type: object + title: Search action + description: | + Action type "search" - Performs a web search query. + properties: + type: + type: string + enum: + - search + description: | + The action type. + x-stainless-const: true + query: + type: string + description: | + [DEPRECATED] The search query. + queries: + type: array + title: Search queries + description: | + The search queries. + items: + type: string + description: | + A search query. + sources: + type: array + title: Web search sources + description: | + The sources used in the search. + items: + type: object + title: Web search source + description: | + A source used in the search. + properties: + type: + type: string + enum: + - url + description: | + The type of source. Always `url`. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the source. + required: + - type + - url + required: + - type + - query + WebSearchActionOpenPage: + type: object + title: Open page action + description: | + Action type "open_page" - Opens a specific URL from search results. + properties: + type: + type: string + enum: + - open_page + description: | + The action type. + x-stainless-const: true + url: + description: | + The URL opened by the model. + type: string + format: uri + required: + - type + WebSearchActionFind: + type: object + title: Find action + description: | + Action type "find_in_page": Searches for a pattern within a loaded page. + properties: + type: + type: string + enum: + - find_in_page + description: | + The action type. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the page searched for the pattern. + pattern: + type: string + description: | + The pattern or text to search for within the page. + required: + - type + - url + - pattern + ComputerAction: + discriminator: + propertyName: type + 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: + items: + type: string + type: array + description: The keys being held while clicking. + 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 + + ``` + + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ] + + ``` + scroll_x: + type: integer + description: The horizontal scroll distance. + scroll_y: + type: integer + description: The vertical scroll distance. + text: + type: string + description: The text to type. + type: object + required: + - type + - button + - x + - 'y' + - keys + - path + - scroll_x + - scroll_y + - text + title: Click + description: A click action. + ComputerActionList: + title: Computer Action List + type: array + description: | + Flattened batched actions for `computer_use`. Each action includes an + `type` discriminator and action-specific fields. + items: + $ref: '#/components/schemas/ComputerAction' + ComputerCallSafetyCheckParam: + properties: + id: + type: string + description: The ID of the pending safety check. + code: + type: string + description: The type of the pending safety check. + message: + type: string + description: Details about the pending safety check. + type: object + required: + - id + description: A pending safety check for the computer call. + ComputerToolCallOutput: + type: object + title: Computer tool call output + description: | + The output of a computer tool call. + properties: + type: + type: string + description: > + The type of the computer tool call output. Always + `computer_call_output`. + enum: + - computer_call_output + default: computer_call_output + x-stainless-const: true + id: + type: string + description: | + The ID of the computer tool call output. + call_id: + type: string + description: | + The ID of the computer tool call that produced the output. + acknowledged_safety_checks: + type: array + description: > + The safety checks reported by the API that have been acknowledged by + the + + developer. + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + status: + type: string + description: > + The status of the message input. One of `in_progress`, `completed`, + or + + `incomplete`. Populated when input items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - output + ComputerCallOutputStatus: + type: string + enum: + - completed + - incomplete + - failed + ToolSearchExecutionType: + type: string + enum: + - server + - client + Tool: + description: | + A tool that can be used to generate a response. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - function + description: The type of the function tool. Always `function`. + default: function + x-stainless-const: true + name: + type: string + description: The name of the function to call. + description: + type: string + description: >- + A description of the function. Used by the model to determine + whether or not to call the function. + parameters: + additionalProperties: {} + type: object + description: A JSON schema object describing the parameters of the function. + x-oaiTypeLabel: map + strict: + type: boolean + description: Whether to enforce strict parameter validation. Default `true`. + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + 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: + 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. + 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`. + + - `eq`: equals + + - `ne`: not equal + + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: >- + The value to compare against the attribute key; supports string, + number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: >- + Array of filters to combine. Items can be `ComparisonFilter` or + `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + 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. + user_location: + $ref: '#/components/schemas/WebSearchApproximateLocation' + search_context_size: + 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. + server_label: + type: string + description: | + A label for this MCP server, used to identify it in tool calls. + server_url: + type: string + format: uri + description: > + The URL for the MCP server. One of `server_url` or `connector_id` + must be + + provided. + 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 + + `server_url` or `connector_id` must be provided. Learn more about + service + + connectors [here](/docs/guides/tools-remote-mcp#connectors). + + + Currently supported `connector_id` values are: + + + - Dropbox: `connector_dropbox` + + - Gmail: `connector_gmail` + + - Google Calendar: `connector_googlecalendar` + + - Google Drive: `connector_googledrive` + + - Microsoft Teams: `connector_microsoftteams` + + - Outlook Calendar: `connector_outlookcalendar` + + - Outlook Email: `connector_outlookemail` + + - SharePoint: `connector_sharepoint` + authorization: + type: string + description: > + An OAuth access token that can be used with a remote MCP server, + either + + with a custom MCP server URL or a service connector. Your + application + + must handle the OAuth authorization flow and provide the token here. + server_description: + type: string + description: > + Optional description of the MCP server, used to provide more + context. + headers: + type: object + additionalProperties: + type: string + description: > + Optional HTTP headers to send to the MCP server. Use for + authentication + + or other purposes. + allowed_tools: + description: | + List of allowed tool names or a filter object. + oneOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/MCPToolFilter' + type: 'null' + require_approval: + 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 + `always`, `never`, or a filter object associated with tools + that require approval. + 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 + + `never`. When set to `always`, all tools will require approval. + When + + set to `never`, all tools will not require approval. + enum: + - always + - never + default: always + type: 'null' + container: + description: > + The code interpreter container. Can be a container ID or an object + that + + specifies uploaded file IDs to make available to your code, along + with an + + optional `memory_limit` setting. + type: string + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + required: + - type + title: CodeInterpreterToolAuto + model: + type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-1.5 + description: | + The image generation model to use. Default: `gpt-image-1`. + default: gpt-image-1 + quality: + type: string + enum: + - low + - medium + - high + - auto + description: | + The quality of the generated image. One of `low`, `medium`, `high`, + or `auto`. Default: `auto`. + default: auto + size: + description: >- + The size of the generated images. For `gpt-image-2` and + `gpt-image-2-2026-04-21`, 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 + type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + output_format: + type: string + enum: + - png + - webp + - jpeg + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer + minimum: 0 + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: + type: string + enum: + - transparent + - opaque + - auto + description: | + Background type for the generated image. One of `transparent`, + `opaque`, or `auto`. Default: `auto`. + default: auto + input_fidelity: + 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`. + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + 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. + default: 0 + action: + description: > + Whether to generate a new image or edit an existing image. Default: + `auto`. + $ref: '#/components/schemas/ImageGenActionEnum' + format: + description: The input format for the custom tool. Default is unconstrained text. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + 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. + type: object + required: + - type + - syntax + - definition + title: Text format + 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 + type: array + minItems: 1 + description: The function/custom tools available inside this namespace. + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search is executed by the server or by the client. + search_content_types: + items: + $ref: '#/components/schemas/SearchContentType' + type: array + type: object + required: + - type + - name + - strict + - parameters + - vector_store_ids + - environment + - display_width + - display_height + - server_label + - container + - description + - tools + title: Function + CodeInterpreterOutputLogs: + properties: + type: + type: string + enum: + - logs + description: The type of the output. Always `logs`. + default: logs + x-stainless-const: true + logs: + type: string + description: The logs output from the code interpreter. + type: object + required: + - type + - logs + 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. + LocalShellExecAction: + properties: + type: + type: string + enum: + - exec + description: The type of the local shell action. Always `exec`. + default: exec + x-stainless-const: true + command: + items: + type: string + type: array + description: The command to run. + timeout_ms: + type: integer + description: Optional timeout in milliseconds for the command. + working_directory: + type: string + description: Optional working directory to run the command in. + env: + additionalProperties: + type: string + type: object + description: Environment variables to set for the command. + x-oaiTypeLabel: map + user: + type: string + description: Optional user to run the command as. + type: object + required: + - type + - command + - env + title: Local shell exec action + description: Execute a shell command on the server. + FunctionShellAction: + properties: + commands: + items: + type: string + description: A list of commands to run. + type: array + timeout_ms: + type: integer + description: Optional timeout in milliseconds for the commands. + max_output_length: + type: integer + description: Optional maximum number of characters to return from each command. + type: object + required: + - commands + - timeout_ms + - max_output_length + title: Shell exec action + description: Execute a shell command. + FunctionShellCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + LocalEnvironmentResource: + properties: + type: + type: string + enum: + - local + description: The environment type. Always `local`. + default: local + x-stainless-const: true + type: object + required: + - type + title: Local Environment + description: Represents the use of a local environment to perform shell actions. + ContainerReferenceResource: + properties: + type: + type: string + enum: + - container_reference + description: The environment type. Always `container_reference`. + default: container_reference + x-stainless-const: true + container_id: + type: string + type: object + required: + - type + - container_id + title: Container Reference + description: Represents a container created with /v1/containers. + FunctionShellCallOutputStatusEnum: + type: string + enum: + - in_progress + - completed + - incomplete + FunctionShellCallOutputContent: + properties: + stdout: + type: string + description: The standard output that was captured. + stderr: + type: string + description: The standard error output that was captured. + outcome: + 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 + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true + exit_code: + type: integer + description: Exit code from the shell process. + type: object + required: + - type + - exit_code + 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. + ApplyPatchCallStatus: + type: string + enum: + - in_progress + - completed + ApplyPatchCreateFileOperation: + properties: + type: + type: string + enum: + - create_file + description: Create a new file with the provided diff. + default: create_file + x-stainless-const: true + path: + type: string + description: Path of the file to create. + diff: + type: string + description: Diff to apply. + type: object + required: + - type + - path + - diff + title: Apply patch create file operation + description: Instruction describing how to create a file via the apply_patch tool. + ApplyPatchDeleteFileOperation: + properties: + type: + type: string + enum: + - delete_file + description: Delete the specified file. + default: delete_file + x-stainless-const: true + path: + type: string + description: Path of the file to delete. + type: object + required: + - type + - path + title: Apply patch delete file operation + description: Instruction describing how to delete a file via the apply_patch tool. + ApplyPatchUpdateFileOperation: + 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: + type: string + description: Diff to apply. + type: object + required: + - type + - path + - diff + title: Apply patch update file operation + description: Instruction describing how to update a file via the apply_patch tool. + ApplyPatchCallOutputStatus: + type: string + enum: + - completed + - failed + MCPListToolsTool: + type: object + title: MCP list tools tool + description: | + A tool available on an MCP server. + properties: + name: + type: string + description: | + The name of the tool. + description: + type: string + description: | + The description of the tool. + input_schema: + type: string + description: |- + The JSON schema describing the tool's input. + (opaque JSON object) + annotations: + type: string + description: |- + Additional annotations about the tool. + (opaque JSON object) + required: + - name + - input_schema + MCPToolCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + - calling + - failed + FunctionAndCustomToolCallOutput: + discriminator: + propertyName: type + 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. + image_url: + 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. + file_id: + type: string + description: The ID of the file to be sent to the model. + 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`. + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + file_url: + type: string + format: uri + description: The URL of the file to be sent to the model. + type: object + required: + - type + - text + - detail + title: Input text + description: A text input to the model. + InputContent: + discriminator: + propertyName: type + 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. + image_url: + 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. + file_id: + type: string + description: The ID of the file to be sent to the model. + 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`. + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + file_url: + type: string + format: uri + description: The URL of the file to be sent to the model. + type: object + required: + - type + - text + - detail + title: Input text + description: A text input to the model. + OutputMessageContent: + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - output_text + description: The type of the output text. Always `output_text`. + default: output_text + x-stainless-const: true + text: + type: string + description: The text output from the model. + annotations: + items: + $ref: '#/components/schemas/Annotation' + type: array + description: The annotations of the text output. + logprobs: + items: + $ref: '#/components/schemas/LogProb' + type: array + refusal: + type: string + description: The refusal explanation from the model. + type: object + required: + - type + - text + - annotations + - logprobs + - refusal + title: Output text + description: A text output from the model. + ComputerScreenshotImage: + type: object + description: | + A computer screenshot image used with the computer use tool. + properties: + type: + type: string + enum: + - computer_screenshot + default: computer_screenshot + description: > + Specifies the event type. For a computer screenshot, this property + is + + always set to `computer_screenshot`. + x-stainless-const: true + image_url: + type: string + format: uri + description: The URL of the screenshot image. + file_id: + type: string + description: The identifier of an uploaded file that contains the screenshot. + required: + - type + FunctionCallItemStatus: + type: string + enum: + - in_progress + - completed + - incomplete + InputTextContentParam: + 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 + maxLength: 10485760 + description: The text input to the model. + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + InputImageContentParamAutoParam: + properties: + type: + type: string + enum: + - input_image + description: The type of the input item. Always `input_image`. + default: input_image + x-stainless-const: true + image_url: + 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. + file_id: + type: string + description: The ID of the file to be sent to the model. + example: file-123 + detail: + type: string + enum: + - low + - high + - auto + - original + type: object + required: + - type + title: Input image + description: >- + An image input to the model. Learn about [image + inputs](/docs/guides/vision) + InputFileContentParam: + 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: + type: string + description: The ID of the file to be sent to the model. + example: file-123 + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + maxLength: 73400320 + description: The base64-encoded data of the file to be sent to the model. + file_url: + type: string + format: uri + description: The URL of the file to be sent to the model. + detail: + $ref: '#/components/schemas/FileDetailEnum' + description: >- + The detail level of the file to be sent to the model. Use `low` for + the default rendering behavior, or `high` to render the file at + higher quality. Defaults to `low`. + type: object + required: + - type + title: Input file + description: A file input to the model. + EmptyModelParam: + properties: {} + type: object + required: [] + FunctionShellActionParam: + properties: + commands: + items: + type: string + type: array + description: Ordered shell commands for the execution environment to run. + timeout_ms: + type: integer + description: >- + Maximum wall-clock time in milliseconds to allow the shell commands + to run. + max_output_length: + type: integer + description: >- + Maximum number of UTF-8 characters to capture from combined stdout + and stderr output. + 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 + title: Shell call status + description: Status values reported for shell tool calls. + LocalEnvironmentParam: + properties: + type: + type: string + enum: + - local + 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. + type: object + required: + - type + ContainerReferenceParam: + properties: + type: + type: string + enum: + - container_reference + description: References a container created with the /v1/containers endpoint + default: container_reference + x-stainless-const: true + container_id: + type: string + description: The ID of the referenced container. + example: cntr_123 + type: object + required: + - type + - container_id + FunctionShellCallOutputContentParam: + properties: + stdout: + type: string + maxLength: 10485760 + description: Captured stdout output for the shell call. + stderr: + type: string + maxLength: 10485760 + description: Captured stderr output for the shell call. + 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. + ApplyPatchCallStatusParam: + type: string + enum: + - in_progress + - completed + title: Apply patch call status + description: Status values reported for apply_patch tool calls. + ApplyPatchOperationParam: + 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 + 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 + required: + - type + - path + - diff + ApplyPatchCallOutputStatusParam: + type: string + enum: + - completed + - failed + title: Apply patch call output status + description: Outcome values reported for apply_patch tool call outputs. + Annotation: + description: An annotation that applies to a span of output text. + discriminator: + propertyName: type + 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 of the file in the list of files. + filename: + type: string + description: The filename of the file cited. + 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. + container_id: + type: string + description: The ID of the container file. + type: object + required: + - type + - file_id + - index + - filename + - url + - start_index + - end_index + - title + - container_id + title: File citation + LogProb: + properties: + token: + type: string + logprob: + type: number + bytes: + items: + type: integer + type: array + 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. + ImageDetail: + type: string + enum: + - low + - high + - auto + - original + FileInputDetail: + type: string + enum: + - low + - high + 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: + items: + type: string + type: array + description: The keys being held while clicking. + 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: + items: + type: string + type: array + description: The keys being held while double-clicking. + type: object + required: + - type + - x + - 'y' + - keys + title: DoubleClick + description: A double click action. + 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 + + ``` + + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ] + + ``` + keys: + items: + type: string + type: array + description: The keys being held while dragging the mouse. + 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 + keys: + items: + 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 + x: + type: integer + description: The x-coordinate to move to. + 'y': + type: integer + description: The y-coordinate to move to. + keys: + items: + type: string + type: array + description: The keys being held while moving the mouse. + 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 + 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: + items: + type: string + type: array + description: The keys being held while scrolling. + 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: object + required: + - type + - text + title: Type + description: An action to type in text. + WaitParam: + 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 + type: object + required: + - type + title: Wait + description: A wait action. + FunctionTool: + properties: + type: + type: string + enum: + - function + description: The type of the function tool. Always `function`. + default: function + x-stainless-const: true + name: + type: string + description: The name of the function to call. + description: + type: string + description: >- + A description of the function. Used by the model to determine + whether or not to call the function. + parameters: + additionalProperties: {} + type: object + description: A JSON schema object describing the parameters of the function. + x-oaiTypeLabel: map + strict: + type: boolean + description: Whether to enforce strict parameter validation. Default `true`. + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + 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://platform.openai.com/docs/guides/function-calling). + FileSearchTool: + properties: + type: + type: string + enum: + - file_search + description: The type of the file search tool. Always `file_search`. + default: file_search + x-stainless-const: true + 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: + 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. + 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`. + + - `eq`: equals + + - `ne`: not equal + + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: >- + The value to compare against the attribute key; supports string, + number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: >- + Array of filters to combine. Items can be `ComparisonFilter` or + `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + 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://platform.openai.com/docs/guides/tools-file-search). + ComputerTool: + properties: + type: + type: string + enum: + - computer + description: The type of the computer tool. Always `computer`. + default: computer + x-stainless-const: true + type: object + required: + - type + title: Computer + description: >- + A tool that controls a virtual computer. Learn more about the [computer + tool](https://platform.openai.com/docs/guides/tools-computer-use). + ComputerUsePreviewTool: + properties: + type: + type: string + enum: + - computer_use_preview + description: The type of the computer use tool. Always `computer_use_preview`. + default: computer_use_preview + x-stainless-const: true + 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: + - 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://platform.openai.com/docs/guides/tools-computer-use). + WebSearchTool: + type: object + title: Web search + description: > + Search the Internet for sources related to the prompt. Learn more about + the + + [web search tool](/docs/guides/tools-web-search). + properties: + type: + 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 + filters: + type: object + description: | + Filters for the search. + 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. + + Subdomains of the provided domains are allowed as well. + + + Example: `["pubmed.ncbi.nlm.nih.gov"]` + items: + type: string + description: Allowed domain for the search. + default: [] + - type: 'null' + user_location: + $ref: '#/components/schemas/WebSearchApproximateLocation' + search_context_size: + 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. + required: + - type + MCPTool: + type: object + title: MCP tool + description: > + Give the model access to additional tools via remote Model Context + Protocol + + (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). + 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. + server_url: + type: string + format: uri + description: > + The URL for the MCP server. One of `server_url` or `connector_id` + must be + + provided. + 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 + + `server_url` or `connector_id` must be provided. Learn more about + service + + connectors [here](/docs/guides/tools-remote-mcp#connectors). + + + Currently supported `connector_id` values are: + + + - Dropbox: `connector_dropbox` + + - Gmail: `connector_gmail` + + - Google Calendar: `connector_googlecalendar` + + - Google Drive: `connector_googledrive` + + - Microsoft Teams: `connector_microsoftteams` + + - Outlook Calendar: `connector_outlookcalendar` + + - Outlook Email: `connector_outlookemail` + + - SharePoint: `connector_sharepoint` + authorization: + type: string + description: > + An OAuth access token that can be used with a remote MCP server, + either + + with a custom MCP server URL or a service connector. Your + application + + must handle the OAuth authorization flow and provide the token here. + server_description: + type: string + description: > + Optional description of the MCP server, used to provide more + context. + headers: + type: object + additionalProperties: + type: string + description: > + Optional HTTP headers to send to the MCP server. Use for + authentication + + or other purposes. + allowed_tools: + description: | + List of allowed tool names or a filter object. + oneOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/MCPToolFilter' + type: 'null' + require_approval: + 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 + `always`, `never`, or a filter object associated with tools + that require approval. + 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 + + `never`. When set to `always`, all tools will require approval. + When + + set to `never`, all tools will not require approval. + enum: + - always + - never + default: always + type: 'null' + defer_loading: + type: boolean + description: | + Whether this MCP tool is deferred and discovered via tool search. + required: + - type + - server_label + CodeInterpreterTool: + type: object + title: Code interpreter + description: | + A tool that runs Python code to help generate a response to a prompt. + properties: + type: + type: string + enum: + - code_interpreter + description: | + The type of the code interpreter tool. Always `code_interpreter`. + x-stainless-const: true + container: + description: > + The code interpreter container. Can be a container ID or an object + that + + specifies uploaded file IDs to make available to your code, along + with an + + optional `memory_limit` setting. + type: string + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + required: + - type + title: CodeInterpreterToolAuto + required: + - type + - container + ImageGenTool: + type: object + title: Image generation tool + description: | + A tool that generates images using the GPT image models. + properties: + type: + type: string + enum: + - image_generation + description: | + The type of the image generation tool. Always `image_generation`. + x-stainless-const: true + model: + type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-1.5 + description: | + The image generation model to use. Default: `gpt-image-1`. + default: gpt-image-1 + quality: + type: string + enum: + - low + - medium + - high + - auto + description: | + The quality of the generated image. One of `low`, `medium`, `high`, + or `auto`. Default: `auto`. + default: auto + size: + description: >- + The size of the generated images. For `gpt-image-2` and + `gpt-image-2-2026-04-21`, 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 + type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + output_format: + type: string + enum: + - png + - webp + - jpeg + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer + minimum: 0 + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: + type: string + enum: + - transparent + - opaque + - auto + description: | + Background type for the generated image. One of `transparent`, + `opaque`, or `auto`. Default: `auto`. + default: auto + input_fidelity: + 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`. + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + 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. + default: 0 + action: + description: > + Whether to generate a new image or edit an existing image. Default: + `auto`. + $ref: '#/components/schemas/ImageGenActionEnum' + required: + - type + LocalShellToolParam: + properties: + type: + type: string + enum: + - local_shell + description: The type of the local shell tool. Always `local_shell`. + default: local_shell + x-stainless-const: true + type: object + required: + - type + title: Local shell tool + description: >- + A tool that allows the model to execute shell commands in a local + environment. + FunctionShellToolParam: + properties: + type: + type: string + enum: + - shell + description: The type of the shell tool. Always `shell`. + default: shell + x-stainless-const: true + environment: + oneOf: + - $ref: '#/components/schemas/ContainerAutoParam' + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + discriminator: + propertyName: type + type: 'null' + type: object + required: + - type + title: Shell tool + description: A tool that allows the model to execute shell commands. + CustomToolParam: + properties: + type: + type: string + enum: + - custom + description: The type of the custom tool. Always `custom`. + default: custom + x-stainless-const: true + 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. + format: + description: The input format for the custom tool. Default is unconstrained text. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + 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. + type: object + required: + - type + - syntax + - definition + title: Text format + defer_loading: + type: boolean + description: Whether this tool should be deferred and discovered via tool search. + type: object + required: + - type + - name + title: Custom tool + description: >- + A custom tool that processes input using a specified format. Learn more + about [custom tools](/docs/guides/function-calling#custom-tools) + NamespaceToolParam: + 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 + minLength: 1 + description: A description of the namespace shown to the model. + 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 + 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: + type: string + description: >- + Description shown to the model for a client-executed tool search + tool. + parameters: + properties: {} + type: object + required: [] + type: object + required: + - type + title: Tool search tool + description: Hosted or BYOT tool search configuration for deferred tools. + WebSearchPreviewTool: + properties: + type: + type: string + enum: + - web_search_preview + - web_search_preview_2025_03_11 + 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 + user_location: + properties: + type: + type: string + enum: + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate + x-stainless-const: true + country: + type: string + description: >- + The two-letter [ISO country + code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, + e.g. `US`. + region: + type: string + description: Free text input for the region of the user, e.g. `California`. + city: + type: string + description: Free text input for the city of the user, e.g. `San Francisco`. + timezone: + type: string + description: >- + The [IANA + timezone](https://timeapi.io/documentation/iana-timezones) of + the user, e.g. `America/Los_Angeles`. + type: object + required: + - type + 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://platform.openai.com/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 + type: object + required: + - type + title: Apply patch tool + description: >- + Allows the assistant to create, delete, or update files using unified + diffs. + FunctionShellCallOutputTimeoutOutcome: + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true + type: object + required: + - type + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + FunctionShellCallOutputExitOutcome: + properties: + type: + type: string + enum: + - exit + description: The outcome type. Always `exit`. + default: exit + x-stainless-const: true + 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. + DetailEnum: + type: string + enum: + - low + - high + - auto + - original + FileDetailEnum: + type: string + enum: + - low + - high + LocalSkillParam: + properties: + name: + type: string + description: The name of the skill. + description: + type: string + description: The description of the skill. + path: + type: string + description: The path to the directory containing the skill. + type: object + required: + - name + - description + - path + FunctionShellCallOutputOutcomeParam: + title: Shell call outcome + description: The exit or timeout outcome associated with this shell call. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true + exit_code: + type: integer + description: The exit code returned by the shell process. + type: object + required: + - type + - exit_code + 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 + 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. + 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 of the file in the list of files. + 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. + start_index: + type: integer + description: >- + The index of the first character of the container file citation in + the message. + 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. + FilePath: + type: object + title: File path + description: | + A path to a file. + properties: + type: + type: string + description: | + The type of the file path. Always `file_path`. + enum: + - file_path + x-stainless-const: true + file_id: + type: string + description: | + The ID of the file. + index: + type: integer + description: | + The index of the file in the list of files. + required: + - type + - file_id + - index + TopLogProb: + properties: + token: + type: string + logprob: + type: number + bytes: + items: + type: integer + type: array + type: object + required: + - token + - logprob + - bytes + title: Top log probability + description: The top log probability of a token. + ClickButtonType: + type: string + enum: + - left + - right + - wheel + - back + - forward + 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 }`.' + RankingOptions: + properties: + 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: + 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. + 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`. + + - `eq`: equals + + - `ne`: not equal + + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: >- + The value to compare against the attribute key; supports string, + number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: >- + Array of filters to combine. Items can be `ComparisonFilter` or + `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + ComputerEnvironment: + type: string + enum: + - windows + - mac + - linux + - ubuntu + - browser + WebSearchApproximateLocation: + type: object + title: Web search approximate location + description: | + The approximate location of the user. + 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' + MCPToolFilter: + type: object + title: MCP tool filter + description: | + A filter object to specify which tools are allowed. + 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 + + MCP server is [annotated with + `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), + + it will match this filter. + required: [] + additionalProperties: false + AutoCodeInterpreterToolParam: + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + 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. + 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`. + ImageGenActionEnum: + type: string + enum: + - generate + - edit + - auto + ContainerAutoParam: + properties: + type: + type: string + enum: + - container_auto + description: Automatically creates a container for this request + default: container_auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + 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. + type: object + required: + - type + CustomTextFormatParam: + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + x-stainless-const: true + type: object + required: + - type + title: Text format + description: Unconstrained free-form text. + CustomGrammarFormatParam: + properties: + type: + type: string + enum: + - grammar + description: Grammar format. Always `grammar`. + default: grammar + 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. + type: object + required: + - type + - syntax + - definition + title: Grammar format + description: A grammar defined by the user. + FunctionToolParam: + properties: + name: + type: string + maxLength: 128 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: + type: string + parameters: + properties: {} + type: object + required: [] + strict: + type: boolean + type: + type: string + enum: + - function + default: function + x-stainless-const: true + defer_loading: + type: boolean + description: >- + Whether this function should be deferred and discovered via tool + search. + type: object + required: + - name + - type + ApproximateLocation: + properties: + type: + type: string + enum: + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate + x-stainless-const: true + country: + type: string + description: >- + The two-letter [ISO country + code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. + `US`. + region: + type: string + description: Free text input for the region of the user, e.g. `California`. + city: + type: string + description: Free text input for the city of the user, e.g. `San Francisco`. + timezone: + type: string + description: >- + The [IANA timezone](https://timeapi.io/documentation/iana-timezones) + of the user, e.g. `America/Los_Angeles`. + type: object + required: + - type + SearchContextSize: + type: string + enum: + - low + - medium + - high + SearchContentType: + type: string + enum: + - text + - image + FunctionShellCallOutputTimeoutOutcomeParam: + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true + type: object + required: + - type + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + FunctionShellCallOutputExitOutcomeParam: + properties: + type: + type: string + enum: + - exit + description: The outcome type. Always `exit`. + default: exit + x-stainless-const: true + exit_code: + type: integer + 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. + 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. + type: object + required: + - embedding_weight + - text_weight + 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. + 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`. + + - `eq`: equals + + - `ne`: not equal + + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: >- + The value to compare against the attribute key; supports string, + number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + required: + - type + - key + - value + x-oaiMeta: + name: ComparisonFilter + 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: '#' + discriminator: + propertyName: type + required: + - type + - filters + x-oaiMeta: + name: CompoundFilter + ContainerMemoryLimit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + ContainerNetworkPolicyDisabledParam: + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + x-stainless-const: true + type: object + required: + - type + 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 + 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 + skill_id: + type: string + maxLength: 64 + minLength: 1 + description: The ID of the referenced skill. + version: + type: string + description: >- + Optional skill version. Use a positive integer or 'latest'. Omit for + default. + type: object + required: + - type + - skill_id + InlineSkillParam: + properties: + type: + type: string + enum: + - inline + description: Defines an inline skill for this request. + default: inline + x-stainless-const: true + name: + type: string + description: The name of the skill. + 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 + GrammarSyntax1: + type: string + enum: + - lark + - regex + 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 + InlineSkillSourceParam: + 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. + type: object + required: + - type + - media_type + - data + description: Inline skill payload + x-stackQL-resources: + items: + id: openai.conversations.items + name: items + title: Items + methods: + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1conversations~1{conversation_id}~1items/post' + response: + mediaType: application/json + openAPIDocKey: '200' + list: + operation: + $ref: '#/paths/~1conversations~1{conversation_id}~1items/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + get: + operation: + $ref: '#/paths/~1conversations~1{conversation_id}~1items~1{item_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: >- + #/paths/~1conversations~1{conversation_id}~1items~1{item_id}/delete + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/items/methods/get' + - $ref: '#/components/x-stackQL-resources/items/methods/list' + insert: + - $ref: '#/components/x-stackQL-resources/items/methods/create' + update: [] + delete: + - $ref: '#/components/x-stackQL-resources/items/methods/delete' + replace: [] + conversations: + id: openai.conversations.conversations + name: conversations + title: Conversations + methods: + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1conversations/post' + response: + mediaType: application/json + openAPIDocKey: '200' + get: + operation: + $ref: '#/paths/~1conversations~1{conversation_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: '#/paths/~1conversations~1{conversation_id}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + update: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1conversations~1{conversation_id}/post' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/conversations/methods/get' + insert: + - $ref: '#/components/x-stackQL-resources/conversations/methods/create' + update: + - $ref: '#/components/x-stackQL-resources/conversations/methods/update' + delete: + - $ref: '#/components/x-stackQL-resources/conversations/methods/delete' + replace: [] +servers: + - url: https://api.openai.com/v1 +x-stackQL-config: + pagination: + requestToken: + key: after + location: query + responseToken: + key: $.last_id + location: body + queryParamPushdown: + top: + paramName: limit + maxValue: 100 diff --git a/provider-dev/openapi/src/openai/v00.00.00000/services/evals.yaml b/provider-dev/openapi/src/openai/v00.00.00000/services/evals.yaml new file mode 100644 index 0000000..8e03ad3 --- /dev/null +++ b/provider-dev/openapi/src/openai/v00.00.00000/services/evals.yaml @@ -0,0 +1,8779 @@ +openapi: 3.1.0 +info: + title: evals API + description: openai API + version: 2.3.0 +paths: + /evals: + get: + operationId: listEvals + tags: + - Evals + summary: | + List evaluations for a project. + parameters: + - name: after + in: query + description: Identifier for the last eval from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: >- + Number of evals to retrieve. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: >- + Sort order for evals by timestamp. Use `asc` for ascending order or + `desc` for descending order. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + - name: order_by + in: query + description: > + Evals can be ordered by creation time or last updated time. Use + + `created_at` for creation time or `updated_at` for last updated + time. + required: false + schema: + type: string + enum: + - created_at + - updated_at + default: created_at + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: A list of evals + content: + application/json: + schema: + $ref: '#/components/schemas/EvalList' + x-oaiMeta: + name: List evals + group: evals + path: list + examples: + request: + curl: | + curl https://api.openai.com/v1/evals?limit=1 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.evals.list() + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const evals = await openai.evals.list({ limit: 1 }); + console.log(evals); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const evalListResponse of client.evals.list()) { + console.log(evalListResponse.id); + } + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalListPage; + import com.openai.models.evals.EvalListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalListPage page = client.evals().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.evals.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "object": "eval", + "data_source_config": { + "type": "stored_completions", + "metadata": { + "usecase": "push_notifications_summarizer" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + ] + } + }, + "testing_criteria": [ + { + "name": "Push Notification Summary Grader", + "id": "Push Notification Summary Grader-9b876f24-4762-4be9-aff4-db7a9b31c673", + "type": "label_model", + "model": "o3-mini", + "input": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "text": "\nLabel the following push notification summary as either correct or incorrect.\nThe push notification and the summary will be provided below.\nA good push notificiation summary is concise and snappy.\nIf it is good, then label it as correct, if not, then incorrect.\n" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "\nPush notifications: {{item.input}}\nSummary: {{sample.output_text}}\n" + } + } + ], + "passing_labels": [ + "correct" + ], + "labels": [ + "correct", + "incorrect" + ], + "sampling_params": null + } + ], + "name": "Push Notification Summary Grader", + "created_at": 1739314509, + "metadata": { + "description": "A stored completions eval for push notification summaries" + } + } + ], + "first_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "last_id": "eval_67aa884cf6688190b58f657d4441c8b7", + "has_more": true + } + post: + operationId: createEval + tags: + - Evals + summary: > + Create the structure of an evaluation that can be used to test a model's + performance. + + An 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. + + For more information, see the [Evals guide](/docs/guides/evals). + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEvalRequest' + responses: + '201': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Eval' + x-oaiMeta: + name: Create eval + group: evals + path: post + examples: + request: + curl: | + curl https://api.openai.com/v1/evals \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Sentiment", + "data_source_config": { + "type": "stored_completions", + "metadata": { + "usecase": "chatbot" + } + }, + "testing_criteria": [ + { + "type": "label_model", + "model": "o3-mini", + "input": [ + { + "role": "developer", + "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" + }, + { + "role": "user", + "content": "Statement: {{item.input}}" + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ], + "name": "Example label grader" + } + ] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.create( + data_source_config={ + "item_schema": { + "foo": "bar" + }, + "type": "custom", + }, + testing_criteria=[{ + "input": [{ + "content": "content", + "role": "role", + }], + "labels": ["string"], + "model": "model", + "name": "name", + "passing_labels": ["string"], + "type": "label_model", + }], + ) + print(eval.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const evalObj = await openai.evals.create({ + name: "Sentiment", + data_source_config: { + type: "stored_completions", + metadata: { usecase: "chatbot" } + }, + testing_criteria: [ + { + type: "label_model", + model: "o3-mini", + input: [ + { role: "developer", content: "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" }, + { role: "user", content: "Statement: {{item.input}}" } + ], + passing_labels: ["positive"], + labels: ["positive", "neutral", "negative"], + name: "Example label grader" + } + ] + }); + console.log(evalObj); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.create({ + data_source_config: { + item_schema: { foo: 'bar' }, + type: 'custom', + }, + testing_criteria: [ + { + input: [{ content: 'content', role: 'role' }], + labels: ['string'], + model: 'model', + name: 'name', + passing_labels: ['string'], + type: 'label_model', + }, + ], + }); + + console.log(_eval.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.evals.EvalCreateParams; + import com.openai.models.evals.EvalCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalCreateParams params = EvalCreateParams.builder() + .customDataSourceConfig(EvalCreateParams.DataSourceConfig.Custom.ItemSchema.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build()) + .addTestingCriterion(EvalCreateParams.TestingCriterion.LabelModel.builder() + .addInput(EvalCreateParams.TestingCriterion.LabelModel.Input.SimpleInputMessage.builder() + .content("content") + .role("role") + .build()) + .addLabel("string") + .model("model") + .name("name") + .addPassingLabel("string") + .build()) + .build(); + EvalCreateResponse eval = client.evals().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.create( + data_source_config: {item_schema: {foo: "bar"}, type: :custom}, + testing_criteria: [ + { + input: [{content: "content", role: "role"}], + labels: ["string"], + model: "model", + name: "name", + passing_labels: ["string"], + type: :label_model + } + ] + ) + + puts(eval_) + response: | + { + "object": "eval", + "id": "eval_67b7fa9a81a88190ab4aa417e397ea21", + "data_source_config": { + "type": "stored_completions", + "metadata": { + "usecase": "chatbot" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + ] + }, + "testing_criteria": [ + { + "name": "Example label grader", + "type": "label_model", + "model": "o3-mini", + "input": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.input}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + ], + "name": "Sentiment", + "created_at": 1740110490, + "metadata": { + "description": "An eval for sentiment analysis" + } + } + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + /evals/{eval_id}: + get: + operationId: getEval + tags: + - Evals + summary: | + Get an evaluation by ID. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: The evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/Eval' + x-oaiMeta: + name: Get an eval + group: evals + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.retrieve( + "eval_id", + ) + print(eval.id) + javascript: > + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + const evalObj = await + openai.evals.retrieve("eval_67abd54d9b0081909a86353f6fb9317a"); + + console.log(evalObj); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.retrieve('eval_id'); + + console.log(_eval.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalRetrieveParams; + import com.openai.models.evals.EvalRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalRetrieveResponse eval = client.evals().retrieve("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.retrieve("eval_id") + + puts(eval_) + response: | + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": {}, + } + post: + operationId: updateEval + tags: + - Evals + summary: | + Update certain properties of an evaluation. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to update. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + description: Request to update an evaluation + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: Rename the evaluation. + metadata: + $ref: '#/components/schemas/Metadata' + responses: + '200': + description: The updated evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/Eval' + x-oaiMeta: + name: Update an eval + group: evals + path: update + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"name": "Updated Eval", "metadata": {"description": "Updated description"}}' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.update( + eval_id="eval_id", + ) + print(eval.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const updatedEval = await openai.evals.update( + "eval_67abd54d9b0081909a86353f6fb9317a", + { + name: "Updated Eval", + metadata: { description: "Updated description" } + } + ); + console.log(updatedEval); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.update('eval_id'); + + console.log(_eval.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalUpdateParams; + import com.openai.models.evals.EvalUpdateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalUpdateResponse eval = client.evals().update("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.update("eval_id") + + puts(eval_) + response: | + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "Updated Eval", + "created_at": 1739314509, + "metadata": {"description": "Updated description"}, + } + delete: + operationId: deleteEval + tags: + - Evals + summary: | + Delete an evaluation. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to delete. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Successfully deleted the evaluation. + content: + application/json: + schema: + type: object + properties: + object: + type: string + example: eval.deleted + deleted: + type: boolean + example: true + eval_id: + type: string + example: eval_abc123 + required: + - object + - deleted + - eval_id + '404': + description: Evaluation not found. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Delete an eval + group: evals + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_abc123 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.delete( + "eval_id", + ) + print(eval.eval_id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const deleted = await openai.evals.delete("eval_abc123"); + console.log(deleted); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.delete('eval_id'); + + console.log(_eval.eval_id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalDeleteParams; + import com.openai.models.evals.EvalDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalDeleteResponse eval = client.evals().delete("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.delete("eval_id") + + puts(eval_) + response: | + { + "object": "eval.deleted", + "deleted": true, + "eval_id": "eval_abc123" + } + /evals/{eval_id}/runs: + get: + operationId: getEvalRuns + tags: + - Evals + summary: | + Get a list of runs for an evaluation. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: after + in: query + description: Identifier for the last run from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: >- + Number of runs to retrieve. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: >- + Sort order for runs by timestamp. Use `asc` for ascending order or + `desc` for descending order. Defaults to `asc`. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + - name: status + in: query + description: >- + Filter runs by status. One of `queued` | `in_progress` | `failed` | + `completed` | `canceled`. + required: false + schema: + type: string + enum: + - queued + - in_progress + - completed + - canceled + - failed + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: A list of runs for the evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRunList' + x-oaiMeta: + name: Get eval runs + group: evals + path: get-runs + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/egroup_67abd54d9b0081909a86353f6fb9317a/runs + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.evals.runs.list( + eval_id="eval_id", + ) + page = page.data[0] + print(page.id) + javascript: > + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + const runs = await + openai.evals.runs.list("egroup_67abd54d9b0081909a86353f6fb9317a"); + + console.log(runs); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const runListResponse of + client.evals.runs.list('eval_id')) { + console.log(runListResponse.id); + } + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunListPage; + import com.openai.models.evals.runs.RunListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunListPage page = client.evals().runs().list("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.evals.runs.list("eval_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "eval.run", + "id": "evalrun_67e0c7d31560819090d60c0780591042", + "eval_id": "eval_67e0c726d560819083f19a957c4c640b", + "report_url": "https://platform.openai.com/evaluations/eval_67e0c726d560819083f19a957c4c640b", + "status": "completed", + "model": "o3-mini", + "name": "bulk_with_negative_examples_o3-mini", + "created_at": 1742784467, + "result_counts": { + "total": 1, + "errored": 0, + "failed": 0, + "passed": 1 + }, + "per_model_usage": [ + { + "model_name": "o3-mini", + "invocation_count": 1, + "prompt_tokens": 563, + "completion_tokens": 874, + "total_tokens": 1437, + "cached_tokens": 0 + } + ], + "per_testing_criteria_results": [ + { + "testing_criteria": "Push Notification Summary Grader-1808cd0b-eeec-4e0b-a519-337e79f4f5d1", + "passed": 1, + "failed": 0 + } + ], + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "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" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.notifications}}" + } + } + ] + }, + "model": "o3-mini", + "sampling_params": null + }, + "error": null, + "metadata": {} + } + ], + "first_id": "evalrun_67e0c7d31560819090d60c0780591042", + "last_id": "evalrun_67e0c7d31560819090d60c0780591042", + "has_more": true + } + post: + operationId: createEvalRun + 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. + parameters: + - in: path + name: eval_id + required: true + schema: + type: string + description: The ID of the evaluation to create a run for. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEvalRunRequest' + responses: + '201': + description: Successfully created a run for the evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRun' + '400': + description: Bad request (for example, missing eval object) + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Create eval run + group: evals + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_67e579652b548190aaa83ada4b125f47/runs + \ + -X POST \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"name":"gpt-4o-mini","data_source":{"type":"completions","input_messages":{"type":"template","template":[{"role":"developer","content":"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"} , {"role":"user","content":"{{item.input}}"}]} ,"sampling_params":{"temperature":1,"max_completions_tokens":2048,"top_p":1,"seed":42},"model":"gpt-4o-mini","source":{"type":"file_content","content":[{"item":{"input":"Tech Company Launches Advanced Artificial Intelligence Platform","ground_truth":"Technology"}}]}}' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.evals.runs.create( + eval_id="eval_id", + data_source={ + "source": { + "content": [{ + "item": { + "foo": "bar" + } + }], + "type": "file_content", + }, + "type": "jsonl", + }, + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const run = await openai.evals.runs.create( + "eval_67e579652b548190aaa83ada4b125f47", + { + name: "gpt-4o-mini", + data_source: { + type: "completions", + input_messages: { + type: "template", + template: [ + { + role: "developer", + content: "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" + }, + { + role: "user", + content: "{{item.input}}" + } + ] + }, + sampling_params: { + temperature: 1, + max_completions_tokens: 2048, + top_p: 1, + seed: 42 + }, + model: "gpt-4o-mini", + source: { + type: "file_content", + content: [ + { + item: { + input: "Tech Company Launches Advanced Artificial Intelligence Platform", + ground_truth: "Technology" + } + } + ] + } + } + } + ); + console.log(run); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.evals.runs.create('eval_id', { + data_source: { + source: { content: [{ item: { foo: 'bar' } }], type: 'file_content' }, + type: 'jsonl', + }, + }); + + console.log(run.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.evals.runs.CreateEvalJsonlRunDataSource; + import com.openai.models.evals.runs.RunCreateParams; + import com.openai.models.evals.runs.RunCreateResponse; + import java.util.List; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .evalId("eval_id") + .dataSource(CreateEvalJsonlRunDataSource.builder() + .fileContentSource(List.of(CreateEvalJsonlRunDataSource.Source.FileContent.Content.builder() + .item(CreateEvalJsonlRunDataSource.Source.FileContent.Content.Item.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build()) + .build())) + .build()) + .build(); + RunCreateResponse run = client.evals().runs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.evals.runs.create( + "eval_id", + data_source: {source: {content: [{item: {foo: "bar"}}], type: :file_content}, type: :jsonl} + ) + + puts(run) + response: | + { + "object": "eval.run", + "id": "evalrun_67e57965b480819094274e3a32235e4c", + "eval_id": "eval_67e579652b548190aaa83ada4b125f47", + "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47&run_id=evalrun_67e57965b480819094274e3a32235e4c", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + /evals/{eval_id}/runs/{run_id}: + get: + operationId: getEvalRun + tags: + - Evals + summary: | + Get an evaluation run by ID. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to retrieve. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: The evaluation run + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRun' + x-oaiMeta: + name: Get an eval run + group: evals + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.evals.runs.retrieve( + run_id="run_id", + eval_id="eval_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const run = await openai.evals.runs.retrieve( + "evalrun_67abd54d60ec8190832b46859da808f7", + { eval_id: "eval_67abd54d9b0081909a86353f6fb9317a" } + ); + console.log(run); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.evals.runs.retrieve('run_id', { eval_id: + 'eval_id' }); + + + console.log(run.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunRetrieveParams; + import com.openai.models.evals.runs.RunRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunRetrieveParams params = RunRetrieveParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + RunRetrieveResponse run = client.evals().runs().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.evals.runs.retrieve("run_id", eval_id: "eval_id") + + puts(run) + response: | + { + "object": "eval.run", + "id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "report_url": "https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + post: + operationId: cancelEvalRun + tags: + - Evals + summary: | + Cancel an ongoing evaluation run. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation whose run you want to cancel. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to cancel. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: The canceled eval run object + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRun' + x-oaiMeta: + name: Cancel eval run + group: evals + path: post + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7/cancel + \ + -X POST \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.evals.runs.cancel( + run_id="run_id", + eval_id="eval_id", + ) + print(response.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const canceledRun = await openai.evals.runs.cancel( + "evalrun_67abd54d60ec8190832b46859da808f7", + { eval_id: "eval_67abd54d9b0081909a86353f6fb9317a" } + ); + console.log(canceledRun); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const response = await client.evals.runs.cancel('run_id', { + eval_id: 'eval_id' }); + + + console.log(response.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunCancelParams; + import com.openai.models.evals.runs.RunCancelResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCancelParams params = RunCancelParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + RunCancelResponse response = client.evals().runs().cancel(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.evals.runs.cancel("run_id", eval_id: "eval_id") + + puts(response) + response: | + { + "object": "eval.run", + "id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "report_url": "https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7", + "status": "canceled", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + delete: + operationId: deleteEvalRun + tags: + - Evals + summary: | + Delete an eval run. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to delete the run from. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to delete. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + 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 + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Delete eval run + group: evals + path: delete + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_123abc/runs/evalrun_abc456 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.evals.runs.delete( + run_id="run_id", + eval_id="eval_id", + ) + print(run.run_id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const deleted = await openai.evals.runs.delete( + "eval_123abc", + "evalrun_abc456" + ); + console.log(deleted); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const run = await client.evals.runs.delete('run_id', { eval_id: + 'eval_id' }); + + + console.log(run.run_id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunDeleteParams; + import com.openai.models.evals.runs.RunDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunDeleteParams params = RunDeleteParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + RunDeleteResponse run = client.evals().runs().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.evals.runs.delete("run_id", eval_id: "eval_id") + + puts(run) + response: | + { + "object": "eval.run.deleted", + "deleted": true, + "run_id": "evalrun_abc456" + } + /evals/{eval_id}/runs/{run_id}/output_items: + get: + operationId: getEvalRunOutputItems + tags: + - Evals + summary: | + Get a list of output items for an evaluation run. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to retrieve output items for. + - name: after + in: query + description: >- + Identifier for the last output item from the previous pagination + request. + required: false + schema: + type: string + - name: limit + in: query + description: >- + Number of output items to retrieve. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: status + in: query + description: > + Filter output items by status. Use `failed` to filter by failed + output + + items or `pass` to filter by passed output items. + required: false + schema: + type: string + enum: + - fail + - pass + - name: order + in: query + description: >- + Sort order for output items by timestamp. Use `asc` for ascending + order or `desc` for descending order. Defaults to `asc`. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: A list of output items for the evaluation run + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRunOutputItemList' + x-oaiMeta: + name: Get eval run output items + group: evals + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/egroup_67abd54d9b0081909a86353f6fb9317a/runs/erun_67abd54d60ec8190832b46859da808f7/output_items + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.evals.runs.output_items.list( + run_id="run_id", + eval_id="eval_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const outputItems = await openai.evals.runs.outputItems.list( + "egroup_67abd54d9b0081909a86353f6fb9317a", + "erun_67abd54d60ec8190832b46859da808f7" + ); + console.log(outputItems); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const outputItemListResponse of + client.evals.runs.outputItems.list('run_id', { + eval_id: 'eval_id', + })) { + console.log(outputItemListResponse.id); + } + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.evals.runs.outputitems.OutputItemListPage; + + import + com.openai.models.evals.runs.outputitems.OutputItemListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OutputItemListParams params = OutputItemListParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + OutputItemListPage page = client.evals().runs().outputItems().list(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + page = openai.evals.runs.output_items.list("run_id", eval_id: + "eval_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "eval.run.output_item", + "id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "created_at": 1743092076, + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "status": "pass", + "datasource_item_id": 5, + "datasource_item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + }, + "results": [ + { + "name": "String check-a2486074-d803-4445-b431-ad2262e85d47", + "sample": null, + "passed": true, + "score": 1.0 + } + ], + "sample": { + "input": [ + { + "role": "developer", + "content": "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", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + }, + { + "role": "user", + "content": "Stock Markets Rally After Positive Economic Data Released", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "output": [ + { + "role": "assistant", + "content": "Markets", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "finish_reason": "stop", + "model": "gpt-4o-mini-2024-07-18", + "usage": { + "total_tokens": 325, + "completion_tokens": 2, + "prompt_tokens": 323, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } + ], + "first_id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "last_id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "has_more": true + } + /evals/{eval_id}/runs/{run_id}/output_items/{output_item_id}: + get: + operationId: getEvalRunOutputItem + tags: + - Evals + summary: | + Get an evaluation run output item by ID. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to retrieve. + - name: output_item_id + in: path + required: true + schema: + type: string + description: The ID of the output item to retrieve. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: The evaluation run output item + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRunOutputItem' + x-oaiMeta: + name: Get an output item of an eval run + group: evals + path: get + examples: + request: + curl: > + curl + https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7/output_items/outputitem_67abd55eb6548190bb580745d5644a33 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + output_item = client.evals.runs.output_items.retrieve( + output_item_id="output_item_id", + eval_id="eval_id", + run_id="run_id", + ) + print(output_item.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const outputItem = await openai.evals.runs.outputItems.retrieve( + "outputitem_67abd55eb6548190bb580745d5644a33", + { + eval_id: "eval_67abd54d9b0081909a86353f6fb9317a", + run_id: "evalrun_67abd54d60ec8190832b46859da808f7", + } + ); + console.log(outputItem); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const outputItem = await + client.evals.runs.outputItems.retrieve('output_item_id', { + eval_id: 'eval_id', + run_id: 'run_id', + }); + + + console.log(outputItem.id); + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.evals.runs.outputitems.OutputItemRetrieveParams; + + import + com.openai.models.evals.runs.outputitems.OutputItemRetrieveResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OutputItemRetrieveParams params = OutputItemRetrieveParams.builder() + .evalId("eval_id") + .runId("run_id") + .outputItemId("output_item_id") + .build(); + OutputItemRetrieveResponse outputItem = client.evals().runs().outputItems().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + output_item = + openai.evals.runs.output_items.retrieve("output_item_id", eval_id: + "eval_id", run_id: "run_id") + + + puts(output_item) + response: | + { + "object": "eval.run.output_item", + "id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "created_at": 1743092076, + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "status": "pass", + "datasource_item_id": 5, + "datasource_item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + }, + "results": [ + { + "name": "String check-a2486074-d803-4445-b431-ad2262e85d47", + "sample": null, + "passed": true, + "score": 1.0 + } + ], + "sample": { + "input": [ + { + "role": "developer", + "content": "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", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + }, + { + "role": "user", + "content": "Stock Markets Rally After Positive Economic Data Released", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "output": [ + { + "role": "assistant", + "content": "Markets", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "finish_reason": "stop", + "model": "gpt-4o-mini-2024-07-18", + "usage": { + "total_tokens": 325, + "completion_tokens": 2, + "prompt_tokens": 323, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } +components: + schemas: + EvalList: + type: object + title: EvalList + description: | + An object representing a list of evals. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval objects. + 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: | + { + "object": "list", + "data": [ + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": {}, + } + ], + "first_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "last_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "has_more": true + } + 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. + title: CustomDataSourceConfig + 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: | + { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + } + 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) + metadata: + type: object + description: Metadata filters for the logs data source. + additionalProperties: true + example: | + { + "use_case": "customer_support_agent" + } + required: + - item_schema + - type + x-oaiMeta: + name: The eval file data source config object + group: evals + example: | + { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + }, + "include_sample_schema": true + } + deprecated: true + 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 + Eval: + type: object + title: Eval + description: | + An Eval object with a data source config and testing criteria. + An Eval represents a task to be done for your LLM integration. + Like: + - Improve the quality of my chatbot + - See how well my chatbot handles customer support + - Check if o4-mini is better at my usecase than gpt-4o + 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. + title: CustomDataSourceConfig + 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. + + Learn how to build JSON schemas + [here](https://json-schema.org/). + additionalProperties: true + example: | + { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + } + }, + "required": ["item"] + } + metadata: + $ref: '#/components/schemas/Metadata' + required: + - type + - schema + x-oaiMeta: + name: The eval custom data source config object + group: evals + example: | + { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + } + }, + "required": ["item"] + } + } + deprecated: true + testing_criteria: + default: eval + 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: | + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + }, + "include_sample_schema": true + }, + "testing_criteria": [ + { + "name": "My string check grader", + "type": "string_check", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq", + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": { + "test": "synthetics", + } + } + Metadata: + 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. + + + Keys are strings with a maximum length of 64 characters. Values are + strings + + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + Error: + type: object + properties: + code: + type: string + message: + type: string + param: + type: string + type: + type: string + required: + - type + - message + - param + - code + EvalRunList: + type: object + title: EvalRunList + description: | + An object representing a list of runs for an evaluation. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval run objects. + 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: | + { + "object": "list", + "data": [ + { + "object": "eval.run", + "id": "evalrun_67b7fbdad46c819092f6fe7a14189620", + "eval_id": "eval_67b7fa9a81a88190ab4aa417e397ea21", + "report_url": "https://platform.openai.com/evaluations/eval_67b7fa9a81a88190ab4aa417e397ea21?run_id=evalrun_67b7fbdad46c819092f6fe7a14189620", + "status": "completed", + "model": "o3-mini", + "name": "Academic Assistant", + "created_at": 1740110812, + "result_counts": { + "total": 171, + "errored": 0, + "failed": 80, + "passed": 91 + }, + "per_model_usage": null, + "per_testing_criteria_results": [ + { + "testing_criteria": "String check grader", + "passed": 91, + "failed": 80 + } + ], + "run_data_source": { + "type": "completions", + "template_messages": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "You are a helpful assistant." + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Hello, can you help me with my homework?" + } + } + ], + "datasource_reference": null, + "model": "o3-mini", + "max_completion_tokens": null, + "seed": null, + "temperature": null, + "top_p": null + }, + "error": null, + "metadata": {"test": "synthetics"} + } + ], + "first_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "last_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "has_more": false + } + 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. + title: JsonlRunDataSource + 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. + 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. + id: + type: string + description: The identifier of the file. + required: + - type + - content + - id + 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. + 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' + item_reference: + type: string + description: >- + A reference to a variable in the `item` namespace. Ie, + "item.input_trajectory" + required: + - type + - template + - 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. + + + Setting 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](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables the older + JSON mode, which + + ensures the message the model generates is valid JSON. Using + `json_schema` + + is preferred for models that support it. + 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. + items: + $ref: '#/components/schemas/ChatCompletionTool' + model: + type: string + description: >- + The name of the model to use for generating completions (e.g. + "o3-mini"). + required: + - type + - source + x-oaiMeta: + name: The file data source object for the eval run configuration + group: evals + example: | + { + "type": "jsonl", + "source": { + "type": "file_id", + "id": "file-9GYS6xbkWgWhmE7VoLUWFg" + } + } + required: + - data_source + EvalRun: + type: object + title: EvalRun + description: | + A schema representing an evaluation run. + 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 + description: The model that is evaluated, if applicable. + name: + type: string + 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 + 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. + title: JsonlRunDataSource + 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. + 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. + id: + type: string + description: The identifier of the file. + required: + - type + - content + - id + 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. + 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' + item_reference: + type: string + description: >- + A reference to a variable in the `item` namespace. Ie, + "item.input_trajectory" + required: + - type + - template + - 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. + + + Setting 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](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables the older + JSON mode, which + + ensures the message the model generates is valid JSON. Using + `json_schema` + + is preferred for models that support it. + 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. + items: + $ref: '#/components/schemas/ChatCompletionTool' + model: + type: string + description: >- + The name of the model to use for generating completions (e.g. + "o3-mini"). + required: + - type + - source + x-oaiMeta: + name: The file data source object for the eval run configuration + group: evals + example: | + { + "type": "jsonl", + "source": { + "type": "file_id", + "id": "file-9GYS6xbkWgWhmE7VoLUWFg" + } + } + metadata: + $ref: '#/components/schemas/Metadata' + error: + $ref: '#/components/schemas/EvalApiError' + 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: | + { + "object": "eval.run", + "id": "evalrun_67e57965b480819094274e3a32235e4c", + "eval_id": "eval_67e579652b548190aaa83ada4b125f47", + "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47?run_id=evalrun_67e57965b480819094274e3a32235e4c", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + EvalRunOutputItemList: + type: object + title: EvalRunOutputItemList + description: | + An object representing a list of output items for an evaluation run. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval run output item objects. + 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: | + { + "object": "list", + "data": [ + { + "object": "eval.run.output_item", + "id": "outputitem_67abd55eb6548190bb580745d5644a33", + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "created_at": 1739314509, + "status": "pass", + "datasource_item_id": 137, + "datasource_item": { + "teacher": "To grade essays, I only check for style, content, and grammar.", + "student": "I am a student who is trying to write the best essay." + }, + "results": [ + { + "name": "String Check Grader", + "type": "string-check-grader", + "score": 1.0, + "passed": true, + } + ], + "sample": { + "input": [ + { + "role": "system", + "content": "You are an evaluator bot..." + }, + { + "role": "user", + "content": "You are assessing..." + } + ], + "output": [ + { + "role": "assistant", + "content": "The rubric is not clear nor concise." + } + ], + "finish_reason": "stop", + "model": "gpt-4o-2024-08-06", + "usage": { + "total_tokens": 521, + "completion_tokens": 2, + "prompt_tokens": 519, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + }, + ], + "first_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "last_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "has_more": false + } + EvalRunOutputItem: + type: object + title: EvalRunOutputItem + description: | + A schema representing an evaluation run output item. + 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: + $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. + 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: | + { + "object": "eval.run.output_item", + "id": "outputitem_67abd55eb6548190bb580745d5644a33", + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "created_at": 1739314509, + "status": "pass", + "datasource_item_id": 137, + "datasource_item": { + "teacher": "To grade essays, I only check for style, content, and grammar.", + "student": "I am a student who is trying to write the best essay." + }, + "results": [ + { + "name": "String Check Grader", + "type": "string-check-grader", + "score": 1.0, + "passed": true, + } + ], + "sample": { + "input": [ + { + "role": "system", + "content": "You are an evaluator bot..." + }, + { + "role": "user", + "content": "You are assessing..." + } + ], + "output": [ + { + "role": "assistant", + "content": "The rubric is not clear nor concise." + } + ], + "finish_reason": "stop", + "model": "gpt-4o-2024-08-06", + "usage": { + "total_tokens": 521, + "completion_tokens": 2, + "prompt_tokens": 519, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } + CreateEvalCustomDataSourceConfig: + type: object + title: CustomDataSourceConfig + description: > + A CustomDataSourceConfig object that defines the schema for the data + source used for the evaluation runs. + + This schema is used to define the shape of the data that will be: + + - Used to define your testing criteria and + + - What data is required when creating a run + 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: | + { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + } + 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: + - item_schema + - type + x-oaiMeta: + name: The eval file data source config object + group: evals + example: | + { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + }, + "include_sample_schema": true + } + CreateEvalLogsDataSourceConfig: + type: object + title: LogsDataSourceConfig + description: > + A data source config which specifies the metadata property of your logs + query. + + This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, + etc. + 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: | + { + "use_case": "customer_support_agent" + } + required: + - type + x-oaiMeta: + name: The logs data source object for evals + group: evals + example: | + { + "type": "logs", + "metadata": { + "use_case": "customer_support_agent" + } + } + CreateEvalStoredCompletionsDataSourceConfig: + type: object + title: StoredCompletionsDataSourceConfig + description: | + Deprecated in favor of LogsDataSourceConfig. + 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: | + { + "use_case": "customer_support_agent" + } + required: + - type + deprecated: true + x-oaiMeta: + name: The stored completions data source object for evals + group: evals + example: | + { + "type": "stored_completions", + "metadata": { + "use_case": "customer_support_agent" + } + } + CreateEvalLabelModelGrader: + type: object + title: LabelModelGrader + description: > + A LabelModelGrader object which uses a model to assign labels to each + item + + in the evaluation. + 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' + 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: | + { + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "role": "system", + "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" + }, + { + "role": "user", + "content": "Statement: {{item.response}}" + } + ], + "passing_labels": ["positive"], + "labels": ["positive", "neutral", "negative"], + "name": "Sentiment label grader" + } + EvalGraderStringCheck: + type: object + title: StringCheckGrader + description: > + A StringCheckGrader object that performs a string comparison between + input and reference using a specified operation. + 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: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + EvalGraderTextSimilarity: + type: object + title: TextSimilarityGrader + description: > + A TextSimilarityGrader object which grades text based on similarity + metrics. + 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`, + + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, + `rouge_5`, + + or `rouge_l`. + pass_threshold: + type: number + description: The threshold for the score. + required: + - type + - name + - input + - reference + - evaluation_metric + - pass_threshold + x-oaiMeta: + name: Text Similarity Grader + group: graders + example: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "evaluation_metric": "fuzzy_match" + } + EvalGraderPython: + type: object + title: PythonGrader + description: | + A PythonGrader object that runs a python script on the input. + 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. + pass_threshold: + type: number + description: The threshold for the score. + required: + - type + - name + - source + x-oaiMeta: + name: Python Grader + group: graders + example: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + } + EvalGraderScoreModel: + type: object + title: ScoreModelGrader + description: > + A ScoreModelGrader object that uses a model to assign a score to the + input. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: > + An alternative to temperature for nucleus sampling; 1.0 + includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: > + The maximum number of tokens the grader model may generate + in its response. + - 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. + range: + type: array + items: + type: number + min_items: 2 + max_items: 2 + description: The range of the score. Defaults to `[0, 1]`. + pass_threshold: + type: number + description: The threshold for the score. + required: + - type + - name + - input + - model + x-oaiMeta: + name: Score Model Grader + group: graders + example: | + { + "type": "score_model", + "name": "Example score model grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "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}}" + ) + }, + { + "type": "input_image", + "image_url": "https://example.com/reference.png", + "file_id": null, + "detail": "auto" + } + ], + } + ], + "model": "gpt-5-mini", + "sampling_params": { + "temperature": 1, + "top_p": 1, + "seed": 42, + "max_completions_tokens": 32768, + "reasoning_effort": "medium" + }, + } + EvalCustomDataSourceConfig: + type: object + title: CustomDataSourceConfig + description: > + A CustomDataSourceConfig which specifies the schema of your `item` and + optionally `sample` namespaces. + + The response schema defines the shape of the data that will be: + + - Used to define your testing criteria and + + - What data is required when creating a run + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + 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: | + { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + } + }, + "required": ["item"] + } + } + EvalLogsDataSourceConfig: + type: object + title: LogsDataSourceConfig + description: > + A LogsDataSourceConfig which specifies the metadata property of your + logs query. + + This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, + etc. + + The schema returned by this data source config is used to defined what + variables are available in your evals. + + `item` and `sample` are both defined when using this data source config. + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + required: + - type + - schema + x-oaiMeta: + name: The logs data source object for evals + group: evals + example: | + { + "type": "logs", + "metadata": { + "language": "english" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + } + } + EvalStoredCompletionsDataSourceConfig: + type: object + title: StoredCompletionsDataSourceConfig + description: | + Deprecated in favor of LogsDataSourceConfig. + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + required: + - type + - schema + deprecated: true + x-oaiMeta: + name: The stored completions data source object for evals + group: evals + example: | + { + "type": "stored_completions", + "metadata": { + "language": "english" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + } + } + EvalGraderLabelModel: + type: object + title: LabelModelGrader + description: > + A LabelModelGrader object which uses a model to assign labels to each + item + + in the evaluation. + 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: | + { + "name": "First label grader", + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.response}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + CreateEvalJsonlRunDataSource: + type: object + title: JsonlRunDataSource + description: > + A JsonlRunDataSource object with that specifies a JSONL file that + matches the eval + 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. + 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. + id: + type: string + description: The identifier of the file. + required: + - type + - content + - id + required: + - type + - source + x-oaiMeta: + name: The file data source object for the eval run configuration + group: evals + example: | + { + "type": "jsonl", + "source": { + "type": "file_id", + "id": "file-9GYS6xbkWgWhmE7VoLUWFg" + } + } + CreateEvalCompletionsRunDataSource: + type: object + title: CompletionsRunDataSource + description: > + A CompletionsRunDataSource object describing a model sampling + configuration. + 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. + 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' + item_reference: + type: string + description: >- + A reference to a variable in the `item` namespace. Ie, + "item.input_trajectory" + required: + - type + - template + - 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. + + + Setting 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](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables the older JSON + mode, which + + ensures the message the model generates is valid JSON. Using + `json_schema` + + is preferred for models that support it. + 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. + items: + $ref: '#/components/schemas/ChatCompletionTool' + 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. + 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. + id: + type: string + description: The identifier of the file. + metadata: + $ref: '#/components/schemas/Metadata' + model: + type: string + description: An optional model to filter by (e.g., 'gpt-4o'). + created_after: + type: integer + description: >- + An optional Unix timestamp to filter items created after this + time. + created_before: + type: integer + description: >- + An optional Unix timestamp to filter items created before this + time. + limit: + type: integer + description: An optional maximum number of items to return. + required: + - type + - content + - id + x-oaiMeta: + name: >- + The stored completions data source object used to configure an + individual run + group: eval runs + example: | + { + "type": "stored_completions", + "model": "gpt-4o", + "created_after": 1668124800, + "created_before": 1668124900, + "limit": 100, + "metadata": {} + } + required: + - type + - source + x-oaiMeta: + name: The completions data source object used to configure an individual run + group: eval runs + example: | + { + "name": "gpt-4o-mini-2024-07-18", + "data_source": { + "type": "completions", + "input_messages": { + "type": "item_reference", + "item_reference": "item.input" + }, + "model": "gpt-4o-mini-2024-07-18", + "source": { + "type": "stored_completions", + "model": "gpt-4o-mini-2024-07-18" + } + } + } + CreateEvalResponsesRunDataSource: + type: object + title: ResponsesRunDataSource + description: > + A ResponsesRunDataSource object describing a model sampling + configuration. + 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. + 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' + item_reference: + type: string + description: >- + A reference to a variable in the `item` namespace. Ie, + "item.name" + required: + - type + - template + - 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 + + can specify which tool to use by setting the `tool_choice` + parameter. + + + The two categories of tools you can provide the model are: + + + - **Built-in tools**: Tools that are provided by OpenAI that + extend the + model's capabilities, like [web search](/docs/guides/tools-web-search) + or [file search](/docs/guides/tools-file-search). Learn more about + [built-in tools](/docs/guides/tools). + - **Function calls (custom tools)**: Functions that are defined + by you, + enabling the model to call your own code. Learn more about + [function calling](/docs/guides/function-calling). + items: + $ref: '#/components/schemas/Tool' + text: + type: object + description: > + Configuration options for a text response from the model. Can be + plain + + text or structured JSON data. Learn more: + + - [Text inputs and outputs](/docs/guides/text) + + - [Structured Outputs](/docs/guides/structured-outputs) + properties: + format: + $ref: '#/components/schemas/TextResponseFormatConfiguration' + 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. + 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. + id: + type: string + description: The identifier of the file. + metadata: + type: string + description: >- + Metadata filter for the responses. This is a query parameter + used to select responses. (opaque JSON object) + model: + type: string + description: >- + The name of the model to find responses for. This is a query + parameter used to select responses. + instructions_search: + type: string + description: >- + Optional string to search the 'instructions' field. This is a + query parameter used to select responses. + created_after: + type: integer + minimum: 0 + description: >- + Only include items created after this timestamp (inclusive). + This is a query parameter used to select responses. + created_before: + type: integer + minimum: 0 + description: >- + Only include items created before this timestamp (inclusive). + This is a query parameter used to select responses. + reasoning_effort: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + default: medium + description: > + Constrains effort on reasoning for + + [reasoning + models](https://platform.openai.com/docs/guides/reasoning). + + Currently supported values are `none`, `minimal`, `low`, + `medium`, `high`, and `xhigh`. Reducing + + reasoning effort can result in faster responses and fewer tokens + used + + on reasoning in a response. + + + - `gpt-5.1` defaults to `none`, which does not perform + reasoning. The supported reasoning values for `gpt-5.1` are + `none`, `low`, `medium`, and `high`. Tool calls are supported + for all reasoning values in gpt-5.1. + + - All models before `gpt-5.1` default to `medium` reasoning + effort, and do not support `none`. + + - The `gpt-5-pro` model defaults to (and only supports) `high` + reasoning effort. + + - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + temperature: + type: number + description: >- + Sampling temperature. This is a query parameter used to select + responses. + top_p: + type: number + description: >- + Nucleus sampling parameter. This is a query parameter used to + select responses. + users: + type: array + items: + type: string + description: >- + List of user identifiers. This is a query parameter used to + select responses. + tools: + type: array + items: + type: string + description: >- + List of tool names. This is a query parameter used to select + responses. + required: + - type + - content + - id + x-oaiMeta: + name: The run data source object used to configure an individual run + group: eval runs + example: | + { + "type": "responses", + "model": "gpt-4o-mini-2024-07-18", + "temperature": 0.7, + "top_p": 1.0, + "users": ["user1", "user2"], + "tools": ["tool1", "tool2"], + "instructions_search": "You are a coding assistant" + } + required: + - type + - source + x-oaiMeta: + name: The completions data source object used to configure an individual run + group: eval runs + example: | + { + "name": "gpt-4o-mini-2024-07-18", + "data_source": { + "type": "responses", + "input_messages": { + "type": "item_reference", + "item_reference": "item.input" + }, + "model": "gpt-4o-mini-2024-07-18", + "source": { + "type": "responses", + "model": "gpt-4o-mini-2024-07-18" + } + } + } + EvalApiError: + type: object + title: EvalApiError + description: | + An object representing an error response from the Eval API. + 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: | + { + "code": "internal_error", + "message": "The eval run failed due to an internal error." + } + EvalRunOutputItemResult: + type: object + title: EvalRunOutputItemResult + description: | + A single grader result for an evaluation run output item. + 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: + description: Optional sample or intermediate data produced by the grader. + type: object + additionalProperties: true + additionalProperties: true + required: + - name + - score + - passed + 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 + x-oaiMeta: + name: The chat message object used to configure an individual run + properties: + role: + type: string + description: The role of the message (e.g. "system", "assistant", "user"). + content: + type: string + description: The content of the message. + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + required: + - role + - content + GraderStringCheck: + type: object + title: StringCheckGrader + description: > + A StringCheckGrader object that performs a string comparison between + input and reference using a specified operation. + 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: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + GraderTextSimilarity: + type: object + title: TextSimilarityGrader + description: > + A TextSimilarityGrader object which grades text based on similarity + metrics. + 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`, + + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, + `rouge_5`, + + or `rouge_l`. + required: + - type + - name + - input + - reference + - evaluation_metric + x-oaiMeta: + name: Text Similarity Grader + group: graders + example: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "evaluation_metric": "fuzzy_match" + } + GraderPython: + type: object + title: PythonGrader + description: | + A PythonGrader object that runs a python script on the input. + 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: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + } + GraderScoreModel: + type: object + title: ScoreModelGrader + description: > + A ScoreModelGrader object that uses a model to assign a score to the + input. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: > + An alternative to temperature for nucleus sampling; 1.0 + includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: > + The maximum number of tokens the grader model may generate + in its response. + - 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. + 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: | + { + "type": "score_model", + "name": "Example score model grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "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}}" + ) + }, + { + "type": "input_image", + "image_url": "https://example.com/reference.png", + "file_id": null, + "detail": "auto" + } + ], + } + ], + "model": "gpt-5-mini", + "sampling_params": { + "temperature": 1, + "top_p": 1, + "seed": 42, + "max_completions_tokens": 32768, + "reasoning_effort": "medium" + }, + } + GraderLabelModel: + type: object + title: LabelModelGrader + description: > + A LabelModelGrader object which uses a model to assign labels to each + item + + in the evaluation. + 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: | + { + "name": "First label grader", + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.response}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + 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 + EasyInputMessage: + type: object + title: Input message + description: > + A message input to the model with a role indicating instruction + following + + hierarchy. Instructions given with the `developer` or `system` role take + + precedence over instructions given with the `user` role. Messages with + the + + `assistant` role are presumed to have been generated by the model in + previous + + interactions. + properties: + role: + type: string + description: > + The role of the message input. One of `user`, `assistant`, `system`, + or + + `developer`. + enum: + - user + - assistant + - system + - developer + content: + description: > + Text, image, or audio input to the model, used to generate a + response. + + Can also contain previous assistant responses. + type: string + title: Text input + items: + $ref: '#/components/schemas/InputContent' + phase: + type: string + 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. + enum: + - commentary + - final_answer + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + required: + - role + - content + EvalItem: + type: object + title: Eval message object + description: > + A message input to the model with a role indicating instruction + following + + hierarchy. Instructions given with the `developer` or `system` role take + + precedence over instructions given with the `user` role. Messages with + the + + `assistant` role are presumed to have been generated by the model in + previous + + interactions. + properties: + role: + type: string + description: > + The role of the message input. One of `user`, `assistant`, `system`, + or + + `developer`. + enum: + - user + - assistant + - system + - developer + content: + $ref: '#/components/schemas/EvalItemContent' + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + required: + - role + - content + ReasoningEffort: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + default: medium + description: > + Constrains effort on reasoning for + + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + + Currently supported values are `none`, `minimal`, `low`, `medium`, + `high`, and `xhigh`. Reducing + + reasoning effort can result in faster responses and fewer tokens used + + on reasoning in a response. + + + - `gpt-5.1` defaults to `none`, which does not perform reasoning. The + supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, + and `high`. Tool calls are supported for all reasoning values in + gpt-5.1. + + - All models before `gpt-5.1` default to `medium` reasoning effort, and + do not support `none`. + + - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning + effort. + + - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + ResponseFormatText: + type: object + title: Text + description: | + Default response format. Used to generate text responses. + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + required: + - type + ResponseFormatJsonSchema: + type: object + title: JSON schema + description: | + JSON Schema response format. Used to generate structured JSON responses. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). + properties: + type: + type: string + description: The type of response format being defined. Always `json_schema`. + enum: + - json_schema + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: > + A description of what the response format is for, used by the + model to + + determine how to respond in the format. + name: + type: string + description: > + The name of the response format. Must be a-z, A-Z, 0-9, or + contain + + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: > + Whether to enable strict schema adherence when generating + the output. + + If set to true, the model will always follow the exact + schema defined + + in the `schema` field. Only a subset of JSON Schema is + supported when + + `strict` is `true`. To learn more, read the [Structured + Outputs + + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + ResponseFormatJsonObject: + type: object + title: JSON object + description: > + JSON object response format. An older method of generating JSON + responses. + + Using `json_schema` is recommended for models that support it. Note that + the + + model will not generate JSON without a system or user message + instructing it + + to do so. + properties: + type: + type: string + description: The type of response format being defined. Always `json_object`. + enum: + - json_object + x-stainless-const: true + required: + - type + ChatCompletionTool: + type: object + title: Function tool + description: | + A function tool that can be used to generate a response. + 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 + EvalStoredCompletionsSource: + type: object + title: StoredCompletionsRunDataSource + description: > + A StoredCompletionsRunDataSource configuration describing a set of + filters + 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: + type: string + description: An optional model to filter by (e.g., 'gpt-4o'). + created_after: + type: integer + description: An optional Unix timestamp to filter items created after this time. + created_before: + type: integer + description: An optional Unix timestamp to filter items created before this time. + limit: + type: integer + description: An optional maximum number of items to return. + required: + - type + x-oaiMeta: + name: >- + The stored completions data source object used to configure an + individual run + group: eval runs + example: | + { + "type": "stored_completions", + "model": "gpt-4o", + "created_after": 1668124800, + "created_before": 1668124900, + "limit": 100, + "metadata": {} + } + Tool: + description: | + A tool that can be used to generate a response. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - function + description: The type of the function tool. Always `function`. + default: function + x-stainless-const: true + name: + type: string + description: The name of the function to call. + description: + type: string + description: >- + A description of the function. Used by the model to determine + whether or not to call the function. + parameters: + additionalProperties: {} + type: object + description: A JSON schema object describing the parameters of the function. + x-oaiTypeLabel: map + strict: + type: boolean + description: Whether to enforce strict parameter validation. Default `true`. + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + 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: + 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. + 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`. + + - `eq`: equals + + - `ne`: not equal + + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: >- + The value to compare against the attribute key; supports string, + number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: >- + Array of filters to combine. Items can be `ComparisonFilter` or + `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + 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. + user_location: + $ref: '#/components/schemas/WebSearchApproximateLocation' + search_context_size: + 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. + server_label: + type: string + description: | + A label for this MCP server, used to identify it in tool calls. + server_url: + type: string + format: uri + description: > + The URL for the MCP server. One of `server_url` or `connector_id` + must be + + provided. + 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 + + `server_url` or `connector_id` must be provided. Learn more about + service + + connectors [here](/docs/guides/tools-remote-mcp#connectors). + + + Currently supported `connector_id` values are: + + + - Dropbox: `connector_dropbox` + + - Gmail: `connector_gmail` + + - Google Calendar: `connector_googlecalendar` + + - Google Drive: `connector_googledrive` + + - Microsoft Teams: `connector_microsoftteams` + + - Outlook Calendar: `connector_outlookcalendar` + + - Outlook Email: `connector_outlookemail` + + - SharePoint: `connector_sharepoint` + authorization: + type: string + description: > + An OAuth access token that can be used with a remote MCP server, + either + + with a custom MCP server URL or a service connector. Your + application + + must handle the OAuth authorization flow and provide the token here. + server_description: + type: string + description: > + Optional description of the MCP server, used to provide more + context. + headers: + type: object + additionalProperties: + type: string + description: > + Optional HTTP headers to send to the MCP server. Use for + authentication + + or other purposes. + allowed_tools: + description: | + List of allowed tool names or a filter object. + oneOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/MCPToolFilter' + type: 'null' + require_approval: + 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 + `always`, `never`, or a filter object associated with tools + that require approval. + 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 + + `never`. When set to `always`, all tools will require approval. + When + + set to `never`, all tools will not require approval. + enum: + - always + - never + default: always + type: 'null' + container: + description: > + The code interpreter container. Can be a container ID or an object + that + + specifies uploaded file IDs to make available to your code, along + with an + + optional `memory_limit` setting. + type: string + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + required: + - type + title: CodeInterpreterToolAuto + model: + type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-1.5 + description: | + The image generation model to use. Default: `gpt-image-1`. + default: gpt-image-1 + quality: + type: string + enum: + - low + - medium + - high + - auto + description: | + The quality of the generated image. One of `low`, `medium`, `high`, + or `auto`. Default: `auto`. + default: auto + size: + description: >- + The size of the generated images. For `gpt-image-2` and + `gpt-image-2-2026-04-21`, 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 + type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + output_format: + type: string + enum: + - png + - webp + - jpeg + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer + minimum: 0 + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: + type: string + enum: + - transparent + - opaque + - auto + description: | + Background type for the generated image. One of `transparent`, + `opaque`, or `auto`. Default: `auto`. + default: auto + input_fidelity: + 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`. + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + 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. + default: 0 + action: + description: > + Whether to generate a new image or edit an existing image. Default: + `auto`. + $ref: '#/components/schemas/ImageGenActionEnum' + format: + description: The input format for the custom tool. Default is unconstrained text. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + 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. + type: object + required: + - type + - syntax + - definition + title: Text format + 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 + type: array + minItems: 1 + description: The function/custom tools available inside this namespace. + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search is executed by the server or by the client. + search_content_types: + items: + $ref: '#/components/schemas/SearchContentType' + type: array + type: object + required: + - type + - name + - strict + - parameters + - vector_store_ids + - environment + - display_width + - display_height + - server_label + - container + - description + - tools + title: Function + TextResponseFormatConfiguration: + description: > + An object specifying the format that the model must output. + + + Configuring `{ "type": "json_schema" }` enables Structured Outputs, + + which ensures the model will match your supplied JSON schema. Learn more + in the + + [Structured Outputs guide](/docs/guides/structured-outputs). + + + The default format is `{ "type": "text" }` with no additional options. + + + **Not recommended for gpt-4o and newer models:** + + + Setting to `{ "type": "json_object" }` enables the older JSON mode, + which + + ensures the message the model generates is valid JSON. Using + `json_schema` + + is preferred for models that support it. + type: object + title: Text + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + description: + type: string + description: > + A description of what the response format is for, used by the model + to + + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + type: boolean + default: false + description: > + Whether to enable strict schema adherence when generating the + output. + + If set to true, the model will always follow the exact schema + defined + + in the `schema` field. Only a subset of JSON Schema is supported + when + + `strict` is `true`. To learn more, read the [Structured Outputs + + guide](/docs/guides/structured-outputs). + required: + - type + - schema + - name + EvalResponsesSource: + type: object + title: EvalResponsesSource + description: | + A EvalResponsesSource object describing a run data source configuration. + properties: + type: + type: string + enum: + - responses + description: The type of run data source. Always `responses`. + metadata: + type: string + description: >- + Metadata filter for the responses. This is a query parameter used to + select responses. (opaque JSON object) + model: + type: string + description: >- + The name of the model to find responses for. This is a query + parameter used to select responses. + instructions_search: + type: string + description: >- + Optional string to search the 'instructions' field. This is a query + parameter used to select responses. + created_after: + type: integer + minimum: 0 + description: >- + Only include items created after this timestamp (inclusive). This is + a query parameter used to select responses. + created_before: + type: integer + minimum: 0 + description: >- + Only include items created before this timestamp (inclusive). This + is a query parameter used to select responses. + reasoning_effort: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + default: medium + description: > + Constrains effort on reasoning for + + [reasoning + models](https://platform.openai.com/docs/guides/reasoning). + + Currently supported values are `none`, `minimal`, `low`, `medium`, + `high`, and `xhigh`. Reducing + + reasoning effort can result in faster responses and fewer tokens + used + + on reasoning in a response. + + + - `gpt-5.1` defaults to `none`, which does not perform reasoning. + The supported reasoning values for `gpt-5.1` are `none`, `low`, + `medium`, and `high`. Tool calls are supported for all reasoning + values in gpt-5.1. + + - All models before `gpt-5.1` default to `medium` reasoning effort, + and do not support `none`. + + - The `gpt-5-pro` model defaults to (and only supports) `high` + reasoning effort. + + - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + temperature: + type: number + description: >- + Sampling temperature. This is a query parameter used to select + responses. + top_p: + type: number + description: >- + Nucleus sampling parameter. This is a query parameter used to select + responses. + users: + type: array + items: + type: string + description: >- + List of user identifiers. This is a query parameter used to select + responses. + tools: + type: array + items: + type: string + description: >- + List of tool names. This is a query parameter used to select + responses. + required: + - type + x-oaiMeta: + name: The run data source object used to configure an individual run + group: eval runs + example: | + { + "type": "responses", + "model": "gpt-4o-mini-2024-07-18", + "temperature": 0.7, + "top_p": 1.0, + "users": ["user1", "user2"], + "tools": ["tool1", "tool2"], + "instructions_search": "You are a coding assistant" + } + InputMessageContentList: + type: array + title: Input item content list + description: > + A list of one or many input items to the model, containing different + content + + types. + items: + $ref: '#/components/schemas/InputContent' + MessagePhase: + type: string + 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. + enum: + - commentary + - final_answer + 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. + type: string + 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. + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: > + The format of the audio data. Currently supported formats are + `mp3` and + + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - text + - image_url + - input_audio + items: + $ref: '#/components/schemas/EvalItemContentItem' + ResponseFormatJsonSchemaSchema: + type: object + title: JSON schema + description: | + The schema for the response format, described as a JSON Schema object. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + 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: + 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](/docs/guides/function-calling). + required: + - name + FunctionTool: + properties: + type: + type: string + enum: + - function + description: The type of the function tool. Always `function`. + default: function + x-stainless-const: true + name: + type: string + description: The name of the function to call. + description: + type: string + description: >- + A description of the function. Used by the model to determine + whether or not to call the function. + parameters: + additionalProperties: {} + type: object + description: A JSON schema object describing the parameters of the function. + x-oaiTypeLabel: map + strict: + type: boolean + description: Whether to enforce strict parameter validation. Default `true`. + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + 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://platform.openai.com/docs/guides/function-calling). + FileSearchTool: + properties: + type: + type: string + enum: + - file_search + description: The type of the file search tool. Always `file_search`. + default: file_search + x-stainless-const: true + 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: + 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. + 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`. + + - `eq`: equals + + - `ne`: not equal + + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: >- + The value to compare against the attribute key; supports string, + number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: >- + Array of filters to combine. Items can be `ComparisonFilter` or + `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + 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://platform.openai.com/docs/guides/tools-file-search). + ComputerTool: + properties: + type: + type: string + enum: + - computer + description: The type of the computer tool. Always `computer`. + default: computer + x-stainless-const: true + type: object + required: + - type + title: Computer + description: >- + A tool that controls a virtual computer. Learn more about the [computer + tool](https://platform.openai.com/docs/guides/tools-computer-use). + ComputerUsePreviewTool: + properties: + type: + type: string + enum: + - computer_use_preview + description: The type of the computer use tool. Always `computer_use_preview`. + default: computer_use_preview + x-stainless-const: true + 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: + - 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://platform.openai.com/docs/guides/tools-computer-use). + WebSearchTool: + type: object + title: Web search + description: > + Search the Internet for sources related to the prompt. Learn more about + the + + [web search tool](/docs/guides/tools-web-search). + properties: + type: + 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 + filters: + type: object + description: | + Filters for the search. + 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. + + Subdomains of the provided domains are allowed as well. + + + Example: `["pubmed.ncbi.nlm.nih.gov"]` + items: + type: string + description: Allowed domain for the search. + default: [] + - type: 'null' + user_location: + $ref: '#/components/schemas/WebSearchApproximateLocation' + search_context_size: + 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. + required: + - type + MCPTool: + type: object + title: MCP tool + description: > + Give the model access to additional tools via remote Model Context + Protocol + + (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). + 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. + server_url: + type: string + format: uri + description: > + The URL for the MCP server. One of `server_url` or `connector_id` + must be + + provided. + 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 + + `server_url` or `connector_id` must be provided. Learn more about + service + + connectors [here](/docs/guides/tools-remote-mcp#connectors). + + + Currently supported `connector_id` values are: + + + - Dropbox: `connector_dropbox` + + - Gmail: `connector_gmail` + + - Google Calendar: `connector_googlecalendar` + + - Google Drive: `connector_googledrive` + + - Microsoft Teams: `connector_microsoftteams` + + - Outlook Calendar: `connector_outlookcalendar` + + - Outlook Email: `connector_outlookemail` + + - SharePoint: `connector_sharepoint` + authorization: + type: string + description: > + An OAuth access token that can be used with a remote MCP server, + either + + with a custom MCP server URL or a service connector. Your + application + + must handle the OAuth authorization flow and provide the token here. + server_description: + type: string + description: > + Optional description of the MCP server, used to provide more + context. + headers: + type: object + additionalProperties: + type: string + description: > + Optional HTTP headers to send to the MCP server. Use for + authentication + + or other purposes. + allowed_tools: + description: | + List of allowed tool names or a filter object. + oneOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/MCPToolFilter' + type: 'null' + require_approval: + 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 + `always`, `never`, or a filter object associated with tools + that require approval. + 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 + + `never`. When set to `always`, all tools will require approval. + When + + set to `never`, all tools will not require approval. + enum: + - always + - never + default: always + type: 'null' + defer_loading: + type: boolean + description: | + Whether this MCP tool is deferred and discovered via tool search. + required: + - type + - server_label + CodeInterpreterTool: + type: object + title: Code interpreter + description: | + A tool that runs Python code to help generate a response to a prompt. + properties: + type: + type: string + enum: + - code_interpreter + description: | + The type of the code interpreter tool. Always `code_interpreter`. + x-stainless-const: true + container: + description: > + The code interpreter container. Can be a container ID or an object + that + + specifies uploaded file IDs to make available to your code, along + with an + + optional `memory_limit` setting. + type: string + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + required: + - type + title: CodeInterpreterToolAuto + required: + - type + - container + ImageGenTool: + type: object + title: Image generation tool + description: | + A tool that generates images using the GPT image models. + properties: + type: + type: string + enum: + - image_generation + description: | + The type of the image generation tool. Always `image_generation`. + x-stainless-const: true + model: + type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-1.5 + description: | + The image generation model to use. Default: `gpt-image-1`. + default: gpt-image-1 + quality: + type: string + enum: + - low + - medium + - high + - auto + description: | + The quality of the generated image. One of `low`, `medium`, `high`, + or `auto`. Default: `auto`. + default: auto + size: + description: >- + The size of the generated images. For `gpt-image-2` and + `gpt-image-2-2026-04-21`, 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 + type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + output_format: + type: string + enum: + - png + - webp + - jpeg + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer + minimum: 0 + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: + type: string + enum: + - transparent + - opaque + - auto + description: | + Background type for the generated image. One of `transparent`, + `opaque`, or `auto`. Default: `auto`. + default: auto + input_fidelity: + 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`. + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + 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. + default: 0 + action: + description: > + Whether to generate a new image or edit an existing image. Default: + `auto`. + $ref: '#/components/schemas/ImageGenActionEnum' + required: + - type + LocalShellToolParam: + properties: + type: + type: string + enum: + - local_shell + description: The type of the local shell tool. Always `local_shell`. + default: local_shell + x-stainless-const: true + type: object + required: + - type + title: Local shell tool + description: >- + A tool that allows the model to execute shell commands in a local + environment. + FunctionShellToolParam: + properties: + type: + type: string + enum: + - shell + description: The type of the shell tool. Always `shell`. + default: shell + x-stainless-const: true + environment: + oneOf: + - $ref: '#/components/schemas/ContainerAutoParam' + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + discriminator: + propertyName: type + type: 'null' + type: object + required: + - type + title: Shell tool + description: A tool that allows the model to execute shell commands. + CustomToolParam: + properties: + type: + type: string + enum: + - custom + description: The type of the custom tool. Always `custom`. + default: custom + x-stainless-const: true + 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. + format: + description: The input format for the custom tool. Default is unconstrained text. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + 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. + type: object + required: + - type + - syntax + - definition + title: Text format + defer_loading: + type: boolean + description: Whether this tool should be deferred and discovered via tool search. + type: object + required: + - type + - name + title: Custom tool + description: >- + A custom tool that processes input using a specified format. Learn more + about [custom tools](/docs/guides/function-calling#custom-tools) + NamespaceToolParam: + 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 + minLength: 1 + description: A description of the namespace shown to the model. + 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 + 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: + type: string + description: >- + Description shown to the model for a client-executed tool search + tool. + parameters: + properties: {} + type: object + required: [] + type: object + required: + - type + title: Tool search tool + description: Hosted or BYOT tool search configuration for deferred tools. + WebSearchPreviewTool: + properties: + type: + type: string + enum: + - web_search_preview + - web_search_preview_2025_03_11 + 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 + user_location: + properties: + type: + type: string + enum: + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate + x-stainless-const: true + country: + type: string + description: >- + The two-letter [ISO country + code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, + e.g. `US`. + region: + type: string + description: Free text input for the region of the user, e.g. `California`. + city: + type: string + description: Free text input for the city of the user, e.g. `San Francisco`. + timezone: + type: string + description: >- + The [IANA + timezone](https://timeapi.io/documentation/iana-timezones) of + the user, e.g. `America/Los_Angeles`. + type: object + required: + - type + 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://platform.openai.com/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 + type: object + required: + - type + title: Apply patch tool + description: >- + Allows the assistant to create, delete, or update files using unified + diffs. + TextResponseFormatJsonSchema: + type: object + title: JSON schema + description: | + JSON Schema response format. Used to generate structured JSON responses. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). + properties: + type: + type: string + description: The type of response format being defined. Always `json_schema`. + enum: + - json_schema + x-stainless-const: true + description: + type: string + description: > + A description of what the response format is for, used by the model + to + + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + type: boolean + default: false + description: > + Whether to enable strict schema adherence when generating the + output. + + If set to true, the model will always follow the exact schema + defined + + in the `schema` field. Only a subset of JSON Schema is supported + when + + `strict` is `true`. To learn more, read the [Structured Outputs + + guide](/docs/guides/structured-outputs). + required: + - type + - schema + - name + InputContent: + discriminator: + propertyName: type + 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. + image_url: + 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. + file_id: + type: string + description: The ID of the file to be sent to the model. + 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`. + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + file_url: + type: string + format: uri + description: The URL of the file to be sent to the model. + type: object + required: + - type + - text + - detail + title: Input text + description: A text input to the model. + EvalItemContentItem: + title: Eval content item + description: > + A single content item: input text, output text, input image, or input + audio. + type: string + 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. + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: > + The format of the audio data. Currently supported formats are + `mp3` and + + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - text + - image_url + - input_audio + 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 + + image, or input audio object. + items: + $ref: '#/components/schemas/EvalItemContentItem' + FunctionParameters: + type: object + description: >- + The parameters the functions accepts, described as a JSON Schema object. + See the [guide](/docs/guides/function-calling) for examples, and the + [JSON Schema + reference](https://json-schema.org/understanding-json-schema/) for + documentation about the format. + + + Omitting `parameters` defines a function with an empty parameter list. + additionalProperties: true + RankingOptions: + properties: + 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: + 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. + 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`. + + - `eq`: equals + + - `ne`: not equal + + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: >- + The value to compare against the attribute key; supports string, + number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: >- + Array of filters to combine. Items can be `ComparisonFilter` or + `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + ComputerEnvironment: + type: string + enum: + - windows + - mac + - linux + - ubuntu + - browser + WebSearchApproximateLocation: + type: object + title: Web search approximate location + description: | + The approximate location of the user. + 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' + MCPToolFilter: + type: object + title: MCP tool filter + description: | + A filter object to specify which tools are allowed. + 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 + + MCP server is [annotated with + `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), + + it will match this filter. + required: [] + additionalProperties: false + AutoCodeInterpreterToolParam: + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + 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. + 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`. + ImageGenActionEnum: + type: string + enum: + - generate + - edit + - auto + ContainerAutoParam: + properties: + type: + type: string + enum: + - container_auto + description: Automatically creates a container for this request + default: container_auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + 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. + type: object + required: + - type + LocalEnvironmentParam: + properties: + type: + type: string + enum: + - local + 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. + type: object + required: + - type + ContainerReferenceParam: + properties: + type: + type: string + enum: + - container_reference + description: References a container created with the /v1/containers endpoint + default: container_reference + x-stainless-const: true + container_id: + type: string + description: The ID of the referenced container. + example: cntr_123 + type: object + required: + - type + - container_id + CustomTextFormatParam: + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + x-stainless-const: true + type: object + required: + - type + title: Text format + description: Unconstrained free-form text. + CustomGrammarFormatParam: + properties: + type: + type: string + enum: + - grammar + description: Grammar format. Always `grammar`. + default: grammar + 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. + type: object + required: + - type + - syntax + - definition + title: Grammar format + description: A grammar defined by the user. + FunctionToolParam: + properties: + name: + type: string + maxLength: 128 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: + type: string + parameters: + properties: {} + type: object + required: [] + strict: + type: boolean + type: + type: string + enum: + - function + default: function + x-stainless-const: true + defer_loading: + type: boolean + description: >- + Whether this function should be deferred and discovered via tool + search. + type: object + required: + - name + - type + ToolSearchExecutionType: + type: string + enum: + - server + - client + EmptyModelParam: + properties: {} + type: object + required: [] + ApproximateLocation: + properties: + type: + type: string + enum: + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate + x-stainless-const: true + country: + type: string + description: >- + The two-letter [ISO country + code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. + `US`. + region: + type: string + description: Free text input for the region of the user, e.g. `California`. + city: + type: string + description: Free text input for the city of the user, e.g. `San Francisco`. + timezone: + type: string + description: >- + The [IANA timezone](https://timeapi.io/documentation/iana-timezones) + of the user, e.g. `America/Los_Angeles`. + type: object + required: + - type + SearchContextSize: + type: string + enum: + - low + - medium + - high + SearchContentType: + type: string + enum: + - text + - image + 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. + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + 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 + image_url: + 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. + file_id: + type: string + description: The ID of the file to be sent to the model. + 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`. + type: object + required: + - type + - detail + title: Input image + description: >- + An image input to the model. Learn about [image + inputs](/docs/guides/vision). + 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: + type: string + description: The ID of the file to be sent to the model. + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + 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 `low` for + the default rendering behavior, or `high` to render the file at + higher quality. Defaults to `low`. + type: object + required: + - type + title: Input file + description: A file input to the model. + EvalItemContentText: + type: string + title: Text input + description: | + A text input to the model. + EvalItemContentOutputText: + type: object + title: Output text + description: | + A text output from the model. + properties: + type: + type: string + description: | + The type of the output text. Always `output_text`. + enum: + - output_text + x-stainless-const: true + text: + type: string + description: | + The text output from the model. + required: + - type + - text + 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`. + enum: + - input_image + x-stainless-const: true + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + required: + - type + - image_url + InputAudio: + type: object + title: Input audio + description: | + An audio input to the model. + properties: + type: + type: string + description: | + The type of the input item. Always `input_audio`. + enum: + - input_audio + x-stainless-const: true + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: > + The format of the audio data. Currently supported formats are + `mp3` and + + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - input_audio + 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. + type: object + required: + - embedding_weight + - text_weight + 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. + 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`. + + - `eq`: equals + + - `ne`: not equal + + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: >- + The value to compare against the attribute key; supports string, + number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + required: + - type + - key + - value + x-oaiMeta: + name: ComparisonFilter + 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: '#' + discriminator: + propertyName: type + required: + - type + - filters + x-oaiMeta: + name: CompoundFilter + ContainerMemoryLimit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + ContainerNetworkPolicyDisabledParam: + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + x-stainless-const: true + type: object + required: + - type + 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 + 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 + skill_id: + type: string + maxLength: 64 + minLength: 1 + description: The ID of the referenced skill. + version: + type: string + description: >- + Optional skill version. Use a positive integer or 'latest'. Omit for + default. + type: object + required: + - type + - skill_id + InlineSkillParam: + properties: + type: + type: string + enum: + - inline + description: Defines an inline skill for this request. + default: inline + x-stainless-const: true + name: + type: string + description: The name of the skill. + 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 + LocalSkillParam: + properties: + name: + type: string + description: The name of the skill. + description: + type: string + description: The description of the skill. + path: + type: string + description: The path to the directory containing the skill. + type: object + required: + - name + - description + - path + GrammarSyntax1: + type: string + enum: + - lark + - regex + ImageDetail: + type: string + enum: + - low + - high + - auto + - original + FileInputDetail: + type: string + enum: + - low + - high + 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 + InlineSkillSourceParam: + 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. + type: object + required: + - type + - media_type + - data + description: Inline skill payload + x-stackQL-resources: + evals: + id: openai.evals.evals + name: evals + title: Evals + methods: + list: + operation: + $ref: '#/paths/~1evals/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1evals/post' + response: + mediaType: application/json + openAPIDocKey: '201' + get: + operation: + $ref: '#/paths/~1evals~1{eval_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + update: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1evals~1{eval_id}/post' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: '#/paths/~1evals~1{eval_id}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/evals/methods/get' + - $ref: '#/components/x-stackQL-resources/evals/methods/list' + insert: + - $ref: '#/components/x-stackQL-resources/evals/methods/create' + update: + - $ref: '#/components/x-stackQL-resources/evals/methods/update' + delete: + - $ref: '#/components/x-stackQL-resources/evals/methods/delete' + replace: [] + runs: + id: openai.evals.runs + name: runs + title: Runs + methods: + list: + operation: + $ref: '#/paths/~1evals~1{eval_id}~1runs/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1evals~1{eval_id}~1runs/post' + response: + mediaType: application/json + openAPIDocKey: '201' + get: + operation: + $ref: '#/paths/~1evals~1{eval_id}~1runs~1{run_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + cancel: + operation: + $ref: '#/paths/~1evals~1{eval_id}~1runs~1{run_id}/post' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: '#/paths/~1evals~1{eval_id}~1runs~1{run_id}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/runs/methods/get' + - $ref: '#/components/x-stackQL-resources/runs/methods/list' + insert: + - $ref: '#/components/x-stackQL-resources/runs/methods/create' + update: [] + delete: + - $ref: '#/components/x-stackQL-resources/runs/methods/delete' + replace: [] + run_output_items: + id: openai.evals.run_output_items + name: run_output_items + title: Run Output Items + methods: + list: + operation: + $ref: '#/paths/~1evals~1{eval_id}~1runs~1{run_id}~1output_items/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + get: + operation: + $ref: >- + #/paths/~1evals~1{eval_id}~1runs~1{run_id}~1output_items~1{output_item_id}/get + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/run_output_items/methods/get' + - $ref: '#/components/x-stackQL-resources/run_output_items/methods/list' + insert: [] + update: [] + delete: [] + replace: [] +servers: + - url: https://api.openai.com/v1 +x-stackQL-config: + pagination: + requestToken: + key: after + location: query + responseToken: + key: $.last_id + location: body + queryParamPushdown: + top: + paramName: limit + maxValue: 100 diff --git a/provider-dev/openapi/src/openai/v00.00.00000/services/files.yaml b/provider-dev/openapi/src/openai/v00.00.00000/services/files.yaml new file mode 100644 index 0000000..ad57ba7 --- /dev/null +++ b/provider-dev/openapi/src/openai/v00.00.00000/services/files.yaml @@ -0,0 +1,807 @@ +openapi: 3.1.0 +info: + title: files API + description: openai API + version: 2.3.0 +paths: + /files: + get: + operationId: listFiles + tags: + - Files + summary: Returns a list of files. + parameters: + - in: query + name: purpose + required: false + schema: + type: string + description: Only return files with the given purpose. + - name: limit + in: query + description: >- + A limit on the number of objects to be returned. Limit can range + between 1 and 10,000, and the default is 10,000. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 10000 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFilesResponse' + x-oaiMeta: + name: List files + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.files.list() + page = page.data[0] + print(page) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.files.list(); + + for await (const file of list) { + console.log(file); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fileObject of client.files.list()) { + console.log(fileObject); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Files.List(context.TODO(), openai.FileListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileListPage; + import com.openai.models.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileListPage page = client.files().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.files.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "file", + "bytes": 175, + "created_at": 1613677385, + "expires_at": 1677614202, + "filename": "salesOverview.pdf", + "purpose": "assistants", + }, + { + "id": "file-abc456", + "object": "file", + "bytes": 140, + "created_at": 1613779121, + "expires_at": 1677614202, + "filename": "puppy.jsonl", + "purpose": "fine-tune", + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + post: + operationId: createFile + tags: + - Files + summary: > + Upload a file that can be used across various endpoints. Individual + files + + can be up to 512 MB, and each project can store up to 2.5 TB of files in + + total. There is no organization-wide storage limit. Uploads to this + + endpoint are rate-limited to 1,000 requests per minute per authenticated + + user. + + + - The Assistants API supports files up to 2 million tokens and of + specific + file types. See the [Assistants Tools guide](/docs/assistants/tools) for + details. + - The Fine-tuning API only supports `.jsonl` files. The input also has + certain required formats for fine-tuning + [chat](/docs/api-reference/fine-tuning/chat-input) or + [completions](/docs/api-reference/fine-tuning/completions-input) models. + - The Batch API only supports `.jsonl` files up to 200 MB in size. The + input + also has a specific required + [format](/docs/api-reference/batch/request-input). + - 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_stores/{vector_store_id}/file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch) + instead of attaching them one by one. Vector store attachment has separate + limits from file upload, including 2,000 attached files per minute per + organization. + + Please [contact us](https://help.openai.com/) if you need to increase + these + + storage limits. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateFileRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIFile' + 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. + examples: + request: + curl: | + curl https://api.openai.com/v1/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F purpose="fine-tune" \ + -F file="@mydata.jsonl" + -F expires_after[anchor]="created_at" + -F expires_after[seconds]=2592000 + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file_object = client.files.create( + file=b"Example data", + purpose="assistants", + ) + print(file_object.id) + javascript: |- + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.create({ + file: fs.createReadStream("mydata.jsonl"), + purpose: "fine-tune", + expires_after: { + anchor: "created_at", + seconds: 2592000 + } + }); + + console.log(file); + } + + main(); + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fileObject = await client.files.create({ + file: fs.createReadStream('fine-tune.jsonl'), + purpose: 'assistants', + }); + + console.log(fileObject.id); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfileObject, err := client.Files.New(context.TODO(), openai.FileNewParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tPurpose: openai.FilePurposeAssistants,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fileObject.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileCreateParams; + import com.openai.models.files.FileObject; + import com.openai.models.files.FilePurpose; + import java.io.ByteArrayInputStream; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileCreateParams params = FileCreateParams.builder() + .file(new ByteArrayInputStream("Example data".getBytes())) + .purpose(FilePurpose.ASSISTANTS) + .build(); + FileObject fileObject = client.files().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + file_object = openai.files.create(file: StringIO.new("Example + data"), purpose: :assistants) + + + puts(file_object) + response: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1677614202, + "filename": "mydata.jsonl", + "purpose": "fine-tune", + } + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + /files/{file_id}: + delete: + operationId: deleteFile + tags: + - Files + summary: Delete a file and remove it from all vector stores. + parameters: + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to use for this request. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteFileResponse' + x-oaiMeta: + name: Delete file + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files/file-abc123 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file_deleted = client.files.delete( + "file_id", + ) + print(file_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.delete("file-abc123"); + + console.log(file); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fileDeleted = await client.files.delete('file_id'); + + console.log(fileDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfileDeleted, err := client.Files.Delete(context.TODO(), \"file_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fileDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileDeleteParams; + import com.openai.models.files.FileDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileDeleted fileDeleted = client.files().delete("file_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file_deleted = openai.files.delete("file_id") + + puts(file_deleted) + response: | + { + "id": "file-abc123", + "object": "file", + "deleted": true + } + get: + operationId: retrieveFile + tags: + - Files + summary: Returns information about a specific file. + parameters: + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to use for this request. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIFile' + x-oaiMeta: + name: Retrieve file + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files/file-abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file_object = client.files.retrieve( + "file_id", + ) + print(file_object.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.retrieve("file-abc123"); + + console.log(file); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fileObject = await client.files.retrieve('file_id'); + + console.log(fileObject.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfileObject, err := client.Files.Get(context.TODO(), \"file_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fileObject.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileObject; + import com.openai.models.files.FileRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileObject fileObject = client.files().retrieve("file_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file_object = openai.files.retrieve("file_id") + + puts(file_object) + response: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1677614202, + "filename": "mydata.jsonl", + "purpose": "fine-tune", + } +components: + schemas: + 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 + CreateFileRequest: + type: object + additionalProperties: false + properties: + purpose: + description: | + The intended purpose of the uploaded file. One of: + - `assistants`: Used in the Assistants API + - `batch`: Used in the Batch API + - `fine-tune`: Used for fine-tuning + - `vision`: Images used for vision fine-tuning + - `user_data`: Flexible file type for any purpose + - `evals`: Used for eval data sets + type: string + enum: + - assistants + - batch + - fine-tune + - vision + - user_data + - evals + expires_after: + $ref: '#/components/schemas/FileExpirationAfter' + required: + - purpose + 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 + 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. + 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`. + required: + - id + - object + - bytes + - created_at + - filename + - purpose + - status + x-oaiMeta: + name: The file object + example: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1680202602, + "filename": "salesOverview.pdf", + "purpose": "assistants", + } + type: object + DeleteFileResponse: + type: object + properties: + id: + type: string + object: + type: string + enum: + - file + x-stainless-const: true + deleted: + type: boolean + required: + - id + - object + - deleted + 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 + x-stackQL-resources: + files: + id: openai.files.files + name: files + title: Files + methods: + list: + operation: + $ref: '#/paths/~1files/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + delete: + operation: + $ref: '#/paths/~1files~1{file_id}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + get: + operation: + $ref: '#/paths/~1files~1{file_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/files/methods/get' + - $ref: '#/components/x-stackQL-resources/files/methods/list' + insert: [] + update: [] + delete: + - $ref: '#/components/x-stackQL-resources/files/methods/delete' + replace: [] +servers: + - url: https://api.openai.com/v1 +x-stackQL-config: + pagination: + requestToken: + key: after + location: query + responseToken: + key: $.last_id + location: body + queryParamPushdown: + top: + paramName: limit + maxValue: 100 diff --git a/provider-dev/openapi/src/openai/v00.00.00000/services/fine_tuning.yaml b/provider-dev/openapi/src/openai/v00.00.00000/services/fine_tuning.yaml new file mode 100644 index 0000000..a89e0b1 --- /dev/null +++ b/provider-dev/openapi/src/openai/v00.00.00000/services/fine_tuning.yaml @@ -0,0 +1,4570 @@ +openapi: 3.1.0 +info: + title: fine_tuning API + description: openai API + version: 2.3.0 +paths: + /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions: + get: + operationId: listFineTuningCheckpointPermissions + tags: + - Fine-tuning + summary: > + **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + + + Organization owners can use this endpoint to view all permissions for a + fine-tuned model checkpoint. + parameters: + - in: path + name: fine_tuned_model_checkpoint + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuned model checkpoint to get permissions for. + - name: project_id + in: query + description: The ID of the project to get permissions for. + required: false + schema: + type: string + - name: after + in: query + description: >- + Identifier for the last permission ID from the previous pagination + request. + required: false + schema: + type: string + - name: limit + in: query + description: >- + Number of permissions to retrieve. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 10 + - name: order + in: query + description: The order in which to retrieve permissions. + required: false + schema: + type: string + enum: + - ascending + - descending + default: descending + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: >- + #/components/schemas/ListFineTuningCheckpointPermissionResponse + 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 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const permission = await + client.fineTuning.checkpoints.permissions.retrieve( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + ); + + + console.log(permission.first_id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + permission = client.fine_tuning.checkpoints.permissions.retrieve( + fine_tuned_model_checkpoint="ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(permission.first_id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpermission, err := client.FineTuning.Checkpoints.Permissions.Get(\n\t\tcontext.TODO(),\n\t\t\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n\t\topenai.FineTuningCheckpointPermissionGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", permission.FirstID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.finetuning.checkpoints.permissions.PermissionRetrieveParams; + + import + com.openai.models.finetuning.checkpoints.permissions.PermissionRetrieveResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PermissionRetrieveResponse permission = client.fineTuning().checkpoints().permissions().retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + permission = + openai.fine_tuning.checkpoints.permissions.retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(permission) + response: | + { + "object": "list", + "data": [ + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + }, + { + "object": "checkpoint.permission", + "id": "cp_enQCFmOTGj3syEpYVhBRLTSy", + "created_at": 1721764800, + "project_id": "proj_iqGMw1llN8IrBb6SvvY5A1oF" + }, + ], + "first_id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "cp_enQCFmOTGj3syEpYVhBRLTSy", + "has_more": false + } + post: + operationId: createFineTuningCheckpointPermission + tags: + - Fine-tuning + summary: > + **NOTE:** Calling this endpoint requires an [admin API + key](../admin-api-keys). + + + This enables organization owners to share fine-tuned models with other + projects in their organization. + parameters: + - in: path + name: fine_tuned_model_checkpoint + required: true + schema: + type: string + example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd + description: > + The ID of the fine-tuned model checkpoint to create a permission + for. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateFineTuningCheckpointPermissionRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: >- + #/components/schemas/ListFineTuningCheckpointPermissionResponse + x-oaiMeta: + name: Create 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 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + -d '{"project_ids": ["proj_abGMw1llN8IrBb6SvvY5A1iH"]}' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const permissionCreateResponse of + client.fineTuning.checkpoints.permissions.create( + 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + { project_ids: ['string'] }, + )) { + console.log(permissionCreateResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.checkpoints.permissions.create( + fine_tuned_model_checkpoint="ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd", + project_ids=["string"], + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Checkpoints.Permissions.New(\n\t\tcontext.TODO(),\n\t\t\"ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd\",\n\t\topenai.FineTuningCheckpointPermissionNewParams{\n\t\t\tProjectIDs: []string{\"string\"},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.finetuning.checkpoints.permissions.PermissionCreatePage; + + import + com.openai.models.finetuning.checkpoints.permissions.PermissionCreateParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PermissionCreateParams params = PermissionCreateParams.builder() + .fineTunedModelCheckpoint("ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd") + .addProjectId("string") + .build(); + PermissionCreatePage page = client.fineTuning().checkpoints().permissions().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.fine_tuning.checkpoints.permissions.create( + "ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd", + project_ids: ["string"] + ) + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + } + ], + "first_id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "has_more": false + } + /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}: + delete: + operationId: deleteFineTuningCheckpointPermission + tags: + - Fine-tuning + summary: > + **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + + + Organization owners can use this endpoint to delete a permission for a + fine-tuned model checkpoint. + parameters: + - in: path + name: fine_tuned_model_checkpoint + required: true + schema: + type: string + example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd + description: > + The ID of the fine-tuned model checkpoint to delete a permission + for. + - in: path + name: permission_id + required: true + schema: + type: string + example: cp_zc4Q7MP6XxulcVzj4MZdwsAB + description: | + The ID of the fine-tuned model checkpoint permission to delete. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: >- + #/components/schemas/DeleteFineTuningCheckpointPermissionResponse + x-oaiMeta: + name: Delete checkpoint permission + 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/cp_zc4Q7MP6XxulcVzj4MZdwsAB + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const permission = await + client.fineTuning.checkpoints.permissions.delete( + 'cp_zc4Q7MP6XxulcVzj4MZdwsAB', + { fine_tuned_model_checkpoint: 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd' }, + ); + + + console.log(permission.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + permission = client.fine_tuning.checkpoints.permissions.delete( + permission_id="cp_zc4Q7MP6XxulcVzj4MZdwsAB", + fine_tuned_model_checkpoint="ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd", + ) + print(permission.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpermission, err := client.FineTuning.Checkpoints.Permissions.Delete(\n\t\tcontext.TODO(),\n\t\t\"ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd\",\n\t\t\"cp_zc4Q7MP6XxulcVzj4MZdwsAB\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", permission.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.finetuning.checkpoints.permissions.PermissionDeleteParams; + + import + com.openai.models.finetuning.checkpoints.permissions.PermissionDeleteResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PermissionDeleteParams params = PermissionDeleteParams.builder() + .fineTunedModelCheckpoint("ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd") + .permissionId("cp_zc4Q7MP6XxulcVzj4MZdwsAB") + .build(); + PermissionDeleteResponse permission = client.fineTuning().checkpoints().permissions().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + permission = openai.fine_tuning.checkpoints.permissions.delete( + "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + fine_tuned_model_checkpoint: "ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd" + ) + + puts(permission) + response: | + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "deleted": true + } + /fine_tuning/jobs: + post: + operationId: createFineTuningJob + tags: + - Fine-tuning + summary: > + Creates a fine-tuning job which begins the process of creating a new + model from a given dataset. + + + Response includes details of the enqueued job including job status and + the name of the fine-tuned models once complete. + + + [Learn more about fine-tuning](/docs/guides/model-optimization) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateFineTuningJobRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Create fine-tuning job + group: fine-tuning + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-BK7bzQj3FfZFXr7DbL6xJwfo", + "model": "gpt-4o-mini" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123" + }); + + console.log(fineTune); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = openai.fine_tuning.jobs.create(model: + :"gpt-4o-mini", training_file: "file-abc123") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + } + } + }, + "metadata": null + } + - title: Epochs + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "model": "gpt-4o-mini", + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 2 + } + } + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + javascript: > + import OpenAI from "openai"; + + import { SupervisedMethod, SupervisedHyperparameters } from + "openai/resources/fine-tuning/methods"; + + + const openai = new OpenAI(); + + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123", + model: "gpt-4o-mini", + method: { + type: "supervised", + supervised: { + hyperparameters: { + n_epochs: 2 + } + } + } + }); + + console.log(fineTune); + } + + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = openai.fine_tuning.jobs.create(model: + :"gpt-4o-mini", training_file: "file-abc123") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": 2 + }, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": 2 + } + } + }, + "metadata": null, + "error": { + "code": null, + "message": null, + "param": null + }, + "finished_at": null, + "seed": 683058546, + "trained_tokens": null, + "estimated_finish": null, + "integrations": [], + "user_provided_suffix": null, + "usage_metrics": null, + "shared_with_openai": false + } + - title: DPO + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini", + "method": { + "type": "dpo", + "dpo": { + "hyperparameters": { + "beta": 0.1 + } + } + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = openai.fine_tuning.jobs.create(model: + :"gpt-4o-mini", training_file: "file-abc123") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc", + "model": "gpt-4o-mini", + "created_at": 1746130590, + "fine_tuned_model": null, + "organization_id": "org-abc", + "result_files": [], + "status": "queued", + "validation_file": "file-123", + "training_file": "file-abc", + "method": { + "type": "dpo", + "dpo": { + "hyperparameters": { + "beta": 0.1, + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto" + } + } + }, + "metadata": null, + "error": { + "code": null, + "message": null, + "param": null + }, + "finished_at": null, + "hyperparameters": null, + "seed": 1036326793, + "estimated_finish": null, + "integrations": [], + "user_provided_suffix": null, + "usage_metrics": null, + "shared_with_openai": false + } + - title: Reinforcement + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc", + "validation_file": "file-123", + "model": "o4-mini", + "method": { + "type": "reinforcement", + "reinforcement": { + "grader": { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + }, + "hyperparameters": { + "reasoning_effort": "medium" + } + } + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = openai.fine_tuning.jobs.create(model: + :"gpt-4o-mini", training_file: "file-abc123") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "o4-mini", + "created_at": 1721764800, + "finished_at": null, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "validating_files", + "validation_file": "file-123", + "training_file": "file-abc", + "trained_tokens": null, + "error": {}, + "user_provided_suffix": null, + "seed": 950189191, + "estimated_finish": null, + "integrations": [], + "method": { + "type": "reinforcement", + "reinforcement": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + "eval_interval": "auto", + "eval_samples": "auto", + "compute_multiplier": "auto", + "reasoning_effort": "medium" + }, + "grader": { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + }, + "response_format": null + } + }, + "metadata": null, + "usage_metrics": null, + "shared_with_openai": false + } + + - title: Validation file + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123", + validation_file: "file-abc123" + }); + + console.log(fineTune); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = openai.fine_tuning.jobs.create(model: + :"gpt-4o-mini", training_file: "file-abc123") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123", + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + } + } + }, + "metadata": null + } + - title: W&B Integration + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini", + "integrations": [ + { + "type": "wandb", + "wandb": { + "project": "my-wandb-project", + "name": "ft-run-display-name" + "tags": [ + "first-experiment", "v2" + ] + } + } + ] + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = openai.fine_tuning.jobs.create(model: + :"gpt-4o-mini", training_file: "file-abc123") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123", + "integrations": [ + { + "type": "wandb", + "wandb": { + "project": "my-wandb-project", + "entity": None, + "run_id": "ftjob-abc123" + } + } + ], + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + } + } + }, + "metadata": null + } + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + get: + operationId: listPaginatedFineTuningJobs + tags: + - Fine-tuning + summary: | + List your organization's fine-tuning jobs + parameters: + - name: after + in: query + description: Identifier for the last job from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: >- + Number of fine-tuning jobs to retrieve. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - in: query + name: metadata + required: false + schema: + type: object + nullable: true + 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. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListPaginatedFineTuningJobsResponse' + 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 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.jobs.list() + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.fineTuning.jobs.list(); + + for await (const fineTune of list) { + console.log(fineTune); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fineTuningJob of client.fineTuning.jobs.list()) { + console.log(fineTuningJob.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Jobs.List(context.TODO(), openai.FineTuningJobListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.JobListPage; + import com.openai.models.finetuning.jobs.JobListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobListPage page = client.fineTuning().jobs().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.fine_tuning.jobs.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "metadata": { + "key": "value" + } + }, + { ... }, + { ... } + ], "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}: + get: + operationId: retrieveFineTuningJob + tags: + - Fine-tuning + summary: | + Get info about a fine-tuning job. + + [Learn more about fine-tuning](/docs/guides/model-optimization) + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Retrieve fine-tuning job + group: fine-tuning + examples: + request: + curl: > + curl + https://api.openai.com/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.retrieve( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.retrieve("ftjob-abc123"); + + console.log(fineTune); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const fineTuningJob = await + client.fineTuning.jobs.retrieve('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Get(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = + openai.fine_tuning.jobs.retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "davinci-002", + "created_at": 1692661014, + "finished_at": 1692661190, + "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + "organization_id": "org-123", + "result_files": [ + "file-abc123" + ], + "status": "succeeded", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + }, + "trained_tokens": 5768, + "integrations": [], + "seed": 0, + "estimated_finish": 0, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + } + } + } + } + /fine_tuning/jobs/{fine_tuning_job_id}/cancel: + post: + operationId: cancelFineTuningJob + tags: + - Fine-tuning + summary: | + Immediately cancel a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to cancel. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Cancel fine-tuning + group: fine-tuning + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.cancel( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.cancel("ftjob-abc123"); + + console.log(fineTune); + } + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const fineTuningJob = await + client.fineTuning.jobs.cancel('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Cancel(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().cancel("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = + openai.fine_tuning.jobs.cancel("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "cancelled", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } + /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints: + get: + operationId: listFineTuningJobCheckpoints + tags: + - Fine-tuning + summary: | + List checkpoints for a fine-tuning job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to get checkpoints for. + - name: after + in: query + description: >- + Identifier for the last checkpoint ID from the previous pagination + request. + required: false + schema: + type: string + - name: limit + in: query + description: >- + Number of checkpoints to retrieve. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 10 + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFineTuningJobCheckpointsResponse' + x-oaiMeta: + name: List fine-tuning checkpoints + group: fine-tuning + examples: + request: + curl: > + curl + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/checkpoints + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const fineTuningJobCheckpoint of + client.fineTuning.jobs.checkpoints.list( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + )) { + console.log(fineTuningJobCheckpoint.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.jobs.checkpoints.list( + fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Jobs.Checkpoints.List(\n\t\tcontext.TODO(),\n\t\t\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n\t\topenai.FineTuningJobCheckpointListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.finetuning.jobs.checkpoints.CheckpointListPage; + + import + com.openai.models.finetuning.jobs.checkpoints.CheckpointListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CheckpointListPage page = client.fineTuning().jobs().checkpoints().list("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + page = + openai.fine_tuning.jobs.checkpoints.list("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:96olL566:ckpt-step-2000", + "metrics": { + "full_valid_loss": 0.134, + "full_valid_mean_token_accuracy": 0.874 + }, + "fine_tuning_job_id": "ftjob-abc123", + "step_number": 2000 + }, + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_enQCFmOTGj3syEpYVhBRLTSy", + "created_at": 1721764800, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:7q8mpxmy:ckpt-step-1000", + "metrics": { + "full_valid_loss": 0.167, + "full_valid_mean_token_accuracy": 0.781 + }, + "fine_tuning_job_id": "ftjob-abc123", + "step_number": 1000 + } + ], + "first_id": "ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "ftckpt_enQCFmOTGj3syEpYVhBRLTSy", + "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}/events: + get: + operationId: listFineTuningEvents + tags: + - Fine-tuning + summary: | + Get status updates for a fine-tuning job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to get events for. + - name: after + in: query + description: Identifier for the last event from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: >- + Number of events to retrieve. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFineTuningJobEventsResponse' + x-oaiMeta: + name: List fine-tuning events + group: fine-tuning + examples: + request: + curl: > + curl + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/events \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.jobs.list_events( + fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.fineTuning.list_events(id="ftjob-abc123", limit=2); + + for await (const fineTune of list) { + console.log(fineTune); + } + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const fineTuningJobEvent of + client.fineTuning.jobs.listEvents( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + )) { + console.log(fineTuningJobEvent.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Jobs.ListEvents(\n\t\tcontext.TODO(),\n\t\t\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n\t\topenai.FineTuningJobListEventsParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.JobListEventsPage; + import com.openai.models.finetuning.jobs.JobListEventsParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobListEventsPage page = client.fineTuning().jobs().listEvents("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + page = + openai.fine_tuning.jobs.list_events("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job.event", + "id": "ft-event-ddTJfwuMVpfLXseO0Am0Gqjm", + "created_at": 1721764800, + "level": "info", + "message": "Fine tuning job successfully completed", + "data": null, + "type": "message" + }, + { + "object": "fine_tuning.job.event", + "id": "ft-event-tyiGuB72evQncpH87xe505Sv", + "created_at": 1721764800, + "level": "info", + "message": "New fine-tuned model created: ft:gpt-4o-mini:openai::7p4lURel", + "data": null, + "type": "message" + } + ], + "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}/pause: + post: + operationId: pauseFineTuningJob + tags: + - Fine-tuning + summary: | + Pause a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to pause. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Pause fine-tuning + group: fine-tuning + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/pause \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.pause( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.pause("ftjob-abc123"); + + console.log(fineTune); + } + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const fineTuningJob = await + client.fineTuning.jobs.pause('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Pause(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobPauseParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().pause("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = + openai.fine_tuning.jobs.pause("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "paused", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } + /fine_tuning/jobs/{fine_tuning_job_id}/resume: + post: + operationId: resumeFineTuningJob + tags: + - Fine-tuning + summary: | + Resume a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to resume. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Resume fine-tuning + group: fine-tuning + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/resume \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.resume( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.resume("ftjob-abc123"); + + console.log(fineTune); + } + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const fineTuningJob = await + client.fineTuning.jobs.resume('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Resume(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobResumeParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().resume("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + fine_tuning_job = + openai.fine_tuning.jobs.resume("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } +components: + schemas: + ListFineTuningCheckpointPermissionResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/FineTuningCheckpointPermission' + object: + type: string + enum: + - list + x-stainless-const: true + first_id: + type: string + last_id: + type: string + has_more: + type: boolean + required: + - object + - data + - has_more + CreateFineTuningCheckpointPermissionRequest: + type: object + additionalProperties: false + properties: + project_ids: + type: array + description: The project identifiers to grant access to. + items: + type: string + required: + - project_ids + 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 + CreateFineTuningJobRequest: + type: object + properties: + model: + description: > + The name of the model to fine-tune. You can select one of the + + [supported + models](/docs/guides/fine-tuning#which-models-can-be-fine-tuned). + example: gpt-4o-mini + x-oaiTypeLabel: string + type: string + enum: + - babbage-002 + - davinci-002 + - gpt-3.5-turbo + - gpt-4o-mini + training_file: + description: > + The ID of an uploaded file that contains training data. + + + See [upload file](/docs/api-reference/files/create) for how to + upload a file. + + + Your dataset must be formatted as a JSONL file. Additionally, you + must upload your file with the purpose `fine-tune`. + + + The contents of the file should differ depending on if the model + uses the [chat](/docs/api-reference/fine-tuning/chat-input), + [completions](/docs/api-reference/fine-tuning/completions-input) + format, or if the fine-tuning method uses the + [preference](/docs/api-reference/fine-tuning/preference-input) + format. + + + See the [fine-tuning guide](/docs/guides/model-optimization) for + more details. + type: string + example: file-abc123 + hyperparameters: + type: object + description: > + The hyperparameters used for the fine-tuning job. + + This value is now deprecated in favor of `method`, and should be + passed in under the `method` parameter. + 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. + 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. + 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 + + through the training dataset. + 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. + + + For example, a `suffix` of "custom-model-name" would produce a model + name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. + type: string + minLength: 1 + maxLength: 64 + default: null + nullable: true + validation_file: + description: > + The ID of an uploaded file that contains validation data. + + + If you provide this file, the data is used to generate validation + + metrics periodically during fine-tuning. These metrics can be viewed + in + + the fine-tuning results file. + + The same data should not be present in both train and validation + files. + + + Your dataset must be formatted as a JSONL file. You must upload your + file with the purpose `fine-tune`. + + + See the [fine-tuning guide](/docs/guides/model-optimization) for + more details. + 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. + 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 + + metrics will be sent to. Optionally, you can set an explicit + display name for your run, add tags + + to your run, and set a default entity (team, username, etc) to + be associated with your run. + required: + - project + properties: + project: + description: > + The name of the project that the new run will be created + under. + 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. + 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 + + like associated with the run. If not set, the default + entity for the registered WandB API key is used. + 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 + + default tags are generated by OpenAI: "openai/finetune", + "openai/{base-model}", "openai/{ftjob-abcdef}". + 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. + + If a seed is not specified, one will be generated for you. + type: integer + nullable: true + minimum: 0 + maximum: 2147483647 + example: 42 + method: + $ref: '#/components/schemas/FineTuneMethod' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - model + - training_file + FineTuningJob: + type: object + title: FineTuningJob + description: > + The `fine_tuning.job` object represents a fine-tuning job that has been + created through the API. + 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: + 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 + fine_tuned_model: + 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. + finished_at: + 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. + 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 + + are updated less frequently, but with lower variance. + 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 + + overfitting. + 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 + + through the training dataset. + 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](/docs/api-reference/files/retrieve-contents). + items: + type: string + example: file-abc123 + status: + type: string + description: >- + The current status of the fine-tuning job, which can be either + `validating_files`, `queued`, `running`, `succeeded`, `failed`, or + `cancelled`. + enum: + - validating_files + - queued + - running + - succeeded + - failed + - cancelled + trained_tokens: + 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. + training_file: + type: string + description: >- + The file ID used for training. You can retrieve the training data + with the [Files API](/docs/api-reference/files/retrieve-contents). + validation_file: + type: string + description: >- + The file ID used for validation. You can retrieve the validation + results with the [Files + API](/docs/api-reference/files/retrieve-contents). + integrations: + type: array + description: A list of integrations to enable for this fine-tuning job. + maxItems: 5 + items: + oneOf: + - $ref: '#/components/schemas/FineTuningIntegration' + seed: + type: integer + description: The seed used for the fine-tuning job. + estimated_finish: + 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. + method: + $ref: '#/components/schemas/FineTuneMethod' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - created_at + - error + - finished_at + - fine_tuned_model + - hyperparameters + - id + - model + - object + - organization_id + - result_files + - status + - trained_tokens + - training_file + - validation_file + - seed + x-oaiMeta: + name: The fine-tuning job object + example: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "davinci-002", + "created_at": 1692661014, + "finished_at": 1692661190, + "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + "organization_id": "org-123", + "result_files": [ + "file-abc123" + ], + "status": "succeeded", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + }, + "trained_tokens": 5768, + "integrations": [], + "seed": 0, + "estimated_finish": 0, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + } + } + }, + "metadata": { + "key": "value" + } + } + 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 + ListFineTuningJobCheckpointsResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/FineTuningJobCheckpoint' + object: + type: string + enum: + - list + x-stainless-const: true + first_id: + type: string + last_id: + type: string + 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 + FineTuningCheckpointPermission: + type: object + title: FineTuningCheckpointPermission + description: > + The `checkpoint.permission` object represents a permission for a + fine-tuned model checkpoint. + 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: | + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1712211699, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + } + 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 + Metadata: + 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. + + + Keys are strings with a maximum length of 64 characters. Values are + strings + + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + 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 + + metrics will be sent to. Optionally, you can set an explicit display + name for your run, add tags + + to your run, and set a default entity (team, username, etc) to be + associated with your run. + required: + - project + properties: + project: + description: | + The name of the project that the new run will be created under. + 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. + 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 + + like associated with the run. If not set, the default entity + for the registered WandB API key is used. + 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 + + default tags are generated by OpenAI: "openai/finetune", + "openai/{base-model}", "openai/{ftjob-abcdef}". + type: array + items: + type: string + example: custom-tag + 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. + 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: | + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P", + "created_at": 1712211699, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88", + "fine_tuning_job_id": "ftjob-fpbNQ3H1GrMehXRf8cO97xTN", + "metrics": { + "step": 88, + "train_loss": 0.478, + "train_mean_token_accuracy": 0.924, + "valid_loss": 10.112, + "valid_mean_token_accuracy": 0.145, + "full_valid_loss": 0.567, + "full_valid_mean_token_accuracy": 0.944 + }, + "step_number": 88 + } + 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: string + description: The data associated with the event. (opaque JSON object) + required: + - id + - object + - created_at + - level + - message + x-oaiMeta: + name: The fine-tuning job event object + example: | + { + "object": "fine_tuning.job.event", + "id": "ftevent-abc123" + "created_at": 1677610602, + "level": "info", + "message": "Created fine-tuning job", + "data": {}, + "type": "message" + } + FineTuneSupervisedMethod: + type: object + description: Configuration for the supervised fine-tuning method. + properties: + hyperparameters: + $ref: '#/components/schemas/FineTuneSupervisedHyperparameters' + FineTuneDPOMethod: + type: object + description: Configuration for the DPO fine-tuning method. + properties: + hyperparameters: + $ref: '#/components/schemas/FineTuneDPOHyperparameters' + FineTuneReinforcementMethod: + type: object + description: Configuration for the reinforcement fine-tuning method. + properties: + grader: + type: object + description: The grader used for the fine-tuning job. + title: StringCheckGrader + 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`. + 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`, + + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, + `rouge_5`, + + or `rouge_l`. + 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. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: > + An alternative to temperature for nucleus sampling; 1.0 + includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: > + A higher temperature increases randomness in the + outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: > + The maximum number of tokens the grader model may + generate in its response. + - type: 'null' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + range: + type: array + items: + type: number + min_items: 2 + max_items: 2 + description: The range of the score. Defaults to `[0, 1]`. + graders: + type: object + title: StringCheckGrader + description: > + A StringCheckGrader object that performs a string comparison + between input and reference using a specified operation. + 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`. + 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`, + + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, + `rouge_4`, `rouge_5`, + + or `rouge_l`. + 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. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: > + An alternative to temperature for nucleus sampling; + 1.0 includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: > + A higher temperature increases randomness in the + outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: > + The maximum number of tokens the grader model may + generate in its response. + - type: 'null' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + range: + type: array + items: + type: number + min_items: 2 + max_items: 2 + description: The range of the score. Defaults to `[0, 1]`. + 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 + - name + - input + - reference + - operation + - evaluation_metric + - source + - model + - passing_labels + - labels + x-oaiMeta: + name: String Check Grader + group: graders + example: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + calculate_output: + type: string + description: A formula to calculate the output based on grader results. + required: + - type + - name + - input + - reference + - operation + - evaluation_metric + - source + - model + - graders + - calculate_output + x-oaiMeta: + name: String Check Grader + group: graders + example: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + 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. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + maximum: 256 + learning_rate_multiplier: + description: > + Scaling factor for the learning rate. A smaller learning rate may be + useful to avoid overfitting. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 0 + exclusiveMinimum: true + n_epochs: + description: > + The number of epochs to train the model for. An epoch refers to one + full cycle through the training dataset. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + maximum: 50 + 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. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 0 + maximum: 2 + exclusiveMinimum: true + 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. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + maximum: 256 + learning_rate_multiplier: + description: > + Scaling factor for the learning rate. A smaller learning rate may be + useful to avoid overfitting. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 0 + exclusiveMinimum: true + n_epochs: + description: > + The number of epochs to train the model for. An epoch refers to one + full cycle through the training dataset. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + maximum: 50 + GraderStringCheck: + type: object + title: StringCheckGrader + description: > + A StringCheckGrader object that performs a string comparison between + input and reference using a specified operation. + 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: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + GraderTextSimilarity: + type: object + title: TextSimilarityGrader + description: > + A TextSimilarityGrader object which grades text based on similarity + metrics. + 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`, + + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, + `rouge_5`, + + or `rouge_l`. + required: + - type + - name + - input + - reference + - evaluation_metric + x-oaiMeta: + name: Text Similarity Grader + group: graders + example: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "evaluation_metric": "fuzzy_match" + } + GraderPython: + type: object + title: PythonGrader + description: | + A PythonGrader object that runs a python script on the input. + 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: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + } + GraderScoreModel: + type: object + title: ScoreModelGrader + description: > + A ScoreModelGrader object that uses a model to assign a score to the + input. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: > + An alternative to temperature for nucleus sampling; 1.0 + includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: > + The maximum number of tokens the grader model may generate + in its response. + - 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. + 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: | + { + "type": "score_model", + "name": "Example score model grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "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}}" + ) + }, + { + "type": "input_image", + "image_url": "https://example.com/reference.png", + "file_id": null, + "detail": "auto" + } + ], + } + ], + "model": "gpt-5-mini", + "sampling_params": { + "temperature": 1, + "top_p": 1, + "seed": 42, + "max_completions_tokens": 32768, + "reasoning_effort": "medium" + }, + } + 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 + title: StringCheckGrader + description: > + A StringCheckGrader object that performs a string comparison between + input and reference using a specified operation. + 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`. + 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`, + + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, + `rouge_5`, + + or `rouge_l`. + 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. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: > + An alternative to temperature for nucleus sampling; 1.0 + includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: > + A higher temperature increases randomness in the + outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: > + The maximum number of tokens the grader model may + generate in its response. + - type: 'null' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + range: + type: array + items: + type: number + min_items: 2 + max_items: 2 + description: The range of the score. Defaults to `[0, 1]`. + 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 + - name + - input + - reference + - operation + - evaluation_metric + - source + - model + - passing_labels + - labels + x-oaiMeta: + name: String Check Grader + group: graders + example: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + 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: | + { + "type": "multi", + "name": "example multi grader", + "graders": [ + { + "type": "text_similarity", + "name": "example text similarity grader", + "input": "The graded text", + "reference": "The reference text", + "evaluation_metric": "fuzzy_match" + }, + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + ], + "calculate_output": "0.5 * text_similarity_score + 0.5 * string_check_score)" + } + 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. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + maximum: 256 + learning_rate_multiplier: + description: > + Scaling factor for the learning rate. A smaller learning rate may be + useful to avoid overfitting. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 0 + exclusiveMinimum: true + n_epochs: + description: > + The number of epochs to train the model for. An epoch refers to one + full cycle through the training dataset. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + maximum: 50 + reasoning_effort: + description: | + Level of reasoning effort. + type: string + enum: + - default + - low + - medium + - high + default: default + compute_multiplier: + description: > + Multiplier on amount of compute used for exploring search space + during training. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 0.00001 + maximum: 10 + exclusiveMinimum: true + eval_interval: + description: | + The number of training steps between evaluation runs. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + eval_samples: + description: | + Number of evaluation samples to generate per training step. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + ReasoningEffort: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + default: medium + description: > + Constrains effort on reasoning for + + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + + Currently supported values are `none`, `minimal`, `low`, `medium`, + `high`, and `xhigh`. Reducing + + reasoning effort can result in faster responses and fewer tokens used + + on reasoning in a response. + + + - `gpt-5.1` defaults to `none`, which does not perform reasoning. The + supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, + and `high`. Tool calls are supported for all reasoning values in + gpt-5.1. + + - All models before `gpt-5.1` default to `medium` reasoning effort, and + do not support `none`. + + - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning + effort. + + - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + EvalItem: + type: object + title: Eval message object + description: > + A message input to the model with a role indicating instruction + following + + hierarchy. Instructions given with the `developer` or `system` role take + + precedence over instructions given with the `user` role. Messages with + the + + `assistant` role are presumed to have been generated by the model in + previous + + interactions. + properties: + role: + type: string + description: > + The role of the message input. One of `user`, `assistant`, `system`, + or + + `developer`. + enum: + - user + - assistant + - system + - developer + content: + $ref: '#/components/schemas/EvalItemContent' + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + required: + - role + - content + GraderLabelModel: + type: object + title: LabelModelGrader + description: > + A LabelModelGrader object which uses a model to assign labels to each + item + + in the evaluation. + 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: | + { + "name": "First label grader", + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.response}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + 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. + type: string + 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. + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: > + The format of the audio data. Currently supported formats are + `mp3` and + + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - text + - image_url + - input_audio + items: + $ref: '#/components/schemas/EvalItemContentItem' + EvalItemContentItem: + title: Eval content item + description: > + A single content item: input text, output text, input image, or input + audio. + type: string + 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. + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: > + The format of the audio data. Currently supported formats are + `mp3` and + + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - text + - image_url + - input_audio + 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 + + image, or input audio object. + items: + $ref: '#/components/schemas/EvalItemContentItem' + EvalItemContentText: + type: string + title: Text input + description: | + A text input to the model. + 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. + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + EvalItemContentOutputText: + type: object + title: Output text + description: | + A text output from the model. + properties: + type: + type: string + description: | + The type of the output text. Always `output_text`. + enum: + - output_text + x-stainless-const: true + text: + type: string + description: | + The text output from the model. + required: + - type + - text + 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`. + enum: + - input_image + x-stainless-const: true + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + required: + - type + - image_url + InputAudio: + type: object + title: Input audio + description: | + An audio input to the model. + properties: + type: + type: string + description: | + The type of the input item. Always `input_audio`. + enum: + - input_audio + x-stainless-const: true + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: > + The format of the audio data. Currently supported formats are + `mp3` and + + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - input_audio + x-stackQL-resources: + checkpoint_permissions: + id: openai.fine_tuning.checkpoint_permissions + name: checkpoint_permissions + title: Checkpoint Permissions + methods: + list: + operation: + $ref: >- + #/paths/~1fine_tuning~1checkpoints~1{fine_tuned_model_checkpoint}~1permissions/get + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: >- + #/paths/~1fine_tuning~1checkpoints~1{fine_tuned_model_checkpoint}~1permissions/post + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: >- + #/paths/~1fine_tuning~1checkpoints~1{fine_tuned_model_checkpoint}~1permissions~1{permission_id}/delete + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: >- + #/components/x-stackQL-resources/checkpoint_permissions/methods/list + insert: + - $ref: >- + #/components/x-stackQL-resources/checkpoint_permissions/methods/create + update: [] + delete: + - $ref: >- + #/components/x-stackQL-resources/checkpoint_permissions/methods/delete + replace: [] + jobs: + id: openai.fine_tuning.jobs + name: jobs + title: Jobs + methods: + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1fine_tuning~1jobs/post' + response: + mediaType: application/json + openAPIDocKey: '200' + list: + operation: + $ref: '#/paths/~1fine_tuning~1jobs/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + get: + operation: + $ref: '#/paths/~1fine_tuning~1jobs~1{fine_tuning_job_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + cancel: + operation: + $ref: '#/paths/~1fine_tuning~1jobs~1{fine_tuning_job_id}~1cancel/post' + response: + mediaType: application/json + openAPIDocKey: '200' + pause: + operation: + $ref: '#/paths/~1fine_tuning~1jobs~1{fine_tuning_job_id}~1pause/post' + response: + mediaType: application/json + openAPIDocKey: '200' + resume: + operation: + $ref: '#/paths/~1fine_tuning~1jobs~1{fine_tuning_job_id}~1resume/post' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/jobs/methods/get' + - $ref: '#/components/x-stackQL-resources/jobs/methods/list' + insert: + - $ref: '#/components/x-stackQL-resources/jobs/methods/create' + update: [] + delete: [] + replace: [] + checkpoints: + id: openai.fine_tuning.checkpoints + name: checkpoints + title: Checkpoints + methods: + list: + operation: + $ref: '#/paths/~1fine_tuning~1jobs~1{fine_tuning_job_id}~1checkpoints/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/checkpoints/methods/list' + insert: [] + update: [] + delete: [] + replace: [] + events: + id: openai.fine_tuning.events + name: events + title: Events + methods: + list: + operation: + $ref: '#/paths/~1fine_tuning~1jobs~1{fine_tuning_job_id}~1events/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/events/methods/list' + insert: [] + update: [] + delete: [] + replace: [] +servers: + - url: https://api.openai.com/v1 +x-stackQL-config: + pagination: + requestToken: + key: after + location: query + responseToken: + key: $.last_id + location: body + queryParamPushdown: + top: + paramName: limit + maxValue: 100 diff --git a/provider-dev/openapi/src/openai/v00.00.00000/services/models.yaml b/provider-dev/openapi/src/openai/v00.00.00000/services/models.yaml new file mode 100644 index 0000000..0620203 --- /dev/null +++ b/provider-dev/openapi/src/openai/v00.00.00000/services/models.yaml @@ -0,0 +1,526 @@ +openapi: 3.1.0 +info: + title: models API + description: openai API + version: 2.3.0 +paths: + /models: + get: + operationId: listModels + tags: + - Models + summary: >- + Lists the currently available models, and provides basic information + about each one such as the owner and availability. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListModelsResponse' + x-oaiMeta: + name: List models + group: models + examples: + request: + curl: | + curl https://api.openai.com/v1/models \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.models.list() + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.models.list(); + + for await (const model of list) { + console.log(model); + } + } + main(); + csharp: | + using System; + + using OpenAI.Models; + + OpenAIModelClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + foreach (var model in client.GetModels().Value) + { + Console.WriteLine(model.Id); + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const model of client.models.list()) { + console.log(model.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Models.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.models.ModelListPage; + import com.openai.models.models.ModelListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ModelListPage page = client.models().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.models.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "model-id-0", + "object": "model", + "created": 1686935002, + "owned_by": "organization-owner" + }, + { + "id": "model-id-1", + "object": "model", + "created": 1686935002, + "owned_by": "organization-owner", + }, + { + "id": "model-id-2", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + }, + ] + } + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + /models/{model}: + get: + operationId: retrieveModel + tags: + - Models + summary: >- + Retrieves a model instance, providing basic information about the model + such as the owner and permissioning. + parameters: + - in: path + name: model + required: true + schema: + type: string + example: gpt-4o-mini + description: The ID of the model to use for this request + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Model' + x-oaiMeta: + name: Retrieve model + group: models + examples: + request: + curl: | + curl https://api.openai.com/v1/models/VAR_chat_model_id \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + model = client.models.retrieve( + "gpt-4o-mini", + ) + print(model.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const model = await openai.models.retrieve("VAR_chat_model_id"); + + console.log(model); + } + + main(); + csharp: | + using System; + using System.ClientModel; + + using OpenAI.Models; + + OpenAIModelClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ClientResult model = client.GetModel("babbage-002"); + Console.WriteLine(model.Value.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const model = await client.models.retrieve('gpt-4o-mini'); + + console.log(model.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmodel, err := client.Models.Get(context.TODO(), \"gpt-4o-mini\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", model.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.models.Model; + import com.openai.models.models.ModelRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Model model = client.models().retrieve("gpt-4o-mini"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + model = openai.models.retrieve("gpt-4o-mini") + + puts(model) + response: | + { + "id": "VAR_chat_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + } + delete: + operationId: deleteModel + tags: + - Models + summary: >- + Delete a fine-tuned model. You must have the Owner role in your + organization to delete a model. + parameters: + - in: path + name: model + required: true + schema: + type: string + example: ft:gpt-4o-mini:acemeco:suffix:abc123 + description: The model to delete + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteModelResponse' + 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 + \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + model_deleted = client.models.delete( + "ft:gpt-4o-mini:acemeco:suffix:abc123", + ) + print(model_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const model = await openai.models.delete("ft:gpt-4o-mini:acemeco:suffix:abc123"); + + console.log(model); + } + main(); + csharp: > + using System; + + using System.ClientModel; + + + using OpenAI.Models; + + + OpenAIModelClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + ClientResult success = + client.DeleteModel("ft:gpt-4o-mini:acemeco:suffix:abc123"); + + Console.WriteLine(success); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const modelDeleted = await + client.models.delete('ft:gpt-4o-mini:acemeco:suffix:abc123'); + + + console.log(modelDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmodelDeleted, err := client.Models.Delete(context.TODO(), \"ft:gpt-4o-mini:acemeco:suffix:abc123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", modelDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.models.ModelDeleteParams; + import com.openai.models.models.ModelDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ModelDeleted modelDeleted = client.models().delete("ft:gpt-4o-mini:acemeco:suffix:abc123"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + model_deleted = + openai.models.delete("ft:gpt-4o-mini:acemeco:suffix:abc123") + + + puts(model_deleted) + response: | + { + "id": "ft:gpt-4o-mini:acemeco:suffix:abc123", + "object": "model", + "deleted": true + } +components: + schemas: + ListModelsResponse: + type: object + properties: + object: + type: string + enum: + - list + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/Model' + required: + - object + - data + 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. + required: + - id + - object + - created + - owned_by + x-oaiMeta: + name: The model object + example: | + { + "id": "VAR_chat_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + } + type: object + DeleteModelResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + required: + - id + - object + - deleted + x-stackQL-resources: + models: + id: openai.models.models + name: models + title: Models + methods: + list: + operation: + $ref: '#/paths/~1models/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + get: + operation: + $ref: '#/paths/~1models~1{model}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: '#/paths/~1models~1{model}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/models/methods/get' + - $ref: '#/components/x-stackQL-resources/models/methods/list' + insert: [] + update: [] + delete: + - $ref: '#/components/x-stackQL-resources/models/methods/delete' + replace: [] +servers: + - url: https://api.openai.com/v1 +x-stackQL-config: + pagination: + requestToken: + key: after + location: query + responseToken: + key: $.last_id + location: body + queryParamPushdown: + top: + paramName: limit + maxValue: 100 diff --git a/provider-dev/openapi/src/openai/v00.00.00000/services/skills.yaml b/provider-dev/openapi/src/openai/v00.00.00000/services/skills.yaml new file mode 100644 index 0000000..b2a9326 --- /dev/null +++ b/provider-dev/openapi/src/openai/v00.00.00000/services/skills.yaml @@ -0,0 +1,1238 @@ +openapi: 3.1.0 +info: + title: skills API + description: openai API + version: 2.3.0 +paths: + /skills: + post: + tags: + - Skills + summary: Create a new skill. + operationId: CreateSkill + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + 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/SkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.skills.create(); + + console.log(skill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill = client.skills.create() + print(skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskill, err := client.Skills.New(context.TODO(), openai.SkillNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.Skill; + import com.openai.models.skills.SkillCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Skill skill = client.skills().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill = openai.skills.create + + puts(skill) + get: + tags: + - Skills + summary: List all skills for the current project. + operationId: ListSkills + parameters: + - name: limit + in: query + description: >- + Number of items to retrieve + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + 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/OrderEnum' + - 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 + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillListResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const skill of client.skills.list()) { + console.log(skill.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.skills.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Skills.List(context.TODO(), openai.SkillListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.SkillListPage; + import com.openai.models.skills.SkillListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SkillListPage page = client.skills().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.skills.list + + puts(page) + /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 + schema: + example: skill_123 + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedSkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const deletedSkill = await client.skills.delete('skill_123'); + + console.log(deletedSkill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + deleted_skill = client.skills.delete( + "skill_123", + ) + print(deleted_skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tdeletedSkill, err := client.Skills.Delete(context.TODO(), \"skill_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", deletedSkill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.DeletedSkill; + import com.openai.models.skills.SkillDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + DeletedSkill deletedSkill = client.skills().delete("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + deleted_skill = openai.skills.delete("skill_123") + + puts(deleted_skill) + 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 + schema: + example: skill_123 + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.skills.retrieve('skill_123'); + + console.log(skill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill = client.skills.retrieve( + "skill_123", + ) + print(skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskill, err := client.Skills.Get(context.TODO(), \"skill_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.Skill; + import com.openai.models.skills.SkillRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Skill skill = client.skills().retrieve("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill = openai.skills.retrieve("skill_123") + + puts(skill) + 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 + schema: + example: skill_123 + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SetDefaultSkillVersionBody' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/SetDefaultSkillVersionBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const skill = await client.skills.update('skill_123', { + default_version: 'default_version' }); + + + console.log(skill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill = client.skills.update( + skill_id="skill_123", + default_version="default_version", + ) + print(skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskill, err := client.Skills.Update(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\topenai.SkillUpdateParams{\n\t\t\tDefaultVersion: \"default_version\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.Skill; + import com.openai.models.skills.SkillUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SkillUpdateParams params = SkillUpdateParams.builder() + .skillId("skill_123") + .defaultVersion("default_version") + .build(); + Skill skill = client.skills().update(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + skill = openai.skills.update("skill_123", default_version: + "default_version") + + + puts(skill) + /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 + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateSkillVersionBody' + application/json: + schema: + $ref: '#/components/schemas/CreateSkillVersionBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillVersionResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const skillVersion = await + client.skills.versions.create('skill_123'); + + + console.log(skillVersion.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill_version = client.skills.versions.create( + skill_id="skill_123", + ) + print(skill_version.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskillVersion, err := client.Skills.Versions.New(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\topenai.SkillVersionNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skillVersion.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.SkillVersion; + import com.openai.models.skills.versions.VersionCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SkillVersion skillVersion = client.skills().versions().create("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill_version = openai.skills.versions.create("skill_123") + + puts(skill_version) + get: + tags: + - Skills + summary: 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 + - name: limit + in: query + description: >- + Number of versions to retrieve. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + minimum: 0 + maximum: 100 + - 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 + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillVersionListResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const skillVersion of + client.skills.versions.list('skill_123')) { + console.log(skillVersion.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.skills.versions.list( + skill_id="skill_123", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Skills.Versions.List(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\topenai.SkillVersionListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.VersionListPage; + import com.openai.models.skills.versions.VersionListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VersionListPage page = client.skills().versions().list("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.skills.versions.list("skill_123") + + puts(page) + /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 + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillVersionResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const skillVersion = await + client.skills.versions.retrieve('version', { skill_id: 'skill_123' + }); + + + console.log(skillVersion.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill_version = client.skills.versions.retrieve( + version="version", + skill_id="skill_123", + ) + print(skill_version.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskillVersion, err := client.Skills.Versions.Get(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\t\"version\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skillVersion.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.SkillVersion; + import com.openai.models.skills.versions.VersionRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VersionRetrieveParams params = VersionRetrieveParams.builder() + .skillId("skill_123") + .version("version") + .build(); + SkillVersion skillVersion = client.skills().versions().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + skill_version = openai.skills.versions.retrieve("version", + skill_id: "skill_123") + + + puts(skill_version) + 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 + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedSkillVersionResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const deletedSkillVersion = await + client.skills.versions.delete('version', { + skill_id: 'skill_123', + }); + + + console.log(deletedSkillVersion.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + deleted_skill_version = client.skills.versions.delete( + version="version", + skill_id="skill_123", + ) + print(deleted_skill_version.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tdeletedSkillVersion, err := client.Skills.Versions.Delete(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\t\"version\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", deletedSkillVersion.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.DeletedSkillVersion; + import com.openai.models.skills.versions.VersionDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VersionDeleteParams params = VersionDeleteParams.builder() + .skillId("skill_123") + .version("version") + .build(); + DeletedSkillVersion deletedSkillVersion = client.skills().versions().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + deleted_skill_version = openai.skills.versions.delete("version", + skill_id: "skill_123") + + + puts(deleted_skill_version) +components: + schemas: + CreateSkillBody: + properties: {} + type: object + required: [] + title: Create skill request + description: >- + Uploads a skill either as a directory (multipart `files[]`) or as a + single zip file. + 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 + OrderEnum: + type: string + enum: + - asc + - desc + 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: + type: string + description: The ID of the first item in the list. + last_id: + type: string + description: The ID of the last item in the list. + has_more: + type: boolean + description: Whether there are more items available. + type: object + required: + - object + - data + - first_id + - last_id + - has_more + 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 + 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. + CreateSkillVersionBody: + properties: + default: + type: boolean + description: Whether to set this version as the default. + type: object + required: [] + title: Create skill version request + description: Uploads a new immutable version of a skill. + 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: + type: string + description: The ID of the first item in the list. + last_id: + type: string + description: The ID of the last item in the list. + has_more: + type: boolean + description: Whether there are more items available. + type: object + required: + - object + - data + - first_id + - last_id + - has_more + 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 + x-stackQL-resources: + skills: + id: openai.skills.skills + name: skills + title: Skills + methods: + list: + operation: + $ref: '#/paths/~1skills/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + delete: + operation: + $ref: '#/paths/~1skills~1{skill_id}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + get: + operation: + $ref: '#/paths/~1skills~1{skill_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + update: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1skills~1{skill_id}/post' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/skills/methods/get' + - $ref: '#/components/x-stackQL-resources/skills/methods/list' + insert: [] + update: + - $ref: '#/components/x-stackQL-resources/skills/methods/update' + delete: + - $ref: '#/components/x-stackQL-resources/skills/methods/delete' + replace: [] + versions: + id: openai.skills.versions + name: versions + title: Versions + methods: + list: + operation: + $ref: '#/paths/~1skills~1{skill_id}~1versions/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + get: + operation: + $ref: '#/paths/~1skills~1{skill_id}~1versions~1{version}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: '#/paths/~1skills~1{skill_id}~1versions~1{version}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/versions/methods/get' + - $ref: '#/components/x-stackQL-resources/versions/methods/list' + insert: [] + update: [] + delete: + - $ref: '#/components/x-stackQL-resources/versions/methods/delete' + replace: [] +servers: + - url: https://api.openai.com/v1 +x-stackQL-config: + pagination: + requestToken: + key: after + location: query + responseToken: + key: $.last_id + location: body + queryParamPushdown: + top: + paramName: limit + maxValue: 100 diff --git a/provider-dev/openapi/src/openai/v00.00.00000/services/uploads.yaml b/provider-dev/openapi/src/openai/v00.00.00000/services/uploads.yaml new file mode 100644 index 0000000..6f3b563 --- /dev/null +++ b/provider-dev/openapi/src/openai/v00.00.00000/services/uploads.yaml @@ -0,0 +1,818 @@ +openapi: 3.1.0 +info: + title: uploads API + description: openai API + version: 2.3.0 +paths: + /uploads: + post: + operationId: createUpload + tags: + - Uploads + summary: > + Creates an intermediate [Upload](/docs/api-reference/uploads/object) + object + + that you can add [Parts](/docs/api-reference/uploads/part-object) to. + + Currently, an Upload can accept at most 8 GB in total and expires after + an + + hour after you create it. + + + Once you complete the Upload, we will create a + + [File](/docs/api-reference/files/object) object that contains all the + parts + + you uploaded. This File is usable in the rest of our platform as a + regular + + File object. + + + For certain `purpose` values, the correct `mime_type` must be + specified. + + Please refer to documentation for the + + [supported MIME types for your use + case](/docs/assistants/tools/file-search#supported-files). + + + For guidance on the proper filename extensions for each purpose, please + + follow the documentation on [creating a + + File](/docs/api-reference/files/create). + + + Returns the Upload object with status `pending`. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUploadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Upload' + x-oaiMeta: + name: Create upload + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "purpose": "fine-tune", + "filename": "training_examples.jsonl", + "bytes": 2147483648, + "mime_type": "text/jsonl", + "expires_after": { + "anchor": "created_at", + "seconds": 3600 + } + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const upload = await client.uploads.create({ + bytes: 0, + filename: 'filename', + mime_type: 'mime_type', + purpose: 'assistants', + }); + + console.log(upload.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload = client.uploads.create( + bytes=0, + filename="filename", + mime_type="mime_type", + purpose="assistants", + ) + print(upload.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tupload, err := client.Uploads.New(context.TODO(), openai.UploadNewParams{\n\t\tBytes: 0,\n\t\tFilename: \"filename\",\n\t\tMimeType: \"mime_type\",\n\t\tPurpose: openai.FilePurposeAssistants,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", upload.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FilePurpose; + import com.openai.models.uploads.Upload; + import com.openai.models.uploads.UploadCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UploadCreateParams params = UploadCreateParams.builder() + .bytes(0L) + .filename("filename") + .mimeType("mime_type") + .purpose(FilePurpose.ASSISTANTS) + .build(); + Upload upload = client.uploads().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + upload = openai.uploads.create(bytes: 0, filename: "filename", + mime_type: "mime_type", purpose: :assistants) + + + puts(upload) + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "pending", + "expires_at": 1719127296 + } + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + /uploads/{upload_id}/cancel: + post: + operationId: cancelUpload + tags: + - Uploads + summary: | + Cancels the Upload. No Parts may be added after an Upload is cancelled. + + Returns the Upload object with status `cancelled`. + parameters: + - in: path + name: upload_id + required: true + schema: + type: string + example: upload_abc123 + description: | + The ID of the Upload. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Upload' + x-oaiMeta: + name: Cancel upload + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads/upload_abc123/cancel + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const upload = await client.uploads.cancel('upload_abc123'); + + console.log(upload.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload = client.uploads.cancel( + "upload_abc123", + ) + print(upload.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tupload, err := client.Uploads.Cancel(context.TODO(), \"upload_abc123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", upload.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.uploads.Upload; + import com.openai.models.uploads.UploadCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Upload upload = client.uploads().cancel("upload_abc123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + upload = openai.uploads.cancel("upload_abc123") + + puts(upload) + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "cancelled", + "expires_at": 1719127296 + } + /uploads/{upload_id}/complete: + post: + operationId: completeUpload + tags: + - Uploads + summary: > + Completes the [Upload](/docs/api-reference/uploads/object). + + + Within the returned Upload object, there is a nested + [File](/docs/api-reference/files/object) object that is ready to use in + the rest of the platform. + + + You can specify the order of the Parts by passing in an ordered list of + the Part IDs. + + + The 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. + + Returns the Upload object with status `completed`, including an + additional `file` property containing the created usable File object. + parameters: + - in: path + name: upload_id + required: true + schema: + type: string + example: upload_abc123 + description: | + The ID of the Upload. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CompleteUploadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Upload' + x-oaiMeta: + name: Complete upload + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads/upload_abc123/complete + -d '{ + "part_ids": ["part_def456", "part_ghi789"] + }' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const upload = await client.uploads.complete('upload_abc123', { + part_ids: ['string'] }); + + + console.log(upload.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload = client.uploads.complete( + upload_id="upload_abc123", + part_ids=["string"], + ) + print(upload.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tupload, err := client.Uploads.Complete(\n\t\tcontext.TODO(),\n\t\t\"upload_abc123\",\n\t\topenai.UploadCompleteParams{\n\t\t\tPartIDs: []string{\"string\"},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", upload.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.uploads.Upload; + import com.openai.models.uploads.UploadCompleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UploadCompleteParams params = UploadCompleteParams.builder() + .uploadId("upload_abc123") + .addPartId("string") + .build(); + Upload upload = client.uploads().complete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + upload = openai.uploads.complete("upload_abc123", part_ids: + ["string"]) + + + puts(upload) + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "completed", + "expires_at": 1719127296, + "file": { + "id": "file-xyz321", + "object": "file", + "bytes": 2147483648, + "created_at": 1719186911, + "expires_at": 1719127296, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + } + } +components: + schemas: + CreateUploadRequest: + type: object + additionalProperties: false + properties: + filename: + description: | + The name of the file to upload. + type: string + purpose: + description: | + The intended purpose of the uploaded file. + + See the [documentation on File + purposes](/docs/api-reference/files/create#files-create-purpose). + type: string + enum: + - assistants + - batch + - fine-tune + - vision + bytes: + description: | + The number of bytes in the file you are uploading. + type: integer + mime_type: + description: > + The MIME type of the file. + + + + This must fall within the supported MIME types for your file + purpose. See + + the supported MIME types for assistants and vision. + type: string + expires_after: + $ref: '#/components/schemas/FileExpirationAfter' + required: + - filename + - purpose + - bytes + - mime_type + Upload: + type: object + title: Upload + description: | + The Upload object can accept byte chunks in the form of Parts. + 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: + 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](/docs/api-reference/files/object#files/object-purpose) for + acceptable values. + status: + type: string + description: The status of the Upload. + enum: + - pending + - completed + - cancelled + - expired + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the Upload will expire. + object: + type: string + description: The object type, which is always "upload". + enum: + - upload + x-stainless-const: true + file: + 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 + 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. + 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`. + required: + - id + - object + - bytes + - created_at + - filename + - purpose + - status + x-oaiMeta: + name: The file object + example: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1680202602, + "filename": "salesOverview.pdf", + "purpose": "assistants", + } + type: object + nullable: true + required: + - bytes + - created_at + - expires_at + - filename + - id + - purpose + - status + x-oaiMeta: + name: The upload object + example: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "completed", + "expires_at": 1719127296, + "file": { + "id": "file-xyz321", + "object": "file", + "bytes": 2147483648, + "created_at": 1719186911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + } + } + CompleteUploadRequest: + type: object + additionalProperties: false + properties: + part_ids: + type: array + description: | + The ordered list of Part IDs. + items: + type: string + md5: + description: > + The optional md5 checksum for the file contents to verify if the + bytes uploaded matches what you expect. + type: string + required: + - part_ids + 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 + 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 + 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. + 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`. + required: + - id + - object + - bytes + - created_at + - filename + - purpose + - status + x-oaiMeta: + name: The file object + example: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1680202602, + "filename": "salesOverview.pdf", + "purpose": "assistants", + } + type: object + x-stackQL-resources: + uploads: + id: openai.uploads.uploads + name: uploads + title: Uploads + methods: + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1uploads/post' + response: + mediaType: application/json + openAPIDocKey: '200' + cancel: + operation: + $ref: '#/paths/~1uploads~1{upload_id}~1cancel/post' + response: + mediaType: application/json + openAPIDocKey: '200' + complete: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1uploads~1{upload_id}~1complete/post' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: [] + insert: + - $ref: '#/components/x-stackQL-resources/uploads/methods/create' + update: [] + delete: [] + replace: [] +servers: + - url: https://api.openai.com/v1 +x-stackQL-config: + pagination: + requestToken: + key: after + location: query + responseToken: + key: $.last_id + location: body + queryParamPushdown: + top: + paramName: limit + maxValue: 100 diff --git a/provider-dev/openapi/src/openai/v00.00.00000/services/vector_stores.yaml b/provider-dev/openapi/src/openai/v00.00.00000/services/vector_stores.yaml new file mode 100644 index 0000000..c54e787 --- /dev/null +++ b/provider-dev/openapi/src/openai/v00.00.00000/services/vector_stores.yaml @@ -0,0 +1,3545 @@ +openapi: 3.1.0 +info: + title: vector_stores API + description: openai API + version: 2.3.0 +paths: + /vector_stores: + get: + operationId: listVectorStores + tags: + - Vector stores + summary: Returns a list of vector stores. + parameters: + - name: limit + in: query + description: >- + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListVectorStoresResponse' + x-oaiMeta: + name: List vector stores + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.list() + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStores = await openai.vectorStores.list(); + console.log(vectorStores); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const vectorStore of client.vectorStores.list()) { + console.log(vectorStore.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.List(context.TODO(), openai.VectorStoreListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStoreListPage; + import com.openai.models.vectorstores.VectorStoreListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreListPage page = client.vectorStores().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "description": "Contains commonly asked questions and answers, organized by topic.", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + }, + { + "id": "vs_abc456", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ v2", + "description": null, + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + ], + "first_id": "vs_abc123", + "last_id": "vs_abc456", + "has_more": false + } + post: + operationId: createVectorStore + tags: + - Vector stores + summary: Create a vector store. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVectorStoreRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreObject' + x-oaiMeta: + name: Create vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "name": "Support FAQ" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store = client.vector_stores.create() + print(vector_store.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.vectorStores.create({ + name: "Support FAQ" + }); + console.log(vectorStore); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStore = await client.vectorStores.create(); + + console.log(vectorStore.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.New(context.TODO(), openai.VectorStoreNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStore; + import com.openai.models.vectorstores.VectorStoreCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStore vectorStore = client.vectorStores().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store = openai.vector_stores.create + + puts(vector_store) + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "description": "Contains commonly asked questions and answers, organized by topic.", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + parameters: + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + /vector_stores/{vector_store_id}: + get: + operationId: getVectorStore + tags: + - Vector stores + summary: Retrieves a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to retrieve. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreObject' + x-oaiMeta: + name: Retrieve vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store = client.vector_stores.retrieve( + "vector_store_id", + ) + print(vector_store.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.vectorStores.retrieve( + "vs_abc123" + ); + console.log(vectorStore); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStore = await + client.vectorStores.retrieve('vector_store_id'); + + + console.log(vectorStore.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.Get(context.TODO(), \"vector_store_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStore; + import com.openai.models.vectorstores.VectorStoreRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStore vectorStore = client.vectorStores().retrieve("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store = openai.vector_stores.retrieve("vector_store_id") + + puts(vector_store) + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776 + } + post: + operationId: modifyVectorStore + tags: + - Vector stores + summary: Modifies a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to modify. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateVectorStoreRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreObject' + x-oaiMeta: + name: Modify vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + -d '{ + "name": "Support FAQ" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store = client.vector_stores.update( + vector_store_id="vector_store_id", + ) + print(vector_store.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.vectorStores.update( + "vs_abc123", + { + name: "Support FAQ" + } + ); + console.log(vectorStore); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStore = await + client.vectorStores.update('vector_store_id'); + + + console.log(vectorStore.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.Update(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\topenai.VectorStoreUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStore; + import com.openai.models.vectorstores.VectorStoreUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStore vectorStore = client.vectorStores().update("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store = openai.vector_stores.update("vector_store_id") + + puts(vector_store) + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "description": "Contains commonly asked questions and answers, organized by topic.", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + delete: + operationId: deleteVectorStore + tags: + - Vector stores + summary: Delete a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to delete. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteVectorStoreResponse' + x-oaiMeta: + name: Delete vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_deleted = client.vector_stores.delete( + "vector_store_id", + ) + print(vector_store_deleted.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStore = await openai.vectorStores.delete( + "vs_abc123" + ); + console.log(deletedVectorStore); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreDeleted = await + client.vectorStores.delete('vector_store_id'); + + + console.log(vectorStoreDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreDeleted, err := client.VectorStores.Delete(context.TODO(), \"vector_store_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStoreDeleteParams; + import com.openai.models.vectorstores.VectorStoreDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreDeleted vectorStoreDeleted = client.vectorStores().delete("vector_store_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_deleted = + openai.vector_stores.delete("vector_store_id") + + + puts(vector_store_deleted) + response: | + { + id: "vs_abc123", + object: "vector_store.deleted", + deleted: true + } + /vector_stores/{vector_store_id}/file_batches: + post: + operationId: createVectorStoreFileBatch + tags: + - Vector stores + summary: Create a vector store file batch. + description: > + The maximum number of files in a single batch request is 2000. + + Vector 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`). + + For ingesting multiple files into the same vector store, this batch + endpoint is recommended. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: | + The ID of the vector store for which to create a File Batch. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVectorStoreFileBatchRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatchObject' + 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`). + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/file_batches \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "files": [ + { + "file_id": "file-abc123", + "attributes": {"category": "finance"} + }, + { + "file_id": "file-abc456", + "chunking_strategy": { + "type": "static", + "max_chunk_size_tokens": 1200, + "chunk_overlap_tokens": 200 + } + } + ] + }' + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + + vector_store_file_batch = + client.vector_stores.file_batches.create( + vector_store_id="vs_abc123", + ) + + print(vector_store_file_batch.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const myVectorStoreFileBatch = await openai.vectorStores.fileBatches.create( + "vs_abc123", + { + files: [ + { + file_id: "file-abc123", + attributes: { category: "finance" }, + }, + { + file_id: "file-abc456", + chunking_strategy: { + type: "static", + max_chunk_size_tokens: 1200, + chunk_overlap_tokens: 200, + }, + }, + ] + } + ); + console.log(myVectorStoreFileBatch); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFileBatch = await + client.vectorStores.fileBatches.create('vs_abc123'); + + + console.log(vectorStoreFileBatch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.New(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreFileBatchNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.vectorstores.filebatches.FileBatchCreateParams; + + import + com.openai.models.vectorstores.filebatches.VectorStoreFileBatch; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().create("vs_abc123"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_file_batch = + openai.vector_stores.file_batches.create("vs_abc123") + + + puts(vector_store_file_batch) + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 1, + "completed": 1, + "failed": 0, + "cancelled": 0, + "total": 0, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}: + get: + operationId: getVectorStoreFileBatch + tags: + - Vector stores + summary: Retrieves a vector store file batch. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store that the file batch belongs to. + - in: path + name: batch_id + required: true + schema: + type: string + example: vsfb_abc123 + description: The ID of the file batch being retrieved. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatchObject' + x-oaiMeta: + name: Retrieve vector store file batch + group: vector_stores + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/file_batches/vsfb_abc123 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + + vector_store_file_batch = + client.vector_stores.file_batches.retrieve( + batch_id="vsfb_abc123", + vector_store_id="vs_abc123", + ) + + print(vector_store_file_batch.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFileBatch = await openai.vectorStores.fileBatches.retrieve( + "vsfb_abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(vectorStoreFileBatch); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFileBatch = await + client.vectorStores.fileBatches.retrieve('vsfb_abc123', { + vector_store_id: 'vs_abc123', + }); + + + console.log(vectorStoreFileBatch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.Get(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"vsfb_abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.vectorstores.filebatches.FileBatchRetrieveParams; + + import + com.openai.models.vectorstores.filebatches.VectorStoreFileBatch; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileBatchRetrieveParams params = FileBatchRetrieveParams.builder() + .vectorStoreId("vs_abc123") + .batchId("vsfb_abc123") + .build(); + VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_file_batch = + openai.vector_stores.file_batches.retrieve("vsfb_abc123", + vector_store_id: "vs_abc123") + + + puts(vector_store_file_batch) + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 1, + "completed": 1, + "failed": 0, + "cancelled": 0, + "total": 0, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel: + post: + operationId: cancelVectorStoreFileBatch + 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. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store that the file batch belongs to. + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the file batch to cancel. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatchObject' + x-oaiMeta: + name: Cancel vector store file batch + group: vector_stores + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X POST + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + + vector_store_file_batch = + client.vector_stores.file_batches.cancel( + batch_id="batch_id", + vector_store_id="vector_store_id", + ) + + print(vector_store_file_batch.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStoreFileBatch = await openai.vectorStores.fileBatches.cancel( + "vsfb_abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(deletedVectorStoreFileBatch); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFileBatch = await + client.vectorStores.fileBatches.cancel('batch_id', { + vector_store_id: 'vector_store_id', + }); + + + console.log(vectorStoreFileBatch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.Cancel(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"batch_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.vectorstores.filebatches.FileBatchCancelParams; + + import + com.openai.models.vectorstores.filebatches.VectorStoreFileBatch; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileBatchCancelParams params = FileBatchCancelParams.builder() + .vectorStoreId("vector_store_id") + .batchId("batch_id") + .build(); + VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().cancel(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_file_batch = + openai.vector_stores.file_batches.cancel("batch_id", + vector_store_id: "vector_store_id") + + + puts(vector_store_file_batch) + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 12, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 15, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}/files: + get: + operationId: listFilesInVectorStoreBatch + tags: + - Vector stores + summary: Returns a list of vector store files in a batch. + parameters: + - name: vector_store_id + in: path + description: The ID of the vector store that the files belong to. + required: true + schema: + type: string + - name: batch_id + in: path + description: The ID of the file batch that the files belong to. + required: true + schema: + type: string + - name: limit + in: query + description: >- + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: filter + in: query + description: >- + Filter by file status. One of `in_progress`, `completed`, `failed`, + `cancelled`. + schema: + type: string + enum: + - in_progress + - completed + - failed + - cancelled + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListVectorStoreFilesResponse' + x-oaiMeta: + name: List vector store files in a batch + group: vector_stores + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.file_batches.list_files( + batch_id="batch_id", + vector_store_id="vector_store_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFiles = await openai.vectorStores.fileBatches.listFiles( + "vsfb_abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(vectorStoreFiles); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const vectorStoreFile of + client.vectorStores.fileBatches.listFiles('batch_id', { + vector_store_id: 'vector_store_id', + })) { + console.log(vectorStoreFile.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.FileBatches.ListFiles(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"batch_id\",\n\t\topenai.VectorStoreFileBatchListFilesParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.vectorstores.filebatches.FileBatchListFilesPage; + + import + com.openai.models.vectorstores.filebatches.FileBatchListFilesParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileBatchListFilesParams params = FileBatchListFilesParams.builder() + .vectorStoreId("vector_store_id") + .batchId("batch_id") + .build(); + FileBatchListFilesPage page = client.vectorStores().fileBatches().listFiles(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + page = openai.vector_stores.file_batches.list_files("batch_id", + vector_store_id: "vector_store_id") + + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + }, + { + "id": "file-abc456", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + /vector_stores/{vector_store_id}/files: + get: + operationId: listVectorStoreFiles + tags: + - Vector stores + summary: Returns a list of vector store files. + parameters: + - name: vector_store_id + in: path + description: The ID of the vector store that the files belong to. + required: true + schema: + type: string + - name: limit + in: query + description: >- + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT + 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` + clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, starting with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: filter + in: query + description: >- + Filter by file status. One of `in_progress`, `completed`, `failed`, + `cancelled`. + schema: + type: string + enum: + - in_progress + - completed + - failed + - cancelled + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListVectorStoreFilesResponse' + x-oaiMeta: + name: List vector store files + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.files.list( + vector_store_id="vector_store_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFiles = await openai.vectorStores.files.list( + "vs_abc123" + ); + console.log(vectorStoreFiles); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const vectorStoreFile of + client.vectorStores.files.list('vector_store_id')) { + console.log(vectorStoreFile.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.Files.List(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\topenai.VectorStoreFileListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileListPage; + import com.openai.models.vectorstores.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileListPage page = client.vectorStores().files().list("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.files.list("vector_store_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + }, + { + "id": "file-abc456", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + post: + operationId: createVectorStoreFile + tags: + - Vector stores + summary: >- + Create a vector store file by attaching a + [File](/docs/api-reference/files) to a [vector + store](/docs/api-reference/vector-stores/object). + 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`. + + For uploading multiple files to the same vector store, use the file + batches endpoint to reduce request volume. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: | + The ID of the vector store for which to create a File. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVectorStoreFileRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileObject' + 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. + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "file_id": "file-abc123" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file = client.vector_stores.files.create( + vector_store_id="vs_abc123", + file_id="file_id", + ) + print(vector_store_file.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const myVectorStoreFile = await openai.vectorStores.files.create( + "vs_abc123", + { + file_id: "file-abc123" + } + ); + console.log(myVectorStoreFile); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFile = await + client.vectorStores.files.create('vs_abc123', { file_id: 'file_id' + }); + + + console.log(vectorStoreFile.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.New(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreFileNewParams{\n\t\t\tFileID: \"file_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileCreateParams; + import com.openai.models.vectorstores.files.VectorStoreFile; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileCreateParams params = FileCreateParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file_id") + .build(); + VectorStoreFile vectorStoreFile = client.vectorStores().files().create(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_file = openai.vector_stores.files.create("vs_abc123", + file_id: "file_id") + + + puts(vector_store_file) + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "usage_bytes": 1234, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null + } + /vector_stores/{vector_store_id}/files/{file_id}: + get: + operationId: getVectorStoreFile + tags: + - Vector stores + summary: Retrieves a vector store file. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store that the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + example: file-abc123 + description: The ID of the file being retrieved. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileObject' + x-oaiMeta: + name: Retrieve vector store file + group: vector_stores + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file = client.vector_stores.files.retrieve( + file_id="file-abc123", + vector_store_id="vs_abc123", + ) + print(vector_store_file.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFile = await openai.vectorStores.files.retrieve( + "file-abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(vectorStoreFile); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFile = await + client.vectorStores.files.retrieve('file-abc123', { + vector_store_id: 'vs_abc123', + }); + + + console.log(vectorStoreFile.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.Get(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"file-abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileRetrieveParams; + import com.openai.models.vectorstores.files.VectorStoreFile; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileRetrieveParams params = FileRetrieveParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file-abc123") + .build(); + VectorStoreFile vectorStoreFile = client.vectorStores().files().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_file = + openai.vector_stores.files.retrieve("file-abc123", + vector_store_id: "vs_abc123") + + + puts(vector_store_file) + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null + } + delete: + operationId: deleteVectorStoreFile + 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](/docs/api-reference/files/delete) endpoint. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store that the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to delete. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteVectorStoreFileResponse' + x-oaiMeta: + name: Delete vector store file + group: vector_stores + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file_deleted = client.vector_stores.files.delete( + file_id="file_id", + vector_store_id="vector_store_id", + ) + print(vector_store_file_deleted.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStoreFile = await openai.vectorStores.files.delete( + "file-abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(deletedVectorStoreFile); + } + + main(); + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFileDeleted = await + client.vectorStores.files.delete('file_id', { + vector_store_id: 'vector_store_id', + }); + + + console.log(vectorStoreFileDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileDeleted, err := client.VectorStores.Files.Delete(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileDeleted.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import com.openai.models.vectorstores.files.FileDeleteParams; + + import + com.openai.models.vectorstores.files.VectorStoreFileDeleted; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileDeleteParams params = FileDeleteParams.builder() + .vectorStoreId("vector_store_id") + .fileId("file_id") + .build(); + VectorStoreFileDeleted vectorStoreFileDeleted = client.vectorStores().files().delete(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + vector_store_file_deleted = + openai.vector_stores.files.delete("file_id", vector_store_id: + "vector_store_id") + + + puts(vector_store_file_deleted) + response: | + { + id: "file-abc123", + object: "vector_store.file.deleted", + deleted: true + } + post: + operationId: updateVectorStoreFileAttributes + tags: + - Vector stores + summary: Update attributes on a vector store file. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + example: file-abc123 + description: The ID of the file to update attributes. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateVectorStoreFileAttributesRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileObject' + 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} + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"attributes": {"key1": "value1", "key2": 2}}' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const vectorStoreFile = await + client.vectorStores.files.update('file-abc123', { + vector_store_id: 'vs_abc123', + attributes: { foo: 'string' }, + }); + + + console.log(vectorStoreFile.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file = client.vector_stores.files.update( + file_id="file-abc123", + vector_store_id="vs_abc123", + attributes={ + "foo": "string" + }, + ) + print(vector_store_file.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.Update(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"file-abc123\",\n\t\topenai.VectorStoreFileUpdateParams{\n\t\t\tAttributes: map[string]openai.VectorStoreFileUpdateParamsAttributeUnion{\n\t\t\t\t\"foo\": {\n\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.vectorstores.files.FileUpdateParams; + import com.openai.models.vectorstores.files.VectorStoreFile; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileUpdateParams params = FileUpdateParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file-abc123") + .attributes(FileUpdateParams.Attributes.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build()) + .build(); + VectorStoreFile vectorStoreFile = client.vectorStores().files().update(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file = openai.vector_stores.files.update( + "file-abc123", + vector_store_id: "vs_abc123", + attributes: {foo: "string"} + ) + + puts(vector_store_file) + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "usage_bytes": 1234, + "created_at": 1699061776, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null, + "chunking_strategy": {...}, + "attributes": {"key1": "value1", "key2": 2} + } + /vector_stores/{vector_store_id}/search: + post: + operationId: searchVectorStore + tags: + - Vector stores + summary: >- + Search a vector store for relevant chunks based on a query and file + attributes filter. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store to search. + - name: openai-organization + in: header + required: false + description: >- + Optionally scope the request to a specific organization (overrides + the default associated with the API key). Addressable in SQL as + `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: >- + Optionally scope the request to a specific project (overrides the + default associated with the API key). Addressable in SQL as + `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreSearchRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreSearchResultsPage' + x-oaiMeta: + name: Search vector store + group: vector_stores + examples: + request: + curl: | + curl -X POST \ + https://api.openai.com/v1/vector_stores/vs_abc123/search \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"query": "What is the return policy?", "filters": {...}}' + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const vectorStoreSearchResponse of + client.vectorStores.search('vs_abc123', { + query: 'string', + })) { + console.log(vectorStoreSearchResponse.file_id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.search( + vector_store_id="vs_abc123", + query="string", + ) + page = page.data[0] + print(page.file_id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.Search(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreSearchParams{\n\t\t\tQuery: openai.VectorStoreSearchParamsQueryUnion{\n\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStoreSearchPage; + import com.openai.models.vectorstores.VectorStoreSearchParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreSearchParams params = VectorStoreSearchParams.builder() + .vectorStoreId("vs_abc123") + .query("string") + .build(); + VectorStoreSearchPage page = client.vectorStores().search(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.search("vs_abc123", query: "string") + + puts(page) + response: | + { + "object": "vector_store.search_results.page", + "search_query": "What is the return policy?", + "data": [ + { + "file_id": "file_123", + "filename": "document.pdf", + "score": 0.95, + "attributes": { + "author": "John Doe", + "date": "2023-01-01" + }, + "content": [ + { + "type": "text", + "text": "Relevant chunk" + } + ] + }, + { + "file_id": "file_456", + "filename": "notes.txt", + "score": 0.89, + "attributes": { + "author": "Jane Smith", + "date": "2023-01-02" + }, + "content": [ + { + "type": "text", + "text": "Sample text content from the vector store." + } + ] + } + ], + "has_more": false, + "next_page": null + } +components: + schemas: + 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 + type: object + CreateVectorStoreRequest: + type: object + additionalProperties: false + properties: + file_ids: + description: >- + A list of [File](/docs/api-reference/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. + title: Auto Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + x-stainless-const: true + static: + $ref: '#/components/schemas/StaticChunkingStrategy' + required: + - type + - static + metadata: + $ref: '#/components/schemas/Metadata' + VectorStoreObject: + 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: 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 + 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 + enum: + - expired + - in_progress + - completed + expires_after: + $ref: '#/components/schemas/VectorStoreExpirationAfter' + expires_at: + description: >- + The Unix timestamp (in seconds) for when the vector store will + expire. + type: integer + format: unixtime + last_active_at: + description: >- + The Unix timestamp (in seconds) for when the vector store was last + active. + type: integer + format: unixtime + 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: | + { + "id": "vs_123", + "object": "vector_store", + "created_at": 1698107661, + "usage_bytes": 123456, + "last_active_at": 1698107661, + "name": "my_vector_store", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "cancelled": 0, + "failed": 0, + "total": 100 + }, + "last_used_at": 1698107661 + } + UpdateVectorStoreRequest: + type: object + additionalProperties: false + properties: + name: + description: The name of the vector store. + type: string + nullable: true + expires_after: + 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: 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 + required: + - anchor + - days + nullable: true + metadata: + $ref: '#/components/schemas/Metadata' + 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 + CreateVectorStoreFileBatchRequest: + type: object + additionalProperties: false + properties: + file_ids: + description: >- + A list of [File](/docs/api-reference/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' + required: + - file_ids + - files + VectorStoreFileBatchObject: + 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: 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](/docs/api-reference/vector-stores/object) that the + [File](/docs/api-reference/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: + - id + - object + - created_at + - vector_store_id + - status + - file_counts + x-oaiMeta: + name: The vector store files batch object + beta: true + example: | + { + "id": "vsfb_123", + "object": "vector_store.files_batch", + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "failed": 0, + "cancelled": 0, + "total": 100 + } + } + 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 + type: object + CreateVectorStoreFileRequest: + type: object + additionalProperties: false + properties: + file_id: + description: >- + A [File](/docs/api-reference/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`](/docs/api-reference/vector-stores-file-batches/createBatch) + to minimize per-vector-store write requests. + type: string + chunking_strategy: + $ref: '#/components/schemas/ChunkingStrategyRequestParam' + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + required: + - file_id + VectorStoreFileObject: + 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: 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 + vector_store_id: + description: >- + The ID of the [vector + store](/docs/api-reference/vector-stores/object) that the + [File](/docs/api-reference/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: + - in_progress + - completed + - cancelled + - failed + last_error: + 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 + chunking_strategy: + type: object + description: The strategy used to chunk the file. + title: Static Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `static`. + enum: + - static + x-stainless-const: true + static: + $ref: '#/components/schemas/StaticChunkingStrategy' + required: + - type + - static + 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: | + { + "id": "file-abc123", + "object": "vector_store.file", + "usage_bytes": 1234, + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "last_error": null, + "chunking_strategy": { + "type": "static", + "static": { + "max_chunk_size_tokens": 800, + "chunk_overlap_tokens": 400 + } + } + } + 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 + UpdateVectorStoreFileAttributesRequest: + type: object + additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + required: + - attributes + x-oaiMeta: + name: Update vector store file attributes request + VectorStoreSearchRequest: + type: object + additionalProperties: false + properties: + query: + description: A query string for a search + type: string + items: + type: string + description: A list of queries to search for. + minItems: 1 + rewrite_query: + description: Whether to rewrite the natural language query for vector search. + type: boolean + default: false + 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 + filters: + description: A filter to apply based on file attributes. + type: object + additionalProperties: false + title: Comparison Filter + 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`. + + - `eq`: equals + + - `ne`: not equal + + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: >- + The value to compare against the attribute key; supports string, + number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: >- + Array of filters to combine. Items can be `ComparisonFilter` or + `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + 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 + VectorStoreSearchResultsPage: + type: object + additionalProperties: false + properties: + object: + 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' + has_more: + type: boolean + description: Indicates if there are more results to fetch. + next_page: + type: string + description: The token for the next page, if any. + required: + - object + - search_query + - data + - has_more + - next_page + x-oaiMeta: + name: Vector store search results page + VectorStoreExpirationAfter: + 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: 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 + required: + - anchor + - days + 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 + 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 + Metadata: + 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. + + + Keys are strings with a maximum length of 64 characters. Values are + strings + + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + ChunkingStrategyRequestParam: + type: object + description: >- + The chunking strategy used to chunk the file(s). If not set, will use + the `auto` strategy. + discriminator: + propertyName: type + title: Auto Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + x-stainless-const: true + static: + $ref: '#/components/schemas/StaticChunkingStrategy' + required: + - type + - static + VectorStoreFileAttributes: + 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. Keys are + strings + + with a maximum length of 64 characters. Values are strings with a + maximum + + length of 512 characters, booleans, or numbers. + maxProperties: 16 + propertyNames: + type: string + maxLength: 64 + additionalProperties: + oneOf: + - type: string + maxLength: 512 + - type: number + - type: boolean + x-oaiTypeLabel: map + 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' + required: + - type + - static + 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 + 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. + 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`. + + - `eq`: equals + + - `ne`: not equal + + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: >- + The value to compare against the attribute key; supports string, + number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + required: + - type + - key + - value + x-oaiMeta: + name: ComparisonFilter + 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: '#' + discriminator: + propertyName: type + required: + - type + - filters + x-oaiMeta: + name: CompoundFilter + VectorStoreSearchResultItem: + type: object + additionalProperties: false + properties: + file_id: + type: string + description: The ID of the vector store file. + filename: + 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' + required: + - file_id + - filename + - score + - attributes + - content + x-oaiMeta: + name: Vector store search result item + 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`. + + + Note that the overlap must not exceed half of + `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + VectorStoreSearchResultContentObject: + type: object + additionalProperties: false + properties: + type: + description: The type of content. + type: string + enum: + - text + text: + description: The text content returned from search. + type: string + required: + - type + - text + x-oaiMeta: + name: Vector store search result content object + x-stackQL-resources: + vector_stores: + id: openai.vector_stores.vector_stores + name: vector_stores + title: Vector Stores + methods: + list: + operation: + $ref: '#/paths/~1vector_stores/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1vector_stores/post' + response: + mediaType: application/json + openAPIDocKey: '200' + get: + operation: + $ref: '#/paths/~1vector_stores~1{vector_store_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + update: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1vector_stores~1{vector_store_id}/post' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: '#/paths/~1vector_stores~1{vector_store_id}/delete' + response: + mediaType: application/json + openAPIDocKey: '200' + search: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1vector_stores~1{vector_store_id}~1search/post' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/vector_stores/methods/get' + - $ref: '#/components/x-stackQL-resources/vector_stores/methods/list' + insert: + - $ref: '#/components/x-stackQL-resources/vector_stores/methods/create' + update: + - $ref: '#/components/x-stackQL-resources/vector_stores/methods/update' + delete: + - $ref: '#/components/x-stackQL-resources/vector_stores/methods/delete' + replace: [] + file_batches: + id: openai.vector_stores.file_batches + name: file_batches + title: File Batches + methods: + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1vector_stores~1{vector_store_id}~1file_batches/post' + response: + mediaType: application/json + openAPIDocKey: '200' + get: + operation: + $ref: >- + #/paths/~1vector_stores~1{vector_store_id}~1file_batches~1{batch_id}/get + response: + mediaType: application/json + openAPIDocKey: '200' + cancel: + operation: + $ref: >- + #/paths/~1vector_stores~1{vector_store_id}~1file_batches~1{batch_id}~1cancel/post + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/file_batches/methods/get' + insert: + - $ref: '#/components/x-stackQL-resources/file_batches/methods/create' + update: [] + delete: [] + replace: [] + file_batch_files: + id: openai.vector_stores.file_batch_files + name: file_batch_files + title: File Batch Files + methods: + list: + operation: + $ref: >- + #/paths/~1vector_stores~1{vector_store_id}~1file_batches~1{batch_id}~1files/get + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/file_batch_files/methods/list' + insert: [] + update: [] + delete: [] + replace: [] + files: + id: openai.vector_stores.files + name: files + title: Files + methods: + list: + operation: + $ref: '#/paths/~1vector_stores~1{vector_store_id}~1files/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.data + create: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1vector_stores~1{vector_store_id}~1files/post' + response: + mediaType: application/json + openAPIDocKey: '200' + get: + operation: + $ref: '#/paths/~1vector_stores~1{vector_store_id}~1files~1{file_id}/get' + response: + mediaType: application/json + openAPIDocKey: '200' + delete: + operation: + $ref: >- + #/paths/~1vector_stores~1{vector_store_id}~1files~1{file_id}/delete + response: + mediaType: application/json + openAPIDocKey: '200' + update: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1vector_stores~1{vector_store_id}~1files~1{file_id}/post' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/files/methods/get' + - $ref: '#/components/x-stackQL-resources/files/methods/list' + insert: + - $ref: '#/components/x-stackQL-resources/files/methods/create' + update: + - $ref: '#/components/x-stackQL-resources/files/methods/update' + delete: + - $ref: '#/components/x-stackQL-resources/files/methods/delete' + replace: [] +servers: + - url: https://api.openai.com/v1 +x-stackQL-config: + pagination: + requestToken: + key: after + location: query + responseToken: + key: $.last_id + location: body + queryParamPushdown: + top: + paramName: limit + maxValue: 100 diff --git a/provider-dev/scripts/build_inventory.mjs b/provider-dev/scripts/build_inventory.mjs new file mode 100644 index 0000000..e3dc6c5 --- /dev/null +++ b/provider-dev/scripts/build_inventory.mjs @@ -0,0 +1,303 @@ +#!/usr/bin/env node +// Builds provider-dev/config/endpoint_inventory.csv over the filtered spec +// (provider-dev/downloaded/openapi_cleaned.yaml): one row per operation with the +// proposed service/resource/method/SQL-verb mapping, envelope and cursor facts, +// update-POST and async-job flags, and deprecation labelling. +// Deterministic rules; validate-and-fail-without-writing. + +import { readFileSync, writeFileSync, mkdirSync } from 'node:fs'; +import { join, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import yaml from 'js-yaml'; + +const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..'); +const inPath = join(repoRoot, 'provider-dev', 'downloaded', 'openapi_cleaned.yaml'); +const outPath = join(repoRoot, 'provider-dev', 'config', 'endpoint_inventory.csv'); + +const HTTP = ['get', 'post', 'delete', 'put', 'patch']; + +// service by first path segment; /threads folds into the assistants family +const SERVICE_BY_SEGMENT = { + assistants: 'assistants', + threads: 'assistants', + batches: 'batches', + containers: 'containers', + conversations: 'conversations', + evals: 'evals', + files: 'files', + fine_tuning: 'fine_tuning', + models: 'models', + skills: 'skills', + uploads: 'uploads', + vector_stores: 'vector_stores', +}; + +// operationId -> {resource, method, verb} - explicit, exhaustive, auditable. +// Verb rules per CLAUDE.md: GET list -> SELECT .list; GET single -> SELECT .get; +// POST create -> INSERT; POST partial update -> UPDATE (update_post flagged for +// per-resource confirmation); DELETE -> DELETE; cancel/pause/resume/submit/search/ +// complete -> EXEC. v1 precedent kept where sane (create_thread_and_run stays EXEC). +const OPS = { + // assistants family (deprecation-labelled; threads/runs/messages by family rule) + listAssistants: { resource: 'assistants', method: 'list', verb: 'select' }, + createAssistant: { resource: 'assistants', method: 'create', verb: 'insert' }, + getAssistant: { resource: 'assistants', method: 'get', verb: 'select' }, + modifyAssistant: { resource: 'assistants', method: 'update', verb: 'update', updatePost: true }, + deleteAssistant: { resource: 'assistants', method: 'delete', verb: 'delete' }, + createThread: { resource: 'threads', method: 'create', verb: 'insert' }, + getThread: { resource: 'threads', method: 'get', verb: 'select' }, + modifyThread: { resource: 'threads', method: 'update', verb: 'update', updatePost: true }, + deleteThread: { resource: 'threads', method: 'delete', verb: 'delete' }, + createThreadAndRun: { resource: 'threads', method: 'create_thread_and_run', verb: 'exec' }, + listMessages: { resource: 'messages', method: 'list', verb: 'select' }, + createMessage: { resource: 'messages', method: 'create', verb: 'insert' }, + getMessage: { resource: 'messages', method: 'get', verb: 'select' }, + modifyMessage: { resource: 'messages', method: 'update', verb: 'update', updatePost: true }, + deleteMessage: { resource: 'messages', method: 'delete', verb: 'delete' }, + listRuns: { resource: 'runs', method: 'list', verb: 'select' }, + createRun: { resource: 'runs', method: 'create', verb: 'insert', asyncJob: 'create' }, + getRun: { resource: 'runs', method: 'get', verb: 'select', asyncJob: 'poll' }, + modifyRun: { resource: 'runs', method: 'update', verb: 'update', updatePost: true }, + cancelRun: { resource: 'runs', method: 'cancel', verb: 'exec', asyncJob: 'cancel' }, + submitToolOuputsToRun: { resource: 'runs', method: 'submit_tool_outputs', verb: 'exec' }, + listRunSteps: { resource: 'run_steps', method: 'list', verb: 'select' }, + getRunStep: { resource: 'run_steps', method: 'get', verb: 'select' }, + + // batches - the in-scope async boundary case + listBatches: { resource: 'batches', method: 'list', verb: 'select' }, + createBatch: { resource: 'batches', method: 'create', verb: 'insert', asyncJob: 'create' }, + retrieveBatch: { resource: 'batches', method: 'get', verb: 'select', asyncJob: 'poll' }, + cancelBatch: { resource: 'batches', method: 'cancel', verb: 'exec', asyncJob: 'cancel' }, + + // containers (code interpreter container metadata) + ListContainers: { resource: 'containers', method: 'list', verb: 'select' }, + CreateContainer: { resource: 'containers', method: 'create', verb: 'insert' }, + RetrieveContainer: { resource: 'containers', method: 'get', verb: 'select' }, + DeleteContainer: { resource: 'containers', method: 'delete', verb: 'delete' }, + ListContainerFiles: { resource: 'files', method: 'list', verb: 'select' }, + CreateContainerFile: { resource: 'files', method: 'create', verb: 'insert', notes: 'INSERT via the non-binary file_id (reference an existing file); the optional binary file upload column is stripped in pre_normalize (any-sdk marshals JSON/XML only)' }, + RetrieveContainerFile: { resource: 'files', method: 'get', verb: 'select' }, + DeleteContainerFile: { resource: 'files', method: 'delete', verb: 'delete' }, + + // conversations (Responses-family state surface; in scope per NOTES Open decision) + createConversation: { resource: 'conversations', method: 'create', verb: 'insert' }, + getConversation: { resource: 'conversations', method: 'get', verb: 'select' }, + updateConversation: { resource: 'conversations', method: 'update', verb: 'update', updatePost: true }, + deleteConversation: { resource: 'conversations', method: 'delete', verb: 'delete' }, + listConversationItems: { resource: 'items', method: 'list', verb: 'select' }, + createConversationItems: { resource: 'items', method: 'create', verb: 'insert' }, + getConversationItem: { resource: 'items', method: 'get', verb: 'select' }, + deleteConversationItem: { resource: 'items', method: 'delete', verb: 'delete' }, + + // evals + listEvals: { resource: 'evals', method: 'list', verb: 'select' }, + createEval: { resource: 'evals', method: 'create', verb: 'insert' }, + getEval: { resource: 'evals', method: 'get', verb: 'select' }, + updateEval: { resource: 'evals', method: 'update', verb: 'update', updatePost: true }, + deleteEval: { resource: 'evals', method: 'delete', verb: 'delete' }, + getEvalRuns: { resource: 'runs', method: 'list', verb: 'select' }, + createEvalRun: { resource: 'runs', method: 'create', verb: 'insert', asyncJob: 'create' }, + getEvalRun: { resource: 'runs', method: 'get', verb: 'select', asyncJob: 'poll' }, + cancelEvalRun: { resource: 'runs', method: 'cancel', verb: 'exec', asyncJob: 'cancel' }, + deleteEvalRun: { resource: 'runs', method: 'delete', verb: 'delete' }, + getEvalRunOutputItems: { resource: 'run_output_items', method: 'list', verb: 'select' }, + getEvalRunOutputItem: { resource: 'run_output_items', method: 'get', verb: 'select' }, + + // files - metadata only; create is multipart binary upload -> skipped + listFiles: { resource: 'files', method: 'list', verb: 'select' }, + createFile: { resource: 'files', method: 'create', verb: '', skip: 'multipart-binary-body' }, + retrieveFile: { resource: 'files', method: 'get', verb: 'select' }, + deleteFile: { resource: 'files', method: 'delete', verb: 'delete' }, + + // fine_tuning - the async-job archetype + listPaginatedFineTuningJobs: { resource: 'jobs', method: 'list', verb: 'select' }, + createFineTuningJob: { resource: 'jobs', method: 'create', verb: 'insert', asyncJob: 'create' }, + retrieveFineTuningJob: { resource: 'jobs', method: 'get', verb: 'select', asyncJob: 'poll' }, + cancelFineTuningJob: { resource: 'jobs', method: 'cancel', verb: 'exec', asyncJob: 'cancel' }, + pauseFineTuningJob: { resource: 'jobs', method: 'pause', verb: 'exec', asyncJob: 'control' }, + resumeFineTuningJob: { resource: 'jobs', method: 'resume', verb: 'exec', asyncJob: 'control' }, + listFineTuningEvents: { resource: 'events', method: 'list', verb: 'select' }, + listFineTuningJobCheckpoints: { resource: 'checkpoints', method: 'list', verb: 'select' }, + listFineTuningCheckpointPermissions: { resource: 'checkpoint_permissions', method: 'list', verb: 'select' }, + createFineTuningCheckpointPermission: { resource: 'checkpoint_permissions', method: 'create', verb: 'insert' }, + deleteFineTuningCheckpointPermission: { resource: 'checkpoint_permissions', method: 'delete', verb: 'delete' }, + + // models + listModels: { resource: 'models', method: 'list', verb: 'select' }, + retrieveModel: { resource: 'models', method: 'get', verb: 'select' }, + deleteModel: { resource: 'models', method: 'delete', verb: 'delete' }, + + // skills (versioned metadata CRUD; in scope per NOTES Open decision) + ListSkills: { resource: 'skills', method: 'list', verb: 'select' }, + CreateSkill: { resource: 'skills', method: 'create', verb: '', skip: 'multipart-binary-body' }, + GetSkill: { resource: 'skills', method: 'get', verb: 'select' }, + UpdateSkillDefaultVersion: { resource: 'skills', method: 'update', verb: 'update', updatePost: true }, + DeleteSkill: { resource: 'skills', method: 'delete', verb: 'delete' }, + ListSkillVersions: { resource: 'versions', method: 'list', verb: 'select' }, + CreateSkillVersion: { resource: 'versions', method: 'create', verb: '', skip: 'multipart-binary-body' }, + GetSkillVersion: { resource: 'versions', method: 'get', verb: 'select' }, + DeleteSkillVersion: { resource: 'versions', method: 'delete', verb: 'delete' }, + + // uploads - metadata lifecycle (parts are binary, filtered upstream); no GET surface + createUpload: { resource: 'uploads', method: 'create', verb: 'insert', asyncJob: 'create' }, + completeUpload: { resource: 'uploads', method: 'complete', verb: 'exec', asyncJob: 'control' }, + cancelUpload: { resource: 'uploads', method: 'cancel', verb: 'exec', asyncJob: 'cancel' }, + + // vector_stores - the CRUD flagship + listVectorStores: { resource: 'vector_stores', method: 'list', verb: 'select' }, + createVectorStore: { resource: 'vector_stores', method: 'create', verb: 'insert' }, + getVectorStore: { resource: 'vector_stores', method: 'get', verb: 'select' }, + modifyVectorStore: { resource: 'vector_stores', method: 'update', verb: 'update', updatePost: true }, + deleteVectorStore: { resource: 'vector_stores', method: 'delete', verb: 'delete' }, + searchVectorStore: { resource: 'vector_stores', method: 'search', verb: 'exec', notes: 'embedding-consuming query; gated smoke tier' }, + listVectorStoreFiles: { resource: 'files', method: 'list', verb: 'select' }, + createVectorStoreFile: { resource: 'files', method: 'create', verb: 'insert' }, + getVectorStoreFile: { resource: 'files', method: 'get', verb: 'select' }, + updateVectorStoreFileAttributes: { resource: 'files', method: 'update', verb: 'update', updatePost: true }, + deleteVectorStoreFile: { resource: 'files', method: 'delete', verb: 'delete' }, + createVectorStoreFileBatch: { resource: 'file_batches', method: 'create', verb: 'insert', asyncJob: 'create' }, + getVectorStoreFileBatch: { resource: 'file_batches', method: 'get', verb: 'select', asyncJob: 'poll' }, + cancelVectorStoreFileBatch: { resource: 'file_batches', method: 'cancel', verb: 'exec', asyncJob: 'cancel' }, + listFilesInVectorStoreBatch: { resource: 'file_batch_files', method: 'list', verb: 'select' }, +}; + +// the vendor flags only /assistants ops deprecated; the family rule extends the +// label to the whole assistants service (threads, messages, runs, run_steps) +const FAMILY_DEPRECATED_SERVICES = new Set(['assistants']); + +const doc = yaml.load(readFileSync(inPath, 'utf8')); +const resolveRef = (ref) => ref.split('/').slice(1).reduce((o, k) => o[k], doc); + +const errors = []; +const rows = []; +const seenOpIds = new Set(); + +for (const [path, item] of Object.entries(doc.paths)) { + const seg = path.split('/')[1]; + const service = SERVICE_BY_SEGMENT[seg]; + if (!service) { + errors.push(`${path}: no service rule for segment '${seg}'`); + continue; + } + const pathParams = [...path.matchAll(/\{([^}]+)\}/g)].map((m) => m[1]); + for (const httpVerb of HTTP) { + const op = item[httpVerb]; + if (!op) continue; + const opId = op.operationId; + if (!opId) { + errors.push(`${httpVerb.toUpperCase()} ${path}: missing operationId`); + continue; + } + if (seenOpIds.has(opId)) errors.push(`duplicate operationId ${opId}`); + seenOpIds.add(opId); + const rule = OPS[opId]; + if (!rule) { + errors.push(`${opId} (${httpVerb.toUpperCase()} ${path}): no classification rule`); + continue; + } + + // envelope facts from the 200 response + let envelope = ''; + let objectKey = ''; + let schema = op.responses?.['200']?.content?.['application/json']?.schema; + if (schema?.$ref) schema = resolveRef(schema.$ref); + const props = schema?.properties || {}; + if (Array.isArray(props.data?.type) ? props.data.type.includes('array') : props.data?.type === 'array' || props.data?.items) { + objectKey = '$.data'; + const keys = Object.keys(props); + envelope = + keys.includes('first_id') && keys.includes('last_id') && keys.includes('has_more') + ? 'list-cursor' + : keys.includes('has_more') + ? 'list-has_more-only' + : 'list-plain'; + } else if (schema) { + envelope = 'object'; + } + + const queryParams = (op.parameters || []) + .map((p) => (p.$ref ? resolveRef(p.$ref) : p)) + .filter((p) => p.in === 'query') + .map((p) => p.name); + const cursorParams = queryParams.filter((q) => ['limit', 'after', 'before', 'order'].includes(q)); + + const deprecated = op.deprecated ? 'spec' : FAMILY_DEPRECATED_SERVICES.has(service) ? 'family-rule' : ''; + + rows.push({ + service, + resource: rule.skip ? '' : rule.resource, + sql_verb: rule.verb, + method: rule.skip ? '' : rule.method, + http_verb: httpVerb.toUpperCase(), + path, + operation_id: opId, + envelope, + object_key: rule.verb === 'select' && rule.method === 'list' ? objectKey : '', + cursor_params: cursorParams.join(' '), + path_params: pathParams.join(' '), + update_post: rule.updatePost ? 'y' : '', + async_job: rule.asyncJob || '', + deprecated, + skip_reason: rule.skip || '', + notes: rule.notes || '', + }); + } +} + +// coverage both directions +for (const opId of Object.keys(OPS)) { + if (!seenOpIds.has(opId)) errors.push(`rule for ${opId} matches no operation in the filtered spec`); +} +// list methods must carry an object key; cursor lists must declare after+limit +for (const r of rows) { + if (r.method === 'list' && !r.object_key) errors.push(`${r.service}.${r.resource}.list (${r.operation_id}): no $.data object key`); + if (r.method === 'list' && r.envelope === 'list-cursor' && !(r.cursor_params.includes('after') && r.cursor_params.includes('limit'))) + errors.push(`${r.operation_id}: cursor envelope without after+limit params`); +} +// unique (service, resource, method) and unique path-param signature per (service, resource, sql_verb) +const methodKeys = new Set(); +const sigMap = new Map(); +for (const r of rows) { + if (r.skip_reason) continue; + const mk = `${r.service}.${r.resource}.${r.method}`; + if (methodKeys.has(mk)) errors.push(`duplicate method key ${mk}`); + methodKeys.add(mk); + if (['select', 'insert', 'update', 'delete'].includes(r.sql_verb)) { + const sk = `${r.service}.${r.resource}.${r.sql_verb}:${r.path_params}`; + if (sigMap.has(sk)) errors.push(`signature collision ${sk} (${sigMap.get(sk)} vs ${r.operation_id})`); + sigMap.set(sk, r.operation_id); + } +} +// select list/get pairs may share a verb only with distinct signatures - covered by sigMap above + +if (errors.length) { + console.error(`FAIL: ${errors.length} validation error(s); nothing written`); + for (const e of errors) console.error(` - ${e}`); + process.exit(1); +} + +const cols = ['service', 'resource', 'sql_verb', 'method', 'http_verb', 'path', 'operation_id', 'envelope', 'object_key', 'cursor_params', 'path_params', 'update_post', 'async_job', 'deprecated', 'skip_reason', 'notes']; +const csvEscape = (v) => (/[",\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v); +rows.sort((a, b) => a.service.localeCompare(b.service) || a.resource.localeCompare(b.resource) || a.path.localeCompare(b.path) || a.http_verb.localeCompare(b.http_verb)); +mkdirSync(dirname(outPath), { recursive: true }); +writeFileSync(outPath, [cols.join(','), ...rows.map((r) => cols.map((c) => csvEscape(String(r[c]))).join(','))].join('\n') + '\n'); + +const mapped = rows.filter((r) => !r.skip_reason); +const count = (arr, fn) => { + const m = {}; + for (const x of arr) { + const k = fn(x); + m[k] = (m[k] || 0) + 1; + } + return Object.entries(m).sort(); +}; +console.log(`Wrote ${rows.length} operations (${mapped.length} mapped, ${rows.length - mapped.length} skipped) -> ${outPath}`); +console.log(`Resources: ${new Set(mapped.map((r) => `${r.service}.${r.resource}`)).size} across ${new Set(mapped.map((r) => r.service)).size} services`); +console.log('By service (mapped):'); +for (const [k, v] of count(mapped, (r) => r.service)) console.log(` ${k}: ${v}`); +console.log('By SQL verb (mapped):'); +for (const [k, v] of count(mapped, (r) => r.sql_verb)) console.log(` ${k}: ${v}`); +console.log(`Deprecation-labelled: ${rows.filter((r) => r.deprecated).length} ops (${rows.filter((r) => r.deprecated === 'spec').length} spec-flagged, ${rows.filter((r) => r.deprecated === 'family-rule').length} family-rule)`); +console.log(`Update-POSTs: ${rows.filter((r) => r.update_post).length}; async-job ops: ${rows.filter((r) => r.async_job).length}`); +console.log('Envelope distribution (list methods):'); +for (const [k, v] of count(rows.filter((r) => r.method === 'list'), (r) => r.envelope)) console.log(` ${k}: ${v}`); diff --git a/provider-dev/scripts/clean_specs.mjs b/provider-dev/scripts/clean_specs.mjs new file mode 100644 index 0000000..87fd615 --- /dev/null +++ b/provider-dev/scripts/clean_specs.mjs @@ -0,0 +1,141 @@ +#!/usr/bin/env node +// Applies the deterministic scope filters to the pinned OpenAI spec and writes the cleaned +// artifact consumed by split. Every removal carries a reason code; the full removal list is +// emitted as provider-dev/config/filter_report.csv. Validate-and-fail-without-writing. +// +// Scope rules (CLAUDE.md "Scope boundaries"): +// org-admin-surface - /organization subtree and the /projects/{id} role/group surface; +// separate admin key class -> the sibling openai_admin provider +// data-plane-inference - inference invocation (chat/completions, responses, embeddings, +// images, audio, moderations, realtime, completions, videos, +// conversation-free invocation surfaces); the model-provider posture +// binary-transfer - file/skill/video/container-file content downloads and upload parts +// alpha-unstable - /fine_tuning/alpha graders (compute-consuming, alpha-labelled) +// beta-ui-surface - ChatKit session/thread surface (client-secret issuance, UI-coupled beta) +// +// Batches stay (async job control surface, not an invocation). Assistants/threads/runs stay, +// deprecation-labelled downstream. File/upload/container metadata stays. + +import { readFileSync, writeFileSync, mkdirSync } from 'node:fs'; +import { join, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import SwaggerParser from '@apidevtools/swagger-parser'; +import yaml from 'js-yaml'; + +const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..'); +const inPath = join(repoRoot, 'provider-dev', 'downloaded', 'openapi.yaml'); +const outPath = join(repoRoot, 'provider-dev', 'downloaded', 'openapi_cleaned.yaml'); +const reportPath = join(repoRoot, 'provider-dev', 'config', 'filter_report.csv'); + +const HTTP = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']; + +// Ordered path rules; first match wins. `keep: true` short-circuits an earlier broad exclusion. +const RULES = [ + // binary transfer carve-outs come first so family keeps below cannot re-admit them + { re: /^\/files\/\{file_id\}\/content$/, reason: 'binary-transfer' }, + { re: /^\/containers\/\{container_id\}\/files\/\{file_id\}\/content$/, reason: 'binary-transfer' }, + { re: /^\/vector_stores\/\{vector_store_id\}\/files\/\{file_id\}\/content$/, reason: 'binary-transfer' }, + { re: /^\/skills\/.*\/content$/, reason: 'binary-transfer' }, + { re: /^\/uploads\/\{upload_id\}\/parts$/, reason: 'binary-transfer' }, + + // admin key class -> openai_admin sibling + { re: /^\/organization(\/|$)/, reason: 'org-admin-surface' }, + { re: /^\/projects\/\{project_id\}(\/|$)/, reason: 'org-admin-surface' }, + + // inference data plane (the model-provider posture) + { re: /^\/chat(\/|$)/, reason: 'data-plane-inference' }, + { re: /^\/completions$/, reason: 'data-plane-inference' }, + { re: /^\/responses(\/|$)/, reason: 'data-plane-inference' }, + { re: /^\/embeddings$/, reason: 'data-plane-inference' }, + { re: /^\/images(\/|$)/, reason: 'data-plane-inference' }, + { re: /^\/audio(\/|$)/, reason: 'data-plane-inference' }, + { re: /^\/moderations$/, reason: 'data-plane-inference' }, + { re: /^\/realtime(\/|$)/, reason: 'data-plane-inference' }, + { re: /^\/videos(\/|$)/, reason: 'data-plane-inference' }, + + // alpha, compute-consuming + { re: /^\/fine_tuning\/alpha(\/|$)/, reason: 'alpha-unstable' }, + + // beta UI-coupled surface (client-secret issuance); revisit if it stabilises + { re: /^\/chatkit(\/|$)/, reason: 'beta-ui-surface' }, +]; + +const raw = readFileSync(inPath, 'utf8'); +const doc = yaml.load(raw); + +const preOps = Object.values(doc.paths).reduce((n, item) => n + HTTP.filter((v) => item[v]).length, 0); +const prePaths = Object.keys(doc.paths).length; + +const removed = []; +for (const [path, item] of Object.entries(doc.paths)) { + const rule = RULES.find((r) => r.re.test(path)); + if (rule) { + const verbs = HTTP.filter((v) => item[v]).map((v) => v.toUpperCase()).join(';'); + const opIds = HTTP.filter((v) => item[v]).map((v) => item[v].operationId || '').join(';'); + removed.push({ path, verbs, opIds, reason: rule.reason }); + delete doc.paths[path]; + } +} + +const postPaths = Object.keys(doc.paths).length; +const postOps = Object.values(doc.paths).reduce((n, item) => n + HTTP.filter((v) => item[v]).length, 0); + +// Fail loudly if a rule matched nothing (stale rule = silent drift) - every rule must earn its place. +const usedReasons = new Set(removed.map((r) => r.reason)); +const staleRules = RULES.filter((r) => !removed.some((x) => r.re.test(x.path))); +if (staleRules.length) { + console.error(`FAIL: ${staleRules.length} filter rule(s) matched no path (stale against this spec pin); nothing written`); + for (const r of staleRules) console.error(` - ${r.re} (${r.reason})`); + process.exit(1); +} + +// The org-subtree filter is validated (non-negotiable 3): nothing org-scoped may survive. +const orgSurvivors = Object.keys(doc.paths).filter((p) => p.startsWith('/organization')); +if (orgSurvivors.length) { + console.error(`FAIL: /organization paths survived the filter: ${orgSurvivors.join(', ')}; nothing written`); + process.exit(1); +} + +// Stamp tags on untagged operations (the Containers family ships untagged upstream): +// deterministic rule - tag from the first path segment, TitleCased. The split step +// discriminates on tags, so every operation must carry exactly one. +let stamped = 0; +for (const [path, item] of Object.entries(doc.paths)) { + for (const v of HTTP) { + const op = item[v]; + if (op && (!op.tags || op.tags.length === 0)) { + const seg = path.split('/')[1]; + op.tags = [seg.charAt(0).toUpperCase() + seg.slice(1)]; + stamped++; + } + } +} +if (stamped) console.log(`Stamped tags on ${stamped} untagged operation(s) (first path segment, TitleCased)`); + +console.log('Validating filtered spec with @apidevtools/swagger-parser ...'); +await SwaggerParser.validate(structuredClone(doc)); + +mkdirSync(dirname(outPath), { recursive: true }); +mkdirSync(dirname(reportPath), { recursive: true }); +writeFileSync(outPath, yaml.dump(doc, { noRefs: true, lineWidth: -1 })); +const csvEscape = (v) => (/[",\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v); +writeFileSync( + reportPath, + ['path,verbs,operation_ids,reason', ...removed + .sort((a, b) => a.reason.localeCompare(b.reason) || a.path.localeCompare(b.path)) + .map((r) => [r.path, r.verbs, r.opIds, r.reason].map(csvEscape).join(','))].join('\n') + '\n' +); + +const removedOps = removed.reduce((n, r) => n + r.verbs.split(';').filter(Boolean).length, 0); +console.log(`Pre-filter: ${prePaths} paths / ${preOps} operations`); +console.log(`Removed: ${removed.length} paths / ${removedOps} operations`); +const byReason = {}; +for (const r of removed) { + const ops = r.verbs.split(';').filter(Boolean).length; + byReason[r.reason] = byReason[r.reason] || { paths: 0, ops: 0 }; + byReason[r.reason].paths++; + byReason[r.reason].ops += ops; +} +for (const [reason, c] of Object.entries(byReason).sort()) console.log(` ${reason}: ${c.paths} paths / ${c.ops} ops`); +console.log(`Post-filter: ${postPaths} paths / ${postOps} operations`); +console.log(`Wrote ${outPath} and ${reportPath}`); diff --git a/provider-dev/scripts/disposition_predecessor.mjs b/provider-dev/scripts/disposition_predecessor.mjs new file mode 100644 index 0000000..507acca --- /dev/null +++ b/provider-dev/scripts/disposition_predecessor.mjs @@ -0,0 +1,192 @@ +#!/usr/bin/env node +// Joins the predecessor inventory (v1 provider methods) against the new endpoint inventory +// and dispositions every v1 entry: carried / renamed (old -> new) / retired (reason-coded). +// Writes provider-dev/config/predecessor_dispositions.csv and regenerates the Breaking +// Changes section of README.md between the BEGIN/END markers - the section is generated, +// never hand-written. Validate-and-fail-without-writing; no v1 entry may be undispositioned. + +import { readFileSync, writeFileSync } from 'node:fs'; +import { join, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..'); +const cfg = (f) => join(repoRoot, 'provider-dev', 'config', f); +const readmePath = join(repoRoot, 'README.md'); + +const parseCsv = (text) => { + const lines = text.trim().split('\n'); + const cols = lines[0].split(','); + return lines.slice(1).map((line) => { + const vals = []; + let cur = '', inQ = false; + for (let i = 0; i < line.length; i++) { + const ch = line[i]; + if (inQ) { + if (ch === '"' && line[i + 1] === '"') { cur += '"'; i++; } + else if (ch === '"') inQ = false; + else cur += ch; + } else if (ch === '"') inQ = true; + else if (ch === ',') { vals.push(cur); cur = ''; } + else cur += ch; + } + vals.push(cur); + return Object.fromEntries(cols.map((c, i) => [c, vals[i] ?? ''])); + }); +}; + +const predecessors = parseCsv(readFileSync(cfg('predecessor_inventory.csv'), 'utf8')); +const inventory = parseCsv(readFileSync(cfg('endpoint_inventory.csv'), 'utf8')); +const filterReport = parseCsv(readFileSync(cfg('filter_report.csv'), 'utf8')); + +// v1 services that are wholly the admin-key surface -> openai_admin sibling. +// Their operationIds were also renamed upstream, so the opId join cannot see them. +const ORG_SERVICES = new Set(['audit_logs', 'invites', 'projects', 'users']); + +const camel = (s) => s.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase()); + +const byOpId = new Map(); +for (const r of inventory) byOpId.set(r.operation_id.toLowerCase(), r); +const filterByOpId = new Map(); +for (const r of filterReport) + for (const id of r.operation_ids.split(';').filter(Boolean)) filterByOpId.set(id.toLowerCase(), r.reason); + +const errors = []; +const out = []; +for (const p of predecessors) { + const oldFqn = `openai.${p.service}.${p.resource}`; + const row = { + service: p.service, resource: p.resource, method: p.method, verb: p.verb, + old_fqn: oldFqn, disposition: '', new_fqn: '', new_method: '', reason: '', + }; + if (ORG_SERVICES.has(p.service)) { + row.disposition = 'retired'; + row.reason = 'org-admin-surface(openai_admin)'; + out.push(row); + continue; + } + const opId = camel(p.method).toLowerCase(); + const inv = byOpId.get(opId); + if (inv && !inv.skip_reason) { + const newFqn = `openai.${inv.service}.${inv.resource}`; + row.disposition = newFqn === oldFqn ? 'carried' : 'renamed'; + row.new_fqn = newFqn; + row.new_method = inv.method; + out.push(row); + continue; + } + if (inv && inv.skip_reason) { + row.disposition = 'retired'; + row.reason = inv.skip_reason; + out.push(row); + continue; + } + const filterReason = filterByOpId.get(opId); + if (filterReason) { + row.disposition = 'retired'; + row.reason = filterReason + (filterReason === 'org-admin-surface' ? '(openai_admin)' : ''); + out.push(row); + continue; + } + errors.push(`${oldFqn}.${p.method}: no disposition (opId ${camel(p.method)} unmatched)`); +} + +if (errors.length) { + console.error(`FAIL: ${errors.length} undispositioned v1 entr(y/ies); nothing written`); + for (const e of errors) console.error(` - ${e}`); + process.exit(1); +} + +// README must carry the markers exactly once each +const readme = readFileSync(readmePath, 'utf8'); +const BEGIN = ''; +const END = ''; +if (readme.split(BEGIN).length !== 2 || readme.split(END).length !== 2) { + console.error('FAIL: README.md must contain exactly one BEGIN/END BREAKING-CHANGES marker pair; nothing written'); + process.exit(1); +} + +// ---- write dispositions csv +const cols = ['service', 'resource', 'method', 'verb', 'old_fqn', 'disposition', 'new_fqn', 'new_method', 'reason']; +const csvEscape = (v) => (/[",\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v); +writeFileSync( + cfg('predecessor_dispositions.csv'), + [cols.join(','), ...out.map((r) => cols.map((c) => csvEscape(r[c])).join(','))].join('\n') + '\n' +); + +// ---- generate the Breaking Changes section +const carried = out.filter((r) => r.disposition === 'carried'); +const renamed = out.filter((r) => r.disposition === 'renamed'); +const retired = out.filter((r) => r.disposition === 'retired'); + +const resourceRenames = new Map(); +for (const r of renamed) resourceRenames.set(r.old_fqn, r.new_fqn); +const methodRenames = [...carried, ...renamed].filter((r) => r.method !== r.new_method); + +// a retired METHOD on a resource that otherwise survives is not a retired RESOURCE +const survivingFqns = new Set([...carried, ...renamed].map((r) => r.old_fqn)); +const retiredWholeResource = retired.filter((r) => !survivingFqns.has(r.old_fqn)); +const retiredMethodOnly = retired.filter((r) => survivingFqns.has(r.old_fqn)); + +const retiredByReason = new Map(); +for (const r of retiredWholeResource) { + if (!retiredByReason.has(r.reason)) retiredByReason.set(r.reason, []); + retiredByReason.get(r.reason).push(r); +} +const REASON_TEXT = { + 'org-admin-surface(openai_admin)': + 'Organization/admin surface (separate admin key class) - moved to the sibling [`openai_admin`](https://github.com/stackql/stackql-provider-registry) provider', + 'data-plane-inference': + 'Inference invocation (data plane) - out of scope per the standing model-provider posture; use the vendor SDKs for invocation', + 'binary-transfer': 'Binary transfer - out of scope per the standing exclusions (metadata remains queryable)', + 'multipart-binary-body': 'Multipart binary upload body - not expressible; file content uploads are out of scope (metadata remains queryable)', +}; + +const fmtResourceSet = (rows) => { + const set = [...new Set(rows.map((r) => `\`${r.old_fqn}\``))].sort(); + return set.join(', '); +}; + +const lines = []; +lines.push(BEGIN); +lines.push(''); +lines.push('### Breaking Changes from the v1 Provider'); +lines.push(''); +lines.push('This rebuild replaces the published v1 `openai` provider. Every v1 resource is dispositioned below'); +lines.push(`(generated from \`provider-dev/config/predecessor_dispositions.csv\`: ${out.length} v1 methods -> ${carried.length} carried, ${renamed.length} renamed, ${retired.length} retired).`); +lines.push('The old provider version remains available in the registry for pinning.'); +lines.push(''); +lines.push('**Renamed resources** (old -> new):'); +lines.push(''); +lines.push('| v1 resource | This rebuild |'); +lines.push('|---|---|'); +for (const [oldFqn, newFqn] of [...resourceRenames.entries()].sort()) lines.push(`| \`${oldFqn}\` | \`${newFqn}\` |`); +lines.push(''); +lines.push('**Retired resources** (reason-coded):'); +lines.push(''); +for (const [reason, rows] of [...retiredByReason.entries()].sort()) { + lines.push(`- ${REASON_TEXT[reason] || reason}: ${fmtResourceSet(rows)}`); +} +lines.push(''); +if (retiredMethodOnly.length) { + lines.push('**Retired methods on surviving resources**:'); + lines.push(''); + for (const r of retiredMethodOnly.sort((a, b) => a.old_fqn.localeCompare(b.old_fqn) || a.method.localeCompare(b.method))) { + lines.push(`- \`${r.old_fqn}.${r.method}\` - ${REASON_TEXT[r.reason] || r.reason}`); + } + lines.push(''); +} +lines.push('**Method naming** - v1 operation-derived method names become resource-scoped names'); +lines.push('(`list_batches` -> `list`, `retrieve_batch` -> `get`, `create_fine_tuning_job` -> `create`, ...).'); +lines.push(`${methodRenames.length} of the ${carried.length + renamed.length} surviving methods are renamed this way; the mapping is one-to-one per resource and recorded in the dispositions CSV.`); +lines.push(''); +lines.push(END); + +const newReadme = readme.slice(0, readme.indexOf(BEGIN)) + lines.join('\n') + readme.slice(readme.indexOf(END) + END.length); +writeFileSync(readmePath, newReadme); + +console.log(`Dispositioned ${out.length} v1 methods -> ${cfg('predecessor_dispositions.csv')}`); +console.log(` carried: ${carried.length}`); +console.log(` renamed: ${renamed.length} (${resourceRenames.size} distinct resource renames)`); +console.log(` retired: ${retired.length}`); +for (const [reason, rows] of [...retiredByReason.entries()].sort()) console.log(` ${reason}: ${rows.length}`); +console.log('Breaking Changes section regenerated in README.md'); diff --git a/provider-dev/scripts/fetch_spec.mjs b/provider-dev/scripts/fetch_spec.mjs new file mode 100644 index 0000000..7055745 --- /dev/null +++ b/provider-dev/scripts/fetch_spec.mjs @@ -0,0 +1,121 @@ +#!/usr/bin/env node +// Acquires the canonical OpenAI OpenAPI artifact (openapi.yaml on openai/openai-openapi), +// validates it with @apidevtools/swagger-parser, and pins (source, ref, date, sha256) in +// provider-dev/config/spec_pin.json. Validate-and-fail-without-writing: nothing is persisted +// unless download + parse + validate all succeed. +// +// Usage: +// node fetch_spec.mjs # resolve current main HEAD, download, validate, pin, save +// node fetch_spec.mjs --ref SHA # fetch a specific commit +// node fetch_spec.mjs --check # re-resolve main HEAD and compare against the recorded pin (drift CI) + +import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs'; +import { createHash } from 'node:crypto'; +import { join, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import SwaggerParser from '@apidevtools/swagger-parser'; +import yaml from 'js-yaml'; + +const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..'); +const pinPath = join(repoRoot, 'provider-dev', 'config', 'spec_pin.json'); +const specPath = join(repoRoot, 'provider-dev', 'downloaded', 'openapi.yaml'); + +const OWNER = 'openai'; +const REPO = 'openai-openapi'; +const BRANCH = 'main'; +const FILE = 'openapi.yaml'; + +const args = process.argv.slice(2); +const getArg = (flag) => { + const i = args.indexOf(flag); + return i !== -1 ? args[i + 1] : null; +}; + +async function ghJson(url) { + const res = await fetch(url, { headers: { accept: 'application/vnd.github+json', 'user-agent': 'stackql-provider-openai' } }); + if (!res.ok) throw new Error(`GET ${url} -> ${res.status}`); + return res.json(); +} + +async function resolveHead() { + const b = await ghJson(`https://api.github.com/repos/${OWNER}/${REPO}/branches/${BRANCH}`); + return { sha: b.commit.sha, date: b.commit.commit.committer.date }; +} + +async function main() { + if (args.includes('--check')) { + if (!existsSync(pinPath)) { + console.error('FAIL: no spec_pin.json to check against'); + process.exit(1); + } + const pin = JSON.parse(readFileSync(pinPath, 'utf8')); + const head = await resolveHead(); + if (head.sha === pin.ref) { + console.log(`OK: ${BRANCH} HEAD matches pin ${pin.ref}`); + return; + } + console.error(`DRIFT: ${BRANCH} HEAD is ${head.sha} (${head.date}); pin is ${pin.ref} (${pin.ref_date})`); + console.error('Refreshes are reviewed diffs: re-run fetch with --ref, diff provider-dev/downloaded/openapi.yaml, review, commit.'); + process.exit(2); + } + + let ref = getArg('--ref'); + let refDate = null; + if (ref) { + const c = await ghJson(`https://api.github.com/repos/${OWNER}/${REPO}/commits/${ref}`); + ref = c.sha; + refDate = c.commit.committer.date; + } else { + const head = await resolveHead(); + ref = head.sha; + refDate = head.date; + } + + const rawUrl = `https://raw.githubusercontent.com/${OWNER}/${REPO}/${ref}/${FILE}`; + console.log(`Downloading ${rawUrl}`); + const res = await fetch(rawUrl); + if (!res.ok) throw new Error(`GET ${rawUrl} -> ${res.status}`); + const text = await res.text(); + const sha256 = createHash('sha256').update(text).digest('hex'); + + const doc = yaml.load(text); + const pathCount = Object.keys(doc.paths || {}).length; + let opCount = 0; + const HTTP = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']; + for (const item of Object.values(doc.paths || {})) { + for (const v of HTTP) if (item[v]) opCount++; + } + + console.log('Validating with @apidevtools/swagger-parser ...'); + // validate() mutates its input while dereferencing; validate a deep copy so the pinned bytes stay canonical + await SwaggerParser.validate(structuredClone(doc)); + + const pin = { + source: `https://github.com/${OWNER}/${REPO}`, + artifact: FILE, + branch: BRANCH, + ref, + ref_date: refDate, + raw_url: rawUrl, + fetched_at: new Date().toISOString(), + sha256, + openapi_version: doc.openapi, + info_version: doc.info?.version ?? null, + info_title: doc.info?.title ?? null, + paths: pathCount, + operations: opCount, + }; + + mkdirSync(dirname(specPath), { recursive: true }); + mkdirSync(dirname(pinPath), { recursive: true }); + writeFileSync(specPath, text); + writeFileSync(pinPath, JSON.stringify(pin, null, 2) + '\n'); + console.log(`OK: openapi ${doc.openapi}, info.version ${pin.info_version}, ${pathCount} paths / ${opCount} operations`); + console.log(`Pinned ${ref} (${refDate}) sha256 ${sha256}`); + console.log(`Wrote ${specPath} and ${pinPath}`); +} + +main().catch((err) => { + console.error(`FAIL: ${err.message}; nothing written`); + process.exit(1); +}); diff --git a/provider-dev/scripts/inventory_predecessor.mjs b/provider-dev/scripts/inventory_predecessor.mjs new file mode 100644 index 0000000..3761815 --- /dev/null +++ b/provider-dev/scripts/inventory_predecessor.mjs @@ -0,0 +1,100 @@ +#!/usr/bin/env node +// Reads the v1 provider's generated service docs (website/docs/services///index.md) +// and writes provider-dev/config/predecessor_inventory.csv: one row per (service, resource, method). +// Deterministic; validates fully before writing - any unparseable resource page fails the run with no output. + +import { readdirSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs'; +import { join, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..'); +const docsRoot = join(repoRoot, 'website', 'docs', 'services'); +const outPath = join(repoRoot, 'provider-dev', 'config', 'predecessor_inventory.csv'); + +const VALID_VERBS = new Set(['SELECT', 'INSERT', 'UPDATE', 'REPLACE', 'DELETE', 'EXEC']); +const ROW_RE = /^\|\s*\s*\|\s*`([A-Z]+)`\s*\|\s*\s*\|(.*)\|\s*$/; + +const errors = []; +const rows = []; + +const services = readdirSync(docsRoot, { withFileTypes: true }) + .filter((d) => d.isDirectory()) + .map((d) => d.name) + .sort(); + +for (const service of services) { + const resources = readdirSync(join(docsRoot, service), { withFileTypes: true }) + .filter((d) => d.isDirectory()) + .map((d) => d.name) + .sort(); + if (resources.length === 0) errors.push(`${service}: no resource directories`); + for (const resource of resources) { + const page = join(docsRoot, service, resource, 'index.md'); + let text; + try { + text = readFileSync(page, 'utf8'); + } catch { + errors.push(`${service}.${resource}: missing index.md`); + continue; + } + const methodsIdx = text.indexOf('## Methods'); + if (methodsIdx === -1) { + errors.push(`${service}.${resource}: no "## Methods" section`); + continue; + } + const section = text.slice(methodsIdx).split(/\n## (?!Methods)/)[0]; + const lines = section.split('\n').filter((l) => l.startsWith('|')); + const dataLines = lines.filter((l) => !/^\|[:\s|-]+\|$/.test(l) && !/^\|\s*Name\s*\|/.test(l)); + if (dataLines.length === 0) { + errors.push(`${service}.${resource}: Methods table has no data rows`); + continue; + } + for (const line of dataLines) { + const m = line.match(ROW_RE); + if (!m) { + errors.push(`${service}.${resource}: unparseable Methods row: ${line}`); + continue; + } + const [, method, verb, params, desc] = m; + if (!VALID_VERBS.has(verb)) { + errors.push(`${service}.${resource}.${method}: unknown verb ${verb}`); + continue; + } + rows.push({ + service, + resource, + method, + verb, + required_params: params.trim(), + notes: desc.trim(), + }); + } + } +} + +if (errors.length) { + console.error(`FAIL: ${errors.length} validation error(s); nothing written`); + for (const e of errors) console.error(` - ${e}`); + process.exit(1); +} + +const csvEscape = (v) => (/[",\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v); +const header = 'service,resource,method,verb,required_params,notes'; +const body = rows.map((r) => + [r.service, r.resource, r.method, r.verb, r.required_params, r.notes].map(csvEscape).join(',') +); +mkdirSync(dirname(outPath), { recursive: true }); +writeFileSync(outPath, [header, ...body].join('\n') + '\n'); + +const byService = {}; +const byVerb = {}; +for (const r of rows) { + byService[r.service] = (byService[r.service] || 0) + 1; + byVerb[r.verb] = (byVerb[r.verb] || 0) + 1; +} +const resourceCount = new Set(rows.map((r) => `${r.service}.${r.resource}`)).size; +console.log(`Wrote ${rows.length} methods across ${resourceCount} resources in ${services.length} services -> ${outPath}`); +console.log('By service:'); +for (const [s, n] of Object.entries(byService).sort()) console.log(` ${s}: ${n}`); +console.log('By verb:'); +for (const [v, n] of Object.entries(byVerb).sort((a, b) => b[1] - a[1])) console.log(` ${v}: ${n}`); diff --git a/provider-dev/scripts/lower_residual_variants.mjs b/provider-dev/scripts/lower_residual_variants.mjs new file mode 100644 index 0000000..06662bb --- /dev/null +++ b/provider-dev/scripts/lower_residual_variants.mjs @@ -0,0 +1,105 @@ +#!/usr/bin/env node +// Stage 3 tail: lower any polymorphism the generic normalize leaves at a +// column-producing site (a request-body or 200-response schema root, or a direct +// property of one) to an honest relational representation. +// +// Why this is needed and safe. The provider-utils normalize renames oneOf/anyOf +// -> allOf only at component-schema roots, their direct properties, and +// request/response schema roots (shallow by design), then flattens allOf with a +// first-wins merge. That merge resolves the nullable idiom cleanly +// (`anyOf: [{realType}, {type: "null"}]` -> realType), so after normalize every +// nullable wrapper at a column site is gone. What can remain at a column site is +// therefore an irreducible union - a discriminated `oneOf` used as a field value +// (e.g. a conversation item's `environment`, either a local env or a container +// reference). A relational column cannot be a union, so it becomes a JSON-blob +// string column addressed with json_extract - the same posture normalize already +// applies to structureless objects (opaque object -> string). +// +// A union at a schema ROOT is different: normalize flattens it into a wide +// projectable schema (all members' fields merged), which is what we want, so +// roots are never lowered here. If a root still carries a raw variant keyword +// post-normalize that is a defect - the run fails loudly rather than silently +// collapsing a whole resource into one blob column. +// +// Deterministic, idempotent (a re-run finds nothing to do), and +// validate-and-fail-without-writing. +// Usage: node provider-dev/scripts/lower_residual_variants.mjs + +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; +import yaml from 'js-yaml'; + +const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..'); +const sourceDir = path.join(repoRoot, 'provider-dev', 'source'); +const HTTP_VERBS = ['get', 'post', 'put', 'delete', 'patch']; +const VARIANT_KEYS = ['oneOf', 'anyOf', 'allOf']; + +const hasVariant = (s) => s && typeof s === 'object' && VARIANT_KEYS.some((k) => Array.isArray(s[k])); + +const errors = []; +const lowered = []; + +const files = fs.readdirSync(sourceDir).filter((f) => f.endsWith('.yaml')).sort(); +const docs = {}; + +for (const filename of files) { + const doc = yaml.load(fs.readFileSync(path.join(sourceDir, filename), 'utf8')); + docs[filename] = doc; + const resolve = (ref) => (typeof ref === 'string' && ref.startsWith('#/') + ? ref.replace(/^#\//, '').split('/').reduce((o, k) => (o ? o[k] : undefined), doc) + : undefined); + const deref = (s) => (s && s.$ref ? resolve(s.$ref) : s); + + const lowerProperty = (propSchema, where) => { + // preserve the human description; replace everything else with a JSON-blob column + const description = propSchema.description; + for (const k of Object.keys(propSchema)) delete propSchema[k]; + propSchema.type = 'string'; + propSchema.format = 'json'; + if (description) propSchema.description = description; + lowered.push(where); + }; + + const checkSite = (rawSchema, where) => { + const schema = deref(rawSchema); + if (!schema || typeof schema !== 'object') return; + if (hasVariant(schema)) { + errors.push(`${where}: variant keyword at schema ROOT after normalize (would collapse the whole resource) - investigate, do not auto-lower`); + return; + } + if (!schema.properties || typeof schema.properties !== 'object') return; + for (const [propName, propRaw] of Object.entries(schema.properties)) { + const prop = deref(propRaw); + if (hasVariant(prop)) lowerProperty(prop, `${where}.${propName}`); + } + }; + + for (const [pathKey, pathItem] of Object.entries(doc.paths || {})) { + for (const verb of HTTP_VERBS) { + const op = pathItem[verb]; + if (!op) continue; + const rb = op.requestBody?.content?.['application/json']?.schema; + if (rb) checkSite(rb, `${filename} ${verb.toUpperCase()} ${pathKey} request`); + const rs = op.responses?.['200']?.content?.['application/json']?.schema; + if (rs) checkSite(rs, `${filename} ${verb.toUpperCase()} ${pathKey} response`); + } + } +} + +if (errors.length) { + console.error(`FAIL: ${errors.length} unexpected root-level variant(s); nothing written`); + for (const e of errors) console.error(` - ${e}`); + process.exit(1); +} + +for (const filename of files) { + fs.writeFileSync(path.join(sourceDir, filename), yaml.dump(docs[filename], { lineWidth: -1, noRefs: true }), 'utf8'); +} + +if (lowered.length === 0) { + console.log('No residual column-site variants; nothing to lower (normalize covered every column boundary).'); +} else { + console.log(`Lowered ${lowered.length} residual column-site union(s) to JSON-blob string columns:`); + for (const w of lowered) console.log(` ${w}`); +} diff --git a/provider-dev/scripts/map_operations.mjs b/provider-dev/scripts/map_operations.mjs new file mode 100644 index 0000000..a386670 --- /dev/null +++ b/provider-dev/scripts/map_operations.mjs @@ -0,0 +1,159 @@ +#!/usr/bin/env node +// Populates stackql_resource_name, stackql_method_name, stackql_verb and +// stackql_object_key in provider-dev/config/all_services.csv. The rule table is +// provider-dev/config/endpoint_inventory.csv (built by build_inventory.mjs) joined +// by operationId - one deterministic source of truth for the mapping. +// +// Validations (all must pass or nothing is written): +// - coverage both directions (every CSV op has an inventory rule; every inventory +// rule matches a CSV op) +// - unique (service, resource, method) keys +// - unique path-param signatures per (service, resource, sqlVerb), exec excluded +// - list methods carry an object key +// - disposition consistency: every carried/renamed predecessor entry resolves to +// a mapped (service.resource, method) produced here - no v1 survivor dangles +// +// Usage: node provider-dev/scripts/map_operations.mjs + +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..'); +const cfg = (f) => path.join(repoRoot, 'provider-dev', 'config', f); +const csvPath = cfg('all_services.csv'); + +function parseCsvRows(text) { + const rows = []; + let row = [], field = '', inQuotes = false; + for (let i = 0; i < text.length; i++) { + const c = text[i]; + if (inQuotes) { + if (c === '"') { + if (text[i + 1] === '"') { field += '"'; i++; } else { inQuotes = false; } + } else field += c; + } else if (c === '"') inQuotes = true; + else if (c === ',') { row.push(field); field = ''; } + else if (c === '\n' || c === '\r') { + if (c === '\r' && text[i + 1] === '\n') i++; + row.push(field); field = ''; + if (row.length > 1 || row[0] !== '') rows.push(row); + row = []; + } else field += c; + } + if (field !== '' || row.length > 0) { row.push(field); rows.push(row); } + return rows; +} +const csvField = (v) => (/[",\n\r]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v); +const toObjects = (rows) => { + const cols = rows[0]; + return rows.slice(1).map((r) => Object.fromEntries(cols.map((c, i) => [c, r[i] ?? '']))); +}; + +const inventory = toObjects(parseCsvRows(fs.readFileSync(cfg('endpoint_inventory.csv'), 'utf8'))); +const dispositions = toObjects(parseCsvRows(fs.readFileSync(cfg('predecessor_dispositions.csv'), 'utf8'))); + +const invByOpId = new Map(); +for (const r of inventory) invByOpId.set(r.operation_id, r); + +const rows = parseCsvRows(fs.readFileSync(csvPath, 'utf8')); +const header = rows[0]; +const col = Object.fromEntries(header.map((h, i) => [h, i])); +for (const required of ['filename', 'path', 'verb', 'operationId', 'stackql_resource_name', 'stackql_method_name', 'stackql_verb', 'stackql_object_key']) { + if (!(required in col)) { + console.error(`FAIL: missing expected CSV column: ${required}`); + process.exit(1); + } +} + +const errors = []; +const seenOpIds = new Set(); +const stats = { mapped: 0, skipped: 0, exec: 0 }; + +for (const row of rows.slice(1)) { + const opId = row[col.operationId]; + seenOpIds.add(opId); + const inv = invByOpId.get(opId); + if (!inv) { + errors.push(`${row[col.filename]} ${row[col.verb]} ${row[col.path]}: no inventory rule for operationId ${opId}`); + continue; + } + const service = row[col.filename].replace(/\.yaml$/, ''); + if (inv.service !== service) { + errors.push(`${opId}: inventory says service ${inv.service}, split says ${service}`); + continue; + } + if (inv.skip_reason) { + row[col.stackql_resource_name] = 'skip_this_resource'; + row[col.stackql_method_name] = ''; + row[col.stackql_verb] = ''; + row[col.stackql_object_key] = ''; + stats.skipped++; + continue; + } + row[col.stackql_resource_name] = inv.resource; + row[col.stackql_method_name] = inv.method; + row[col.stackql_verb] = inv.sql_verb; + row[col.stackql_object_key] = inv.method === 'list' ? inv.object_key : ''; + if (inv.sql_verb === 'exec') stats.exec++; else stats.mapped++; +} + +// coverage: every inventory rule must have matched a CSV row +for (const r of inventory) { + if (!seenOpIds.has(r.operation_id)) errors.push(`inventory rule ${r.operation_id} matches no all_services.csv row`); +} + +// uniqueness gates +const pathParams = (p) => (p.match(/\{[^}]+\}/g) || []).map((s) => s.slice(1, -1)); +const methodSeen = new Map(); +const sigSeen = new Map(); +const mappedMethodKeys = new Set(); +for (const row of rows.slice(1)) { + const resource = row[col.stackql_resource_name]; + if (!resource || resource === 'skip_this_resource') continue; + const service = row[col.filename].replace(/\.yaml$/, ''); + const methodKey = `${service}.${resource}.${row[col.stackql_method_name]}`; + if (methodSeen.has(methodKey)) errors.push(`duplicate method ${methodKey} (${methodSeen.get(methodKey)} and ${row[col.path]}:${row[col.verb]})`); + methodSeen.set(methodKey, `${row[col.path]}:${row[col.verb]}`); + mappedMethodKeys.add(methodKey); + const sqlVerb = row[col.stackql_verb]; + if (row[col.stackql_method_name] === 'list' && !row[col.stackql_object_key]) errors.push(`${methodKey}: list method without object key`); + if (sqlVerb === 'exec') continue; + const sig = pathParams(row[col.path]).sort().join(','); + const sigKey = `${service}.${resource}.${sqlVerb}::${sig}`; + if (sigSeen.has(sigKey)) errors.push(`signature clash on ${service}.${resource} ${sqlVerb} [${sig}] (${sigSeen.get(sigKey)} and ${row[col.stackql_method_name]})`); + sigSeen.set(sigKey, row[col.stackql_method_name]); +} + +// disposition consistency: every surviving v1 method resolves to a mapped method here +for (const d of dispositions) { + if (d.disposition !== 'carried' && d.disposition !== 'renamed') continue; + const key = `${d.new_fqn.replace(/^openai\./, '')}.${d.new_method}`; + if (!mappedMethodKeys.has(key)) errors.push(`disposition ${d.old_fqn}.${d.method} -> ${key} has no mapped method`); +} + +if (errors.length > 0) { + console.error(`FAIL: ${errors.length} error(s); nothing written`); + for (const e of errors) console.error(` ${e}`); + process.exit(1); +} + +fs.writeFileSync(csvPath, rows.map((r) => r.map(csvField).join(',')).join('\n') + '\n'); + +const resourcesByService = new Map(); +const verbCounts = {}; +for (const row of rows.slice(1)) { + const resource = row[col.stackql_resource_name]; + if (!resource || resource === 'skip_this_resource') continue; + const service = row[col.filename].replace(/\.yaml$/, ''); + if (!resourcesByService.has(service)) resourcesByService.set(service, new Set()); + resourcesByService.get(service).add(resource); + verbCounts[row[col.stackql_verb]] = (verbCounts[row[col.stackql_verb]] || 0) + 1; +} +console.log(`Mapped ${stats.mapped} operations to CRUD verbs, ${stats.exec} to exec, ${stats.skipped} skipped`); +console.log('By SQL verb:', Object.entries(verbCounts).sort().map(([k, v]) => `${k} ${v}`).join(', ')); +console.log('Resources per service:'); +for (const [service, resources] of [...resourcesByService.entries()].sort()) { + console.log(` ${service}: ${resources.size} (${[...resources].sort().join(', ')})`); +} +console.log(`Total resources: ${[...resourcesByService.values()].reduce((n, s) => n + s.size, 0)}`); diff --git a/provider-dev/scripts/pre_normalize.mjs b/provider-dev/scripts/pre_normalize.mjs new file mode 100644 index 0000000..2002054 --- /dev/null +++ b/provider-dev/scripts/pre_normalize.mjs @@ -0,0 +1,228 @@ +#!/usr/bin/env node +// OpenAI-specific spec adjustments applied to provider-dev/source before the +// generic `npm run normalize` pass. This is the seam for mutations the generic +// normalizer cannot infer; it runs first so its edits flow through the flatten +// and on into generate. +// +// Job 1: inject the optional org/project scoping headers. +// The pinned spec declares neither OpenAI-Organization nor OpenAI-Project on +// any operation, but both are valid on every request. They are added as +// `required: false` header parameters so they surface as optional query +// parameters, never in required params. +// +// Job 2: carry the assistants-family deprecation, driven by the endpoint +// inventory. The vendor flags only the five /assistants CRUD operations +// `deprecated: true`, but the whole Assistants family (threads, messages, +// runs, run steps) carries the migration-to-Responses deprecation. The +// inventory records that decision per operation (the `deprecated` column, +// `spec` or `family-rule`); this stamps `deprecated: true` on every operation +// the inventory marks, so the label is uniform and flows into the generated +// provider and its docs. +// +// Job 3 (contingent): downgrade any openapi 3.1.0 construct the normalizer or +// generator cannot consume. The pinned spec does NOT use the 3.1 array-type +// nullable form (`type: [x, "null"]`) - verified below - and its +// `anyOf: [{realType}, {type: "null"}]` idiom flattens safely under the +// normalizer's first-wins merge (the real type is always the first member). +// So no rewrite is needed against this pin; the guard fails the run if the +// array-type form ever appears in a spec refresh, so the downgrade is written +// deliberately rather than discovered during generate. +// +// Deterministic and re-runnable; validate-and-fail-without-writing. +// Usage: node provider-dev/scripts/pre_normalize.mjs + +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; +import yaml from 'js-yaml'; + +const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..'); +const sourceDir = path.join(repoRoot, 'provider-dev', 'source'); +const inventoryPath = path.join(repoRoot, 'provider-dev', 'config', 'endpoint_inventory.csv'); + +const HTTP_VERBS = ['get', 'post', 'put', 'delete', 'patch', 'options', 'head', 'trace']; + +// Declared in lowercase kebab-case, not the vendor's `OpenAI-Organization` +// spelling. HTTP field names are case-insensitive (RFC 7230 s3.2), so +// `openai-organization` is the same header on the wire, but the lowercase kebab +// form is what any-sdk's reverse-casing lookup can reach: with +// `request.nativeCasing: kebab` (stamped by post_process.mjs), a snake_case SQL +// key resolves via casing.FromSnake(key, 'kebab') -> `openai-organization`. That +// lets users write `WHERE openai_organization = '...'` unquoted, instead of +// quoting `"OpenAI-Organization"`. The botocore-derived ToSnake alias path cannot +// help here: it does not handle hyphens (ToSnake('OpenAI-Organization') yields +// the mangled 'open_ai-_organization'). +const ORG_PROJECT_HEADERS = [ + { + name: 'openai-organization', + in: 'header', + required: false, + description: + 'Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.', + schema: { type: 'string' }, + }, + { + name: 'openai-project', + in: 'header', + required: false, + description: + 'Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.', + schema: { type: 'string' }, + }, +]; + +// operationIds the inventory marks deprecated (spec-flagged or family-rule). +function loadDeprecatedOpIds() { + const text = fs.readFileSync(inventoryPath, 'utf8').trim().split('\n'); + const header = text[0].split(','); + const opIdx = header.indexOf('operation_id'); + const depIdx = header.indexOf('deprecated'); + if (opIdx === -1 || depIdx === -1) throw new Error('endpoint_inventory.csv missing operation_id/deprecated columns'); + const set = new Set(); + for (const line of text.slice(1)) { + // no quoted commas in these two columns, simple split is safe for them + const cols = line.split(','); + if (cols[depIdx] && cols[depIdx].trim() !== '') set.add(cols[opIdx].trim()); + } + return set; +} + +// Guard: the array-type nullable form is the one 3.1 construct that would need a +// deterministic downgrade. Detect it so a spec refresh cannot slip it past +// normalize silently. +function findArrayTypeNullable(node, at, hits) { + if (Array.isArray(node)) { + node.forEach((n, i) => findArrayTypeNullable(n, `${at}[${i}]`, hits)); + return; + } + if (node && typeof node === 'object') { + if (Array.isArray(node.type) && node.type.includes('null')) hits.push(at); + for (const [k, v] of Object.entries(node)) findArrayTypeNullable(v, `${at}.${k}`, hits); + } +} + +const errors = []; +const deprecatedOpIds = loadDeprecatedOpIds(); +const files = fs.readdirSync(sourceDir).filter((f) => f.endsWith('.yaml')).sort(); +if (files.length === 0) errors.push('no service specs in provider-dev/source'); + +let headersInjected = 0; +let opsTouched = 0; +let deprecatedStamped = 0; +let binaryPropsStripped = 0; +let limitAnnotated = 0; +const perFile = {}; +const docs = {}; + +// Appended to every `limit` query parameter description. `limit` is wired to the +// `top` query-param pushdown at generate time, so `SELECT ... LIMIT n` sets it on +// the wire; users should not hand-write `WHERE limit = n`. +const LIMIT_NOTE = + 'Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.'; +const LIMIT_NOTE_RE = /Automatically applied from a SQL/; + +// A request-body property is a binary upload if its schema declares +// `format: binary` anywhere (directly, in array items, or in a oneOf member). +const isBinaryProp = (v) => v && typeof v === 'object' && JSON.stringify(v).includes('"binary"'); + +// Strip binary upload properties from a request-body schema. any-sdk marshals +// only JSON/XML request bodies (operation_store.go marshalBody), so a binary +// property is never a functional column/param. Remove it and drop it from +// `required`. Operations whose sole body is a required binary upload with no +// non-binary alternative are skipped at the inventory level; this cleans the rest +// (e.g. container file create stays usable via the non-binary file_id). +function stripBinaryFromSchema(schema, resolve, seen) { + const s = schema && schema.$ref ? resolve(schema.$ref) : schema; + if (!s || typeof s !== 'object' || !s.properties || seen.has(s)) return 0; + seen.add(s); + let removed = 0; + for (const [k, v] of Object.entries(s.properties)) { + if (isBinaryProp(v)) { + delete s.properties[k]; + if (Array.isArray(s.required)) s.required = s.required.filter((r) => r !== k); + removed++; + } + } + return removed; +} + +for (const filename of files) { + const filePath = path.join(sourceDir, filename); + const doc = yaml.load(fs.readFileSync(filePath, 'utf8')); + docs[filename] = doc; + + const nullHits = []; + findArrayTypeNullable(doc.paths || {}, 'paths', nullHits); + findArrayTypeNullable(doc.components || {}, 'components', nullHits); + if (nullHits.length) { + errors.push(`${filename}: ${nullHits.length} array-type nullable site(s) (3.1 downgrade rule needed): ${nullHits.slice(0, 3).join(', ')}${nullHits.length > 3 ? ' ...' : ''}`); + } + + let fileHeaders = 0; + for (const [, pathItem] of Object.entries(doc.paths || {})) { + for (const verb of HTTP_VERBS) { + const op = pathItem[verb]; + if (!op || typeof op !== 'object') continue; + + if (!Array.isArray(op.parameters)) op.parameters = []; + const present = new Set(op.parameters.filter((p) => p && p.in === 'header').map((p) => p.name)); + let added = 0; + for (const h of ORG_PROJECT_HEADERS) { + if (!present.has(h.name)) { + op.parameters.push(structuredClone(h)); + added++; + } + } + if (added) { + opsTouched++; + fileHeaders += added; + headersInjected += added; + } + + if (op.operationId && deprecatedOpIds.has(op.operationId) && op.deprecated !== true) { + op.deprecated = true; + deprecatedStamped++; + } + + // Annotate the `limit` query parameter: it is the page-size parameter wired + // to the `top` query-param pushdown at generate time, so a SQL LIMIT clause + // supplies it automatically. The docs drop it from the example WHERE clauses + // (sanitize_docs.mjs) but keep the row in the params table, where this note + // is what the reader sees. + for (const p of op.parameters) { + const param = p && p.$ref ? undefined : p; + if (param && param.in === 'query' && param.name === 'limit' && !LIMIT_NOTE_RE.test(param.description || '')) { + param.description = `${(param.description || '').trim()}\n\n${LIMIT_NOTE}`.trim(); + limitAnnotated++; + } + } + + const content = op.requestBody?.content; + if (content && typeof content === 'object') { + const resolve = (ref) => ref.replace(/^#\//, '').split('/').reduce((o, kk) => (o ? o[kk] : undefined), doc); + const seen = new Set(); + for (const mt of Object.values(content)) { + if (mt?.schema) binaryPropsStripped += stripBinaryFromSchema(mt.schema, resolve, seen); + } + } + } + } + perFile[filename] = fileHeaders; +} + +if (errors.length) { + console.error(`FAIL: ${errors.length} pre-normalize issue(s); nothing written`); + for (const e of errors) console.error(` - ${e}`); + process.exit(1); +} + +for (const filename of files) { + fs.writeFileSync(path.join(sourceDir, filename), yaml.dump(docs[filename], { lineWidth: -1, noRefs: true }), 'utf8'); +} + +console.log(`Injected ${headersInjected} org/project header parameter(s) across ${opsTouched} operations in ${files.length} spec(s):`); +for (const [f, n] of Object.entries(perFile).sort()) console.log(` ${f}: ${n}`); +console.log(`Stamped deprecated: true on ${deprecatedStamped} operation(s) not already flagged upstream (${deprecatedOpIds.size} deprecated per the inventory).`); +console.log(`Stripped ${binaryPropsStripped} binary (format:binary) request-body property(ies) - not marshalable by any-sdk (JSON/XML only).`); +console.log(`Annotated ${limitAnnotated} \`limit\` query parameter(s) as SQL-LIMIT driven (the top pushdown).`); +console.log('No openapi 3.1.0 array-type nullable sites found; no downgrade needed against this pin.'); diff --git a/provider-dev/source/.gitkeep b/provider-dev/source/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/provider-dev/source/assistants.yaml b/provider-dev/source/assistants.yaml new file mode 100644 index 0000000..6548434 --- /dev/null +++ b/provider-dev/source/assistants.yaml @@ -0,0 +1,7426 @@ +openapi: 3.1.0 +info: + title: assistants API + description: openai API + version: 2.3.0 +paths: + /assistants: + get: + operationId: listAssistants + tags: + - Assistants + summary: Returns a list of assistants. + deprecated: true + parameters: + - name: limit + in: query + description: |- + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListAssistantsResponse' + x-oaiMeta: + name: List assistants + group: assistants + examples: + request: + curl: | + curl "https://api.openai.com/v1/assistants?order=desc&limit=20" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.assistants.list() + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistants = await openai.beta.assistants.list({ + order: "desc", + limit: "20", + }); + + console.log(myAssistants.data); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const assistant of client.beta.assistants.list()) { + console.log(assistant.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Assistants.List(context.TODO(), openai.BetaAssistantListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.AssistantListPage; + import com.openai.models.beta.assistants.AssistantListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantListPage page = client.beta().assistants().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.assistants.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698982736, + "name": "Coding Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc456", + "object": "assistant", + "created_at": 1698982718, + "name": "My Assistant", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc789", + "object": "assistant", + "created_at": 1698982643, + "name": null, + "description": null, + "model": "gpt-4o", + "instructions": null, + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + ], + "first_id": "asst_abc123", + "last_id": "asst_abc789", + "has_more": false + } + post: + operationId: createAssistant + tags: + - Assistants + summary: Create an assistant with a model and instructions. + deprecated: true + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAssistantRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantObject' + x-oaiMeta: + name: Create assistant + group: assistants + examples: + - title: Code Interpreter + request: + curl: | + curl "https://api.openai.com/v1/assistants" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "name": "Math Tutor", + "tools": [{"type": "code_interpreter"}], + "model": "gpt-4o" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.create( + model="gpt-4o", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.create({ + instructions: + "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + name: "Math Tutor", + tools: [{ type: "code_interpreter" }], + model: "gpt-4o", + }); + + console.log(myAssistant); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const assistant = await client.beta.assistants.create({ model: 'gpt-4o' }); + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{\n\t\tModel: shared.ChatModelGPT4o,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.ChatModel; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantCreateParams params = AssistantCreateParams.builder() + .model(ChatModel.GPT_4O) + .build(); + Assistant assistant = client.beta().assistants().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.create(model: :"gpt-4o") + + puts(assistant) + response: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698984975, + "name": "Math Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + - title: Files + request: + curl: | + curl https://api.openai.com/v1/assistants \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [{"type": "file_search"}], + "tool_resources": {"file_search": {"vector_store_ids": ["vs_123"]}}, + "model": "gpt-4o" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.create( + model="gpt-4o", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.create({ + instructions: + "You are an HR bot, and you have access to files to answer employee questions about company policies.", + name: "HR Helper", + tools: [{ type: "file_search" }], + tool_resources: { + file_search: { + vector_store_ids: ["vs_123"] + } + }, + model: "gpt-4o" + }); + + console.log(myAssistant); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const assistant = await client.beta.assistants.create({ model: 'gpt-4o' }); + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{\n\t\tModel: shared.ChatModelGPT4o,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.ChatModel; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantCreateParams params = AssistantCreateParams.builder() + .model(ChatModel.GPT_4O) + .build(); + Assistant assistant = client.beta().assistants().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.create(model: :"gpt-4o") + + puts(assistant) + response: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1699009403, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": ["vs_123"] + } + }, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + /assistants/{assistant_id}: + get: + operationId: getAssistant + tags: + - Assistants + summary: Retrieves an assistant. + deprecated: true + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to retrieve. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantObject' + x-oaiMeta: + name: Retrieve assistant + group: assistants + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.retrieve( + "assistant_id", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.retrieve( + "asst_abc123" + ); + + console.log(myAssistant); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const assistant = await client.beta.assistants.retrieve('assistant_id'); + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.Get(context.TODO(), \"assistant_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Assistant assistant = client.beta().assistants().retrieve("assistant_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.retrieve("assistant_id") + + puts(assistant) + response: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1699009709, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [ + { + "type": "file_search" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + post: + operationId: modifyAssistant + tags: + - Assistants + summary: Modifies an assistant. + deprecated: true + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to modify. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyAssistantRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantObject' + x-oaiMeta: + name: Modify assistant + group: assistants + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "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.", + "tools": [{"type": "file_search"}], + "model": "gpt-4o" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant = client.beta.assistants.update( + assistant_id="assistant_id", + ) + print(assistant.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myUpdatedAssistant = await openai.beta.assistants.update( + "asst_abc123", + { + 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.", + name: "HR Helper", + tools: [{ type: "file_search" }], + model: "gpt-4o" + } + ); + + console.log(myUpdatedAssistant); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const assistant = await client.beta.assistants.update('assistant_id'); + + console.log(assistant.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistant, err := client.Beta.Assistants.Update(\n\t\tcontext.TODO(),\n\t\t\"assistant_id\",\n\t\topenai.BetaAssistantUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistant.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.Assistant; + import com.openai.models.beta.assistants.AssistantUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Assistant assistant = client.beta().assistants().update("assistant_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant = openai.beta.assistants.update("assistant_id") + + puts(assistant) + response: | + { + "id": "asst_123", + "object": "assistant", + "created_at": 1699009709, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "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.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": [] + } + }, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + delete: + operationId: deleteAssistant + tags: + - Assistants + summary: Delete an assistant. + deprecated: true + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to delete. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAssistantResponse' + x-oaiMeta: + name: Delete assistant + group: assistants + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + assistant_deleted = client.beta.assistants.delete( + "assistant_id", + ) + print(assistant_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const response = await openai.beta.assistants.delete("asst_abc123"); + + console.log(response); + } + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const assistantDeleted = await client.beta.assistants.delete('assistant_id'); + + console.log(assistantDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tassistantDeleted, err := client.Beta.Assistants.Delete(context.TODO(), \"assistant_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", assistantDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.assistants.AssistantDeleteParams; + import com.openai.models.beta.assistants.AssistantDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + AssistantDeleted assistantDeleted = client.beta().assistants().delete("assistant_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + assistant_deleted = openai.beta.assistants.delete("assistant_id") + + puts(assistant_deleted) + response: | + { + "id": "asst_abc123", + "object": "assistant.deleted", + "deleted": true + } + /threads: + post: + operationId: createThread + tags: + - Assistants + summary: Create a thread. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateThreadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadObject' + x-oaiMeta: + name: Create thread + group: threads + beta: true + examples: + - title: Empty + request: + curl: | + curl https://api.openai.com/v1/threads \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.create() + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const emptyThread = await openai.beta.threads.create(); + + console.log(emptyThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.create(); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.New(context.TODO(), openai.BetaThreadNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.create + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699012949, + "metadata": {}, + "tool_resources": {} + } + - title: Messages + request: + curl: | + curl https://api.openai.com/v1/threads \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "messages": [{ + "role": "user", + "content": "Hello, what is AI?" + }, { + "role": "user", + "content": "How does AI work? Explain it in simple terms." + }] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.create() + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const messageThread = await openai.beta.threads.create({ + messages: [ + { + role: "user", + content: "Hello, what is AI?" + }, + { + role: "user", + content: "How does AI work? Explain it in simple terms.", + }, + ], + }); + + console.log(messageThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.create(); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.New(context.TODO(), openai.BetaThreadNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.create + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": {}, + "tool_resources": {} + } + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + deprecated: true + /threads/runs: + post: + operationId: createThreadAndRun + tags: + - Assistants + summary: Create a thread and run it in one request. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateThreadAndRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Create thread and run + group: threads + beta: true + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "thread": { + "messages": [ + {"role": "user", "content": "Explain deep learning to a 5 year old."} + ] + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for thread in client.beta.threads.create_and_run( + assistant_id="assistant_id", + ): + print(thread) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.createAndRun({ + assistant_id: "asst_abc123", + thread: { + messages: [ + { role: "user", content: "Explain deep learning to a 5 year old." }, + ], + }, + }); + + console.log(run); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.createAndRun({ assistant_id: 'assistant_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.NewAndRun(context.TODO(), openai.BetaThreadNewAndRunParams{\n\t\tAssistantID: \"assistant_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadCreateAndRunParams; + import com.openai.models.beta.threads.runs.Run; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadCreateAndRunParams params = ThreadCreateAndRunParams.builder() + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().createAndRun(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.create_and_run(assistant_id: "assistant_id") + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699076792, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "queued", + "started_at": null, + "expires_at": 1699077392, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4o", + "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", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_123", + "thread": { + "messages": [ + {"role": "user", "content": "Hello"} + ] + }, + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for thread in client.beta.threads.create_and_run( + assistant_id="assistant_id", + ): + print(thread) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.createAndRun({ + assistant_id: "asst_123", + thread: { + messages: [ + { role: "user", content: "Hello" }, + ], + }, + stream: true + }); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.createAndRun({ assistant_id: 'assistant_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.NewAndRun(context.TODO(), openai.BetaThreadNewAndRunParams{\n\t\tAssistantID: \"assistant_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadCreateAndRunParams; + import com.openai.models.beta.threads.runs.Run; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadCreateAndRunParams params = ThreadCreateAndRunParams.builder() + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().createAndRun(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.create_and_run(assistant_id: "assistant_id") + + puts(run) + response: | + event: thread.created + data: {"id":"thread_123","object":"thread","created_at":1710348075,"metadata":{}} + + event: thread.run.created + data: {"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-4o","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} + + event: thread.run.queued + data: {"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-4o","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} + + event: thread.run.in_progress + data: {"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-4o","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} + + event: thread.run.step.created + data: {"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} + + event: thread.run.step.in_progress + data: {"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} + + event: thread.message.created + data: {"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":{}} + + event: thread.message.in_progress + data: {"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":{}} + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + ... + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}} + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + event: thread.message.completed + data: {"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":{}} + + event: thread.run.step.completed + data: {"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}} + + event: thread.run.completed + {"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-4o","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} + + event: done + data: [DONE] + - title: Streaming with Functions + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "thread": { + "messages": [ + {"role": "user", "content": "What is the weather like in San Francisco?"} + ] + }, + "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"] + } + } + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for thread in client.beta.threads.create_and_run( + assistant_id="assistant_id", + ): + print(thread) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const 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"], + }, + } + } + ]; + + async function main() { + const stream = await openai.beta.threads.createAndRun({ + assistant_id: "asst_123", + thread: { + messages: [ + { role: "user", content: "What is the weather like in San Francisco?" }, + ], + }, + tools: tools, + stream: true + }); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.createAndRun({ assistant_id: 'assistant_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.NewAndRun(context.TODO(), openai.BetaThreadNewAndRunParams{\n\t\tAssistantID: \"assistant_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadCreateAndRunParams; + import com.openai.models.beta.threads.runs.Run; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadCreateAndRunParams params = ThreadCreateAndRunParams.builder() + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().createAndRun(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.create_and_run(assistant_id: "assistant_id") + + puts(run) + response: | + event: thread.created + data: {"id":"thread_123","object":"thread","created_at":1710351818,"metadata":{}} + + event: thread.run.created + data: {"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-4o","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}} + + event: thread.run.queued + data: {"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-4o","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}} + + event: thread.run.in_progress + data: {"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-4o","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}} + + event: thread.run.step.created + data: {"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} + + event: thread.run.step.in_progress + data: {"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} + + event: thread.run.step.delta + data: {"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}}]}}} + + event: thread.run.step.delta + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]}}} + + event: thread.run.step.delta + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"location"}}]}}} + + ... + + event: thread.run.step.delta + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"ahrenheit"}}]}}} + + event: thread.run.step.delta + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]}}} + + event: thread.run.requires_action + data: {"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-4o","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}} + + event: done + data: [DONE] + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + deprecated: true + /threads/{thread_id}: + get: + operationId: getThread + tags: + - Assistants + summary: Retrieves a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to retrieve. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadObject' + x-oaiMeta: + name: Retrieve thread + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.retrieve( + "thread_id", + ) + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myThread = await openai.beta.threads.retrieve( + "thread_abc123" + ); + + console.log(myThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.retrieve('thread_id'); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.Get(context.TODO(), \"thread_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().retrieve("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.retrieve("thread_id") + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": {}, + "tool_resources": { + "code_interpreter": { + "file_ids": [] + } + } + } + deprecated: true + post: + operationId: modifyThread + tags: + - Assistants + summary: Modifies a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to modify. Only the `metadata` can be modified. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyThreadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadObject' + x-oaiMeta: + name: Modify thread + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "modified": "true", + "user": "abc123" + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread = client.beta.threads.update( + thread_id="thread_id", + ) + print(thread.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const updatedThread = await openai.beta.threads.update( + "thread_abc123", + { + metadata: { modified: "true", user: "abc123" }, + } + ); + + console.log(updatedThread); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const thread = await client.beta.threads.update('thread_id'); + + console.log(thread.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthread, err := client.Beta.Threads.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", thread.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.Thread; + import com.openai.models.beta.threads.ThreadUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Thread thread = client.beta().threads().update("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread = openai.beta.threads.update("thread_id") + + puts(thread) + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": { + "modified": "true", + "user": "abc123" + }, + "tool_resources": {} + } + deprecated: true + delete: + operationId: deleteThread + tags: + - Assistants + summary: Delete a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to delete. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteThreadResponse' + x-oaiMeta: + name: Delete thread + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + thread_deleted = client.beta.threads.delete( + "thread_id", + ) + print(thread_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const response = await openai.beta.threads.delete("thread_abc123"); + + console.log(response); + } + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const threadDeleted = await client.beta.threads.delete('thread_id'); + + console.log(threadDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tthreadDeleted, err := client.Beta.Threads.Delete(context.TODO(), \"thread_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", threadDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.ThreadDeleteParams; + import com.openai.models.beta.threads.ThreadDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ThreadDeleted threadDeleted = client.beta().threads().delete("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + thread_deleted = openai.beta.threads.delete("thread_id") + + puts(thread_deleted) + response: | + { + "id": "thread_abc123", + "object": "thread.deleted", + "deleted": true + } + deprecated: true + /threads/{thread_id}/messages: + get: + operationId: listMessages + tags: + - Assistants + summary: Returns a list of messages for a given thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) the messages belong to. + - name: limit + in: query + description: |- + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + - name: run_id + in: query + description: | + Filter messages by the run ID that generated them. + schema: + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListMessagesResponse' + x-oaiMeta: + name: List messages + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.threads.messages.list( + thread_id="thread_id", + ) + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const threadMessages = await openai.beta.threads.messages.list( + "thread_abc123" + ); + + console.log(threadMessages.data); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const message of client.beta.threads.messages.list('thread_id')) { + console.log(message.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Threads.Messages.List(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadMessageListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.messages.MessageListPage; + import com.openai.models.beta.threads.messages.MessageListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageListPage page = client.beta().threads().messages().list("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.threads.messages.list("thread_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699016383, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + }, + { + "id": "msg_abc456", + "object": "thread.message", + "created_at": 1699016383, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Hello, what is AI?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + ], + "first_id": "msg_abc123", + "last_id": "msg_abc456", + "has_more": false + } + deprecated: true + post: + operationId: createMessage + tags: + - Assistants + summary: Create a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) to create a message for. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateMessageRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MessageObject' + x-oaiMeta: + name: Create message + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "role": "user", + "content": "How does AI work? Explain it in simple terms." + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message = client.beta.threads.messages.create( + thread_id="thread_id", + content="string", + role="user", + ) + print(message.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const threadMessages = await openai.beta.threads.messages.create( + "thread_abc123", + { role: "user", content: "How does AI work? Explain it in simple terms." } + ); + + console.log(threadMessages); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const message = await client.beta.threads.messages.create('thread_id', { + content: 'string', + role: 'user', + }); + + console.log(message.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.Beta.Threads.Messages.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadMessageNewParams{\n\t\t\tContent: openai.BetaThreadMessageNewParamsContentUnion{\n\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t},\n\t\t\tRole: openai.BetaThreadMessageNewParamsRoleUser,\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.messages.Message; + import com.openai.models.beta.threads.messages.MessageCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageCreateParams params = MessageCreateParams.builder() + .threadId("thread_id") + .content("string") + .role(MessageCreateParams.Role.USER) + .build(); + Message message = client.beta().threads().messages().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + message = openai.beta.threads.messages.create("thread_id", content: "string", role: :user) + + puts(message) + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1713226573, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + deprecated: true + /threads/{thread_id}/messages/{message_id}: + get: + operationId: getMessage + tags: + - Assistants + summary: Retrieve a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) to which this message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to retrieve. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MessageObject' + x-oaiMeta: + name: Retrieve message + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message = client.beta.threads.messages.retrieve( + message_id="message_id", + thread_id="thread_id", + ) + print(message.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const message = await openai.beta.threads.messages.retrieve( + "msg_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(message); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const message = await client.beta.threads.messages.retrieve('message_id', { + thread_id: 'thread_id', + }); + + console.log(message.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.Beta.Threads.Messages.Get(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"message_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.messages.Message; + import com.openai.models.beta.threads.messages.MessageRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageRetrieveParams params = MessageRetrieveParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + Message message = client.beta().threads().messages().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + message = openai.beta.threads.messages.retrieve("message_id", thread_id: "thread_id") + + puts(message) + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699017614, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + deprecated: true + post: + operationId: modifyMessage + tags: + - Assistants + summary: Modifies a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to modify. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyMessageRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MessageObject' + x-oaiMeta: + name: Modify message + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "modified": "true", + "user": "abc123" + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message = client.beta.threads.messages.update( + message_id="message_id", + thread_id="thread_id", + ) + print(message.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const message = await openai.beta.threads.messages.update( + "thread_abc123", + "msg_abc123", + { + metadata: { + modified: "true", + user: "abc123", + }, + } + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const message = await client.beta.threads.messages.update('message_id', { thread_id: 'thread_id' }); + + console.log(message.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.Beta.Threads.Messages.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"message_id\",\n\t\topenai.BetaThreadMessageUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.messages.Message; + import com.openai.models.beta.threads.messages.MessageUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageUpdateParams params = MessageUpdateParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + Message message = client.beta().threads().messages().update(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + message = openai.beta.threads.messages.update("message_id", thread_id: "thread_id") + + puts(message) + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699017614, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "file_ids": [], + "metadata": { + "modified": "true", + "user": "abc123" + } + } + deprecated: true + delete: + operationId: deleteMessage + tags: + - Assistants + summary: Deletes a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to delete. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteMessageResponse' + x-oaiMeta: + name: Delete message + group: threads + beta: true + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + message_deleted = client.beta.threads.messages.delete( + message_id="message_id", + thread_id="thread_id", + ) + print(message_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const deletedMessage = await openai.beta.threads.messages.delete( + "msg_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(deletedMessage); + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const messageDeleted = await client.beta.threads.messages.delete('message_id', { + thread_id: 'thread_id', + }); + + console.log(messageDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessageDeleted, err := client.Beta.Threads.Messages.Delete(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"message_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", messageDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.messages.MessageDeleteParams; + import com.openai.models.beta.threads.messages.MessageDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageDeleteParams params = MessageDeleteParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + MessageDeleted messageDeleted = client.beta().threads().messages().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + message_deleted = openai.beta.threads.messages.delete("message_id", thread_id: "thread_id") + + puts(message_deleted) + response: | + { + "id": "msg_abc123", + "object": "thread.message.deleted", + "deleted": true + } + deprecated: true + /threads/{thread_id}/runs: + get: + operationId: listRuns + tags: + - Assistants + summary: Returns a list of runs belonging to a thread. + parameters: + - name: thread_id + in: path + required: true + schema: + type: string + description: The ID of the thread the run belongs to. + - name: limit + in: query + description: |- + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListRunsResponse' + x-oaiMeta: + name: List runs + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.threads.runs.list( + thread_id="thread_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const runs = await openai.beta.threads.runs.list( + "thread_abc123" + ); + + console.log(runs); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const run of client.beta.threads.runs.list('thread_id')) { + console.log(run.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Threads.Runs.List(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.RunListPage; + import com.openai.models.beta.threads.runs.RunListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunListPage page = client.beta().threads().runs().list("thread_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.threads.runs.list("thread_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + }, + { + "id": "run_abc456", + "object": "thread.run", + "created_at": 1699063290, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699063290, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699063291, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + ], + "first_id": "run_abc123", + "last_id": "run_abc456", + "has_more": false + } + deprecated: true + post: + operationId: createRun + tags: + - Assistants + summary: Create a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to run. + - name: include[] + in: query + description: | + A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Create run + group: threads + beta: true + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.create( + thread_id="thread_id", + assistant_id="assistant_id", + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.create( + "thread_abc123", + { assistant_id: "asst_abc123" } + ); + + console.log(run); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.create('thread_id', { assistant_id: 'assistant_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunNewParams{\n\t\t\tAssistantID: \"assistant_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .threadId("thread_id") + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().runs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.create("thread_id", assistant_id: "assistant_id") + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699063290, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "queued", + "started_at": 1699063290, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699063291, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/threads/thread_123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_123", + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.create( + thread_id="thread_id", + assistant_id="assistant_id", + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.runs.create( + "thread_123", + { assistant_id: "asst_123", stream: true } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.create('thread_id', { assistant_id: 'assistant_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunNewParams{\n\t\t\tAssistantID: \"assistant_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .threadId("thread_id") + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().runs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.create("thread_id", assistant_id: "assistant_id") + + puts(run) + response: | + event: thread.run.created + data: {"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-4o","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}} + + event: thread.run.queued + data: {"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-4o","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}} + + event: thread.run.in_progress + data: {"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-4o","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}} + + event: thread.run.step.created + data: {"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} + + event: thread.run.step.in_progress + data: {"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} + + event: thread.message.created + data: {"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":{}} + + event: thread.message.in_progress + data: {"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":{}} + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + ... + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}} + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + event: thread.message.completed + data: {"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":{}} + + event: thread.run.step.completed + data: {"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}} + + event: thread.run.completed + data: {"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-4o","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}} + + event: done + data: [DONE] + - title: Streaming with Functions + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "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"] + } + } + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.create( + thread_id="thread_id", + assistant_id="assistant_id", + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const 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"], + }, + } + } + ]; + + async function main() { + const stream = await openai.beta.threads.runs.create( + "thread_abc123", + { + assistant_id: "asst_abc123", + tools: tools, + stream: true + } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.create('thread_id', { assistant_id: 'assistant_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.New(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\topenai.BetaThreadRunNewParams{\n\t\t\tAssistantID: \"assistant_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .threadId("thread_id") + .assistantId("assistant_id") + .build(); + Run run = client.beta().threads().runs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.create("thread_id", assistant_id: "assistant_id") + + puts(run) + response: | + event: thread.run.created + data: {"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-4o","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}} + + event: thread.run.queued + data: {"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-4o","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}} + + event: thread.run.in_progress + data: {"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-4o","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}} + + event: thread.run.step.created + data: {"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} + + event: thread.run.step.in_progress + data: {"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} + + event: thread.message.created + data: {"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":{}} + + event: thread.message.in_progress + data: {"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":{}} + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + ... + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}} + + event: thread.message.delta + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + event: thread.message.completed + data: {"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":{}} + + event: thread.run.step.completed + data: {"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}} + + event: thread.run.completed + data: {"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-4o","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}} + + event: done + data: [DONE] + deprecated: true + /threads/{thread_id}/runs/{run_id}: + get: + operationId: getRun + tags: + - Assistants + summary: Retrieves a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) that was run. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to retrieve. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Retrieve run + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.beta.threads.runs.retrieve( + run_id="run_id", + thread_id="thread_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.retrieve( + "run_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(run); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.retrieve('run_id', { thread_id: 'thread_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.Get(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunRetrieveParams params = RunRetrieveParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + Run run = client.beta().threads().runs().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.retrieve("run_id", thread_id: "thread_id") + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + deprecated: true + post: + operationId: modifyRun + tags: + - Assistants + summary: Modifies a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) that was run. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to modify. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ModifyRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Modify run + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "user_id": "user_abc123" + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.beta.threads.runs.update( + run_id="run_id", + thread_id="thread_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.update( + "run_abc123", + { + thread_id: "thread_abc123", + metadata: { + user_id: "user_abc123", + }, + } + ); + + console.log(run); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.update('run_id', { thread_id: 'thread_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunUpdateParams params = RunUpdateParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + Run run = client.beta().threads().runs().update(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.update("run_id", thread_id: "thread_id") + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": { + "user_id": "user_abc123" + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + deprecated: true + /threads/{thread_id}/runs/{run_id}/cancel: + post: + operationId: cancelRun + tags: + - Assistants + summary: Cancels a run that is `in_progress`. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this run belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to cancel. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Cancel a run + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X POST + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.beta.threads.runs.cancel( + run_id="run_id", + thread_id="thread_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.cancel( + "run_abc123", + { thread_id: "thread_abc123" } + ); + + console.log(run); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.cancel('run_id', { thread_id: 'thread_id' }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.Cancel(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCancelParams params = RunCancelParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + Run run = client.beta().threads().runs().cancel(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.cancel("run_id", thread_id: "thread_id") + + puts(run) + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699076126, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "cancelling", + "started_at": 1699076126, + "expires_at": 1699076726, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "last_error": null, + "model": "gpt-4o", + "instructions": "You summarize books.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": ["vs_123"] + } + }, + "metadata": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + deprecated: true + /threads/{thread_id}/runs/{run_id}/steps: + get: + operationId: listRunSteps + tags: + - Assistants + summary: Returns a list of run steps belonging to a run. + parameters: + - name: thread_id + in: path + required: true + schema: + type: string + description: The ID of the thread the run and run steps belong to. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run the run steps belong to. + - name: limit + in: query + description: |- + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + - name: include[] + in: query + description: | + A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListRunStepsResponse' + x-oaiMeta: + name: List run steps + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.threads.runs.steps.list( + run_id="run_id", + thread_id="thread_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const runStep = await openai.beta.threads.runs.steps.list( + "run_abc123", + { thread_id: "thread_abc123" } + ); + console.log(runStep); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const runStep of client.beta.threads.runs.steps.list('run_id', { + thread_id: 'thread_id', + })) { + console.log(runStep.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Threads.Runs.Steps.List(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunStepListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.steps.StepListPage; + import com.openai.models.beta.threads.runs.steps.StepListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + StepListParams params = StepListParams.builder() + .threadId("thread_id") + .runId("run_id") + .build(); + StepListPage page = client.beta().threads().runs().steps().list(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.threads.runs.steps.list("run_id", thread_id: "thread_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + ], + "first_id": "step_abc123", + "last_id": "step_abc456", + "has_more": false + } + deprecated: true + /threads/{thread_id}/runs/{run_id}/steps/{step_id}: + get: + operationId: getRunStep + tags: + - Assistants + summary: Retrieves a run step. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which the run and run step belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to which the run step belongs. + - in: path + name: step_id + required: true + schema: + type: string + description: The ID of the run step to retrieve. + - name: include[] + in: query + description: | + A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunStepObject' + x-oaiMeta: + name: Retrieve run step + group: threads + beta: true + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run_step = client.beta.threads.runs.steps.retrieve( + step_id="step_id", + thread_id="thread_id", + run_id="run_id", + ) + print(run_step.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const runStep = await openai.beta.threads.runs.steps.retrieve( + "step_abc123", + { thread_id: "thread_abc123", run_id: "run_abc123" } + ); + console.log(runStep); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const runStep = await client.beta.threads.runs.steps.retrieve('step_id', { + thread_id: 'thread_id', + run_id: 'run_id', + }); + + console.log(runStep.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trunStep, err := client.Beta.Threads.Runs.Steps.Get(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\t\"step_id\",\n\t\topenai.BetaThreadRunStepGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", runStep.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.steps.RunStep; + import com.openai.models.beta.threads.runs.steps.StepRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + StepRetrieveParams params = StepRetrieveParams.builder() + .threadId("thread_id") + .runId("run_id") + .stepId("step_id") + .build(); + RunStep runStep = client.beta().threads().runs().steps().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run_step = openai.beta.threads.runs.steps.retrieve("step_id", thread_id: "thread_id", run_id: "run_id") + + puts(run_step) + response: | + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + deprecated: true + /threads/{thread_id}/runs/{run_id}/submit_tool_outputs: + post: + operationId: submitToolOuputsToRun + 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. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) to which this run belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run that requires the tool output submission. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SubmitToolOutputsRunRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunObject' + x-oaiMeta: + name: Submit tool outputs to run + group: threads + beta: true + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "tool_outputs": [ + { + "tool_call_id": "call_001", + "output": "70 degrees and sunny." + } + ] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.submit_tool_outputs( + run_id="run_id", + thread_id="thread_id", + tool_outputs=[{}], + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.submitToolOutputs( + "run_123", + { + thread_id: "thread_123", + tool_outputs: [ + { + tool_call_id: "call_001", + output: "70 degrees and sunny.", + }, + ], + } + ); + + console.log(run); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.submitToolOutputs('run_id', { + thread_id: 'thread_id', + tool_outputs: [{}], + }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.SubmitToolOutputs(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunSubmitToolOutputsParams{\n\t\t\tToolOutputs: []openai.BetaThreadRunSubmitToolOutputsParamsToolOutput{{}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunSubmitToolOutputsParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunSubmitToolOutputsParams params = RunSubmitToolOutputsParams.builder() + .threadId("thread_id") + .runId("run_id") + .addToolOutput(RunSubmitToolOutputsParams.ToolOutput.builder().build()) + .build(); + Run run = client.beta().threads().runs().submitToolOutputs(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.submit_tool_outputs("run_id", thread_id: "thread_id", tool_outputs: [{}]) + + puts(run) + response: | + { + "id": "run_123", + "object": "thread.run", + "created_at": 1699075592, + "assistant_id": "asst_123", + "thread_id": "thread_123", + "status": "queued", + "started_at": 1699075592, + "expires_at": 1699076192, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "last_error": null, + "model": "gpt-4o", + "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": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "tool_outputs": [ + { + "tool_call_id": "call_001", + "output": "70 degrees and sunny." + } + ], + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for run in client.beta.threads.runs.submit_tool_outputs( + run_id="run_id", + thread_id="thread_id", + tool_outputs=[{}], + ): + print(run) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.runs.submitToolOutputs( + "run_123", + { + thread_id: "thread_123", + tool_outputs: [ + { + tool_call_id: "call_001", + output: "70 degrees and sunny.", + }, + ], + } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.beta.threads.runs.submitToolOutputs('run_id', { + thread_id: 'thread_id', + tool_outputs: [{}], + }); + + console.log(run.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\trun, err := client.Beta.Threads.Runs.SubmitToolOutputs(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"run_id\",\n\t\topenai.BetaThreadRunSubmitToolOutputsParams{\n\t\t\tToolOutputs: []openai.BetaThreadRunSubmitToolOutputsParamsToolOutput{{}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", run.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.threads.runs.Run; + import com.openai.models.beta.threads.runs.RunSubmitToolOutputsParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunSubmitToolOutputsParams params = RunSubmitToolOutputsParams.builder() + .threadId("thread_id") + .runId("run_id") + .addToolOutput(RunSubmitToolOutputsParams.ToolOutput.builder().build()) + .build(); + Run run = client.beta().threads().runs().submitToolOutputs(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.beta.threads.runs.submit_tool_outputs("run_id", thread_id: "thread_id", tool_outputs: [{}]) + + puts(run) + response: | + event: thread.run.step.completed + data: {"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}} + + event: thread.run.queued + data: {"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-4o","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}} + + event: thread.run.in_progress + data: {"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-4o","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}} + + event: thread.run.step.created + data: {"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} + + event: thread.run.step.in_progress + data: {"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} + + event: thread.message.created + data: {"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":{}} + + event: thread.message.in_progress + data: {"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":{}} + + event: thread.message.delta + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"The","annotations":[]}}]}} + + event: thread.message.delta + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" current"}}]}} + + event: thread.message.delta + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" weather"}}]}} + + ... + + event: thread.message.delta + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" sunny"}}]}} + + event: thread.message.delta + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"."}}]}} + + event: thread.message.completed + data: {"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":{}} + + event: thread.run.step.completed + data: {"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}} + + event: thread.run.completed + data: {"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-4o","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}} + + event: done + data: [DONE] + deprecated: true +components: + schemas: + 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: | + { + "object": "list", + "data": [ + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698982736, + "name": "Coding Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc456", + "object": "assistant", + "created_at": 1698982718, + "name": "My Assistant", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc789", + "object": "assistant", + "created_at": 1698982643, + "name": null, + "description": null, + "model": "gpt-4o", + "instructions": null, + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + ], + "first_id": "asst_abc123", + "last_id": "asst_abc789", + "has_more": false + } + CreateAssistantRequest: + type: object + additionalProperties: false + properties: + model: + description: | + ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them. + example: gpt-4o + x-oaiTypeLabel: 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 + - 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 + name: + description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + description: + description: | + The description of the assistant. The maximum length is 512 characters. + type: string + maxLength: 512 + instructions: + description: | + The system instructions that the assistant uses. The maximum length is 256,000 characters. + type: string + maxLength: 256000 + 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`. + default: [] + type: array + maxItems: 128 + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearch' + - $ref: '#/components/schemas/AssistantToolsFunction' + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: | + A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/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. + 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`. + + Note that the overlap must not exceed half of `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + required: + - type + - static + metadata: + $ref: '#/components/schemas/Metadata' + oneOf: + - required: + - vector_store_ids + - required: + - vector_stores + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + 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. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + top_p: + 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. + + We generally recommend altering this or temperature but not both. + response_format: + description: | + Specifies the format that the model must output. Compatible with [GPT-4o](/docs/models#gpt-4o), [GPT-4 Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. + + Setting 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](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. + + **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. + type: string + enum: + - auto + x-stainless-const: true + title: Text + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: | + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + required: + - model + 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: + description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + description: + description: | + The description of the assistant. The maximum length is 512 characters. + type: string + maxLength: 512 + model: + description: | + ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them. + type: string + instructions: + description: | + The system instructions that the assistant uses. The maximum length is 256,000 characters. + type: string + maxLength: 256000 + 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`. + default: [] + type: array + maxItems: 128 + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearch' + - $ref: '#/components/schemas/AssistantToolsFunction' + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The ID of the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: string + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + 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. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + top_p: + 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. + + We generally recommend altering this or temperature but not both. + response_format: + description: | + Specifies the format that the model must output. Compatible with [GPT-4o](/docs/models#gpt-4o), [GPT-4 Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. + + Setting 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](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. + + **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. + type: string + enum: + - auto + x-stainless-const: true + title: Text + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: | + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + required: + - id + - object + - created_at + - name + - description + - model + - instructions + - tools + - metadata + x-oaiMeta: + name: The assistant object + example: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698984975, + "name": "Math Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + deprecated: true + ModifyAssistantRequest: + type: object + additionalProperties: false + properties: + model: + description: | + ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them. + 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 + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + name: + description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + description: + description: | + The description of the assistant. The maximum length is 512 characters. + type: string + maxLength: 512 + instructions: + description: | + The system instructions that the assistant uses. The maximum length is 256,000 characters. + type: string + maxLength: 256000 + 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`. + default: [] + type: array + maxItems: 128 + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearch' + - $ref: '#/components/schemas/AssistantToolsFunction' + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + Overrides the list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + Overrides the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: string + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + 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. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + top_p: + 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. + + We generally recommend altering this or temperature but not both. + response_format: + description: | + Specifies the format that the model must output. Compatible with [GPT-4o](/docs/models#gpt-4o), [GPT-4 Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. + + Setting 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](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. + + **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. + type: string + enum: + - auto + x-stainless-const: true + title: Text + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: | + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + DeleteAssistantResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + enum: + - assistant.deleted + x-stainless-const: true + required: + - id + - object + - deleted + CreateThreadRequest: + type: object + description: | + Options to create a new thread. If no thread is provided when running a + request, an empty thread will be created. + additionalProperties: false + properties: + messages: + description: A list of [messages](/docs/api-reference/messages) to start the thread with. + type: array + items: + $ref: '#/components/schemas/CreateMessageRequest' + tool_resources: + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: | + A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/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. + 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`. + + Note that the overlap must not exceed half of `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + required: + - type + - static + metadata: + $ref: '#/components/schemas/Metadata' + oneOf: + - required: + - vector_store_ids + - required: + - vector_stores + metadata: + $ref: '#/components/schemas/Metadata' + ThreadObject: + type: object + title: Thread + description: Represents a thread that contains [messages](/docs/api-reference/messages). + 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 + created_at: + description: The Unix timestamp (in seconds) for when the thread was created. + type: integer + format: unixtime + tool_resources: + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: string + metadata: + $ref: '#/components/schemas/Metadata' + required: + - id + - object + - created_at + - tool_resources + - metadata + x-oaiMeta: + name: The thread object + beta: true + example: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1698107661, + "metadata": {} + } + CreateThreadAndRunRequest: + type: object + additionalProperties: false + properties: + assistant_id: + description: The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run. + type: string + thread: + $ref: '#/components/schemas/CreateThreadRequest' + model: + description: The ID of the [Model](/docs/api-reference/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-4o + x-oaiTypeLabel: string + nullable: true + 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 + instructions: + description: Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis. + type: string + 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' + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The ID of the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: string + 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. + 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. + + We generally recommend altering this or temperature but not both. + 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. + 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. + 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. + minimum: 256 + truncation_strategy: + 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 + last_messages: + type: integer + description: The number of most recent messages from the thread when constructing the context for the run. + minimum: 1 + required: + - type + nullable: true + tool_choice: + description: | + Controls which (if any) tool is called by the model. + `none` means the model will not call any tools and instead generates a message. + `auto` is the default value and 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. + Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. + type: string + enum: + - none + - auto + - required + 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. + required: + - name + required: + - type + nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + required: + - assistant_id + RunObject: + type: object + title: A run on a thread + description: Represents an execution run on a [thread](/docs/api-reference/threads). + 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: string + enum: + - thread.run + 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](/docs/api-reference/threads) that was executed on as a part of this run. + type: string + assistant_id: + description: The ID of the [assistant](/docs/api-reference/assistants) used for execution of this run. + type: string + 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 + 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' + 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 + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + expires_at: + description: The Unix timestamp (in seconds) for when the run will expire. + type: integer + format: unixtime + nullable: true + started_at: + description: The Unix timestamp (in seconds) for when the run was started. + type: integer + format: unixtime + nullable: true + cancelled_at: + description: The Unix timestamp (in seconds) for when the run was cancelled. + type: integer + format: unixtime + nullable: true + failed_at: + description: The Unix timestamp (in seconds) for when the run failed. + type: integer + format: unixtime + nullable: true + completed_at: + description: The Unix timestamp (in seconds) for when the run was completed. + type: integer + format: unixtime + nullable: true + 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 + model: + description: The model that the [assistant](/docs/api-reference/assistants) used for this run. + type: string + instructions: + description: The instructions that the [assistant](/docs/api-reference/assistants) used for this run. + type: string + tools: + description: The list of tools that the [assistant](/docs/api-reference/assistants) used for this run. + default: [] + type: array + maxItems: 20 + 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 + max_prompt_tokens: + type: integer + nullable: true + description: | + The maximum number of prompt tokens specified to have been used over the course of the run. + minimum: 256 + max_completion_tokens: + type: integer + nullable: true + description: | + The maximum number of completion tokens specified to have been used over the course of the run. + minimum: 256 + truncation_strategy: + 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 + last_messages: + type: integer + description: The number of most recent messages from the thread when constructing the context for the run. + minimum: 1 + required: + - type + nullable: true + tool_choice: + description: | + Controls which (if any) tool is called by the model. + `none` means the model will not call any tools and instead generates a message. + `auto` is the default value and 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. + Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. + type: string + enum: + - none + - auto + - required + 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. + required: + - name + required: + - type + nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + 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 + x-oaiMeta: + name: The run object + beta: true + example: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1698107661, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699073476, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699073498, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "tools": [{"type": "file_search"}, {"type": "code_interpreter"}], + "metadata": {}, + "incomplete_details": null, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + ModifyThreadRequest: + type: object + additionalProperties: false + properties: + tool_resources: + 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. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: string + metadata: + $ref: '#/components/schemas/Metadata' + DeleteThreadResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + enum: + - thread.deleted + x-stainless-const: true + required: + - id + - object + - deleted + 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 + type: object + 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: + - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. + - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation. + content: + type: string + description: The text contents of the message. + title: Text content + items: + oneOf: + - $ref: '#/components/schemas/MessageContentImageFileObject' + - $ref: '#/components/schemas/MessageContentImageUrlObject' + - $ref: '#/components/schemas/MessageRequestContentTextObject' + minItems: 1 + attachments: + 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 + metadata: + $ref: '#/components/schemas/Metadata' + MessageObject: + type: object + title: The message object + description: Represents a message within a [thread](/docs/api-reference/threads). + 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](/docs/api-reference/threads) 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: + 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 + completed_at: + description: The Unix timestamp (in seconds) for when the message was completed. + type: integer + format: unixtime + incomplete_at: + description: The Unix timestamp (in seconds) for when the message was marked as incomplete. + type: integer + format: unixtime + 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: + description: If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message. + type: string + run_id: + description: The ID of the [run](/docs/api-reference/runs) 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 + attachments: + 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. + 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: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1698983503, + "thread_id": "thread_abc123", + "role": "assistant", + "content": [ + { + "type": "text", + "text": { + "value": "Hi! How can I help you today?", + "annotations": [] + } + } + ], + "assistant_id": "asst_abc123", + "run_id": "run_abc123", + "attachments": [], + "metadata": {} + } + ModifyMessageRequest: + type: object + additionalProperties: false + properties: + metadata: + $ref: '#/components/schemas/Metadata' + 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 + 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 + CreateRunRequest: + type: object + additionalProperties: false + properties: + assistant_id: + description: The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run. + type: string + model: + description: The ID of the [Model](/docs/api-reference/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-4o + x-oaiTypeLabel: string + nullable: true + 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 + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + instructions: + description: Overrides the [instructions](/docs/api-reference/assistants/createAssistant) 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. + 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. + + We generally recommend altering this or temperature but not both. + 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. + 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. + 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. + minimum: 256 + truncation_strategy: + 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 + last_messages: + type: integer + description: The number of most recent messages from the thread when constructing the context for the run. + minimum: 1 + required: + - type + nullable: true + tool_choice: + description: | + Controls which (if any) tool is called by the model. + `none` means the model will not call any tools and instead generates a message. + `auto` is the default value and 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. + Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. + type: string + enum: + - none + - auto + - required + 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. + required: + - name + required: + - type + nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + required: + - assistant_id + ModifyRunRequest: + type: object + additionalProperties: false + properties: + metadata: + $ref: '#/components/schemas/Metadata' + 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 + type: object + RunStepObject: + type: object + title: Run steps + description: | + Represents a step in execution of a run. + 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: string + enum: + - thread.run.step + 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](/docs/api-reference/assistants) associated with the run step. + type: string + thread_id: + description: The ID of the [thread](/docs/api-reference/threads) that was run. + type: string + run_id: + description: The ID of the [run](/docs/api-reference/runs) 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. + title: Message creation + properties: + type: + description: Always `message_creation`. + type: string + enum: + - message_creation + 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 + 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`. + items: + oneOf: + - $ref: '#/components/schemas/RunStepDetailsToolCallsCodeObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsFileSearchObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsFunctionObject' + required: + - type + - message_creation + - tool_calls + last_error: + 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. + required: + - code + - message + expired_at: + 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 + cancelled_at: + description: The Unix timestamp (in seconds) for when the run step was cancelled. + type: integer + format: unixtime + failed_at: + description: The Unix timestamp (in seconds) for when the run step failed. + type: integer + format: unixtime + completed_at: + description: The Unix timestamp (in seconds) for when the run step completed. + type: integer + format: unixtime + metadata: + $ref: '#/components/schemas/Metadata' + usage: + $ref: '#/components/schemas/RunStepCompletionUsage' + 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 + x-oaiMeta: + name: The run step object + beta: true + example: | + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + 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: + 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. + required: + - tool_outputs + 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 + ReasoningEffort: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + default: medium + description: | + Constrains effort on reasoning for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing + reasoning effort can result in faster responses and fewer tokens used + on reasoning in a response. + + - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. + - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. + - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. + - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + 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. + + Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + ranking_options: + $ref: '#/components/schemas/FileSearchRankingOptions' + 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 + Metadata: + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + AssistantsApiResponseFormatOption: + description: | + Specifies the format that the model must output. Compatible with [GPT-4o](/docs/models#gpt-4o), [GPT-4 Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. + + Setting 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](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. + + **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. + type: string + enum: + - auto + x-stainless-const: true + title: Text + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: | + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + 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 + last_messages: + type: integer + description: The number of most recent messages from the thread when constructing the context for the run. + minimum: 1 + required: + - type + AssistantsApiToolChoiceOption: + description: | + Controls which (if any) tool is called by the model. + `none` means the model will not call any tools and instead generates a message. + `auto` is the default value and 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. + Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. + type: string + enum: + - none + - auto + - required + 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. + required: + - name + required: + - type + ParallelToolCalls: + description: Whether to enable [parallel function calling](/docs/guides/function-calling#configuring-parallel-function-calling) during tool use. + type: boolean + default: true + 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](/docs/api-reference/runs/submitToolOutputs) endpoint. + 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 + description: The function definition. + properties: + 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. + required: + - name + - arguments + required: + - id + - type + - function + RunCompletionUsage: + 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 + MessageContentImageFileObject: + title: Image file + type: object + description: References an image [File](/docs/api-reference/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](/docs/api-reference/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 + 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 + 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 + 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 + 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 + RunStepDetailsMessageCreationObject: + title: Message creation + type: object + description: Details of the message creation by the run step. + properties: + type: + description: Always `message_creation`. + type: string + enum: + - message_creation + 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 + required: + - type + - message_creation + RunStepDetailsToolCallsObject: + title: Tool calls + type: object + description: Details of the tool call. + properties: + type: + description: Always `tool_calls`. + type: string + enum: + - tool_calls + 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`. + items: + oneOf: + - $ref: '#/components/schemas/RunStepDetailsToolCallsCodeObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsFileSearchObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsFunctionObject' + required: + - type + - tool_calls + RunStepCompletionUsage: + 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 + 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. + + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + 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 + 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: + 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](/docs/guides/function-calling). + required: + - name + ResponseFormatText: + type: object + title: Text + description: | + Default response format. Used to generate text responses. + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + required: + - type + ResponseFormatJsonObject: + type: object + title: JSON object + description: | + JSON object response format. An older method of generating JSON responses. + Using `json_schema` is recommended for models that support it. Note that the + model will not generate JSON without a system or user message instructing it + to do so. + 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. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). + properties: + type: + type: string + description: The type of response format being defined. Always `json_schema`. + enum: + - json_schema + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: | + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + 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. + required: + - name + required: + - type + 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 + RunStepDetailsToolCallsCodeObject: + title: Code Interpreter tool call + type: object + description: Details of the Code Interpreter tool call the run step was involved in. + 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 + 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. + 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: + - id + - type + - code_interpreter + RunStepDetailsToolCallsFileSearchObject: + title: File search tool call + type: object + 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 + 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' + required: + - id + - type + - file_search + RunStepDetailsToolCallsFunctionObject: + type: object + title: Function tool call + 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 + 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: + - type: string + description: The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet. + - type: 'null' + required: + - name + - arguments + - output + required: + - id + - type + - function + 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 + FunctionParameters: + type: object + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. + additionalProperties: true + ResponseFormatJsonSchemaSchema: + type: object + title: JSON schema + description: | + The schema for the response format, described as a JSON Schema object. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + RunStepDetailsToolCallsCodeOutputLogsObject: + title: Code Interpreter log output + type: object + description: Text output from the Code Interpreter tool call as part of a run step. + properties: + type: + description: Always `logs`. + type: string + enum: + - logs + x-stainless-const: true + logs: + type: string + description: The text output from the Code Interpreter tool call. + required: + - type + - logs + RunStepDetailsToolCallsCodeOutputImageObject: + title: Code Interpreter image output + type: object + properties: + type: + description: Always `image`. + type: string + enum: + - image + x-stainless-const: true + image: + type: object + properties: + file_id: + description: The [file](/docs/api-reference/files) ID of the image. + type: string + required: + - file_id + required: + - type + - image + 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 + 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 ID of the file that result was found in. + file_name: + 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. + required: + - file_id + - file_name + - score +servers: + - url: https://api.openai.com/v1 diff --git a/provider-dev/source/batches.yaml b/provider-dev/source/batches.yaml new file mode 100644 index 0000000..5470e82 --- /dev/null +++ b/provider-dev/source/batches.yaml @@ -0,0 +1,887 @@ +openapi: 3.1.0 +info: + title: batches API + description: openai API + version: 2.3.0 +paths: + /batches: + post: + summary: Creates and executes a batch from an uploaded file of requests + operationId: createBatch + tags: + - Batch + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - input_file_id + - endpoint + - completion_window + properties: + input_file_id: + type: string + description: | + The ID of an uploaded file that contains requests for the new batch. + + See [upload file](/docs/api-reference/files/create) for how to upload a file. + + Your input file must be formatted as a [JSONL file](/docs/api-reference/batch/request-input), 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. + 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. + completion_window: + type: string + enum: + - 24h + description: The time frame within which the batch should be processed. Currently only `24h` is supported. + metadata: + $ref: '#/components/schemas/Metadata' + output_expires_after: + $ref: '#/components/schemas/BatchFileExpirationAfter' + responses: + '200': + description: Batch created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Batch' + x-oaiMeta: + name: Create batch + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "input_file_id": "file-abc123", + "endpoint": "/v1/chat/completions", + "completion_window": "24h" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + batch = client.batches.create( + completion_window="24h", + endpoint="/v1/responses", + input_file_id="input_file_id", + ) + print(batch.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.create({ + input_file_id: "file-abc123", + endpoint: "/v1/chat/completions", + completion_window: "24h" + }); + + console.log(batch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const batch = await client.batches.create({ + completion_window: '24h', + endpoint: '/v1/responses', + input_file_id: 'input_file_id', + }); + + console.log(batch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.New(context.TODO(), openai.BatchNewParams{\n\t\tCompletionWindow: openai.BatchNewParamsCompletionWindow24h,\n\t\tEndpoint: openai.BatchNewParamsEndpointV1Responses,\n\t\tInputFileID: \"input_file_id\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.Batch; + import com.openai.models.batches.BatchCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BatchCreateParams params = BatchCreateParams.builder() + .completionWindow(BatchCreateParams.CompletionWindow._24H) + .endpoint(BatchCreateParams.Endpoint.V1_RESPONSES) + .inputFileId("input_file_id") + .build(); + Batch batch = client.batches().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + batch = openai.batches.create( + completion_window: :"24h", + endpoint: :"/v1/responses", + input_file_id: "input_file_id" + ) + + puts(batch) + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "validating", + "output_file_id": null, + "error_file_id": null, + "created_at": 1711471533, + "in_progress_at": null, + "expires_at": null, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 0, + "completed": 0, + "failed": 0 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + get: + operationId: listBatches + tags: + - Batch + summary: List your organization's batches. + parameters: + - in: query + name: after + required: false + schema: + type: string + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + - name: limit + in: query + description: |- + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Batch listed successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ListBatchesResponse' + x-oaiMeta: + name: List batches + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches?limit=2 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.batches.list() + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.batches.list(); + + for await (const batch of list) { + console.log(batch); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const batch of client.batches.list()) { + console.log(batch.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Batches.List(context.TODO(), openai.BatchListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.BatchListPage; + import com.openai.models.batches.BatchListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BatchListPage page = client.batches().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.batches.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly job", + } + }, + { ... }, + ], + "first_id": "batch_abc123", + "last_id": "batch_abc456", + "has_more": true + } + /batches/{batch_id}: + get: + operationId: retrieveBatch + tags: + - Batch + summary: Retrieves a batch. + parameters: + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the batch to retrieve. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Batch retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Batch' + x-oaiMeta: + name: Retrieve batch + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches/batch_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + batch = client.batches.retrieve( + "batch_id", + ) + print(batch.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.retrieve("batch_abc123"); + + console.log(batch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const batch = await client.batches.retrieve('batch_id'); + + console.log(batch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.Get(context.TODO(), \"batch_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.Batch; + import com.openai.models.batches.BatchRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Batch batch = client.batches().retrieve("batch_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + batch = openai.batches.retrieve("batch_id") + + puts(batch) + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + /batches/{batch_id}/cancel: + post: + operationId: cancelBatch + 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. + parameters: + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the batch to cancel. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Batch is cancelling. Returns the cancelling batch's details. + content: + application/json: + schema: + $ref: '#/components/schemas/Batch' + x-oaiMeta: + name: Cancel batch + group: batch + examples: + request: + curl: | + curl https://api.openai.com/v1/batches/batch_abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -X POST + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + batch = client.batches.cancel( + "batch_id", + ) + print(batch.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.cancel("batch_abc123"); + + console.log(batch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const batch = await client.batches.cancel('batch_id'); + + console.log(batch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbatch, err := client.Batches.Cancel(context.TODO(), \"batch_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", batch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.batches.Batch; + import com.openai.models.batches.BatchCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Batch batch = client.batches().cancel("batch_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + batch = openai.batches.cancel("batch_id") + + puts(batch) + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "cancelling", + "output_file_id": null, + "error_file_id": null, + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": 1711475133, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 23, + "failed": 1 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } +components: + schemas: + Metadata: + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + 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 + required: + - anchor + - seconds + Batch: + type: object + properties: + id: + type: string + object: + type: string + enum: + - batch + description: The object type, which is always `batch`. + x-stainless-const: true + endpoint: + type: string + description: The OpenAI API endpoint used by the batch. + model: + type: string + description: | + Model ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI + offers a wide range of models with different capabilities, performance + characteristics, and price points. Refer to the [model + guide](/docs/models) to browse and compare available models. + errors: + type: object + properties: + object: + type: string + description: The object type, which is always `list`. + data: + type: array + items: + 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 + description: The name of the parameter that caused the error, if applicable. + - type: 'null' + line: + anyOf: + - type: integer + description: The line number of the input file where the error occurred, if applicable. + - type: 'null' + input_file_id: + type: string + description: The ID of the input file for the batch. + completion_window: + type: string + description: The time frame within which the batch should be processed. + status: + type: string + description: The current status of the batch. + enum: + - validating + - failed + - in_progress + - finalizing + - completed + - expired + - cancelling + - cancelled + output_file_id: + type: string + description: The ID of the file containing the outputs of successfully executed requests. + error_file_id: + type: string + description: The ID of the file containing the outputs of requests with errors. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was created. + in_progress_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch started processing. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch will expire. + finalizing_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch started finalizing. + completed_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was completed. + failed_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch failed. + expired_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch expired. + cancelling_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch started cancelling. + cancelled_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was cancelled. + request_counts: + 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. + failed: + type: integer + description: Number of requests that have failed. + required: + - total + - completed + - failed + description: The request counts for different statuses within the batch. + usage: + type: object + description: | + Represents token usage details including input tokens, output tokens, a + breakdown of output tokens, and the total tokens used. Only populated on + batches created after September 7, 2025. + 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 + prompt caching](/docs/guides/prompt-caching). + 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. + 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: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/completions", + "model": "gpt-5-2025-08-07", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "usage": { + "input_tokens": 1500, + "input_tokens_details": { + "cached_tokens": 1024 + }, + "output_tokens": 500, + "output_tokens_details": { + "reasoning_tokens": 300 + }, + "total_tokens": 2000 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + 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 +servers: + - url: https://api.openai.com/v1 diff --git a/provider-dev/source/containers.yaml b/provider-dev/source/containers.yaml new file mode 100644 index 0000000..ccd5e4b --- /dev/null +++ b/provider-dev/source/containers.yaml @@ -0,0 +1,1312 @@ +openapi: 3.1.0 +info: + title: containers API + description: openai API + version: 2.3.0 +paths: + /containers: + get: + summary: List Containers + description: Lists containers. + operationId: ListContainers + parameters: + - name: limit + in: query + description: |- + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: name + in: query + description: Filter results by container name. + required: false + schema: + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerListResource' + x-oaiMeta: + name: List containers + group: containers + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/containers \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const containerListResponse of client.containers.list()) { + console.log(containerListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.containers.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Containers.List(context.TODO(), openai.ContainerListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerListPage; + import com.openai.models.containers.ContainerListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContainerListPage page = client.containers().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.containers.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "4g", + "name": "My Container" + } + ], + "first_id": "container_123", + "last_id": "container_123", + "has_more": false + } + tags: + - Containers + post: + summary: Create Container + description: Creates a container. + operationId: CreateContainer + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateContainerBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerResource' + x-oaiMeta: + name: Create container + group: containers + path: post + examples: + request: + curl: | + curl https://api.openai.com/v1/containers \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "My Container", + "memory_limit": "4g", + "skills": [ + { + "type": "skill_reference", + "skill_id": "skill_4db6f1a2c9e73508b41f9da06e2c7b5f" + }, + { + "type": "skill_reference", + "skill_id": "openai-spreadsheets", + "version": "latest" + } + ], + "network_policy": { + "type": "allowlist", + "allowed_domains": ["api.buildkite.com"] + } + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const container = await client.containers.create({ name: 'name' }); + + console.log(container.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + container = client.containers.create( + name="name", + ) + print(container.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcontainer, err := client.Containers.New(context.TODO(), openai.ContainerNewParams{\n\t\tName: \"name\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", container.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerCreateParams; + import com.openai.models.containers.ContainerCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContainerCreateParams params = ContainerCreateParams.builder() + .name("name") + .build(); + ContainerCreateResponse container = client.containers().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + container = openai.containers.create(name: "name") + + puts(container) + response: | + { + "id": "cntr_682e30645a488191b6363a0cbefc0f0a025ec61b66250591", + "object": "container", + "created_at": 1747857508, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747857508, + "network_policy": { + "type": "allowlist", + "allowed_domains": ["api.buildkite.com"] + }, + "memory_limit": "4g", + "name": "My Container" + } + tags: + - Containers + /containers/{container_id}: + get: + summary: Retrieve Container + description: Retrieves a container. + operationId: RetrieveContainer + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerResource' + x-oaiMeta: + name: Retrieve container + group: containers + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const container = await client.containers.retrieve('container_id'); + + console.log(container.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + container = client.containers.retrieve( + "container_id", + ) + print(container.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcontainer, err := client.Containers.Get(context.TODO(), \"container_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", container.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerRetrieveParams; + import com.openai.models.containers.ContainerRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ContainerRetrieveResponse container = client.containers().retrieve("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + container = openai.containers.retrieve("container_id") + + puts(container) + response: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "4g", + "name": "My Container" + } + tags: + - Containers + delete: + operationId: DeleteContainer + summary: Delete Container + description: Delete a container. + parameters: + - name: container_id + in: path + description: The ID of the container to delete. + required: true + schema: + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + x-oaiMeta: + name: Delete a container + group: containers + path: delete + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + await client.containers.delete('container_id'); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.containers.delete( + "container_id", + ) + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Containers.Delete(context.TODO(), \"container_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.ContainerDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + client.containers().delete("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + result = openai.containers.delete("container_id") + + puts(result) + response: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container.deleted", + "deleted": true + } + tags: + - Containers + /containers/{container_id}/files: + post: + summary: | + Create a Container File + + You can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID. + description: | + Creates a container file. + operationId: CreateContainerFile + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateContainerFileBody' + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateContainerFileBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerFileResource' + x-oaiMeta: + name: Create container file + group: containers + path: post + examples: + request: + curl: | + curl https://api.openai.com/v1/containers/cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F file="@example.txt" + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const file = await client.containers.files.create('container_id'); + + console.log(file.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file = client.containers.files.create( + container_id="container_id", + ) + print(file.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfile, err := client.Containers.Files.New(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\topenai.ContainerFileNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", file.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileCreateParams; + import com.openai.models.containers.files.FileCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileCreateResponse file = client.containers().files().create("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file = openai.containers.files.create("container_id") + + puts(file) + response: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + tags: + - Containers + get: + summary: List Container files + description: Lists container files. + operationId: ListContainerFiles + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: limit + in: query + description: |- + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerFileListResource' + x-oaiMeta: + name: List container files + group: containers + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/containers/cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fileListResponse of client.containers.files.list('container_id')) { + console.log(fileListResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.containers.files.list( + container_id="container_id", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Containers.Files.List(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\topenai.ContainerFileListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileListPage; + import com.openai.models.containers.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileListPage page = client.containers().files().list("container_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.containers.files.list("container_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + ], + "first_id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "has_more": false, + "last_id": "cfile_682e0e8a43c88191a7978f477a09bdf5" + } + tags: + - Containers + /containers/{container_id}/files/{file_id}: + get: + summary: Retrieve Container File + description: Retrieves a container file. + operationId: RetrieveContainerFile + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: file_id + in: path + required: true + schema: + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerFileResource' + x-oaiMeta: + name: Retrieve container file + group: containers + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/containers/container_123/files/file_456 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const file = await client.containers.files.retrieve('file_id', { container_id: 'container_id' }); + + console.log(file.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file = client.containers.files.retrieve( + file_id="file_id", + container_id="container_id", + ) + print(file.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfile, err := client.Containers.Files.Get(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", file.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileRetrieveParams; + import com.openai.models.containers.files.FileRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileRetrieveParams params = FileRetrieveParams.builder() + .containerId("container_id") + .fileId("file_id") + .build(); + FileRetrieveResponse file = client.containers().files().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file = openai.containers.files.retrieve("file_id", container_id: "container_id") + + puts(file) + response: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + tags: + - Containers + delete: + operationId: DeleteContainerFile + summary: Delete Container File + description: Delete a container file. + parameters: + - name: container_id + in: path + required: true + schema: + type: string + - name: file_id + in: path + required: true + schema: + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + x-oaiMeta: + name: Delete a container file + group: containers + path: delete + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863/files/cfile_682e0e8a43c88191a7978f477a09bdf5 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + await client.containers.files.delete('file_id', { container_id: 'container_id' }); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.containers.files.delete( + file_id="file_id", + container_id="container_id", + ) + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Containers.Files.Delete(\n\t\tcontext.TODO(),\n\t\t\"container_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.containers.files.FileDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileDeleteParams params = FileDeleteParams.builder() + .containerId("container_id") + .fileId("file_id") + .build(); + client.containers().files().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + result = openai.containers.files.delete("file_id", container_id: "container_id") + + puts(result) + response: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file.deleted", + "deleted": true + } + tags: + - Containers +components: + schemas: + 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. + required: + - object + - data + - first_id + - last_id + - has_more + 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: + 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 + 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. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + required: + - name + 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. + The anchor is the reference point for the expiration. + The minutes is the number of minutes after the anchor before the container expires. + 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. + memory_limit: + type: string + description: The memory limit configured for the container. + enum: + - 1g + - 4g + - 16g + - 64g + 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 + required: + - type + required: + - id + - object + - name + - created_at + - status + - id + - name + - created_at + - status + x-oaiMeta: + name: The container object + example: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "1g", + "name": "My Container" + } + CreateContainerFileBody: + type: object + properties: + file_id: + type: string + description: Name of the file to create. + required: [] + 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. + path: + type: string + description: Path of the file in the container. + source: + type: string + description: Source of the file (e.g., `user`, `assistant`). + required: + - id + - object + - created_at + - bytes + - container_id + - path + - source + x-oaiMeta: + name: The container file object + example: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + 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' + 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: + - object + - data + - first_id + - last_id + - has_more + 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 + skill_id: + type: string + maxLength: 64 + minLength: 1 + description: The ID of the referenced skill. + version: + type: string + description: Optional skill version. Use a positive integer or 'latest'. Omit for default. + type: object + required: + - type + - skill_id + InlineSkillParam: + properties: + type: + type: string + enum: + - inline + description: Defines an inline skill for this request. + default: inline + x-stainless-const: true + name: + type: string + description: The name of the skill. + 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 + 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 + InlineSkillSourceParam: + 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. + type: object + required: + - type + - media_type + - data + description: Inline skill payload + 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 +servers: + - url: https://api.openai.com/v1 diff --git a/provider-dev/source/conversations.yaml b/provider-dev/source/conversations.yaml new file mode 100644 index 0000000..9297fdb --- /dev/null +++ b/provider-dev/source/conversations.yaml @@ -0,0 +1,7325 @@ +openapi: 3.1.0 +info: + title: conversations API + description: openai API + version: 2.3.0 +paths: + /conversations/{conversation_id}/items: + post: + operationId: createConversationItems + tags: + - Conversations + summary: Create items in a conversation with the given ID. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation to add the item to. + - name: include + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: | + Additional fields to include in the response. See the `include` + parameter for [listing Conversation items above](/docs/api-reference/conversations/list-items#conversations_list_items-include) for more information. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + properties: + items: + type: array + description: | + The items to add to the conversation. You may add up to 20 items at a time. + items: + $ref: '#/components/schemas/InputItem' + maxItems: 20 + required: + - items + type: object + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationItemList' + x-oaiMeta: + name: Create items + group: conversations + path: create-item + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123/items \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "items": [ + { + "type": "message", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + }, + { + "type": "message", + "role": "user", + "content": [ + {"type": "input_text", "text": "How are you?"} + ] + } + ] + }' + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const items = await client.conversations.items.create( + "conv_123", + { + items: [ + { + type: "message", + role: "user", + content: [{ type: "input_text", text: "Hello!" }], + }, + { + type: "message", + role: "user", + content: [{ type: "input_text", text: "How are you?" }], + }, + ], + } + ); + console.log(items.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation_item_list = client.conversations.items.create( + conversation_id="conv_123", + items=[{ + "content": "string", + "role": "user", + "type": "message", + }], + ) + print(conversation_item_list.first_id) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ConversationItemList created = client.ConversationItems.Create( + conversationId: "conv_123", + new CreateConversationItemsOptions + { + Items = new List + { + new ConversationMessage + { + Role = "user", + Content = + { + new ConversationInputText { Text = "Hello!" } + } + }, + new ConversationMessage + { + Role = "user", + Content = + { + new ConversationInputText { Text = "How are you?" } + } + } + } + } + ); + Console.WriteLine(created.Data.Count); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversationItemList = await client.conversations.items.create('conv_123', { + items: [ + { + content: 'string', + role: 'user', + type: 'message', + }, + ], + }); + + console.log(conversationItemList.first_id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationItemList, err := client.Conversations.Items.New(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ItemNewParams{\n\t\t\tItems: []responses.ResponseInputItemUnionParam{{\n\t\t\t\tOfMessage: &responses.EasyInputMessageParam{\n\t\t\t\t\tContent: responses.EasyInputMessageContentUnionParam{\n\t\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t\t},\n\t\t\t\t\tRole: responses.EasyInputMessageRoleUser,\n\t\t\t\t\tType: responses.EasyInputMessageTypeMessage,\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationItemList.FirstID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.items.ConversationItemList; + import com.openai.models.conversations.items.ItemCreateParams; + import com.openai.models.responses.EasyInputMessage; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemCreateParams params = ItemCreateParams.builder() + .conversationId("conv_123") + .addItem(EasyInputMessage.builder() + .content("string") + .role(EasyInputMessage.Role.USER) + .type(EasyInputMessage.Type.MESSAGE) + .build()) + .build(); + ConversationItemList conversationItemList = client.conversations().items().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation_item_list = openai.conversations.items.create("conv_123", items: [{content: "string", role: :user, type: :message}]) + + puts(conversation_item_list) + response: | + { + "object": "list", + "data": [ + { + "type": "message", + "id": "msg_abc", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + }, + { + "type": "message", + "id": "msg_def", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "How are you?"} + ] + } + ], + "first_id": "msg_abc", + "last_id": "msg_def", + "has_more": false + } + get: + operationId: listConversationItems + tags: + - Conversations + summary: List all items for a conversation with the given ID. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation to list items for. + - name: limit + in: query + description: |- + A limit on the number of objects to be returned. Limit can range between + 1 and 100, and the default is 20. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - in: query + name: order + schema: + type: string + enum: + - asc + - desc + description: | + The order to return the input items in. Default is `desc`. + - `asc`: Return the input items in ascending order. + - `desc`: Return the input items in descending order. + - in: query + name: after + schema: + type: string + description: | + An item ID to list items after, used in pagination. + - name: include + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: |- + Specify additional output data to include in the model response. Currently supported values are: + - `web_search_call.action.sources`: Include the sources of the web search tool call. + - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items. + - `computer_call_output.output.image_url`: Include image urls from the computer call output. + - `file_search_call.results`: Include the search results of the file search tool call. + - `message.input_image.image_url`: Include image urls from the input message. + - `message.output_text.logprobs`: Include logprobs with assistant messages. + - `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). + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationItemList' + x-oaiMeta: + name: List items + group: conversations + path: list-items + examples: + request: + curl: | + curl "https://api.openai.com/v1/conversations/conv_123/items?limit=10" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const items = await client.conversations.items.list("conv_123", { limit: 10 }); + console.log(items.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.conversations.items.list( + conversation_id="conv_123", + ) + page = page.data[0] + print(page) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ConversationItemList items = client.ConversationItems.List( + conversationId: "conv_123", + new ListConversationItemsOptions { Limit = 10 } + ); + Console.WriteLine(items.Data.Count); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const conversationItem of client.conversations.items.list('conv_123')) { + console.log(conversationItem); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Conversations.Items.List(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ItemListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.items.ItemListPage; + import com.openai.models.conversations.items.ItemListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemListPage page = client.conversations().items().list("conv_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.conversations.items.list("conv_123") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "type": "message", + "id": "msg_abc", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + } + ], + "first_id": "msg_abc", + "last_id": "msg_abc", + "has_more": false + } + /conversations/{conversation_id}/items/{item_id}: + get: + operationId: getConversationItem + tags: + - Conversations + summary: Get a single item from a conversation with the given IDs. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation that contains the item. + - in: path + name: item_id + required: true + schema: + type: string + example: msg_abc + description: The ID of the item to retrieve. + - name: include + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/IncludeEnum' + description: | + Additional fields to include in the response. See the `include` + parameter for [listing Conversation items above](/docs/api-reference/conversations/list-items#conversations_list_items-include) for more information. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationItem' + x-oaiMeta: + name: Retrieve an item + group: conversations + path: get-item + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123/items/msg_abc \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const item = await client.conversations.items.retrieve( + "conv_123", + "msg_abc" + ); + console.log(item); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation_item = client.conversations.items.retrieve( + item_id="msg_abc", + conversation_id="conv_123", + ) + print(conversation_item) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ConversationItem item = client.ConversationItems.Get( + conversationId: "conv_123", + itemId: "msg_abc" + ); + Console.WriteLine(item.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversationItem = await client.conversations.items.retrieve('msg_abc', { + conversation_id: 'conv_123', + }); + + console.log(conversationItem); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationItem, err := client.Conversations.Items.Get(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\t\"msg_abc\",\n\t\tconversations.ItemGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationItem)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.items.ConversationItem; + import com.openai.models.conversations.items.ItemRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemRetrieveParams params = ItemRetrieveParams.builder() + .conversationId("conv_123") + .itemId("msg_abc") + .build(); + ConversationItem conversationItem = client.conversations().items().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation_item = openai.conversations.items.retrieve("msg_abc", conversation_id: "conv_123") + + puts(conversation_item) + response: | + { + "type": "message", + "id": "msg_abc", + "status": "completed", + "role": "user", + "content": [ + {"type": "input_text", "text": "Hello!"} + ] + } + delete: + operationId: deleteConversationItem + tags: + - Conversations + summary: Delete an item from a conversation with the given IDs. + parameters: + - in: path + name: conversation_id + required: true + schema: + type: string + example: conv_123 + description: The ID of the conversation that contains the item. + - in: path + name: item_id + required: true + schema: + type: string + example: msg_abc + description: The ID of the item to delete. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Delete an item + group: conversations + path: delete-item + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/conversations/conv_123/items/msg_abc \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const conversation = await client.conversations.items.delete( + "conv_123", + "msg_abc" + ); + console.log(conversation); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.items.delete( + item_id="msg_abc", + conversation_id="conv_123", + ) + print(conversation.id) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation conversation = client.ConversationItems.Delete( + conversationId: "conv_123", + itemId: "msg_abc" + ); + Console.WriteLine(conversation.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversation = await client.conversations.items.delete('msg_abc', { + conversation_id: 'conv_123', + }); + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Items.Delete(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\t\"msg_abc\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.items.ItemDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ItemDeleteParams params = ItemDeleteParams.builder() + .conversationId("conv_123") + .itemId("msg_abc") + .build(); + Conversation conversation = client.conversations().items().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation = openai.conversations.items.delete("msg_abc", conversation_id: "conv_123") + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "demo"} + } + /conversations: + post: + tags: + - Conversations + summary: Create a conversation. + operationId: createConversation + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateConversationBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Create a conversation + group: conversations + path: create + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "metadata": {"topic": "demo"}, + "items": [ + { + "type": "message", + "role": "user", + "content": "Hello!" + } + ] + }' + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const conversation = await client.conversations.create({ + metadata: { topic: "demo" }, + items: [ + { type: "message", role: "user", content: "Hello!" } + ], + }); + console.log(conversation); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.create() + print(conversation.id) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation conversation = client.CreateConversation( + new CreateConversationOptions + { + Metadata = new Dictionary + { + { "topic", "demo" } + }, + Items = + { + new ConversationMessageInput + { + Role = "user", + Content = "Hello!", + } + } + } + ); + Console.WriteLine(conversation.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversation = await client.conversations.create(); + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.New(context.TODO(), conversations.ConversationNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.ConversationCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Conversation conversation = client.conversations().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation = openai.conversations.create + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "demo"} + } + /conversations/{conversation_id}: + get: + tags: + - Conversations + summary: Get a conversation + operationId: getConversation + parameters: + - name: conversation_id + in: path + description: The ID of the conversation to retrieve. + required: true + schema: + example: conv_123 + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Retrieve a conversation + group: conversations + path: retrieve + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const conversation = await client.conversations.retrieve("conv_123"); + console.log(conversation); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.retrieve( + "conv_123", + ) + print(conversation.id) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation conversation = client.GetConversation("conv_123"); + Console.WriteLine(conversation.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversation = await client.conversations.retrieve('conv_123'); + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Get(context.TODO(), \"conv_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.ConversationRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Conversation conversation = client.conversations().retrieve("conv_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation = openai.conversations.retrieve("conv_123") + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "demo"} + } + delete: + tags: + - Conversations + summary: Delete a conversation. Items in the conversation will not be deleted. + operationId: deleteConversation + parameters: + - name: conversation_id + in: path + description: The ID of the conversation to delete. + required: true + schema: + example: conv_123 + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedConversationResource' + x-oaiMeta: + name: Delete a conversation + group: conversations + path: delete + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/conversations/conv_123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const deleted = await client.conversations.delete("conv_123"); + console.log(deleted); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation_deleted_resource = client.conversations.delete( + "conv_123", + ) + print(conversation_deleted_resource.id) + csharp: | + using System; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + DeletedConversation deleted = client.DeleteConversation("conv_123"); + Console.WriteLine(deleted.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversationDeletedResource = await client.conversations.delete('conv_123'); + + console.log(conversationDeletedResource.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversationDeletedResource, err := client.Conversations.Delete(context.TODO(), \"conv_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversationDeletedResource.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.conversations.ConversationDeleteParams; + import com.openai.models.conversations.ConversationDeletedResource; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ConversationDeletedResource conversationDeletedResource = client.conversations().delete("conv_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation_deleted_resource = openai.conversations.delete("conv_123") + + puts(conversation_deleted_resource) + response: | + { + "id": "conv_123", + "object": "conversation.deleted", + "deleted": true + } + post: + tags: + - Conversations + summary: Update a conversation + operationId: updateConversation + parameters: + - name: conversation_id + in: path + description: The ID of the conversation to update. + required: true + schema: + example: conv_123 + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateConversationBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResource' + x-oaiMeta: + name: Update a conversation + group: conversations + path: update + examples: + request: + curl: | + curl https://api.openai.com/v1/conversations/conv_123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "metadata": {"topic": "project-x"} + }' + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const updated = await client.conversations.update( + "conv_123", + { metadata: { topic: "project-x" } } + ); + console.log(updated); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + conversation = client.conversations.update( + conversation_id="conv_123", + metadata={ + "foo": "string" + }, + ) + print(conversation.id) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Conversations; + + OpenAIConversationClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + Conversation updated = client.UpdateConversation( + conversationId: "conv_123", + new UpdateConversationOptions + { + Metadata = new Dictionary + { + { "topic", "project-x" } + } + } + ); + Console.WriteLine(updated.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const conversation = await client.conversations.update('conv_123', { metadata: { foo: 'string' } }); + + console.log(conversation.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/conversations\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/shared\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconversation, err := client.Conversations.Update(\n\t\tcontext.TODO(),\n\t\t\"conv_123\",\n\t\tconversations.ConversationUpdateParams{\n\t\t\tMetadata: shared.Metadata{\n\t\t\t\t\"foo\": \"string\",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", conversation.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.conversations.Conversation; + import com.openai.models.conversations.ConversationUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ConversationUpdateParams params = ConversationUpdateParams.builder() + .conversationId("conv_123") + .metadata(ConversationUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build()) + .build(); + Conversation conversation = client.conversations().update(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + conversation = openai.conversations.update("conv_123", metadata: {foo: "string"}) + + puts(conversation) + response: | + { + "id": "conv_123", + "object": "conversation", + "created_at": 1741900000, + "metadata": {"topic": "project-x"} + } +components: + schemas: + 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: + - `web_search_call.results`: Include the search results of the web search tool call. + - `web_search_call.action.sources`: Include the sources of the web search tool call. + - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items. + - `computer_call_output.output.image_url`: Include image urls from the computer call output. + - `file_search_call.results`: Include the search results of the file search tool call. + - `message.input_image.image_url`: Include image urls from the input message. + - `message.output_text.logprobs`: Include logprobs with assistant messages. + - `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). + InputItem: + discriminator: + propertyName: type + type: object + title: Input message + description: | + A message input to the model with a role indicating instruction following + hierarchy. Instructions given with the `developer` or `system` role take + precedence over instructions given with the `user` role. Messages with the + `assistant` role are presumed to have been generated by the model in previous + interactions. + properties: + role: + type: string + description: | + The role of the message input. One of `user`, `assistant`, `system`, or + `developer`. + enum: + - user + - assistant + - system + - developer + content: + description: | + Text, image, or audio input to the model, used to generate a response. + Can also contain previous assistant responses. + type: string + title: Text input + items: + $ref: '#/components/schemas/InputContent' + phase: + type: string + 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. + enum: + - commentary + - final_answer + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + status: + type: string + description: | + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + id: + type: string + description: | + The unique ID of the output message. + queries: + type: array + items: + type: string + description: | + The queries used to search for files. + results: + type: array + description: | + The results of the file search tool call. + items: + type: object + properties: + file_id: + type: string + description: | + The unique ID of the file. + text: + type: string + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. + call_id: + type: string + description: | + An identifier used when responding to the tool call with output. + 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. + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + acknowledged_safety_checks: + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + type: array + description: The safety checks reported by the API that have been acknowledged by the developer. + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. + 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. + encrypted_content: + type: string + description: | + The encrypted content of the reasoning item - populated when a response is + generated with `reasoning.encrypted_content` in the `include` parameter. + summary: + type: array + description: | + Reasoning summary content. + items: + $ref: '#/components/schemas/SummaryTextContent' + result: + type: string + description: | + The generated image encoded in base64. + container_id: + type: string + description: | + The ID of the container used to run the code. + code: + type: string + description: | + The code to run, or null if not available. + outputs: + 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. + Can be null if no outputs are available. + environment: + oneOf: + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + description: The environment to execute the shell commands in. + discriminator: + propertyName: type + type: 'null' + max_output_length: + type: integer + description: The maximum number of UTF-8 characters captured for this shell call's combined output. + operation: + $ref: '#/components/schemas/ApplyPatchOperationParam' + description: The specific create, delete, or update instruction for the apply_patch tool call. + server_label: + type: string + description: | + The label of the MCP server. + error: + type: string + description: | + Error message if the server could not list tools. + approval_request_id: + type: string + description: | + The ID of the approval request being answered. + approve: + type: boolean + description: | + Whether the request was approved. + reason: + type: string + description: | + Optional reason for the decision. + input: + type: string + description: | + The input for the custom tool call generated by the model. + required: + - role + - content + - id + - type + - status + - queries + - call_id + - pending_safety_checks + - output + - action + - name + - arguments + - tools + - summary + - encrypted_content + - result + - container_id + - code + - outputs + - operation + - server_label + - request_id + - approve + - approval_request_id + - input + 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' + 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. + last_id: + type: string + description: The ID of the last item in the list. + required: + - object + - data + - has_more + - first_id + - last_id + x-oaiMeta: + name: The item list + group: conversations + 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](/docs/api-reference/responses/object#responses/object-output). + discriminator: + propertyName: type + 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: + type: string + enum: + - commentary + - final_answer + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. + created_by: + type: string + description: | + The identifier of the actor that created the item. + output: + description: | + The output from the function call generated by your code. + Can be a string or an list of output content. + type: string + title: string output + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + queries: + type: array + items: + type: string + description: | + The queries used to search for files. + results: + type: array + description: | + The results of the file search tool call. + items: + type: object + properties: + file_id: + type: string + description: | + The unique ID of the file. + text: + type: string + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. + action: + type: object + description: | + An object describing the specific action taken in this web search call. + Includes details on how the model used the web (search, open_page, find_in_page). + discriminator: + propertyName: type + title: Search action + properties: + type: + type: string + enum: + - search + description: | + The action type. + x-stainless-const: true + query: + type: string + description: | + [DEPRECATED] The search query. + queries: + type: array + title: Search queries + description: | + The search queries. + items: + type: string + description: | + A search query. + sources: + type: array + title: Web search sources + description: | + The sources used in the search. + items: + type: object + title: Web search source + description: | + A source used in the search. + properties: + type: + type: string + enum: + - url + description: | + The type of source. Always `url`. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the source. + required: + - type + - url + url: + description: | + The URL opened by the model. + type: string + format: uri + pattern: + type: string + description: | + The pattern or text to search for within the page. + required: + - type + - query + - url + - pattern + result: + type: string + description: | + The generated image encoded in base64. + actions: + $ref: '#/components/schemas/ComputerActionList' + pending_safety_checks: + type: array + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + description: | + The pending safety checks for the computer call. + acknowledged_safety_checks: + type: array + description: | + The safety checks reported by the API that have been acknowledged by the + developer. + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + 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. + encrypted_content: + type: string + description: | + The encrypted content of the reasoning item - populated when a response is + generated with `reasoning.encrypted_content` in the `include` parameter. + summary: + type: array + description: | + Reasoning summary content. + items: + $ref: '#/components/schemas/SummaryTextContent' + container_id: + type: string + description: | + The ID of the container used to run the code. + code: + type: string + description: | + The code to run, or null if not available. + outputs: + 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. + Can be null if no outputs are available. + environment: + type: string + format: json + max_output_length: + 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. + operation: + title: Apply patch operation + description: One of the create_file, delete_file, or update_file operations applied via apply_patch. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - create_file + description: Create a new file with the provided diff. + default: create_file + x-stainless-const: true + path: + type: string + description: Path of the file to create. + diff: + type: string + description: Diff to apply. + type: object + required: + - type + - path + - diff + server_label: + type: string + description: | + The label of the MCP server. + error: + type: string + description: | + Error message if the server could not list tools. + approval_request_id: + type: string + description: | + The ID of the approval request being answered. + approve: + type: boolean + description: | + Whether the request was approved. + reason: + type: string + description: | + Optional reason for the decision. + input: + type: string + description: | + The input for the custom tool call generated by the model. + type: object + required: + - type + - id + - status + - role + - content + - call_id + - name + - arguments + - output + - queries + - action + - result + - pending_safety_checks + - execution + - tools + - summary + - encrypted_content + - container_id + - code + - outputs + - environment + - max_output_length + - operation + - server_label + - request_id + - approve + - approval_request_id + - input + ConversationResource: + properties: + id: + type: string + description: The unique ID of the conversation. + object: + type: string + enum: + - conversation + description: The object type, which is always `conversation`. + default: conversation + 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. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + 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 + CreateConversationBody: + properties: + metadata: + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + items: + 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: object + required: [] + DeletedConversationResource: + properties: + object: + type: string + enum: + - conversation.deleted + default: conversation.deleted + x-stainless-const: true + deleted: + type: boolean + id: + type: string + type: object + required: + - object + - deleted + - id + UpdateConversationBody: + 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. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + type: object + required: + - metadata + EasyInputMessage: + type: object + title: Input message + description: | + A message input to the model with a role indicating instruction following + hierarchy. Instructions given with the `developer` or `system` role take + precedence over instructions given with the `user` role. Messages with the + `assistant` role are presumed to have been generated by the model in previous + interactions. + properties: + role: + type: string + description: | + The role of the message input. One of `user`, `assistant`, `system`, or + `developer`. + enum: + - user + - assistant + - system + - developer + content: + description: | + Text, image, or audio input to the model, used to generate a response. + Can also contain previous assistant responses. + type: string + title: Text input + items: + $ref: '#/components/schemas/InputContent' + phase: + type: string + 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. + enum: + - commentary + - final_answer + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + required: + - role + - content + Item: + type: object + description: | + Content item used to generate a response. + discriminator: + propertyName: type + title: Input message + properties: + type: + type: string + description: | + The type of the message input. Always set to `message`. + enum: + - message + x-stainless-const: true + role: + type: string + description: | + The role of the message input. One of `user`, `system`, or `developer`. + enum: + - user + - system + - developer + status: + type: string + description: | + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + content: + $ref: '#/components/schemas/InputMessageContentList' + id: + type: string + description: | + The unique ID of the output message. + phase: + type: string + 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. + enum: + - commentary + - final_answer + queries: + type: array + items: + type: string + description: | + The queries used to search for files. + results: + type: array + description: | + The results of the file search tool call. + items: + type: object + properties: + file_id: + type: string + description: | + The unique ID of the file. + text: + type: string + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. + call_id: + type: string + description: | + An identifier used when responding to the tool call with output. + 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. + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + acknowledged_safety_checks: + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + type: array + description: The safety checks reported by the API that have been acknowledged by the developer. + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. + 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. + encrypted_content: + type: string + description: | + The encrypted content of the reasoning item - populated when a response is + generated with `reasoning.encrypted_content` in the `include` parameter. + summary: + type: array + description: | + Reasoning summary content. + items: + $ref: '#/components/schemas/SummaryTextContent' + result: + type: string + description: | + The generated image encoded in base64. + container_id: + type: string + description: | + The ID of the container used to run the code. + code: + type: string + description: | + The code to run, or null if not available. + outputs: + 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. + Can be null if no outputs are available. + environment: + oneOf: + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + description: The environment to execute the shell commands in. + discriminator: + propertyName: type + type: 'null' + max_output_length: + type: integer + description: The maximum number of UTF-8 characters captured for this shell call's combined output. + operation: + $ref: '#/components/schemas/ApplyPatchOperationParam' + description: The specific create, delete, or update instruction for the apply_patch tool call. + server_label: + type: string + description: | + The label of the MCP server. + error: + type: string + description: | + Error message if the server could not list tools. + approval_request_id: + type: string + description: | + The ID of the approval request being answered. + approve: + type: boolean + description: | + Whether the request was approved. + reason: + type: string + description: | + Optional reason for the decision. + input: + type: string + description: | + The input for the custom tool call generated by the model. + required: + - role + - content + - id + - type + - status + - queries + - call_id + - pending_safety_checks + - output + - action + - name + - arguments + - tools + - summary + - encrypted_content + - result + - container_id + - code + - outputs + - operation + - server_label + - request_id + - approve + - approval_request_id + - input + ItemReferenceParam: + properties: + type: + type: string + enum: + - item_reference + description: The type of item to reference. Always `item_reference`. + default: item_reference + x-stainless-const: true + id: + type: string + description: The ID of the item to reference. + type: object + required: + - id + title: Item reference + description: An internal identifier for an item to reference. + 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: + type: string + enum: + - commentary + - final_answer + type: object + required: + - type + - id + - status + - role + - content + title: Message + description: A message to or from the model. + FunctionToolCallResource: + type: object + title: Function tool call + description: | + A tool call to run a function. See the + [function calling guide](/docs/guides/function-calling) for more information. + properties: + id: + type: string + description: | + The unique ID of the function tool call. + type: + type: string + enum: + - function_call + description: | + The type of the function tool call. Always `function_call`. + x-stainless-const: true + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - type + - call_id + - name + - arguments + - id + - status + FunctionToolCallOutputResource: + type: object + title: Function tool call output + description: | + The output of a function tool call. + properties: + id: + type: string + description: | + The unique ID of the function tool call output. Populated when this item + is returned via API. + type: + type: string + enum: + - function_call_output + description: | + The type of the function tool call output. Always `function_call_output`. + x-stainless-const: true + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + output: + description: | + The output from the function call generated by your code. + Can be a string or an list of output content. + type: string + title: string output + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - type + - call_id + - output + - id + - status + FileSearchToolCall: + type: object + title: File search tool call + description: | + The results of a file search tool call. See the + [file search guide](/docs/guides/tools-file-search) for more information. + properties: + id: + type: string + description: | + The unique ID of the file search tool call. + type: + type: string + enum: + - file_search_call + description: | + The type of the file search tool call. Always `file_search_call`. + x-stainless-const: true + status: + type: string + description: | + The status of the file search tool call. One of `in_progress`, + `searching`, `incomplete` or `failed`, + enum: + - in_progress + - searching + - completed + - incomplete + - failed + queries: + type: array + items: + type: string + description: | + The queries used to search for files. + results: + type: array + description: | + The results of the file search tool call. + items: + type: object + properties: + file_id: + type: string + description: | + The unique ID of the file. + text: + type: string + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. + required: + - id + - type + - status + - queries + WebSearchToolCall: + type: object + title: Web search tool call + description: | + The results of a web search tool call. See the + [web search guide](/docs/guides/tools-web-search) for more information. + properties: + id: + type: string + description: | + The unique ID of the web search tool call. + type: + type: string + enum: + - web_search_call + description: | + The type of the web search tool call. Always `web_search_call`. + x-stainless-const: true + status: + type: string + description: | + The status of the web search tool call. + enum: + - in_progress + - searching + - completed + - failed + action: + type: object + description: | + An object describing the specific action taken in this web search call. + Includes details on how the model used the web (search, open_page, find_in_page). + discriminator: + propertyName: type + title: Search action + properties: + type: + type: string + enum: + - search + description: | + The action type. + x-stainless-const: true + query: + type: string + description: | + [DEPRECATED] The search query. + queries: + type: array + title: Search queries + description: | + The search queries. + items: + type: string + description: | + A search query. + sources: + type: array + title: Web search sources + description: | + The sources used in the search. + items: + type: object + title: Web search source + description: | + A source used in the search. + properties: + type: + type: string + enum: + - url + description: | + The type of source. Always `url`. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the source. + required: + - type + - url + url: + description: | + The URL opened by the model. + type: string + format: uri + pattern: + type: string + description: | + The pattern or text to search for within the page. + required: + - type + - query + - url + - pattern + required: + - id + - type + - status + - action + ImageGenToolCall: + type: object + title: Image generation call + description: | + An image generation request made by the model. + properties: + type: + type: string + enum: + - image_generation_call + description: | + The type of the image generation call. Always `image_generation_call`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the image generation call. + status: + type: string + enum: + - in_progress + - completed + - generating + - failed + description: | + The status of the image generation call. + result: + type: string + description: | + The generated image encoded in base64. + required: + - type + - id + - status + - result + ComputerToolCall: + type: object + title: Computer tool call + description: | + A tool call to a computer use tool. See the + [computer use guide](/docs/guides/tools-computer-use) for more information. + 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. + 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. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - id + - call_id + - pending_safety_checks + - status + ComputerToolCallOutputResource: + type: object + title: Computer tool call output + description: | + The output of a computer tool call. + properties: + type: + type: string + description: | + The type of the computer tool call output. Always `computer_call_output`. + enum: + - computer_call_output + default: computer_call_output + x-stainless-const: true + id: + type: string + description: | + The ID of the computer tool call output. + call_id: + type: string + description: | + The ID of the computer tool call that produced the output. + acknowledged_safety_checks: + type: array + description: | + The safety checks reported by the API that have been acknowledged by the + developer. + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + status: + type: string + description: | + The status of the message input. One of `in_progress`, `completed`, or + `incomplete`. Populated when input items are returned via API. + enum: + - in_progress + - completed + - incomplete + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - type + - call_id + - output + - id + - status + ToolSearchCall: + properties: + 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 unique ID of the tool search call item. + call_id: + type: string + description: The unique ID of the tool search call generated by the model. + 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 + ToolSearchOutput: + properties: + type: + type: string + enum: + - tool_search_output + description: The type of the item. Always `tool_search_output`. + default: tool_search_output + x-stainless-const: true + id: + type: string + description: The unique ID of the tool search output item. + call_id: + type: string + description: The unique ID of the tool search call generated by the model. + 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: + - type + - id + - call_id + - execution + - tools + - status + ReasoningItem: + type: object + description: | + A description of the chain of thought used by a reasoning model while generating + a response. Be sure to include these items in your `input` to the Responses API + for subsequent turns of a conversation if you are manually + [managing context](/docs/guides/conversation-state). + title: Reasoning + properties: + type: + type: string + description: | + The type of the object. Always `reasoning`. + enum: + - reasoning + x-stainless-const: true + id: + type: string + description: | + The unique identifier of the reasoning content. + encrypted_content: + type: string + description: | + The encrypted content of the reasoning item - populated when a response is + generated with `reasoning.encrypted_content` in the `include` parameter. + summary: + type: array + description: | + Reasoning summary content. + items: + $ref: '#/components/schemas/SummaryTextContent' + content: + type: array + description: | + Reasoning text content. + items: + $ref: '#/components/schemas/ReasoningTextContent' + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - id + - summary + - type + CompactionBody: + properties: + type: + type: string + enum: + - compaction + description: The type of the item. Always `compaction`. + default: compaction + x-stainless-const: true + id: + type: string + 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 + - id + - encrypted_content + title: Compaction item + description: A compaction item generated by the [`v1/responses/compact` API](/docs/api-reference/responses/compact). + CodeInterpreterToolCall: + type: object + title: Code interpreter tool call + description: | + A tool call to run code. + 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`. + id: + type: string + description: | + The unique ID of the code interpreter tool call. + 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`. + container_id: + type: string + description: | + The ID of the container used to run the code. + code: + type: string + description: | + The code to run, or null if not available. + outputs: + 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. + Can be null if no outputs are available. + required: + - type + - id + - status + - container_id + - code + - outputs + LocalShellToolCall: + type: object + title: Local shell call + description: | + A tool call to run a command on the local shell. + properties: + type: + type: string + enum: + - local_shell_call + description: | + The type of the local shell call. Always `local_shell_call`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the local shell call. + call_id: + type: string + description: | + The unique ID of the local shell tool call generated by the model. + action: + $ref: '#/components/schemas/LocalShellExecAction' + status: + type: string + enum: + - in_progress + - completed + - incomplete + description: | + The status of the local shell call. + required: + - type + - id + - call_id + - action + - status + LocalShellToolCallOutput: + type: object + title: Local shell call output + description: | + The output of a local shell tool call. + properties: + type: + type: string + enum: + - local_shell_call_output + description: | + The type of the local shell tool call output. Always `local_shell_call_output`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the local shell tool call generated by the model. + output: + type: string + description: | + A JSON string of the output of the local shell tool call. + status: + type: string + enum: + - in_progress + - completed + - incomplete + description: | + The status of the item. One of `in_progress`, `completed`, or `incomplete`. + required: + - id + - type + - call_id + - output + FunctionShellCall: + 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. + 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: + oneOf: + - $ref: '#/components/schemas/LocalEnvironmentResource' + - $ref: '#/components/schemas/ContainerReferenceResource' + discriminator: + propertyName: type + type: 'null' + created_by: + type: string + description: The ID of the entity that created this tool call. + 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. + 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 + 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. + 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: + 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. + 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. + ApplyPatchToolCall: + properties: + type: + type: string + enum: + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_call + x-stainless-const: true + id: + type: string + description: The unique ID of the apply patch tool call. Populated when this item is returned via API. + call_id: + type: string + description: The unique ID of the apply patch tool call generated by the model. + status: + $ref: '#/components/schemas/ApplyPatchCallStatus' + description: The status of the apply patch tool call. One of `in_progress` or `completed`. + operation: + title: Apply patch operation + description: One of the create_file, delete_file, or update_file operations applied via apply_patch. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - create_file + description: Create a new file with the provided diff. + default: create_file + x-stainless-const: true + path: + type: string + description: Path of the file to create. + diff: + type: string + description: Diff to apply. + type: object + required: + - type + - path + - diff + created_by: + type: string + description: The ID of the entity that created this tool call. + type: object + required: + - type + - id + - call_id + - status + - operation + title: Apply patch tool call + description: A tool call that applies file diffs by creating, deleting, or updating files. + 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 + id: + type: string + description: The unique ID of the apply patch tool call output. Populated when this item is returned via API. + call_id: + type: string + description: The unique ID of the apply patch tool call generated by the model. + status: + $ref: '#/components/schemas/ApplyPatchCallOutputStatus' + description: The status of the apply patch tool call output. One of `completed` or `failed`. + output: + type: string + description: Optional textual output returned by the apply patch tool. + created_by: + type: string + description: The ID of the entity that created this tool call output. + type: object + required: + - type + - id + - call_id + - status + title: Apply patch tool call output + description: The output emitted by an apply patch tool call. + MCPListTools: + type: object + title: MCP list tools + description: | + A list of tools available on an MCP server. + 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. + error: + type: string + description: | + Error message if the server could not list tools. + required: + - type + - id + - server_label + - tools + MCPApprovalRequest: + type: object + title: MCP approval request + description: | + A request for human approval of a tool invocation. + 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 + MCPApprovalResponseResource: + type: object + title: MCP approval response + description: | + A response to an MCP approval request. + 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: + type: string + description: | + Optional reason for the decision. + required: + - type + - id + - request_id + - approve + - approval_request_id + MCPToolCall: + type: object + title: MCP tool call + description: | + An invocation of a tool on an MCP server. + 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. + output: + type: string + description: | + The output from the tool call. + error: + type: string + description: | + The error from the tool call, if any. + status: + $ref: '#/components/schemas/MCPToolCallStatus' + description: | + The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`. + approval_request_id: + type: string + description: | + Unique identifier for the MCP tool call approval request. + Include this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call. + required: + - type + - id + - server_label + - name + - arguments + CustomToolCall: + type: object + title: Custom tool call + description: | + A call to a custom tool created by the model. + properties: + type: + type: string + enum: + - custom_tool_call + x-stainless-const: true + description: | + The type of the custom tool call. Always `custom_tool_call`. + id: + type: string + description: | + The unique ID of the custom tool call in the OpenAI platform. + call_id: + type: string + description: | + An identifier used to map this custom tool call to a tool call output. + namespace: + type: string + description: | + The namespace of the custom tool being called. + name: + type: string + description: | + The name of the custom tool being called. + input: + type: string + description: | + The input for the custom tool call generated by the model. + 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. + 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`. + id: + type: string + description: | + The unique ID of the custom tool call output in the OpenAI platform. + call_id: + type: string + description: | + The call ID, used to map this custom tool call output to a custom tool call. + output: + description: | + The output from the custom tool call generated by your code. + Can be a string or an list of output content. + type: string + title: string output + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + required: + - type + - call_id + - output + Metadata: + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + InputMessageContentList: + type: array + title: Input item content list + description: | + A list of one or many input items to the model, containing different content + types. + items: + $ref: '#/components/schemas/InputContent' + MessagePhase: + type: string + 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. + enum: + - commentary + - final_answer + InputMessage: + type: object + title: Input message + description: | + A message input to the model with a role indicating instruction following + hierarchy. Instructions given with the `developer` or `system` role take + precedence over instructions given with the `user` role. + properties: + type: + type: string + description: | + The type of the message input. Always set to `message`. + enum: + - message + x-stainless-const: true + role: + type: string + description: | + The role of the message input. One of `user`, `system`, or `developer`. + enum: + - user + - system + - developer + status: + type: string + description: | + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + content: + $ref: '#/components/schemas/InputMessageContentList' + required: + - role + - content + OutputMessage: + type: object + title: Output message + description: | + An output message from the model. + properties: + id: + type: string + description: | + The unique ID of the output message. + type: + type: string + description: | + The type of the output message. Always `message`. + enum: + - message + x-stainless-const: true + role: + type: string + description: | + The role of the output message. Always `assistant`. + enum: + - assistant + x-stainless-const: true + content: + type: array + description: | + The content of the output message. + items: + $ref: '#/components/schemas/OutputMessageContent' + phase: + type: string + 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. + enum: + - commentary + - final_answer + status: + type: string + description: | + The status of the message input. One of `in_progress`, `completed`, or + `incomplete`. Populated when input items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - id + - type + - role + - content + - status + ComputerCallOutputItemParam: + properties: + id: + type: string + description: The ID of the computer tool call output. + example: cuo_123 + 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: + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + type: array + description: The safety checks reported by the API that have been acknowledged by the developer. + status: + type: string + enum: + - in_progress + - completed + - incomplete + type: object + required: + - call_id + - type + - output + title: Computer tool call output + description: The output of a computer tool call. + FunctionToolCall: + type: object + title: Function tool call + description: | + A tool call to run a function. See the + [function calling guide](/docs/guides/function-calling) for more information. + properties: + id: + type: string + description: | + The unique ID of the function tool call. + type: + type: string + enum: + - function_call + description: | + The type of the function tool call. Always `function_call`. + x-stainless-const: true + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - name + - arguments + FunctionCallOutputItemParam: + properties: + id: + type: string + description: The unique ID of the function tool call output. Populated when this item is returned via API. + example: fc_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the function tool call generated by the model. + 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: + description: Text, image, or file output of the function tool call. + type: string + maxLength: 10485760 + 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 + status: + type: string + enum: + - in_progress + - completed + - incomplete + type: object + required: + - call_id + - type + - output + title: Function tool call output + description: The output of a function tool call. + ToolSearchCallItemParam: + properties: + id: + type: string + description: The unique ID of this tool search call. + example: tsc_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the tool search call generated by the model. + type: + type: string + 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: + type: string + enum: + - in_progress + - completed + - incomplete + type: object + required: + - type + - arguments + ToolSearchOutputItemParam: + properties: + id: + type: string + description: The unique ID of this tool search output. + example: tso_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the tool search call generated by the model. + type: + type: string + enum: + - 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/Tool' + type: array + description: The loaded tool definitions returned by the tool search output. + status: + type: string + enum: + - in_progress + - completed + - incomplete + type: object + required: + - type + - tools + CompactionSummaryItemParam: + properties: + id: + type: string + description: The ID of the compaction item. + example: cmp_123 + type: + type: string + enum: + - compaction + description: The type of the item. Always `compaction`. + default: compaction + x-stainless-const: true + encrypted_content: + type: string + maxLength: 10485760 + 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](/docs/api-reference/responses/compact). + FunctionShellCallItemParam: + properties: + id: + type: string + description: The unique ID of the shell tool call. Populated when this item is returned via API. + example: sh_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the shell tool call generated by the model. + 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: + type: string + enum: + - in_progress + - completed + - incomplete + title: Shell call status + description: Status values reported for shell tool calls. + environment: + oneOf: + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + description: The environment to execute the shell commands in. + discriminator: + propertyName: type + type: 'null' + type: object + required: + - call_id + - type + - action + title: Shell tool call + description: A tool representing a request to execute one or more shell commands. + FunctionShellCallOutputItemParam: + properties: + id: + type: string + description: The unique ID of the shell tool call output. Populated when this item is returned via API. + example: sho_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the shell tool call generated by the model. + 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 + output: + items: + $ref: '#/components/schemas/FunctionShellCallOutputContentParam' + type: array + description: Captured chunks of stdout and stderr output, along with their associated outcomes. + status: + type: string + enum: + - in_progress + - completed + - incomplete + title: Shell call status + description: Status values reported for shell tool calls. + max_output_length: + type: integer + description: The maximum number of UTF-8 characters captured for this shell call's combined output. + type: object + required: + - call_id + - type + - output + title: Shell tool call output + description: The streamed output items emitted by a shell tool call. + ApplyPatchToolCallItemParam: + properties: + type: + type: string + enum: + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_call + x-stainless-const: true + id: + type: string + description: The unique ID of the apply patch tool call. Populated when this item is returned via API. + example: apc_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + 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: + - type + - call_id + - status + - operation + title: Apply patch tool call + description: A tool call representing a request to create, delete, or update files using diff patches. + ApplyPatchToolCallOutputItemParam: + 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 + id: + type: string + description: The unique ID of the apply patch tool call output. Populated when this item is returned via API. + example: apco_123 + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + status: + $ref: '#/components/schemas/ApplyPatchCallOutputStatusParam' + description: The status of the apply patch tool call output. One of `completed` or `failed`. + output: + type: string + maxLength: 10485760 + description: Optional human-readable log text from the apply patch tool (e.g., patch results or errors). + type: object + required: + - type + - call_id + - status + title: Apply patch tool call output + description: The streamed output emitted by an apply patch tool call. + MCPApprovalResponse: + type: object + title: MCP approval response + description: | + A response to an MCP approval request. + 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: + type: string + description: | + Optional reason for the decision. + required: + - type + - request_id + - approve + - approval_request_id + MessageStatus: + type: string + enum: + - in_progress + - completed + - incomplete + MessageRole: + type: string + enum: + - unknown + - user + - assistant + - system + - critic + - discriminator + - developer + - tool + 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. + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + 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 + text: + type: string + description: The text output from the model. + annotations: + items: + $ref: '#/components/schemas/Annotation' + type: array + description: The annotations of the text output. + 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 + 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 + 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 + 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. + 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 + image_url: + 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. + file_id: + type: string + description: The ID of the file to be sent to the model. + 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`. + type: object + required: + - type + - detail + title: Input image + description: An image input to the model. Learn about [image inputs](/docs/guides/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: + type: string + format: uri + description: The URL of the screenshot image. + file_id: + type: string + description: The identifier of an uploaded file that contains the screenshot. + 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`. + type: object + required: + - type + - image_url + - file_id + - detail + title: Computer screenshot + description: A screenshot of a computer. + 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: + type: string + description: The ID of the file to be sent to the model. + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + 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 `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`. + type: object + required: + - type + title: Input file + description: A file input to the model. + MessagePhase-2: + type: string + enum: + - commentary + - final_answer + FunctionCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + FunctionToolCallOutput: + type: object + title: Function tool call output + description: | + The output of a function tool call. + properties: + id: + type: string + description: | + The unique ID of the function tool call output. Populated when this item + is returned via API. + type: + type: string + enum: + - function_call_output + description: | + The type of the function tool call output. Always `function_call_output`. + x-stainless-const: true + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + output: + description: | + The output from the function call generated by your code. + Can be a string or an list of output content. + type: string + title: string output + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - output + FunctionCallOutputStatusEnum: + type: string + enum: + - in_progress + - completed + - incomplete + VectorStoreFileAttributes: + 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. Keys are strings + with a maximum length of 64 characters. Values are strings with a maximum + length of 512 characters, booleans, or numbers. + maxProperties: 16 + propertyNames: + type: string + maxLength: 64 + additionalProperties: + oneOf: + - type: string + maxLength: 512 + - type: number + - type: boolean + x-oaiTypeLabel: map + WebSearchActionSearch: + type: object + title: Search action + description: | + Action type "search" - Performs a web search query. + properties: + type: + type: string + enum: + - search + description: | + The action type. + x-stainless-const: true + query: + type: string + description: | + [DEPRECATED] The search query. + queries: + type: array + title: Search queries + description: | + The search queries. + items: + type: string + description: | + A search query. + sources: + type: array + title: Web search sources + description: | + The sources used in the search. + items: + type: object + title: Web search source + description: | + A source used in the search. + properties: + type: + type: string + enum: + - url + description: | + The type of source. Always `url`. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the source. + required: + - type + - url + required: + - type + - query + WebSearchActionOpenPage: + type: object + title: Open page action + description: | + Action type "open_page" - Opens a specific URL from search results. + properties: + type: + type: string + enum: + - open_page + description: | + The action type. + x-stainless-const: true + url: + description: | + The URL opened by the model. + type: string + format: uri + required: + - type + WebSearchActionFind: + type: object + title: Find action + description: | + Action type "find_in_page": Searches for a pattern within a loaded page. + properties: + type: + type: string + enum: + - find_in_page + description: | + The action type. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the page searched for the pattern. + pattern: + type: string + description: | + The pattern or text to search for within the page. + required: + - type + - url + - pattern + ComputerAction: + discriminator: + propertyName: type + 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: + items: + type: string + type: array + description: The keys being held while clicking. + 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 + ``` + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ] + ``` + scroll_x: + type: integer + description: The horizontal scroll distance. + scroll_y: + type: integer + description: The vertical scroll distance. + text: + type: string + description: The text to type. + type: object + required: + - type + - button + - x + - 'y' + - keys + - path + - scroll_x + - scroll_y + - text + title: Click + description: A click action. + ComputerActionList: + title: Computer Action List + type: array + description: | + Flattened batched actions for `computer_use`. Each action includes an + `type` discriminator and action-specific fields. + items: + $ref: '#/components/schemas/ComputerAction' + ComputerCallSafetyCheckParam: + properties: + id: + type: string + description: The ID of the pending safety check. + code: + type: string + description: The type of the pending safety check. + message: + type: string + description: Details about the pending safety check. + type: object + required: + - id + description: A pending safety check for the computer call. + ComputerToolCallOutput: + type: object + title: Computer tool call output + description: | + The output of a computer tool call. + properties: + type: + type: string + description: | + The type of the computer tool call output. Always `computer_call_output`. + enum: + - computer_call_output + default: computer_call_output + x-stainless-const: true + id: + type: string + description: | + The ID of the computer tool call output. + call_id: + type: string + description: | + The ID of the computer tool call that produced the output. + acknowledged_safety_checks: + type: array + description: | + The safety checks reported by the API that have been acknowledged by the + developer. + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + status: + type: string + description: | + The status of the message input. One of `in_progress`, `completed`, or + `incomplete`. Populated when input items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - output + ComputerCallOutputStatus: + type: string + enum: + - completed + - incomplete + - failed + ToolSearchExecutionType: + type: string + enum: + - server + - client + Tool: + description: | + A tool that can be used to generate a response. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - function + description: The type of the function tool. Always `function`. + default: function + x-stainless-const: true + name: + type: string + description: The name of the function to call. + description: + type: string + description: A description of the function. Used by the model to determine whether or not to call the function. + parameters: + additionalProperties: {} + type: object + description: A JSON schema object describing the parameters of the function. + x-oaiTypeLabel: map + strict: + type: boolean + description: Whether to enforce strict parameter validation. Default `true`. + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + 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: + 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. + 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`. + - `eq`: equals + - `ne`: not equal + - `gt`: greater than + - `gte`: greater than or equal + - `lt`: less than + - `lte`: less than or equal + - `in`: in + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: The value to compare against the attribute key; supports string, number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + 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. + user_location: + $ref: '#/components/schemas/WebSearchApproximateLocation' + search_context_size: + 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. + server_label: + type: string + description: | + A label for this MCP server, used to identify it in tool calls. + server_url: + type: string + format: uri + description: | + The URL for the MCP server. One of `server_url` or `connector_id` must be + provided. + 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 + `server_url` or `connector_id` must be provided. Learn more about service + connectors [here](/docs/guides/tools-remote-mcp#connectors). + + Currently supported `connector_id` values are: + + - Dropbox: `connector_dropbox` + - Gmail: `connector_gmail` + - Google Calendar: `connector_googlecalendar` + - Google Drive: `connector_googledrive` + - Microsoft Teams: `connector_microsoftteams` + - Outlook Calendar: `connector_outlookcalendar` + - Outlook Email: `connector_outlookemail` + - SharePoint: `connector_sharepoint` + authorization: + type: string + description: | + An OAuth access token that can be used with a remote MCP server, either + with a custom MCP server URL or a service connector. Your application + must handle the OAuth authorization flow and provide the token here. + server_description: + type: string + description: | + Optional description of the MCP server, used to provide more context. + headers: + type: object + additionalProperties: + type: string + description: | + Optional HTTP headers to send to the MCP server. Use for authentication + or other purposes. + allowed_tools: + description: | + List of allowed tool names or a filter object. + oneOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/MCPToolFilter' + type: 'null' + require_approval: + 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 + `always`, `never`, or a filter object associated with tools + that require approval. + 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 + `never`. When set to `always`, all tools will require approval. When + set to `never`, all tools will not require approval. + enum: + - always + - never + default: always + type: 'null' + container: + description: | + The code interpreter container. Can be a container ID or an object that + specifies uploaded file IDs to make available to your code, along with an + optional `memory_limit` setting. + type: string + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + required: + - type + title: CodeInterpreterToolAuto + model: + type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-1.5 + description: | + The image generation model to use. Default: `gpt-image-1`. + default: gpt-image-1 + quality: + type: string + enum: + - low + - medium + - high + - auto + description: | + The quality of the generated image. One of `low`, `medium`, `high`, + or `auto`. Default: `auto`. + default: auto + size: + description: The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, 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 + type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + output_format: + type: string + enum: + - png + - webp + - jpeg + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer + minimum: 0 + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: + type: string + enum: + - transparent + - opaque + - auto + description: | + Background type for the generated image. One of `transparent`, + `opaque`, or `auto`. Default: `auto`. + default: auto + input_fidelity: + 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`. + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + 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. + default: 0 + action: + description: | + Whether to generate a new image or edit an existing image. Default: `auto`. + $ref: '#/components/schemas/ImageGenActionEnum' + format: + description: The input format for the custom tool. Default is unconstrained text. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + 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. + type: object + required: + - type + - syntax + - definition + title: Text format + 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 + type: array + minItems: 1 + description: The function/custom tools available inside this namespace. + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search is executed by the server or by the client. + search_content_types: + items: + $ref: '#/components/schemas/SearchContentType' + type: array + type: object + required: + - type + - name + - strict + - parameters + - vector_store_ids + - environment + - display_width + - display_height + - server_label + - container + - description + - tools + title: Function + CodeInterpreterOutputLogs: + properties: + type: + type: string + enum: + - logs + description: The type of the output. Always `logs`. + default: logs + x-stainless-const: true + logs: + type: string + description: The logs output from the code interpreter. + type: object + required: + - type + - logs + 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. + LocalShellExecAction: + properties: + type: + type: string + enum: + - exec + description: The type of the local shell action. Always `exec`. + default: exec + x-stainless-const: true + command: + items: + type: string + type: array + description: The command to run. + timeout_ms: + type: integer + description: Optional timeout in milliseconds for the command. + working_directory: + type: string + description: Optional working directory to run the command in. + env: + additionalProperties: + type: string + type: object + description: Environment variables to set for the command. + x-oaiTypeLabel: map + user: + type: string + description: Optional user to run the command as. + type: object + required: + - type + - command + - env + title: Local shell exec action + description: Execute a shell command on the server. + FunctionShellAction: + properties: + commands: + items: + type: string + description: A list of commands to run. + type: array + timeout_ms: + type: integer + description: Optional timeout in milliseconds for the commands. + max_output_length: + type: integer + description: Optional maximum number of characters to return from each command. + type: object + required: + - commands + - timeout_ms + - max_output_length + title: Shell exec action + description: Execute a shell command. + FunctionShellCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + LocalEnvironmentResource: + properties: + type: + type: string + enum: + - local + description: The environment type. Always `local`. + default: local + x-stainless-const: true + type: object + required: + - type + title: Local Environment + description: Represents the use of a local environment to perform shell actions. + ContainerReferenceResource: + properties: + type: + type: string + enum: + - container_reference + description: The environment type. Always `container_reference`. + default: container_reference + x-stainless-const: true + container_id: + type: string + type: object + required: + - type + - container_id + title: Container Reference + description: Represents a container created with /v1/containers. + FunctionShellCallOutputStatusEnum: + type: string + enum: + - in_progress + - completed + - incomplete + FunctionShellCallOutputContent: + properties: + stdout: + type: string + description: The standard output that was captured. + stderr: + type: string + description: The standard error output that was captured. + outcome: + 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 + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true + exit_code: + type: integer + description: Exit code from the shell process. + type: object + required: + - type + - exit_code + 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. + ApplyPatchCallStatus: + type: string + enum: + - in_progress + - completed + ApplyPatchCreateFileOperation: + properties: + type: + type: string + enum: + - create_file + description: Create a new file with the provided diff. + default: create_file + x-stainless-const: true + path: + type: string + description: Path of the file to create. + diff: + type: string + description: Diff to apply. + type: object + required: + - type + - path + - diff + title: Apply patch create file operation + description: Instruction describing how to create a file via the apply_patch tool. + ApplyPatchDeleteFileOperation: + properties: + type: + type: string + enum: + - delete_file + description: Delete the specified file. + default: delete_file + x-stainless-const: true + path: + type: string + description: Path of the file to delete. + type: object + required: + - type + - path + title: Apply patch delete file operation + description: Instruction describing how to delete a file via the apply_patch tool. + ApplyPatchUpdateFileOperation: + 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: + type: string + description: Diff to apply. + type: object + required: + - type + - path + - diff + title: Apply patch update file operation + description: Instruction describing how to update a file via the apply_patch tool. + ApplyPatchCallOutputStatus: + type: string + enum: + - completed + - failed + MCPListToolsTool: + type: object + title: MCP list tools tool + description: | + A tool available on an MCP server. + properties: + name: + type: string + description: | + The name of the tool. + description: + type: string + description: | + The description of the tool. + input_schema: + type: string + description: |- + The JSON schema describing the tool's input. + (opaque JSON object) + annotations: + type: string + description: |- + Additional annotations about the tool. + (opaque JSON object) + required: + - name + - input_schema + MCPToolCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + - calling + - failed + FunctionAndCustomToolCallOutput: + discriminator: + propertyName: type + 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. + image_url: + 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. + file_id: + type: string + description: The ID of the file to be sent to the model. + 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`. + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + file_url: + type: string + format: uri + description: The URL of the file to be sent to the model. + type: object + required: + - type + - text + - detail + title: Input text + description: A text input to the model. + InputContent: + discriminator: + propertyName: type + 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. + image_url: + 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. + file_id: + type: string + description: The ID of the file to be sent to the model. + 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`. + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + file_url: + type: string + format: uri + description: The URL of the file to be sent to the model. + type: object + required: + - type + - text + - detail + title: Input text + description: A text input to the model. + OutputMessageContent: + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - output_text + description: The type of the output text. Always `output_text`. + default: output_text + x-stainless-const: true + text: + type: string + description: The text output from the model. + annotations: + items: + $ref: '#/components/schemas/Annotation' + type: array + description: The annotations of the text output. + logprobs: + items: + $ref: '#/components/schemas/LogProb' + type: array + refusal: + type: string + description: The refusal explanation from the model. + type: object + required: + - type + - text + - annotations + - logprobs + - refusal + title: Output text + description: A text output from the model. + ComputerScreenshotImage: + type: object + description: | + A computer screenshot image used with the computer use tool. + properties: + type: + type: string + enum: + - computer_screenshot + default: computer_screenshot + description: | + Specifies the event type. For a computer screenshot, this property is + always set to `computer_screenshot`. + x-stainless-const: true + image_url: + type: string + format: uri + description: The URL of the screenshot image. + file_id: + type: string + description: The identifier of an uploaded file that contains the screenshot. + required: + - type + FunctionCallItemStatus: + type: string + enum: + - in_progress + - completed + - incomplete + InputTextContentParam: + 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 + maxLength: 10485760 + description: The text input to the model. + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + InputImageContentParamAutoParam: + properties: + type: + type: string + enum: + - input_image + description: The type of the input item. Always `input_image`. + default: input_image + x-stainless-const: true + image_url: + 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. + file_id: + type: string + description: The ID of the file to be sent to the model. + example: file-123 + detail: + type: string + enum: + - low + - high + - auto + - original + type: object + required: + - type + title: Input image + description: An image input to the model. Learn about [image inputs](/docs/guides/vision) + InputFileContentParam: + 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: + type: string + description: The ID of the file to be sent to the model. + example: file-123 + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + maxLength: 73400320 + description: The base64-encoded data of the file to be sent to the model. + file_url: + type: string + format: uri + description: The URL of the file to be sent to the model. + detail: + $ref: '#/components/schemas/FileDetailEnum' + description: The detail level of the file to be sent to the model. Use `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`. + type: object + required: + - type + title: Input file + description: A file input to the model. + EmptyModelParam: + properties: {} + type: object + required: [] + FunctionShellActionParam: + properties: + commands: + items: + type: string + type: array + description: Ordered shell commands for the execution environment to run. + timeout_ms: + type: integer + description: Maximum wall-clock time in milliseconds to allow the shell commands to run. + max_output_length: + type: integer + description: Maximum number of UTF-8 characters to capture from combined stdout and stderr output. + 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 + title: Shell call status + description: Status values reported for shell tool calls. + LocalEnvironmentParam: + properties: + type: + type: string + enum: + - local + 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. + type: object + required: + - type + ContainerReferenceParam: + properties: + type: + type: string + enum: + - container_reference + description: References a container created with the /v1/containers endpoint + default: container_reference + x-stainless-const: true + container_id: + type: string + description: The ID of the referenced container. + example: cntr_123 + type: object + required: + - type + - container_id + FunctionShellCallOutputContentParam: + properties: + stdout: + type: string + maxLength: 10485760 + description: Captured stdout output for the shell call. + stderr: + type: string + maxLength: 10485760 + description: Captured stderr output for the shell call. + 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. + ApplyPatchCallStatusParam: + type: string + enum: + - in_progress + - completed + title: Apply patch call status + description: Status values reported for apply_patch tool calls. + ApplyPatchOperationParam: + 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 + 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 + required: + - type + - path + - diff + ApplyPatchCallOutputStatusParam: + type: string + enum: + - completed + - failed + title: Apply patch call output status + description: Outcome values reported for apply_patch tool call outputs. + Annotation: + description: An annotation that applies to a span of output text. + discriminator: + propertyName: type + 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 of the file in the list of files. + filename: + type: string + description: The filename of the file cited. + 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. + container_id: + type: string + description: The ID of the container file. + type: object + required: + - type + - file_id + - index + - filename + - url + - start_index + - end_index + - title + - container_id + title: File citation + LogProb: + properties: + token: + type: string + logprob: + type: number + bytes: + items: + type: integer + type: array + 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. + ImageDetail: + type: string + enum: + - low + - high + - auto + - original + FileInputDetail: + type: string + enum: + - low + - high + 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: + items: + type: string + type: array + description: The keys being held while clicking. + 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: + items: + type: string + type: array + description: The keys being held while double-clicking. + type: object + required: + - type + - x + - 'y' + - keys + title: DoubleClick + description: A double click action. + 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 + ``` + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ] + ``` + keys: + items: + type: string + type: array + description: The keys being held while dragging the mouse. + 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 + keys: + items: + 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 + x: + type: integer + description: The x-coordinate to move to. + 'y': + type: integer + description: The y-coordinate to move to. + keys: + items: + type: string + type: array + description: The keys being held while moving the mouse. + 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 + 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: + items: + type: string + type: array + description: The keys being held while scrolling. + 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: object + required: + - type + - text + title: Type + description: An action to type in text. + WaitParam: + 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 + type: object + required: + - type + title: Wait + description: A wait action. + FunctionTool: + properties: + type: + type: string + enum: + - function + description: The type of the function tool. Always `function`. + default: function + x-stainless-const: true + name: + type: string + description: The name of the function to call. + description: + type: string + description: A description of the function. Used by the model to determine whether or not to call the function. + parameters: + additionalProperties: {} + type: object + description: A JSON schema object describing the parameters of the function. + x-oaiTypeLabel: map + strict: + type: boolean + description: Whether to enforce strict parameter validation. Default `true`. + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + 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://platform.openai.com/docs/guides/function-calling). + FileSearchTool: + properties: + type: + type: string + enum: + - file_search + description: The type of the file search tool. Always `file_search`. + default: file_search + x-stainless-const: true + 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: + 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. + 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`. + - `eq`: equals + - `ne`: not equal + - `gt`: greater than + - `gte`: greater than or equal + - `lt`: less than + - `lte`: less than or equal + - `in`: in + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: The value to compare against the attribute key; supports string, number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + 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://platform.openai.com/docs/guides/tools-file-search). + ComputerTool: + properties: + type: + type: string + enum: + - computer + description: The type of the computer tool. Always `computer`. + default: computer + x-stainless-const: true + type: object + required: + - type + title: Computer + description: A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). + ComputerUsePreviewTool: + properties: + type: + type: string + enum: + - computer_use_preview + description: The type of the computer use tool. Always `computer_use_preview`. + default: computer_use_preview + x-stainless-const: true + 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: + - 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://platform.openai.com/docs/guides/tools-computer-use). + WebSearchTool: + type: object + title: Web search + description: | + Search the Internet for sources related to the prompt. Learn more about the + [web search tool](/docs/guides/tools-web-search). + properties: + type: + 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 + filters: + type: object + description: | + Filters for the search. + 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. + Subdomains of the provided domains are allowed as well. + + Example: `["pubmed.ncbi.nlm.nih.gov"]` + items: + type: string + description: Allowed domain for the search. + default: [] + - type: 'null' + user_location: + $ref: '#/components/schemas/WebSearchApproximateLocation' + search_context_size: + 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. + required: + - type + MCPTool: + type: object + title: MCP tool + description: | + Give the model access to additional tools via remote Model Context Protocol + (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). + 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. + server_url: + type: string + format: uri + description: | + The URL for the MCP server. One of `server_url` or `connector_id` must be + provided. + 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 + `server_url` or `connector_id` must be provided. Learn more about service + connectors [here](/docs/guides/tools-remote-mcp#connectors). + + Currently supported `connector_id` values are: + + - Dropbox: `connector_dropbox` + - Gmail: `connector_gmail` + - Google Calendar: `connector_googlecalendar` + - Google Drive: `connector_googledrive` + - Microsoft Teams: `connector_microsoftteams` + - Outlook Calendar: `connector_outlookcalendar` + - Outlook Email: `connector_outlookemail` + - SharePoint: `connector_sharepoint` + authorization: + type: string + description: | + An OAuth access token that can be used with a remote MCP server, either + with a custom MCP server URL or a service connector. Your application + must handle the OAuth authorization flow and provide the token here. + server_description: + type: string + description: | + Optional description of the MCP server, used to provide more context. + headers: + type: object + additionalProperties: + type: string + description: | + Optional HTTP headers to send to the MCP server. Use for authentication + or other purposes. + allowed_tools: + description: | + List of allowed tool names or a filter object. + oneOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/MCPToolFilter' + type: 'null' + require_approval: + 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 + `always`, `never`, or a filter object associated with tools + that require approval. + 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 + `never`. When set to `always`, all tools will require approval. When + set to `never`, all tools will not require approval. + enum: + - always + - never + default: always + type: 'null' + defer_loading: + type: boolean + description: | + Whether this MCP tool is deferred and discovered via tool search. + required: + - type + - server_label + CodeInterpreterTool: + type: object + title: Code interpreter + description: | + A tool that runs Python code to help generate a response to a prompt. + properties: + type: + type: string + enum: + - code_interpreter + description: | + The type of the code interpreter tool. Always `code_interpreter`. + x-stainless-const: true + container: + description: | + The code interpreter container. Can be a container ID or an object that + specifies uploaded file IDs to make available to your code, along with an + optional `memory_limit` setting. + type: string + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + required: + - type + title: CodeInterpreterToolAuto + required: + - type + - container + ImageGenTool: + type: object + title: Image generation tool + description: | + A tool that generates images using the GPT image models. + properties: + type: + type: string + enum: + - image_generation + description: | + The type of the image generation tool. Always `image_generation`. + x-stainless-const: true + model: + type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-1.5 + description: | + The image generation model to use. Default: `gpt-image-1`. + default: gpt-image-1 + quality: + type: string + enum: + - low + - medium + - high + - auto + description: | + The quality of the generated image. One of `low`, `medium`, `high`, + or `auto`. Default: `auto`. + default: auto + size: + description: The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, 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 + type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + output_format: + type: string + enum: + - png + - webp + - jpeg + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer + minimum: 0 + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: + type: string + enum: + - transparent + - opaque + - auto + description: | + Background type for the generated image. One of `transparent`, + `opaque`, or `auto`. Default: `auto`. + default: auto + input_fidelity: + 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`. + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + 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. + default: 0 + action: + description: | + Whether to generate a new image or edit an existing image. Default: `auto`. + $ref: '#/components/schemas/ImageGenActionEnum' + required: + - type + LocalShellToolParam: + properties: + type: + type: string + enum: + - local_shell + description: The type of the local shell tool. Always `local_shell`. + default: local_shell + x-stainless-const: true + type: object + required: + - type + title: Local shell tool + description: A tool that allows the model to execute shell commands in a local environment. + FunctionShellToolParam: + properties: + type: + type: string + enum: + - shell + description: The type of the shell tool. Always `shell`. + default: shell + x-stainless-const: true + environment: + oneOf: + - $ref: '#/components/schemas/ContainerAutoParam' + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + discriminator: + propertyName: type + type: 'null' + type: object + required: + - type + title: Shell tool + description: A tool that allows the model to execute shell commands. + CustomToolParam: + properties: + type: + type: string + enum: + - custom + description: The type of the custom tool. Always `custom`. + default: custom + x-stainless-const: true + 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. + format: + description: The input format for the custom tool. Default is unconstrained text. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + 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. + type: object + required: + - type + - syntax + - definition + title: Text format + defer_loading: + type: boolean + description: Whether this tool should be deferred and discovered via tool search. + type: object + required: + - type + - name + title: Custom tool + description: A custom tool that processes input using a specified format. Learn more about [custom tools](/docs/guides/function-calling#custom-tools) + NamespaceToolParam: + 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 + minLength: 1 + description: A description of the namespace shown to the model. + 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 + 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: + type: string + description: Description shown to the model for a client-executed tool search tool. + parameters: + properties: {} + type: object + required: [] + type: object + required: + - type + title: Tool search tool + description: Hosted or BYOT tool search configuration for deferred tools. + WebSearchPreviewTool: + properties: + type: + type: string + enum: + - web_search_preview + - web_search_preview_2025_03_11 + 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 + user_location: + properties: + type: + type: string + enum: + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate + x-stainless-const: true + country: + type: string + description: The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`. + region: + type: string + description: Free text input for the region of the user, e.g. `California`. + city: + type: string + description: Free text input for the city of the user, e.g. `San Francisco`. + timezone: + type: string + description: The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`. + type: object + required: + - type + 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://platform.openai.com/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 + type: object + required: + - type + title: Apply patch tool + description: Allows the assistant to create, delete, or update files using unified diffs. + FunctionShellCallOutputTimeoutOutcome: + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true + type: object + required: + - type + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + FunctionShellCallOutputExitOutcome: + properties: + type: + type: string + enum: + - exit + description: The outcome type. Always `exit`. + default: exit + x-stainless-const: true + 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. + DetailEnum: + type: string + enum: + - low + - high + - auto + - original + FileDetailEnum: + type: string + enum: + - low + - high + LocalSkillParam: + properties: + name: + type: string + description: The name of the skill. + description: + type: string + description: The description of the skill. + path: + type: string + description: The path to the directory containing the skill. + type: object + required: + - name + - description + - path + FunctionShellCallOutputOutcomeParam: + title: Shell call outcome + description: The exit or timeout outcome associated with this shell call. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true + exit_code: + type: integer + description: The exit code returned by the shell process. + type: object + required: + - type + - exit_code + 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 + 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. + 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 of the file in the list of files. + 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. + start_index: + type: integer + description: The index of the first character of the container file citation in the message. + 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. + FilePath: + type: object + title: File path + description: | + A path to a file. + properties: + type: + type: string + description: | + The type of the file path. Always `file_path`. + enum: + - file_path + x-stainless-const: true + file_id: + type: string + description: | + The ID of the file. + index: + type: integer + description: | + The index of the file in the list of files. + required: + - type + - file_id + - index + TopLogProb: + properties: + token: + type: string + logprob: + type: number + bytes: + items: + type: integer + type: array + type: object + required: + - token + - logprob + - bytes + title: Top log probability + description: The top log probability of a token. + ClickButtonType: + type: string + enum: + - left + - right + - wheel + - back + - forward + 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 }`.' + RankingOptions: + properties: + 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: + 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. + 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`. + - `eq`: equals + - `ne`: not equal + - `gt`: greater than + - `gte`: greater than or equal + - `lt`: less than + - `lte`: less than or equal + - `in`: in + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: The value to compare against the attribute key; supports string, number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + ComputerEnvironment: + type: string + enum: + - windows + - mac + - linux + - ubuntu + - browser + WebSearchApproximateLocation: + type: object + title: Web search approximate location + description: | + The approximate location of the user. + 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' + MCPToolFilter: + type: object + title: MCP tool filter + description: | + A filter object to specify which tools are allowed. + 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 + MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), + it will match this filter. + required: [] + additionalProperties: false + AutoCodeInterpreterToolParam: + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + 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. + 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`. + ImageGenActionEnum: + type: string + enum: + - generate + - edit + - auto + ContainerAutoParam: + properties: + type: + type: string + enum: + - container_auto + description: Automatically creates a container for this request + default: container_auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + 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. + type: object + required: + - type + CustomTextFormatParam: + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + x-stainless-const: true + type: object + required: + - type + title: Text format + description: Unconstrained free-form text. + CustomGrammarFormatParam: + properties: + type: + type: string + enum: + - grammar + description: Grammar format. Always `grammar`. + default: grammar + 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. + type: object + required: + - type + - syntax + - definition + title: Grammar format + description: A grammar defined by the user. + FunctionToolParam: + properties: + name: + type: string + maxLength: 128 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: + type: string + parameters: + properties: {} + type: object + required: [] + strict: + type: boolean + type: + type: string + enum: + - function + default: function + x-stainless-const: true + defer_loading: + type: boolean + description: Whether this function should be deferred and discovered via tool search. + type: object + required: + - name + - type + ApproximateLocation: + properties: + type: + type: string + enum: + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate + x-stainless-const: true + country: + type: string + description: The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`. + region: + type: string + description: Free text input for the region of the user, e.g. `California`. + city: + type: string + description: Free text input for the city of the user, e.g. `San Francisco`. + timezone: + type: string + description: The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`. + type: object + required: + - type + SearchContextSize: + type: string + enum: + - low + - medium + - high + SearchContentType: + type: string + enum: + - text + - image + FunctionShellCallOutputTimeoutOutcomeParam: + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true + type: object + required: + - type + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + FunctionShellCallOutputExitOutcomeParam: + properties: + type: + type: string + enum: + - exit + description: The outcome type. Always `exit`. + default: exit + x-stainless-const: true + exit_code: + type: integer + 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. + 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. + type: object + required: + - embedding_weight + - text_weight + 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. + 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`. + - `eq`: equals + - `ne`: not equal + - `gt`: greater than + - `gte`: greater than or equal + - `lt`: less than + - `lte`: less than or equal + - `in`: in + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: The value to compare against the attribute key; supports string, number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + required: + - type + - key + - value + x-oaiMeta: + name: ComparisonFilter + 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: '#' + discriminator: + propertyName: type + required: + - type + - filters + x-oaiMeta: + name: CompoundFilter + ContainerMemoryLimit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + ContainerNetworkPolicyDisabledParam: + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + x-stainless-const: true + type: object + required: + - type + 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 + 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 + skill_id: + type: string + maxLength: 64 + minLength: 1 + description: The ID of the referenced skill. + version: + type: string + description: Optional skill version. Use a positive integer or 'latest'. Omit for default. + type: object + required: + - type + - skill_id + InlineSkillParam: + properties: + type: + type: string + enum: + - inline + description: Defines an inline skill for this request. + default: inline + x-stainless-const: true + name: + type: string + description: The name of the skill. + 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 + GrammarSyntax1: + type: string + enum: + - lark + - regex + 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 + InlineSkillSourceParam: + 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. + type: object + required: + - type + - media_type + - data + description: Inline skill payload +servers: + - url: https://api.openai.com/v1 diff --git a/provider-dev/source/evals.yaml b/provider-dev/source/evals.yaml new file mode 100644 index 0000000..ae38a2c --- /dev/null +++ b/provider-dev/source/evals.yaml @@ -0,0 +1,7791 @@ +openapi: 3.1.0 +info: + title: evals API + description: openai API + version: 2.3.0 +paths: + /evals: + get: + operationId: listEvals + tags: + - Evals + summary: | + List evaluations for a project. + parameters: + - name: after + in: query + description: Identifier for the last eval from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: |- + Number of evals to retrieve. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: Sort order for evals by timestamp. Use `asc` for ascending order or `desc` for descending order. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + - name: order_by + in: query + description: | + Evals can be ordered by creation time or last updated time. Use + `created_at` for creation time or `updated_at` for last updated time. + required: false + schema: + type: string + enum: + - created_at + - updated_at + default: created_at + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: A list of evals + content: + application/json: + schema: + $ref: '#/components/schemas/EvalList' + x-oaiMeta: + name: List evals + group: evals + path: list + examples: + request: + curl: | + curl https://api.openai.com/v1/evals?limit=1 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.evals.list() + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const evals = await openai.evals.list({ limit: 1 }); + console.log(evals); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const evalListResponse of client.evals.list()) { + console.log(evalListResponse.id); + } + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalListPage; + import com.openai.models.evals.EvalListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalListPage page = client.evals().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.evals.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "object": "eval", + "data_source_config": { + "type": "stored_completions", + "metadata": { + "usecase": "push_notifications_summarizer" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + ] + } + }, + "testing_criteria": [ + { + "name": "Push Notification Summary Grader", + "id": "Push Notification Summary Grader-9b876f24-4762-4be9-aff4-db7a9b31c673", + "type": "label_model", + "model": "o3-mini", + "input": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "text": "\nLabel the following push notification summary as either correct or incorrect.\nThe push notification and the summary will be provided below.\nA good push notificiation summary is concise and snappy.\nIf it is good, then label it as correct, if not, then incorrect.\n" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "\nPush notifications: {{item.input}}\nSummary: {{sample.output_text}}\n" + } + } + ], + "passing_labels": [ + "correct" + ], + "labels": [ + "correct", + "incorrect" + ], + "sampling_params": null + } + ], + "name": "Push Notification Summary Grader", + "created_at": 1739314509, + "metadata": { + "description": "A stored completions eval for push notification summaries" + } + } + ], + "first_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "last_id": "eval_67aa884cf6688190b58f657d4441c8b7", + "has_more": true + } + post: + operationId: createEval + tags: + - Evals + summary: | + Create the structure of an evaluation that can be used to test a model's performance. + An 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. + For more information, see the [Evals guide](/docs/guides/evals). + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEvalRequest' + responses: + '201': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Eval' + x-oaiMeta: + name: Create eval + group: evals + path: post + examples: + request: + curl: | + curl https://api.openai.com/v1/evals \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Sentiment", + "data_source_config": { + "type": "stored_completions", + "metadata": { + "usecase": "chatbot" + } + }, + "testing_criteria": [ + { + "type": "label_model", + "model": "o3-mini", + "input": [ + { + "role": "developer", + "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" + }, + { + "role": "user", + "content": "Statement: {{item.input}}" + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ], + "name": "Example label grader" + } + ] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.create( + data_source_config={ + "item_schema": { + "foo": "bar" + }, + "type": "custom", + }, + testing_criteria=[{ + "input": [{ + "content": "content", + "role": "role", + }], + "labels": ["string"], + "model": "model", + "name": "name", + "passing_labels": ["string"], + "type": "label_model", + }], + ) + print(eval.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const evalObj = await openai.evals.create({ + name: "Sentiment", + data_source_config: { + type: "stored_completions", + metadata: { usecase: "chatbot" } + }, + testing_criteria: [ + { + type: "label_model", + model: "o3-mini", + input: [ + { role: "developer", content: "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" }, + { role: "user", content: "Statement: {{item.input}}" } + ], + passing_labels: ["positive"], + labels: ["positive", "neutral", "negative"], + name: "Example label grader" + } + ] + }); + console.log(evalObj); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.create({ + data_source_config: { + item_schema: { foo: 'bar' }, + type: 'custom', + }, + testing_criteria: [ + { + input: [{ content: 'content', role: 'role' }], + labels: ['string'], + model: 'model', + name: 'name', + passing_labels: ['string'], + type: 'label_model', + }, + ], + }); + + console.log(_eval.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.evals.EvalCreateParams; + import com.openai.models.evals.EvalCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalCreateParams params = EvalCreateParams.builder() + .customDataSourceConfig(EvalCreateParams.DataSourceConfig.Custom.ItemSchema.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build()) + .addTestingCriterion(EvalCreateParams.TestingCriterion.LabelModel.builder() + .addInput(EvalCreateParams.TestingCriterion.LabelModel.Input.SimpleInputMessage.builder() + .content("content") + .role("role") + .build()) + .addLabel("string") + .model("model") + .name("name") + .addPassingLabel("string") + .build()) + .build(); + EvalCreateResponse eval = client.evals().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.create( + data_source_config: {item_schema: {foo: "bar"}, type: :custom}, + testing_criteria: [ + { + input: [{content: "content", role: "role"}], + labels: ["string"], + model: "model", + name: "name", + passing_labels: ["string"], + type: :label_model + } + ] + ) + + puts(eval_) + response: | + { + "object": "eval", + "id": "eval_67b7fa9a81a88190ab4aa417e397ea21", + "data_source_config": { + "type": "stored_completions", + "metadata": { + "usecase": "chatbot" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + ] + }, + "testing_criteria": [ + { + "name": "Example label grader", + "type": "label_model", + "model": "o3-mini", + "input": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.input}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + ], + "name": "Sentiment", + "created_at": 1740110490, + "metadata": { + "description": "An eval for sentiment analysis" + } + } + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + /evals/{eval_id}: + get: + operationId: getEval + tags: + - Evals + summary: | + Get an evaluation by ID. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: The evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/Eval' + x-oaiMeta: + name: Get an eval + group: evals + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.retrieve( + "eval_id", + ) + print(eval.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const evalObj = await openai.evals.retrieve("eval_67abd54d9b0081909a86353f6fb9317a"); + console.log(evalObj); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.retrieve('eval_id'); + + console.log(_eval.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalRetrieveParams; + import com.openai.models.evals.EvalRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalRetrieveResponse eval = client.evals().retrieve("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.retrieve("eval_id") + + puts(eval_) + response: | + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": {}, + } + post: + operationId: updateEval + tags: + - Evals + summary: | + Update certain properties of an evaluation. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to update. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + description: Request to update an evaluation + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: Rename the evaluation. + metadata: + $ref: '#/components/schemas/Metadata' + responses: + '200': + description: The updated evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/Eval' + x-oaiMeta: + name: Update an eval + group: evals + path: update + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"name": "Updated Eval", "metadata": {"description": "Updated description"}}' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.update( + eval_id="eval_id", + ) + print(eval.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const updatedEval = await openai.evals.update( + "eval_67abd54d9b0081909a86353f6fb9317a", + { + name: "Updated Eval", + metadata: { description: "Updated description" } + } + ); + console.log(updatedEval); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.update('eval_id'); + + console.log(_eval.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalUpdateParams; + import com.openai.models.evals.EvalUpdateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalUpdateResponse eval = client.evals().update("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.update("eval_id") + + puts(eval_) + response: | + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "Updated Eval", + "created_at": 1739314509, + "metadata": {"description": "Updated description"}, + } + delete: + operationId: deleteEval + tags: + - Evals + summary: | + Delete an evaluation. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to delete. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Successfully deleted the evaluation. + content: + application/json: + schema: + type: object + properties: + object: + type: string + example: eval.deleted + deleted: + type: boolean + example: true + eval_id: + type: string + example: eval_abc123 + required: + - object + - deleted + - eval_id + '404': + description: Evaluation not found. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Delete an eval + group: evals + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_abc123 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + eval = client.evals.delete( + "eval_id", + ) + print(eval.eval_id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const deleted = await openai.evals.delete("eval_abc123"); + console.log(deleted); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const _eval = await client.evals.delete('eval_id'); + + console.log(_eval.eval_id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.EvalDeleteParams; + import com.openai.models.evals.EvalDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + EvalDeleteResponse eval = client.evals().delete("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + eval_ = openai.evals.delete("eval_id") + + puts(eval_) + response: | + { + "object": "eval.deleted", + "deleted": true, + "eval_id": "eval_abc123" + } + /evals/{eval_id}/runs: + get: + operationId: getEvalRuns + tags: + - Evals + summary: | + Get a list of runs for an evaluation. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: after + in: query + description: Identifier for the last run from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: |- + Number of runs to retrieve. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: Sort order for runs by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + - name: status + in: query + description: Filter runs by status. One of `queued` | `in_progress` | `failed` | `completed` | `canceled`. + required: false + schema: + type: string + enum: + - queued + - in_progress + - completed + - canceled + - failed + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: A list of runs for the evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRunList' + x-oaiMeta: + name: Get eval runs + group: evals + path: get-runs + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/egroup_67abd54d9b0081909a86353f6fb9317a/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.evals.runs.list( + eval_id="eval_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const runs = await openai.evals.runs.list("egroup_67abd54d9b0081909a86353f6fb9317a"); + console.log(runs); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const runListResponse of client.evals.runs.list('eval_id')) { + console.log(runListResponse.id); + } + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunListPage; + import com.openai.models.evals.runs.RunListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunListPage page = client.evals().runs().list("eval_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.evals.runs.list("eval_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "eval.run", + "id": "evalrun_67e0c7d31560819090d60c0780591042", + "eval_id": "eval_67e0c726d560819083f19a957c4c640b", + "report_url": "https://platform.openai.com/evaluations/eval_67e0c726d560819083f19a957c4c640b", + "status": "completed", + "model": "o3-mini", + "name": "bulk_with_negative_examples_o3-mini", + "created_at": 1742784467, + "result_counts": { + "total": 1, + "errored": 0, + "failed": 0, + "passed": 1 + }, + "per_model_usage": [ + { + "model_name": "o3-mini", + "invocation_count": 1, + "prompt_tokens": 563, + "completion_tokens": 874, + "total_tokens": 1437, + "cached_tokens": 0 + } + ], + "per_testing_criteria_results": [ + { + "testing_criteria": "Push Notification Summary Grader-1808cd0b-eeec-4e0b-a519-337e79f4f5d1", + "passed": 1, + "failed": 0 + } + ], + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "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" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.notifications}}" + } + } + ] + }, + "model": "o3-mini", + "sampling_params": null + }, + "error": null, + "metadata": {} + } + ], + "first_id": "evalrun_67e0c7d31560819090d60c0780591042", + "last_id": "evalrun_67e0c7d31560819090d60c0780591042", + "has_more": true + } + post: + operationId: createEvalRun + 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. + parameters: + - in: path + name: eval_id + required: true + schema: + type: string + description: The ID of the evaluation to create a run for. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEvalRunRequest' + responses: + '201': + description: Successfully created a run for the evaluation + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRun' + '400': + description: Bad request (for example, missing eval object) + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Create eval run + group: evals + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_67e579652b548190aaa83ada4b125f47/runs \ + -X POST \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"name":"gpt-4o-mini","data_source":{"type":"completions","input_messages":{"type":"template","template":[{"role":"developer","content":"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"} , {"role":"user","content":"{{item.input}}"}]} ,"sampling_params":{"temperature":1,"max_completions_tokens":2048,"top_p":1,"seed":42},"model":"gpt-4o-mini","source":{"type":"file_content","content":[{"item":{"input":"Tech Company Launches Advanced Artificial Intelligence Platform","ground_truth":"Technology"}}]}}' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.evals.runs.create( + eval_id="eval_id", + data_source={ + "source": { + "content": [{ + "item": { + "foo": "bar" + } + }], + "type": "file_content", + }, + "type": "jsonl", + }, + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const run = await openai.evals.runs.create( + "eval_67e579652b548190aaa83ada4b125f47", + { + name: "gpt-4o-mini", + data_source: { + type: "completions", + input_messages: { + type: "template", + template: [ + { + role: "developer", + content: "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" + }, + { + role: "user", + content: "{{item.input}}" + } + ] + }, + sampling_params: { + temperature: 1, + max_completions_tokens: 2048, + top_p: 1, + seed: 42 + }, + model: "gpt-4o-mini", + source: { + type: "file_content", + content: [ + { + item: { + input: "Tech Company Launches Advanced Artificial Intelligence Platform", + ground_truth: "Technology" + } + } + ] + } + } + } + ); + console.log(run); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.evals.runs.create('eval_id', { + data_source: { + source: { content: [{ item: { foo: 'bar' } }], type: 'file_content' }, + type: 'jsonl', + }, + }); + + console.log(run.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.evals.runs.CreateEvalJsonlRunDataSource; + import com.openai.models.evals.runs.RunCreateParams; + import com.openai.models.evals.runs.RunCreateResponse; + import java.util.List; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCreateParams params = RunCreateParams.builder() + .evalId("eval_id") + .dataSource(CreateEvalJsonlRunDataSource.builder() + .fileContentSource(List.of(CreateEvalJsonlRunDataSource.Source.FileContent.Content.builder() + .item(CreateEvalJsonlRunDataSource.Source.FileContent.Content.Item.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build()) + .build())) + .build()) + .build(); + RunCreateResponse run = client.evals().runs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.evals.runs.create( + "eval_id", + data_source: {source: {content: [{item: {foo: "bar"}}], type: :file_content}, type: :jsonl} + ) + + puts(run) + response: | + { + "object": "eval.run", + "id": "evalrun_67e57965b480819094274e3a32235e4c", + "eval_id": "eval_67e579652b548190aaa83ada4b125f47", + "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47&run_id=evalrun_67e57965b480819094274e3a32235e4c", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + /evals/{eval_id}/runs/{run_id}: + get: + operationId: getEvalRun + tags: + - Evals + summary: | + Get an evaluation run by ID. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to retrieve. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: The evaluation run + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRun' + x-oaiMeta: + name: Get an eval run + group: evals + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.evals.runs.retrieve( + run_id="run_id", + eval_id="eval_id", + ) + print(run.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const run = await openai.evals.runs.retrieve( + "evalrun_67abd54d60ec8190832b46859da808f7", + { eval_id: "eval_67abd54d9b0081909a86353f6fb9317a" } + ); + console.log(run); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.evals.runs.retrieve('run_id', { eval_id: 'eval_id' }); + + console.log(run.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunRetrieveParams; + import com.openai.models.evals.runs.RunRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunRetrieveParams params = RunRetrieveParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + RunRetrieveResponse run = client.evals().runs().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.evals.runs.retrieve("run_id", eval_id: "eval_id") + + puts(run) + response: | + { + "object": "eval.run", + "id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "report_url": "https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + post: + operationId: cancelEvalRun + tags: + - Evals + summary: | + Cancel an ongoing evaluation run. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation whose run you want to cancel. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to cancel. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: The canceled eval run object + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRun' + x-oaiMeta: + name: Cancel eval run + group: evals + path: post + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7/cancel \ + -X POST \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.evals.runs.cancel( + run_id="run_id", + eval_id="eval_id", + ) + print(response.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const canceledRun = await openai.evals.runs.cancel( + "evalrun_67abd54d60ec8190832b46859da808f7", + { eval_id: "eval_67abd54d9b0081909a86353f6fb9317a" } + ); + console.log(canceledRun); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.evals.runs.cancel('run_id', { eval_id: 'eval_id' }); + + console.log(response.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunCancelParams; + import com.openai.models.evals.runs.RunCancelResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunCancelParams params = RunCancelParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + RunCancelResponse response = client.evals().runs().cancel(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.evals.runs.cancel("run_id", eval_id: "eval_id") + + puts(response) + response: | + { + "object": "eval.run", + "id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "report_url": "https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7", + "status": "canceled", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + delete: + operationId: deleteEvalRun + tags: + - Evals + summary: | + Delete an eval run. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to delete the run from. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to delete. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + 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 + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-oaiMeta: + name: Delete eval run + group: evals + path: delete + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_123abc/runs/evalrun_abc456 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + run = client.evals.runs.delete( + run_id="run_id", + eval_id="eval_id", + ) + print(run.run_id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const deleted = await openai.evals.runs.delete( + "eval_123abc", + "evalrun_abc456" + ); + console.log(deleted); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const run = await client.evals.runs.delete('run_id', { eval_id: 'eval_id' }); + + console.log(run.run_id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.RunDeleteParams; + import com.openai.models.evals.runs.RunDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + RunDeleteParams params = RunDeleteParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + RunDeleteResponse run = client.evals().runs().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + run = openai.evals.runs.delete("run_id", eval_id: "eval_id") + + puts(run) + response: | + { + "object": "eval.run.deleted", + "deleted": true, + "run_id": "evalrun_abc456" + } + /evals/{eval_id}/runs/{run_id}/output_items: + get: + operationId: getEvalRunOutputItems + tags: + - Evals + summary: | + Get a list of output items for an evaluation run. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to retrieve output items for. + - name: after + in: query + description: Identifier for the last output item from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: |- + Number of output items to retrieve. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: status + in: query + description: | + Filter output items by status. Use `failed` to filter by failed output + items or `pass` to filter by passed output items. + required: false + schema: + type: string + enum: + - fail + - pass + - name: order + in: query + description: Sort order for output items by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`. + required: false + schema: + type: string + enum: + - asc + - desc + default: asc + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: A list of output items for the evaluation run + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRunOutputItemList' + x-oaiMeta: + name: Get eval run output items + group: evals + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/egroup_67abd54d9b0081909a86353f6fb9317a/runs/erun_67abd54d60ec8190832b46859da808f7/output_items \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.evals.runs.output_items.list( + run_id="run_id", + eval_id="eval_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const outputItems = await openai.evals.runs.outputItems.list( + "egroup_67abd54d9b0081909a86353f6fb9317a", + "erun_67abd54d60ec8190832b46859da808f7" + ); + console.log(outputItems); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const outputItemListResponse of client.evals.runs.outputItems.list('run_id', { + eval_id: 'eval_id', + })) { + console.log(outputItemListResponse.id); + } + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.outputitems.OutputItemListPage; + import com.openai.models.evals.runs.outputitems.OutputItemListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OutputItemListParams params = OutputItemListParams.builder() + .evalId("eval_id") + .runId("run_id") + .build(); + OutputItemListPage page = client.evals().runs().outputItems().list(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.evals.runs.output_items.list("run_id", eval_id: "eval_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "eval.run.output_item", + "id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "created_at": 1743092076, + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "status": "pass", + "datasource_item_id": 5, + "datasource_item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + }, + "results": [ + { + "name": "String check-a2486074-d803-4445-b431-ad2262e85d47", + "sample": null, + "passed": true, + "score": 1.0 + } + ], + "sample": { + "input": [ + { + "role": "developer", + "content": "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", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + }, + { + "role": "user", + "content": "Stock Markets Rally After Positive Economic Data Released", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "output": [ + { + "role": "assistant", + "content": "Markets", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "finish_reason": "stop", + "model": "gpt-4o-mini-2024-07-18", + "usage": { + "total_tokens": 325, + "completion_tokens": 2, + "prompt_tokens": 323, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } + ], + "first_id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "last_id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "has_more": true + } + /evals/{eval_id}/runs/{run_id}/output_items/{output_item_id}: + get: + operationId: getEvalRunOutputItem + tags: + - Evals + summary: | + Get an evaluation run output item by ID. + parameters: + - name: eval_id + in: path + required: true + schema: + type: string + description: The ID of the evaluation to retrieve runs for. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run to retrieve. + - name: output_item_id + in: path + required: true + schema: + type: string + description: The ID of the output item to retrieve. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: The evaluation run output item + content: + application/json: + schema: + $ref: '#/components/schemas/EvalRunOutputItem' + x-oaiMeta: + name: Get an output item of an eval run + group: evals + path: get + examples: + request: + curl: | + curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7/output_items/outputitem_67abd55eb6548190bb580745d5644a33 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + output_item = client.evals.runs.output_items.retrieve( + output_item_id="output_item_id", + eval_id="eval_id", + run_id="run_id", + ) + print(output_item.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const outputItem = await openai.evals.runs.outputItems.retrieve( + "outputitem_67abd55eb6548190bb580745d5644a33", + { + eval_id: "eval_67abd54d9b0081909a86353f6fb9317a", + run_id: "evalrun_67abd54d60ec8190832b46859da808f7", + } + ); + console.log(outputItem); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const outputItem = await client.evals.runs.outputItems.retrieve('output_item_id', { + eval_id: 'eval_id', + run_id: 'run_id', + }); + + console.log(outputItem.id); + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.evals.runs.outputitems.OutputItemRetrieveParams; + import com.openai.models.evals.runs.outputitems.OutputItemRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OutputItemRetrieveParams params = OutputItemRetrieveParams.builder() + .evalId("eval_id") + .runId("run_id") + .outputItemId("output_item_id") + .build(); + OutputItemRetrieveResponse outputItem = client.evals().runs().outputItems().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + output_item = openai.evals.runs.output_items.retrieve("output_item_id", eval_id: "eval_id", run_id: "run_id") + + puts(output_item) + response: | + { + "object": "eval.run.output_item", + "id": "outputitem_67e5796c28e081909917bf79f6e6214d", + "created_at": 1743092076, + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "status": "pass", + "datasource_item_id": 5, + "datasource_item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + }, + "results": [ + { + "name": "String check-a2486074-d803-4445-b431-ad2262e85d47", + "sample": null, + "passed": true, + "score": 1.0 + } + ], + "sample": { + "input": [ + { + "role": "developer", + "content": "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", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + }, + { + "role": "user", + "content": "Stock Markets Rally After Positive Economic Data Released", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "output": [ + { + "role": "assistant", + "content": "Markets", + "tool_call_id": null, + "tool_calls": null, + "function_call": null + } + ], + "finish_reason": "stop", + "model": "gpt-4o-mini-2024-07-18", + "usage": { + "total_tokens": 325, + "completion_tokens": 2, + "prompt_tokens": 323, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } +components: + schemas: + EvalList: + type: object + title: EvalList + description: | + An object representing a list of evals. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval objects. + 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: | + { + "object": "list", + "data": [ + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": {}, + } + ], + "first_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "last_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "has_more": true + } + 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. + title: CustomDataSourceConfig + 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: | + { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + } + 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) + metadata: + type: object + description: Metadata filters for the logs data source. + additionalProperties: true + example: | + { + "use_case": "customer_support_agent" + } + required: + - item_schema + - type + x-oaiMeta: + name: The eval file data source config object + group: evals + example: | + { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + }, + "include_sample_schema": true + } + deprecated: true + 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 + Eval: + type: object + title: Eval + description: | + An Eval object with a data source config and testing criteria. + An Eval represents a task to be done for your LLM integration. + Like: + - Improve the quality of my chatbot + - See how well my chatbot handles customer support + - Check if o4-mini is better at my usecase than gpt-4o + 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. + title: CustomDataSourceConfig + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + example: | + { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + } + }, + "required": ["item"] + } + metadata: + $ref: '#/components/schemas/Metadata' + required: + - type + - schema + x-oaiMeta: + name: The eval custom data source config object + group: evals + example: | + { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + } + }, + "required": ["item"] + } + } + deprecated: true + testing_criteria: + default: eval + 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: | + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + }, + "include_sample_schema": true + }, + "testing_criteria": [ + { + "name": "My string check grader", + "type": "string_check", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq", + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": { + "test": "synthetics", + } + } + Metadata: + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + Error: + type: object + properties: + code: + type: string + message: + type: string + param: + type: string + type: + type: string + required: + - type + - message + - param + - code + EvalRunList: + type: object + title: EvalRunList + description: | + An object representing a list of runs for an evaluation. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval run objects. + 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: | + { + "object": "list", + "data": [ + { + "object": "eval.run", + "id": "evalrun_67b7fbdad46c819092f6fe7a14189620", + "eval_id": "eval_67b7fa9a81a88190ab4aa417e397ea21", + "report_url": "https://platform.openai.com/evaluations/eval_67b7fa9a81a88190ab4aa417e397ea21?run_id=evalrun_67b7fbdad46c819092f6fe7a14189620", + "status": "completed", + "model": "o3-mini", + "name": "Academic Assistant", + "created_at": 1740110812, + "result_counts": { + "total": 171, + "errored": 0, + "failed": 80, + "passed": 91 + }, + "per_model_usage": null, + "per_testing_criteria_results": [ + { + "testing_criteria": "String check grader", + "passed": 91, + "failed": 80 + } + ], + "run_data_source": { + "type": "completions", + "template_messages": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "You are a helpful assistant." + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Hello, can you help me with my homework?" + } + } + ], + "datasource_reference": null, + "model": "o3-mini", + "max_completion_tokens": null, + "seed": null, + "temperature": null, + "top_p": null + }, + "error": null, + "metadata": {"test": "synthetics"} + } + ], + "first_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "last_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "has_more": false + } + 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. + title: JsonlRunDataSource + 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. + 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. + id: + type: string + description: The identifier of the file. + required: + - type + - content + - id + 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. + 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' + item_reference: + type: string + description: A reference to a variable in the `item` namespace. Ie, "item.input_trajectory" + required: + - type + - template + - 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. + + Setting 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](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables the older JSON mode, which + ensures the message the model generates is valid JSON. Using `json_schema` + is preferred for models that support it. + 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. + items: + $ref: '#/components/schemas/ChatCompletionTool' + model: + type: string + description: The name of the model to use for generating completions (e.g. "o3-mini"). + required: + - type + - source + x-oaiMeta: + name: The file data source object for the eval run configuration + group: evals + example: | + { + "type": "jsonl", + "source": { + "type": "file_id", + "id": "file-9GYS6xbkWgWhmE7VoLUWFg" + } + } + required: + - data_source + EvalRun: + type: object + title: EvalRun + description: | + A schema representing an evaluation run. + 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 + description: The model that is evaluated, if applicable. + name: + type: string + 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 + 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. + title: JsonlRunDataSource + 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. + 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. + id: + type: string + description: The identifier of the file. + required: + - type + - content + - id + 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. + 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' + item_reference: + type: string + description: A reference to a variable in the `item` namespace. Ie, "item.input_trajectory" + required: + - type + - template + - 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. + + Setting 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](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables the older JSON mode, which + ensures the message the model generates is valid JSON. Using `json_schema` + is preferred for models that support it. + 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. + items: + $ref: '#/components/schemas/ChatCompletionTool' + model: + type: string + description: The name of the model to use for generating completions (e.g. "o3-mini"). + required: + - type + - source + x-oaiMeta: + name: The file data source object for the eval run configuration + group: evals + example: | + { + "type": "jsonl", + "source": { + "type": "file_id", + "id": "file-9GYS6xbkWgWhmE7VoLUWFg" + } + } + metadata: + $ref: '#/components/schemas/Metadata' + error: + $ref: '#/components/schemas/EvalApiError' + 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: | + { + "object": "eval.run", + "id": "evalrun_67e57965b480819094274e3a32235e4c", + "eval_id": "eval_67e579652b548190aaa83ada4b125f47", + "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47?run_id=evalrun_67e57965b480819094274e3a32235e4c", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "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" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + EvalRunOutputItemList: + type: object + title: EvalRunOutputItemList + description: | + An object representing a list of output items for an evaluation run. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval run output item objects. + 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: | + { + "object": "list", + "data": [ + { + "object": "eval.run.output_item", + "id": "outputitem_67abd55eb6548190bb580745d5644a33", + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "created_at": 1739314509, + "status": "pass", + "datasource_item_id": 137, + "datasource_item": { + "teacher": "To grade essays, I only check for style, content, and grammar.", + "student": "I am a student who is trying to write the best essay." + }, + "results": [ + { + "name": "String Check Grader", + "type": "string-check-grader", + "score": 1.0, + "passed": true, + } + ], + "sample": { + "input": [ + { + "role": "system", + "content": "You are an evaluator bot..." + }, + { + "role": "user", + "content": "You are assessing..." + } + ], + "output": [ + { + "role": "assistant", + "content": "The rubric is not clear nor concise." + } + ], + "finish_reason": "stop", + "model": "gpt-4o-2024-08-06", + "usage": { + "total_tokens": 521, + "completion_tokens": 2, + "prompt_tokens": 519, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + }, + ], + "first_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "last_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "has_more": false + } + EvalRunOutputItem: + type: object + title: EvalRunOutputItem + description: | + A schema representing an evaluation run output item. + 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: + $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. + 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: | + { + "object": "eval.run.output_item", + "id": "outputitem_67abd55eb6548190bb580745d5644a33", + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "created_at": 1739314509, + "status": "pass", + "datasource_item_id": 137, + "datasource_item": { + "teacher": "To grade essays, I only check for style, content, and grammar.", + "student": "I am a student who is trying to write the best essay." + }, + "results": [ + { + "name": "String Check Grader", + "type": "string-check-grader", + "score": 1.0, + "passed": true, + } + ], + "sample": { + "input": [ + { + "role": "system", + "content": "You are an evaluator bot..." + }, + { + "role": "user", + "content": "You are assessing..." + } + ], + "output": [ + { + "role": "assistant", + "content": "The rubric is not clear nor concise." + } + ], + "finish_reason": "stop", + "model": "gpt-4o-2024-08-06", + "usage": { + "total_tokens": 521, + "completion_tokens": 2, + "prompt_tokens": 519, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } + CreateEvalCustomDataSourceConfig: + type: object + title: CustomDataSourceConfig + description: | + A CustomDataSourceConfig object that defines the schema for the data source used for the evaluation runs. + This schema is used to define the shape of the data that will be: + - Used to define your testing criteria and + - What data is required when creating a run + 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: | + { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + } + 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: + - item_schema + - type + x-oaiMeta: + name: The eval file data source config object + group: evals + example: | + { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + }, + "include_sample_schema": true + } + CreateEvalLogsDataSourceConfig: + type: object + title: LogsDataSourceConfig + description: | + A data source config which specifies the metadata property of your logs query. + This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. + 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: | + { + "use_case": "customer_support_agent" + } + required: + - type + x-oaiMeta: + name: The logs data source object for evals + group: evals + example: | + { + "type": "logs", + "metadata": { + "use_case": "customer_support_agent" + } + } + CreateEvalStoredCompletionsDataSourceConfig: + type: object + title: StoredCompletionsDataSourceConfig + description: | + Deprecated in favor of LogsDataSourceConfig. + 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: | + { + "use_case": "customer_support_agent" + } + required: + - type + deprecated: true + x-oaiMeta: + name: The stored completions data source object for evals + group: evals + example: | + { + "type": "stored_completions", + "metadata": { + "use_case": "customer_support_agent" + } + } + CreateEvalLabelModelGrader: + type: object + title: LabelModelGrader + description: | + A LabelModelGrader object which uses a model to assign labels to each item + in the evaluation. + 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' + 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: | + { + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "role": "system", + "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" + }, + { + "role": "user", + "content": "Statement: {{item.response}}" + } + ], + "passing_labels": ["positive"], + "labels": ["positive", "neutral", "negative"], + "name": "Sentiment label grader" + } + EvalGraderStringCheck: + type: object + title: StringCheckGrader + description: | + A StringCheckGrader object that performs a string comparison between input and reference using a specified operation. + 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: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + EvalGraderTextSimilarity: + type: object + title: TextSimilarityGrader + description: | + A TextSimilarityGrader object which grades text based on similarity metrics. + 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`, + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, + or `rouge_l`. + pass_threshold: + type: number + description: The threshold for the score. + required: + - type + - name + - input + - reference + - evaluation_metric + - pass_threshold + x-oaiMeta: + name: Text Similarity Grader + group: graders + example: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "evaluation_metric": "fuzzy_match" + } + EvalGraderPython: + type: object + title: PythonGrader + description: | + A PythonGrader object that runs a python script on the input. + 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. + pass_threshold: + type: number + description: The threshold for the score. + required: + - type + - name + - source + x-oaiMeta: + name: Python Grader + group: graders + example: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + } + EvalGraderScoreModel: + type: object + title: ScoreModelGrader + description: | + A ScoreModelGrader object that uses a model to assign a score to the input. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: | + An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: | + The maximum number of tokens the grader model may generate in its response. + - 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. + range: + type: array + items: + type: number + min_items: 2 + max_items: 2 + description: The range of the score. Defaults to `[0, 1]`. + pass_threshold: + type: number + description: The threshold for the score. + required: + - type + - name + - input + - model + x-oaiMeta: + name: Score Model Grader + group: graders + example: | + { + "type": "score_model", + "name": "Example score model grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "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}}" + ) + }, + { + "type": "input_image", + "image_url": "https://example.com/reference.png", + "file_id": null, + "detail": "auto" + } + ], + } + ], + "model": "gpt-5-mini", + "sampling_params": { + "temperature": 1, + "top_p": 1, + "seed": 42, + "max_completions_tokens": 32768, + "reasoning_effort": "medium" + }, + } + EvalCustomDataSourceConfig: + type: object + title: CustomDataSourceConfig + description: | + A CustomDataSourceConfig which specifies the schema of your `item` and optionally `sample` namespaces. + The response schema defines the shape of the data that will be: + - Used to define your testing criteria and + - What data is required when creating a run + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + 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: | + { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + } + }, + "required": ["item"] + } + } + EvalLogsDataSourceConfig: + type: object + title: LogsDataSourceConfig + description: | + A LogsDataSourceConfig which specifies the metadata property of your logs query. + This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. + The schema returned by this data source config is used to defined what variables are available in your evals. + `item` and `sample` are both defined when using this data source config. + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + required: + - type + - schema + x-oaiMeta: + name: The logs data source object for evals + group: evals + example: | + { + "type": "logs", + "metadata": { + "language": "english" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + } + } + EvalStoredCompletionsDataSourceConfig: + type: object + title: StoredCompletionsDataSourceConfig + description: | + Deprecated in favor of LogsDataSourceConfig. + 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. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + required: + - type + - schema + deprecated: true + x-oaiMeta: + name: The stored completions data source object for evals + group: evals + example: | + { + "type": "stored_completions", + "metadata": { + "language": "english" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + } + } + EvalGraderLabelModel: + type: object + title: LabelModelGrader + description: | + A LabelModelGrader object which uses a model to assign labels to each item + in the evaluation. + 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: | + { + "name": "First label grader", + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.response}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + CreateEvalJsonlRunDataSource: + type: object + title: JsonlRunDataSource + description: | + A JsonlRunDataSource object with that specifies a JSONL file that matches the eval + 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. + 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. + id: + type: string + description: The identifier of the file. + required: + - type + - content + - id + required: + - type + - source + x-oaiMeta: + name: The file data source object for the eval run configuration + group: evals + example: | + { + "type": "jsonl", + "source": { + "type": "file_id", + "id": "file-9GYS6xbkWgWhmE7VoLUWFg" + } + } + CreateEvalCompletionsRunDataSource: + type: object + title: CompletionsRunDataSource + description: | + A CompletionsRunDataSource object describing a model sampling configuration. + 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. + 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' + item_reference: + type: string + description: A reference to a variable in the `item` namespace. Ie, "item.input_trajectory" + required: + - type + - template + - 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. + + Setting 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](/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables the older JSON mode, which + ensures the message the model generates is valid JSON. Using `json_schema` + is preferred for models that support it. + 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. + items: + $ref: '#/components/schemas/ChatCompletionTool' + 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. + 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. + id: + type: string + description: The identifier of the file. + metadata: + $ref: '#/components/schemas/Metadata' + model: + type: string + description: An optional model to filter by (e.g., 'gpt-4o'). + created_after: + type: integer + description: An optional Unix timestamp to filter items created after this time. + created_before: + type: integer + description: An optional Unix timestamp to filter items created before this time. + limit: + type: integer + description: An optional maximum number of items to return. + required: + - type + - content + - id + x-oaiMeta: + name: The stored completions data source object used to configure an individual run + group: eval runs + example: | + { + "type": "stored_completions", + "model": "gpt-4o", + "created_after": 1668124800, + "created_before": 1668124900, + "limit": 100, + "metadata": {} + } + required: + - type + - source + x-oaiMeta: + name: The completions data source object used to configure an individual run + group: eval runs + example: | + { + "name": "gpt-4o-mini-2024-07-18", + "data_source": { + "type": "completions", + "input_messages": { + "type": "item_reference", + "item_reference": "item.input" + }, + "model": "gpt-4o-mini-2024-07-18", + "source": { + "type": "stored_completions", + "model": "gpt-4o-mini-2024-07-18" + } + } + } + CreateEvalResponsesRunDataSource: + type: object + title: ResponsesRunDataSource + description: | + A ResponsesRunDataSource object describing a model sampling configuration. + 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. + 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' + item_reference: + type: string + description: A reference to a variable in the `item` namespace. Ie, "item.name" + required: + - type + - template + - 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 + can specify which tool to use by setting the `tool_choice` parameter. + + The two categories of tools you can provide the model are: + + - **Built-in tools**: Tools that are provided by OpenAI that extend the + model's capabilities, like [web search](/docs/guides/tools-web-search) + or [file search](/docs/guides/tools-file-search). Learn more about + [built-in tools](/docs/guides/tools). + - **Function calls (custom tools)**: Functions that are defined by you, + enabling the model to call your own code. Learn more about + [function calling](/docs/guides/function-calling). + items: + $ref: '#/components/schemas/Tool' + text: + type: object + description: | + Configuration options for a text response from the model. Can be plain + text or structured JSON data. Learn more: + - [Text inputs and outputs](/docs/guides/text) + - [Structured Outputs](/docs/guides/structured-outputs) + properties: + format: + $ref: '#/components/schemas/TextResponseFormatConfiguration' + 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. + 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. + id: + type: string + description: The identifier of the file. + metadata: + type: string + description: Metadata filter for the responses. This is a query parameter used to select responses. (opaque JSON object) + model: + type: string + description: The name of the model to find responses for. This is a query parameter used to select responses. + instructions_search: + type: string + description: Optional string to search the 'instructions' field. This is a query parameter used to select responses. + created_after: + type: integer + minimum: 0 + description: Only include items created after this timestamp (inclusive). This is a query parameter used to select responses. + created_before: + type: integer + minimum: 0 + description: Only include items created before this timestamp (inclusive). This is a query parameter used to select responses. + reasoning_effort: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + default: medium + description: | + Constrains effort on reasoning for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing + reasoning effort can result in faster responses and fewer tokens used + on reasoning in a response. + + - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. + - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. + - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. + - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + temperature: + type: number + description: Sampling temperature. This is a query parameter used to select responses. + top_p: + type: number + description: Nucleus sampling parameter. This is a query parameter used to select responses. + users: + type: array + items: + type: string + description: List of user identifiers. This is a query parameter used to select responses. + tools: + type: array + items: + type: string + description: List of tool names. This is a query parameter used to select responses. + required: + - type + - content + - id + x-oaiMeta: + name: The run data source object used to configure an individual run + group: eval runs + example: | + { + "type": "responses", + "model": "gpt-4o-mini-2024-07-18", + "temperature": 0.7, + "top_p": 1.0, + "users": ["user1", "user2"], + "tools": ["tool1", "tool2"], + "instructions_search": "You are a coding assistant" + } + required: + - type + - source + x-oaiMeta: + name: The completions data source object used to configure an individual run + group: eval runs + example: | + { + "name": "gpt-4o-mini-2024-07-18", + "data_source": { + "type": "responses", + "input_messages": { + "type": "item_reference", + "item_reference": "item.input" + }, + "model": "gpt-4o-mini-2024-07-18", + "source": { + "type": "responses", + "model": "gpt-4o-mini-2024-07-18" + } + } + } + EvalApiError: + type: object + title: EvalApiError + description: | + An object representing an error response from the Eval API. + 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: | + { + "code": "internal_error", + "message": "The eval run failed due to an internal error." + } + EvalRunOutputItemResult: + type: object + title: EvalRunOutputItemResult + description: | + A single grader result for an evaluation run output item. + 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: + description: Optional sample or intermediate data produced by the grader. + type: object + additionalProperties: true + additionalProperties: true + required: + - name + - score + - passed + 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 + x-oaiMeta: + name: The chat message object used to configure an individual run + properties: + role: + type: string + description: The role of the message (e.g. "system", "assistant", "user"). + content: + type: string + description: The content of the message. + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + required: + - role + - content + GraderStringCheck: + type: object + title: StringCheckGrader + description: | + A StringCheckGrader object that performs a string comparison between input and reference using a specified operation. + 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: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + GraderTextSimilarity: + type: object + title: TextSimilarityGrader + description: | + A TextSimilarityGrader object which grades text based on similarity metrics. + 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`, + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, + or `rouge_l`. + required: + - type + - name + - input + - reference + - evaluation_metric + x-oaiMeta: + name: Text Similarity Grader + group: graders + example: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "evaluation_metric": "fuzzy_match" + } + GraderPython: + type: object + title: PythonGrader + description: | + A PythonGrader object that runs a python script on the input. + 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: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + } + GraderScoreModel: + type: object + title: ScoreModelGrader + description: | + A ScoreModelGrader object that uses a model to assign a score to the input. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: | + An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: | + The maximum number of tokens the grader model may generate in its response. + - 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. + 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: | + { + "type": "score_model", + "name": "Example score model grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "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}}" + ) + }, + { + "type": "input_image", + "image_url": "https://example.com/reference.png", + "file_id": null, + "detail": "auto" + } + ], + } + ], + "model": "gpt-5-mini", + "sampling_params": { + "temperature": 1, + "top_p": 1, + "seed": 42, + "max_completions_tokens": 32768, + "reasoning_effort": "medium" + }, + } + GraderLabelModel: + type: object + title: LabelModelGrader + description: | + A LabelModelGrader object which uses a model to assign labels to each item + in the evaluation. + 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: | + { + "name": "First label grader", + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.response}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + 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 + EasyInputMessage: + type: object + title: Input message + description: | + A message input to the model with a role indicating instruction following + hierarchy. Instructions given with the `developer` or `system` role take + precedence over instructions given with the `user` role. Messages with the + `assistant` role are presumed to have been generated by the model in previous + interactions. + properties: + role: + type: string + description: | + The role of the message input. One of `user`, `assistant`, `system`, or + `developer`. + enum: + - user + - assistant + - system + - developer + content: + description: | + Text, image, or audio input to the model, used to generate a response. + Can also contain previous assistant responses. + type: string + title: Text input + items: + $ref: '#/components/schemas/InputContent' + phase: + type: string + 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. + enum: + - commentary + - final_answer + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + required: + - role + - content + EvalItem: + type: object + title: Eval message object + description: | + A message input to the model with a role indicating instruction following + hierarchy. Instructions given with the `developer` or `system` role take + precedence over instructions given with the `user` role. Messages with the + `assistant` role are presumed to have been generated by the model in previous + interactions. + properties: + role: + type: string + description: | + The role of the message input. One of `user`, `assistant`, `system`, or + `developer`. + enum: + - user + - assistant + - system + - developer + content: + $ref: '#/components/schemas/EvalItemContent' + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + required: + - role + - content + ReasoningEffort: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + default: medium + description: | + Constrains effort on reasoning for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing + reasoning effort can result in faster responses and fewer tokens used + on reasoning in a response. + + - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. + - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. + - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. + - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + ResponseFormatText: + type: object + title: Text + description: | + Default response format. Used to generate text responses. + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + required: + - type + ResponseFormatJsonSchema: + type: object + title: JSON schema + description: | + JSON Schema response format. Used to generate structured JSON responses. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). + properties: + type: + type: string + description: The type of response format being defined. Always `json_schema`. + enum: + - json_schema + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: | + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + ResponseFormatJsonObject: + type: object + title: JSON object + description: | + JSON object response format. An older method of generating JSON responses. + Using `json_schema` is recommended for models that support it. Note that the + model will not generate JSON without a system or user message instructing it + to do so. + properties: + type: + type: string + description: The type of response format being defined. Always `json_object`. + enum: + - json_object + x-stainless-const: true + required: + - type + ChatCompletionTool: + type: object + title: Function tool + description: | + A function tool that can be used to generate a response. + 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 + EvalStoredCompletionsSource: + type: object + title: StoredCompletionsRunDataSource + description: | + A StoredCompletionsRunDataSource configuration describing a set of filters + 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: + type: string + description: An optional model to filter by (e.g., 'gpt-4o'). + created_after: + type: integer + description: An optional Unix timestamp to filter items created after this time. + created_before: + type: integer + description: An optional Unix timestamp to filter items created before this time. + limit: + type: integer + description: An optional maximum number of items to return. + required: + - type + x-oaiMeta: + name: The stored completions data source object used to configure an individual run + group: eval runs + example: | + { + "type": "stored_completions", + "model": "gpt-4o", + "created_after": 1668124800, + "created_before": 1668124900, + "limit": 100, + "metadata": {} + } + Tool: + description: | + A tool that can be used to generate a response. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - function + description: The type of the function tool. Always `function`. + default: function + x-stainless-const: true + name: + type: string + description: The name of the function to call. + description: + type: string + description: A description of the function. Used by the model to determine whether or not to call the function. + parameters: + additionalProperties: {} + type: object + description: A JSON schema object describing the parameters of the function. + x-oaiTypeLabel: map + strict: + type: boolean + description: Whether to enforce strict parameter validation. Default `true`. + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + 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: + 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. + 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`. + - `eq`: equals + - `ne`: not equal + - `gt`: greater than + - `gte`: greater than or equal + - `lt`: less than + - `lte`: less than or equal + - `in`: in + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: The value to compare against the attribute key; supports string, number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + 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. + user_location: + $ref: '#/components/schemas/WebSearchApproximateLocation' + search_context_size: + 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. + server_label: + type: string + description: | + A label for this MCP server, used to identify it in tool calls. + server_url: + type: string + format: uri + description: | + The URL for the MCP server. One of `server_url` or `connector_id` must be + provided. + 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 + `server_url` or `connector_id` must be provided. Learn more about service + connectors [here](/docs/guides/tools-remote-mcp#connectors). + + Currently supported `connector_id` values are: + + - Dropbox: `connector_dropbox` + - Gmail: `connector_gmail` + - Google Calendar: `connector_googlecalendar` + - Google Drive: `connector_googledrive` + - Microsoft Teams: `connector_microsoftteams` + - Outlook Calendar: `connector_outlookcalendar` + - Outlook Email: `connector_outlookemail` + - SharePoint: `connector_sharepoint` + authorization: + type: string + description: | + An OAuth access token that can be used with a remote MCP server, either + with a custom MCP server URL or a service connector. Your application + must handle the OAuth authorization flow and provide the token here. + server_description: + type: string + description: | + Optional description of the MCP server, used to provide more context. + headers: + type: object + additionalProperties: + type: string + description: | + Optional HTTP headers to send to the MCP server. Use for authentication + or other purposes. + allowed_tools: + description: | + List of allowed tool names or a filter object. + oneOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/MCPToolFilter' + type: 'null' + require_approval: + 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 + `always`, `never`, or a filter object associated with tools + that require approval. + 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 + `never`. When set to `always`, all tools will require approval. When + set to `never`, all tools will not require approval. + enum: + - always + - never + default: always + type: 'null' + container: + description: | + The code interpreter container. Can be a container ID or an object that + specifies uploaded file IDs to make available to your code, along with an + optional `memory_limit` setting. + type: string + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + required: + - type + title: CodeInterpreterToolAuto + model: + type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-1.5 + description: | + The image generation model to use. Default: `gpt-image-1`. + default: gpt-image-1 + quality: + type: string + enum: + - low + - medium + - high + - auto + description: | + The quality of the generated image. One of `low`, `medium`, `high`, + or `auto`. Default: `auto`. + default: auto + size: + description: The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, 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 + type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + output_format: + type: string + enum: + - png + - webp + - jpeg + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer + minimum: 0 + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: + type: string + enum: + - transparent + - opaque + - auto + description: | + Background type for the generated image. One of `transparent`, + `opaque`, or `auto`. Default: `auto`. + default: auto + input_fidelity: + 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`. + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + 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. + default: 0 + action: + description: | + Whether to generate a new image or edit an existing image. Default: `auto`. + $ref: '#/components/schemas/ImageGenActionEnum' + format: + description: The input format for the custom tool. Default is unconstrained text. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + 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. + type: object + required: + - type + - syntax + - definition + title: Text format + 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 + type: array + minItems: 1 + description: The function/custom tools available inside this namespace. + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search is executed by the server or by the client. + search_content_types: + items: + $ref: '#/components/schemas/SearchContentType' + type: array + type: object + required: + - type + - name + - strict + - parameters + - vector_store_ids + - environment + - display_width + - display_height + - server_label + - container + - description + - tools + title: Function + TextResponseFormatConfiguration: + description: | + An object specifying the format that the model must output. + + Configuring `{ "type": "json_schema" }` enables Structured Outputs, + which ensures the model will match your supplied JSON schema. Learn more in the + [Structured Outputs guide](/docs/guides/structured-outputs). + + The default format is `{ "type": "text" }` with no additional options. + + **Not recommended for gpt-4o and newer models:** + + Setting to `{ "type": "json_object" }` enables the older JSON mode, which + ensures the message the model generates is valid JSON. Using `json_schema` + is preferred for models that support it. + type: object + title: Text + properties: + type: + type: string + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true + description: + type: string + description: | + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + type: boolean + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](/docs/guides/structured-outputs). + required: + - type + - schema + - name + EvalResponsesSource: + type: object + title: EvalResponsesSource + description: | + A EvalResponsesSource object describing a run data source configuration. + properties: + type: + type: string + enum: + - responses + description: The type of run data source. Always `responses`. + metadata: + type: string + description: Metadata filter for the responses. This is a query parameter used to select responses. (opaque JSON object) + model: + type: string + description: The name of the model to find responses for. This is a query parameter used to select responses. + instructions_search: + type: string + description: Optional string to search the 'instructions' field. This is a query parameter used to select responses. + created_after: + type: integer + minimum: 0 + description: Only include items created after this timestamp (inclusive). This is a query parameter used to select responses. + created_before: + type: integer + minimum: 0 + description: Only include items created before this timestamp (inclusive). This is a query parameter used to select responses. + reasoning_effort: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + default: medium + description: | + Constrains effort on reasoning for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing + reasoning effort can result in faster responses and fewer tokens used + on reasoning in a response. + + - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. + - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. + - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. + - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + temperature: + type: number + description: Sampling temperature. This is a query parameter used to select responses. + top_p: + type: number + description: Nucleus sampling parameter. This is a query parameter used to select responses. + users: + type: array + items: + type: string + description: List of user identifiers. This is a query parameter used to select responses. + tools: + type: array + items: + type: string + description: List of tool names. This is a query parameter used to select responses. + required: + - type + x-oaiMeta: + name: The run data source object used to configure an individual run + group: eval runs + example: | + { + "type": "responses", + "model": "gpt-4o-mini-2024-07-18", + "temperature": 0.7, + "top_p": 1.0, + "users": ["user1", "user2"], + "tools": ["tool1", "tool2"], + "instructions_search": "You are a coding assistant" + } + InputMessageContentList: + type: array + title: Input item content list + description: | + A list of one or many input items to the model, containing different content + types. + items: + $ref: '#/components/schemas/InputContent' + MessagePhase: + type: string + 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. + enum: + - commentary + - final_answer + 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. + type: string + 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. + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: | + The format of the audio data. Currently supported formats are `mp3` and + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - text + - image_url + - input_audio + items: + $ref: '#/components/schemas/EvalItemContentItem' + ResponseFormatJsonSchemaSchema: + type: object + title: JSON schema + description: | + The schema for the response format, described as a JSON Schema object. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + 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: + 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](/docs/guides/function-calling). + required: + - name + FunctionTool: + properties: + type: + type: string + enum: + - function + description: The type of the function tool. Always `function`. + default: function + x-stainless-const: true + name: + type: string + description: The name of the function to call. + description: + type: string + description: A description of the function. Used by the model to determine whether or not to call the function. + parameters: + additionalProperties: {} + type: object + description: A JSON schema object describing the parameters of the function. + x-oaiTypeLabel: map + strict: + type: boolean + description: Whether to enforce strict parameter validation. Default `true`. + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + 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://platform.openai.com/docs/guides/function-calling). + FileSearchTool: + properties: + type: + type: string + enum: + - file_search + description: The type of the file search tool. Always `file_search`. + default: file_search + x-stainless-const: true + 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: + 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. + 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`. + - `eq`: equals + - `ne`: not equal + - `gt`: greater than + - `gte`: greater than or equal + - `lt`: less than + - `lte`: less than or equal + - `in`: in + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: The value to compare against the attribute key; supports string, number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + 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://platform.openai.com/docs/guides/tools-file-search). + ComputerTool: + properties: + type: + type: string + enum: + - computer + description: The type of the computer tool. Always `computer`. + default: computer + x-stainless-const: true + type: object + required: + - type + title: Computer + description: A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). + ComputerUsePreviewTool: + properties: + type: + type: string + enum: + - computer_use_preview + description: The type of the computer use tool. Always `computer_use_preview`. + default: computer_use_preview + x-stainless-const: true + 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: + - 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://platform.openai.com/docs/guides/tools-computer-use). + WebSearchTool: + type: object + title: Web search + description: | + Search the Internet for sources related to the prompt. Learn more about the + [web search tool](/docs/guides/tools-web-search). + properties: + type: + 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 + filters: + type: object + description: | + Filters for the search. + 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. + Subdomains of the provided domains are allowed as well. + + Example: `["pubmed.ncbi.nlm.nih.gov"]` + items: + type: string + description: Allowed domain for the search. + default: [] + - type: 'null' + user_location: + $ref: '#/components/schemas/WebSearchApproximateLocation' + search_context_size: + 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. + required: + - type + MCPTool: + type: object + title: MCP tool + description: | + Give the model access to additional tools via remote Model Context Protocol + (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). + 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. + server_url: + type: string + format: uri + description: | + The URL for the MCP server. One of `server_url` or `connector_id` must be + provided. + 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 + `server_url` or `connector_id` must be provided. Learn more about service + connectors [here](/docs/guides/tools-remote-mcp#connectors). + + Currently supported `connector_id` values are: + + - Dropbox: `connector_dropbox` + - Gmail: `connector_gmail` + - Google Calendar: `connector_googlecalendar` + - Google Drive: `connector_googledrive` + - Microsoft Teams: `connector_microsoftteams` + - Outlook Calendar: `connector_outlookcalendar` + - Outlook Email: `connector_outlookemail` + - SharePoint: `connector_sharepoint` + authorization: + type: string + description: | + An OAuth access token that can be used with a remote MCP server, either + with a custom MCP server URL or a service connector. Your application + must handle the OAuth authorization flow and provide the token here. + server_description: + type: string + description: | + Optional description of the MCP server, used to provide more context. + headers: + type: object + additionalProperties: + type: string + description: | + Optional HTTP headers to send to the MCP server. Use for authentication + or other purposes. + allowed_tools: + description: | + List of allowed tool names or a filter object. + oneOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/MCPToolFilter' + type: 'null' + require_approval: + 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 + `always`, `never`, or a filter object associated with tools + that require approval. + 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 + `never`. When set to `always`, all tools will require approval. When + set to `never`, all tools will not require approval. + enum: + - always + - never + default: always + type: 'null' + defer_loading: + type: boolean + description: | + Whether this MCP tool is deferred and discovered via tool search. + required: + - type + - server_label + CodeInterpreterTool: + type: object + title: Code interpreter + description: | + A tool that runs Python code to help generate a response to a prompt. + properties: + type: + type: string + enum: + - code_interpreter + description: | + The type of the code interpreter tool. Always `code_interpreter`. + x-stainless-const: true + container: + description: | + The code interpreter container. Can be a container ID or an object that + specifies uploaded file IDs to make available to your code, along with an + optional `memory_limit` setting. + type: string + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + required: + - type + title: CodeInterpreterToolAuto + required: + - type + - container + ImageGenTool: + type: object + title: Image generation tool + description: | + A tool that generates images using the GPT image models. + properties: + type: + type: string + enum: + - image_generation + description: | + The type of the image generation tool. Always `image_generation`. + x-stainless-const: true + model: + type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-1.5 + description: | + The image generation model to use. Default: `gpt-image-1`. + default: gpt-image-1 + quality: + type: string + enum: + - low + - medium + - high + - auto + description: | + The quality of the generated image. One of `low`, `medium`, `high`, + or `auto`. Default: `auto`. + default: auto + size: + description: The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, 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 + type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + output_format: + type: string + enum: + - png + - webp + - jpeg + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer + minimum: 0 + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: + type: string + enum: + - transparent + - opaque + - auto + description: | + Background type for the generated image. One of `transparent`, + `opaque`, or `auto`. Default: `auto`. + default: auto + input_fidelity: + 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`. + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + 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. + default: 0 + action: + description: | + Whether to generate a new image or edit an existing image. Default: `auto`. + $ref: '#/components/schemas/ImageGenActionEnum' + required: + - type + LocalShellToolParam: + properties: + type: + type: string + enum: + - local_shell + description: The type of the local shell tool. Always `local_shell`. + default: local_shell + x-stainless-const: true + type: object + required: + - type + title: Local shell tool + description: A tool that allows the model to execute shell commands in a local environment. + FunctionShellToolParam: + properties: + type: + type: string + enum: + - shell + description: The type of the shell tool. Always `shell`. + default: shell + x-stainless-const: true + environment: + oneOf: + - $ref: '#/components/schemas/ContainerAutoParam' + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + discriminator: + propertyName: type + type: 'null' + type: object + required: + - type + title: Shell tool + description: A tool that allows the model to execute shell commands. + CustomToolParam: + properties: + type: + type: string + enum: + - custom + description: The type of the custom tool. Always `custom`. + default: custom + x-stainless-const: true + 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. + format: + description: The input format for the custom tool. Default is unconstrained text. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + 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. + type: object + required: + - type + - syntax + - definition + title: Text format + defer_loading: + type: boolean + description: Whether this tool should be deferred and discovered via tool search. + type: object + required: + - type + - name + title: Custom tool + description: A custom tool that processes input using a specified format. Learn more about [custom tools](/docs/guides/function-calling#custom-tools) + NamespaceToolParam: + 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 + minLength: 1 + description: A description of the namespace shown to the model. + 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 + 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: + type: string + description: Description shown to the model for a client-executed tool search tool. + parameters: + properties: {} + type: object + required: [] + type: object + required: + - type + title: Tool search tool + description: Hosted or BYOT tool search configuration for deferred tools. + WebSearchPreviewTool: + properties: + type: + type: string + enum: + - web_search_preview + - web_search_preview_2025_03_11 + 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 + user_location: + properties: + type: + type: string + enum: + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate + x-stainless-const: true + country: + type: string + description: The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`. + region: + type: string + description: Free text input for the region of the user, e.g. `California`. + city: + type: string + description: Free text input for the city of the user, e.g. `San Francisco`. + timezone: + type: string + description: The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`. + type: object + required: + - type + 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://platform.openai.com/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 + type: object + required: + - type + title: Apply patch tool + description: Allows the assistant to create, delete, or update files using unified diffs. + TextResponseFormatJsonSchema: + type: object + title: JSON schema + description: | + JSON Schema response format. Used to generate structured JSON responses. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). + properties: + type: + type: string + description: The type of response format being defined. Always `json_schema`. + enum: + - json_schema + x-stainless-const: true + description: + type: string + description: | + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + type: boolean + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](/docs/guides/structured-outputs). + required: + - type + - schema + - name + InputContent: + discriminator: + propertyName: type + 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. + image_url: + 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. + file_id: + type: string + description: The ID of the file to be sent to the model. + 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`. + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + file_url: + type: string + format: uri + description: The URL of the file to be sent to the model. + type: object + required: + - type + - text + - detail + title: Input text + description: A text input to the model. + EvalItemContentItem: + title: Eval content item + description: | + A single content item: input text, output text, input image, or input audio. + type: string + 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. + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: | + The format of the audio data. Currently supported formats are `mp3` and + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - text + - image_url + - input_audio + 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 + image, or input audio object. + items: + $ref: '#/components/schemas/EvalItemContentItem' + FunctionParameters: + type: object + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. + additionalProperties: true + RankingOptions: + properties: + 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: + 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. + 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`. + - `eq`: equals + - `ne`: not equal + - `gt`: greater than + - `gte`: greater than or equal + - `lt`: less than + - `lte`: less than or equal + - `in`: in + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: The value to compare against the attribute key; supports string, number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + ComputerEnvironment: + type: string + enum: + - windows + - mac + - linux + - ubuntu + - browser + WebSearchApproximateLocation: + type: object + title: Web search approximate location + description: | + The approximate location of the user. + 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' + MCPToolFilter: + type: object + title: MCP tool filter + description: | + A filter object to specify which tools are allowed. + 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 + MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), + it will match this filter. + required: [] + additionalProperties: false + AutoCodeInterpreterToolParam: + properties: + type: + type: string + enum: + - auto + description: Always `auto`. + default: auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + 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. + 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`. + ImageGenActionEnum: + type: string + enum: + - generate + - edit + - auto + ContainerAutoParam: + properties: + type: + type: string + enum: + - container_auto + description: Automatically creates a container for this request + default: container_auto + 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. + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + 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 + 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. + type: object + required: + - type + LocalEnvironmentParam: + properties: + type: + type: string + enum: + - local + 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. + type: object + required: + - type + ContainerReferenceParam: + properties: + type: + type: string + enum: + - container_reference + description: References a container created with the /v1/containers endpoint + default: container_reference + x-stainless-const: true + container_id: + type: string + description: The ID of the referenced container. + example: cntr_123 + type: object + required: + - type + - container_id + CustomTextFormatParam: + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + default: text + x-stainless-const: true + type: object + required: + - type + title: Text format + description: Unconstrained free-form text. + CustomGrammarFormatParam: + properties: + type: + type: string + enum: + - grammar + description: Grammar format. Always `grammar`. + default: grammar + 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. + type: object + required: + - type + - syntax + - definition + title: Grammar format + description: A grammar defined by the user. + FunctionToolParam: + properties: + name: + type: string + maxLength: 128 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: + type: string + parameters: + properties: {} + type: object + required: [] + strict: + type: boolean + type: + type: string + enum: + - function + default: function + x-stainless-const: true + defer_loading: + type: boolean + description: Whether this function should be deferred and discovered via tool search. + type: object + required: + - name + - type + ToolSearchExecutionType: + type: string + enum: + - server + - client + EmptyModelParam: + properties: {} + type: object + required: [] + ApproximateLocation: + properties: + type: + type: string + enum: + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate + x-stainless-const: true + country: + type: string + description: The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`. + region: + type: string + description: Free text input for the region of the user, e.g. `California`. + city: + type: string + description: Free text input for the city of the user, e.g. `San Francisco`. + timezone: + type: string + description: The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`. + type: object + required: + - type + SearchContextSize: + type: string + enum: + - low + - medium + - high + SearchContentType: + type: string + enum: + - text + - image + 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. + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + 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 + image_url: + 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. + file_id: + type: string + description: The ID of the file to be sent to the model. + 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`. + type: object + required: + - type + - detail + title: Input image + description: An image input to the model. Learn about [image inputs](/docs/guides/vision). + 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: + type: string + description: The ID of the file to be sent to the model. + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + 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 `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`. + type: object + required: + - type + title: Input file + description: A file input to the model. + EvalItemContentText: + type: string + title: Text input + description: | + A text input to the model. + EvalItemContentOutputText: + type: object + title: Output text + description: | + A text output from the model. + properties: + type: + type: string + description: | + The type of the output text. Always `output_text`. + enum: + - output_text + x-stainless-const: true + text: + type: string + description: | + The text output from the model. + required: + - type + - text + 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`. + enum: + - input_image + x-stainless-const: true + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + required: + - type + - image_url + InputAudio: + type: object + title: Input audio + description: | + An audio input to the model. + properties: + type: + type: string + description: | + The type of the input item. Always `input_audio`. + enum: + - input_audio + x-stainless-const: true + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: | + The format of the audio data. Currently supported formats are `mp3` and + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - input_audio + 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. + type: object + required: + - embedding_weight + - text_weight + 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. + 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`. + - `eq`: equals + - `ne`: not equal + - `gt`: greater than + - `gte`: greater than or equal + - `lt`: less than + - `lte`: less than or equal + - `in`: in + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: The value to compare against the attribute key; supports string, number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + required: + - type + - key + - value + x-oaiMeta: + name: ComparisonFilter + 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: '#' + discriminator: + propertyName: type + required: + - type + - filters + x-oaiMeta: + name: CompoundFilter + ContainerMemoryLimit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + ContainerNetworkPolicyDisabledParam: + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + x-stainless-const: true + type: object + required: + - type + 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 + 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 + skill_id: + type: string + maxLength: 64 + minLength: 1 + description: The ID of the referenced skill. + version: + type: string + description: Optional skill version. Use a positive integer or 'latest'. Omit for default. + type: object + required: + - type + - skill_id + InlineSkillParam: + properties: + type: + type: string + enum: + - inline + description: Defines an inline skill for this request. + default: inline + x-stainless-const: true + name: + type: string + description: The name of the skill. + 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 + LocalSkillParam: + properties: + name: + type: string + description: The name of the skill. + description: + type: string + description: The description of the skill. + path: + type: string + description: The path to the directory containing the skill. + type: object + required: + - name + - description + - path + GrammarSyntax1: + type: string + enum: + - lark + - regex + ImageDetail: + type: string + enum: + - low + - high + - auto + - original + FileInputDetail: + type: string + enum: + - low + - high + 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 + InlineSkillSourceParam: + 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. + type: object + required: + - type + - media_type + - data + description: Inline skill payload +servers: + - url: https://api.openai.com/v1 diff --git a/provider-dev/source/files.yaml b/provider-dev/source/files.yaml new file mode 100644 index 0000000..15472ed --- /dev/null +++ b/provider-dev/source/files.yaml @@ -0,0 +1,694 @@ +openapi: 3.1.0 +info: + title: files API + description: openai API + version: 2.3.0 +paths: + /files: + get: + operationId: listFiles + tags: + - Files + summary: Returns a list of files. + parameters: + - in: query + name: purpose + required: false + schema: + type: string + description: Only return files with the given purpose. + - name: limit + in: query + description: |- + A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 10000 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFilesResponse' + x-oaiMeta: + name: List files + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.files.list() + page = page.data[0] + print(page) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.files.list(); + + for await (const file of list) { + console.log(file); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fileObject of client.files.list()) { + console.log(fileObject); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Files.List(context.TODO(), openai.FileListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileListPage; + import com.openai.models.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileListPage page = client.files().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.files.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "file", + "bytes": 175, + "created_at": 1613677385, + "expires_at": 1677614202, + "filename": "salesOverview.pdf", + "purpose": "assistants", + }, + { + "id": "file-abc456", + "object": "file", + "bytes": 140, + "created_at": 1613779121, + "expires_at": 1677614202, + "filename": "puppy.jsonl", + "purpose": "fine-tune", + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + post: + operationId: createFile + tags: + - Files + summary: | + Upload a file that can be used across various endpoints. Individual files + can be up to 512 MB, and each project can store up to 2.5 TB of files in + total. There is no organization-wide storage limit. Uploads to this + endpoint are rate-limited to 1,000 requests per minute per authenticated + user. + + - The Assistants API supports files up to 2 million tokens and of specific + file types. See the [Assistants Tools guide](/docs/assistants/tools) for + details. + - The Fine-tuning API only supports `.jsonl` files. The input also has + certain required formats for fine-tuning + [chat](/docs/api-reference/fine-tuning/chat-input) or + [completions](/docs/api-reference/fine-tuning/completions-input) models. + - The Batch API only supports `.jsonl` files up to 200 MB in size. The input + also has a specific required + [format](/docs/api-reference/batch/request-input). + - 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_stores/{vector_store_id}/file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch) + instead of attaching them one by one. Vector store attachment has separate + limits from file upload, including 2,000 attached files per minute per + organization. + + Please [contact us](https://help.openai.com/) if you need to increase these + storage limits. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateFileRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIFile' + 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. + examples: + request: + curl: | + curl https://api.openai.com/v1/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F purpose="fine-tune" \ + -F file="@mydata.jsonl" + -F expires_after[anchor]="created_at" + -F expires_after[seconds]=2592000 + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file_object = client.files.create( + file=b"Example data", + purpose="assistants", + ) + print(file_object.id) + javascript: |- + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.create({ + file: fs.createReadStream("mydata.jsonl"), + purpose: "fine-tune", + expires_after: { + anchor: "created_at", + seconds: 2592000 + } + }); + + console.log(file); + } + + main(); + node.js: |- + import fs from 'fs'; + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fileObject = await client.files.create({ + file: fs.createReadStream('fine-tune.jsonl'), + purpose: 'assistants', + }); + + console.log(fileObject.id); + go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfileObject, err := client.Files.New(context.TODO(), openai.FileNewParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tPurpose: openai.FilePurposeAssistants,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fileObject.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileCreateParams; + import com.openai.models.files.FileObject; + import com.openai.models.files.FilePurpose; + import java.io.ByteArrayInputStream; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileCreateParams params = FileCreateParams.builder() + .file(new ByteArrayInputStream("Example data".getBytes())) + .purpose(FilePurpose.ASSISTANTS) + .build(); + FileObject fileObject = client.files().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file_object = openai.files.create(file: StringIO.new("Example data"), purpose: :assistants) + + puts(file_object) + response: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1677614202, + "filename": "mydata.jsonl", + "purpose": "fine-tune", + } + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + /files/{file_id}: + delete: + operationId: deleteFile + tags: + - Files + summary: Delete a file and remove it from all vector stores. + parameters: + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to use for this request. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteFileResponse' + x-oaiMeta: + name: Delete file + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files/file-abc123 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file_deleted = client.files.delete( + "file_id", + ) + print(file_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.delete("file-abc123"); + + console.log(file); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fileDeleted = await client.files.delete('file_id'); + + console.log(fileDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfileDeleted, err := client.Files.Delete(context.TODO(), \"file_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fileDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileDeleteParams; + import com.openai.models.files.FileDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileDeleted fileDeleted = client.files().delete("file_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file_deleted = openai.files.delete("file_id") + + puts(file_deleted) + response: | + { + "id": "file-abc123", + "object": "file", + "deleted": true + } + get: + operationId: retrieveFile + tags: + - Files + summary: Returns information about a specific file. + parameters: + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to use for this request. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIFile' + x-oaiMeta: + name: Retrieve file + group: files + examples: + request: + curl: | + curl https://api.openai.com/v1/files/file-abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + file_object = client.files.retrieve( + "file_id", + ) + print(file_object.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.retrieve("file-abc123"); + + console.log(file); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fileObject = await client.files.retrieve('file_id'); + + console.log(fileObject.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfileObject, err := client.Files.Get(context.TODO(), \"file_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fileObject.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FileObject; + import com.openai.models.files.FileRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileObject fileObject = client.files().retrieve("file_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + file_object = openai.files.retrieve("file_id") + + puts(file_object) + response: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1677614202, + "filename": "mydata.jsonl", + "purpose": "fine-tune", + } +components: + schemas: + 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 + CreateFileRequest: + type: object + additionalProperties: false + properties: + purpose: + description: | + The intended purpose of the uploaded file. One of: + - `assistants`: Used in the Assistants API + - `batch`: Used in the Batch API + - `fine-tune`: Used for fine-tuning + - `vision`: Images used for vision fine-tuning + - `user_data`: Flexible file type for any purpose + - `evals`: Used for eval data sets + type: string + enum: + - assistants + - batch + - fine-tune + - vision + - user_data + - evals + expires_after: + $ref: '#/components/schemas/FileExpirationAfter' + required: + - purpose + 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 + 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. + 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`. + required: + - id + - object + - bytes + - created_at + - filename + - purpose + - status + x-oaiMeta: + name: The file object + example: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1680202602, + "filename": "salesOverview.pdf", + "purpose": "assistants", + } + type: object + DeleteFileResponse: + type: object + properties: + id: + type: string + object: + type: string + enum: + - file + x-stainless-const: true + deleted: + type: boolean + required: + - id + - object + - deleted + 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 +servers: + - url: https://api.openai.com/v1 diff --git a/provider-dev/source/fine_tuning.yaml b/provider-dev/source/fine_tuning.yaml new file mode 100644 index 0000000..4ba1a24 --- /dev/null +++ b/provider-dev/source/fine_tuning.yaml @@ -0,0 +1,3956 @@ +openapi: 3.1.0 +info: + title: fine_tuning API + description: openai API + version: 2.3.0 +paths: + /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions: + get: + operationId: listFineTuningCheckpointPermissions + tags: + - Fine-tuning + summary: | + **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + + Organization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint. + parameters: + - in: path + name: fine_tuned_model_checkpoint + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuned model checkpoint to get permissions for. + - name: project_id + in: query + description: The ID of the project to get permissions for. + required: false + schema: + type: string + - name: after + in: query + description: Identifier for the last permission ID from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: |- + Number of permissions to retrieve. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 10 + - name: order + in: query + description: The order in which to retrieve permissions. + required: false + schema: + type: string + enum: + - ascending + - descending + default: descending + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFineTuningCheckpointPermissionResponse' + 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 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const permission = await client.fineTuning.checkpoints.permissions.retrieve( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + ); + + console.log(permission.first_id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + permission = client.fine_tuning.checkpoints.permissions.retrieve( + fine_tuned_model_checkpoint="ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(permission.first_id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpermission, err := client.FineTuning.Checkpoints.Permissions.Get(\n\t\tcontext.TODO(),\n\t\t\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n\t\topenai.FineTuningCheckpointPermissionGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", permission.FirstID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.checkpoints.permissions.PermissionRetrieveParams; + import com.openai.models.finetuning.checkpoints.permissions.PermissionRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PermissionRetrieveResponse permission = client.fineTuning().checkpoints().permissions().retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + permission = openai.fine_tuning.checkpoints.permissions.retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(permission) + response: | + { + "object": "list", + "data": [ + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + }, + { + "object": "checkpoint.permission", + "id": "cp_enQCFmOTGj3syEpYVhBRLTSy", + "created_at": 1721764800, + "project_id": "proj_iqGMw1llN8IrBb6SvvY5A1oF" + }, + ], + "first_id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "cp_enQCFmOTGj3syEpYVhBRLTSy", + "has_more": false + } + post: + operationId: createFineTuningCheckpointPermission + tags: + - Fine-tuning + summary: | + **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys). + + This enables organization owners to share fine-tuned models with other projects in their organization. + parameters: + - in: path + name: fine_tuned_model_checkpoint + required: true + schema: + type: string + example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd + description: | + The ID of the fine-tuned model checkpoint to create a permission for. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateFineTuningCheckpointPermissionRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFineTuningCheckpointPermissionResponse' + x-oaiMeta: + name: Create 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 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + -d '{"project_ids": ["proj_abGMw1llN8IrBb6SvvY5A1iH"]}' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const permissionCreateResponse of client.fineTuning.checkpoints.permissions.create( + 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + { project_ids: ['string'] }, + )) { + console.log(permissionCreateResponse.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.checkpoints.permissions.create( + fine_tuned_model_checkpoint="ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd", + project_ids=["string"], + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Checkpoints.Permissions.New(\n\t\tcontext.TODO(),\n\t\t\"ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd\",\n\t\topenai.FineTuningCheckpointPermissionNewParams{\n\t\t\tProjectIDs: []string{\"string\"},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.checkpoints.permissions.PermissionCreatePage; + import com.openai.models.finetuning.checkpoints.permissions.PermissionCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PermissionCreateParams params = PermissionCreateParams.builder() + .fineTunedModelCheckpoint("ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd") + .addProjectId("string") + .build(); + PermissionCreatePage page = client.fineTuning().checkpoints().permissions().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.fine_tuning.checkpoints.permissions.create( + "ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd", + project_ids: ["string"] + ) + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + } + ], + "first_id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "has_more": false + } + /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}: + delete: + operationId: deleteFineTuningCheckpointPermission + tags: + - Fine-tuning + summary: | + **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + + Organization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint. + parameters: + - in: path + name: fine_tuned_model_checkpoint + required: true + schema: + type: string + example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd + description: | + The ID of the fine-tuned model checkpoint to delete a permission for. + - in: path + name: permission_id + required: true + schema: + type: string + example: cp_zc4Q7MP6XxulcVzj4MZdwsAB + description: | + The ID of the fine-tuned model checkpoint permission to delete. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteFineTuningCheckpointPermissionResponse' + x-oaiMeta: + name: Delete checkpoint permission + 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/cp_zc4Q7MP6XxulcVzj4MZdwsAB \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const permission = await client.fineTuning.checkpoints.permissions.delete( + 'cp_zc4Q7MP6XxulcVzj4MZdwsAB', + { fine_tuned_model_checkpoint: 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd' }, + ); + + console.log(permission.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + permission = client.fine_tuning.checkpoints.permissions.delete( + permission_id="cp_zc4Q7MP6XxulcVzj4MZdwsAB", + fine_tuned_model_checkpoint="ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd", + ) + print(permission.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpermission, err := client.FineTuning.Checkpoints.Permissions.Delete(\n\t\tcontext.TODO(),\n\t\t\"ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd\",\n\t\t\"cp_zc4Q7MP6XxulcVzj4MZdwsAB\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", permission.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.checkpoints.permissions.PermissionDeleteParams; + import com.openai.models.finetuning.checkpoints.permissions.PermissionDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + PermissionDeleteParams params = PermissionDeleteParams.builder() + .fineTunedModelCheckpoint("ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd") + .permissionId("cp_zc4Q7MP6XxulcVzj4MZdwsAB") + .build(); + PermissionDeleteResponse permission = client.fineTuning().checkpoints().permissions().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + permission = openai.fine_tuning.checkpoints.permissions.delete( + "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + fine_tuned_model_checkpoint: "ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd" + ) + + puts(permission) + response: | + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "deleted": true + } + /fine_tuning/jobs: + post: + operationId: createFineTuningJob + tags: + - Fine-tuning + summary: | + Creates a fine-tuning job which begins the process of creating a new model from a given dataset. + + Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. + + [Learn more about fine-tuning](/docs/guides/model-optimization) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateFineTuningJobRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Create fine-tuning job + group: fine-tuning + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-BK7bzQj3FfZFXr7DbL6xJwfo", + "model": "gpt-4o-mini" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123" + }); + + console.log(fineTune); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + } + } + }, + "metadata": null + } + - title: Epochs + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "model": "gpt-4o-mini", + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 2 + } + } + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + import { SupervisedMethod, SupervisedHyperparameters } from "openai/resources/fine-tuning/methods"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123", + model: "gpt-4o-mini", + method: { + type: "supervised", + supervised: { + hyperparameters: { + n_epochs: 2 + } + } + } + }); + + console.log(fineTune); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": 2 + }, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": 2 + } + } + }, + "metadata": null, + "error": { + "code": null, + "message": null, + "param": null + }, + "finished_at": null, + "seed": 683058546, + "trained_tokens": null, + "estimated_finish": null, + "integrations": [], + "user_provided_suffix": null, + "usage_metrics": null, + "shared_with_openai": false + } + - title: DPO + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini", + "method": { + "type": "dpo", + "dpo": { + "hyperparameters": { + "beta": 0.1 + } + } + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc", + "model": "gpt-4o-mini", + "created_at": 1746130590, + "fine_tuned_model": null, + "organization_id": "org-abc", + "result_files": [], + "status": "queued", + "validation_file": "file-123", + "training_file": "file-abc", + "method": { + "type": "dpo", + "dpo": { + "hyperparameters": { + "beta": 0.1, + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto" + } + } + }, + "metadata": null, + "error": { + "code": null, + "message": null, + "param": null + }, + "finished_at": null, + "hyperparameters": null, + "seed": 1036326793, + "estimated_finish": null, + "integrations": [], + "user_provided_suffix": null, + "usage_metrics": null, + "shared_with_openai": false + } + - title: Reinforcement + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc", + "validation_file": "file-123", + "model": "o4-mini", + "method": { + "type": "reinforcement", + "reinforcement": { + "grader": { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + }, + "hyperparameters": { + "reasoning_effort": "medium" + } + } + } + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "o4-mini", + "created_at": 1721764800, + "finished_at": null, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "validating_files", + "validation_file": "file-123", + "training_file": "file-abc", + "trained_tokens": null, + "error": {}, + "user_provided_suffix": null, + "seed": 950189191, + "estimated_finish": null, + "integrations": [], + "method": { + "type": "reinforcement", + "reinforcement": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + "eval_interval": "auto", + "eval_samples": "auto", + "compute_multiplier": "auto", + "reasoning_effort": "medium" + }, + "grader": { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + }, + "response_format": null + } + }, + "metadata": null, + "usage_metrics": null, + "shared_with_openai": false + } + + - title: Validation file + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123", + validation_file: "file-abc123" + }); + + console.log(fineTune); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123", + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + } + } + }, + "metadata": null + } + - title: W&B Integration + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini", + "integrations": [ + { + "type": "wandb", + "wandb": { + "project": "my-wandb-project", + "name": "ft-run-display-name" + "tags": [ + "first-experiment", "v2" + ] + } + } + ] + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.create({ + model: 'gpt-4o-mini', + training_file: 'file-abc123', + }); + + console.log(fineTuningJob.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.create( + model="gpt-4o-mini", + training_file="file-abc123", + ) + print(fine_tuning_job.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{\n\t\tModel: openai.FineTuningJobNewParamsModelGPT4oMini,\n\t\tTrainingFile: \"file-abc123\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobCreateParams params = JobCreateParams.builder() + .model(JobCreateParams.Model.GPT_4O_MINI) + .trainingFile("file-abc123") + .build(); + FineTuningJob fineTuningJob = client.fineTuning().jobs().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.create(model: :"gpt-4o-mini", training_file: "file-abc123") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123", + "integrations": [ + { + "type": "wandb", + "wandb": { + "project": "my-wandb-project", + "entity": None, + "run_id": "ftjob-abc123" + } + } + ], + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": "auto", + "n_epochs": "auto", + } + } + }, + "metadata": null + } + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + get: + operationId: listPaginatedFineTuningJobs + tags: + - Fine-tuning + summary: | + List your organization's fine-tuning jobs + parameters: + - name: after + in: query + description: Identifier for the last job from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: |- + Number of fine-tuning jobs to retrieve. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - in: query + name: metadata + required: false + schema: + type: object + nullable: true + 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. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListPaginatedFineTuningJobsResponse' + 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 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.jobs.list() + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.fineTuning.jobs.list(); + + for await (const fineTune of list) { + console.log(fineTune); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fineTuningJob of client.fineTuning.jobs.list()) { + console.log(fineTuningJob.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Jobs.List(context.TODO(), openai.FineTuningJobListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.JobListPage; + import com.openai.models.finetuning.jobs.JobListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobListPage page = client.fineTuning().jobs().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.fine_tuning.jobs.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "metadata": { + "key": "value" + } + }, + { ... }, + { ... } + ], "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}: + get: + operationId: retrieveFineTuningJob + tags: + - Fine-tuning + summary: | + Get info about a fine-tuning job. + + [Learn more about fine-tuning](/docs/guides/model-optimization) + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Retrieve fine-tuning job + group: fine-tuning + examples: + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.retrieve( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.retrieve("ftjob-abc123"); + + console.log(fineTune); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.retrieve('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Get(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "davinci-002", + "created_at": 1692661014, + "finished_at": 1692661190, + "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + "organization_id": "org-123", + "result_files": [ + "file-abc123" + ], + "status": "succeeded", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + }, + "trained_tokens": 5768, + "integrations": [], + "seed": 0, + "estimated_finish": 0, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + } + } + } + } + /fine_tuning/jobs/{fine_tuning_job_id}/cancel: + post: + operationId: cancelFineTuningJob + tags: + - Fine-tuning + summary: | + Immediately cancel a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to cancel. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Cancel fine-tuning + group: fine-tuning + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.cancel( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.cancel("ftjob-abc123"); + + console.log(fineTune); + } + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.cancel('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Cancel(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().cancel("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.cancel("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "cancelled", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } + /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints: + get: + operationId: listFineTuningJobCheckpoints + tags: + - Fine-tuning + summary: | + List checkpoints for a fine-tuning job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to get checkpoints for. + - name: after + in: query + description: Identifier for the last checkpoint ID from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: |- + Number of checkpoints to retrieve. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 10 + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFineTuningJobCheckpointsResponse' + x-oaiMeta: + name: List fine-tuning checkpoints + group: fine-tuning + examples: + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/checkpoints \ + -H "Authorization: Bearer $OPENAI_API_KEY" + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fineTuningJobCheckpoint of client.fineTuning.jobs.checkpoints.list( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + )) { + console.log(fineTuningJobCheckpoint.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.jobs.checkpoints.list( + fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Jobs.Checkpoints.List(\n\t\tcontext.TODO(),\n\t\t\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n\t\topenai.FineTuningJobCheckpointListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.checkpoints.CheckpointListPage; + import com.openai.models.finetuning.jobs.checkpoints.CheckpointListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + CheckpointListPage page = client.fineTuning().jobs().checkpoints().list("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.fine_tuning.jobs.checkpoints.list("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:96olL566:ckpt-step-2000", + "metrics": { + "full_valid_loss": 0.134, + "full_valid_mean_token_accuracy": 0.874 + }, + "fine_tuning_job_id": "ftjob-abc123", + "step_number": 2000 + }, + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_enQCFmOTGj3syEpYVhBRLTSy", + "created_at": 1721764800, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:7q8mpxmy:ckpt-step-1000", + "metrics": { + "full_valid_loss": 0.167, + "full_valid_mean_token_accuracy": 0.781 + }, + "fine_tuning_job_id": "ftjob-abc123", + "step_number": 1000 + } + ], + "first_id": "ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "ftckpt_enQCFmOTGj3syEpYVhBRLTSy", + "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}/events: + get: + operationId: listFineTuningEvents + tags: + - Fine-tuning + summary: | + Get status updates for a fine-tuning job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to get events for. + - name: after + in: query + description: Identifier for the last event from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: |- + Number of events to retrieve. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListFineTuningJobEventsResponse' + x-oaiMeta: + name: List fine-tuning events + group: fine-tuning + examples: + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/events \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.fine_tuning.jobs.list_events( + fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.fineTuning.list_events(id="ftjob-abc123", limit=2); + + for await (const fineTune of list) { + console.log(fineTune); + } + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fineTuningJobEvent of client.fineTuning.jobs.listEvents( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + )) { + console.log(fineTuningJobEvent.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.FineTuning.Jobs.ListEvents(\n\t\tcontext.TODO(),\n\t\t\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n\t\topenai.FineTuningJobListEventsParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.JobListEventsPage; + import com.openai.models.finetuning.jobs.JobListEventsParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + JobListEventsPage page = client.fineTuning().jobs().listEvents("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.fine_tuning.jobs.list_events("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job.event", + "id": "ft-event-ddTJfwuMVpfLXseO0Am0Gqjm", + "created_at": 1721764800, + "level": "info", + "message": "Fine tuning job successfully completed", + "data": null, + "type": "message" + }, + { + "object": "fine_tuning.job.event", + "id": "ft-event-tyiGuB72evQncpH87xe505Sv", + "created_at": 1721764800, + "level": "info", + "message": "New fine-tuned model created: ft:gpt-4o-mini:openai::7p4lURel", + "data": null, + "type": "message" + } + ], + "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}/pause: + post: + operationId: pauseFineTuningJob + tags: + - Fine-tuning + summary: | + Pause a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to pause. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Pause fine-tuning + group: fine-tuning + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/pause \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.pause( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.pause("ftjob-abc123"); + + console.log(fineTune); + } + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.pause('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Pause(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobPauseParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().pause("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.pause("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "paused", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } + /fine_tuning/jobs/{fine_tuning_job_id}/resume: + post: + operationId: resumeFineTuningJob + tags: + - Fine-tuning + summary: | + Resume a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to resume. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FineTuningJob' + x-oaiMeta: + name: Resume fine-tuning + group: fine-tuning + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/resume \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + fine_tuning_job = client.fine_tuning.jobs.resume( + "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + ) + print(fine_tuning_job.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.resume("ftjob-abc123"); + + console.log(fineTune); + } + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const fineTuningJob = await client.fineTuning.jobs.resume('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + + console.log(fineTuningJob.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.FineTuning.Jobs.Resume(context.TODO(), \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.finetuning.jobs.FineTuningJob; + import com.openai.models.finetuning.jobs.JobResumeParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FineTuningJob fineTuningJob = client.fineTuning().jobs().resume("ft-AF1WoRqd3aJAHsqc9NY7iL8F"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + fine_tuning_job = openai.fine_tuning.jobs.resume("ft-AF1WoRqd3aJAHsqc9NY7iL8F") + + puts(fine_tuning_job) + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } +components: + schemas: + ListFineTuningCheckpointPermissionResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/FineTuningCheckpointPermission' + object: + type: string + enum: + - list + x-stainless-const: true + first_id: + type: string + last_id: + type: string + has_more: + type: boolean + required: + - object + - data + - has_more + CreateFineTuningCheckpointPermissionRequest: + type: object + additionalProperties: false + properties: + project_ids: + type: array + description: The project identifiers to grant access to. + items: + type: string + required: + - project_ids + 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 + CreateFineTuningJobRequest: + type: object + properties: + model: + description: | + The name of the model to fine-tune. You can select one of the + [supported models](/docs/guides/fine-tuning#which-models-can-be-fine-tuned). + example: gpt-4o-mini + x-oaiTypeLabel: string + type: string + enum: + - babbage-002 + - davinci-002 + - gpt-3.5-turbo + - gpt-4o-mini + training_file: + description: | + The ID of an uploaded file that contains training data. + + See [upload file](/docs/api-reference/files/create) for how to upload a file. + + Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`. + + The contents of the file should differ depending on if the model uses the [chat](/docs/api-reference/fine-tuning/chat-input), [completions](/docs/api-reference/fine-tuning/completions-input) format, or if the fine-tuning method uses the [preference](/docs/api-reference/fine-tuning/preference-input) format. + + See the [fine-tuning guide](/docs/guides/model-optimization) for more details. + type: string + example: file-abc123 + hyperparameters: + type: object + description: | + The hyperparameters used for the fine-tuning job. + This value is now deprecated in favor of `method`, and should be passed in under the `method` parameter. + 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. + 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. + 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 + through the training dataset. + 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. + + For example, a `suffix` of "custom-model-name" would produce a model name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. + type: string + minLength: 1 + maxLength: 64 + default: null + nullable: true + validation_file: + description: | + The ID of an uploaded file that contains validation data. + + If you provide this file, the data is used to generate validation + metrics periodically during fine-tuning. These metrics can be viewed in + the fine-tuning results file. + The same data should not be present in both train and validation files. + + Your dataset must be formatted as a JSONL file. You must upload your file with the purpose `fine-tune`. + + See the [fine-tuning guide](/docs/guides/model-optimization) for more details. + 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. + 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 + metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags + to your run, and set a default entity (team, username, etc) to be associated with your run. + required: + - project + properties: + project: + description: | + The name of the project that the new run will be created under. + 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. + 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 + like associated with the run. If not set, the default entity for the registered WandB API key is used. + 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 + default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}". + 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. + If a seed is not specified, one will be generated for you. + type: integer + nullable: true + minimum: 0 + maximum: 2147483647 + example: 42 + method: + $ref: '#/components/schemas/FineTuneMethod' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - model + - training_file + FineTuningJob: + type: object + title: FineTuningJob + description: | + The `fine_tuning.job` object represents a fine-tuning job that has been created through the API. + 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: + 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 + fine_tuned_model: + 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. + finished_at: + 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. + 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 + are updated less frequently, but with lower variance. + 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 + overfitting. + 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 + through the training dataset. + 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](/docs/api-reference/files/retrieve-contents). + items: + type: string + example: file-abc123 + status: + type: string + description: The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. + enum: + - validating_files + - queued + - running + - succeeded + - failed + - cancelled + trained_tokens: + 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. + training_file: + type: string + description: The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents). + validation_file: + type: string + description: The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents). + integrations: + type: array + description: A list of integrations to enable for this fine-tuning job. + maxItems: 5 + items: + oneOf: + - $ref: '#/components/schemas/FineTuningIntegration' + seed: + type: integer + description: The seed used for the fine-tuning job. + estimated_finish: + 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. + method: + $ref: '#/components/schemas/FineTuneMethod' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - created_at + - error + - finished_at + - fine_tuned_model + - hyperparameters + - id + - model + - object + - organization_id + - result_files + - status + - trained_tokens + - training_file + - validation_file + - seed + x-oaiMeta: + name: The fine-tuning job object + example: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "davinci-002", + "created_at": 1692661014, + "finished_at": 1692661190, + "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + "organization_id": "org-123", + "result_files": [ + "file-abc123" + ], + "status": "succeeded", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + }, + "trained_tokens": 5768, + "integrations": [], + "seed": 0, + "estimated_finish": 0, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + } + } + }, + "metadata": { + "key": "value" + } + } + 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 + ListFineTuningJobCheckpointsResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/FineTuningJobCheckpoint' + object: + type: string + enum: + - list + x-stainless-const: true + first_id: + type: string + last_id: + type: string + 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 + FineTuningCheckpointPermission: + type: object + title: FineTuningCheckpointPermission + description: | + The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint. + 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: | + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1712211699, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + } + 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 + Metadata: + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + 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 + metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags + to your run, and set a default entity (team, username, etc) to be associated with your run. + required: + - project + properties: + project: + description: | + The name of the project that the new run will be created under. + 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. + 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 + like associated with the run. If not set, the default entity for the registered WandB API key is used. + 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 + default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}". + type: array + items: + type: string + example: custom-tag + 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. + 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: | + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P", + "created_at": 1712211699, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88", + "fine_tuning_job_id": "ftjob-fpbNQ3H1GrMehXRf8cO97xTN", + "metrics": { + "step": 88, + "train_loss": 0.478, + "train_mean_token_accuracy": 0.924, + "valid_loss": 10.112, + "valid_mean_token_accuracy": 0.145, + "full_valid_loss": 0.567, + "full_valid_mean_token_accuracy": 0.944 + }, + "step_number": 88 + } + 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: string + description: The data associated with the event. (opaque JSON object) + required: + - id + - object + - created_at + - level + - message + x-oaiMeta: + name: The fine-tuning job event object + example: | + { + "object": "fine_tuning.job.event", + "id": "ftevent-abc123" + "created_at": 1677610602, + "level": "info", + "message": "Created fine-tuning job", + "data": {}, + "type": "message" + } + FineTuneSupervisedMethod: + type: object + description: Configuration for the supervised fine-tuning method. + properties: + hyperparameters: + $ref: '#/components/schemas/FineTuneSupervisedHyperparameters' + FineTuneDPOMethod: + type: object + description: Configuration for the DPO fine-tuning method. + properties: + hyperparameters: + $ref: '#/components/schemas/FineTuneDPOHyperparameters' + FineTuneReinforcementMethod: + type: object + description: Configuration for the reinforcement fine-tuning method. + properties: + grader: + type: object + description: The grader used for the fine-tuning job. + title: StringCheckGrader + 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`. + 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`, + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, + or `rouge_l`. + 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. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: | + An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: | + The maximum number of tokens the grader model may generate in its response. + - type: 'null' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + range: + type: array + items: + type: number + min_items: 2 + max_items: 2 + description: The range of the score. Defaults to `[0, 1]`. + graders: + type: object + title: StringCheckGrader + description: | + A StringCheckGrader object that performs a string comparison between input and reference using a specified operation. + 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`. + 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`, + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, + or `rouge_l`. + 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. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: | + An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: | + The maximum number of tokens the grader model may generate in its response. + - type: 'null' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + range: + type: array + items: + type: number + min_items: 2 + max_items: 2 + description: The range of the score. Defaults to `[0, 1]`. + 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 + - name + - input + - reference + - operation + - evaluation_metric + - source + - model + - passing_labels + - labels + x-oaiMeta: + name: String Check Grader + group: graders + example: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + calculate_output: + type: string + description: A formula to calculate the output based on grader results. + required: + - type + - name + - input + - reference + - operation + - evaluation_metric + - source + - model + - graders + - calculate_output + x-oaiMeta: + name: String Check Grader + group: graders + example: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + 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. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + maximum: 256 + learning_rate_multiplier: + description: | + Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 0 + exclusiveMinimum: true + n_epochs: + description: | + The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + maximum: 50 + 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. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 0 + maximum: 2 + exclusiveMinimum: true + 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. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + maximum: 256 + learning_rate_multiplier: + description: | + Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 0 + exclusiveMinimum: true + n_epochs: + description: | + The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + maximum: 50 + GraderStringCheck: + type: object + title: StringCheckGrader + description: | + A StringCheckGrader object that performs a string comparison between input and reference using a specified operation. + 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: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + GraderTextSimilarity: + type: object + title: TextSimilarityGrader + description: | + A TextSimilarityGrader object which grades text based on similarity metrics. + 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`, + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, + or `rouge_l`. + required: + - type + - name + - input + - reference + - evaluation_metric + x-oaiMeta: + name: Text Similarity Grader + group: graders + example: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "evaluation_metric": "fuzzy_match" + } + GraderPython: + type: object + title: PythonGrader + description: | + A PythonGrader object that runs a python script on the input. + 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: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + } + GraderScoreModel: + type: object + title: ScoreModelGrader + description: | + A ScoreModelGrader object that uses a model to assign a score to the input. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: | + An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: | + The maximum number of tokens the grader model may generate in its response. + - 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. + 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: | + { + "type": "score_model", + "name": "Example score model grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "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}}" + ) + }, + { + "type": "input_image", + "image_url": "https://example.com/reference.png", + "file_id": null, + "detail": "auto" + } + ], + } + ], + "model": "gpt-5-mini", + "sampling_params": { + "temperature": 1, + "top_p": 1, + "seed": 42, + "max_completions_tokens": 32768, + "reasoning_effort": "medium" + }, + } + 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 + title: StringCheckGrader + description: | + A StringCheckGrader object that performs a string comparison between input and reference using a specified operation. + 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`. + 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`, + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, + or `rouge_l`. + 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. + 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. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: | + An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: | + The maximum number of tokens the grader model may generate in its response. + - type: 'null' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + range: + type: array + items: + type: number + min_items: 2 + max_items: 2 + description: The range of the score. Defaults to `[0, 1]`. + 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 + - name + - input + - reference + - operation + - evaluation_metric + - source + - model + - passing_labels + - labels + x-oaiMeta: + name: String Check Grader + group: graders + example: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + 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: | + { + "type": "multi", + "name": "example multi grader", + "graders": [ + { + "type": "text_similarity", + "name": "example text similarity grader", + "input": "The graded text", + "reference": "The reference text", + "evaluation_metric": "fuzzy_match" + }, + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + ], + "calculate_output": "0.5 * text_similarity_score + 0.5 * string_check_score)" + } + 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. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + maximum: 256 + learning_rate_multiplier: + description: | + Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 0 + exclusiveMinimum: true + n_epochs: + description: | + The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + maximum: 50 + reasoning_effort: + description: | + Level of reasoning effort. + type: string + enum: + - default + - low + - medium + - high + default: default + compute_multiplier: + description: | + Multiplier on amount of compute used for exploring search space during training. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 0.00001 + maximum: 10 + exclusiveMinimum: true + eval_interval: + description: | + The number of training steps between evaluation runs. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + eval_samples: + description: | + Number of evaluation samples to generate per training step. + default: auto + type: string + enum: + - auto + x-stainless-const: true + minimum: 1 + ReasoningEffort: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + default: medium + description: | + Constrains effort on reasoning for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing + reasoning effort can result in faster responses and fewer tokens used + on reasoning in a response. + + - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. + - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. + - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. + - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + EvalItem: + type: object + title: Eval message object + description: | + A message input to the model with a role indicating instruction following + hierarchy. Instructions given with the `developer` or `system` role take + precedence over instructions given with the `user` role. Messages with the + `assistant` role are presumed to have been generated by the model in previous + interactions. + properties: + role: + type: string + description: | + The role of the message input. One of `user`, `assistant`, `system`, or + `developer`. + enum: + - user + - assistant + - system + - developer + content: + $ref: '#/components/schemas/EvalItemContent' + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true + required: + - role + - content + GraderLabelModel: + type: object + title: LabelModelGrader + description: | + A LabelModelGrader object which uses a model to assign labels to each item + in the evaluation. + 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: | + { + "name": "First label grader", + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.response}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + 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. + type: string + 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. + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: | + The format of the audio data. Currently supported formats are `mp3` and + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - text + - image_url + - input_audio + items: + $ref: '#/components/schemas/EvalItemContentItem' + EvalItemContentItem: + title: Eval content item + description: | + A single content item: input text, output text, input image, or input audio. + type: string + 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. + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: | + The format of the audio data. Currently supported formats are `mp3` and + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - text + - image_url + - input_audio + 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 + image, or input audio object. + items: + $ref: '#/components/schemas/EvalItemContentItem' + EvalItemContentText: + type: string + title: Text input + description: | + A text input to the model. + 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. + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + EvalItemContentOutputText: + type: object + title: Output text + description: | + A text output from the model. + properties: + type: + type: string + description: | + The type of the output text. Always `output_text`. + enum: + - output_text + x-stainless-const: true + text: + type: string + description: | + The text output from the model. + required: + - type + - text + 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`. + enum: + - input_image + x-stainless-const: true + image_url: + type: string + format: uri + description: | + The URL of the image input. + 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`. + required: + - type + - image_url + InputAudio: + type: object + title: Input audio + description: | + An audio input to the model. + properties: + type: + type: string + description: | + The type of the input item. Always `input_audio`. + enum: + - input_audio + x-stainless-const: true + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: | + The format of the audio data. Currently supported formats are `mp3` and + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - input_audio +servers: + - url: https://api.openai.com/v1 diff --git a/provider-dev/source/models.yaml b/provider-dev/source/models.yaml new file mode 100644 index 0000000..3400e9c --- /dev/null +++ b/provider-dev/source/models.yaml @@ -0,0 +1,440 @@ +openapi: 3.1.0 +info: + title: models API + description: openai API + version: 2.3.0 +paths: + /models: + get: + operationId: listModels + tags: + - Models + summary: Lists the currently available models, and provides basic information about each one such as the owner and availability. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListModelsResponse' + x-oaiMeta: + name: List models + group: models + examples: + request: + curl: | + curl https://api.openai.com/v1/models \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.models.list() + page = page.data[0] + print(page.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.models.list(); + + for await (const model of list) { + console.log(model); + } + } + main(); + csharp: | + using System; + + using OpenAI.Models; + + OpenAIModelClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + foreach (var model in client.GetModels().Value) + { + Console.WriteLine(model.Id); + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const model of client.models.list()) { + console.log(model.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Models.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.models.ModelListPage; + import com.openai.models.models.ModelListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ModelListPage page = client.models().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.models.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "model-id-0", + "object": "model", + "created": 1686935002, + "owned_by": "organization-owner" + }, + { + "id": "model-id-1", + "object": "model", + "created": 1686935002, + "owned_by": "organization-owner", + }, + { + "id": "model-id-2", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + }, + ] + } + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + /models/{model}: + get: + operationId: retrieveModel + tags: + - Models + summary: Retrieves a model instance, providing basic information about the model such as the owner and permissioning. + parameters: + - in: path + name: model + required: true + schema: + type: string + example: gpt-4o-mini + description: The ID of the model to use for this request + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Model' + x-oaiMeta: + name: Retrieve model + group: models + examples: + request: + curl: | + curl https://api.openai.com/v1/models/VAR_chat_model_id \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + model = client.models.retrieve( + "gpt-4o-mini", + ) + print(model.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const model = await openai.models.retrieve("VAR_chat_model_id"); + + console.log(model); + } + + main(); + csharp: | + using System; + using System.ClientModel; + + using OpenAI.Models; + + OpenAIModelClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ClientResult model = client.GetModel("babbage-002"); + Console.WriteLine(model.Value.Id); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const model = await client.models.retrieve('gpt-4o-mini'); + + console.log(model.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmodel, err := client.Models.Get(context.TODO(), \"gpt-4o-mini\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", model.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.models.Model; + import com.openai.models.models.ModelRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Model model = client.models().retrieve("gpt-4o-mini"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + model = openai.models.retrieve("gpt-4o-mini") + + puts(model) + response: | + { + "id": "VAR_chat_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + } + delete: + operationId: deleteModel + tags: + - Models + summary: Delete a fine-tuned model. You must have the Owner role in your organization to delete a model. + parameters: + - in: path + name: model + required: true + schema: + type: string + example: ft:gpt-4o-mini:acemeco:suffix:abc123 + description: The model to delete + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteModelResponse' + 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 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + model_deleted = client.models.delete( + "ft:gpt-4o-mini:acemeco:suffix:abc123", + ) + print(model_deleted.id) + javascript: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const model = await openai.models.delete("ft:gpt-4o-mini:acemeco:suffix:abc123"); + + console.log(model); + } + main(); + csharp: | + using System; + using System.ClientModel; + + using OpenAI.Models; + + OpenAIModelClient client = new( + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + ClientResult success = client.DeleteModel("ft:gpt-4o-mini:acemeco:suffix:abc123"); + Console.WriteLine(success); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const modelDeleted = await client.models.delete('ft:gpt-4o-mini:acemeco:suffix:abc123'); + + console.log(modelDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmodelDeleted, err := client.Models.Delete(context.TODO(), \"ft:gpt-4o-mini:acemeco:suffix:abc123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", modelDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.models.ModelDeleteParams; + import com.openai.models.models.ModelDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ModelDeleted modelDeleted = client.models().delete("ft:gpt-4o-mini:acemeco:suffix:abc123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + model_deleted = openai.models.delete("ft:gpt-4o-mini:acemeco:suffix:abc123") + + puts(model_deleted) + response: | + { + "id": "ft:gpt-4o-mini:acemeco:suffix:abc123", + "object": "model", + "deleted": true + } +components: + schemas: + ListModelsResponse: + type: object + properties: + object: + type: string + enum: + - list + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/Model' + required: + - object + - data + 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. + required: + - id + - object + - created + - owned_by + x-oaiMeta: + name: The model object + example: | + { + "id": "VAR_chat_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + } + type: object + DeleteModelResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + required: + - id + - object + - deleted +servers: + - url: https://api.openai.com/v1 diff --git a/provider-dev/source/skills.yaml b/provider-dev/source/skills.yaml new file mode 100644 index 0000000..eb89ac9 --- /dev/null +++ b/provider-dev/source/skills.yaml @@ -0,0 +1,1052 @@ +openapi: 3.1.0 +info: + title: skills API + description: openai API + version: 2.3.0 +paths: + /skills: + post: + tags: + - Skills + summary: Create a new skill. + operationId: CreateSkill + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + 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/SkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.skills.create(); + + console.log(skill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill = client.skills.create() + print(skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskill, err := client.Skills.New(context.TODO(), openai.SkillNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.Skill; + import com.openai.models.skills.SkillCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Skill skill = client.skills().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill = openai.skills.create + + puts(skill) + get: + tags: + - Skills + summary: List all skills for the current project. + operationId: ListSkills + parameters: + - name: limit + in: query + description: |- + Number of items to retrieve + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + 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/OrderEnum' + - 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 + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillListResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const skill of client.skills.list()) { + console.log(skill.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.skills.list() + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Skills.List(context.TODO(), openai.SkillListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.SkillListPage; + import com.openai.models.skills.SkillListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SkillListPage page = client.skills().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.skills.list + + puts(page) + /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 + schema: + example: skill_123 + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedSkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const deletedSkill = await client.skills.delete('skill_123'); + + console.log(deletedSkill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + deleted_skill = client.skills.delete( + "skill_123", + ) + print(deleted_skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tdeletedSkill, err := client.Skills.Delete(context.TODO(), \"skill_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", deletedSkill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.DeletedSkill; + import com.openai.models.skills.SkillDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + DeletedSkill deletedSkill = client.skills().delete("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + deleted_skill = openai.skills.delete("skill_123") + + puts(deleted_skill) + 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 + schema: + example: skill_123 + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.skills.retrieve('skill_123'); + + console.log(skill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill = client.skills.retrieve( + "skill_123", + ) + print(skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskill, err := client.Skills.Get(context.TODO(), \"skill_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.Skill; + import com.openai.models.skills.SkillRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Skill skill = client.skills().retrieve("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill = openai.skills.retrieve("skill_123") + + puts(skill) + 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 + schema: + example: skill_123 + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SetDefaultSkillVersionBody' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/SetDefaultSkillVersionBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.skills.update('skill_123', { default_version: 'default_version' }); + + console.log(skill.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill = client.skills.update( + skill_id="skill_123", + default_version="default_version", + ) + print(skill.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskill, err := client.Skills.Update(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\topenai.SkillUpdateParams{\n\t\t\tDefaultVersion: \"default_version\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skill.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.Skill; + import com.openai.models.skills.SkillUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SkillUpdateParams params = SkillUpdateParams.builder() + .skillId("skill_123") + .defaultVersion("default_version") + .build(); + Skill skill = client.skills().update(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill = openai.skills.update("skill_123", default_version: "default_version") + + puts(skill) + /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 + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/CreateSkillVersionBody' + application/json: + schema: + $ref: '#/components/schemas/CreateSkillVersionBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillVersionResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skillVersion = await client.skills.versions.create('skill_123'); + + console.log(skillVersion.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill_version = client.skills.versions.create( + skill_id="skill_123", + ) + print(skill_version.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskillVersion, err := client.Skills.Versions.New(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\topenai.SkillVersionNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skillVersion.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.SkillVersion; + import com.openai.models.skills.versions.VersionCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SkillVersion skillVersion = client.skills().versions().create("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill_version = openai.skills.versions.create("skill_123") + + puts(skill_version) + get: + tags: + - Skills + summary: 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 + - name: limit + in: query + description: |- + Number of versions to retrieve. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + minimum: 0 + maximum: 100 + - 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 + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillVersionListResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const skillVersion of client.skills.versions.list('skill_123')) { + console.log(skillVersion.id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.skills.versions.list( + skill_id="skill_123", + ) + page = page.data[0] + print(page.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Skills.Versions.List(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\topenai.SkillVersionListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.VersionListPage; + import com.openai.models.skills.versions.VersionListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VersionListPage page = client.skills().versions().list("skill_123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.skills.versions.list("skill_123") + + puts(page) + /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 + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SkillVersionResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const skillVersion = await client.skills.versions.retrieve('version', { skill_id: 'skill_123' }); + + console.log(skillVersion.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + skill_version = client.skills.versions.retrieve( + version="version", + skill_id="skill_123", + ) + print(skill_version.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tskillVersion, err := client.Skills.Versions.Get(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\t\"version\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", skillVersion.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.SkillVersion; + import com.openai.models.skills.versions.VersionRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VersionRetrieveParams params = VersionRetrieveParams.builder() + .skillId("skill_123") + .version("version") + .build(); + SkillVersion skillVersion = client.skills().versions().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + skill_version = openai.skills.versions.retrieve("version", skill_id: "skill_123") + + puts(skill_version) + 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 + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedSkillVersionResource' + x-oaiMeta: + examples: + response: '' + request: + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const deletedSkillVersion = await client.skills.versions.delete('version', { + skill_id: 'skill_123', + }); + + console.log(deletedSkillVersion.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + deleted_skill_version = client.skills.versions.delete( + version="version", + skill_id="skill_123", + ) + print(deleted_skill_version.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tdeletedSkillVersion, err := client.Skills.Versions.Delete(\n\t\tcontext.TODO(),\n\t\t\"skill_123\",\n\t\t\"version\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", deletedSkillVersion.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.skills.versions.DeletedSkillVersion; + import com.openai.models.skills.versions.VersionDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VersionDeleteParams params = VersionDeleteParams.builder() + .skillId("skill_123") + .version("version") + .build(); + DeletedSkillVersion deletedSkillVersion = client.skills().versions().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + deleted_skill_version = openai.skills.versions.delete("version", skill_id: "skill_123") + + puts(deleted_skill_version) +components: + schemas: + CreateSkillBody: + properties: {} + type: object + required: [] + title: Create skill request + description: Uploads a skill either as a directory (multipart `files[]`) or as a single zip file. + 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 + OrderEnum: + type: string + enum: + - asc + - desc + 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: + type: string + description: The ID of the first item in the list. + last_id: + type: string + description: The ID of the last item in the list. + has_more: + type: boolean + description: Whether there are more items available. + type: object + required: + - object + - data + - first_id + - last_id + - has_more + 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 + 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. + CreateSkillVersionBody: + properties: + default: + type: boolean + description: Whether to set this version as the default. + type: object + required: [] + title: Create skill version request + description: Uploads a new immutable version of a skill. + 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: + type: string + description: The ID of the first item in the list. + last_id: + type: string + description: The ID of the last item in the list. + has_more: + type: boolean + description: Whether there are more items available. + type: object + required: + - object + - data + - first_id + - last_id + - has_more + 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 +servers: + - url: https://api.openai.com/v1 diff --git a/provider-dev/source/uploads.yaml b/provider-dev/source/uploads.yaml new file mode 100644 index 0000000..eaf7b49 --- /dev/null +++ b/provider-dev/source/uploads.yaml @@ -0,0 +1,673 @@ +openapi: 3.1.0 +info: + title: uploads API + description: openai API + version: 2.3.0 +paths: + /uploads: + post: + operationId: createUpload + tags: + - Uploads + summary: | + Creates an intermediate [Upload](/docs/api-reference/uploads/object) object + that you can add [Parts](/docs/api-reference/uploads/part-object) to. + Currently, an Upload can accept at most 8 GB in total and expires after an + hour after you create it. + + Once you complete the Upload, we will create a + [File](/docs/api-reference/files/object) object that contains all the parts + you uploaded. This File is usable in the rest of our platform as a regular + File object. + + For certain `purpose` values, the correct `mime_type` must be specified. + Please refer to documentation for the + [supported MIME types for your use case](/docs/assistants/tools/file-search#supported-files). + + For guidance on the proper filename extensions for each purpose, please + follow the documentation on [creating a + File](/docs/api-reference/files/create). + + Returns the Upload object with status `pending`. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUploadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Upload' + x-oaiMeta: + name: Create upload + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "purpose": "fine-tune", + "filename": "training_examples.jsonl", + "bytes": 2147483648, + "mime_type": "text/jsonl", + "expires_after": { + "anchor": "created_at", + "seconds": 3600 + } + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const upload = await client.uploads.create({ + bytes: 0, + filename: 'filename', + mime_type: 'mime_type', + purpose: 'assistants', + }); + + console.log(upload.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload = client.uploads.create( + bytes=0, + filename="filename", + mime_type="mime_type", + purpose="assistants", + ) + print(upload.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tupload, err := client.Uploads.New(context.TODO(), openai.UploadNewParams{\n\t\tBytes: 0,\n\t\tFilename: \"filename\",\n\t\tMimeType: \"mime_type\",\n\t\tPurpose: openai.FilePurposeAssistants,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", upload.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.files.FilePurpose; + import com.openai.models.uploads.Upload; + import com.openai.models.uploads.UploadCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UploadCreateParams params = UploadCreateParams.builder() + .bytes(0L) + .filename("filename") + .mimeType("mime_type") + .purpose(FilePurpose.ASSISTANTS) + .build(); + Upload upload = client.uploads().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + upload = openai.uploads.create(bytes: 0, filename: "filename", mime_type: "mime_type", purpose: :assistants) + + puts(upload) + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "pending", + "expires_at": 1719127296 + } + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + /uploads/{upload_id}/cancel: + post: + operationId: cancelUpload + tags: + - Uploads + summary: | + Cancels the Upload. No Parts may be added after an Upload is cancelled. + + Returns the Upload object with status `cancelled`. + parameters: + - in: path + name: upload_id + required: true + schema: + type: string + example: upload_abc123 + description: | + The ID of the Upload. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Upload' + x-oaiMeta: + name: Cancel upload + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads/upload_abc123/cancel + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const upload = await client.uploads.cancel('upload_abc123'); + + console.log(upload.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload = client.uploads.cancel( + "upload_abc123", + ) + print(upload.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tupload, err := client.Uploads.Cancel(context.TODO(), \"upload_abc123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", upload.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.uploads.Upload; + import com.openai.models.uploads.UploadCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + Upload upload = client.uploads().cancel("upload_abc123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + upload = openai.uploads.cancel("upload_abc123") + + puts(upload) + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "cancelled", + "expires_at": 1719127296 + } + /uploads/{upload_id}/complete: + post: + operationId: completeUpload + tags: + - Uploads + summary: | + Completes the [Upload](/docs/api-reference/uploads/object). + + Within the returned Upload object, there is a nested [File](/docs/api-reference/files/object) object that is ready to use in the rest of the platform. + + You can specify the order of the Parts by passing in an ordered list of the Part IDs. + + The 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. + Returns the Upload object with status `completed`, including an additional `file` property containing the created usable File object. + parameters: + - in: path + name: upload_id + required: true + schema: + type: string + example: upload_abc123 + description: | + The ID of the Upload. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CompleteUploadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Upload' + x-oaiMeta: + name: Complete upload + group: uploads + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads/upload_abc123/complete + -d '{ + "part_ids": ["part_def456", "part_ghi789"] + }' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const upload = await client.uploads.complete('upload_abc123', { part_ids: ['string'] }); + + console.log(upload.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + upload = client.uploads.complete( + upload_id="upload_abc123", + part_ids=["string"], + ) + print(upload.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tupload, err := client.Uploads.Complete(\n\t\tcontext.TODO(),\n\t\t\"upload_abc123\",\n\t\topenai.UploadCompleteParams{\n\t\t\tPartIDs: []string{\"string\"},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", upload.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.uploads.Upload; + import com.openai.models.uploads.UploadCompleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + UploadCompleteParams params = UploadCompleteParams.builder() + .uploadId("upload_abc123") + .addPartId("string") + .build(); + Upload upload = client.uploads().complete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + upload = openai.uploads.complete("upload_abc123", part_ids: ["string"]) + + puts(upload) + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "completed", + "expires_at": 1719127296, + "file": { + "id": "file-xyz321", + "object": "file", + "bytes": 2147483648, + "created_at": 1719186911, + "expires_at": 1719127296, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + } + } +components: + schemas: + CreateUploadRequest: + type: object + additionalProperties: false + properties: + filename: + description: | + The name of the file to upload. + type: string + purpose: + description: | + The intended purpose of the uploaded file. + + See the [documentation on File + purposes](/docs/api-reference/files/create#files-create-purpose). + type: string + enum: + - assistants + - batch + - fine-tune + - vision + bytes: + description: | + The number of bytes in the file you are uploading. + type: integer + mime_type: + description: | + The MIME type of the file. + + + This must fall within the supported MIME types for your file purpose. See + the supported MIME types for assistants and vision. + type: string + expires_after: + $ref: '#/components/schemas/FileExpirationAfter' + required: + - filename + - purpose + - bytes + - mime_type + Upload: + type: object + title: Upload + description: | + The Upload object can accept byte chunks in the form of Parts. + 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: + 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](/docs/api-reference/files/object#files/object-purpose) for acceptable values. + status: + type: string + description: The status of the Upload. + enum: + - pending + - completed + - cancelled + - expired + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the Upload will expire. + object: + type: string + description: The object type, which is always "upload". + enum: + - upload + x-stainless-const: true + file: + 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 + 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. + 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`. + required: + - id + - object + - bytes + - created_at + - filename + - purpose + - status + x-oaiMeta: + name: The file object + example: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1680202602, + "filename": "salesOverview.pdf", + "purpose": "assistants", + } + type: object + nullable: true + required: + - bytes + - created_at + - expires_at + - filename + - id + - purpose + - status + x-oaiMeta: + name: The upload object + example: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "completed", + "expires_at": 1719127296, + "file": { + "id": "file-xyz321", + "object": "file", + "bytes": 2147483648, + "created_at": 1719186911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + } + } + CompleteUploadRequest: + type: object + additionalProperties: false + properties: + part_ids: + type: array + description: | + The ordered list of Part IDs. + items: + type: string + md5: + description: | + The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect. + type: string + required: + - part_ids + 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 + 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 + 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. + 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`. + required: + - id + - object + - bytes + - created_at + - filename + - purpose + - status + x-oaiMeta: + name: The file object + example: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1680202602, + "filename": "salesOverview.pdf", + "purpose": "assistants", + } + type: object +servers: + - url: https://api.openai.com/v1 diff --git a/provider-dev/source/vector_stores.yaml b/provider-dev/source/vector_stores.yaml new file mode 100644 index 0000000..040b760 --- /dev/null +++ b/provider-dev/source/vector_stores.yaml @@ -0,0 +1,2931 @@ +openapi: 3.1.0 +info: + title: vector_stores API + description: openai API + version: 2.3.0 +paths: + /vector_stores: + get: + operationId: listVectorStores + tags: + - Vector stores + summary: Returns a list of vector stores. + parameters: + - name: limit + in: query + description: |- + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListVectorStoresResponse' + x-oaiMeta: + name: List vector stores + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.list() + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStores = await openai.vectorStores.list(); + console.log(vectorStores); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const vectorStore of client.vectorStores.list()) { + console.log(vectorStore.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.List(context.TODO(), openai.VectorStoreListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStoreListPage; + import com.openai.models.vectorstores.VectorStoreListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreListPage page = client.vectorStores().list(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.list + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "description": "Contains commonly asked questions and answers, organized by topic.", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + }, + { + "id": "vs_abc456", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ v2", + "description": null, + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + ], + "first_id": "vs_abc123", + "last_id": "vs_abc456", + "has_more": false + } + post: + operationId: createVectorStore + tags: + - Vector stores + summary: Create a vector store. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVectorStoreRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreObject' + x-oaiMeta: + name: Create vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "name": "Support FAQ" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store = client.vector_stores.create() + print(vector_store.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.vectorStores.create({ + name: "Support FAQ" + }); + console.log(vectorStore); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStore = await client.vectorStores.create(); + + console.log(vectorStore.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.New(context.TODO(), openai.VectorStoreNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStore; + import com.openai.models.vectorstores.VectorStoreCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStore vectorStore = client.vectorStores().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store = openai.vector_stores.create + + puts(vector_store) + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "description": "Contains commonly asked questions and answers, organized by topic.", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + parameters: + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + /vector_stores/{vector_store_id}: + get: + operationId: getVectorStore + tags: + - Vector stores + summary: Retrieves a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to retrieve. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreObject' + x-oaiMeta: + name: Retrieve vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store = client.vector_stores.retrieve( + "vector_store_id", + ) + print(vector_store.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.vectorStores.retrieve( + "vs_abc123" + ); + console.log(vectorStore); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStore = await client.vectorStores.retrieve('vector_store_id'); + + console.log(vectorStore.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.Get(context.TODO(), \"vector_store_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStore; + import com.openai.models.vectorstores.VectorStoreRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStore vectorStore = client.vectorStores().retrieve("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store = openai.vector_stores.retrieve("vector_store_id") + + puts(vector_store) + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776 + } + post: + operationId: modifyVectorStore + tags: + - Vector stores + summary: Modifies a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to modify. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateVectorStoreRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreObject' + x-oaiMeta: + name: Modify vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + -d '{ + "name": "Support FAQ" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store = client.vector_stores.update( + vector_store_id="vector_store_id", + ) + print(vector_store.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.vectorStores.update( + "vs_abc123", + { + name: "Support FAQ" + } + ); + console.log(vectorStore); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStore = await client.vectorStores.update('vector_store_id'); + + console.log(vectorStore.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.Update(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\topenai.VectorStoreUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStore; + import com.openai.models.vectorstores.VectorStoreUpdateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStore vectorStore = client.vectorStores().update("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store = openai.vector_stores.update("vector_store_id") + + puts(vector_store) + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "description": "Contains commonly asked questions and answers, organized by topic.", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + delete: + operationId: deleteVectorStore + tags: + - Vector stores + summary: Delete a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to delete. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteVectorStoreResponse' + x-oaiMeta: + name: Delete vector store + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_deleted = client.vector_stores.delete( + "vector_store_id", + ) + print(vector_store_deleted.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStore = await openai.vectorStores.delete( + "vs_abc123" + ); + console.log(deletedVectorStore); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreDeleted = await client.vectorStores.delete('vector_store_id'); + + console.log(vectorStoreDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreDeleted, err := client.VectorStores.Delete(context.TODO(), \"vector_store_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStoreDeleteParams; + import com.openai.models.vectorstores.VectorStoreDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreDeleted vectorStoreDeleted = client.vectorStores().delete("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_deleted = openai.vector_stores.delete("vector_store_id") + + puts(vector_store_deleted) + response: | + { + id: "vs_abc123", + object: "vector_store.deleted", + deleted: true + } + /vector_stores/{vector_store_id}/file_batches: + post: + operationId: createVectorStoreFileBatch + tags: + - Vector stores + summary: Create a vector store file batch. + description: | + The maximum number of files in a single batch request is 2000. + Vector 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`). + For ingesting multiple files into the same vector store, this batch endpoint is recommended. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: | + The ID of the vector store for which to create a File Batch. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVectorStoreFileBatchRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatchObject' + 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`). + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "files": [ + { + "file_id": "file-abc123", + "attributes": {"category": "finance"} + }, + { + "file_id": "file-abc456", + "chunking_strategy": { + "type": "static", + "max_chunk_size_tokens": 1200, + "chunk_overlap_tokens": 200 + } + } + ] + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file_batch = client.vector_stores.file_batches.create( + vector_store_id="vs_abc123", + ) + print(vector_store_file_batch.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const myVectorStoreFileBatch = await openai.vectorStores.fileBatches.create( + "vs_abc123", + { + files: [ + { + file_id: "file-abc123", + attributes: { category: "finance" }, + }, + { + file_id: "file-abc456", + chunking_strategy: { + type: "static", + max_chunk_size_tokens: 1200, + chunk_overlap_tokens: 200, + }, + }, + ] + } + ); + console.log(myVectorStoreFileBatch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFileBatch = await client.vectorStores.fileBatches.create('vs_abc123'); + + console.log(vectorStoreFileBatch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.New(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreFileBatchNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.filebatches.FileBatchCreateParams; + import com.openai.models.vectorstores.filebatches.VectorStoreFileBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().create("vs_abc123"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file_batch = openai.vector_stores.file_batches.create("vs_abc123") + + puts(vector_store_file_batch) + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 1, + "completed": 1, + "failed": 0, + "cancelled": 0, + "total": 0, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}: + get: + operationId: getVectorStoreFileBatch + tags: + - Vector stores + summary: Retrieves a vector store file batch. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store that the file batch belongs to. + - in: path + name: batch_id + required: true + schema: + type: string + example: vsfb_abc123 + description: The ID of the file batch being retrieved. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatchObject' + x-oaiMeta: + name: Retrieve vector store file batch + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches/vsfb_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file_batch = client.vector_stores.file_batches.retrieve( + batch_id="vsfb_abc123", + vector_store_id="vs_abc123", + ) + print(vector_store_file_batch.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFileBatch = await openai.vectorStores.fileBatches.retrieve( + "vsfb_abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(vectorStoreFileBatch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFileBatch = await client.vectorStores.fileBatches.retrieve('vsfb_abc123', { + vector_store_id: 'vs_abc123', + }); + + console.log(vectorStoreFileBatch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.Get(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"vsfb_abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.filebatches.FileBatchRetrieveParams; + import com.openai.models.vectorstores.filebatches.VectorStoreFileBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileBatchRetrieveParams params = FileBatchRetrieveParams.builder() + .vectorStoreId("vs_abc123") + .batchId("vsfb_abc123") + .build(); + VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file_batch = openai.vector_stores.file_batches.retrieve("vsfb_abc123", vector_store_id: "vs_abc123") + + puts(vector_store_file_batch) + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 1, + "completed": 1, + "failed": 0, + "cancelled": 0, + "total": 0, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel: + post: + operationId: cancelVectorStoreFileBatch + 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. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store that the file batch belongs to. + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the file batch to cancel. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatchObject' + x-oaiMeta: + name: Cancel vector store file batch + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X POST + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file_batch = client.vector_stores.file_batches.cancel( + batch_id="batch_id", + vector_store_id="vector_store_id", + ) + print(vector_store_file_batch.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStoreFileBatch = await openai.vectorStores.fileBatches.cancel( + "vsfb_abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(deletedVectorStoreFileBatch); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFileBatch = await client.vectorStores.fileBatches.cancel('batch_id', { + vector_store_id: 'vector_store_id', + }); + + console.log(vectorStoreFileBatch.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.Cancel(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"batch_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.filebatches.FileBatchCancelParams; + import com.openai.models.vectorstores.filebatches.VectorStoreFileBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileBatchCancelParams params = FileBatchCancelParams.builder() + .vectorStoreId("vector_store_id") + .batchId("batch_id") + .build(); + VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().cancel(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file_batch = openai.vector_stores.file_batches.cancel("batch_id", vector_store_id: "vector_store_id") + + puts(vector_store_file_batch) + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 12, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 15, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}/files: + get: + operationId: listFilesInVectorStoreBatch + tags: + - Vector stores + summary: Returns a list of vector store files in a batch. + parameters: + - name: vector_store_id + in: path + description: The ID of the vector store that the files belong to. + required: true + schema: + type: string + - name: batch_id + in: path + description: The ID of the file batch that the files belong to. + required: true + schema: + type: string + - name: limit + in: query + description: |- + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + - name: filter + in: query + description: Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. + schema: + type: string + enum: + - in_progress + - completed + - failed + - cancelled + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListVectorStoreFilesResponse' + x-oaiMeta: + name: List vector store files in a batch + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.file_batches.list_files( + batch_id="batch_id", + vector_store_id="vector_store_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFiles = await openai.vectorStores.fileBatches.listFiles( + "vsfb_abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(vectorStoreFiles); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const vectorStoreFile of client.vectorStores.fileBatches.listFiles('batch_id', { + vector_store_id: 'vector_store_id', + })) { + console.log(vectorStoreFile.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.FileBatches.ListFiles(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"batch_id\",\n\t\topenai.VectorStoreFileBatchListFilesParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.filebatches.FileBatchListFilesPage; + import com.openai.models.vectorstores.filebatches.FileBatchListFilesParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileBatchListFilesParams params = FileBatchListFilesParams.builder() + .vectorStoreId("vector_store_id") + .batchId("batch_id") + .build(); + FileBatchListFilesPage page = client.vectorStores().fileBatches().listFiles(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.file_batches.list_files("batch_id", vector_store_id: "vector_store_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + }, + { + "id": "file-abc456", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + /vector_stores/{vector_store_id}/files: + get: + operationId: listVectorStoreFiles + tags: + - Vector stores + summary: Returns a list of vector store files. + parameters: + - name: vector_store_id + in: path + description: The ID of the vector store that the files belong to. + required: true + schema: + type: string + - name: limit + in: query + description: |- + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + + Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: | + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: | + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: | + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + schema: + type: string + - name: filter + in: query + description: Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. + schema: + type: string + enum: + - in_progress + - completed + - failed + - cancelled + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListVectorStoreFilesResponse' + x-oaiMeta: + name: List vector store files + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.files.list( + vector_store_id="vector_store_id", + ) + page = page.data[0] + print(page.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFiles = await openai.vectorStores.files.list( + "vs_abc123" + ); + console.log(vectorStoreFiles); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const vectorStoreFile of client.vectorStores.files.list('vector_store_id')) { + console.log(vectorStoreFile.id); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.Files.List(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\topenai.VectorStoreFileListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileListPage; + import com.openai.models.vectorstores.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileListPage page = client.vectorStores().files().list("vector_store_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.files.list("vector_store_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + }, + { + "id": "file-abc456", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + post: + operationId: createVectorStoreFile + tags: + - Vector stores + summary: Create a vector store file by attaching a [File](/docs/api-reference/files) to a [vector store](/docs/api-reference/vector-stores/object). + 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`. + For uploading multiple files to the same vector store, use the file batches endpoint to reduce request volume. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: | + The ID of the vector store for which to create a File. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVectorStoreFileRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileObject' + 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. + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "file_id": "file-abc123" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file = client.vector_stores.files.create( + vector_store_id="vs_abc123", + file_id="file_id", + ) + print(vector_store_file.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const myVectorStoreFile = await openai.vectorStores.files.create( + "vs_abc123", + { + file_id: "file-abc123" + } + ); + console.log(myVectorStoreFile); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFile = await client.vectorStores.files.create('vs_abc123', { file_id: 'file_id' }); + + console.log(vectorStoreFile.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.New(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreFileNewParams{\n\t\t\tFileID: \"file_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileCreateParams; + import com.openai.models.vectorstores.files.VectorStoreFile; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileCreateParams params = FileCreateParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file_id") + .build(); + VectorStoreFile vectorStoreFile = client.vectorStores().files().create(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file = openai.vector_stores.files.create("vs_abc123", file_id: "file_id") + + puts(vector_store_file) + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "usage_bytes": 1234, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null + } + /vector_stores/{vector_store_id}/files/{file_id}: + get: + operationId: getVectorStoreFile + tags: + - Vector stores + summary: Retrieves a vector store file. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store that the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + example: file-abc123 + description: The ID of the file being retrieved. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileObject' + x-oaiMeta: + name: Retrieve vector store file + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file = client.vector_stores.files.retrieve( + file_id="file-abc123", + vector_store_id="vs_abc123", + ) + print(vector_store_file.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStoreFile = await openai.vectorStores.files.retrieve( + "file-abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(vectorStoreFile); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFile = await client.vectorStores.files.retrieve('file-abc123', { + vector_store_id: 'vs_abc123', + }); + + console.log(vectorStoreFile.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.Get(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"file-abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileRetrieveParams; + import com.openai.models.vectorstores.files.VectorStoreFile; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileRetrieveParams params = FileRetrieveParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file-abc123") + .build(); + VectorStoreFile vectorStoreFile = client.vectorStores().files().retrieve(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file = openai.vector_stores.files.retrieve("file-abc123", vector_store_id: "vs_abc123") + + puts(vector_store_file) + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null + } + delete: + operationId: deleteVectorStoreFile + 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](/docs/api-reference/files/delete) endpoint. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store that the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to delete. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteVectorStoreFileResponse' + x-oaiMeta: + name: Delete vector store file + group: vector_stores + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file_deleted = client.vector_stores.files.delete( + file_id="file_id", + vector_store_id="vector_store_id", + ) + print(vector_store_file_deleted.id) + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStoreFile = await openai.vectorStores.files.delete( + "file-abc123", + { vector_store_id: "vs_abc123" } + ); + console.log(deletedVectorStoreFile); + } + + main(); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFileDeleted = await client.vectorStores.files.delete('file_id', { + vector_store_id: 'vector_store_id', + }); + + console.log(vectorStoreFileDeleted.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileDeleted, err := client.VectorStores.Files.Delete(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileDeleted.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.files.FileDeleteParams; + import com.openai.models.vectorstores.files.VectorStoreFileDeleted; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileDeleteParams params = FileDeleteParams.builder() + .vectorStoreId("vector_store_id") + .fileId("file_id") + .build(); + VectorStoreFileDeleted vectorStoreFileDeleted = client.vectorStores().files().delete(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file_deleted = openai.vector_stores.files.delete("file_id", vector_store_id: "vector_store_id") + + puts(vector_store_file_deleted) + response: | + { + id: "file-abc123", + object: "vector_store.file.deleted", + deleted: true + } + post: + operationId: updateVectorStoreFileAttributes + tags: + - Vector stores + summary: Update attributes on a vector store file. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + example: file-abc123 + description: The ID of the file to update attributes. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateVectorStoreFileAttributesRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileObject' + 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} \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"attributes": {"key1": "value1", "key2": 2}}' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const vectorStoreFile = await client.vectorStores.files.update('file-abc123', { + vector_store_id: 'vs_abc123', + attributes: { foo: 'string' }, + }); + + console.log(vectorStoreFile.id); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + vector_store_file = client.vector_stores.files.update( + file_id="file-abc123", + vector_store_id="vs_abc123", + attributes={ + "foo": "string" + }, + ) + print(vector_store_file.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.Update(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"file-abc123\",\n\t\topenai.VectorStoreFileUpdateParams{\n\t\t\tAttributes: map[string]openai.VectorStoreFileUpdateParamsAttributeUnion{\n\t\t\t\t\"foo\": {\n\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.vectorstores.files.FileUpdateParams; + import com.openai.models.vectorstores.files.VectorStoreFile; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + FileUpdateParams params = FileUpdateParams.builder() + .vectorStoreId("vs_abc123") + .fileId("file-abc123") + .attributes(FileUpdateParams.Attributes.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build()) + .build(); + VectorStoreFile vectorStoreFile = client.vectorStores().files().update(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + vector_store_file = openai.vector_stores.files.update( + "file-abc123", + vector_store_id: "vs_abc123", + attributes: {foo: "string"} + ) + + puts(vector_store_file) + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "usage_bytes": 1234, + "created_at": 1699061776, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null, + "chunking_strategy": {...}, + "attributes": {"key1": "value1", "key2": 2} + } + /vector_stores/{vector_store_id}/search: + post: + operationId: searchVectorStore + tags: + - Vector stores + summary: Search a vector store for relevant chunks based on a query and file attributes filter. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store to search. + - name: openai-organization + in: header + required: false + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`. + schema: + type: string + - name: openai-project + in: header + required: false + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreSearchRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreSearchResultsPage' + x-oaiMeta: + name: Search vector store + group: vector_stores + examples: + request: + curl: | + curl -X POST \ + https://api.openai.com/v1/vector_stores/vs_abc123/search \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"query": "What is the return policy?", "filters": {...}}' + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const vectorStoreSearchResponse of client.vectorStores.search('vs_abc123', { + query: 'string', + })) { + console.log(vectorStoreSearchResponse.file_id); + } + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.vector_stores.search( + vector_store_id="vs_abc123", + query="string", + ) + page = page.data[0] + print(page.file_id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.Search(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreSearchParams{\n\t\t\tQuery: openai.VectorStoreSearchParamsQueryUnion{\n\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.vectorstores.VectorStoreSearchPage; + import com.openai.models.vectorstores.VectorStoreSearchParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + VectorStoreSearchParams params = VectorStoreSearchParams.builder() + .vectorStoreId("vs_abc123") + .query("string") + .build(); + VectorStoreSearchPage page = client.vectorStores().search(params); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.vector_stores.search("vs_abc123", query: "string") + + puts(page) + response: | + { + "object": "vector_store.search_results.page", + "search_query": "What is the return policy?", + "data": [ + { + "file_id": "file_123", + "filename": "document.pdf", + "score": 0.95, + "attributes": { + "author": "John Doe", + "date": "2023-01-01" + }, + "content": [ + { + "type": "text", + "text": "Relevant chunk" + } + ] + }, + { + "file_id": "file_456", + "filename": "notes.txt", + "score": 0.89, + "attributes": { + "author": "Jane Smith", + "date": "2023-01-02" + }, + "content": [ + { + "type": "text", + "text": "Sample text content from the vector store." + } + ] + } + ], + "has_more": false, + "next_page": null + } +components: + schemas: + 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 + type: object + CreateVectorStoreRequest: + type: object + additionalProperties: false + properties: + file_ids: + description: A list of [File](/docs/api-reference/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. + title: Auto Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + x-stainless-const: true + static: + $ref: '#/components/schemas/StaticChunkingStrategy' + required: + - type + - static + metadata: + $ref: '#/components/schemas/Metadata' + VectorStoreObject: + 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: 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 + 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 + enum: + - expired + - in_progress + - completed + expires_after: + $ref: '#/components/schemas/VectorStoreExpirationAfter' + expires_at: + description: The Unix timestamp (in seconds) for when the vector store will expire. + type: integer + format: unixtime + last_active_at: + description: The Unix timestamp (in seconds) for when the vector store was last active. + type: integer + format: unixtime + 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: | + { + "id": "vs_123", + "object": "vector_store", + "created_at": 1698107661, + "usage_bytes": 123456, + "last_active_at": 1698107661, + "name": "my_vector_store", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "cancelled": 0, + "failed": 0, + "total": 100 + }, + "last_used_at": 1698107661 + } + UpdateVectorStoreRequest: + type: object + additionalProperties: false + properties: + name: + description: The name of the vector store. + type: string + nullable: true + expires_after: + 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: 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 + required: + - anchor + - days + nullable: true + metadata: + $ref: '#/components/schemas/Metadata' + 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 + CreateVectorStoreFileBatchRequest: + type: object + additionalProperties: false + properties: + file_ids: + description: A list of [File](/docs/api-reference/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' + required: + - file_ids + - files + VectorStoreFileBatchObject: + 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: 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](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/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: + - id + - object + - created_at + - vector_store_id + - status + - file_counts + x-oaiMeta: + name: The vector store files batch object + beta: true + example: | + { + "id": "vsfb_123", + "object": "vector_store.files_batch", + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "failed": 0, + "cancelled": 0, + "total": 100 + } + } + 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 + type: object + CreateVectorStoreFileRequest: + type: object + additionalProperties: false + properties: + file_id: + description: A [File](/docs/api-reference/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`](/docs/api-reference/vector-stores-file-batches/createBatch) to minimize per-vector-store write requests. + type: string + chunking_strategy: + $ref: '#/components/schemas/ChunkingStrategyRequestParam' + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + required: + - file_id + VectorStoreFileObject: + 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: 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 + vector_store_id: + description: The ID of the [vector store](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/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: + - in_progress + - completed + - cancelled + - failed + last_error: + 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 + chunking_strategy: + type: object + description: The strategy used to chunk the file. + title: Static Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `static`. + enum: + - static + x-stainless-const: true + static: + $ref: '#/components/schemas/StaticChunkingStrategy' + required: + - type + - static + 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: | + { + "id": "file-abc123", + "object": "vector_store.file", + "usage_bytes": 1234, + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "last_error": null, + "chunking_strategy": { + "type": "static", + "static": { + "max_chunk_size_tokens": 800, + "chunk_overlap_tokens": 400 + } + } + } + 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 + UpdateVectorStoreFileAttributesRequest: + type: object + additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + required: + - attributes + x-oaiMeta: + name: Update vector store file attributes request + VectorStoreSearchRequest: + type: object + additionalProperties: false + properties: + query: + description: A query string for a search + type: string + items: + type: string + description: A list of queries to search for. + minItems: 1 + rewrite_query: + description: Whether to rewrite the natural language query for vector search. + type: boolean + default: false + 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 + filters: + description: A filter to apply based on file attributes. + type: object + additionalProperties: false + title: Comparison Filter + 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`. + - `eq`: equals + - `ne`: not equal + - `gt`: greater than + - `gte`: greater than or equal + - `lt`: less than + - `lte`: less than or equal + - `in`: in + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: The value to compare against the attribute key; supports string, number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + filters: + type: array + description: Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - key + - value + - filters + x-oaiMeta: + name: ComparisonFilter + $recursiveAnchor: true + 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 + VectorStoreSearchResultsPage: + type: object + additionalProperties: false + properties: + object: + 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' + has_more: + type: boolean + description: Indicates if there are more results to fetch. + next_page: + type: string + description: The token for the next page, if any. + required: + - object + - search_query + - data + - has_more + - next_page + x-oaiMeta: + name: Vector store search results page + VectorStoreExpirationAfter: + 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: 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 + required: + - anchor + - days + 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 + 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 + Metadata: + 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. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + ChunkingStrategyRequestParam: + type: object + description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. + discriminator: + propertyName: type + title: Auto Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + x-stainless-const: true + static: + $ref: '#/components/schemas/StaticChunkingStrategy' + required: + - type + - static + VectorStoreFileAttributes: + 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. Keys are strings + with a maximum length of 64 characters. Values are strings with a maximum + length of 512 characters, booleans, or numbers. + maxProperties: 16 + propertyNames: + type: string + maxLength: 64 + additionalProperties: + oneOf: + - type: string + maxLength: 512 + - type: number + - type: boolean + x-oaiTypeLabel: map + 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' + required: + - type + - static + 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 + 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. + 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`. + - `eq`: equals + - `ne`: not equal + - `gt`: greater than + - `gte`: greater than or equal + - `lt`: less than + - `lte`: less than or equal + - `in`: in + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: The value to compare against the attribute key; supports string, number, or boolean types. + type: string + items: + oneOf: + - type: string + - type: number + required: + - type + - key + - value + x-oaiMeta: + name: ComparisonFilter + 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: '#' + discriminator: + propertyName: type + required: + - type + - filters + x-oaiMeta: + name: CompoundFilter + VectorStoreSearchResultItem: + type: object + additionalProperties: false + properties: + file_id: + type: string + description: The ID of the vector store file. + filename: + 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' + required: + - file_id + - filename + - score + - attributes + - content + x-oaiMeta: + name: Vector store search result item + 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`. + + Note that the overlap must not exceed half of `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + VectorStoreSearchResultContentObject: + type: object + additionalProperties: false + properties: + type: + description: The type of content. + type: string + enum: + - text + text: + description: The text content returned from search. + type: string + required: + - type + - text + x-oaiMeta: + name: Vector store search result content object +servers: + - url: https://api.openai.com/v1 diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 0000000..ce37dee --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1,2 @@ +# Smoke test dependencies (tests/smoke_test.py) +pystackql>=3.8 diff --git a/tests/smoke_test.py b/tests/smoke_test.py new file mode 100644 index 0000000..9a567b5 --- /dev/null +++ b/tests/smoke_test.py @@ -0,0 +1,361 @@ +#!/usr/bin/env python3 +"""Live smoke test for the openai StackQL provider (pystackql). + +Exercises the provider against the real OpenAI API using an API key supplied via +the OPENAI_API_KEY environment variable. Runs cost-free read and metadata +lifecycles by default (ungated); the token-consuming completions demonstration is +opt-in (--with-completions, the gated tier). + +Runs against the local generated provider (default) or the published provider in +the registry: + + python tests/smoke_test.py # local provider (provider-dev/openapi) + python tests/smoke_test.py --registry public # published provider (registry pull openai) + python tests/smoke_test.py --with-completions # also run the gated completions demo + python tests/smoke_test.py --cleanup-only # just sweep stackql-smoke breadcrumbs + +Auth: the provider declares `bearer` auth on OPENAI_API_KEY, so no credential is +passed on the command line - stackql reads it from the environment. Only the +resolution checks (SHOW/DESCRIBE) work without a key; the live steps report as +BLOCKED when OPENAI_API_KEY is absent. + +Scope note: chat/completions is inference (the data plane) and is deliberately +NOT part of this provider. The --with-completions step therefore calls the OpenAI +API directly (same key), separately from the provider, purely to demonstrate the +key works end to end and return a real answer. +""" + +import argparse +import json +import os +import platform +import sys +import time +import urllib.request +import urllib.error + +try: + from pystackql import StackQL +except ImportError: + sys.exit("pystackql is not installed. Install it with: pip install pystackql") + +REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +LOCAL_REGISTRY_DIR = os.path.join(REPO_ROOT, "provider-dev", "openapi") +SMOKE_PREFIX = "stackql-smoke" +IS_WINDOWS = platform.system().startswith("Win") + + +class Reporter: + """Tracks step outcomes and prints a final summary.""" + + def __init__(self): + self.results = [] # (name, status, detail) + + def record(self, name, status, detail=""): + self.results.append((name, status, detail)) + symbol = {"PASS": "[ PASS ]", "FAIL": "[ FAIL ]", "SKIP": "[ SKIP ]", "BLOCKED": "[BLOCK ]"}[status] + line = f"{symbol} {name}" + if detail: + one_line = " ".join(str(detail).split()) + if len(one_line) > 140: + one_line = one_line[:137] + "..." + line += f" - {one_line}" + print(line, flush=True) + + def summary(self): + counts = {} + for _, status, _ in self.results: + counts[status] = counts.get(status, 0) + 1 + print("\n" + "=" * 60) + print("Summary: " + ", ".join(f"{k}={v}" for k, v in sorted(counts.items()))) + print("=" * 60) + return counts.get("FAIL", 0) == 0 + + +def build_stackql(registry_mode): + """Return a StackQL instance configured for the chosen registry.""" + sq = StackQL(output="dict") + if registry_mode == "local": + if not os.path.isdir(LOCAL_REGISTRY_DIR): + sys.exit(f"local registry not found at {LOCAL_REGISTRY_DIR}; run the generate stage first") + reg_path = LOCAL_REGISTRY_DIR.replace("\\", "/") + full = { + "url": f"file://{reg_path}", + "localDocRoot": reg_path, + "verifyConfig": {"nopVerify": True}, + } + compact = json.dumps(full, separators=(",", ":")) + # pystackql joins params into one shell string (shell=True), so the registry + # JSON must survive the platform shell: escaped double quotes on Windows cmd, + # single-quote wrapping on POSIX sh. + reg_arg = ('"' + compact.replace('"', '\\"') + '"') if IS_WINDOWS else ("'" + compact + "'") + params = sq.params + if "--registry" in params: + i = params.index("--registry") + params[i + 1] = reg_arg + else: + params.extend(["--registry", reg_arg]) + return sq + + +def rows_of(result): + """Normalise a pystackql execute() result to (rows, error).""" + if isinstance(result, list): + if len(result) == 1 and isinstance(result[0], dict) and set(result[0]) <= {"error", "exception"}: + return [], str(result[0].get("error") or result[0].get("exception")) + # surface an error key mixed into rows + for r in result: + if isinstance(r, dict) and "error" in r and len(r) == 1: + return [], str(r["error"]) + return result, None + if isinstance(result, dict) and ("error" in result or "exception" in result): + return [], str(result.get("error") or result.get("exception")) + return result, None + + +def q(sq, query): + return rows_of(sq.execute(query, suppress_errors=False)) + + +def stmt(sq, query): + """Run a mutation/EXEC/REGISTRY statement. executeStmt surfaces API errors as + a list like [{'error': '...'}] (unlike execute, which swallows SELECT errors to + an empty list), so mutations give a reliable pass/fail signal.""" + out = sq.executeStmt(query) + if isinstance(out, list): + for item in out: + if isinstance(item, dict) and item.get("error"): + return ("", str(item["error"]).strip()) + return (str(out), None) + if isinstance(out, dict): + err = out.get("error") or out.get("exception") + return (out.get("message", ""), str(err).strip() if err else None) + return (str(out), None) + + +def sweep_breadcrumbs(sq, rep, key_present): + """Delete any vector stores whose name starts with the smoke prefix.""" + if not key_present: + rep.record("cleanup: sweep prior breadcrumbs", "BLOCKED", "OPENAI_API_KEY not set") + return + rows, err = q(sq, "SELECT id, name FROM openai.vector_stores.vector_stores") + if err: + rep.record("cleanup: list vector stores", "FAIL", err) + return + stale = [r for r in rows if str(r.get("name", "")).startswith(SMOKE_PREFIX)] + for r in stale: + _, derr = stmt(sq, f"DELETE FROM openai.vector_stores.vector_stores WHERE vector_store_id = '{r['id']}'") + status = "FAIL" if derr else "PASS" + rep.record(f"cleanup: delete {r['name']}", status, derr or r["id"]) + rep.record("cleanup: sweep prior breadcrumbs", "PASS", f"{len(stale)} swept") + + +def check_resolution(sq, rep): + rows, err = q(sq, "SHOW SERVICES IN openai") + if err: + rep.record("resolution: SHOW SERVICES", "FAIL", err) + return False + names = sorted(str(r.get("name")) for r in rows) + ok = len(names) == 11 + rep.record("resolution: SHOW SERVICES", "PASS" if ok else "FAIL", f"{len(names)} services") + return ok + + +def read_smokes(sq, rep, key_present): + if not key_present: + rep.record("read: models / files list", "BLOCKED", "OPENAI_API_KEY not set") + return + # A valid key always returns the base model list, so 0 models with a key set is + # a reliable auth/connectivity failure signal (SELECT errors are otherwise + # swallowed to an empty result by pystackql). + rows, err = q(sq, "SELECT id FROM openai.models.models") + if err: + rep.record("read: list models", "FAIL", err) + elif len(rows) == 0: + rep.record("read: list models", "FAIL", "0 models - check auth/connectivity (a valid key always returns models)") + else: + rep.record("read: list models", "PASS", f"{len(rows)} models") + + rows, err = q(sq, "SELECT id, filename, purpose FROM openai.files.files") + rep.record("read: list files (metadata)", "FAIL" if err else "PASS", err or f"{len(rows)} files (0 is valid)") + + # derived-cursor / limit: a bounded read should return at most 2 rows + rows, err = q(sq, "SELECT id FROM openai.files.files WHERE \"limit\" = 2") + detail = err or f"{len(rows)} rows (limit=2)" + rep.record("read: files with limit=2 param", "FAIL" if err else "PASS", detail) + + +def poll_until(fn, timeout, interval): + """Poll fn() until it returns a truthy value or the timeout elapses. + + Returns (value, elapsed_seconds, timed_out). fn is a zero-arg callable + performing one probe; a truthy return ends the poll. This is the async-job + wait pattern (create, then SELECT-poll) applied to resource readiness. + """ + start = time.time() + while True: + val = fn() + elapsed = time.time() - start + if val: + return val, elapsed, False + if elapsed >= timeout: + return None, elapsed, True + time.sleep(min(interval, max(0.0, timeout - elapsed))) + + +def vector_store_lifecycle(sq, rep, key_present, stamp, timeout, interval): + if not key_present: + rep.record("lifecycle: vector store create/get/update/delete", "BLOCKED", "OPENAI_API_KEY not set") + return + name = f"{SMOKE_PREFIX}-{stamp}" + + _, err = stmt(sq, f"INSERT INTO openai.vector_stores.vector_stores(name) SELECT '{name}'") + if err: + rep.record("lifecycle: create vector store", "FAIL", err) + return + rep.record("lifecycle: create vector store", "PASS", name) + + # The created store may not be listable immediately (eventual consistency), so + # poll the list for it up to --timeout. last_rows is captured so that on timeout + # we can report diagnostics: the row count (exactly the default page size points + # at pagination not traversing) and a sample of names (a blank-named store points + # at the INSERT not binding `name`). + last = {"rows": []} + + def probe(): + rows, perr = q(sq, "SELECT id, name, status FROM openai.vector_stores.vector_stores") + if perr: + last["err"] = perr + return "ERROR" + last["rows"] = rows + return next((r for r in rows if r.get("name") == name), None) + + match, elapsed, timed_out = poll_until(probe, timeout, interval) + if match == "ERROR": + rep.record("lifecycle: find created store (poll)", "FAIL", last.get("err", "list error")) + return + if timed_out or not match: + rows = last["rows"] + names = [str(r.get("name")) for r in rows] + smoke_seen = sum(1 for n in names if n.startswith(SMOKE_PREFIX)) + sample = ", ".join(names[:6]) if names else "(none)" + rep.record("lifecycle: find created store (poll)", "FAIL", + f"'{name}' not found after {elapsed:.0f}s among {len(rows)} stores " + f"({smoke_seen} smoke-named; sample: {sample})") + return + vsid = match["id"] + rep.record("lifecycle: find created store (poll)", "PASS", + f"{vsid} after {elapsed:.0f}s ({len(last['rows'])} listed)") + + rows, err = q(sq, f"SELECT id, name, status FROM openai.vector_stores.vector_stores WHERE vector_store_id = '{vsid}'") + got = (not err) and len(rows) == 1 and rows[0].get("id") == vsid + rep.record("lifecycle: get store by id", "PASS" if got else "FAIL", err or (rows[0].get("status") if got else "mismatch")) + + _, err = stmt(sq, f"UPDATE openai.vector_stores.vector_stores SET name = '{name}-updated' WHERE vector_store_id = '{vsid}'") + rep.record("lifecycle: update store name", "FAIL" if err else "PASS", err or f"{name}-updated") + + _, err = stmt(sq, f"DELETE FROM openai.vector_stores.vector_stores WHERE vector_store_id = '{vsid}'") + rep.record("lifecycle: delete store", "FAIL" if err else "PASS", err or vsid) + + rows, err = q(sq, "SELECT id FROM openai.vector_stores.vector_stores") + gone = (not err) and all(r.get("id") != vsid for r in rows) + rep.record("lifecycle: confirm store deleted", "PASS" if gone else "FAIL", err or ("gone" if gone else "still present")) + + +def completions_demo(sq, rep, key_present, model): + """Direct OpenAI API call (inference is out of provider scope) - gated.""" + if not key_present: + rep.record("gated: completions demo", "BLOCKED", "OPENAI_API_KEY not set") + return + api_key = os.environ["OPENAI_API_KEY"] + body = json.dumps({ + "model": model, + "messages": [{"role": "user", "content": "Explain how StackQL works in two sentences."}], + "max_tokens": 150, + }).encode() + req = urllib.request.Request( + "https://api.openai.com/v1/chat/completions", + data=body, + headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}, + method="POST", + ) + try: + with urllib.request.urlopen(req, timeout=60) as resp: + payload = json.loads(resp.read()) + answer = payload["choices"][0]["message"]["content"].strip() + rep.record("gated: completions demo (direct, out of provider scope)", "PASS", f"model={model}") + print("\n --- completion ---") + for line in answer.splitlines(): + print(f" {line}") + print(" ------------------") + except urllib.error.HTTPError as e: + raw = e.read().decode() + code = "" + try: + code = json.loads(raw).get("error", {}).get("code", "") or "" + except Exception: # noqa: BLE001 + pass + # Quota / billing state on the account is not a provider or code defect, and + # this is an optional out-of-scope demo - report it as a SKIP so it does not + # red the run. Any other HTTP error is a real failure. + if e.code == 429 or code == "insufficient_quota": + rep.record("gated: completions demo", "SKIP", + "account has no completions quota/billing (HTTP 429 insufficient_quota) - not a provider issue") + else: + rep.record("gated: completions demo", "FAIL", f"HTTP {e.code}: {raw[:120]}") + except Exception as e: # noqa: BLE001 + rep.record("gated: completions demo", "FAIL", repr(e)[:120]) + + +def main(): + ap = argparse.ArgumentParser(description="Live smoke test for the openai StackQL provider.") + ap.add_argument("--registry", choices=["local", "public"], default="local", + help="local generated provider (default) or published provider via registry pull") + ap.add_argument("--with-completions", action="store_true", + help="run the gated, token-consuming completions demonstration (direct API call)") + ap.add_argument("--model", default="gpt-4o-mini", help="model for the completions demo (default gpt-4o-mini)") + ap.add_argument("--timeout", type=float, default=120.0, + help="seconds to poll for the created vector store to become listable (default 120)") + ap.add_argument("--poll-interval", type=float, default=3.0, + help="seconds between poll attempts (default 3)") + ap.add_argument("--cleanup-only", action="store_true", help="only sweep stackql-smoke breadcrumbs, then exit") + args = ap.parse_args() + + key_present = bool(os.environ.get("OPENAI_API_KEY")) + stamp = str(int(time.time())) + rep = Reporter() + + print(f"openai provider smoke test | registry={args.registry} | key={'set' if key_present else 'ABSENT'}\n") + + sq = build_stackql(args.registry) + + if args.registry == "public": + out, err = stmt(sq, "REGISTRY PULL openai") + rep.record("registry pull openai", "FAIL" if err else "PASS", err or "pulled") + if err: + sys.exit(1) + + if not check_resolution(sq, rep): + rep.summary() + sys.exit(1) + + sweep_breadcrumbs(sq, rep, key_present) + + if args.cleanup_only: + ok = rep.summary() + sys.exit(0 if ok else 1) + + read_smokes(sq, rep, key_present) + vector_store_lifecycle(sq, rep, key_present, stamp, args.timeout, args.poll_interval) + + if args.with_completions: + completions_demo(sq, rep, key_present, args.model) + + ok = rep.summary() + if not key_present: + print("\nNote: live steps were BLOCKED. Set OPENAI_API_KEY to run them.") + sys.exit(0 if ok else 1) + + +if __name__ == "__main__": + main() diff --git a/website/.gitignore b/website/.gitignore index b2d6de3..dc32d51 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -18,3 +18,6 @@ npm-debug.log* yarn-debug.log* yarn-error.log* + +# vendored shared docusaurus config (cloned at build time) +.shared-config diff --git a/website/README.md b/website/README.md index 79065ea..3813422 100644 --- a/website/README.md +++ b/website/README.md @@ -1,283 +1,59 @@ -# `openai` provider for [`stackql`](https://github.com/stackql/stackql) +# Website -This repository is used to generate and document the `openai` provider for StackQL, allowing you to query and interact with OpenAI services using SQL-like syntax. The provider is built using the `@stackql/provider-utils` package, which provides tools for converting OpenAPI specifications into StackQL-compatible provider schemas. +The documentation microsite for the `openai` StackQL provider, served at +[openai-provider.stackql.io](https://openai-provider.stackql.io). Built with +[Docusaurus](https://docusaurus.io/) 3.10. -## Prerequisites +> Provider generation (fetch, split, mappings, normalize, generate, test, publish) +> is documented in the [repository root README](../README.md). This README covers +> the website only. The service docs under `docs/` are generated from the provider +> output - do not edit them by hand. -To use the OpenAI provider with StackQL, you'll need: +## Shared configuration -1. An OpenAI account with appropriate API credentials -2. An OpenAI API key with sufficient permissions for the resources you want to access -3. StackQL CLI installed on your system (see [StackQL](https://github.com/stackql/stackql)) +Navbar, footer, theme and plugin configuration is shared across the StackQL +provider microsites via [`stackql/docusaurus-config`](https://github.com/stackql/docusaurus-config), +vendored into `.shared-config/` at build time. The `vendor-config` script runs +automatically before `start` and `build` (it clones the shared config, so network +access to GitHub is required). Site-local files are `provider.js` (the provider +identity), the thin `docusaurus.config.js` / `sidebars.js` wrappers, the +components/theme under `src/`, and the assets under `static/`. -## 1. Download the Open API Specification - -First, download or create the OpenAI API OpenAPI specification: - -```bash -mkdir -p provider-dev/downloaded -curl -L https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml \ - -o provider-dev/downloaded/openai-openapi.yaml - -# Convert YAML to JSON if needed -python3 provider-dev/scripts/yaml_to_json.py \ - --input provider-dev/downloaded/openai-openapi.yaml \ - --output provider-dev/downloaded/openapi.json -``` - -## 2. Split into Service Specs - -Next, split the OpenAPI specification into service-specific files: - -```bash -rm -rf provider-dev/source/* -npm run split -- \ - --provider-name openai \ - --api-doc provider-dev/downloaded/openapi.json \ - --svc-discriminator tag \ - --output-dir provider-dev/source \ - --overwrite \ - --svc-name-overrides "$(cat < -
-total services: 17
-total resources: 52
-
- - -::: - -See also: -[[` SHOW `]](https://stackql.io/docs/language-spec/show) [[` DESCRIBE `]](https://stackql.io/docs/language-spec/describe) [[` REGISTRY `]](https://stackql.io/docs/language-spec/registry) -* * * - -## Installation - -To pull the latest version of the `openai` provider, run the following command: - -```bash -REGISTRY PULL openai; -``` -> To view previous provider versions or to pull a specific provider version, see [here](https://stackql.io/docs/language-spec/registry). - -## Authentication - -The following system environment variables are used for authentication by default: - -- - OpenAI API key (see How to Create an OpenAI API Key) - -These variables are sourced at runtime (from the local machine or as CI variables/secrets). - -
- -Using different environment variables - -To use different environment variables (instead of the defaults), use the `--auth` flag of the `stackql` program. For example: - -```bash - -AUTH='{ "openai": { "type": "bearer", "credentialsenvvar": "OPENAI_API_KEY" }}' -stackql shell --auth="${AUTH}" - -``` -or using PowerShell: - -```powershell - -$Auth = "{ 'openai': { 'type': 'bearer', 'credentialsenvvar': 'OPENAI_API_KEY' }}" -stackql.exe shell --auth=$Auth - -``` -
- - -## Services - +--- +title: openai +hide_title: false +hide_table_of_contents: false +keywords: + - openai + - stackql + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage OpenAI resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +id: 'provider-intro' +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; + +The OpenAI platform surface available to standard API keys - models, files, fine-tuning, batches, vector stores, assistants, evals, conversations, uploads, containers and skills - queried and managed with SQL. The organization/admin surface is the sibling `openai_admin` provider. + + +:::info[Provider Summary] + +total services: __11__ +total resources: __37__ + +::: + +See also: +[[` SHOW `]](https://stackql.io/docs/language-spec/show) [[` DESCRIBE `]](https://stackql.io/docs/language-spec/describe) [[` REGISTRY `]](https://stackql.io/docs/language-spec/registry) +* * * + +## Installation + +To pull the latest version of the `openai` provider, run the following command: + +```bash +REGISTRY PULL openai; +``` +> To view previous provider versions or to pull a specific provider version, see [here](https://stackql.io/docs/language-spec/registry). + +## Authentication + +The following system environment variables are used for authentication by default: + +- - OpenAI API key, `sk-...` (see How to Create an OpenAI API Key) + +These variables are sourced at runtime (from the local machine or as CI variables/secrets). + +A standard API key carries its own organization and project defaults, so neither is required on any query. To scope a request explicitly, supply the optional `openai-organization` / `openai-project` headers - they are hyphenated wire names, so they are addressed with double quotes: `WHERE "openai-organization" = 'org-...'`. The organization/admin surface (usage, costs, projects, users, invites, audit logs) uses a separate **admin** key and lives in the sibling [`openai_admin`](https://openai-admin-provider.stackql.io) provider. + +
+ +Using different environment variables + +To use different environment variables (instead of the defaults), use the `--auth` flag of the `stackql` program. For example: + +```bash + +AUTH='{ "openai": { "type": "bearer", "credentialsenvvar": "OPENAI_API_KEY" }}' +stackql shell --auth="${AUTH}" + +``` +or using PowerShell: + +```powershell + +$Auth = "{ 'openai': { 'type': 'bearer', 'credentialsenvvar': 'OPENAI_API_KEY' }}" +stackql.exe shell --auth=$Auth + +``` +
+ +## Fine-tuning history and checkpoints + +Every fine-tuning job, newest first, with the tuning method and any failure reason: + +```sql +SELECT + id, + model, + status, + fine_tuned_model, + trained_tokens, + date(created_at, 'unixepoch') AS created, + json_extract(method, '$.type') AS method_type, + json_extract(error, '$.message') AS error_message +FROM openai.fine_tuning.jobs +ORDER BY created_at DESC; +``` + +Spend and success at a glance - tokens trained per base model: + +```sql +SELECT + model, + count(*) AS jobs, + sum(trained_tokens) AS trained_tokens, + sum(CASE WHEN status = 'succeeded' THEN 1 ELSE 0 END) AS succeeded, + sum(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) AS failed +FROM openai.fine_tuning.jobs +GROUP BY model +ORDER BY trained_tokens DESC; +``` + +Checkpoint inventory for one job - pick the best checkpoint by validation loss: + +```sql +SELECT + step_number, + fine_tuned_model_checkpoint, + json_extract(metrics, '$.train_loss') AS train_loss, + json_extract(metrics, '$.valid_loss') AS valid_loss, + json_extract(metrics, '$.full_valid_loss') AS full_valid_loss +FROM openai.fine_tuning.checkpoints +WHERE fine_tuning_job_id = 'ftjob-abc123' +ORDER BY step_number; +``` + +## Async jobs: create, poll, cancel + +Fine-tuning jobs, batches, vector store file batches and uploads are all the same shape - `INSERT` creates, `SELECT` polls, `EXEC` cancels: + +```sql +-- create +INSERT INTO openai.fine_tuning.jobs (model, training_file) +SELECT 'gpt-4o-mini-2024-07-18', 'file-abc123'; + +-- poll +SELECT status, trained_tokens, fine_tuned_model, json_extract(error, '$.message') AS error_message +FROM openai.fine_tuning.jobs +WHERE fine_tuning_job_id = 'ftjob-abc123'; + +-- cancel +EXEC openai.fine_tuning.jobs.cancel @fine_tuning_job_id = 'ftjob-abc123'; +``` + +## Batch status and error triage + +Batches that are not finished, with their per-request tallies: + +```sql +SELECT + id, + status, + endpoint, + json_extract(request_counts, '$.total') AS requests_total, + json_extract(request_counts, '$.completed') AS requests_completed, + json_extract(request_counts, '$.failed') AS requests_failed, + error_file_id, + date(created_at, 'unixepoch') AS created +FROM openai.batches.batches +WHERE status <> 'completed' +ORDER BY created_at DESC; +``` + +Triage the failures - batches with failed requests, and where to read the errors: + +```sql +SELECT + id, + status, + json_extract(request_counts, '$.failed') AS requests_failed, + output_file_id, + error_file_id, + date(coalesce(failed_at, completed_at, created_at), 'unixepoch') AS last_event +FROM openai.batches.batches +WHERE json_extract(request_counts, '$.failed') > 0 + OR status IN ('failed', 'expired', 'cancelled') +ORDER BY last_event DESC; +``` + +## Vector store audit + +Stores by size, with their file processing state: + +```sql +SELECT + name, + status, + round(usage_bytes / 1048576.0, 2) AS size_mb, + json_extract(file_counts, '$.total') AS files_total, + json_extract(file_counts, '$.completed') AS files_completed, + json_extract(file_counts, '$.failed') AS files_failed, + date(created_at, 'unixepoch') AS created, + date(last_active_at, 'unixepoch') AS last_active +FROM openai.vector_stores.vector_stores +ORDER BY usage_bytes DESC; +``` + +Which files failed to ingest, and why: + +```sql +SELECT + id AS file_id, + status, + usage_bytes, + json_extract(last_error, '$.code') AS error_code, + json_extract(last_error, '$.message') AS error_message +FROM openai.vector_stores.files +WHERE vector_store_id = 'vs_abc123' + AND status = 'failed'; +``` + +Idle stores - candidates for cleanup: + +```sql +SELECT name, id, round(usage_bytes / 1048576.0, 2) AS size_mb, + date(last_active_at, 'unixepoch') AS last_active +FROM openai.vector_stores.vector_stores +WHERE last_active_at < strftime('%s', date('now', '-30 days')) +ORDER BY usage_bytes DESC; +``` + +## File estate by purpose and age + +The whole file estate, grouped by what it is for: + +```sql +SELECT + purpose, + count(*) AS files, + round(sum(bytes) / 1048576.0, 2) AS total_mb, + min(date(created_at, 'unixepoch')) AS oldest, + max(date(created_at, 'unixepoch')) AS newest +FROM openai.files.files +GROUP BY purpose +ORDER BY total_mb DESC; +``` + +`purpose` is filtered on the wire, so narrowing is a server-side fetch rather than a client-side scan: + +```sql +SELECT id, filename, round(bytes / 1048576.0, 2) AS size_mb, + date(created_at, 'unixepoch') AS created, status +FROM openai.files.files +WHERE purpose = 'fine-tune' +ORDER BY created_at; +``` + +## Assistants inventory + +> The Assistants family (assistants, threads, messages, runs, run steps) carries OpenAI's **deprecation** in favour of the Responses API. It is mapped and labelled here for inventory and migration work; new build-outs should target Responses. + +What assistants exist, on which models: + +```sql +SELECT + id, + name, + model, + json_array_length(tools) AS tool_count, + date(created_at, 'unixepoch') AS created +FROM openai.assistants.assistants +ORDER BY created_at DESC +LIMIT 20; +``` + +Assistants by model - the migration surface, largest first: + +```sql +SELECT model, count(*) AS assistants +FROM openai.assistants.assistants +GROUP BY model +ORDER BY assistants DESC; +``` + + +## Services + diff --git a/website/docs/services/assistants/assistants/index.md b/website/docs/services/assistants/assistants/index.md index bb05abe..fd4a8ca 100644 --- a/website/docs/services/assistants/assistants/index.md +++ b/website/docs/services/assistants/assistants/index.md @@ -1,4 +1,4 @@ ---- +--- title: assistants hide_title: false hide_table_of_contents: false @@ -15,55 +15,339 @@ image: /img/stackql-openai-provider-featured-image.png --- import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -Creates, updates, deletes, gets or lists a assistants resource. +Creates, updates, deletes, gets or lists an assistants resource. ## Overview - +
Nameassistants
Name
TypeResource
Id
## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints. | -| | `string` | The name of the assistant. The maximum length is 256 characters. | -| | `string` | The description of the assistant. The maximum length is 512 characters. | -| | `integer` | The Unix timestamp (in seconds) for when the assistant was created. | -| | `string` | The system instructions that the assistant uses. The maximum length is 256,000 characters. | -| | `object` | 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. | -| | `string` | ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. | -| | `string` | The object type, which is always `assistant`. | -| | `` | Specifies the format that the model must output. Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4 Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. Setting 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](/docs/guides/structured-outputs). Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. **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. | -| | `number` | 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. | -| | `object` | 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. | -| | `array` | 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`. | -| | `number` | 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. We generally recommend altering this or temperature but not both. | + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
stringThe name of the assistant. The maximum length is 256 characters.
integer (unixtime)The Unix timestamp (in seconds) for when the assistant was created.
stringThe description of the assistant. The maximum length is 512 characters.
stringThe system instructions that the assistant uses. The maximum length is 256,000 characters.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.
stringThe object type, which is always `assistant`. (assistant)
stringSpecifies the format that the model must output. Compatible with [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. Setting 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://platform.openai.com/docs/guides/structured-outputs). Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. **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. (auto) (title: Text)
numberWhat 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.
objectA 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.
arrayA 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`.
numberAn 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. We generally recommend altering this or temperature but not both.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
stringThe name of the assistant. The maximum length is 256 characters.
integer (unixtime)The Unix timestamp (in seconds) for when the assistant was created.
stringThe description of the assistant. The maximum length is 512 characters.
stringThe system instructions that the assistant uses. The maximum length is 256,000 characters.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.
stringThe object type, which is always `assistant`. (assistant)
stringSpecifies the format that the model must output. Compatible with [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. Setting 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://platform.openai.com/docs/guides/structured-outputs). Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. **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. (auto) (title: Text)
numberWhat 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.
objectA 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.
arrayA 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`.
numberAn 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. We generally recommend altering this or temperature but not both.
+
+
## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `INSERT` | | | -| | `DELETE` | | | -| | `UPDATE` | | | -## `SELECT` examples +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
assistant_idopenai-organization, openai-project
limit, order, after, before, openai-organization, openai-project
modelopenai-organization, openai-project
assistant_idopenai-organization, openai-project
assistant_idopenai-organization, openai-project
+ +## Parameters +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the assistant to delete.
stringA cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
stringA cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
integerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
+## `SELECT` examples + + + + +OK ```sql SELECT id, name, +created_at, description, +instructions, +metadata, +model, +object, +response_format, +temperature, +tool_resources, +tools, +top_p +FROM openai.assistants.assistants +WHERE assistant_id = '{{ assistant_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +OK + +```sql +SELECT +id, +name, created_at, +description, instructions, metadata, model, @@ -74,133 +358,240 @@ tool_resources, tools, top_p FROM openai.assistants.assistants +WHERE "order" = '{{ order }}' +AND after = '{{ after }}' +AND before = '{{ before }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' ; ``` -## `INSERT` example + + + -Use the following StackQL query and manifest file to create a new assistants resource. +## `INSERT` examples - + { label: 'create', value: 'create' }, + { label: 'Manifest', value: 'manifest' } + ]} +> + + +No description available. ```sql -/*+ create */ INSERT INTO openai.assistants.assistants ( -data__model, -data__name, -data__description, -data__instructions, -data__tools, -data__tool_resources, -data__metadata, -data__temperature, -data__top_p, -data__response_format +model, +name, +description, +instructions, +reasoning_effort, +tools, +tool_resources, +metadata, +temperature, +top_p, +response_format, +"openai-organization", +"openai-project" ) SELECT -'{{ model }}', +'{{ model }}' /* required */, '{{ name }}', '{{ description }}', '{{ instructions }}', +'{{ reasoning_effort }}', '{{ tools }}', '{{ tool_resources }}', '{{ metadata }}', -'{{ temperature }}', -'{{ top_p }}', -'{{ response_format }}' -; -``` - - - - -```sql -/*+ create */ -INSERT INTO openai.assistants.assistants ( -data__model -) -SELECT -'{{ model }}' +{{ temperature }}, +{{ top_p }}, +'{{ response_format }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +name, +created_at, +description, +instructions, +metadata, +model, +object, +response_format, +temperature, +tool_resources, +tools, +top_p ; ``` - -```yaml +{`# Description fields are for documentation purposes - name: assistants props: - - name: data__model - value: string - name: model - value: string + value: "{{ model }}" + description: | + ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them. + valid_values: ['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'] - name: name - value: string + value: "{{ name }}" + description: | + The name of the assistant. The maximum length is 256 characters. - name: description - value: string + value: "{{ description }}" + description: | + The description of the assistant. The maximum length is 512 characters. - name: instructions - value: string + value: "{{ instructions }}" + description: | + The system instructions that the assistant uses. The maximum length is 256,000 characters. + - name: reasoning_effort + value: "{{ reasoning_effort }}" + description: | + Constrains effort on reasoning for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + Currently supported values are \`none\`, \`minimal\`, \`low\`, \`medium\`, \`high\`, and \`xhigh\`. Reducing + reasoning effort can result in faster responses and fewer tokens used + on reasoning in a response. + - \`gpt-5.1\` defaults to \`none\`, which does not perform reasoning. The supported reasoning values for \`gpt-5.1\` are \`none\`, \`low\`, \`medium\`, and \`high\`. Tool calls are supported for all reasoning values in gpt-5.1. + - All models before \`gpt-5.1\` default to \`medium\` reasoning effort, and do not support \`none\`. + - The \`gpt-5-pro\` model defaults to (and only supports) \`high\` reasoning effort. + - \`xhigh\` is supported for all models after \`gpt-5.1-codex-max\`. + valid_values: ['none', 'minimal', 'low', 'medium', 'high', 'xhigh'] + default: medium - name: tools - value: array - props: - - name: type - value: string + value: "{{ 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\`. + default: - name: tool_resources - props: - - name: code_interpreter - props: - - name: file_ids - value: array - - name: file_search - value: string + 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. + value: + code_interpreter: + file_ids: + - "{{ file_ids }}" + file_search: + vector_store_ids: + - "{{ vector_store_ids }}" + vector_stores: + - file_ids: "{{ file_ids }}" + chunking_strategy: "{{ chunking_strategy }}" + metadata: "{{ metadata }}" - name: metadata - value: object + value: "{{ 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. + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. - name: temperature - value: number + value: {{ temperature }} + 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. + default: 1 - name: top_p - value: number + value: {{ top_p }} + 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. + We generally recommend altering this or temperature but not both. + default: 1 - name: response_format - value: string + value: "{{ response_format }}" + description: | + Specifies the format that the model must output. Compatible with [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since \`gpt-3.5-turbo-1106\`. + Setting 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://platform.openai.com/docs/guides/structured-outputs). + Setting to \`{ "type": "json_object" }\` enables JSON mode, which ensures the message the model generates is valid JSON. + **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. + valid_values: ['auto'] + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} -``` -## `UPDATE` example -Updates a assistants resource. +## `UPDATE` examples + + + + +No description available. ```sql -/*+ update */ UPDATE openai.assistants.assistants SET model = '{{ model }}', +reasoning_effort = '{{ reasoning_effort }}', name = '{{ name }}', description = '{{ description }}', instructions = '{{ instructions }}', tools = '{{ tools }}', tool_resources = '{{ tool_resources }}', metadata = '{{ metadata }}', -temperature = number, -top_p = number, +temperature = {{ temperature }}, +top_p = {{ top_p }}, response_format = '{{ response_format }}' WHERE -assistant_id = '{{ assistant_id }}'; +assistant_id = '{{ assistant_id }}' --required +AND "openai-organization" = '{{ openai-organization}}' +AND "openai-project" = '{{ openai-project}}' +RETURNING +id, +name, +created_at, +description, +instructions, +metadata, +model, +object, +response_format, +temperature, +tool_resources, +tools, +top_p; ``` + + + -## `DELETE` example +## `DELETE` examples -Deletes the specified assistants resource. + + + +No description available. ```sql -/*+ delete */ DELETE FROM openai.assistants.assistants -WHERE assistant_id = '{{ assistant_id }}'; +WHERE assistant_id = '{{ assistant_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; ``` + + diff --git a/website/docs/services/assistants/index.md b/website/docs/services/assistants/index.md index 8e70394..0cdb34e 100644 --- a/website/docs/services/assistants/index.md +++ b/website/docs/services/assistants/index.md @@ -16,13 +16,9 @@ image: /img/stackql-openai-provider-featured-image.png assistants service documentation. -:::info Service Summary +:::info[Service Summary] -
-
-total resources: 5
-
-
+total resources: __5__ ::: diff --git a/website/docs/services/assistants/messages/index.md b/website/docs/services/assistants/messages/index.md index ea080bb..e504587 100644 --- a/website/docs/services/assistants/messages/index.md +++ b/website/docs/services/assistants/messages/index.md @@ -1,4 +1,4 @@ ---- +--- title: messages hide_title: false hide_table_of_contents: false @@ -15,6 +15,7 @@ image: /img/stackql-openai-provider-featured-image.png --- import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -22,47 +23,325 @@ Creates, updates, deletes, gets or lists a messages resource. ## Overview - +
Namemessages
Name
TypeResource
Id
## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints. | -| | `string` | If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message. | -| | `array` | A list of files attached to the message, and the tools they were added to. | -| | `integer` | The Unix timestamp (in seconds) for when the message was completed. | -| | `array` | The content of the message in array of text and/or images. | -| | `integer` | The Unix timestamp (in seconds) for when the message was created. | -| | `integer` | The Unix timestamp (in seconds) for when the message was marked as incomplete. | -| | `object` | On an incomplete message, details about why the message is incomplete. | -| | `object` | 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. | -| | `string` | The object type, which is always `thread.message`. | -| | `string` | The entity that produced the message. One of `user` or `assistant`. | -| | `string` | The ID of the [run](/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. | -| | `string` | The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. | -| | `string` | The [thread](/docs/api-reference/threads) ID that this message belongs to. | + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
stringIf applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message.
stringThe ID of the [run](https://platform.openai.com/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints.
stringThe [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to.
arrayA list of files attached to the message, and the tools they were added to.
integer (unixtime)The Unix timestamp (in seconds) for when the message was completed.
arrayThe content of the message in array of text and/or images.
integer (unixtime)The Unix timestamp (in seconds) for when the message was created.
integer (unixtime)The Unix timestamp (in seconds) for when the message was marked as incomplete.
objectOn an incomplete message, details about why the message is incomplete.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe object type, which is always `thread.message`. (thread.message)
stringThe entity that produced the message. One of `user` or `assistant`. (user, assistant)
stringThe status of the message, which can be either `in_progress`, `incomplete`, or `completed`. (in_progress, incomplete, completed)
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
stringIf applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message.
stringThe ID of the [run](https://platform.openai.com/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints.
stringThe [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to.
arrayA list of files attached to the message, and the tools they were added to.
integer (unixtime)The Unix timestamp (in seconds) for when the message was completed.
arrayThe content of the message in array of text and/or images.
integer (unixtime)The Unix timestamp (in seconds) for when the message was created.
integer (unixtime)The Unix timestamp (in seconds) for when the message was marked as incomplete.
objectOn an incomplete message, details about why the message is incomplete.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe object type, which is always `thread.message`. (thread.message)
stringThe entity that produced the message. One of `user` or `assistant`. (user, assistant)
stringThe status of the message, which can be either `in_progress`, `incomplete`, or `completed`. (in_progress, incomplete, completed)
+
+
## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `INSERT` | | | -| | `DELETE` | | | -| | `UPDATE` | | | -## `SELECT` examples +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
thread_id, message_idopenai-organization, openai-project
thread_idlimit, order, after, before, run_id, openai-organization, openai-project
thread_id, role, contentopenai-organization, openai-project
thread_id, message_idopenai-organization, openai-project
thread_id, message_idopenai-organization, openai-project
+## Parameters +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the message to delete.
stringThe ID of the thread to which this message belongs.
stringA cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
stringA cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
integerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
stringFilter messages by the run ID that generated them.
+ +## `SELECT` examples + + + + +OK ```sql SELECT id, assistant_id, +run_id, +thread_id, attachments, completed_at, content, @@ -72,115 +351,205 @@ incomplete_details, metadata, object, role, -run_id, -status, -thread_id +status FROM openai.assistants.messages -WHERE thread_id = '{{ thread_id }}'; +WHERE thread_id = '{{ thread_id }}' -- required +AND message_id = '{{ message_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; ``` -## `INSERT` example - -Use the following StackQL query and manifest file to create a new messages resource. + + - - +OK ```sql -/*+ create */ -INSERT INTO openai.assistants.messages ( -data__role, -data__content, -data__attachments, -data__metadata, -thread_id -) -SELECT -'{{ role }}', -'{{ content }}', -'{{ attachments }}', -'{{ metadata }}', -'{{ thread_id }}' +SELECT +id, +assistant_id, +run_id, +thread_id, +attachments, +completed_at, +content, +created_at, +incomplete_at, +incomplete_details, +metadata, +object, +role, +status +FROM openai.assistants.messages +WHERE thread_id = '{{ thread_id }}' -- required +AND "order" = '{{ order }}' +AND after = '{{ after }}' +AND before = '{{ before }}' +AND run_id = '{{ run_id }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' ; ``` + - + +## `INSERT` examples + + + + +No description available. ```sql -/*+ create */ INSERT INTO openai.assistants.messages ( -data__role, -data__content, -thread_id +role, +content, +attachments, +metadata, +thread_id, +"openai-organization", +"openai-project" ) SELECT -'{{ role }}', -'{{ content }}', -'{{ thread_id }}' +'{{ role }}' /* required */, +'{{ content }}' /* required */, +'{{ attachments }}', +'{{ metadata }}', +'{{ thread_id }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +assistant_id, +run_id, +thread_id, +attachments, +completed_at, +content, +created_at, +incomplete_at, +incomplete_details, +metadata, +object, +role, +status ; ``` - -```yaml +{`# Description fields are for documentation purposes - name: messages props: - name: thread_id - value: string - - name: data__content - value: string - - name: data__role - value: string + value: "{{ thread_id }}" + description: Required parameter for the messages resource. - name: role - value: string + value: "{{ role }}" + description: | + The role of the entity that is creating the message. Allowed values include: + - \`user\`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. + - \`assistant\`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation. + valid_values: ['user', 'assistant'] - name: content - value: string + value: "{{ content }}" + description: | + The text contents of the message. - name: attachments - value: array - props: - - name: file_id - value: string - - name: tools - value: array - props: - - name: type - value: string + description: | + A list of files attached to the message, and the tools they should be added to. + value: + - file_id: "{{ file_id }}" + tools: "{{ tools }}" - name: metadata - value: object + value: "{{ 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. + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} -``` -## `UPDATE` example -Updates a messages resource. +## `UPDATE` examples + + + + +No description available. ```sql -/*+ update */ UPDATE openai.assistants.messages SET metadata = '{{ metadata }}' WHERE -message_id = '{{ message_id }}' -AND thread_id = '{{ thread_id }}'; +thread_id = '{{ thread_id }}' --required +AND message_id = '{{ message_id }}' --required +AND "openai-organization" = '{{ openai-organization}}' +AND "openai-project" = '{{ openai-project}}' +RETURNING +id, +assistant_id, +run_id, +thread_id, +attachments, +completed_at, +content, +created_at, +incomplete_at, +incomplete_details, +metadata, +object, +role, +status; ``` + + -## `DELETE` example -Deletes the specified messages resource. +## `DELETE` examples + + + + +No description available. ```sql -/*+ delete */ DELETE FROM openai.assistants.messages -WHERE message_id = '{{ message_id }}' -AND thread_id = '{{ thread_id }}'; +WHERE thread_id = '{{ thread_id }}' --required +AND message_id = '{{ message_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; ``` + + diff --git a/website/docs/services/assistants/run_steps/index.md b/website/docs/services/assistants/run_steps/index.md index 648c155..27b36bf 100644 --- a/website/docs/services/assistants/run_steps/index.md +++ b/website/docs/services/assistants/run_steps/index.md @@ -1,4 +1,4 @@ ---- +--- title: run_steps hide_title: false hide_table_of_contents: false @@ -15,6 +15,7 @@ image: /img/stackql-openai-provider-featured-image.png --- import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -22,46 +23,329 @@ Creates, updates, deletes, gets or lists a run_steps resource. ## Overview - +
Namerun_steps
Name
TypeResource
Id
## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier of the run step, which can be referenced in API endpoints. | -| | `string` | The ID of the [assistant](/docs/api-reference/assistants) associated with the run step. | -| | `integer` | The Unix timestamp (in seconds) for when the run step was cancelled. | -| | `integer` | The Unix timestamp (in seconds) for when the run step completed. | -| | `integer` | The Unix timestamp (in seconds) for when the run step was created. | -| | `integer` | The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired. | -| | `integer` | The Unix timestamp (in seconds) for when the run step failed. | -| | `object` | The last error associated with this run step. Will be `null` if there are no errors. | -| | `object` | 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. | -| | `string` | The object type, which is always `thread.run.step`. | -| | `string` | The ID of the [run](/docs/api-reference/runs) that this run step is a part of. | -| | `string` | The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`. | -| | `object` | The details of the run step. | -| | `string` | The ID of the [thread](/docs/api-reference/threads) that was run. | -| | `string` | The type of run step, which can be either `message_creation` or `tool_calls`. | -| | `object` | Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. | + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier of the run step, which can be referenced in API endpoints.
stringThe ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) associated with the run step.
stringThe ID of the [run](https://platform.openai.com/docs/api-reference/runs) that this run step is a part of.
stringThe ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run.
integer (unixtime)The Unix timestamp (in seconds) for when the run step was cancelled.
integer (unixtime)The Unix timestamp (in seconds) for when the run step completed.
integer (unixtime)The Unix timestamp (in seconds) for when the run step was created.
integer (unixtime)The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.
integer (unixtime)The Unix timestamp (in seconds) for when the run step failed.
objectThe last error associated with this run step. Will be `null` if there are no errors.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe object type, which is always `thread.run.step`. (thread.run.step)
stringThe status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`. (in_progress, cancelled, failed, completed, expired)
objectThe details of the run step. (title: Message creation)
stringThe type of run step, which can be either `message_creation` or `tool_calls`. (message_creation, tool_calls)
objectUsage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier of the run step, which can be referenced in API endpoints.
stringThe ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) associated with the run step.
stringThe ID of the [run](https://platform.openai.com/docs/api-reference/runs) that this run step is a part of.
stringThe ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run.
integer (unixtime)The Unix timestamp (in seconds) for when the run step was cancelled.
integer (unixtime)The Unix timestamp (in seconds) for when the run step completed.
integer (unixtime)The Unix timestamp (in seconds) for when the run step was created.
integer (unixtime)The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.
integer (unixtime)The Unix timestamp (in seconds) for when the run step failed.
objectThe last error associated with this run step. Will be `null` if there are no errors.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe object type, which is always `thread.run.step`. (thread.run.step)
stringThe status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`. (in_progress, cancelled, failed, completed, expired)
objectThe details of the run step. (title: Message creation)
stringThe type of run step, which can be either `message_creation` or `tool_calls`. (message_creation, tool_calls)
objectUsage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.
+
+
## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -## `SELECT` examples +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
thread_id, run_id, step_idinclude[], openai-organization, openai-project
thread_id, run_idlimit, order, after, before, include[], openai-organization, openai-project
+## Parameters +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the run the run steps belong to.
stringThe ID of the run step to retrieve.
stringThe ID of the thread the run and run steps belong to.
stringA cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
stringA cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
arrayA list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.
integerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
+ +## `SELECT` examples + + + + +OK ```sql SELECT id, assistant_id, +run_id, +thread_id, cancelled_at, completed_at, created_at, @@ -70,13 +354,52 @@ failed_at, last_error, metadata, object, -run_id, status, step_details, +type, +usage +FROM openai.assistants.run_steps +WHERE thread_id = '{{ thread_id }}' -- required +AND run_id = '{{ run_id }}' -- required +AND step_id = '{{ step_id }}' -- required +AND include[] = '{{ include[] }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +OK + +```sql +SELECT +id, +assistant_id, +run_id, thread_id, +cancelled_at, +completed_at, +created_at, +expired_at, +failed_at, +last_error, +metadata, +object, +status, +step_details, type, usage FROM openai.assistants.run_steps -WHERE run_id = '{{ run_id }}' -AND thread_id = '{{ thread_id }}'; -``` \ No newline at end of file +WHERE thread_id = '{{ thread_id }}' -- required +AND run_id = '{{ run_id }}' -- required +AND "order" = '{{ order }}' +AND after = '{{ after }}' +AND before = '{{ before }}' +AND include[] = '{{ include[] }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/assistants/runs/index.md b/website/docs/services/assistants/runs/index.md index 9c604c3..505927e 100644 --- a/website/docs/services/assistants/runs/index.md +++ b/website/docs/services/assistants/runs/index.md @@ -1,4 +1,4 @@ ---- +--- title: runs hide_title: false hide_table_of_contents: false @@ -15,6 +15,7 @@ image: /img/stackql-openai-provider-featured-image.png --- import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -22,61 +23,461 @@ Creates, updates, deletes, gets or lists a runs resource. ## Overview - +
Nameruns
Name
TypeResource
Id
## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints. | -| | `string` | The ID of the [assistant](/docs/api-reference/assistants) used for execution of this run. | -| | `integer` | The Unix timestamp (in seconds) for when the run was cancelled. | -| | `integer` | The Unix timestamp (in seconds) for when the run was completed. | -| | `integer` | The Unix timestamp (in seconds) for when the run was created. | -| | `integer` | The Unix timestamp (in seconds) for when the run will expire. | -| | `integer` | The Unix timestamp (in seconds) for when the run failed. | -| | `object` | Details on why the run is incomplete. Will be `null` if the run is not incomplete. | -| | `string` | The instructions that the [assistant](/docs/api-reference/assistants) used for this run. | -| | `object` | The last error associated with this run. Will be `null` if there are no errors. | -| | `integer` | The maximum number of completion tokens specified to have been used over the course of the run. | -| | `integer` | The maximum number of prompt tokens specified to have been used over the course of the run. | -| | `object` | 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. | -| | `string` | The model that the [assistant](/docs/api-reference/assistants) used for this run. | -| | `string` | The object type, which is always `thread.run`. | -| | `boolean` | Whether to enable [parallel function calling](/docs/guides/function-calling/parallel-function-calling) during tool use. | -| | `object` | Details on the action required to continue the run. Will be `null` if no action is required. | -| | `` | Specifies the format that the model must output. Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4 Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. Setting 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](/docs/guides/structured-outputs). Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. **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. | -| | `integer` | The Unix timestamp (in seconds) for when the run was started. | -| | `string` | The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. | -| | `number` | The sampling temperature used for this run. If not set, defaults to 1. | -| | `string` | The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run. | -| | `` | Controls which (if any) tool is called by the model. `none` means the model will not call any tools and instead generates a message. `auto` is the default value and 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. Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. | -| | `array` | The list of tools that the [assistant](/docs/api-reference/assistants) used for this run. | -| | `number` | The nucleus sampling value used for this run. If not set, defaults to 1. | -| | `object` | Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run. | -| | `object` | 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.). | + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
stringThe ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for execution of this run.
stringThe ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was executed on as a part of this run.
integer (unixtime)The Unix timestamp (in seconds) for when the run was cancelled.
integer (unixtime)The Unix timestamp (in seconds) for when the run was completed.
integer (unixtime)The Unix timestamp (in seconds) for when the run was created.
integer (unixtime)The Unix timestamp (in seconds) for when the run will expire.
integer (unixtime)The Unix timestamp (in seconds) for when the run failed.
objectDetails on why the run is incomplete. Will be `null` if the run is not incomplete.
stringThe instructions that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run.
objectThe last error associated with this run. Will be `null` if there are no errors.
integerThe maximum number of completion tokens specified to have been used over the course of the run.
integerThe maximum number of prompt tokens specified to have been used over the course of the run.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe model that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run.
stringThe object type, which is always `thread.run`. (thread.run)
booleanWhether to enable [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling) during tool use.
objectDetails on the action required to continue the run. Will be `null` if no action is required.
stringSpecifies the format that the model must output. Compatible with [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. Setting 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://platform.openai.com/docs/guides/structured-outputs). Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. **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. (auto) (title: Text)
integer (unixtime)The Unix timestamp (in seconds) for when the run was started.
stringThe status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. (queued, in_progress, requires_action, cancelling, cancelled, failed, completed, incomplete, expired)
numberThe sampling temperature used for this run. If not set, defaults to 1.
stringControls which (if any) tool is called by the model. `none` means the model will not call any tools and instead generates a message. `auto` is the default value and 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. Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. (none, auto, required)
arrayThe list of tools that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run.
numberThe nucleus sampling value used for this run. If not set, defaults to 1.
objectControls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. (title: Thread Truncation Controls)
objectUsage 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.).
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
stringThe ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for execution of this run.
stringThe ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was executed on as a part of this run.
integer (unixtime)The Unix timestamp (in seconds) for when the run was cancelled.
integer (unixtime)The Unix timestamp (in seconds) for when the run was completed.
integer (unixtime)The Unix timestamp (in seconds) for when the run was created.
integer (unixtime)The Unix timestamp (in seconds) for when the run will expire.
integer (unixtime)The Unix timestamp (in seconds) for when the run failed.
objectDetails on why the run is incomplete. Will be `null` if the run is not incomplete.
stringThe instructions that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run.
objectThe last error associated with this run. Will be `null` if there are no errors.
integerThe maximum number of completion tokens specified to have been used over the course of the run.
integerThe maximum number of prompt tokens specified to have been used over the course of the run.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe model that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run.
stringThe object type, which is always `thread.run`. (thread.run)
booleanWhether to enable [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling) during tool use.
objectDetails on the action required to continue the run. Will be `null` if no action is required.
stringSpecifies the format that the model must output. Compatible with [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. Setting 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://platform.openai.com/docs/guides/structured-outputs). Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. **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. (auto) (title: Text)
integer (unixtime)The Unix timestamp (in seconds) for when the run was started.
stringThe status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. (queued, in_progress, requires_action, cancelling, cancelled, failed, completed, incomplete, expired)
numberThe sampling temperature used for this run. If not set, defaults to 1.
stringControls which (if any) tool is called by the model. `none` means the model will not call any tools and instead generates a message. `auto` is the default value and 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. Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. (none, auto, required)
arrayThe list of tools that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run.
numberThe nucleus sampling value used for this run. If not set, defaults to 1.
objectControls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. (title: Thread Truncation Controls)
objectUsage 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.).
+
+
## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `INSERT` | | | -| | `UPDATE` | | | -| | `EXEC` | | | -| | `EXEC` | | | -## `SELECT` examples +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
thread_id, run_idopenai-organization, openai-project
thread_idlimit, order, after, before, openai-organization, openai-project
thread_id, assistant_idinclude[], openai-organization, openai-project
thread_id, run_idopenai-organization, openai-project
thread_id, run_idopenai-organization, openai-project
thread_id, run_id, tool_outputsopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the run that requires the tool output submission.
stringThe ID of the [thread](https://platform.openai.com/docs/api-reference/threads) to which this run belongs.
stringA cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
stringA cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
arrayA list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.
integerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
+## `SELECT` examples + + +OK ```sql SELECT id, assistant_id, +thread_id, cancelled_at, completed_at, created_at, @@ -96,167 +497,375 @@ response_format, started_at, status, temperature, +tool_choice, +tools, +top_p, +truncation_strategy, +usage +FROM openai.assistants.runs +WHERE thread_id = '{{ thread_id }}' -- required +AND run_id = '{{ run_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +OK + +```sql +SELECT +id, +assistant_id, thread_id, +cancelled_at, +completed_at, +created_at, +expires_at, +failed_at, +incomplete_details, +instructions, +last_error, +max_completion_tokens, +max_prompt_tokens, +metadata, +model, +object, +parallel_tool_calls, +required_action, +response_format, +started_at, +status, +temperature, tool_choice, tools, top_p, truncation_strategy, usage FROM openai.assistants.runs -WHERE thread_id = '{{ thread_id }}'; +WHERE thread_id = '{{ thread_id }}' -- required +AND "order" = '{{ order }}' +AND after = '{{ after }}' +AND before = '{{ before }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; ``` -## `INSERT` example + + + -Use the following StackQL query and manifest file to create a new runs resource. +## `INSERT` examples - + { label: 'create', value: 'create' }, + { label: 'Manifest', value: 'manifest' } + ]} +> + + +No description available. ```sql -/*+ create */ INSERT INTO openai.assistants.runs ( -data__assistant_id, -data__model, -data__instructions, -data__additional_instructions, -data__additional_messages, -data__tools, -data__metadata, -data__temperature, -data__top_p, -data__stream, -data__max_prompt_tokens, -data__max_completion_tokens, -data__truncation_strategy, -data__tool_choice, -data__parallel_tool_calls, -data__response_format, -thread_id +assistant_id, +model, +reasoning_effort, +instructions, +additional_instructions, +additional_messages, +tools, +metadata, +temperature, +top_p, +stream, +max_prompt_tokens, +max_completion_tokens, +truncation_strategy, +tool_choice, +parallel_tool_calls, +response_format, +thread_id, +include[], +"openai-organization", +"openai-project" ) SELECT -'{{ assistant_id }}', +'{{ assistant_id }}' /* required */, '{{ model }}', +'{{ reasoning_effort }}', '{{ instructions }}', '{{ additional_instructions }}', '{{ additional_messages }}', '{{ tools }}', '{{ metadata }}', -'{{ temperature }}', -'{{ top_p }}', -'{{ stream }}', -'{{ max_prompt_tokens }}', -'{{ max_completion_tokens }}', +{{ temperature }}, +{{ top_p }}, +{{ stream }}, +{{ max_prompt_tokens }}, +{{ max_completion_tokens }}, '{{ truncation_strategy }}', '{{ tool_choice }}', -'{{ parallel_tool_calls }}', +{{ parallel_tool_calls }}, '{{ response_format }}', -'{{ thread_id }}' -; -``` - - - - -```sql -/*+ create */ -INSERT INTO openai.assistants.runs ( -data__assistant_id, -thread_id -) -SELECT -'{{ assistant_id }}', -'{{ thread_id }}' +'{{ thread_id }}', +'{{ include[] }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +assistant_id, +thread_id, +cancelled_at, +completed_at, +created_at, +expires_at, +failed_at, +incomplete_details, +instructions, +last_error, +max_completion_tokens, +max_prompt_tokens, +metadata, +model, +object, +parallel_tool_calls, +required_action, +response_format, +started_at, +status, +temperature, +tool_choice, +tools, +top_p, +truncation_strategy, +usage ; ``` - -```yaml +{`# Description fields are for documentation purposes - name: runs props: - name: thread_id - value: string - - name: data__assistant_id - value: string + value: "{{ thread_id }}" + description: Required parameter for the runs resource. - name: assistant_id - value: string + value: "{{ assistant_id }}" + description: | + The ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to execute this run. - name: model - value: string + value: "{{ model }}" + description: | + The ID of the [Model](https://platform.openai.com/docs/api-reference/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. + valid_values: ['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'] + - name: reasoning_effort + value: "{{ reasoning_effort }}" + description: | + Constrains effort on reasoning for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + Currently supported values are \`none\`, \`minimal\`, \`low\`, \`medium\`, \`high\`, and \`xhigh\`. Reducing + reasoning effort can result in faster responses and fewer tokens used + on reasoning in a response. + - \`gpt-5.1\` defaults to \`none\`, which does not perform reasoning. The supported reasoning values for \`gpt-5.1\` are \`none\`, \`low\`, \`medium\`, and \`high\`. Tool calls are supported for all reasoning values in gpt-5.1. + - All models before \`gpt-5.1\` default to \`medium\` reasoning effort, and do not support \`none\`. + - The \`gpt-5-pro\` model defaults to (and only supports) \`high\` reasoning effort. + - \`xhigh\` is supported for all models after \`gpt-5.1-codex-max\`. + valid_values: ['none', 'minimal', 'low', 'medium', 'high', 'xhigh'] + default: medium - name: instructions - value: string + value: "{{ instructions }}" + description: | + Overrides the [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis. - name: additional_instructions - value: string + value: "{{ 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. - name: additional_messages - value: array - props: - - name: role - value: string - - name: content - value: string - - name: attachments - value: array - props: - - name: file_id - value: string - - name: tools - value: array - props: - - name: type - value: string - - name: metadata - value: object + description: | + Adds additional messages to the thread before creating the run. + value: + - role: "{{ role }}" + content: "{{ content }}" + attachments: "{{ attachments }}" + metadata: "{{ metadata }}" - name: tools - value: array - props: - - name: type - value: string + value: "{{ tools }}" + description: | + Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. - name: metadata - value: object + value: "{{ 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. + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. - name: temperature - value: number + value: {{ temperature }} + 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. + default: 1 - name: top_p - value: number + value: {{ top_p }} + 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. + We generally recommend altering this or temperature but not both. + default: 1 - name: stream - value: boolean + value: {{ stream }} + 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. - name: max_prompt_tokens - value: integer + value: {{ max_prompt_tokens }} + 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. - name: max_completion_tokens - value: integer + value: {{ max_completion_tokens }} + 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. - name: truncation_strategy - props: - - name: type - value: string - - name: last_messages - value: integer + description: | + Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. + value: + type: "{{ type }}" + last_messages: {{ last_messages }} - name: tool_choice - value: string + value: "{{ tool_choice }}" + description: | + Controls which (if any) tool is called by the model. + \`none\` means the model will not call any tools and instead generates a message. + \`auto\` is the default value and 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. + Specifying a particular tool like \`{"type": "file_search"}\` or \`{"type": "function", "function": {"name": "my_function"}}\` forces the model to call that tool. + valid_values: ['none', 'auto', 'required'] - name: parallel_tool_calls - value: boolean + value: {{ parallel_tool_calls }} + description: | + Whether to enable [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling) during tool use. + default: true - name: response_format - value: string + value: "{{ response_format }}" + description: | + Specifies the format that the model must output. Compatible with [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since \`gpt-3.5-turbo-1106\`. + Setting 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://platform.openai.com/docs/guides/structured-outputs). + Setting to \`{ "type": "json_object" }\` enables JSON mode, which ensures the message the model generates is valid JSON. + **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. + valid_values: ['auto'] + - name: include[] + value: "{{ include[] }}" + description: A list of additional fields to include in the response. Currently the only supported value is \`step_details.tool_calls[*].file_search.results[*].content\` to fetch the file search result content. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + description: A list of additional fields to include in the response. Currently the only supported value is \`step_details.tool_calls[*].file_search.results[*].content\` to fetch the file search result content. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} -``` -## `UPDATE` example -Updates a runs resource. +## `UPDATE` examples + + + + +No description available. ```sql -/*+ update */ UPDATE openai.assistants.runs SET metadata = '{{ metadata }}' WHERE -run_id = '{{ run_id }}' -AND thread_id = '{{ thread_id }}'; +thread_id = '{{ thread_id }}' --required +AND run_id = '{{ run_id }}' --required +AND "openai-organization" = '{{ openai-organization}}' +AND "openai-project" = '{{ openai-project}}' +RETURNING +id, +assistant_id, +thread_id, +cancelled_at, +completed_at, +created_at, +expires_at, +failed_at, +incomplete_details, +instructions, +last_error, +max_completion_tokens, +max_prompt_tokens, +metadata, +model, +object, +parallel_tool_calls, +required_action, +response_format, +started_at, +status, +temperature, +tool_choice, +tools, +top_p, +truncation_strategy, +usage; ``` + + + + +## Lifecycle Methods + + + + +OK + +```sql +EXEC openai.assistants.runs.cancel +@thread_id='{{ thread_id }}' --required, +@run_id='{{ run_id }}' --required, +@openai-organization='{{ openai-organization }}', +@openai-project='{{ openai-project }}' +; +``` + + + +OK + +```sql +EXEC openai.assistants.runs.submit_tool_outputs +@thread_id='{{ thread_id }}' --required, +@run_id='{{ run_id }}' --required, +@openai-organization='{{ openai-organization }}', +@openai-project='{{ openai-project }}' +@@json= +'{ +"tool_outputs": "{{ tool_outputs }}", +"stream": {{ stream }} +}' +; +``` + + diff --git a/website/docs/services/assistants/threads/index.md b/website/docs/services/assistants/threads/index.md index 04b998d..b3fab8b 100644 --- a/website/docs/services/assistants/threads/index.md +++ b/website/docs/services/assistants/threads/index.md @@ -1,4 +1,4 @@ ---- +--- title: threads hide_title: false hide_table_of_contents: false @@ -15,6 +15,7 @@ image: /img/stackql-openai-provider-featured-image.png --- import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -22,33 +23,157 @@ Creates, updates, deletes, gets or lists a threads resource. ## Overview - +
Namethreads
Name
TypeResource
Id
## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints. | -| | `integer` | The Unix timestamp (in seconds) for when the thread was created. | -| | `object` | 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. | -| | `string` | The object type, which is always `thread`. | -| | `object` | 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. | + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
integer (unixtime)The Unix timestamp (in seconds) for when the thread was created.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe object type, which is always `thread`. (thread)
objectA 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.
+
+
## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `INSERT` | | | -| | `DELETE` | | | -| | `UPDATE` | | | -| | `EXEC` | | | -## `SELECT` examples +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
thread_idopenai-organization, openai-project
openai-organization, openai-project
thread_idopenai-organization, openai-project
thread_idopenai-organization, openai-project
assistant_idopenai-organization, openai-project
+## Parameters +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the thread to delete.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
+ +## `SELECT` examples + + + + +OK ```sql SELECT @@ -58,96 +183,191 @@ metadata, object, tool_resources FROM openai.assistants.threads -WHERE thread_id = '{{ thread_id }}'; +WHERE thread_id = '{{ thread_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; ``` -## `INSERT` example + + -Use the following StackQL query and manifest file to create a new threads resource. + +## `INSERT` examples - + { label: 'create', value: 'create' }, + { label: 'Manifest', value: 'manifest' } + ]} +> + + +No description available. ```sql -/*+ create */ INSERT INTO openai.assistants.threads ( -data__messages, -data__tool_resources, -data__metadata +messages, +tool_resources, +metadata, +"openai-organization", +"openai-project" ) SELECT '{{ messages }}', '{{ tool_resources }}', -'{{ metadata }}' +'{{ metadata }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +created_at, +metadata, +object, +tool_resources ; ``` - -```yaml +{`# Description fields are for documentation purposes - name: threads props: - name: messages - value: array - props: - - name: role - value: string - - name: content - value: string - - name: attachments - value: array - props: - - name: file_id - value: string - - name: tools - value: array - props: - - name: type - value: string - - name: metadata - value: object + description: | + A list of [messages](https://platform.openai.com/docs/api-reference/messages) to start the thread with. + value: + - role: "{{ role }}" + content: "{{ content }}" + attachments: "{{ attachments }}" + metadata: "{{ metadata }}" - name: tool_resources - props: - - name: code_interpreter - props: - - name: file_ids - value: array - - name: file_search - value: string + 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. + value: + code_interpreter: + file_ids: + - "{{ file_ids }}" + file_search: + vector_store_ids: + - "{{ vector_store_ids }}" + vector_stores: + - file_ids: "{{ file_ids }}" + chunking_strategy: "{{ chunking_strategy }}" + metadata: "{{ metadata }}" - name: metadata - value: object + value: "{{ 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. + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} -``` -## `UPDATE` example -Updates a threads resource. +## `UPDATE` examples + + + + +No description available. ```sql -/*+ update */ UPDATE openai.assistants.threads SET tool_resources = '{{ tool_resources }}', metadata = '{{ metadata }}' WHERE -thread_id = '{{ thread_id }}'; +thread_id = '{{ thread_id }}' --required +AND "openai-organization" = '{{ openai-organization}}' +AND "openai-project" = '{{ openai-project}}' +RETURNING +id, +created_at, +metadata, +object, +tool_resources; ``` + + -## `DELETE` example -Deletes the specified threads resource. +## `DELETE` examples + + + + +No description available. ```sql -/*+ delete */ DELETE FROM openai.assistants.threads -WHERE thread_id = '{{ thread_id }}'; +WHERE thread_id = '{{ thread_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; ``` + + + + +## Lifecycle Methods + + + + +OK + +```sql +EXEC openai.assistants.threads.create_thread_and_run +@openai-organization='{{ openai-organization }}', +@openai-project='{{ openai-project }}' +@@json= +'{ +"assistant_id": "{{ assistant_id }}", +"thread": "{{ thread }}", +"model": "{{ model }}", +"instructions": "{{ instructions }}", +"tools": "{{ tools }}", +"tool_resources": "{{ tool_resources }}", +"metadata": "{{ metadata }}", +"temperature": {{ temperature }}, +"top_p": {{ top_p }}, +"stream": {{ stream }}, +"max_prompt_tokens": {{ max_prompt_tokens }}, +"max_completion_tokens": {{ max_completion_tokens }}, +"truncation_strategy": "{{ truncation_strategy }}", +"tool_choice": "{{ tool_choice }}", +"parallel_tool_calls": {{ parallel_tool_calls }}, +"response_format": "{{ response_format }}" +}' +; +``` + + diff --git a/website/docs/services/audio/index.md b/website/docs/services/audio/index.md deleted file mode 100644 index 6afb2e1..0000000 --- a/website/docs/services/audio/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: audio -hide_title: false -hide_table_of_contents: false -keywords: - - audio - - openai - - stackql - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -audio service documentation. - -:::info Service Summary - -
-
-total resources: 3
-
-
- -::: - -## Resources - \ No newline at end of file diff --git a/website/docs/services/audio/speeches/index.md b/website/docs/services/audio/speeches/index.md deleted file mode 100644 index 2602364..0000000 --- a/website/docs/services/audio/speeches/index.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: speeches -hide_title: false -hide_table_of_contents: false -keywords: - - speeches - - audio - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a speeches resource. - -## Overview - - - - -
Namespeeches
TypeResource
Id
- -## Fields -`SELECT` not supported for this resource, use `SHOW METHODS` to view available operations for the resource. - - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `INSERT` | | | - -## `INSERT` example - -Use the following StackQL query and manifest file to create a new speeches resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.audio.speeches ( -data__model, -data__input, -data__voice, -data__response_format, -data__speed -) -SELECT -'{{ model }}', -'{{ input }}', -'{{ voice }}', -'{{ response_format }}', -'{{ speed }}' -; -``` - - - - -```sql -/*+ create */ -INSERT INTO openai.audio.speeches ( -data__model, -data__input, -data__voice -) -SELECT -'{{ model }}', -'{{ input }}', -'{{ voice }}' -; -``` - - - - -```yaml -- name: speeches - props: - - name: data__input - value: string - - name: data__model - value: string - - name: data__voice - value: string - - name: model - value: string - - name: input - value: string - - name: voice - value: string - - name: response_format - value: string - - name: speed - value: number - -``` - - diff --git a/website/docs/services/audio/transcriptions/index.md b/website/docs/services/audio/transcriptions/index.md deleted file mode 100644 index c095f26..0000000 --- a/website/docs/services/audio/transcriptions/index.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: transcriptions -hide_title: false -hide_table_of_contents: false -keywords: - - transcriptions - - audio - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a transcriptions resource. - -## Overview - - - - -
Nametranscriptions
TypeResource
Id
- -## Fields -`SELECT` not supported for this resource, use `SHOW METHODS` to view available operations for the resource. - - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `INSERT` | | | - -## `INSERT` example - -Use the following StackQL query and manifest file to create a new transcriptions resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.audio.transcriptions ( - -) -SELECT - -; -``` - - - - -```yaml -- name: transcriptions - props: [] - -``` - - diff --git a/website/docs/services/audio/translations/index.md b/website/docs/services/audio/translations/index.md deleted file mode 100644 index 4637bd1..0000000 --- a/website/docs/services/audio/translations/index.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: translations -hide_title: false -hide_table_of_contents: false -keywords: - - translations - - audio - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a translations resource. - -## Overview - - - - -
Nametranslations
TypeResource
Id
- -## Fields -`SELECT` not supported for this resource, use `SHOW METHODS` to view available operations for the resource. - - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `INSERT` | | | - -## `INSERT` example - -Use the following StackQL query and manifest file to create a new translations resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.audio.translations ( - -) -SELECT - -; -``` - - - - -```yaml -- name: translations - props: [] - -``` - - diff --git a/website/docs/services/audit_logs/audit_logs/index.md b/website/docs/services/audit_logs/audit_logs/index.md deleted file mode 100644 index 2e1a0e6..0000000 --- a/website/docs/services/audit_logs/audit_logs/index.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: audit_logs -hide_title: false -hide_table_of_contents: false -keywords: - - audit_logs - - audit_logs - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a audit_logs resource. - -## Overview - - - - -
Nameaudit_logs
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The ID of this log. | -| | `object` | The actor who performed the audit logged action. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `integer` | The Unix timestamp (in seconds) of the event. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `object` | The project that the action was scoped to. Absent for actions not scoped to projects. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `string` | The event type. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | -| | `object` | The details for events with this `type`. | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | - -## `SELECT` examples - - - - -```sql -SELECT -id, -actor, -api_key.created, -api_key.deleted, -api_key.updated, -effective_at, -invite.accepted, -invite.deleted, -invite.sent, -login.failed, -logout.failed, -organization.updated, -project, -project.archived, -project.created, -project.updated, -service_account.created, -service_account.deleted, -service_account.updated, -type, -user.added, -user.deleted, -user.updated -FROM openai.audit_logs.audit_logs -; -``` \ No newline at end of file diff --git a/website/docs/services/audit_logs/index.md b/website/docs/services/audit_logs/index.md deleted file mode 100644 index 27db56b..0000000 --- a/website/docs/services/audit_logs/index.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: audit_logs -hide_title: false -hide_table_of_contents: false -keywords: - - audit_logs - - openai - - stackql - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -audit_logs service documentation. - -:::info Service Summary - -
-
-total resources: 1
-
-
- -::: - -## Resources -
- -
- -
-
\ No newline at end of file diff --git a/website/docs/services/batch/batches/index.md b/website/docs/services/batch/batches/index.md deleted file mode 100644 index 3cd627f..0000000 --- a/website/docs/services/batch/batches/index.md +++ /dev/null @@ -1,162 +0,0 @@ ---- -title: batches -hide_title: false -hide_table_of_contents: false -keywords: - - batches - - batch - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a batches resource. - -## Overview - - - - -
Namebatches
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | | -| | `integer` | The Unix timestamp (in seconds) for when the batch was cancelled. | -| | `integer` | The Unix timestamp (in seconds) for when the batch started cancelling. | -| | `integer` | The Unix timestamp (in seconds) for when the batch was completed. | -| | `string` | The time frame within which the batch should be processed. | -| | `integer` | The Unix timestamp (in seconds) for when the batch was created. | -| | `string` | The OpenAI API endpoint used by the batch. | -| | `string` | The ID of the file containing the outputs of requests with errors. | -| | `object` | | -| | `integer` | The Unix timestamp (in seconds) for when the batch expired. | -| | `integer` | The Unix timestamp (in seconds) for when the batch will expire. | -| | `integer` | The Unix timestamp (in seconds) for when the batch failed. | -| | `integer` | The Unix timestamp (in seconds) for when the batch started finalizing. | -| | `integer` | The Unix timestamp (in seconds) for when the batch started processing. | -| | `string` | The ID of the input file for the batch. | -| | `object` | 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. | -| | `string` | The object type, which is always `batch`. | -| | `string` | The ID of the file containing the outputs of successfully executed requests. | -| | `object` | The request counts for different statuses within the batch. | -| | `string` | The current status of the batch. | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `INSERT` | | | -| | `EXEC` | | | - -## `SELECT` examples - - - - -```sql -SELECT -id, -cancelled_at, -cancelling_at, -completed_at, -completion_window, -created_at, -endpoint, -error_file_id, -errors, -expired_at, -expires_at, -failed_at, -finalizing_at, -in_progress_at, -input_file_id, -metadata, -object, -output_file_id, -request_counts, -status -FROM openai.batch.batches -; -``` -## `INSERT` example - -Use the following StackQL query and manifest file to create a new batches resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.batch.batches ( -data__input_file_id, -data__endpoint, -data__completion_window, -data__metadata -) -SELECT -'{{ input_file_id }}', -'{{ endpoint }}', -'{{ completion_window }}', -'{{ metadata }}' -; -``` - - - - -```sql -/*+ create */ -INSERT INTO openai.batch.batches ( -data__input_file_id, -data__endpoint, -data__completion_window -) -SELECT -'{{ input_file_id }}', -'{{ endpoint }}', -'{{ completion_window }}' -; -``` - - - - -```yaml -- name: batches - props: - - name: data__completion_window - value: string - - name: data__endpoint - value: string - - name: data__input_file_id - value: string - - name: input_file_id - value: string - - name: endpoint - value: string - - name: completion_window - value: string - - name: metadata - value: object - -``` - - diff --git a/website/docs/services/batches/batches/index.md b/website/docs/services/batches/batches/index.md new file mode 100644 index 0000000..74e3693 --- /dev/null +++ b/website/docs/services/batches/batches/index.md @@ -0,0 +1,591 @@ +--- +title: batches +hide_title: false +hide_table_of_contents: false +keywords: + - batches + - batches + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a batches resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + +Batch retrieved successfully. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
string
stringThe ID of the file containing the outputs of requests with errors.
stringThe ID of the input file for the batch.
stringThe ID of the file containing the outputs of successfully executed requests.
integer (unixtime)The Unix timestamp (in seconds) for when the batch was cancelled.
integer (unixtime)The Unix timestamp (in seconds) for when the batch started cancelling.
integer (unixtime)The Unix timestamp (in seconds) for when the batch was completed.
stringThe time frame within which the batch should be processed.
integer (unixtime)The Unix timestamp (in seconds) for when the batch was created.
stringThe OpenAI API endpoint used by the batch.
object
integer (unixtime)The Unix timestamp (in seconds) for when the batch expired.
integer (unixtime)The Unix timestamp (in seconds) for when the batch will expire.
integer (unixtime)The Unix timestamp (in seconds) for when the batch failed.
integer (unixtime)The Unix timestamp (in seconds) for when the batch started finalizing.
integer (unixtime)The Unix timestamp (in seconds) for when the batch started processing.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringModel ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://platform.openai.com/docs/models) to browse and compare available models.
stringThe object type, which is always `batch`. (batch)
objectThe request counts for different statuses within the batch.
stringThe current status of the batch. (validating, failed, in_progress, finalizing, completed, expired, cancelling, cancelled)
objectRepresents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used. Only populated on batches created after September 7, 2025.
+
+ + +Batch listed successfully. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
string
stringThe ID of the file containing the outputs of requests with errors.
stringThe ID of the input file for the batch.
stringThe ID of the file containing the outputs of successfully executed requests.
integer (unixtime)The Unix timestamp (in seconds) for when the batch was cancelled.
integer (unixtime)The Unix timestamp (in seconds) for when the batch started cancelling.
integer (unixtime)The Unix timestamp (in seconds) for when the batch was completed.
stringThe time frame within which the batch should be processed.
integer (unixtime)The Unix timestamp (in seconds) for when the batch was created.
stringThe OpenAI API endpoint used by the batch.
object
integer (unixtime)The Unix timestamp (in seconds) for when the batch expired.
integer (unixtime)The Unix timestamp (in seconds) for when the batch will expire.
integer (unixtime)The Unix timestamp (in seconds) for when the batch failed.
integer (unixtime)The Unix timestamp (in seconds) for when the batch started finalizing.
integer (unixtime)The Unix timestamp (in seconds) for when the batch started processing.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringModel ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://platform.openai.com/docs/models) to browse and compare available models.
stringThe object type, which is always `batch`. (batch)
objectThe request counts for different statuses within the batch.
stringThe current status of the batch. (validating, failed, in_progress, finalizing, completed, expired, cancelling, cancelled)
objectRepresents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used. Only populated on batches created after September 7, 2025.
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
batch_idopenai-organization, openai-project
after, limit, openai-organization, openai-project
input_file_id, endpoint, completion_windowopenai-organization, openai-project
batch_idopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the batch to cancel.
stringA cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
integerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
+ +## `SELECT` examples + + + + +Batch retrieved successfully. + +```sql +SELECT +id, +error_file_id, +input_file_id, +output_file_id, +cancelled_at, +cancelling_at, +completed_at, +completion_window, +created_at, +endpoint, +errors, +expired_at, +expires_at, +failed_at, +finalizing_at, +in_progress_at, +metadata, +model, +object, +request_counts, +status, +usage +FROM openai.batches.batches +WHERE batch_id = '{{ batch_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +Batch listed successfully. + +```sql +SELECT +id, +error_file_id, +input_file_id, +output_file_id, +cancelled_at, +cancelling_at, +completed_at, +completion_window, +created_at, +endpoint, +errors, +expired_at, +expires_at, +failed_at, +finalizing_at, +in_progress_at, +metadata, +model, +object, +request_counts, +status, +usage +FROM openai.batches.batches +WHERE after = '{{ after }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## `INSERT` examples + + + + +No description available. + +```sql +INSERT INTO openai.batches.batches ( +input_file_id, +endpoint, +completion_window, +metadata, +output_expires_after, +"openai-organization", +"openai-project" +) +SELECT +'{{ input_file_id }}' /* required */, +'{{ endpoint }}' /* required */, +'{{ completion_window }}' /* required */, +'{{ metadata }}', +'{{ output_expires_after }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +error_file_id, +input_file_id, +output_file_id, +cancelled_at, +cancelling_at, +completed_at, +completion_window, +created_at, +endpoint, +errors, +expired_at, +expires_at, +failed_at, +finalizing_at, +in_progress_at, +metadata, +model, +object, +request_counts, +status, +usage +; +``` + + + +{`# Description fields are for documentation purposes +- name: batches + props: + - name: input_file_id + value: "{{ input_file_id }}" + description: | + The ID of an uploaded file that contains requests for the new batch. + See [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file. + Your input file must be formatted as a [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input), 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. + - name: endpoint + value: "{{ endpoint }}" + 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. + valid_values: ['/v1/responses', '/v1/chat/completions', '/v1/embeddings', '/v1/completions', '/v1/moderations', '/v1/images/generations', '/v1/images/edits', '/v1/videos'] + - name: completion_window + value: "{{ completion_window }}" + description: | + The time frame within which the batch should be processed. Currently only \`24h\` is supported. + valid_values: ['24h'] + - name: metadata + value: "{{ 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. + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + - name: output_expires_after + description: | + The expiration policy for the output and/or error file that are generated for a batch. + value: + anchor: "{{ anchor }}" + seconds: {{ seconds }} + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} + + + + + +## Lifecycle Methods + + + + +Batch is cancelling. Returns the cancelling batch's details. + +```sql +EXEC openai.batches.batches.cancel +@batch_id='{{ batch_id }}' --required, +@openai-organization='{{ openai-organization }}', +@openai-project='{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/users/index.md b/website/docs/services/batches/index.md similarity index 64% rename from website/docs/services/users/index.md rename to website/docs/services/batches/index.md index 2810da0..0a68ee0 100644 --- a/website/docs/services/users/index.md +++ b/website/docs/services/batches/index.md @@ -1,9 +1,9 @@ --- -title: users +title: batches hide_title: false hide_table_of_contents: false keywords: - - users + - batches - openai - stackql - infrastructure-as-code @@ -14,22 +14,18 @@ custom_edit_url: null image: /img/stackql-openai-provider-featured-image.png --- -users service documentation. +batches service documentation. -:::info Service Summary +:::info[Service Summary] -
-
-total resources: 1
-
-
+total resources: __1__ ::: ## Resources
diff --git a/website/docs/services/chat/completions/index.md b/website/docs/services/chat/completions/index.md deleted file mode 100644 index 7cd5933..0000000 --- a/website/docs/services/chat/completions/index.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: completions -hide_title: false -hide_table_of_contents: false -keywords: - - completions - - chat - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a completions resource. - -## Overview - - - - -
Namecompletions
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | A unique identifier for the chat completion. | -| | `array` | A list of chat completion choices. Can be more than one if `n` is greater than 1. | -| | `integer` | The Unix timestamp (in seconds) of when the chat completion was created. | -| | `string` | The model used for the chat completion. | -| | `string` | The object type, which is always `chat.completion`. | -| | `string` | The service tier used for processing the request. This field is only included if the `service_tier` parameter is specified in the request. | -| | `string` | This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. | -| | `object` | Usage statistics for the completion request. | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | - -## `SELECT` examples - - - - -```sql -SELECT -id, -choices, -created, -model, -object, -service_tier, -system_fingerprint, -usage -FROM openai.chat.completions -WHERE data__messages = '{{ data__messages }}' -AND data__model = '{{ data__model }}'; -``` \ No newline at end of file diff --git a/website/docs/services/completions/completions/index.md b/website/docs/services/completions/completions/index.md deleted file mode 100644 index 6922f3c..0000000 --- a/website/docs/services/completions/completions/index.md +++ /dev/null @@ -1,163 +0,0 @@ ---- -title: completions -hide_title: false -hide_table_of_contents: false -keywords: - - completions - - completions - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a completions resource. - -## Overview - - - - -
Namecompletions
TypeResource
Id
- -## Fields -`SELECT` not supported for this resource, use `SHOW METHODS` to view available operations for the resource. - - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `INSERT` | | | - -## `INSERT` example - -Use the following StackQL query and manifest file to create a new completions resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.completions.completions ( -data__model, -data__prompt, -data__best_of, -data__echo, -data__frequency_penalty, -data__logit_bias, -data__logprobs, -data__max_tokens, -data__n, -data__presence_penalty, -data__seed, -data__stop, -data__stream, -data__stream_options, -data__suffix, -data__temperature, -data__top_p, -data__user -) -SELECT -'{{ model }}', -'{{ prompt }}', -'{{ best_of }}', -'{{ echo }}', -'{{ frequency_penalty }}', -'{{ logit_bias }}', -'{{ logprobs }}', -'{{ max_tokens }}', -'{{ n }}', -'{{ presence_penalty }}', -'{{ seed }}', -'{{ stop }}', -'{{ stream }}', -'{{ stream_options }}', -'{{ suffix }}', -'{{ temperature }}', -'{{ top_p }}', -'{{ user }}' -; -``` - - - - -```sql -/*+ create */ -INSERT INTO openai.completions.completions ( -data__model, -data__prompt -) -SELECT -'{{ model }}', -'{{ prompt }}' -; -``` - - - - -```yaml -- name: completions - props: - - name: data__model - value: string - - name: data__prompt - value: string - - name: model - value: string - - name: prompt - value: string - - name: best_of - value: integer - - name: echo - value: boolean - - name: frequency_penalty - value: number - - name: logit_bias - value: object - - name: logprobs - value: integer - - name: max_tokens - value: integer - - name: 'n' - value: integer - - name: presence_penalty - value: number - - name: seed - value: integer - - name: stop - value: string - - name: stream - value: boolean - - name: stream_options - props: - - name: include_usage - value: boolean - - name: suffix - value: string - - name: temperature - value: number - - name: top_p - value: number - - name: user - value: string - -``` - - diff --git a/website/docs/services/completions/index.md b/website/docs/services/completions/index.md deleted file mode 100644 index 17dc9b9..0000000 --- a/website/docs/services/completions/index.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: completions -hide_title: false -hide_table_of_contents: false -keywords: - - completions - - openai - - stackql - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -completions service documentation. - -:::info Service Summary - -
-
-total resources: 1
-
-
- -::: - -## Resources -
- -
- -
-
\ No newline at end of file diff --git a/website/docs/services/containers/containers/index.md b/website/docs/services/containers/containers/index.md new file mode 100644 index 0000000..a308fda --- /dev/null +++ b/website/docs/services/containers/containers/index.md @@ -0,0 +1,437 @@ +--- +title: containers +hide_title: false +hide_table_of_contents: false +keywords: + - containers + - containers + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a containers resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the container.
stringName of the container.
integer (unixtime)Unix timestamp (in seconds) when the container was created.
objectThe container will expire after this time period. The anchor is the reference point for the expiration. The minutes is the number of minutes after the anchor before the container expires.
integer (unixtime)Unix timestamp (in seconds) when the container was last active.
stringThe memory limit configured for the container. (1g, 4g, 16g, 64g)
objectNetwork access policy for the container.
stringThe type of this object.
stringStatus of the container (e.g., active, deleted).
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the container.
stringName of the container.
integer (unixtime)Unix timestamp (in seconds) when the container was created.
objectThe container will expire after this time period. The anchor is the reference point for the expiration. The minutes is the number of minutes after the anchor before the container expires.
integer (unixtime)Unix timestamp (in seconds) when the container was last active.
stringThe memory limit configured for the container. (1g, 4g, 16g, 64g)
objectNetwork access policy for the container.
stringThe type of this object.
stringStatus of the container (e.g., active, deleted).
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
container_idopenai-organization, openai-projectRetrieves a container.
limit, order, after, name, openai-organization, openai-projectLists containers.
nameopenai-organization, openai-projectCreates a container.
container_idopenai-organization, openai-projectDelete a container.
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the container to delete.
stringA cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
integerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringFilter results by container name.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
+ +## `SELECT` examples + + + + +Retrieves a container. + +```sql +SELECT +id, +name, +created_at, +expires_after, +last_active_at, +memory_limit, +network_policy, +object, +status +FROM openai.containers.containers +WHERE container_id = '{{ container_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +Lists containers. + +```sql +SELECT +id, +name, +created_at, +expires_after, +last_active_at, +memory_limit, +network_policy, +object, +status +FROM openai.containers.containers +WHERE "order" = '{{ order }}' +AND after = '{{ after }}' +AND name = '{{ name }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## `INSERT` examples + + + + +Creates a container. + +```sql +INSERT INTO openai.containers.containers ( +name, +file_ids, +expires_after, +skills, +memory_limit, +network_policy, +"openai-organization", +"openai-project" +) +SELECT +'{{ name }}' /* required */, +'{{ file_ids }}', +'{{ expires_after }}', +'{{ skills }}', +'{{ memory_limit }}', +'{{ network_policy }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +name, +created_at, +expires_after, +last_active_at, +memory_limit, +network_policy, +object, +status +; +``` + + + +{`# Description fields are for documentation purposes +- name: containers + props: + - name: name + value: "{{ name }}" + description: | + Name of the container to create. + - name: file_ids + value: + - "{{ file_ids }}" + description: | + IDs of files to copy to the container. + - name: expires_after + description: | + Container expiration time in seconds relative to the 'anchor' time. + value: + anchor: "{{ anchor }}" + minutes: {{ minutes }} + - name: skills + value: "{{ skills }}" + description: | + An optional list of skills referenced by id or inline data. + - name: memory_limit + value: "{{ memory_limit }}" + description: | + Optional memory limit for the container. Defaults to "1g". + valid_values: ['1g', '4g', '16g', '64g'] + - name: network_policy + description: | + Network access policy for the container. + value: + type: "{{ type }}" + allowed_domains: + - "{{ allowed_domains }}" + domain_secrets: + - domain: "{{ domain }}" + name: "{{ name }}" + value: "{{ value }}" + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} + + + + + +## `DELETE` examples + + + + +Delete a container. + +```sql +DELETE FROM openai.containers.containers +WHERE container_id = '{{ container_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/containers/files/index.md b/website/docs/services/containers/files/index.md new file mode 100644 index 0000000..97087b0 --- /dev/null +++ b/website/docs/services/containers/files/index.md @@ -0,0 +1,377 @@ +--- +title: files +hide_title: false +hide_table_of_contents: false +keywords: + - files + - containers + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a files resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the file.
stringThe container this file belongs to.
integerSize of the file in bytes.
integer (unixtime)Unix timestamp (in seconds) when the file was created.
stringThe type of this object (`container.file`).
stringPath of the file in the container.
stringSource of the file (e.g., `user`, `assistant`).
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the file.
stringThe container this file belongs to.
integerSize of the file in bytes.
integer (unixtime)Unix timestamp (in seconds) when the file was created.
stringThe type of this object (`container.file`).
stringPath of the file in the container.
stringSource of the file (e.g., `user`, `assistant`).
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
container_id, file_idopenai-organization, openai-projectRetrieves a container file.
container_idlimit, order, after, openai-organization, openai-projectLists container files.
container_idopenai-organization, openai-projectCreates a container file.
container_id, file_idopenai-organization, openai-projectDelete a container file.
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
string
string
stringA cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
integerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
+ +## `SELECT` examples + + + + +Retrieves a container file. + +```sql +SELECT +id, +container_id, +bytes, +created_at, +object, +path, +source +FROM openai.containers.files +WHERE container_id = '{{ container_id }}' -- required +AND file_id = '{{ file_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +Lists container files. + +```sql +SELECT +id, +container_id, +bytes, +created_at, +object, +path, +source +FROM openai.containers.files +WHERE container_id = '{{ container_id }}' -- required +AND "order" = '{{ order }}' +AND after = '{{ after }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## `INSERT` examples + + + + +Creates a container file.
+ +```sql +INSERT INTO openai.containers.files ( +file_id, +container_id, +"openai-organization", +"openai-project" +) +SELECT +'{{ file_id }}', +'{{ container_id }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +container_id, +bytes, +created_at, +object, +path, +source +; +``` +
+ + +{`# Description fields are for documentation purposes +- name: files + props: + - name: container_id + value: "{{ container_id }}" + description: Required parameter for the files resource. + - name: file_id + value: "{{ file_id }}" + description: | + Name of the file to create. + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} + + +
+ + +## `DELETE` examples + + + + +Delete a container file. + +```sql +DELETE FROM openai.containers.files +WHERE container_id = '{{ container_id }}' --required +AND file_id = '{{ file_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/batch/index.md b/website/docs/services/containers/index.md similarity index 64% rename from website/docs/services/batch/index.md rename to website/docs/services/containers/index.md index 06f7eeb..a49d1fc 100644 --- a/website/docs/services/batch/index.md +++ b/website/docs/services/containers/index.md @@ -1,9 +1,9 @@ --- -title: batch +title: containers hide_title: false hide_table_of_contents: false keywords: - - batch + - containers - openai - stackql - infrastructure-as-code @@ -14,24 +14,20 @@ custom_edit_url: null image: /img/stackql-openai-provider-featured-image.png --- -batch service documentation. +containers service documentation. -:::info Service Summary +:::info[Service Summary] -
-
-total resources: 1
-
-
+total resources: __2__ ::: ## Resources \ No newline at end of file diff --git a/website/docs/services/conversations/conversations/index.md b/website/docs/services/conversations/conversations/index.md new file mode 100644 index 0000000..4883589 --- /dev/null +++ b/website/docs/services/conversations/conversations/index.md @@ -0,0 +1,349 @@ +--- +title: conversations +hide_title: false +hide_table_of_contents: false +keywords: + - conversations + - conversations + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a conversations resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe unique ID of the conversation.
integer (unixtime)The time at which the conversation was created, measured in seconds since the Unix epoch.
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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
stringThe object type, which is always `conversation`. (conversation) (default: conversation)
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
conversation_idopenai-organization, openai-project
openai-organization, openai-project
conversation_id, metadataopenai-organization, openai-project
conversation_idopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the conversation to delete.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
+ +## `SELECT` examples + + + + +Success + +```sql +SELECT +id, +created_at, +metadata, +object +FROM openai.conversations.conversations +WHERE conversation_id = '{{ conversation_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## `INSERT` examples + + + + +No description available. + +```sql +INSERT INTO openai.conversations.conversations ( +metadata, +items, +"openai-organization", +"openai-project" +) +SELECT +'{{ metadata }}', +'{{ items }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +created_at, +metadata, +object +; +``` + + + +{`# Description fields are for documentation purposes +- name: conversations + props: + - name: metadata + value: "{{ 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. + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + - name: items + description: | + Initial items to include in the conversation context. You may add up to 20 items at a time. + value: + - role: "{{ role }}" + content: "{{ content }}" + phase: "{{ phase }}" + type: "{{ type }}" + status: "{{ status }}" + id: "{{ id }}" + queries: "{{ queries }}" + results: "{{ results }}" + call_id: "{{ call_id }}" + action: + type: "{{ type }}" + button: "{{ button }}" + x: {{ x }} + y: {{ y }} + keys: + - "{{ keys }}" + path: + - x: {{ x }} + y: {{ y }} + scroll_x: {{ scroll_x }} + scroll_y: {{ scroll_y }} + text: "{{ text }}" + actions: "{{ actions }}" + pending_safety_checks: "{{ pending_safety_checks }}" + output: + type: "{{ type }}" + image_url: "{{ image_url }}" + file_id: "{{ file_id }}" + acknowledged_safety_checks: "{{ acknowledged_safety_checks }}" + namespace: "{{ namespace }}" + name: "{{ name }}" + arguments: "{{ arguments }}" + execution: "{{ execution }}" + tools: "{{ tools }}" + encrypted_content: "{{ encrypted_content }}" + summary: "{{ summary }}" + result: "{{ result }}" + container_id: "{{ container_id }}" + code: "{{ code }}" + outputs: "{{ outputs }}" + environment: "{{ environment }}" + max_output_length: {{ max_output_length }} + operation: + type: "{{ type }}" + path: "{{ path }}" + diff: "{{ diff }}" + server_label: "{{ server_label }}" + error: "{{ error }}" + approval_request_id: "{{ approval_request_id }}" + approve: {{ approve }} + reason: "{{ reason }}" + input: "{{ input }}" + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} + + + + + +## `UPDATE` examples + + + + +No description available. + +```sql +UPDATE openai.conversations.conversations +SET +metadata = '{{ metadata }}' +WHERE +conversation_id = '{{ conversation_id }}' --required +AND metadata = '{{ metadata }}' --required +AND "openai-organization" = '{{ openai-organization}}' +AND "openai-project" = '{{ openai-project}}' +RETURNING +id, +created_at, +metadata, +object; +``` + + + + +## `DELETE` examples + + + + +No description available. + +```sql +DELETE FROM openai.conversations.conversations +WHERE conversation_id = '{{ conversation_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/conversations/index.md b/website/docs/services/conversations/index.md new file mode 100644 index 0000000..fa0bc59 --- /dev/null +++ b/website/docs/services/conversations/index.md @@ -0,0 +1,33 @@ +--- +title: conversations +hide_title: false +hide_table_of_contents: false +keywords: + - conversations + - openai + - stackql + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +conversations service documentation. + +:::info[Service Summary] + +total resources: __2__ + +::: + +## Resources +
+ +
+items +
+
\ No newline at end of file diff --git a/website/docs/services/conversations/items/index.md b/website/docs/services/conversations/items/index.md new file mode 100644 index 0000000..7eb3665 --- /dev/null +++ b/website/docs/services/conversations/items/index.md @@ -0,0 +1,776 @@ +--- +title: items +hide_title: false +hide_table_of_contents: false +keywords: + - items + - conversations + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists an items resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe unique ID of the message.
stringThe name of the function to run.
stringThe ID of the approval request being answered.
stringThe unique ID of the function tool call generated by the model.
stringThe ID of the container used to run the code.
arrayThe safety checks reported by the API that have been acknowledged by the developer.
objectAn object describing the specific action taken in this web search call. Includes details on how the model used the web (search, open_page, find_in_page). (title: Search action)
arrayFlattened batched actions for `computer_use`. Each action includes an `type` discriminator and action-specific fields. (title: Computer Action List)
booleanWhether the request was approved.
stringA JSON string of the arguments to pass to the function.
stringThe code to run, or null if not available.
arrayThe content of the message
stringThe identifier of the actor that created the item.
stringThe encrypted content of the reasoning item - populated when a response is generated with `reasoning.encrypted_content` in the `include` parameter.
string (json)
stringError message if the server could not list tools.
stringWhether tool search was executed by the server or by the client. (server, client)
stringThe input for the custom tool call generated by the model.
integerThe maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.
stringThe namespace of the function to run.
objectOne of the create_file, delete_file, or update_file operations applied via apply_patch. (title: Apply patch operation)
stringThe output from the function call generated by your code. Can be a string or an list of output content. (title: string output)
arrayThe outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.
arrayThe pending safety checks for the computer call.
string (commentary, final_answer)
arrayThe queries used to search for files.
stringOptional reason for the decision.
stringThe generated image encoded in base64.
arrayThe results of the file search tool call.
stringThe role of the message. One of `unknown`, `user`, `assistant`, `system`, `critic`, `discriminator`, `developer`, or `tool`. (unknown, user, assistant, system, critic, discriminator, developer, tool)
stringThe label of the MCP server.
stringThe status of item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API. (in_progress, completed, incomplete)
arrayReasoning summary content.
arrayThe loaded tool definitions returned by tool search.
stringThe type of the message. Always set to `message`. (message) (default: message)
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe unique ID of the message.
stringThe name of the function to run.
stringThe ID of the approval request being answered.
stringThe unique ID of the function tool call generated by the model.
stringThe ID of the container used to run the code.
arrayThe safety checks reported by the API that have been acknowledged by the developer.
objectAn object describing the specific action taken in this web search call. Includes details on how the model used the web (search, open_page, find_in_page). (title: Search action)
arrayFlattened batched actions for `computer_use`. Each action includes an `type` discriminator and action-specific fields. (title: Computer Action List)
booleanWhether the request was approved.
stringA JSON string of the arguments to pass to the function.
stringThe code to run, or null if not available.
arrayThe content of the message
stringThe identifier of the actor that created the item.
stringThe encrypted content of the reasoning item - populated when a response is generated with `reasoning.encrypted_content` in the `include` parameter.
string (json)
stringError message if the server could not list tools.
stringWhether tool search was executed by the server or by the client. (server, client)
stringThe input for the custom tool call generated by the model.
integerThe maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.
stringThe namespace of the function to run.
objectOne of the create_file, delete_file, or update_file operations applied via apply_patch. (title: Apply patch operation)
stringThe output from the function call generated by your code. Can be a string or an list of output content. (title: string output)
arrayThe outputs generated by the code interpreter, such as logs or images. Can be null if no outputs are available.
arrayThe pending safety checks for the computer call.
string (commentary, final_answer)
arrayThe queries used to search for files.
stringOptional reason for the decision.
stringThe generated image encoded in base64.
arrayThe results of the file search tool call.
stringThe role of the message. One of `unknown`, `user`, `assistant`, `system`, `critic`, `discriminator`, `developer`, or `tool`. (unknown, user, assistant, system, critic, discriminator, developer, tool)
stringThe label of the MCP server.
stringThe status of item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API. (in_progress, completed, incomplete)
arrayReasoning summary content.
arrayThe loaded tool definitions returned by tool search.
stringThe type of the message. Always set to `message`. (message) (default: message)
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
conversation_id, item_idinclude, openai-organization, openai-project
conversation_idlimit, order, after, include, openai-organization, openai-project
conversation_id, itemsinclude, openai-organization, openai-project
conversation_id, item_idopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the conversation that contains the item.
stringThe ID of the item to delete.
stringAn item ID to list items after, used in pagination.
arrayAdditional fields to include in the response. See the `include` parameter for [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include) for more information.
integerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringThe order to return the input items in. Default is `desc`. - `asc`: Return the input items in ascending order. - `desc`: Return the input items in descending order.
+ +## `SELECT` examples + + + + +OK + +```sql +SELECT +id, +name, +approval_request_id, +call_id, +container_id, +acknowledged_safety_checks, +action, +actions, +approve, +arguments, +code, +content, +created_by, +encrypted_content, +environment, +error, +execution, +input, +max_output_length, +namespace, +operation, +output, +outputs, +pending_safety_checks, +phase, +queries, +reason, +result, +results, +role, +server_label, +status, +summary, +tools, +type +FROM openai.conversations.items +WHERE conversation_id = '{{ conversation_id }}' -- required +AND item_id = '{{ item_id }}' -- required +AND include = '{{ include }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +OK + +```sql +SELECT +id, +name, +approval_request_id, +call_id, +container_id, +acknowledged_safety_checks, +action, +actions, +approve, +arguments, +code, +content, +created_by, +encrypted_content, +environment, +error, +execution, +input, +max_output_length, +namespace, +operation, +output, +outputs, +pending_safety_checks, +phase, +queries, +reason, +result, +results, +role, +server_label, +status, +summary, +tools, +type +FROM openai.conversations.items +WHERE conversation_id = '{{ conversation_id }}' -- required +AND "order" = '{{ order }}' +AND after = '{{ after }}' +AND include = '{{ include }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## `INSERT` examples + + + + +No description available. + +```sql +INSERT INTO openai.conversations.items ( +items, +conversation_id, +include, +"openai-organization", +"openai-project" +) +SELECT +'{{ items }}' /* required */, +'{{ conversation_id }}', +'{{ include }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +first_id, +last_id, +data, +has_more, +object +; +``` + + + +{`# Description fields are for documentation purposes +- name: items + props: + - name: conversation_id + value: "{{ conversation_id }}" + description: Required parameter for the items resource. + - name: items + description: | + The items to add to the conversation. You may add up to 20 items at a time. + value: + - role: "{{ role }}" + content: "{{ content }}" + phase: "{{ phase }}" + type: "{{ type }}" + status: "{{ status }}" + id: "{{ id }}" + queries: "{{ queries }}" + results: "{{ results }}" + call_id: "{{ call_id }}" + action: + type: "{{ type }}" + button: "{{ button }}" + x: {{ x }} + y: {{ y }} + keys: + - "{{ keys }}" + path: + - x: {{ x }} + y: {{ y }} + scroll_x: {{ scroll_x }} + scroll_y: {{ scroll_y }} + text: "{{ text }}" + actions: "{{ actions }}" + pending_safety_checks: "{{ pending_safety_checks }}" + output: + type: "{{ type }}" + image_url: "{{ image_url }}" + file_id: "{{ file_id }}" + acknowledged_safety_checks: "{{ acknowledged_safety_checks }}" + namespace: "{{ namespace }}" + name: "{{ name }}" + arguments: "{{ arguments }}" + execution: "{{ execution }}" + tools: "{{ tools }}" + encrypted_content: "{{ encrypted_content }}" + summary: "{{ summary }}" + result: "{{ result }}" + container_id: "{{ container_id }}" + code: "{{ code }}" + outputs: "{{ outputs }}" + environment: "{{ environment }}" + max_output_length: {{ max_output_length }} + operation: + type: "{{ type }}" + path: "{{ path }}" + diff: "{{ diff }}" + server_label: "{{ server_label }}" + error: "{{ error }}" + approval_request_id: "{{ approval_request_id }}" + approve: {{ approve }} + reason: "{{ reason }}" + input: "{{ input }}" + - name: include + value: "{{ include }}" + description: Additional fields to include in the response. See the \`include\` parameter for [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include) for more information. + description: Additional fields to include in the response. See the \`include\` parameter for [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include) for more information. + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} + + + + + +## `DELETE` examples + + + + +No description available. + +```sql +DELETE FROM openai.conversations.items +WHERE conversation_id = '{{ conversation_id }}' --required +AND item_id = '{{ item_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/embeddings/embeddings/index.md b/website/docs/services/embeddings/embeddings/index.md deleted file mode 100644 index 6963c9c..0000000 --- a/website/docs/services/embeddings/embeddings/index.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -title: embeddings -hide_title: false -hide_table_of_contents: false -keywords: - - embeddings - - embeddings - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a embeddings resource. - -## Overview - - - - -
Nameembeddings
TypeResource
Id
- -## Fields -`SELECT` not supported for this resource, use `SHOW METHODS` to view available operations for the resource. - - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `INSERT` | | | - -## `INSERT` example - -Use the following StackQL query and manifest file to create a new embeddings resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.embeddings.embeddings ( -data__input, -data__model, -data__encoding_format, -data__dimensions, -data__user -) -SELECT -'{{ input }}', -'{{ model }}', -'{{ encoding_format }}', -'{{ dimensions }}', -'{{ user }}' -; -``` - - - - -```sql -/*+ create */ -INSERT INTO openai.embeddings.embeddings ( -data__model, -data__input -) -SELECT -'{{ model }}', -'{{ input }}' -; -``` - - - - -```yaml -- name: embeddings - props: - - name: data__input - value: string - - name: data__model - value: string - - name: input - value: string - - name: model - value: string - - name: encoding_format - value: string - - name: dimensions - value: integer - - name: user - value: string - -``` - - diff --git a/website/docs/services/evals/evals/index.md b/website/docs/services/evals/evals/index.md new file mode 100644 index 0000000..81cc444 --- /dev/null +++ b/website/docs/services/evals/evals/index.md @@ -0,0 +1,441 @@ +--- +title: evals +hide_title: false +hide_table_of_contents: false +keywords: + - evals + - evals + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists an evals resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + +The evaluation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the evaluation.
stringThe name of the evaluation. (example: Chatbot effectiveness Evaluation)
integer (unixtime)The Unix timestamp (in seconds) for when the eval was created.
objectConfiguration of data sources used in runs of the evaluation. (title: CustomDataSourceConfig)
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe object type. (eval) (default: eval)
arrayA list of testing criteria. (default: eval)
+
+ + +A list of evals + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the evaluation.
stringThe name of the evaluation. (example: Chatbot effectiveness Evaluation)
integer (unixtime)The Unix timestamp (in seconds) for when the eval was created.
objectConfiguration of data sources used in runs of the evaluation. (title: CustomDataSourceConfig)
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe object type. (eval) (default: eval)
arrayA list of testing criteria. (default: eval)
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
eval_idopenai-organization, openai-project
after, limit, order, order_by, openai-organization, openai-project
data_source_config, testing_criteriaopenai-organization, openai-project
eval_idopenai-organization, openai-project
eval_idopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the evaluation to delete.
stringIdentifier for the last eval from the previous pagination request.
integerNumber of evals to retrieve. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order for evals by timestamp. Use `asc` for ascending order or `desc` for descending order.
stringEvals can be ordered by creation time or last updated time. Use `created_at` for creation time or `updated_at` for last updated time.
+ +## `SELECT` examples + + + + +The evaluation + +```sql +SELECT +id, +name, +created_at, +data_source_config, +metadata, +object, +testing_criteria +FROM openai.evals.evals +WHERE eval_id = '{{ eval_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +A list of evals + +```sql +SELECT +id, +name, +created_at, +data_source_config, +metadata, +object, +testing_criteria +FROM openai.evals.evals +WHERE after = '{{ after }}' +AND "order" = '{{ order }}' +AND order_by = '{{ order_by }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## `INSERT` examples + + + + +No description available. + +```sql +INSERT INTO openai.evals.evals ( +name, +metadata, +data_source_config, +testing_criteria, +"openai-organization", +"openai-project" +) +SELECT +'{{ name }}', +'{{ metadata }}', +'{{ data_source_config }}' /* required */, +'{{ testing_criteria }}' /* required */, +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +name, +created_at, +data_source_config, +metadata, +object, +testing_criteria +; +``` + + + +{`# Description fields are for documentation purposes +- name: evals + props: + - name: name + value: "{{ name }}" + description: | + The name of the evaluation. + - name: metadata + value: "{{ 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. + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + - name: data_source_config + description: | + The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation. + value: + type: "{{ type }}" + item_schema: "{{ item_schema }}" + include_sample_schema: {{ include_sample_schema }} + metadata: "{{ metadata }}" + - name: testing_criteria + value: "{{ testing_criteria }}" + 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}}\`). + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} + + + + + +## `UPDATE` examples + + + + +No description available. + +```sql +UPDATE openai.evals.evals +SET +name = '{{ name }}', +metadata = '{{ metadata }}' +WHERE +eval_id = '{{ eval_id }}' --required +AND "openai-organization" = '{{ openai-organization}}' +AND "openai-project" = '{{ openai-project}}' +RETURNING +id, +name, +created_at, +data_source_config, +metadata, +object, +testing_criteria; +``` + + + + +## `DELETE` examples + + + + +No description available. + +```sql +DELETE FROM openai.evals.evals +WHERE eval_id = '{{ eval_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/embeddings/index.md b/website/docs/services/evals/index.md similarity index 61% rename from website/docs/services/embeddings/index.md rename to website/docs/services/evals/index.md index 2e5b056..522f050 100644 --- a/website/docs/services/embeddings/index.md +++ b/website/docs/services/evals/index.md @@ -1,9 +1,9 @@ --- -title: embeddings +title: evals hide_title: false hide_table_of_contents: false keywords: - - embeddings + - evals - openai - stackql - infrastructure-as-code @@ -14,24 +14,21 @@ custom_edit_url: null image: /img/stackql-openai-provider-featured-image.png --- -embeddings service documentation. +evals service documentation. -:::info Service Summary +:::info[Service Summary] -
-
-total resources: 1
-
-
+total resources: __3__ ::: ## Resources \ No newline at end of file diff --git a/website/docs/services/evals/run_output_items/index.md b/website/docs/services/evals/run_output_items/index.md new file mode 100644 index 0000000..788dc61 --- /dev/null +++ b/website/docs/services/evals/run_output_items/index.md @@ -0,0 +1,330 @@ +--- +title: run_output_items +hide_title: false +hide_table_of_contents: false +keywords: + - run_output_items + - evals + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a run_output_items resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + +The evaluation run output item + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the evaluation run output item.
integerThe identifier for the data source item.
stringThe identifier of the evaluation group.
stringThe identifier of the evaluation run associated with this output item.
integer (unixtime)Unix timestamp (in seconds) when the evaluation run was created.
objectDetails of the input data source item.
stringThe type of the object. Always "eval.run.output_item". (eval.run.output_item) (default: eval.run.output_item)
arrayA list of grader results for this output item.
objectA sample containing the input and output of the evaluation run.
stringThe status of the evaluation run.
+
+ + +A list of output items for the evaluation run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the evaluation run output item.
integerThe identifier for the data source item.
stringThe identifier of the evaluation group.
stringThe identifier of the evaluation run associated with this output item.
integer (unixtime)Unix timestamp (in seconds) when the evaluation run was created.
objectDetails of the input data source item.
stringThe type of the object. Always "eval.run.output_item". (eval.run.output_item) (default: eval.run.output_item)
arrayA list of grader results for this output item.
objectA sample containing the input and output of the evaluation run.
stringThe status of the evaluation run.
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
eval_id, run_id, output_item_idopenai-organization, openai-project
eval_id, run_idafter, limit, status, order, openai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the evaluation to retrieve runs for.
stringThe ID of the output item to retrieve.
stringThe ID of the run to retrieve output items for.
stringIdentifier for the last output item from the previous pagination request.
integerNumber of output items to retrieve. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order for output items by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`.
stringFilter output items by status. Use `failed` to filter by failed output items or `pass` to filter by passed output items.
+ +## `SELECT` examples + + + + +The evaluation run output item + +```sql +SELECT +id, +datasource_item_id, +eval_id, +run_id, +created_at, +datasource_item, +object, +results, +sample, +status +FROM openai.evals.run_output_items +WHERE eval_id = '{{ eval_id }}' -- required +AND run_id = '{{ run_id }}' -- required +AND output_item_id = '{{ output_item_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +A list of output items for the evaluation run + +```sql +SELECT +id, +datasource_item_id, +eval_id, +run_id, +created_at, +datasource_item, +object, +results, +sample, +status +FROM openai.evals.run_output_items +WHERE eval_id = '{{ eval_id }}' -- required +AND run_id = '{{ run_id }}' -- required +AND after = '{{ after }}' +AND status = '{{ status }}' +AND "order" = '{{ order }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/evals/runs/index.md b/website/docs/services/evals/runs/index.md new file mode 100644 index 0000000..38b49f7 --- /dev/null +++ b/website/docs/services/evals/runs/index.md @@ -0,0 +1,551 @@ +--- +title: runs +hide_title: false +hide_table_of_contents: false +keywords: + - runs + - evals + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a runs resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + +The evaluation run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the evaluation run.
stringThe name of the evaluation run.
stringThe identifier of the associated evaluation.
integer (unixtime)Unix timestamp (in seconds) when the evaluation run was created.
objectInformation about the run's data source. (title: JsonlRunDataSource)
objectAn object representing an error response from the Eval API. (title: EvalApiError)
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe model that is evaluated, if applicable.
stringThe type of the object. Always "eval.run". (eval.run) (default: eval.run)
arrayUsage statistics for each model during the evaluation run.
arrayResults per testing criteria applied during the evaluation run.
string (uri)The URL to the rendered evaluation run report on the UI dashboard.
objectCounters summarizing the outcomes of the evaluation run.
stringThe status of the evaluation run.
+
+ + +A list of runs for the evaluation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the evaluation run.
stringThe name of the evaluation run.
stringThe identifier of the associated evaluation.
integer (unixtime)Unix timestamp (in seconds) when the evaluation run was created.
objectInformation about the run's data source. (title: JsonlRunDataSource)
objectAn object representing an error response from the Eval API. (title: EvalApiError)
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe model that is evaluated, if applicable.
stringThe type of the object. Always "eval.run". (eval.run) (default: eval.run)
arrayUsage statistics for each model during the evaluation run.
arrayResults per testing criteria applied during the evaluation run.
string (uri)The URL to the rendered evaluation run report on the UI dashboard.
objectCounters summarizing the outcomes of the evaluation run.
stringThe status of the evaluation run.
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
eval_id, run_idopenai-organization, openai-project
eval_idafter, limit, order, status, openai-organization, openai-project
eval_id, data_sourceopenai-organization, openai-project
eval_id, run_idopenai-organization, openai-project
eval_id, run_idopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the evaluation whose run you want to cancel.
stringThe ID of the run to cancel.
stringIdentifier for the last run from the previous pagination request.
integerNumber of runs to retrieve. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order for runs by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`.
stringFilter runs by status. One of `queued` | `in_progress` | `failed` | `completed` | `canceled`.
+ +## `SELECT` examples + + + + +The evaluation run + +```sql +SELECT +id, +name, +eval_id, +created_at, +data_source, +error, +metadata, +model, +object, +per_model_usage, +per_testing_criteria_results, +report_url, +result_counts, +status +FROM openai.evals.runs +WHERE eval_id = '{{ eval_id }}' -- required +AND run_id = '{{ run_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +A list of runs for the evaluation + +```sql +SELECT +id, +name, +eval_id, +created_at, +data_source, +error, +metadata, +model, +object, +per_model_usage, +per_testing_criteria_results, +report_url, +result_counts, +status +FROM openai.evals.runs +WHERE eval_id = '{{ eval_id }}' -- required +AND after = '{{ after }}' +AND "order" = '{{ order }}' +AND status = '{{ status }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## `INSERT` examples + + + + +No description available. + +```sql +INSERT INTO openai.evals.runs ( +name, +metadata, +data_source, +eval_id, +"openai-organization", +"openai-project" +) +SELECT +'{{ name }}', +'{{ metadata }}', +'{{ data_source }}' /* required */, +'{{ eval_id }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +name, +eval_id, +created_at, +data_source, +error, +metadata, +model, +object, +per_model_usage, +per_testing_criteria_results, +report_url, +result_counts, +status +; +``` + + + +{`# Description fields are for documentation purposes +- name: runs + props: + - name: eval_id + value: "{{ eval_id }}" + description: Required parameter for the runs resource. + - name: name + value: "{{ name }}" + description: | + The name of the run. + - name: metadata + value: "{{ 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. + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + - name: data_source + description: | + Details about the run's data source. + value: + type: "{{ type }}" + source: + type: "{{ type }}" + content: + - item: "{{ item }}" + sample: "{{ sample }}" + id: "{{ id }}" + input_messages: + type: "{{ type }}" + template: "{{ template }}" + item_reference: "{{ item_reference }}" + sampling_params: + reasoning_effort: "{{ reasoning_effort }}" + temperature: {{ temperature }} + max_completion_tokens: {{ max_completion_tokens }} + top_p: {{ top_p }} + seed: {{ seed }} + response_format: "{{ response_format }}" + tools: + - type: "{{ type }}" + function: + description: "{{ description }}" + name: "{{ name }}" + parameters: "{{ parameters }}" + strict: {{ strict }} + model: "{{ model }}" + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} + + + + + +## `DELETE` examples + + + + +No description available. + +```sql +DELETE FROM openai.evals.runs +WHERE eval_id = '{{ eval_id }}' --required +AND run_id = '{{ run_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## Lifecycle Methods + + + + +The canceled eval run object + +```sql +EXEC openai.evals.runs.cancel +@eval_id='{{ eval_id }}' --required, +@run_id='{{ run_id }}' --required, +@openai-organization='{{ openai-organization }}', +@openai-project='{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/files/files/index.md b/website/docs/services/files/files/index.md index c711f31..a152362 100644 --- a/website/docs/services/files/files/index.md +++ b/website/docs/services/files/files/index.md @@ -1,4 +1,4 @@ ---- +--- title: files hide_title: false hide_table_of_contents: false @@ -15,6 +15,7 @@ image: /img/stackql-openai-provider-featured-image.png --- import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -22,77 +23,308 @@ Creates, updates, deletes, gets or lists a files resource. ## Overview - +
Namefiles
Name
TypeResource
Id
## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `` | The `File` object represents a document that has been uploaded to OpenAI. | + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe file identifier, which can be referenced in the API endpoints.
integerThe size of the file, in bytes.
integer (unixtime)The Unix timestamp (in seconds) for when the file was created.
integer (unixtime)The Unix timestamp (in seconds) for when the file will expire.
stringThe name of the file.
stringThe object type, which is always `file`. (file)
stringThe intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`. (assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, user_data)
stringDeprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. (uploaded, processed, error)
stringDeprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe file identifier, which can be referenced in the API endpoints.
integerThe size of the file, in bytes.
integer (unixtime)The Unix timestamp (in seconds) for when the file was created.
integer (unixtime)The Unix timestamp (in seconds) for when the file will expire.
stringThe name of the file.
stringThe object type, which is always `file`. (file)
stringThe intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`. (assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, user_data)
stringDeprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. (uploaded, processed, error)
stringDeprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.
+
+
## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `INSERT` | | | -| | `DELETE` | | | -| | `EXEC` | | | -## `SELECT` examples +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
file_idopenai-organization, openai-project
purpose, limit, order, after, openai-organization, openai-project
file_idopenai-organization, openai-project
+## Parameters +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. -```sql -SELECT -column_anon -FROM openai.files.files -; -``` -## `INSERT` example + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the file to use for this request.
stringA cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
integerA limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
stringOnly return files with the given purpose.
-Use the following StackQL query and manifest file to create a new files resource. +## `SELECT` examples - + { label: 'get', value: 'get' }, + { label: 'list', value: 'list' } + ]} +> + -```sql -/*+ create */ -INSERT INTO openai.files.files ( - -) -SELECT +OK +```sql +SELECT +id, +bytes, +created_at, +expires_at, +filename, +object, +purpose, +status, +status_details +FROM openai.files.files +WHERE file_id = '{{ file_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' ; ``` + - - -```yaml -- name: files - props: [] +OK +```sql +SELECT +id, +bytes, +created_at, +expires_at, +filename, +object, +purpose, +status, +status_details +FROM openai.files.files +WHERE purpose = '{{ purpose }}' +AND "order" = '{{ order }}' +AND after = '{{ after }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; ``` -## `DELETE` example -Deletes the specified files resource. +## `DELETE` examples + + + + +No description available. ```sql -/*+ delete */ DELETE FROM openai.files.files -WHERE file_id = '{{ file_id }}'; +WHERE file_id = '{{ file_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; ``` + + diff --git a/website/docs/services/files/index.md b/website/docs/services/files/index.md index 2ff0c2a..ef5afda 100644 --- a/website/docs/services/files/index.md +++ b/website/docs/services/files/index.md @@ -16,13 +16,9 @@ image: /img/stackql-openai-provider-featured-image.png files service documentation. -:::info Service Summary +:::info[Service Summary] -
-
-total resources: 1
-
-
+total resources: __1__ ::: diff --git a/website/docs/services/fine_tuning/checkpoint_permissions/index.md b/website/docs/services/fine_tuning/checkpoint_permissions/index.md new file mode 100644 index 0000000..83296ea --- /dev/null +++ b/website/docs/services/fine_tuning/checkpoint_permissions/index.md @@ -0,0 +1,285 @@ +--- +title: checkpoint_permissions +hide_title: false +hide_table_of_contents: false +keywords: + - checkpoint_permissions + - fine_tuning + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a checkpoint_permissions resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe permission identifier, which can be referenced in the API endpoints.
stringThe project identifier that the permission is for.
integer (unixtime)The Unix timestamp (in seconds) for when the permission was created.
stringThe object type, which is always "checkpoint.permission". (checkpoint.permission)
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
fine_tuned_model_checkpointproject_id, after, limit, order, openai-organization, openai-project
fine_tuned_model_checkpoint, project_idsopenai-organization, openai-project
fine_tuned_model_checkpoint, permission_idopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the fine-tuned model checkpoint to delete a permission for.
stringThe ID of the fine-tuned model checkpoint permission to delete.
stringIdentifier for the last permission ID from the previous pagination request.
integerNumber of permissions to retrieve. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringThe order in which to retrieve permissions.
stringThe ID of the project to get permissions for.
+ +## `SELECT` examples + + + + +OK + +```sql +SELECT +id, +project_id, +created_at, +object +FROM openai.fine_tuning.checkpoint_permissions +WHERE fine_tuned_model_checkpoint = '{{ fine_tuned_model_checkpoint }}' -- required +AND project_id = '{{ project_id }}' +AND after = '{{ after }}' +AND "order" = '{{ order }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## `INSERT` examples + + + + +No description available. + +```sql +INSERT INTO openai.fine_tuning.checkpoint_permissions ( +project_ids, +fine_tuned_model_checkpoint, +"openai-organization", +"openai-project" +) +SELECT +'{{ project_ids }}' /* required */, +'{{ fine_tuned_model_checkpoint }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +first_id, +last_id, +data, +has_more, +object +; +``` + + + +{`# Description fields are for documentation purposes +- name: checkpoint_permissions + props: + - name: fine_tuned_model_checkpoint + value: "{{ fine_tuned_model_checkpoint }}" + description: Required parameter for the checkpoint_permissions resource. + - name: project_ids + value: + - "{{ project_ids }}" + description: | + The project identifiers to grant access to. + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} + + + + + +## `DELETE` examples + + + + +No description available. + +```sql +DELETE FROM openai.fine_tuning.checkpoint_permissions +WHERE fine_tuned_model_checkpoint = '{{ fine_tuned_model_checkpoint }}' --required +AND permission_id = '{{ permission_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/fine_tuning/checkpoints/index.md b/website/docs/services/fine_tuning/checkpoints/index.md new file mode 100644 index 0000000..8c9538a --- /dev/null +++ b/website/docs/services/fine_tuning/checkpoints/index.md @@ -0,0 +1,187 @@ +--- +title: checkpoints +hide_title: false +hide_table_of_contents: false +keywords: + - checkpoints + - fine_tuning + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a checkpoints resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe checkpoint identifier, which can be referenced in the API endpoints.
stringThe name of the fine-tuning job that this checkpoint was created from.
integer (unixtime)The Unix timestamp (in seconds) for when the checkpoint was created.
stringThe name of the fine-tuned checkpoint model that is created.
objectMetrics at the step number during the fine-tuning job.
stringThe object type, which is always "fine_tuning.job.checkpoint". (fine_tuning.job.checkpoint)
integerThe step number that the checkpoint was created at.
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
fine_tuning_job_idafter, limit, openai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the fine-tuning job to get checkpoints for.
stringIdentifier for the last checkpoint ID from the previous pagination request.
integerNumber of checkpoints to retrieve. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
+ +## `SELECT` examples + + + + +OK + +```sql +SELECT +id, +fine_tuning_job_id, +created_at, +fine_tuned_model_checkpoint, +metrics, +object, +step_number +FROM openai.fine_tuning.checkpoints +WHERE fine_tuning_job_id = '{{ fine_tuning_job_id }}' -- required +AND after = '{{ after }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/fine_tuning/events/index.md b/website/docs/services/fine_tuning/events/index.md index 5c2bd88..37bb1e2 100644 --- a/website/docs/services/fine_tuning/events/index.md +++ b/website/docs/services/fine_tuning/events/index.md @@ -1,4 +1,4 @@ ---- +--- title: events hide_title: false hide_table_of_contents: false @@ -15,44 +15,173 @@ image: /img/stackql-openai-provider-featured-image.png --- import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -Creates, updates, deletes, gets or lists a events resource. +Creates, updates, deletes, gets or lists an events resource. ## Overview - +
Nameevents
Name
TypeResource
Id
## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | | -| | `integer` | | -| | `string` | | -| | `string` | | -| | `string` | | + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe object identifier.
integer (unixtime)The Unix timestamp (in seconds) for when the fine-tuning job was created.
stringThe data associated with the event. (opaque JSON object)
stringThe log level of the event. (info, warn, error)
stringThe message of the event.
stringThe object type, which is always "fine_tuning.job.event". (fine_tuning.job.event)
stringThe type of event. (message, metrics)
+
+
## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -## `SELECT` examples +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
fine_tuning_job_idafter, limit, openai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the fine-tuning job to get events for.
stringIdentifier for the last event from the previous pagination request.
integerNumber of events to retrieve. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
+ +## `SELECT` examples + + +OK ```sql SELECT id, created_at, +data, level, message, -object +object, +type FROM openai.fine_tuning.events -WHERE fine_tuning_job_id = '{{ fine_tuning_job_id }}'; -``` \ No newline at end of file +WHERE fine_tuning_job_id = '{{ fine_tuning_job_id }}' -- required +AND after = '{{ after }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/fine_tuning/index.md b/website/docs/services/fine_tuning/index.md index 157aefe..71295d2 100644 --- a/website/docs/services/fine_tuning/index.md +++ b/website/docs/services/fine_tuning/index.md @@ -16,23 +16,20 @@ image: /img/stackql-openai-provider-featured-image.png fine_tuning service documentation. -:::info Service Summary +:::info[Service Summary] -
-
-total resources: 3
-
-
+total resources: __4__ ::: ## Resources \ No newline at end of file diff --git a/website/docs/services/fine_tuning/job_checkpoints/index.md b/website/docs/services/fine_tuning/job_checkpoints/index.md deleted file mode 100644 index e526d37..0000000 --- a/website/docs/services/fine_tuning/job_checkpoints/index.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: job_checkpoints -hide_title: false -hide_table_of_contents: false -keywords: - - job_checkpoints - - fine_tuning - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a job_checkpoints resource. - -## Overview - - - - -
Namejob_checkpoints
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The checkpoint identifier, which can be referenced in the API endpoints. | -| | `integer` | The Unix timestamp (in seconds) for when the checkpoint was created. | -| | `string` | The name of the fine-tuned checkpoint model that is created. | -| | `string` | The name of the fine-tuning job that this checkpoint was created from. | -| | `object` | Metrics at the step number during the fine-tuning job. | -| | `string` | The object type, which is always "fine_tuning.job.checkpoint". | -| | `integer` | The step number that the checkpoint was created at. | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | - -## `SELECT` examples - - - - -```sql -SELECT -id, -created_at, -fine_tuned_model_checkpoint, -fine_tuning_job_id, -metrics, -object, -step_number -FROM openai.fine_tuning.job_checkpoints -WHERE fine_tuning_job_id = '{{ fine_tuning_job_id }}'; -``` \ No newline at end of file diff --git a/website/docs/services/fine_tuning/jobs/index.md b/website/docs/services/fine_tuning/jobs/index.md index b7bd2b2..edb7785 100644 --- a/website/docs/services/fine_tuning/jobs/index.md +++ b/website/docs/services/fine_tuning/jobs/index.md @@ -1,4 +1,4 @@ ---- +--- title: jobs hide_title: false hide_table_of_contents: false @@ -15,6 +15,7 @@ image: /img/stackql-openai-provider-featured-image.png --- import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -22,48 +23,365 @@ Creates, updates, deletes, gets or lists a jobs resource. ## Overview - +
Namejobs
Name
TypeResource
Id
## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The object identifier, which can be referenced in the API endpoints. | -| | `integer` | The Unix timestamp (in seconds) for when the fine-tuning job was created. | -| | `object` | For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure. | -| | `integer` | 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. | -| | `string` | The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running. | -| | `integer` | 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. | -| | `object` | The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. | -| | `array` | A list of integrations to enable for this fine-tuning job. | -| | `string` | The base model that is being fine-tuned. | -| | `string` | The object type, which is always "fine_tuning.job". | -| | `string` | The organization that owns the fine-tuning job. | -| | `array` | The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](/docs/api-reference/files/retrieve-contents). | -| | `integer` | The seed used for the fine-tuning job. | -| | `string` | The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. | -| | `integer` | 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. | -| | `string` | The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents). | -| | `string` | The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents). | + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe object identifier, which can be referenced in the API endpoints.
stringThe organization that owns the fine-tuning job.
integer (unixtime)The Unix timestamp (in seconds) for when the fine-tuning job was created.
objectFor fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure.
integer (unixtime)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.
stringThe name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
integer (unixtime)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.
objectThe hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs.
arrayA list of integrations to enable for this fine-tuning job.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
objectThe method used for fine-tuning.
stringThe base model that is being fine-tuned.
stringThe object type, which is always "fine_tuning.job". (fine_tuning.job)
arrayThe compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents).
integerThe seed used for the fine-tuning job.
stringThe current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. (validating_files, queued, running, succeeded, failed, cancelled)
integerThe total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
stringThe file ID used for training. You can retrieve the training data with the [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents).
stringThe file ID used for validation. You can retrieve the validation results with the [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents).
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe object identifier, which can be referenced in the API endpoints.
stringThe organization that owns the fine-tuning job.
integer (unixtime)The Unix timestamp (in seconds) for when the fine-tuning job was created.
objectFor fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure.
integer (unixtime)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.
stringThe name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
integer (unixtime)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.
objectThe hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs.
arrayA list of integrations to enable for this fine-tuning job.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
objectThe method used for fine-tuning.
stringThe base model that is being fine-tuned.
stringThe object type, which is always "fine_tuning.job". (fine_tuning.job)
arrayThe compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents).
integerThe seed used for the fine-tuning job.
stringThe current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. (validating_files, queued, running, succeeded, failed, cancelled)
integerThe total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
stringThe file ID used for training. You can retrieve the training data with the [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents).
stringThe file ID used for validation. You can retrieve the validation results with the [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents).
+
+
## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `INSERT` | | | -| | `EXEC` | | | -## `SELECT` examples +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
fine_tuning_job_idopenai-organization, openai-project
after, limit, metadata, openai-organization, openai-project
model, training_fileopenai-organization, openai-project
fine_tuning_job_idopenai-organization, openai-project
fine_tuning_job_idopenai-organization, openai-project
fine_tuning_job_idopenai-organization, openai-project
+ +## Parameters +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the fine-tuning job to resume.
stringIdentifier for the last job from the previous pagination request.
integerNumber of fine-tuning jobs to retrieve. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
objectOptional metadata filter. To filter, use the syntax `metadata[k]=v`. Alternatively, set `metadata=null` to indicate no metadata.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
+## `SELECT` examples + + + + +OK ```sql SELECT id, +organization_id, created_at, error, estimated_finish, @@ -71,9 +389,42 @@ fine_tuned_model, finished_at, hyperparameters, integrations, +metadata, +method, model, object, +result_files, +seed, +status, +trained_tokens, +training_file, +validation_file +FROM openai.fine_tuning.jobs +WHERE fine_tuning_job_id = '{{ fine_tuning_job_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +OK + +```sql +SELECT +id, organization_id, +created_at, +error, +estimated_finish, +fine_tuned_model, +finished_at, +hyperparameters, +integrations, +metadata, +method, +model, +object, result_files, seed, status, @@ -81,103 +432,269 @@ trained_tokens, training_file, validation_file FROM openai.fine_tuning.jobs +WHERE after = '{{ after }}' +AND metadata = '{{ metadata }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' ; ``` -## `INSERT` example + + -Use the following StackQL query and manifest file to create a new jobs resource. + +## `INSERT` examples - + { label: 'create', value: 'create' }, + { label: 'Manifest', value: 'manifest' } + ]} +> + + +No description available. ```sql -/*+ create */ INSERT INTO openai.fine_tuning.jobs ( -data__model, -data__training_file, -data__hyperparameters, -data__suffix, -data__validation_file, -data__integrations, -data__seed +model, +training_file, +hyperparameters, +suffix, +validation_file, +integrations, +seed, +method, +metadata, +"openai-organization", +"openai-project" ) SELECT -'{{ model }}', -'{{ training_file }}', +'{{ model }}' /* required */, +'{{ training_file }}' /* required */, '{{ hyperparameters }}', '{{ suffix }}', '{{ validation_file }}', '{{ integrations }}', -'{{ seed }}' -; -``` - - - - -```sql -/*+ create */ -INSERT INTO openai.fine_tuning.jobs ( -data__model, -data__training_file -) -SELECT -'{{ model }}', -'{{ training_file }}' +{{ seed }}, +'{{ method }}', +'{{ metadata }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +organization_id, +created_at, +error, +estimated_finish, +fine_tuned_model, +finished_at, +hyperparameters, +integrations, +metadata, +method, +model, +object, +result_files, +seed, +status, +trained_tokens, +training_file, +validation_file ; ``` - -```yaml +{`# Description fields are for documentation purposes - name: jobs props: - - name: data__model - value: string - - name: data__training_file - value: string - name: model - value: string + value: "{{ model }}" + description: | + The name of the model to fine-tune. You can select one of the + [supported models](https://platform.openai.com/docs/guides/fine-tuning#which-models-can-be-fine-tuned). + valid_values: ['babbage-002', 'davinci-002', 'gpt-3.5-turbo', 'gpt-4o-mini'] - name: training_file - value: string + value: "{{ training_file }}" + description: | + The ID of an uploaded file that contains training data. + See [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file. + Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose \`fine-tune\`. + The contents of the file should differ depending on if the model uses the [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input), [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) format, or if the fine-tuning method uses the [preference](https://platform.openai.com/docs/api-reference/fine-tuning/preference-input) format. + See the [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization) for more details. - name: hyperparameters - props: - - name: batch_size - value: string - - name: learning_rate_multiplier - value: string - - name: n_epochs - value: string + description: | + The hyperparameters used for the fine-tuning job. + This value is now deprecated in favor of \`method\`, and should be passed in under the \`method\` parameter. + value: + batch_size: "{{ batch_size }}" + learning_rate_multiplier: "{{ learning_rate_multiplier }}" + n_epochs: "{{ n_epochs }}" - name: suffix - value: string + value: "{{ suffix }}" + description: | + A string of up to 64 characters that will be added to your fine-tuned model name. + For example, a \`suffix\` of "custom-model-name" would produce a model name like \`ft:gpt-4o-mini:openai:custom-model-name:7p4lURel\`. + default: null - name: validation_file - value: string + value: "{{ validation_file }}" + description: | + The ID of an uploaded file that contains validation data. + If you provide this file, the data is used to generate validation + metrics periodically during fine-tuning. These metrics can be viewed in + the fine-tuning results file. + The same data should not be present in both train and validation files. + Your dataset must be formatted as a JSONL file. You must upload your file with the purpose \`fine-tune\`. + See the [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization) for more details. - name: integrations - value: array - props: - - name: type - value: string - - name: wandb - props: - - name: project - value: string - - name: name - value: string - - name: entity - value: string - - name: tags - value: array + description: | + A list of integrations to enable for your fine-tuning job. + value: + - type: "{{ type }}" + wandb: + project: "{{ project }}" + name: "{{ name }}" + entity: "{{ entity }}" + tags: + - "{{ tags }}" - name: seed - value: integer + value: {{ 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. + If a seed is not specified, one will be generated for you. + - name: method + description: | + The method used for fine-tuning. + value: + type: "{{ type }}" + supervised: + hyperparameters: + batch_size: "{{ batch_size }}" + learning_rate_multiplier: "{{ learning_rate_multiplier }}" + n_epochs: "{{ n_epochs }}" + dpo: + hyperparameters: + beta: "{{ beta }}" + batch_size: "{{ batch_size }}" + learning_rate_multiplier: "{{ learning_rate_multiplier }}" + n_epochs: "{{ n_epochs }}" + reinforcement: + grader: + type: "{{ type }}" + name: "{{ name }}" + input: "{{ input }}" + reference: "{{ reference }}" + operation: "{{ operation }}" + evaluation_metric: "{{ evaluation_metric }}" + source: "{{ source }}" + image_tag: "{{ image_tag }}" + model: "{{ model }}" + sampling_params: + seed: "{{ seed }}" + top_p: "{{ top_p }}" + temperature: "{{ temperature }}" + max_completions_tokens: "{{ max_completions_tokens }}" + reasoning_effort: "{{ reasoning_effort }}" + range: + - {{ range }} + graders: + type: "{{ type }}" + name: "{{ name }}" + input: "{{ input }}" + reference: "{{ reference }}" + operation: "{{ operation }}" + evaluation_metric: "{{ evaluation_metric }}" + source: "{{ source }}" + image_tag: "{{ image_tag }}" + model: "{{ model }}" + sampling_params: + seed: "{{ seed }}" + top_p: "{{ top_p }}" + temperature: "{{ temperature }}" + max_completions_tokens: "{{ max_completions_tokens }}" + reasoning_effort: "{{ reasoning_effort }}" + range: + - {{ range }} + labels: + - "{{ labels }}" + passing_labels: + - "{{ passing_labels }}" + calculate_output: "{{ calculate_output }}" + hyperparameters: + batch_size: "{{ batch_size }}" + learning_rate_multiplier: "{{ learning_rate_multiplier }}" + n_epochs: "{{ n_epochs }}" + reasoning_effort: "{{ reasoning_effort }}" + compute_multiplier: "{{ compute_multiplier }}" + eval_interval: "{{ eval_interval }}" + eval_samples: "{{ eval_samples }}" + - name: metadata + value: "{{ 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. + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} + + + + + +## Lifecycle Methods + + + +OK + +```sql +EXEC openai.fine_tuning.jobs.cancel +@fine_tuning_job_id='{{ fine_tuning_job_id }}' --required, +@openai-organization='{{ openai-organization }}', +@openai-project='{{ openai-project }}' +; +``` + + + +OK + +```sql +EXEC openai.fine_tuning.jobs.pause +@fine_tuning_job_id='{{ fine_tuning_job_id }}' --required, +@openai-organization='{{ openai-organization }}', +@openai-project='{{ openai-project }}' +; +``` + + + +OK + +```sql +EXEC openai.fine_tuning.jobs.resume +@fine_tuning_job_id='{{ fine_tuning_job_id }}' --required, +@openai-organization='{{ openai-organization }}', +@openai-project='{{ openai-project }}' +; ``` diff --git a/website/docs/services/images/image_edits/index.md b/website/docs/services/images/image_edits/index.md deleted file mode 100644 index ab28c20..0000000 --- a/website/docs/services/images/image_edits/index.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: image_edits -hide_title: false -hide_table_of_contents: false -keywords: - - image_edits - - images - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a image_edits resource. - -## Overview - - - - -
Nameimage_edits
TypeResource
Id
- -## Fields -`SELECT` not supported for this resource, use `SHOW METHODS` to view available operations for the resource. - - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `INSERT` | | | - -## `INSERT` example - -Use the following StackQL query and manifest file to create a new image_edits resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.images.image_edits ( - -) -SELECT - -; -``` - - - - -```yaml -- name: image_edits - props: [] - -``` - - diff --git a/website/docs/services/images/image_variations/index.md b/website/docs/services/images/image_variations/index.md deleted file mode 100644 index 22ae083..0000000 --- a/website/docs/services/images/image_variations/index.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: image_variations -hide_title: false -hide_table_of_contents: false -keywords: - - image_variations - - images - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a image_variations resource. - -## Overview - - - - -
Nameimage_variations
TypeResource
Id
- -## Fields -`SELECT` not supported for this resource, use `SHOW METHODS` to view available operations for the resource. - - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `INSERT` | | | - -## `INSERT` example - -Use the following StackQL query and manifest file to create a new image_variations resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.images.image_variations ( - -) -SELECT - -; -``` - - - - -```yaml -- name: image_variations - props: [] - -``` - - diff --git a/website/docs/services/images/images/index.md b/website/docs/services/images/images/index.md deleted file mode 100644 index fa74036..0000000 --- a/website/docs/services/images/images/index.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -title: images -hide_title: false -hide_table_of_contents: false -keywords: - - images - - images - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a images resource. - -## Overview - - - - -
Nameimages
TypeResource
Id
- -## Fields -`SELECT` not supported for this resource, use `SHOW METHODS` to view available operations for the resource. - - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `INSERT` | | | - -## `INSERT` example - -Use the following StackQL query and manifest file to create a new images resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.images.images ( -data__prompt, -data__model, -data__n, -data__quality, -data__response_format, -data__size, -data__style, -data__user -) -SELECT -'{{ prompt }}', -'{{ model }}', -'{{ n }}', -'{{ quality }}', -'{{ response_format }}', -'{{ size }}', -'{{ style }}', -'{{ user }}' -; -``` - - - - -```sql -/*+ create */ -INSERT INTO openai.images.images ( -data__prompt -) -SELECT -'{{ prompt }}' -; -``` - - - - -```yaml -- name: images - props: - - name: data__prompt - value: string - - name: prompt - value: string - - name: model - value: string - - name: 'n' - value: integer - - name: quality - value: string - - name: response_format - value: string - - name: size - value: string - - name: style - value: string - - name: user - value: string - -``` - - diff --git a/website/docs/services/images/index.md b/website/docs/services/images/index.md deleted file mode 100644 index 7b8aa3e..0000000 --- a/website/docs/services/images/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: images -hide_title: false -hide_table_of_contents: false -keywords: - - images - - openai - - stackql - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -images service documentation. - -:::info Service Summary - -
-
-total resources: 3
-
-
- -::: - -## Resources - \ No newline at end of file diff --git a/website/docs/services/invites/index.md b/website/docs/services/invites/index.md deleted file mode 100644 index d688a80..0000000 --- a/website/docs/services/invites/index.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: invites -hide_title: false -hide_table_of_contents: false -keywords: - - invites - - openai - - stackql - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -invites service documentation. - -:::info Service Summary - -
-
-total resources: 2
-
-
- -::: - -## Resources -
- -
-users -
-
\ No newline at end of file diff --git a/website/docs/services/invites/invites/index.md b/website/docs/services/invites/invites/index.md deleted file mode 100644 index ca6852e..0000000 --- a/website/docs/services/invites/invites/index.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: invites -hide_title: false -hide_table_of_contents: false -keywords: - - invites - - invites - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a invites resource. - -## Overview - - - - -
Nameinvites
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints | -| | `integer` | The Unix timestamp (in seconds) of when the invite was accepted. | -| | `string` | The email address of the individual to whom the invite was sent | -| | `integer` | The Unix timestamp (in seconds) of when the invite expires. | -| | `integer` | The Unix timestamp (in seconds) of when the invite was sent. | -| | `string` | The object type, which is always `organization.invite` | -| | `string` | `owner` or `reader` | -| | `string` | `accepted`,`expired`, or `pending` | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `DELETE` | | | - -## `SELECT` examples - - - - -```sql -SELECT -id, -accepted_at, -email, -expires_at, -invited_at, -object, -role, -status -FROM openai.invites.invites -; -``` -## `DELETE` example - -Deletes the specified invites resource. - -```sql -/*+ delete */ -DELETE FROM openai.invites.invites -WHERE invite_id = '{{ invite_id }}'; -``` diff --git a/website/docs/services/invites/users/index.md b/website/docs/services/invites/users/index.md deleted file mode 100644 index 6fddd3d..0000000 --- a/website/docs/services/invites/users/index.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: users -hide_title: false -hide_table_of_contents: false -keywords: - - users - - invites - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a users resource. - -## Overview - - - - -
Nameusers
TypeResource
Id
- -## Fields -`SELECT` not supported for this resource, use `SHOW METHODS` to view available operations for the resource. - - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `EXEC` | | | diff --git a/website/docs/services/models/index.md b/website/docs/services/models/index.md index c9c6eee..40b837c 100644 --- a/website/docs/services/models/index.md +++ b/website/docs/services/models/index.md @@ -16,13 +16,9 @@ image: /img/stackql-openai-provider-featured-image.png models service documentation. -:::info Service Summary +:::info[Service Summary] -
-
-total resources: 1
-
-
+total resources: __1__ ::: diff --git a/website/docs/services/models/models/index.md b/website/docs/services/models/models/index.md index 99a785a..1bee459 100644 --- a/website/docs/services/models/models/index.md +++ b/website/docs/services/models/models/index.md @@ -1,4 +1,4 @@ ---- +--- title: models hide_title: false hide_table_of_contents: false @@ -15,6 +15,7 @@ image: /img/stackql-openai-provider-featured-image.png --- import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -22,40 +23,225 @@ Creates, updates, deletes, gets or lists a models resource. ## Overview - +
Namemodels
Name
TypeResource
Id
## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `` | Describes an OpenAI model offering that can be used with the API. | + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe model identifier, which can be referenced in the API endpoints.
integer (unixtime)The Unix timestamp (in seconds) when the model was created.
stringThe object type, which is always "model". (model)
stringThe organization that owns the model.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe model identifier, which can be referenced in the API endpoints.
integer (unixtime)The Unix timestamp (in seconds) when the model was created.
stringThe object type, which is always "model". (model)
stringThe organization that owns the model.
+
+
## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `DELETE` | | | + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
modelopenai-organization, openai-project
openai-organization, openai-project
modelopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe model to delete
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
## `SELECT` examples + + +OK +```sql +SELECT +id, +created, +object, +owned_by +FROM openai.models.models +WHERE model = '{{ model }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +OK ```sql SELECT -column_anon +id, +created, +object, +owned_by FROM openai.models.models +WHERE "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' ; ``` -## `DELETE` example + + + + +## `DELETE` examples -Deletes the specified models resource. + + + +No description available. ```sql -/*+ delete */ DELETE FROM openai.models.models -WHERE model = '{{ model }}'; +WHERE model = '{{ model }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; ``` + + diff --git a/website/docs/services/moderations/index.md b/website/docs/services/moderations/index.md deleted file mode 100644 index c414855..0000000 --- a/website/docs/services/moderations/index.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: moderations -hide_title: false -hide_table_of_contents: false -keywords: - - moderations - - openai - - stackql - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -moderations service documentation. - -:::info Service Summary - -
-
-total resources: 1
-
-
- -::: - -## Resources -
- -
- -
-
\ No newline at end of file diff --git a/website/docs/services/moderations/moderations/index.md b/website/docs/services/moderations/moderations/index.md deleted file mode 100644 index cbc3b35..0000000 --- a/website/docs/services/moderations/moderations/index.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: moderations -hide_title: false -hide_table_of_contents: false -keywords: - - moderations - - moderations - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a moderations resource. - -## Overview - - - - -
Namemoderations
TypeResource
Id
- -## Fields -`SELECT` not supported for this resource, use `SHOW METHODS` to view available operations for the resource. - - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `INSERT` | | | - -## `INSERT` example - -Use the following StackQL query and manifest file to create a new moderations resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.moderations.moderations ( -data__input, -data__model -) -SELECT -'{{ input }}', -'{{ model }}' -; -``` - - - - -```sql -/*+ create */ -INSERT INTO openai.moderations.moderations ( -data__input -) -SELECT -'{{ input }}' -; -``` - - - - -```yaml -- name: moderations - props: - - name: data__input - value: string - - name: input - value: string - - name: model - value: string - -``` - - diff --git a/website/docs/services/projects/index.md b/website/docs/services/projects/index.md deleted file mode 100644 index 758eab4..0000000 --- a/website/docs/services/projects/index.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: projects -hide_title: false -hide_table_of_contents: false -keywords: - - projects - - openai - - stackql - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -projects service documentation. - -:::info Service Summary - -
-
-total resources: 4
-
-
- -::: - -## Resources - \ No newline at end of file diff --git a/website/docs/services/projects/project_api_keys/index.md b/website/docs/services/projects/project_api_keys/index.md deleted file mode 100644 index fa29677..0000000 --- a/website/docs/services/projects/project_api_keys/index.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: project_api_keys -hide_title: false -hide_table_of_contents: false -keywords: - - project_api_keys - - projects - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a project_api_keys resource. - -## Overview - - - - -
Nameproject_api_keys
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints | -| | `string` | The name of the API key | -| | `integer` | The Unix timestamp (in seconds) of when the API key was created | -| | `string` | The object type, which is always `organization.project.api_key` | -| | `object` | | -| | `string` | The redacted value of the API key | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `DELETE` | | | - -## `SELECT` examples - - - - -```sql -SELECT -id, -name, -created_at, -object, -owner, -redacted_value -FROM openai.projects.project_api_keys -WHERE project_id = '{{ project_id }}'; -``` -## `DELETE` example - -Deletes the specified project_api_keys resource. - -```sql -/*+ delete */ -DELETE FROM openai.projects.project_api_keys -WHERE key_id = '{{ key_id }}' -AND project_id = '{{ project_id }}'; -``` diff --git a/website/docs/services/projects/project_service_accounts/index.md b/website/docs/services/projects/project_service_accounts/index.md deleted file mode 100644 index 9783c7f..0000000 --- a/website/docs/services/projects/project_service_accounts/index.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -title: project_service_accounts -hide_title: false -hide_table_of_contents: false -keywords: - - project_service_accounts - - projects - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a project_service_accounts resource. - -## Overview - - - - -
Nameproject_service_accounts
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints | -| | `string` | The name of the service account | -| | `integer` | The Unix timestamp (in seconds) of when the service account was created | -| | `string` | The object type, which is always `organization.project.service_account` | -| | `string` | `owner` or `member` | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `INSERT` | | | -| | `DELETE` | | | - -## `SELECT` examples - - - - -```sql -SELECT -id, -name, -created_at, -object, -role -FROM openai.projects.project_service_accounts -WHERE project_id = '{{ project_id }}'; -``` -## `INSERT` example - -Use the following StackQL query and manifest file to create a new project_service_accounts resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.projects.project_service_accounts ( -data__name, -project_id -) -SELECT -'{{ name }}', -'{{ project_id }}' -; -``` - - - - -```yaml -- name: project_service_accounts - props: - - name: project_id - value: string - - name: data__name - value: string - - name: name - value: string - -``` - - - -## `DELETE` example - -Deletes the specified project_service_accounts resource. - -```sql -/*+ delete */ -DELETE FROM openai.projects.project_service_accounts -WHERE project_id = '{{ project_id }}' -AND service_account_id = '{{ service_account_id }}'; -``` diff --git a/website/docs/services/projects/project_users/index.md b/website/docs/services/projects/project_users/index.md deleted file mode 100644 index 683ab52..0000000 --- a/website/docs/services/projects/project_users/index.md +++ /dev/null @@ -1,138 +0,0 @@ ---- -title: project_users -hide_title: false -hide_table_of_contents: false -keywords: - - project_users - - projects - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a project_users resource. - -## Overview - - - - -
Nameproject_users
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints | -| | `string` | The name of the user | -| | `integer` | The Unix timestamp (in seconds) of when the project was added. | -| | `string` | The email address of the user | -| | `string` | The object type, which is always `organization.project.user` | -| | `string` | `owner` or `member` | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `INSERT` | | | -| | `DELETE` | | | -| | `UPDATE` | | | - -## `SELECT` examples - - - - -```sql -SELECT -id, -name, -added_at, -email, -object, -role -FROM openai.projects.project_users -WHERE project_id = '{{ project_id }}'; -``` -## `INSERT` example - -Use the following StackQL query and manifest file to create a new project_users resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.projects.project_users ( -data__user_id, -data__role, -project_id -) -SELECT -'{{ user_id }}', -'{{ role }}', -'{{ project_id }}' -; -``` - - - - -```yaml -- name: project_users - props: - - name: project_id - value: string - - name: data__role - value: string - - name: data__user_id - value: string - - name: user_id - value: string - - name: role - value: string - -``` - - - -## `UPDATE` example - -Updates a project_users resource. - -```sql -/*+ update */ -UPDATE openai.projects.project_users -SET -role = '{{ role }}' -WHERE -project_id = '{{ project_id }}' -AND user_id = '{{ user_id }}' -AND data__role = '{{ data__role }}'; -``` - -## `DELETE` example - -Deletes the specified project_users resource. - -```sql -/*+ delete */ -DELETE FROM openai.projects.project_users -WHERE project_id = '{{ project_id }}' -AND user_id = '{{ user_id }}'; -``` diff --git a/website/docs/services/projects/projects/index.md b/website/docs/services/projects/projects/index.md deleted file mode 100644 index c40c06e..0000000 --- a/website/docs/services/projects/projects/index.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -title: projects -hide_title: false -hide_table_of_contents: false -keywords: - - projects - - projects - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a projects resource. - -## Overview - - - - -
Nameprojects
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints | -| | `string` | The name of the project. This appears in reporting. | -| | `integer` | The Unix timestamp (in seconds) of when the project was archived or `null`. | -| | `integer` | The Unix timestamp (in seconds) of when the project was created. | -| | `string` | The object type, which is always `organization.project` | -| | `string` | `active` or `archived` | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `INSERT` | | | -| | `UPDATE` | | | -| | `EXEC` | | | - -## `SELECT` examples - - - - -```sql -SELECT -id, -name, -archived_at, -created_at, -object, -status -FROM openai.projects.projects -; -``` -## `INSERT` example - -Use the following StackQL query and manifest file to create a new projects resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.projects.projects ( -data__name -) -SELECT -'{{ name }}' -; -``` - - - - -```yaml -- name: projects - props: - - name: data__name - value: string - - name: name - value: string - -``` - - - -## `UPDATE` example - -Updates a projects resource. - -```sql -/*+ update */ -UPDATE openai.projects.projects -SET -name = '{{ name }}' -WHERE -project_id = '{{ project_id }}' -AND data__name = '{{ data__name }}'; -``` diff --git a/website/docs/services/chat/index.md b/website/docs/services/skills/index.md similarity index 63% rename from website/docs/services/chat/index.md rename to website/docs/services/skills/index.md index e1de60a..1234ce9 100644 --- a/website/docs/services/chat/index.md +++ b/website/docs/services/skills/index.md @@ -1,9 +1,9 @@ --- -title: chat +title: skills hide_title: false hide_table_of_contents: false keywords: - - chat + - skills - openai - stackql - infrastructure-as-code @@ -14,24 +14,20 @@ custom_edit_url: null image: /img/stackql-openai-provider-featured-image.png --- -chat service documentation. +skills service documentation. -:::info Service Summary +:::info[Service Summary] -
-
-total resources: 1
-
-
+total resources: __2__ ::: ## Resources \ No newline at end of file diff --git a/website/docs/services/skills/skills/index.md b/website/docs/services/skills/skills/index.md new file mode 100644 index 0000000..1c40210 --- /dev/null +++ b/website/docs/services/skills/skills/index.md @@ -0,0 +1,341 @@ +--- +title: skills +hide_title: false +hide_table_of_contents: false +keywords: + - skills + - skills + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a skills resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the skill.
stringName of the skill.
integer (unixtime)Unix timestamp (seconds) for when the skill was created.
stringDefault version for the skill.
stringDescription of the skill.
stringLatest version for the skill.
stringThe object type, which is `skill`. (skill) (default: skill)
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the skill.
stringName of the skill.
integer (unixtime)Unix timestamp (seconds) for when the skill was created.
stringDefault version for the skill.
stringDescription of the skill.
stringLatest version for the skill.
stringThe object type, which is `skill`. (skill) (default: skill)
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
skill_idopenai-organization, openai-project
limit, order, after, openai-organization, openai-project
skill_id, default_versionopenai-organization, openai-project
skill_idopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier of the skill to delete.
stringIdentifier for the last item from the previous pagination request
integerNumber of items to retrieve Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order of results by timestamp. Use `asc` for ascending order or `desc` for descending order.
+ +## `SELECT` examples + + + + +Success + +```sql +SELECT +id, +name, +created_at, +default_version, +description, +latest_version, +object +FROM openai.skills.skills +WHERE skill_id = '{{ skill_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +Success + +```sql +SELECT +id, +name, +created_at, +default_version, +description, +latest_version, +object +FROM openai.skills.skills +WHERE "order" = '{{ order }}' +AND after = '{{ after }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## `UPDATE` examples + + + + +No description available. + +```sql +UPDATE openai.skills.skills +SET +default_version = '{{ default_version }}' +WHERE +skill_id = '{{ skill_id }}' --required +AND default_version = '{{ default_version }}' --required +AND "openai-organization" = '{{ openai-organization}}' +AND "openai-project" = '{{ openai-project}}' +RETURNING +id, +name, +created_at, +default_version, +description, +latest_version, +object; +``` + + + + +## `DELETE` examples + + + + +No description available. + +```sql +DELETE FROM openai.skills.skills +WHERE skill_id = '{{ skill_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/skills/versions/index.md b/website/docs/services/skills/versions/index.md new file mode 100644 index 0000000..a17c19d --- /dev/null +++ b/website/docs/services/skills/versions/index.md @@ -0,0 +1,308 @@ +--- +title: versions +hide_title: false +hide_table_of_contents: false +keywords: + - versions + - skills + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a versions resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the skill version.
stringName of the skill version.
stringIdentifier of the skill for this version.
integer (unixtime)Unix timestamp (seconds) for when the version was created.
stringDescription of the skill version.
stringThe object type, which is `skill.version`. (skill.version) (default: skill.version)
stringVersion number for this skill.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringUnique identifier for the skill version.
stringName of the skill version.
stringIdentifier of the skill for this version.
integer (unixtime)Unix timestamp (seconds) for when the version was created.
stringDescription of the skill version.
stringThe object type, which is `skill.version`. (skill.version) (default: skill.version)
stringVersion number for this skill.
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
skill_id, versionopenai-organization, openai-project
skill_idlimit, order, after, openai-organization, openai-project
skill_id, versionopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier of the skill.
stringThe skill version number.
stringThe skill version ID to start after.
integerNumber of versions to retrieve. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order of results by version number.
+ +## `SELECT` examples + + + + +Success + +```sql +SELECT +id, +name, +skill_id, +created_at, +description, +object, +version +FROM openai.skills.versions +WHERE skill_id = '{{ skill_id }}' -- required +AND version = '{{ version }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +Success + +```sql +SELECT +id, +name, +skill_id, +created_at, +description, +object, +version +FROM openai.skills.versions +WHERE skill_id = '{{ skill_id }}' -- required +AND "order" = '{{ order }}' +AND after = '{{ after }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## `DELETE` examples + + + + +No description available. + +```sql +DELETE FROM openai.skills.versions +WHERE skill_id = '{{ skill_id }}' --required +AND version = '{{ version }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/uploads/index.md b/website/docs/services/uploads/index.md index 5b02b6a..6e04b8e 100644 --- a/website/docs/services/uploads/index.md +++ b/website/docs/services/uploads/index.md @@ -16,22 +16,18 @@ image: /img/stackql-openai-provider-featured-image.png uploads service documentation. -:::info Service Summary +:::info[Service Summary] -
-
-total resources: 2
-
-
+total resources: __1__ ::: ## Resources \ No newline at end of file diff --git a/website/docs/services/uploads/upload_parts/index.md b/website/docs/services/uploads/upload_parts/index.md deleted file mode 100644 index 0e0e1f6..0000000 --- a/website/docs/services/uploads/upload_parts/index.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: upload_parts -hide_title: false -hide_table_of_contents: false -keywords: - - upload_parts - - uploads - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a upload_parts resource. - -## Overview - - - - -
Nameupload_parts
TypeResource
Id
- -## Fields -`SELECT` not supported for this resource, use `SHOW METHODS` to view available operations for the resource. - - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `INSERT` | | | - -## `INSERT` example - -Use the following StackQL query and manifest file to create a new upload_parts resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.uploads.upload_parts ( -upload_id -) -SELECT -'{{ upload_id }}' -; -``` - - - - -```yaml -- name: upload_parts - props: - - name: upload_id - value: string - -``` - - diff --git a/website/docs/services/uploads/uploads/index.md b/website/docs/services/uploads/uploads/index.md index 899462a..df85770 100644 --- a/website/docs/services/uploads/uploads/index.md +++ b/website/docs/services/uploads/uploads/index.md @@ -1,4 +1,4 @@ ---- +--- title: uploads hide_title: false hide_table_of_contents: false @@ -15,6 +15,7 @@ image: /img/stackql-openai-provider-featured-image.png --- import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -22,75 +23,214 @@ Creates, updates, deletes, gets or lists a uploads resource. ## Overview - +
Nameuploads
Name
TypeResource
Id
## Fields + +The following fields are returned by `SELECT` queries: + `SELECT` not supported for this resource, use `SHOW METHODS` to view available operations for the resource. ## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `INSERT` | | | -| | `EXEC` | | | -| | `EXEC` | | | -## `INSERT` example +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
filename, purpose, bytes, mime_typeopenai-organization, openai-project
upload_idopenai-organization, openai-project
upload_id, part_idsopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the Upload.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
-Use the following StackQL query and manifest file to create a new uploads resource. +## `INSERT` examples - + { label: 'create', value: 'create' }, + { label: 'Manifest', value: 'manifest' } + ]} +> + + +No description available. ```sql -/*+ create */ INSERT INTO openai.uploads.uploads ( -data__filename, -data__purpose, -data__bytes, -data__mime_type +filename, +purpose, +bytes, +mime_type, +expires_after, +"openai-organization", +"openai-project" ) SELECT -'{{ filename }}', -'{{ purpose }}', -'{{ bytes }}', -'{{ mime_type }}' +'{{ filename }}' /* required */, +'{{ purpose }}' /* required */, +{{ bytes }} /* required */, +'{{ mime_type }}' /* required */, +'{{ expires_after }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +bytes, +created_at, +expires_at, +file, +filename, +object, +purpose, +status ; ``` - -```yaml +{`# Description fields are for documentation purposes - name: uploads props: - - name: data__bytes - value: string - - name: data__filename - value: string - - name: data__mime_type - value: string - - name: data__purpose - value: string - name: filename - value: string + value: "{{ filename }}" + description: | + The name of the file to upload. - name: purpose - value: string + value: "{{ purpose }}" + description: | + The intended purpose of the uploaded file. + See the [documentation on File + purposes](https://platform.openai.com/docs/api-reference/files/create#files-create-purpose). + valid_values: ['assistants', 'batch', 'fine-tune', 'vision'] - name: bytes - value: integer + value: {{ bytes }} + description: | + The number of bytes in the file you are uploading. - name: mime_type - value: string + value: "{{ mime_type }}" + description: | + The MIME type of the file. + This must fall within the supported MIME types for your file purpose. See + the supported MIME types for assistants and vision. + - name: expires_after + 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. + value: + anchor: "{{ anchor }}" + seconds: {{ seconds }} + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} + + + + +## Lifecycle Methods + + + + +OK + +```sql +EXEC openai.uploads.uploads.cancel +@upload_id='{{ upload_id }}' --required, +@openai-organization='{{ openai-organization }}', +@openai-project='{{ openai-project }}' +; +``` + + + +OK + +```sql +EXEC openai.uploads.uploads.complete +@upload_id='{{ upload_id }}' --required, +@openai-organization='{{ openai-organization }}', +@openai-project='{{ openai-project }}' +@@json= +'{ +"part_ids": "{{ part_ids }}", +"md5": "{{ md5 }}" +}' +; ``` diff --git a/website/docs/services/users/users/index.md b/website/docs/services/users/users/index.md deleted file mode 100644 index 9fccb49..0000000 --- a/website/docs/services/users/users/index.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: users -hide_title: false -hide_table_of_contents: false -keywords: - - users - - users - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a users resource. - -## Overview - - - - -
Nameusers
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints | -| | `string` | The name of the user | -| | `integer` | The Unix timestamp (in seconds) of when the user was added. | -| | `string` | The email address of the user | -| | `string` | The object type, which is always `organization.user` | -| | `string` | `owner` or `reader` | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `DELETE` | | | -| | `UPDATE` | | | - -## `SELECT` examples - - - - -```sql -SELECT -id, -name, -added_at, -email, -object, -role -FROM openai.users.users -; -``` -## `UPDATE` example - -Updates a users resource. - -```sql -/*+ update */ -UPDATE openai.users.users -SET -role = '{{ role }}' -WHERE -user_id = '{{ user_id }}' -AND data__role = '{{ data__role }}'; -``` - -## `DELETE` example - -Deletes the specified users resource. - -```sql -/*+ delete */ -DELETE FROM openai.users.users -WHERE user_id = '{{ user_id }}'; -``` diff --git a/website/docs/services/vector_stores/file_batch_files/index.md b/website/docs/services/vector_stores/file_batch_files/index.md new file mode 100644 index 0000000..05e092f --- /dev/null +++ b/website/docs/services/vector_stores/file_batch_files/index.md @@ -0,0 +1,223 @@ +--- +title: file_batch_files +hide_title: false +hide_table_of_contents: false +keywords: + - file_batch_files + - vector_stores + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a file_batch_files resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
stringThe ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers. (x-oaiTypeLabel: map)
objectThe strategy used to chunk the file. (title: Static Chunking Strategy)
integer (unixtime)The Unix timestamp (in seconds) for when the vector store file was created.
objectThe last error associated with this vector store file. Will be `null` if there are no errors.
stringThe object type, which is always `vector_store.file`. (vector_store.file)
stringThe 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. (in_progress, completed, cancelled, failed)
integerThe total vector store usage in bytes. Note that this may be different from the original file size.
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
vector_store_id, batch_idlimit, order, after, before, filter, openai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the file batch that the files belong to.
stringThe ID of the vector store that the files belong to.
stringA cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
stringA cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
stringFilter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.
integerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
+ +## `SELECT` examples + + + + +OK + +```sql +SELECT +id, +vector_store_id, +attributes, +chunking_strategy, +created_at, +last_error, +object, +status, +usage_bytes +FROM openai.vector_stores.file_batch_files +WHERE vector_store_id = '{{ vector_store_id }}' -- required +AND batch_id = '{{ batch_id }}' -- required +AND "order" = '{{ order }}' +AND after = '{{ after }}' +AND before = '{{ before }}' +AND filter = '{{ filter }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/vector_stores/file_batches/index.md b/website/docs/services/vector_stores/file_batches/index.md new file mode 100644 index 0000000..be3b48b --- /dev/null +++ b/website/docs/services/vector_stores/file_batches/index.md @@ -0,0 +1,309 @@ +--- +title: file_batches +hide_title: false +hide_table_of_contents: false +keywords: + - file_batches + - vector_stores + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a file_batches resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
stringThe ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
integer (unixtime)The Unix timestamp (in seconds) for when the vector store files batch was created.
object
stringThe object type, which is always `vector_store.file_batch`. (vector_store.files_batch)
stringThe status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`. (in_progress, completed, cancelled, failed)
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
vector_store_id, batch_idopenai-organization, openai-project
vector_store_id, file_ids, filesopenai-organization, openai-projectThe maximum number of files in a single batch request is 2000.
Vector 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`).
For ingesting multiple files into the same vector store, this batch endpoint is recommended.
vector_store_id, batch_idopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the file batch to cancel.
stringThe ID of the vector store that the file batch belongs to.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
+ +## `SELECT` examples + + + + +OK + +```sql +SELECT +id, +vector_store_id, +created_at, +file_counts, +object, +status +FROM openai.vector_stores.file_batches +WHERE vector_store_id = '{{ vector_store_id }}' -- required +AND batch_id = '{{ batch_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## `INSERT` examples + + + + +The maximum number of files in a single batch request is 2000.
Vector 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`).
For ingesting multiple files into the same vector store, this batch endpoint is recommended.
+ +```sql +INSERT INTO openai.vector_stores.file_batches ( +file_ids, +files, +chunking_strategy, +attributes, +vector_store_id, +"openai-organization", +"openai-project" +) +SELECT +'{{ file_ids }}' /* required */, +'{{ files }}' /* required */, +'{{ chunking_strategy }}', +'{{ attributes }}', +'{{ vector_store_id }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +vector_store_id, +created_at, +file_counts, +object, +status +; +``` +
+ + +{`# Description fields are for documentation purposes +- name: file_batches + props: + - name: vector_store_id + value: "{{ vector_store_id }}" + description: Required parameter for the file_batches resource. + - name: file_ids + value: + - "{{ file_ids }}" + description: | + A list of [File](https://platform.openai.com/docs/api-reference/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\`. + - name: 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\`. + value: + - file_id: "{{ file_id }}" + chunking_strategy: + type: "{{ type }}" + static: + max_chunk_size_tokens: {{ max_chunk_size_tokens }} + chunk_overlap_tokens: {{ chunk_overlap_tokens }} + attributes: "{{ attributes }}" + - name: chunking_strategy + description: | + The chunking strategy used to chunk the file(s). If not set, will use the \`auto\` strategy. + value: + type: "{{ type }}" + static: + max_chunk_size_tokens: {{ max_chunk_size_tokens }} + chunk_overlap_tokens: {{ chunk_overlap_tokens }} + - name: attributes + value: "{{ attributes }}" + 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. Keys are strings + with a maximum length of 64 characters. Values are strings with a maximum + length of 512 characters, booleans, or numbers. + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} + + +
+ + +## Lifecycle Methods + + + + +OK + +```sql +EXEC openai.vector_stores.file_batches.cancel +@vector_store_id='{{ vector_store_id }}' --required, +@batch_id='{{ batch_id }}' --required, +@openai-organization='{{ openai-organization }}', +@openai-project='{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/vector_stores/files/index.md b/website/docs/services/vector_stores/files/index.md new file mode 100644 index 0000000..69ae22a --- /dev/null +++ b/website/docs/services/vector_stores/files/index.md @@ -0,0 +1,479 @@ +--- +title: files +hide_title: false +hide_table_of_contents: false +keywords: + - files + - vector_stores + - openai + - infrastructure-as-code + - configuration-as-data + - cloud inventory +description: Query, deploy and manage openai resources using SQL +custom_edit_url: null +image: /img/stackql-openai-provider-featured-image.png +--- + +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Creates, updates, deletes, gets or lists a files resource. + +## Overview + + + + +
Name
TypeResource
Id
+ +## Fields + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
stringThe ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers. (x-oaiTypeLabel: map)
objectThe strategy used to chunk the file. (title: Static Chunking Strategy)
integer (unixtime)The Unix timestamp (in seconds) for when the vector store file was created.
objectThe last error associated with this vector store file. Will be `null` if there are no errors.
stringThe object type, which is always `vector_store.file`. (vector_store.file)
stringThe 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. (in_progress, completed, cancelled, failed)
integerThe total vector store usage in bytes. Note that this may be different from the original file size.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
stringThe ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers. (x-oaiTypeLabel: map)
objectThe strategy used to chunk the file. (title: Static Chunking Strategy)
integer (unixtime)The Unix timestamp (in seconds) for when the vector store file was created.
objectThe last error associated with this vector store file. Will be `null` if there are no errors.
stringThe object type, which is always `vector_store.file`. (vector_store.file)
stringThe 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. (in_progress, completed, cancelled, failed)
integerThe total vector store usage in bytes. Note that this may be different from the original file size.
+
+
+ +## Methods + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
vector_store_id, file_idopenai-organization, openai-project
vector_store_idlimit, order, after, before, filter, openai-organization, openai-project
vector_store_id, file_idopenai-organization, openai-projectThis 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`.
For uploading multiple files to the same vector store, use the file batches endpoint to reduce request volume.
vector_store_id, file_id, attributesopenai-organization, openai-project
vector_store_id, file_idopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the file to delete.
stringThe ID of the vector store that the file belongs to.
stringA cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
stringA cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
stringFilter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.
integerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
+ +## `SELECT` examples + + + + +OK + +```sql +SELECT +id, +vector_store_id, +attributes, +chunking_strategy, +created_at, +last_error, +object, +status, +usage_bytes +FROM openai.vector_stores.files +WHERE vector_store_id = '{{ vector_store_id }}' -- required +AND file_id = '{{ file_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +OK + +```sql +SELECT +id, +vector_store_id, +attributes, +chunking_strategy, +created_at, +last_error, +object, +status, +usage_bytes +FROM openai.vector_stores.files +WHERE vector_store_id = '{{ vector_store_id }}' -- required +AND "order" = '{{ order }}' +AND after = '{{ after }}' +AND before = '{{ before }}' +AND filter = '{{ filter }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## `INSERT` examples + + + + +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`.
For uploading multiple files to the same vector store, use the file batches endpoint to reduce request volume. + +```sql +INSERT INTO openai.vector_stores.files ( +file_id, +chunking_strategy, +attributes, +vector_store_id, +"openai-organization", +"openai-project" +) +SELECT +'{{ file_id }}' /* required */, +'{{ chunking_strategy }}', +'{{ attributes }}', +'{{ vector_store_id }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +vector_store_id, +attributes, +chunking_strategy, +created_at, +last_error, +object, +status, +usage_bytes +; +``` +
+ + +{`# Description fields are for documentation purposes +- name: files + props: + - name: vector_store_id + value: "{{ vector_store_id }}" + description: Required parameter for the files resource. + - name: file_id + value: "{{ file_id }}" + description: | + A [File](https://platform.openai.com/docs/api-reference/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://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch) to minimize per-vector-store write requests. + - name: chunking_strategy + description: | + The chunking strategy used to chunk the file(s). If not set, will use the \`auto\` strategy. + value: + type: "{{ type }}" + static: + max_chunk_size_tokens: {{ max_chunk_size_tokens }} + chunk_overlap_tokens: {{ chunk_overlap_tokens }} + - name: attributes + value: "{{ attributes }}" + 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. Keys are strings + with a maximum length of 64 characters. Values are strings with a maximum + length of 512 characters, booleans, or numbers. + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} + + +
+ + +## `UPDATE` examples + + + + +No description available. + +```sql +UPDATE openai.vector_stores.files +SET +attributes = '{{ attributes }}' +WHERE +vector_store_id = '{{ vector_store_id }}' --required +AND file_id = '{{ file_id }}' --required +AND attributes = '{{ attributes }}' --required +AND "openai-organization" = '{{ openai-organization}}' +AND "openai-project" = '{{ openai-project}}' +RETURNING +id, +vector_store_id, +attributes, +chunking_strategy, +created_at, +last_error, +object, +status, +usage_bytes; +``` + + + + +## `DELETE` examples + + + + +No description available. + +```sql +DELETE FROM openai.vector_stores.files +WHERE vector_store_id = '{{ vector_store_id }}' --required +AND file_id = '{{ file_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + diff --git a/website/docs/services/vector_stores/files_in_vector_store_batches/index.md b/website/docs/services/vector_stores/files_in_vector_store_batches/index.md deleted file mode 100644 index bdf053a..0000000 --- a/website/docs/services/vector_stores/files_in_vector_store_batches/index.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: files_in_vector_store_batches -hide_title: false -hide_table_of_contents: false -keywords: - - files_in_vector_store_batches - - vector_stores - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a files_in_vector_store_batches resource. - -## Overview - - - - -
Namefiles_in_vector_store_batches
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `` | | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | - -## `SELECT` examples - - - - -```sql -SELECT -column_anon -FROM openai.vector_stores.files_in_vector_store_batches -WHERE batch_id = '{{ batch_id }}' -AND vector_store_id = '{{ vector_store_id }}'; -``` \ No newline at end of file diff --git a/website/docs/services/vector_stores/index.md b/website/docs/services/vector_stores/index.md index 3cec763..dba96e2 100644 --- a/website/docs/services/vector_stores/index.md +++ b/website/docs/services/vector_stores/index.md @@ -16,24 +16,20 @@ image: /img/stackql-openai-provider-featured-image.png vector_stores service documentation. -:::info Service Summary +:::info[Service Summary] -
-
-total resources: 4
-
-
+total resources: __4__ ::: ## Resources \ No newline at end of file diff --git a/website/docs/services/vector_stores/vector_store_file_batches/index.md b/website/docs/services/vector_stores/vector_store_file_batches/index.md deleted file mode 100644 index 1c80475..0000000 --- a/website/docs/services/vector_stores/vector_store_file_batches/index.md +++ /dev/null @@ -1,126 +0,0 @@ ---- -title: vector_store_file_batches -hide_title: false -hide_table_of_contents: false -keywords: - - vector_store_file_batches - - vector_stores - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a vector_store_file_batches resource. - -## Overview - - - - -
Namevector_store_file_batches
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints. | -| | `integer` | The Unix timestamp (in seconds) for when the vector store files batch was created. | -| | `object` | | -| | `string` | The object type, which is always `vector_store.file_batch`. | -| | `string` | The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`. | -| | `string` | The ID of the [vector store](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/files) is attached to. | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `INSERT` | | | -| | `EXEC` | | | - -## `SELECT` examples - - - - -```sql -SELECT -id, -created_at, -file_counts, -object, -status, -vector_store_id -FROM openai.vector_stores.vector_store_file_batches -WHERE batch_id = '{{ batch_id }}' -AND vector_store_id = '{{ vector_store_id }}'; -``` -## `INSERT` example - -Use the following StackQL query and manifest file to create a new vector_store_file_batches resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.vector_stores.vector_store_file_batches ( -data__file_ids, -data__chunking_strategy, -vector_store_id -) -SELECT -'{{ file_ids }}', -'{{ chunking_strategy }}', -'{{ vector_store_id }}' -; -``` - - - - -```sql -/*+ create */ -INSERT INTO openai.vector_stores.vector_store_file_batches ( -data__file_ids, -vector_store_id -) -SELECT -'{{ file_ids }}', -'{{ vector_store_id }}' -; -``` - - - - -```yaml -- name: vector_store_file_batches - props: - - name: vector_store_id - value: string - - name: data__file_ids - value: string - - name: file_ids - value: array - - name: chunking_strategy - props: - - name: type - value: string - -``` - - diff --git a/website/docs/services/vector_stores/vector_store_files/index.md b/website/docs/services/vector_stores/vector_store_files/index.md deleted file mode 100644 index a944a9a..0000000 --- a/website/docs/services/vector_stores/vector_store_files/index.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: vector_store_files -hide_title: false -hide_table_of_contents: false -keywords: - - vector_store_files - - vector_stores - - openai - - infrastructure-as-code - - configuration-as-data - - cloud inventory -description: Query, deploy and manage openai resources using SQL -custom_edit_url: null -image: /img/stackql-openai-provider-featured-image.png ---- - -import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Creates, updates, deletes, gets or lists a vector_store_files resource. - -## Overview - - - - -
Namevector_store_files
TypeResource
Id
- -## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints. | -| | `object` | The strategy used to chunk the file. | -| | `integer` | The Unix timestamp (in seconds) for when the vector store file was created. | -| | `object` | The last error associated with this vector store file. Will be `null` if there are no errors. | -| | `string` | The object type, which is always `vector_store.file`. | -| | `string` | 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. | -| | `integer` | The total vector store usage in bytes. Note that this may be different from the original file size. | -| | `string` | The ID of the [vector store](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/files) is attached to. | - -## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `INSERT` | | | -| | `DELETE` | | | - -## `SELECT` examples - - - - -```sql -SELECT -id, -chunking_strategy, -created_at, -last_error, -object, -status, -usage_bytes, -vector_store_id -FROM openai.vector_stores.vector_store_files -WHERE vector_store_id = '{{ vector_store_id }}'; -``` -## `INSERT` example - -Use the following StackQL query and manifest file to create a new vector_store_files resource. - - - - -```sql -/*+ create */ -INSERT INTO openai.vector_stores.vector_store_files ( -data__file_id, -data__chunking_strategy, -vector_store_id -) -SELECT -'{{ file_id }}', -'{{ chunking_strategy }}', -'{{ vector_store_id }}' -; -``` - - - - -```sql -/*+ create */ -INSERT INTO openai.vector_stores.vector_store_files ( -data__file_id, -vector_store_id -) -SELECT -'{{ file_id }}', -'{{ vector_store_id }}' -; -``` - - - - -```yaml -- name: vector_store_files - props: - - name: vector_store_id - value: string - - name: data__file_id - value: string - - name: file_id - value: string - - name: chunking_strategy - props: - - name: type - value: string - -``` - - - -## `DELETE` example - -Deletes the specified vector_store_files resource. - -```sql -/*+ delete */ -DELETE FROM openai.vector_stores.vector_store_files -WHERE file_id = '{{ file_id }}' -AND vector_store_id = '{{ vector_store_id }}'; -``` diff --git a/website/docs/services/vector_stores/vector_stores/index.md b/website/docs/services/vector_stores/vector_stores/index.md index 6ed32f2..791fc57 100644 --- a/website/docs/services/vector_stores/vector_stores/index.md +++ b/website/docs/services/vector_stores/vector_stores/index.md @@ -1,4 +1,4 @@ ---- +--- title: vector_stores hide_title: false hide_table_of_contents: false @@ -15,6 +15,7 @@ image: /img/stackql-openai-provider-featured-image.png --- import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; +import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -22,39 +23,309 @@ Creates, updates, deletes, gets or lists a vector_stores resource. ## Overview - +
Namevector_stores
Name
TypeResource
Id
## Fields -| Name | Datatype | Description | -|:-----|:---------|:------------| -| | `string` | The identifier, which can be referenced in API endpoints. | -| | `string` | The name of the vector store. | -| | `integer` | The Unix timestamp (in seconds) for when the vector store was created. | -| | `object` | The expiration policy for a vector store. | -| | `integer` | The Unix timestamp (in seconds) for when the vector store will expire. | -| | `object` | | -| | `integer` | The Unix timestamp (in seconds) for when the vector store was last active. | -| | `object` | 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. | -| | `string` | The object type, which is always `vector_store`. | -| | `string` | 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. | -| | `integer` | The total number of bytes used by the files in the vector store. | + +The following fields are returned by `SELECT` queries: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
stringThe name of the vector store.
integer (unixtime)The Unix timestamp (in seconds) for when the vector store was created.
objectThe expiration policy for a vector store. (title: Vector store expiration policy)
integer (unixtime)The Unix timestamp (in seconds) for when the vector store will expire.
object
integer (unixtime)The Unix timestamp (in seconds) for when the vector store was last active.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe object type, which is always `vector_store`. (vector_store)
stringThe 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. (expired, in_progress, completed)
integerThe total number of bytes used by the files in the vector store.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe identifier, which can be referenced in API endpoints.
stringThe name of the vector store.
integer (unixtime)The Unix timestamp (in seconds) for when the vector store was created.
objectThe expiration policy for a vector store. (title: Vector store expiration policy)
integer (unixtime)The Unix timestamp (in seconds) for when the vector store will expire.
object
integer (unixtime)The Unix timestamp (in seconds) for when the vector store was last active.
objectSet 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. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
stringThe object type, which is always `vector_store`. (vector_store)
stringThe 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. (expired, in_progress, completed)
integerThe total number of bytes used by the files in the vector store.
+
+
## Methods -| Name | Accessible by | Required Params | Description | -|:-----|:--------------|:----------------|:------------| -| | `SELECT` | | | -| | `SELECT` | | | -| | `INSERT` | | | -| | `DELETE` | | | -| | `UPDATE` | | | + +The following methods are available for this resource: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAccessible byRequired ParamsOptional ParamsDescription
vector_store_idopenai-organization, openai-project
limit, order, after, before, openai-organization, openai-project
openai-organization, openai-project
vector_store_idopenai-organization, openai-project
vector_store_idopenai-organization, openai-project
vector_store_id, queryopenai-organization, openai-project
+ +## Parameters + +Parameters can be passed in the `WHERE` clause of a query. Check the [Methods](#methods) section to see which parameters are required or optional for each operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDatatypeDescription
stringThe ID of the vector store to search.
stringA cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
stringA cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
integerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL `LIMIT` clause - `SELECT ... LIMIT 10` sends `limit=10` on the wire. Setting it explicitly in a `WHERE` clause is not required.
stringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
stringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
stringSort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
## `SELECT` examples + + +OK +```sql +SELECT +id, +name, +created_at, +expires_after, +expires_at, +file_counts, +last_active_at, +metadata, +object, +status, +usage_bytes +FROM openai.vector_stores.vector_stores +WHERE vector_store_id = '{{ vector_store_id }}' -- required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + +OK ```sql SELECT @@ -70,88 +341,207 @@ object, status, usage_bytes FROM openai.vector_stores.vector_stores +WHERE "order" = '{{ order }}' +AND after = '{{ after }}' +AND before = '{{ before }}' +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' ; ``` -## `INSERT` example + + -Use the following StackQL query and manifest file to create a new vector_stores resource. + +## `INSERT` examples - + { label: 'create', value: 'create' }, + { label: 'Manifest', value: 'manifest' } + ]} +> + + +No description available. ```sql -/*+ create */ INSERT INTO openai.vector_stores.vector_stores ( -data__file_ids, -data__name, -data__expires_after, -data__chunking_strategy, -data__metadata +file_ids, +name, +description, +expires_after, +chunking_strategy, +metadata, +"openai-organization", +"openai-project" ) SELECT '{{ file_ids }}', '{{ name }}', +'{{ description }}', '{{ expires_after }}', '{{ chunking_strategy }}', -'{{ metadata }}' +'{{ metadata }}', +'{{ openai-organization }}', +'{{ openai-project }}' +RETURNING +id, +name, +created_at, +expires_after, +expires_at, +file_counts, +last_active_at, +metadata, +object, +status, +usage_bytes ; ``` - -```yaml +{`# Description fields are for documentation purposes - name: vector_stores props: - name: file_ids - value: array + value: + - "{{ file_ids }}" + description: | + A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that the vector store should use. Useful for tools like \`file_search\` that can access files. - name: name - value: string + value: "{{ name }}" + description: | + The name of the vector store. + - name: description + value: "{{ description }}" + description: | + A description for the vector store. Can be used to describe the vector store's purpose. - name: expires_after - props: - - name: anchor - value: string - - name: days - value: integer + description: | + The expiration policy for a vector store. + value: + anchor: "{{ anchor }}" + days: {{ days }} - name: chunking_strategy - props: - - name: type - value: string + 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. + value: + type: "{{ type }}" + static: + max_chunk_size_tokens: {{ max_chunk_size_tokens }} + chunk_overlap_tokens: {{ chunk_overlap_tokens }} - name: metadata - value: object + value: "{{ 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. + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + - name: openai-organization + value: "{{ openai-organization }}" + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as \`openai_organization\`. + - name: openai-project + value: "{{ openai-project }}" + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. + description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as \`openai_project\`. +`} -``` -## `UPDATE` example -Updates a vector_stores resource. +## `UPDATE` examples + + + + +No description available. ```sql -/*+ update */ UPDATE openai.vector_stores.vector_stores SET name = '{{ name }}', expires_after = '{{ expires_after }}', metadata = '{{ metadata }}' WHERE -vector_store_id = '{{ vector_store_id }}'; +vector_store_id = '{{ vector_store_id }}' --required +AND "openai-organization" = '{{ openai-organization}}' +AND "openai-project" = '{{ openai-project}}' +RETURNING +id, +name, +created_at, +expires_after, +expires_at, +file_counts, +last_active_at, +metadata, +object, +status, +usage_bytes; ``` + + -## `DELETE` example -Deletes the specified vector_stores resource. +## `DELETE` examples + + + + +No description available. ```sql -/*+ delete */ DELETE FROM openai.vector_stores.vector_stores -WHERE vector_store_id = '{{ vector_store_id }}'; +WHERE vector_store_id = '{{ vector_store_id }}' --required +AND "openai-organization" = '{{ openai-organization }}' +AND "openai-project" = '{{ openai-project }}' +; +``` + + + + +## Lifecycle Methods + + + + +OK + +```sql +EXEC openai.vector_stores.vector_stores.search +@vector_store_id='{{ vector_store_id }}' --required, +@openai-organization='{{ openai-organization }}', +@openai-project='{{ openai-project }}' +@@json= +'{ +"query": "{{ query }}", +"rewrite_query": {{ rewrite_query }}, +"max_num_results": {{ max_num_results }}, +"filters": "{{ filters }}", +"ranking_options": "{{ ranking_options }}" +}' +; ``` + + diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 98b03c6..ac5701c 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -1,232 +1,36 @@ -// @ts-check -// `@type` JSDoc annotations allow editor autocompletion and type checking -// (when paired with `@ts-check`). -// There are various equivalent ways to declare your Docusaurus config. -// See: https://docusaurus.io/docs/api/docusaurus-config - import {themes as prismThemes} from 'prism-react-renderer'; - -// Provider configuration - change these for different providers -const providerName = "openai"; -const providerTitle = "OpenAI"; - -const providerDropDownListItems = [ - { - label: 'AWS', - to: '/providers/aws', - }, - { - label: 'Azure', - to: '/providers/azure', - }, - { - label: 'Google', - to: '/providers/google', - }, - { - label: 'Databricks', - to: '/providers/databricks', - }, - { - label: 'Snowflake', - to: '/providers/snowflake', - }, - { - label: 'Confluent', - to: '/providers/confluent', - }, - { - label: 'Okta', - to: '/providers/okta', - }, - { - label: 'GitHub', - to: '/providers/github', - }, - { - label: 'OpenAI', - to: '/providers/openai', - }, - { - label: '... More', - to: '/providers', - }, -]; - -const footerStackQLItems = [ - { - label: 'Documentation', - to: '/stackqldocs', - }, - { - label: 'Install', - to: '/install', - }, - { - label: 'Contact us', - to: '/contact-us', - }, -]; - -const footerMoreItems = [ - { - label: 'Providers', - to: '/providers', - }, - { - label: 'stackql-deploy', - to: '/stackql-deploy', - }, - { - label: 'Blog', - to: '/blog', - }, - { - label: 'Tutorials', - to: '/tutorials', - }, -]; - -// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...) - -/** @type {import('@docusaurus/types').Config} */ -const config = { - title: `StackQL ${providerTitle} Provider`, - tagline: `Query and Provision ${providerTitle} Resources using StackQL`, - favicon: 'img/favicon.ico', - staticDirectories: ['static'], - // Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future - future: { - v4: true, // Improve compatibility with the upcoming Docusaurus v4 - }, - - // Set the production url of your site here - url: `https://${providerName}-provider.stackql.io`, - // Set the // pathname under which your site is served - // For GitHub pages deployment, it is often '//' - baseUrl: '/', - - // GitHub pages deployment config. - // If you aren't using GitHub pages, you don't need these. - organizationName: 'stackql', // Usually your GitHub org/user name. - projectName: `stackql-provider-${providerName}`, // Usually your repo name. - - onBrokenLinks: 'warn', - onBrokenMarkdownLinks: 'warn', - - // Even if you don't use internationalization, you can use this field to set - // useful metadata like html lang. For example, if your site is Chinese, you - // may want to replace "en" with "zh-Hans". - i18n: { - defaultLocale: 'en', - locales: ['en'], - }, - - presets: [ - [ - 'classic', - /** @type {import('@docusaurus/preset-classic').Options} */ - ({ - docs: { - sidebarPath: './sidebars.js', - // Please change this to your repo. - // Remove this to remove the "edit this page" links. - // editUrl: 'https://github.com/stackql/stackql-deploy/tree/main/website/', - routeBasePath: '/', // Set the docs to be the root of the site - }, - theme: { - customCss: './src/css/custom.css', - }, - }), - ], - ], - - themeConfig: - /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ - ({ - // Replace with your project's social card - image: 'img/stackql-cover.png', - navbar: { - logo: { - alt: 'StackQL Registry', - href: '/providers', - src: 'img/stackql-registry-logo.svg', - srcDark: 'img/stackql-registry-logo-white.svg', - }, - items: [ - { - to: '/install', - position: 'left', - label: 'Install', - }, - { - to: '/stackql-deploy', - position: 'left', - label: 'stackql-deploy', - }, - { - to: '/providers', - type: 'dropdown', - label: 'Providers', - position: 'left', - items: providerDropDownListItems, - }, - { - type: 'dropdown', - label: 'More', - position: 'left', - items: [ - { - to: '/stackqldocs', - label: 'StackQL Docs', - }, - { - to: '/blog', - label: 'Blog', - }, - { - to: '/tutorials', - label: 'Tutorials', - }, - ], - }, - { - href: 'https://github.com/stackql/stackql', - position: 'right', - className: 'header-github-link', - 'aria-label': 'GitHub repository', - }, - ], - }, - footer: { - style: 'dark', - logo: { - alt: 'StackQL', - href: '/providers', - src: 'img/stackql-registry-logo.svg', - srcDark: 'img/stackql-registry-logo-white.svg', - }, - links: [ - { - title: 'StackQL', - items: footerStackQLItems, - }, - { - title: 'More', - items: footerMoreItems, - }, - ], - copyright: `© ${new Date().getFullYear()} StackQL Studios`, - }, - colorMode: { - // using user system preferences, instead of the hardcoded defaultMode - respectPrefersColorScheme: true, - }, - prism: { - theme: prismThemes.nightOwl, - darkTheme: prismThemes.dracula, - }, - }), +import { createConfig } from './.shared-config/index.js'; +import { providerName, providerTitle } from './provider.js'; + +const config = createConfig({ + providerName, + providerTitle, + prismThemes, + overrides: { + future: { + v4: true, + faster: true, + }, + }, +}); + +// This provider's website lives at website/ within the canonical +// stackql-registry/stackql-provider-openai repo, so the "Edit this page" links +// point at that subdirectory (the shared config default omits the website/ path). +config.projectName = 'stackql-provider-openai'; +config.presets[0][1].docs.editUrl = + 'https://github.com/stackql-registry/stackql-provider-openai/edit/main/website/'; + +// Use the locally vendored registry-branded logos (STACKQL>> | REGISTRY) instead +// of the shared config's hotlinked main-site wordmark - self-contained assets, no +// cross-origin fetch. global.css swaps in the -mobile variants below 996px. +const registryLogo = { + alt: 'StackQL', + href: '/', + src: 'img/stackql-registry-logo.svg', + srcDark: 'img/stackql-registry-logo-white.svg', }; +config.themeConfig.navbar.logo = { ...registryLogo }; +config.themeConfig.footer.logo = { ...registryLogo }; export default config; diff --git a/website/package.json b/website/package.json index 8f57f6c..923281d 100644 --- a/website/package.json +++ b/website/package.json @@ -4,6 +4,9 @@ "private": true, "scripts": { "docusaurus": "docusaurus", + "vendor-config": "rimraf .shared-config && git clone --depth 1 --branch main https://github.com/stackql/docusaurus-config.git .shared-config", + "prestart": "yarn vendor-config", + "prebuild": "yarn vendor-config", "start": "docusaurus start", "build": "docusaurus build", "swizzle": "docusaurus swizzle", @@ -14,8 +17,11 @@ "write-heading-ids": "docusaurus write-heading-ids" }, "dependencies": { - "@docusaurus/core": "3.8.1", - "@docusaurus/preset-classic": "3.8.1", + "@docusaurus/core": "^3.10.2", + "@docusaurus/faster": "^3.10.2", + "@docusaurus/plugin-ideal-image": "^3.10.2", + "@docusaurus/preset-classic": "^3.10.2", + "@docusaurus/theme-mermaid": "^3.10.2", "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.1", "@iconify/react": "^6.0.0", @@ -29,8 +35,25 @@ "react-dom": "^19.0.0" }, "devDependencies": { - "@docusaurus/module-type-aliases": "3.8.1", - "@docusaurus/types": "3.8.1" + "@docusaurus/module-type-aliases": "^3.10.2", + "@docusaurus/types": "^3.10.2", + "rimraf": "^6.0.1" + }, + "overrides": { + "rimraf": "^6.0.1", + "glob": "^13.0.0", + "memfs": "^4.17.0", + "uuid": "^11.0.0", + "@ungap/structured-clone": "^1.3.1", + "sharp": "^0.33.0" + }, + "resolutions": { + "rimraf": "^6.0.1", + "glob": "^13.0.0", + "memfs": "^4.17.0", + "uuid": "^11.0.0", + "@ungap/structured-clone": "^1.3.1", + "sharp": "^0.33.0" }, "browserslist": { "production": [ @@ -45,7 +68,7 @@ ] }, "engines": { - "node": ">=18.0" + "node": ">=20.0" }, "license": "MIT" } diff --git a/website/provider.js b/website/provider.js new file mode 100644 index 0000000..29cc744 --- /dev/null +++ b/website/provider.js @@ -0,0 +1,2 @@ +export const providerName = 'openai'; +export const providerTitle = 'OpenAI'; diff --git a/website/sidebars.js b/website/sidebars.js index 72e3166..f719984 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -1,42 +1,14 @@ -// @ts-check +import { providerTitle } from './provider.js'; -// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...) - -/** - * Creating a sidebar enables you to: - - create an ordered group of docs - - render a sidebar for each doc of that group - - provide next/previous navigation - - The sidebars can be generated from the filesystem, or explicitly defined here. - - Create as many sidebars as you want. - - @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} - */ - -import config from './docusaurus.config'; - -const providerTitle = config.title.replace(/^StackQL /, '').replace(/ Provider$/, ''); - - const sidebars = { +const sidebars = { mainSidebar: [ - { - type: 'link', - label: 'All Providers', - href: '/providers', - }, + { type: 'link', label: 'All Providers', href: '/providers' }, { type: 'category', label: `${providerTitle} Provider`, - link: {type: 'doc', id: 'provider-intro'}, - items: [ - { - type: 'autogenerated', - dirName: 'services', - } - ] - }, + link: { type: 'doc', id: 'provider-intro' }, + items: [{ type: 'autogenerated', dirName: 'services' }], + }, ], }; diff --git a/website/src/components/SchemaTable/SchemaTable.js b/website/src/components/SchemaTable/SchemaTable.js new file mode 100644 index 0000000..fa75677 --- /dev/null +++ b/website/src/components/SchemaTable/SchemaTable.js @@ -0,0 +1,49 @@ +import React, { useState } from 'react'; +import styles from './SchemaTable.module.css'; + +function SchemaRow({ name, type, description, children, depth = 0 }) { + const [expanded, setExpanded] = useState(false); + const hasChildren = children && children.length > 0; + + return ( + <> + + + {hasChildren && ( + setExpanded(!expanded)} + > + {expanded ? '▼' : '▶'} + + )} + {name} + + {type} + + + {expanded && children?.map((child, idx) => ( + + ))} + + ); +} + +export default function SchemaTable({ fields }) { + return ( + + + + + + + + + + {fields.map((field, idx) => ( + + ))} + +
NameDatatypeDescription
+ ); +} \ No newline at end of file diff --git a/website/src/components/SchemaTable/SchemaTable.module.css b/website/src/components/SchemaTable/SchemaTable.module.css new file mode 100644 index 0000000..9b88751 --- /dev/null +++ b/website/src/components/SchemaTable/SchemaTable.module.css @@ -0,0 +1,27 @@ +.schemaTable { + width: 100%; + border-collapse: collapse; +} + +.schemaTable th, +.schemaTable td { + border: 1px solid var(--ifm-table-border-color); + padding: 8px 12px; + text-align: left; +} + +.schemaTable th { + background: var(--ifm-table-head-background); +} + +.row:hover { + background: var(--ifm-table-stripe-background); +} + +.expander { + cursor: pointer; + margin-right: 8px; + user-select: none; + color: var(--ifm-color-primary); + font-size: 10px; +} \ No newline at end of file diff --git a/website/src/components/StackqlDeployDropdown/StackqlDeployDropdown.js b/website/src/components/StackqlDeployDropdown/StackqlDeployDropdown.js new file mode 100644 index 0000000..f616a0c --- /dev/null +++ b/website/src/components/StackqlDeployDropdown/StackqlDeployDropdown.js @@ -0,0 +1,400 @@ +import React, { useState } from 'react'; +import Button from '@mui/material/Button'; +import Menu from '@mui/material/Menu'; +import MenuItem from '@mui/material/MenuItem'; +import ListItemIcon from '@mui/material/ListItemIcon'; +import ListItemText from '@mui/material/ListItemText'; +import DownloadIcon from '@mui/icons-material/Download'; +import ContentCopyIcon from '@mui/icons-material/ContentCopy'; +import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; +import {useLocation} from '@docusaurus/router'; +import styles from './StackqlDeployDropdown.module.css'; + +/** + * Collects all DOM elements between a heading and the next

. + */ +function getElementsBetweenHeadings(heading) { + const elements = []; + let el = heading.nextElementSibling; + while (el && el.tagName !== 'H2') { + elements.push(el); + el = el.nextElementSibling; + } + return elements; +} + +/** + * Extracts text from a element, preserving newlines. + * prism-react-renderer wraps each line in a child element (div or span), + * and textContent concatenates them without newlines, so we join manually. + */ +function getCodeText(codeEl) { + if (codeEl.children.length > 0) { + return Array.from(codeEl.children) + .map(line => line.textContent.replace(/\n$/, '')) + .join('\n'); + } + return codeEl.textContent; +} + +/** + * Extracts the text content of a code block from within a set of elements. + * If preferredTab is provided, looks for a tab with that label first. + */ +function extractCodeFromElements(elements, preferredTab) { + if (preferredTab) { + for (const el of elements) { + const tabs = el.querySelectorAll('[role="tab"]'); + const panels = el.querySelectorAll('[role="tabpanel"]'); + for (let i = 0; i < tabs.length; i++) { + const tabLabel = tabs[i].textContent.trim().toLowerCase(); + if (tabLabel === preferredTab.toLowerCase() && panels[i]) { + const codeEl = panels[i].querySelector('pre code'); + if (codeEl) return getCodeText(codeEl); + } + } + } + } + // Fallback: first code block in the section + for (const el of elements) { + const codeEl = el.querySelector('pre code'); + if (codeEl) return getCodeText(codeEl); + } + return null; +} + +/** + * Scans the rendered page DOM for SQL example sections and extracts + * code blocks to build a context-aware stackql-deploy template. + * + * Section heading IDs generated by Docusaurus: + * ## `SELECT` examples -> #select-examples + * ## `INSERT` examples -> #insert-examples + * ## `UPDATE` examples -> #update-examples + * ## `REPLACE` examples -> #replace-examples + * ## `DELETE` examples -> #delete-examples + * ## Lifecycle Methods -> #lifecycle-methods + */ +function extractTemplateFromPage() { + const sections = {}; + + // --- SELECT (prefer "get" tab for a single-resource check) --- + const selectH2 = document.getElementById('select-examples'); + if (selectH2) { + const els = getElementsBetweenHeadings(selectH2); + sections.select = extractCodeFromElements(els, 'get (all properties)') + || extractCodeFromElements(els, 'get') + || extractCodeFromElements(els); + } + + // --- INSERT (prefer "create" tab -- skip "Manifest" yaml tab) --- + const insertH2 = document.getElementById('insert-examples') || document.getElementById('insert-example'); + if (insertH2) { + const els = getElementsBetweenHeadings(insertH2); + sections.insert = extractCodeFromElements(els, 'All Properties') + || extractCodeFromElements(els, 'create') + || extractCodeFromElements(els); + } + + // --- UPDATE --- + const updateH2 = document.getElementById('update-examples') || document.getElementById('update-example'); + if (updateH2) { + const els = getElementsBetweenHeadings(updateH2); + sections.update = extractCodeFromElements(els); + } + + // --- REPLACE --- + const replaceH2 = document.getElementById('replace-examples'); + if (replaceH2) { + const els = getElementsBetweenHeadings(replaceH2); + sections.replace = extractCodeFromElements(els); + } + + // --- DELETE (standalone section) --- + const deleteH2 = document.getElementById('delete-examples') || document.getElementById('delete-example'); + if (deleteH2) { + const els = getElementsBetweenHeadings(deleteH2); + sections.delete = extractCodeFromElements(els); + } + + // --- Lifecycle Methods: look for a "delete" tab if no standalone DELETE --- + if (!sections.delete) { + const lifecycleH2 = document.getElementById('lifecycle-methods'); + if (lifecycleH2) { + const els = getElementsBetweenHeadings(lifecycleH2); + sections.delete = extractCodeFromElements(els, 'delete'); + } + } + + return sections; +} + +/** + * Parses a SELECT SQL string into its components: + * fields - column names from the SELECT list + * table - fully-qualified table reference after FROM + * where - the raw WHERE clause (conditions only, no leading WHERE) + */ +function parseSelectSQL(sql) { + const selectFromMatch = sql.match(/SELECT\s+([\s\S]+?)\s+FROM\s+/i); + const fromMatch = sql.match(/FROM\s+(\S+)/i); + const whereMatch = sql.match(/WHERE\s+([\s\S]+?)(?:\s*;\s*$|$)/i); + + const fields = selectFromMatch + ? selectFromMatch[1] + .split(',') + .map(f => f.trim()) + .filter(f => f && f !== '*') + : []; + + const table = fromMatch ? fromMatch[1] : ''; + const where = whereMatch ? whereMatch[1].trim().replace(/;\s*$/, '').trim() : ''; + + return { fields, table, where }; +} + +// Parses column names from an INSERT INTO ... (...) statement +// and returns the base field names (stripping data__ prefix). +function parseInsertColumns(sql) { + const match = sql.match(/INSERT\s+INTO\s+\S+\s*\(([\s\S]+?)\)/i); + if (!match) return []; + return match[1] + .split(',') + // .map(c => c.trim().replace(/^data__/, '')) + .map(c => c.trim()) + .filter(Boolean); +} + +// Builds an "exists" hint query - a simplified count query using only the +// original WHERE params (required parameters from the page). +function buildExistsQuery(parsed) { + let sql = `SELECT count(*) as count\nFROM ${parsed.table}`; + if (parsed.where) { + const conditions = parsed.where.split(/\s+AND\s+/i).map(c => c.trim()); + sql += `\nWHERE ${conditions.join(' AND\n')}`; + } + sql += '\n;'; + return sql; +} + +// Builds a "statecheck" hint query - a count query where SELECT fields become +// equality checks in the WHERE clause, followed by the original WHERE params. +function buildStatecheckQuery(parsed) { + // Extract condition field names from WHERE clause to avoid duplicates + const whereConditionFields = new Set(); + if (parsed.where) { + parsed.where.split(/\s+AND\s+/i).forEach(c => { + const match = c.trim().match(/^\s*(\w+)\s*=/); + if (match) whereConditionFields.add(match[1].toLowerCase()); + }); + } + + // Filter out fields already in the WHERE clause (e.g., region) + const filteredFields = parsed.fields.filter(f => !whereConditionFields.has(f.toLowerCase())); + const fieldConditions = filteredFields.map(f => `${f} = {{ ${f} }}`); + + // Collect all WHERE conditions + const allConditions = [...fieldConditions]; + if (parsed.where) { + parsed.where.split(/\s+AND\s+/i).forEach(c => allConditions.push(c.trim())); + } + + let sql = `SELECT count(*) as count\nFROM ${parsed.table}`; + if (allConditions.length > 0) { + sql += `\nWHERE \n${allConditions.join(' AND\n')}`; + } + sql += '\n;'; + return sql; +} + +/** + * Builds the stackql-deploy IQL template from extracted sections. + * Only includes anchors for operations that actually exist on the page. + */ +function buildTemplate(sections) { + const parts = []; + let parsed = null; + + if (sections.select) { + parsed = parseSelectSQL(sections.select); + parts.push(`/*+ exists */\n${buildExistsQuery(parsed)}`); + } + + if (sections.insert) { + parts.push(sections.insert); + } + + if (sections.update) { + parts.push(sections.update); + } else if (sections.replace) { + parts.push(sections.replace); + } + + if (parsed) { + // If INSERT exists, narrow to mutable fields only (skip created_at, etc.) + let mutableParsed = parsed; + if (sections.insert) { + const insertColSet = new Set(parseInsertColumns(sections.insert)); + const mutableFields = parsed.fields.filter(f => insertColSet.has(f)); + if (mutableFields.length > 0) { + mutableParsed = { ...parsed, fields: mutableFields }; + } + } + + parts.push(`/*+ statecheck, retries=5, retry_delay=10 */\n${buildStatecheckQuery(mutableParsed)}`); + + // Use all GET fields minus region for exports + const exportFields = parsed.fields.filter(f => f.toLowerCase() !== 'region'); + let exportsSql = `SELECT\n${exportFields.join(',\n')}\nFROM ${parsed.table}`; + if (parsed.where) { + const conditions = parsed.where.split(/\s+AND\s+/i).map(c => c.trim()); + exportsSql += `\nWHERE ${conditions.join(' AND\n')}`; + } + exportsSql += ';'; + parts.push(`/*+ exports */\n${exportsSql}`); + } + + if (sections.delete) { + parts.push(sections.delete); + } + + return parts.join('\n\n'); +} + +function getResourceName(pathname) { + const match = pathname.match(/\/services\/[^/]+\/([^/]+)/); + return match ? match[1] : null; +} + +export default function StackqlDeployDropdown() { + const [anchorEl, setAnchorEl] = useState(null); + const [copied, setCopied] = useState(false); + const open = Boolean(anchorEl); + const location = useLocation(); + + const resourceName = getResourceName(location.pathname); + + // Only render on resource pages (URL: /services/{service}/{resource}) + if (!resourceName) return null; + + const filename = `${resourceName}.iql`; + + function getTemplate() { + const sections = extractTemplateFromPage(); + return buildTemplate(sections); + } + + const handleClick = (event) => { + setAnchorEl(event.currentTarget); + }; + + const handleClose = () => { + setAnchorEl(null); + }; + + const handleDownload = () => { + const template = getTemplate(); + if (!template) { + handleClose(); + return; + } + const blob = new Blob([template], { type: 'text/plain' }); + const url = URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = filename; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + URL.revokeObjectURL(url); + handleClose(); + }; + + const handleCopy = async () => { + const template = getTemplate(); + if (!template) { + handleClose(); + return; + } + try { + await navigator.clipboard.writeText(template); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + } catch { + const textarea = document.createElement('textarea'); + textarea.value = template; + document.body.appendChild(textarea); + textarea.select(); + document.execCommand('copy'); + document.body.removeChild(textarea); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + } + handleClose(); + }; + + return ( +
+ + + + + + + + Download + + + + + + + + {copied ? 'Copied!' : 'Copy'} + + + +
+ ); +} diff --git a/website/src/components/StackqlDeployDropdown/StackqlDeployDropdown.module.css b/website/src/components/StackqlDeployDropdown/StackqlDeployDropdown.module.css new file mode 100644 index 0000000..c63460e --- /dev/null +++ b/website/src/components/StackqlDeployDropdown/StackqlDeployDropdown.module.css @@ -0,0 +1,12 @@ +/* Only show on md+ viewports (Docusaurus default breakpoint: 996px) */ +.dropdownWrapper { + display: none; + flex-shrink: 0; +} + +@media screen and (min-width: 997px) { + .dropdownWrapper { + display: flex; + align-items: center; + } +} diff --git a/website/src/css/custom.css b/website/src/css/global.css similarity index 89% rename from website/src/css/custom.css rename to website/src/css/global.css index ce0b531..3e50218 100644 --- a/website/src/css/custom.css +++ b/website/src/css/global.css @@ -256,4 +256,32 @@ div:has(> .vhsImage) { .providerDocColumn { width: 100%; } - } \ No newline at end of file + } + +/* +* breadcrumbs with actions (stackql-deploy dropdown) +*/ +.breadcrumbs-with-actions { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: nowrap; +} + +.breadcrumbs-with-actions nav { + flex: 1; + min-width: 0; +} + +/* +* registry logo: swap to the narrower -mobile mark below the Docusaurus +* mobile breakpoint (996px), per theme +*/ +@media (max-width: 996px) { + .navbar__logo img[src$='stackql-registry-logo.svg'] { + content: url('/img/stackql-registry-logo-mobile.svg'); + } + .navbar__logo img[src$='stackql-registry-logo-white.svg'] { + content: url('/img/stackql-registry-logo-white-mobile.svg'); + } +} \ No newline at end of file diff --git a/website/src/pages/blog.js b/website/src/pages/blog.js deleted file mode 100644 index e435012..0000000 --- a/website/src/pages/blog.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Blog() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/contact-us.js b/website/src/pages/contact-us.js deleted file mode 100644 index b6850d8..0000000 --- a/website/src/pages/contact-us.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function ConactUs() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/install.js b/website/src/pages/install.js deleted file mode 100644 index 341a4bb..0000000 --- a/website/src/pages/install.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Install() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/providers/aws.js b/website/src/pages/providers/aws.js deleted file mode 100644 index 780099a..0000000 --- a/website/src/pages/providers/aws.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Registry() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/providers/azure.js b/website/src/pages/providers/azure.js deleted file mode 100644 index 467f77a..0000000 --- a/website/src/pages/providers/azure.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Registry() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/providers/confluent.js b/website/src/pages/providers/confluent.js deleted file mode 100644 index e886aaf..0000000 --- a/website/src/pages/providers/confluent.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Registry() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/providers/databricks.js b/website/src/pages/providers/databricks.js deleted file mode 100644 index a04b603..0000000 --- a/website/src/pages/providers/databricks.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Registry() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/providers/github.js b/website/src/pages/providers/github.js deleted file mode 100644 index b425c6c..0000000 --- a/website/src/pages/providers/github.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Registry() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/providers/google.js b/website/src/pages/providers/google.js deleted file mode 100644 index 01fe8b7..0000000 --- a/website/src/pages/providers/google.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Registry() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/providers/index.js b/website/src/pages/providers/index.js deleted file mode 100644 index 9afaa02..0000000 --- a/website/src/pages/providers/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Providers() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/providers/okta.js b/website/src/pages/providers/okta.js deleted file mode 100644 index cdddc72..0000000 --- a/website/src/pages/providers/okta.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Registry() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/providers/openai.js b/website/src/pages/providers/openai.js deleted file mode 100644 index 9884c84..0000000 --- a/website/src/pages/providers/openai.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Registry() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/providers/snowflake.js b/website/src/pages/providers/snowflake.js deleted file mode 100644 index 7b3ec43..0000000 --- a/website/src/pages/providers/snowflake.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Registry() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/stackql-deploy.js b/website/src/pages/stackql-deploy.js deleted file mode 100644 index 95e18b3..0000000 --- a/website/src/pages/stackql-deploy.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Deploy() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/stackqldocs.js b/website/src/pages/stackqldocs.js deleted file mode 100644 index 7182d93..0000000 --- a/website/src/pages/stackqldocs.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function StackQLDocs() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/pages/tutorials.js b/website/src/pages/tutorials.js deleted file mode 100644 index 2bb5f07..0000000 --- a/website/src/pages/tutorials.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Head from '@docusaurus/Head'; - -export default function Tutorials() { - return ( - - - - ); -}; \ No newline at end of file diff --git a/website/src/theme/DocBreadcrumbs/index.js b/website/src/theme/DocBreadcrumbs/index.js new file mode 100644 index 0000000..7f0bb4b --- /dev/null +++ b/website/src/theme/DocBreadcrumbs/index.js @@ -0,0 +1,12 @@ +import React from 'react'; +import DocBreadcrumbs from '@theme-original/DocBreadcrumbs'; +import StackqlDeployDropdown from '@site/src/components/StackqlDeployDropdown/StackqlDeployDropdown'; + +export default function DocBreadcrumbsWrapper(props) { + return ( +
+ + +
+ ); +} diff --git a/website/static/CNAME b/website/static/CNAME index 1f7a4f5..4ef0e9d 100644 --- a/website/static/CNAME +++ b/website/static/CNAME @@ -1 +1 @@ -snowflake-provider.stackql.io +openai-provider.stackql.io diff --git a/website/static/favicon-16x16.png b/website/static/favicon-16x16.png new file mode 100644 index 0000000..178c107 Binary files /dev/null and b/website/static/favicon-16x16.png differ diff --git a/website/static/favicon-32x32.png b/website/static/favicon-32x32.png new file mode 100644 index 0000000..f1efee0 Binary files /dev/null and b/website/static/favicon-32x32.png differ diff --git a/website/static/favicon.ico b/website/static/favicon.ico new file mode 100644 index 0000000..0145fbf Binary files /dev/null and b/website/static/favicon.ico differ diff --git a/website/static/img/docusaurus-social-card.jpg b/website/static/img/docusaurus-social-card.jpg new file mode 100644 index 0000000..ffcb448 Binary files /dev/null and b/website/static/img/docusaurus-social-card.jpg differ diff --git a/website/static/img/logo.svg b/website/static/img/logo.svg new file mode 100644 index 0000000..9db6d0d --- /dev/null +++ b/website/static/img/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/website/static/site.webmanifest b/website/static/site.webmanifest new file mode 100644 index 0000000..6411c2b --- /dev/null +++ b/website/static/site.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "StackQL OpenAI Provider", + "short_name": "StackQL OpenAI", + "icons": [ + { "src": "/favicon-32x32.png", "sizes": "32x32", "type": "image/png" }, + { "src": "/favicon-16x16.png", "sizes": "16x16", "type": "image/png" } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/website/yarn.lock b/website/yarn.lock index 00f1900..285c35b 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -2,192 +2,223 @@ # yarn lockfile v1 -"@algolia/abtesting@1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@algolia/abtesting/-/abtesting-1.3.0.tgz#3fade769bf5b03244baaee8034b83e2b49f8e86c" - integrity sha512-KqPVLdVNfoJzX5BKNGM9bsW8saHeyax8kmPFXul5gejrSPN3qss7PgsFH5mMem7oR8tvjvNkia97ljEYPYCN8Q== - dependencies: - "@algolia/client-common" "5.37.0" - "@algolia/requester-browser-xhr" "5.37.0" - "@algolia/requester-fetch" "5.37.0" - "@algolia/requester-node-http" "5.37.0" - -"@algolia/autocomplete-core@1.17.9": - version "1.17.9" - resolved "https://registry.yarnpkg.com/@algolia/autocomplete-core/-/autocomplete-core-1.17.9.tgz#83374c47dc72482aa45d6b953e89377047f0dcdc" - integrity sha512-O7BxrpLDPJWWHv/DLA9DRFWs+iY1uOJZkqUwjS5HSZAGcl0hIVCQ97LTLewiZmZ402JYUrun+8NqFP+hCknlbQ== - dependencies: - "@algolia/autocomplete-plugin-algolia-insights" "1.17.9" - "@algolia/autocomplete-shared" "1.17.9" - -"@algolia/autocomplete-plugin-algolia-insights@1.17.9": - version "1.17.9" - resolved "https://registry.yarnpkg.com/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.17.9.tgz#74c86024d09d09e8bfa3dd90b844b77d9f9947b6" - integrity sha512-u1fEHkCbWF92DBeB/KHeMacsjsoI0wFhjZtlCq2ddZbAehshbZST6Hs0Avkc0s+4UyBGbMDnSuXHLuvRWK5iDQ== - dependencies: - "@algolia/autocomplete-shared" "1.17.9" - -"@algolia/autocomplete-preset-algolia@1.17.9": - version "1.17.9" - resolved "https://registry.yarnpkg.com/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.17.9.tgz#911f3250544eb8ea4096fcfb268f156b085321b5" - integrity sha512-Na1OuceSJeg8j7ZWn5ssMu/Ax3amtOwk76u4h5J4eK2Nx2KB5qt0Z4cOapCsxot9VcEN11ADV5aUSlQF4RhGjQ== - dependencies: - "@algolia/autocomplete-shared" "1.17.9" - -"@algolia/autocomplete-shared@1.17.9": - version "1.17.9" - resolved "https://registry.yarnpkg.com/@algolia/autocomplete-shared/-/autocomplete-shared-1.17.9.tgz#5f38868f7cb1d54b014b17a10fc4f7e79d427fa8" - integrity sha512-iDf05JDQ7I0b7JEA/9IektxN/80a2MZ1ToohfmNS3rfeuQnIKI3IJlIafD0xu4StbtQTghx9T3Maa97ytkXenQ== - -"@algolia/client-abtesting@5.37.0": - version "5.37.0" - resolved "https://registry.yarnpkg.com/@algolia/client-abtesting/-/client-abtesting-5.37.0.tgz#37df3674ccc37dfb0aa4cbfea42002bb136fb909" - integrity sha512-Dp2Zq+x9qQFnuiQhVe91EeaaPxWBhzwQ6QnznZQnH9C1/ei3dvtmAFfFeaTxM6FzfJXDLvVnaQagTYFTQz3R5g== - dependencies: - "@algolia/client-common" "5.37.0" - "@algolia/requester-browser-xhr" "5.37.0" - "@algolia/requester-fetch" "5.37.0" - "@algolia/requester-node-http" "5.37.0" - -"@algolia/client-analytics@5.37.0": - version "5.37.0" - resolved "https://registry.yarnpkg.com/@algolia/client-analytics/-/client-analytics-5.37.0.tgz#6fb4d748e1af43d8bc9f955d73d98205ce1c1ee5" - integrity sha512-wyXODDOluKogTuZxRII6mtqhAq4+qUR3zIUJEKTiHLe8HMZFxfUEI4NO2qSu04noXZHbv/sRVdQQqzKh12SZuQ== - dependencies: - "@algolia/client-common" "5.37.0" - "@algolia/requester-browser-xhr" "5.37.0" - "@algolia/requester-fetch" "5.37.0" - "@algolia/requester-node-http" "5.37.0" - -"@algolia/client-common@5.37.0": - version "5.37.0" - resolved "https://registry.yarnpkg.com/@algolia/client-common/-/client-common-5.37.0.tgz#f7ca097c4bae44e4ea365ee8f420693d0005c98e" - integrity sha512-GylIFlPvLy9OMgFG8JkonIagv3zF+Dx3H401Uo2KpmfMVBBJiGfAb9oYfXtplpRMZnZPxF5FnkWaI/NpVJMC+g== - -"@algolia/client-insights@5.37.0": - version "5.37.0" - resolved "https://registry.yarnpkg.com/@algolia/client-insights/-/client-insights-5.37.0.tgz#f4f4011fc89bc0b2dfc384acc3c6fb38f633f4ec" - integrity sha512-T63afO2O69XHKw2+F7mfRoIbmXWGzgpZxgOFAdP3fR4laid7pWBt20P4eJ+Zn23wXS5kC9P2K7Bo3+rVjqnYiw== - dependencies: - "@algolia/client-common" "5.37.0" - "@algolia/requester-browser-xhr" "5.37.0" - "@algolia/requester-fetch" "5.37.0" - "@algolia/requester-node-http" "5.37.0" - -"@algolia/client-personalization@5.37.0": - version "5.37.0" - resolved "https://registry.yarnpkg.com/@algolia/client-personalization/-/client-personalization-5.37.0.tgz#c1688db681623b189f353599815a118033ceebb5" - integrity sha512-1zOIXM98O9zD8bYDCJiUJRC/qNUydGHK/zRK+WbLXrW1SqLFRXECsKZa5KoG166+o5q5upk96qguOtE8FTXDWQ== - dependencies: - "@algolia/client-common" "5.37.0" - "@algolia/requester-browser-xhr" "5.37.0" - "@algolia/requester-fetch" "5.37.0" - "@algolia/requester-node-http" "5.37.0" - -"@algolia/client-query-suggestions@5.37.0": - version "5.37.0" - resolved "https://registry.yarnpkg.com/@algolia/client-query-suggestions/-/client-query-suggestions-5.37.0.tgz#fa514df8d36fb548258c712f3ba6f97eb84ebb87" - integrity sha512-31Nr2xOLBCYVal+OMZn1rp1H4lPs1914Tfr3a34wU/nsWJ+TB3vWjfkUUuuYhWoWBEArwuRzt3YNLn0F/KRVkg== - dependencies: - "@algolia/client-common" "5.37.0" - "@algolia/requester-browser-xhr" "5.37.0" - "@algolia/requester-fetch" "5.37.0" - "@algolia/requester-node-http" "5.37.0" - -"@algolia/client-search@5.37.0": - version "5.37.0" - resolved "https://registry.yarnpkg.com/@algolia/client-search/-/client-search-5.37.0.tgz#38c7110d96fbbbda7b7fb0578a18b8cad3c25af2" - integrity sha512-DAFVUvEg+u7jUs6BZiVz9zdaUebYULPiQ4LM2R4n8Nujzyj7BZzGr2DCd85ip4p/cx7nAZWKM8pLcGtkTRTdsg== - dependencies: - "@algolia/client-common" "5.37.0" - "@algolia/requester-browser-xhr" "5.37.0" - "@algolia/requester-fetch" "5.37.0" - "@algolia/requester-node-http" "5.37.0" +"@11ty/gray-matter@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@11ty/gray-matter/-/gray-matter-1.0.0.tgz#35ee04d76b870893c053f64f659c923a7a9db2d7" + integrity sha512-7mJJl+wf1AByoT0PknQiQfOPnVNT4fevGrUBVWO4HXsnYn1aQPyRyrELYrNUFleUBM++KzMKN6QaxHPk0t/6/g== + dependencies: + js-yaml "^4.1.0" + kind-of "^6.0.3" + section-matter "^1.0.0" + strip-bom-string "^1.0.0" + +"@algolia/abtesting@1.21.2": + version "1.21.2" + resolved "https://registry.yarnpkg.com/@algolia/abtesting/-/abtesting-1.21.2.tgz#798e51b0226b6ed303a7d891235606b674a87857" + integrity sha512-uXj0rgk30EpsKvOpuS+R+1XFDrnm56hED1Lz56e8uBkZdKCxw99LS2U8eXBqAHYU8kpkbsnV1GC8velBG070Hg== + dependencies: + "@algolia/client-common" "5.55.2" + "@algolia/requester-browser-xhr" "5.55.2" + "@algolia/requester-fetch" "5.55.2" + "@algolia/requester-node-http" "5.55.2" + +"@algolia/autocomplete-core@1.19.2": + version "1.19.2" + resolved "https://registry.yarnpkg.com/@algolia/autocomplete-core/-/autocomplete-core-1.19.2.tgz#702df67a08cb3cfe8c33ee1111ef136ec1a9e232" + integrity sha512-mKv7RyuAzXvwmq+0XRK8HqZXt9iZ5Kkm2huLjgn5JoCPtDy+oh9yxUMfDDaVCw0oyzZ1isdJBc7l9nuCyyR7Nw== + dependencies: + "@algolia/autocomplete-plugin-algolia-insights" "1.19.2" + "@algolia/autocomplete-shared" "1.19.2" + +"@algolia/autocomplete-core@^1.19.2": + version "1.19.9" + resolved "https://registry.yarnpkg.com/@algolia/autocomplete-core/-/autocomplete-core-1.19.9.tgz#bbed371e56aeea4a31a3af239f16733e1b8aedca" + integrity sha512-4U2JKLMWlDu0CotYyUkWakDxr8AIav3QtIUXXRpfavYN29aVWfzlwJp9T0rPKEf/dO2QCPAUc0Kq1Tj1GJxo2A== + dependencies: + "@algolia/autocomplete-plugin-algolia-insights" "1.19.9" + "@algolia/autocomplete-shared" "1.19.9" + +"@algolia/autocomplete-plugin-algolia-insights@1.19.2": + version "1.19.2" + resolved "https://registry.yarnpkg.com/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.19.2.tgz#3584b625b9317e333d1ae43664d02358e175c52d" + integrity sha512-TjxbcC/r4vwmnZaPwrHtkXNeqvlpdyR+oR9Wi2XyfORkiGkLTVhX2j+O9SaCCINbKoDfc+c2PB8NjfOnz7+oKg== + dependencies: + "@algolia/autocomplete-shared" "1.19.2" + +"@algolia/autocomplete-plugin-algolia-insights@1.19.9": + version "1.19.9" + resolved "https://registry.yarnpkg.com/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.19.9.tgz#f799737d13bf0c4ec8421619c7107fa05c836535" + integrity sha512-6mExC6X7762s2SV3eJy3QOkB8bdMmnUhQ2agvGVDuzwoGyr3PquGSY/0vPQXCfiAiCaXUz1rXn+lwghgSi0l0w== + dependencies: + "@algolia/autocomplete-shared" "1.19.9" + +"@algolia/autocomplete-shared@1.19.2": + version "1.19.2" + resolved "https://registry.yarnpkg.com/@algolia/autocomplete-shared/-/autocomplete-shared-1.19.2.tgz#c0b7b8dc30a5c65b70501640e62b009535e4578f" + integrity sha512-jEazxZTVD2nLrC+wYlVHQgpBoBB5KPStrJxLzsIFl6Kqd1AlG9sIAGl39V5tECLpIQzB3Qa2T6ZPJ1ChkwMK/w== + +"@algolia/autocomplete-shared@1.19.9": + version "1.19.9" + resolved "https://registry.yarnpkg.com/@algolia/autocomplete-shared/-/autocomplete-shared-1.19.9.tgz#c5b05e23c71027e4e45a301f286593dffdcdfbdf" + integrity sha512-YosP9Uoek6y/Ur1r1qeogk4biMe/hzkyNcgMCciw0//3XpCM7VlYLSHnyt/vOnEOGhCCc0+3v+unEiH6zz+Z1A== + +"@algolia/client-abtesting@5.55.2": + version "5.55.2" + resolved "https://registry.yarnpkg.com/@algolia/client-abtesting/-/client-abtesting-5.55.2.tgz#5c7d1632051b05ef155a6ea7e4a9454d5c6d5a08" + integrity sha512-y7Epol8HcjlBxKXHhyhfFPFhm78B3P6x9cCbCyGTdxjsdVCptXCy5hpkZWxjGpnaLHvWsHS4QRF0TiBOLst2xg== + dependencies: + "@algolia/client-common" "5.55.2" + "@algolia/requester-browser-xhr" "5.55.2" + "@algolia/requester-fetch" "5.55.2" + "@algolia/requester-node-http" "5.55.2" + +"@algolia/client-analytics@5.55.2": + version "5.55.2" + resolved "https://registry.yarnpkg.com/@algolia/client-analytics/-/client-analytics-5.55.2.tgz#770694ceef05213a2dc1c64bf3cb9c0b33a16b71" + integrity sha512-8Pxj2VVmpM2d+UZufnlTq7T1QIcYPVugLV5XC50PnHsV5uRM9CSoYkg2Y+CwqwRk2La0xK5QsfZ0obIU+9XftQ== + dependencies: + "@algolia/client-common" "5.55.2" + "@algolia/requester-browser-xhr" "5.55.2" + "@algolia/requester-fetch" "5.55.2" + "@algolia/requester-node-http" "5.55.2" + +"@algolia/client-common@5.55.2": + version "5.55.2" + resolved "https://registry.yarnpkg.com/@algolia/client-common/-/client-common-5.55.2.tgz#17347bdd5a118b7966231a73c59cac44d256071c" + integrity sha512-9L4IpIYUqA63a7sw1trnHQGUvwiAjKz67nsgDnal98JGAc7wyposRb0Iag+eiMuyzFFaSHLe2/rGyIo+PafRBA== + +"@algolia/client-insights@5.55.2": + version "5.55.2" + resolved "https://registry.yarnpkg.com/@algolia/client-insights/-/client-insights-5.55.2.tgz#3e575307d01d2e6ccd7394b7428edd22ec68057c" + integrity sha512-ZBm2ytY5EHFcj+kjNsXxMNO/TGlOHe2fBFXGKHJOM1bk1rAy4o2YI+d9oV/w/jrqx44pvJMJlc8X6vKnCuDgUQ== + dependencies: + "@algolia/client-common" "5.55.2" + "@algolia/requester-browser-xhr" "5.55.2" + "@algolia/requester-fetch" "5.55.2" + "@algolia/requester-node-http" "5.55.2" + +"@algolia/client-personalization@5.55.2": + version "5.55.2" + resolved "https://registry.yarnpkg.com/@algolia/client-personalization/-/client-personalization-5.55.2.tgz#1c5458095fdfdd2dd0ed8dcd5b94962db2852400" + integrity sha512-3FGVW/jDk7sdYwqa2NKnF/qXWcttc4bvGrwNbvqz3VoWSRv42CNvRk+3Y9QJFIUf1vY50hAuVWUoFKdyc8vaXA== + dependencies: + "@algolia/client-common" "5.55.2" + "@algolia/requester-browser-xhr" "5.55.2" + "@algolia/requester-fetch" "5.55.2" + "@algolia/requester-node-http" "5.55.2" + +"@algolia/client-query-suggestions@5.55.2": + version "5.55.2" + resolved "https://registry.yarnpkg.com/@algolia/client-query-suggestions/-/client-query-suggestions-5.55.2.tgz#7bf49bf6f7832943646dcaa1ffc2873e54bb783e" + integrity sha512-JsG8LovDAYul5t8e533tZ3O1uZILxso5zsTtB7ONc5RJ8ACdTxAAC/jaOnsBNYb+x+STP7fzx/Iro55v5DNgoQ== + dependencies: + "@algolia/client-common" "5.55.2" + "@algolia/requester-browser-xhr" "5.55.2" + "@algolia/requester-fetch" "5.55.2" + "@algolia/requester-node-http" "5.55.2" + +"@algolia/client-search@5.55.2": + version "5.55.2" + resolved "https://registry.yarnpkg.com/@algolia/client-search/-/client-search-5.55.2.tgz#8cd3d994598210e5428ca9a64dd3f17620bfbf08" + integrity sha512-5wDnoIfC75zJ2MSHv5SSzTlRL2z7jQMbqQ5jrzottuq2p3oBObv8pD/JpXWu8pRaimaxNr3/Bs/KZIGVXxJ7hg== + dependencies: + "@algolia/client-common" "5.55.2" + "@algolia/requester-browser-xhr" "5.55.2" + "@algolia/requester-fetch" "5.55.2" + "@algolia/requester-node-http" "5.55.2" "@algolia/events@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@algolia/events/-/events-4.0.1.tgz#fd39e7477e7bc703d7f893b556f676c032af3950" integrity sha512-FQzvOCgoFXAbf5Y6mYozw2aj5KCJoA3m4heImceldzPSMbdyS4atVjJzXKMsfX3wnZTFYwkkt8/z8UesLHlSBQ== -"@algolia/ingestion@1.37.0": - version "1.37.0" - resolved "https://registry.yarnpkg.com/@algolia/ingestion/-/ingestion-1.37.0.tgz#bb6016e656c68014050814abf130e103f977794e" - integrity sha512-pkCepBRRdcdd7dTLbFddnu886NyyxmhgqiRcHHaDunvX03Ij4WzvouWrQq7B7iYBjkMQrLS8wQqSP0REfA4W8g== +"@algolia/ingestion@1.55.2": + version "1.55.2" + resolved "https://registry.yarnpkg.com/@algolia/ingestion/-/ingestion-1.55.2.tgz#e247f70c5055569af70e3c676853bad4c422ab6c" + integrity sha512-da+SC6ikpza98W7C5ChsKEQDvZc8PQLQ0sxmQ5yMRsHpdD3iPKnclJA6ViB5Nr5T9qOX+IDswC6AyqY4V3rtug== dependencies: - "@algolia/client-common" "5.37.0" - "@algolia/requester-browser-xhr" "5.37.0" - "@algolia/requester-fetch" "5.37.0" - "@algolia/requester-node-http" "5.37.0" + "@algolia/client-common" "5.55.2" + "@algolia/requester-browser-xhr" "5.55.2" + "@algolia/requester-fetch" "5.55.2" + "@algolia/requester-node-http" "5.55.2" -"@algolia/monitoring@1.37.0": - version "1.37.0" - resolved "https://registry.yarnpkg.com/@algolia/monitoring/-/monitoring-1.37.0.tgz#6d20c220d648db8faea45679350f1516917cc13d" - integrity sha512-fNw7pVdyZAAQQCJf1cc/ih4fwrRdQSgKwgor4gchsI/Q/ss9inmC6bl/69jvoRSzgZS9BX4elwHKdo0EfTli3w== +"@algolia/monitoring@1.55.2": + version "1.55.2" + resolved "https://registry.yarnpkg.com/@algolia/monitoring/-/monitoring-1.55.2.tgz#56c8b9e5b8e64d5f8fd41a37854eb5559cb798d4" + integrity sha512-Y8kEcPqCiIEeaGv83l9RRA09mfYECqAJHNnOyEtZc9UirI6XBMUyFVss/sSeYUiV/Lf30hkbWcl00V1uXsf86Q== dependencies: - "@algolia/client-common" "5.37.0" - "@algolia/requester-browser-xhr" "5.37.0" - "@algolia/requester-fetch" "5.37.0" - "@algolia/requester-node-http" "5.37.0" + "@algolia/client-common" "5.55.2" + "@algolia/requester-browser-xhr" "5.55.2" + "@algolia/requester-fetch" "5.55.2" + "@algolia/requester-node-http" "5.55.2" -"@algolia/recommend@5.37.0": - version "5.37.0" - resolved "https://registry.yarnpkg.com/@algolia/recommend/-/recommend-5.37.0.tgz#dd5e814f30bbb92395902e120fdb28a120b91341" - integrity sha512-U+FL5gzN2ldx3TYfQO5OAta2TBuIdabEdFwD5UVfWPsZE5nvOKkc/6BBqP54Z/adW/34c5ZrvvZhlhNTZujJXQ== +"@algolia/recommend@5.55.2": + version "5.55.2" + resolved "https://registry.yarnpkg.com/@algolia/recommend/-/recommend-5.55.2.tgz#9549d2fe261dca9ac94c144131ea980c56a6442b" + integrity sha512-5zmobuCQqFZkx+84Nt+suL7vo6jTh2CfAs2ndDSeTS2QHvnzP8YEEGWtWftjyACI0cK/FuH8urWwCHP+d2j8TA== dependencies: - "@algolia/client-common" "5.37.0" - "@algolia/requester-browser-xhr" "5.37.0" - "@algolia/requester-fetch" "5.37.0" - "@algolia/requester-node-http" "5.37.0" + "@algolia/client-common" "5.55.2" + "@algolia/requester-browser-xhr" "5.55.2" + "@algolia/requester-fetch" "5.55.2" + "@algolia/requester-node-http" "5.55.2" -"@algolia/requester-browser-xhr@5.37.0": - version "5.37.0" - resolved "https://registry.yarnpkg.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.37.0.tgz#8851ab846d8005055c36a59422161ebe1594ae48" - integrity sha512-Ao8GZo8WgWFABrU7iq+JAftXV0t+UcOtCDL4mzHHZ+rQeTTf1TZssr4d0vIuoqkVNnKt9iyZ7T4lQff4ydcTrw== +"@algolia/requester-browser-xhr@5.55.2": + version "5.55.2" + resolved "https://registry.yarnpkg.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.55.2.tgz#087322fcdfb35fdf8226d2ca966628c49f711d74" + integrity sha512-qnGUUuWG66dRMnr33owLsrYIh9fHVxtU4R2rd3SpneAHuoAUcGbDOWNrj05glVU6M8yOqo9gQ22K8zpz0I8Xpg== dependencies: - "@algolia/client-common" "5.37.0" + "@algolia/client-common" "5.55.2" -"@algolia/requester-fetch@5.37.0": - version "5.37.0" - resolved "https://registry.yarnpkg.com/@algolia/requester-fetch/-/requester-fetch-5.37.0.tgz#93602fdc9a59b41ecd53768c53c11cddb0db846a" - integrity sha512-H7OJOXrFg5dLcGJ22uxx8eiFId0aB9b0UBhoOi4SMSuDBe6vjJJ/LeZyY25zPaSvkXNBN3vAM+ad6M0h6ha3AA== +"@algolia/requester-fetch@5.55.2": + version "5.55.2" + resolved "https://registry.yarnpkg.com/@algolia/requester-fetch/-/requester-fetch-5.55.2.tgz#a01695738861a80181f231ce7e8fca6f7a6e4072" + integrity sha512-lKZ5uhafMvR7dWCJEyuaeyZitid1I3ICx+k0vGf5x/ktdIQvc7bndCiOPpmIDqUmN26FE3jTehkAzSqee95G2Q== dependencies: - "@algolia/client-common" "5.37.0" + "@algolia/client-common" "5.55.2" -"@algolia/requester-node-http@5.37.0": - version "5.37.0" - resolved "https://registry.yarnpkg.com/@algolia/requester-node-http/-/requester-node-http-5.37.0.tgz#83da1b52f3ee86f262a5d4b2a88a74db665211c2" - integrity sha512-npZ9aeag4SGTx677eqPL3rkSPlQrnzx/8wNrl1P7GpWq9w/eTmRbOq+wKrJ2r78idlY0MMgmY/mld2tq6dc44g== +"@algolia/requester-node-http@5.55.2": + version "5.55.2" + resolved "https://registry.yarnpkg.com/@algolia/requester-node-http/-/requester-node-http-5.55.2.tgz#5ceae3de5e223366fc5b3e643fcc0542909b87e8" + integrity sha512-Zc90xvKWUvxcNicvvTO9Pr/hT2TAnkixOIzJm/KMj5Ptm2pKjk71ngTsdkbRtJQvhZ2Kr9N1YdIjLrNHB5P2xw== dependencies: - "@algolia/client-common" "5.37.0" + "@algolia/client-common" "5.55.2" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.27.1.tgz#200f715e66d52a23b221a9435534a91cc13ad5be" - integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== +"@antfu/install-pkg@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@antfu/install-pkg/-/install-pkg-1.1.0.tgz#78fa036be1a6081b5a77a5cf59f50c7752b6ba26" + integrity sha512-MGQsmw10ZyI+EJo45CdSER4zEb+p31LpDAFp2Z3gkSd1yqVZGi0Ebx++YTEMonJy4oChEMLsxZ64j8FH6sSqtQ== dependencies: - "@babel/helper-validator-identifier" "^7.27.1" + package-manager-detector "^1.3.0" + tinyexec "^1.0.1" + +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.29.7.tgz#f2fbbfea87c44a21590ec515b778b2c26d8866e7" + integrity sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw== + dependencies: + "@babel/helper-validator-identifier" "^7.29.7" js-tokens "^4.0.0" picocolors "^1.1.1" -"@babel/compat-data@^7.27.2", "@babel/compat-data@^7.27.7", "@babel/compat-data@^7.28.0": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.28.4.tgz#96fdf1af1b8859c8474ab39c295312bfb7c24b04" - integrity sha512-YsmSKC29MJwf0gF8Rjjrg5LQCmyh+j/nD8/eP7f+BeoQTKYqs9RoWbjGOdy0+1Ekr68RJZMUOPVQaQisnIo4Rw== +"@babel/compat-data@^7.28.6", "@babel/compat-data@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.29.7.tgz#6f0237f0f36d2e51c0570a636faed9d2d0efe629" + integrity sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg== "@babel/core@^7.21.3", "@babel/core@^7.25.9": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.28.4.tgz#12a550b8794452df4c8b084f95003bce1742d496" - integrity sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA== - dependencies: - "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.28.3" - "@babel/helper-compilation-targets" "^7.27.2" - "@babel/helper-module-transforms" "^7.28.3" - "@babel/helpers" "^7.28.4" - "@babel/parser" "^7.28.4" - "@babel/template" "^7.27.2" - "@babel/traverse" "^7.28.4" - "@babel/types" "^7.28.4" + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.29.7.tgz#80c10b17248082968b57a857b91640971f2070f7" + integrity sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/generator" "^7.29.7" + "@babel/helper-compilation-targets" "^7.29.7" + "@babel/helper-module-transforms" "^7.29.7" + "@babel/helpers" "^7.29.7" + "@babel/parser" "^7.29.7" + "@babel/template" "^7.29.7" + "@babel/traverse" "^7.29.7" + "@babel/types" "^7.29.7" "@jridgewell/remapping" "^2.3.5" convert-source-map "^2.0.0" debug "^4.1.0" @@ -195,213 +226,221 @@ json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.25.9", "@babel/generator@^7.28.3": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.28.3.tgz#9626c1741c650cbac39121694a0f2d7451b8ef3e" - integrity sha512-3lSpxGgvnmZznmBkCRnVREPUFJv2wrv9iAoFDvADJc0ypmdOxdUtcLeBgBJ6zE0PMeTKnxeQzyk0xTBq4Ep7zw== +"@babel/generator@^7.25.9", "@babel/generator@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.29.7.tgz#cca0b8827e6bcf3ba176788e7f3b180ad6db2fa3" + integrity sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ== dependencies: - "@babel/parser" "^7.28.3" - "@babel/types" "^7.28.2" + "@babel/parser" "^7.29.7" + "@babel/types" "^7.29.7" "@jridgewell/gen-mapping" "^0.3.12" "@jridgewell/trace-mapping" "^0.3.28" jsesc "^3.0.2" -"@babel/helper-annotate-as-pure@^7.27.1", "@babel/helper-annotate-as-pure@^7.27.3": - version "7.27.3" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.3.tgz#f31fd86b915fc4daf1f3ac6976c59be7084ed9c5" - integrity sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg== +"@babel/helper-annotate-as-pure@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.29.7.tgz#c70fe3c6ecbdc3fd2dd1b0f498428b88b82ce47f" + integrity sha512-OoK6239jHPuSQOoS0kfTVKn0b/rVTk0seKq4Gd2UMLtmOVLjDC0ki3e+c90Trqv2gMfvJFqkiljrr568+qddiw== dependencies: - "@babel/types" "^7.27.3" + "@babel/types" "^7.29.7" -"@babel/helper-compilation-targets@^7.27.1", "@babel/helper-compilation-targets@^7.27.2": - version "7.27.2" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz#46a0f6efab808d51d29ce96858dd10ce8732733d" - integrity sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ== +"@babel/helper-compilation-targets@^7.28.6", "@babel/helper-compilation-targets@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz#7a1def704302401c47f64fa85589e974ae217042" + integrity sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g== dependencies: - "@babel/compat-data" "^7.27.2" - "@babel/helper-validator-option" "^7.27.1" + "@babel/compat-data" "^7.29.7" + "@babel/helper-validator-option" "^7.29.7" browserslist "^4.24.0" lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-create-class-features-plugin@^7.27.1", "@babel/helper-create-class-features-plugin@^7.28.3": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.28.3.tgz#3e747434ea007910c320c4d39a6b46f20f371d46" - integrity sha512-V9f6ZFIYSLNEbuGA/92uOvYsGCJNsuA8ESZ4ldc09bWk/j8H8TKiPw8Mk1eG6olpnO0ALHJmYfZvF4MEE4gajg== - dependencies: - "@babel/helper-annotate-as-pure" "^7.27.3" - "@babel/helper-member-expression-to-functions" "^7.27.1" - "@babel/helper-optimise-call-expression" "^7.27.1" - "@babel/helper-replace-supers" "^7.27.1" - "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" - "@babel/traverse" "^7.28.3" +"@babel/helper-create-class-features-plugin@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.29.7.tgz#6eddf286f2ec418f740c91d60a83347c55838ddd" + integrity sha512-IY3ZD9Tmooqr3TUhc3DUWxiuo8xx1DWLhd5M7hQ+ZWJamqM2BbalrBJb2MisSLoYorOj75U03qULCxQTY9r3hg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.29.7" + "@babel/helper-member-expression-to-functions" "^7.29.7" + "@babel/helper-optimise-call-expression" "^7.29.7" + "@babel/helper-replace-supers" "^7.29.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.29.7" + "@babel/traverse" "^7.29.7" semver "^6.3.1" -"@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.27.1.tgz#05b0882d97ba1d4d03519e4bce615d70afa18c53" - integrity sha512-uVDC72XVf8UbrH5qQTc18Agb8emwjTiZrQE11Nv3CuBEZmVvTwwE9CBUEvHku06gQCAyYf8Nv6ja1IN+6LMbxQ== +"@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.29.7.tgz#5d4c3f928f315cf6c4184ea2fc3b5b38745b2430" + integrity sha512-907Uymvqgg1dwUA+7IGwFAOSYzQOuzPXKNJ1yxzwPffzkYFg2q2eHi1fIOs6sXkG9NbIUMunnUlkYsfRFNvomg== dependencies: - "@babel/helper-annotate-as-pure" "^7.27.1" - regexpu-core "^6.2.0" + "@babel/helper-annotate-as-pure" "^7.29.7" + regexpu-core "^6.3.1" semver "^6.3.1" -"@babel/helper-define-polyfill-provider@^0.6.5": - version "0.6.5" - resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.5.tgz#742ccf1cb003c07b48859fc9fa2c1bbe40e5f753" - integrity sha512-uJnGFcPsWQK8fvjgGP5LZUZZsYGIoPeRjSF5PGwrelYgq7Q15/Ft9NGFp1zglwgIv//W0uG4BevRuSJRyylZPg== +"@babel/helper-define-polyfill-provider@^0.6.5", "@babel/helper-define-polyfill-provider@^0.6.8": + version "0.6.8" + resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.8.tgz#cf1e4462b613f2b54c41e6ff758d5dfcaa2c85d1" + integrity sha512-47UwBLPpQi1NoWzLuHNjRoHlYXMwIJoBf7MFou6viC/sIHWYygpvr0B6IAyh5sBdA2nr2LPIRww8lfaUVQINBA== dependencies: - "@babel/helper-compilation-targets" "^7.27.2" - "@babel/helper-plugin-utils" "^7.27.1" - debug "^4.4.1" + "@babel/helper-compilation-targets" "^7.28.6" + "@babel/helper-plugin-utils" "^7.28.6" + debug "^4.4.3" lodash.debounce "^4.0.8" - resolve "^1.22.10" - -"@babel/helper-globals@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.28.0.tgz#b9430df2aa4e17bc28665eadeae8aa1d985e6674" - integrity sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw== - -"@babel/helper-member-expression-to-functions@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.27.1.tgz#ea1211276be93e798ce19037da6f06fbb994fa44" - integrity sha512-E5chM8eWjTp/aNoVpcbfM7mLxu9XGLWYise2eBKGQomAk/Mb4XoxyqXTZbuTohbsl8EKqdlMhnDI2CCLfcs9wA== - dependencies: - "@babel/traverse" "^7.27.1" - "@babel/types" "^7.27.1" - -"@babel/helper-module-imports@^7.16.7", "@babel/helper-module-imports@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz#7ef769a323e2655e126673bb6d2d6913bbead204" - integrity sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w== - dependencies: - "@babel/traverse" "^7.27.1" - "@babel/types" "^7.27.1" - -"@babel/helper-module-transforms@^7.27.1", "@babel/helper-module-transforms@^7.28.3": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz#a2b37d3da3b2344fe085dab234426f2b9a2fa5f6" - integrity sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw== - dependencies: - "@babel/helper-module-imports" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" - "@babel/traverse" "^7.28.3" - -"@babel/helper-optimise-call-expression@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.27.1.tgz#c65221b61a643f3e62705e5dd2b5f115e35f9200" - integrity sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw== - dependencies: - "@babel/types" "^7.27.1" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.27.1", "@babel/helper-plugin-utils@^7.8.0": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz#ddb2f876534ff8013e6c2b299bf4d39b3c51d44c" - integrity sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw== - -"@babel/helper-remap-async-to-generator@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.27.1.tgz#4601d5c7ce2eb2aea58328d43725523fcd362ce6" - integrity sha512-7fiA521aVw8lSPeI4ZOD3vRFkoqkJcS+z4hFo82bFSH/2tNd6eJ5qCVMS5OzDmZh/kaHQeBaeyxK6wljcPtveA== - dependencies: - "@babel/helper-annotate-as-pure" "^7.27.1" - "@babel/helper-wrap-function" "^7.27.1" - "@babel/traverse" "^7.27.1" - -"@babel/helper-replace-supers@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.27.1.tgz#b1ed2d634ce3bdb730e4b52de30f8cccfd692bc0" - integrity sha512-7EHz6qDZc8RYS5ElPoShMheWvEgERonFCs7IAonWLLUTXW59DP14bCZt89/GKyreYn8g3S83m21FelHKbeDCKA== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.27.1" - "@babel/helper-optimise-call-expression" "^7.27.1" - "@babel/traverse" "^7.27.1" - -"@babel/helper-skip-transparent-expression-wrappers@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.27.1.tgz#62bb91b3abba8c7f1fec0252d9dbea11b3ee7a56" - integrity sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg== - dependencies: - "@babel/traverse" "^7.27.1" - "@babel/types" "^7.27.1" - -"@babel/helper-string-parser@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" - integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== - -"@babel/helper-validator-identifier@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8" - integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== - -"@babel/helper-validator-option@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" - integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg== - -"@babel/helper-wrap-function@^7.27.1": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.28.3.tgz#fe4872092bc1438ffd0ce579e6f699609f9d0a7a" - integrity sha512-zdf983tNfLZFletc0RRXYrHrucBEg95NIFMkn6K9dbeMYnsgHaSBGcQqdsCSStG2PYwRre0Qc2NNSCXbG+xc6g== - dependencies: - "@babel/template" "^7.27.2" - "@babel/traverse" "^7.28.3" - "@babel/types" "^7.28.2" - -"@babel/helpers@^7.28.4": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.28.4.tgz#fe07274742e95bdf7cf1443593eeb8926ab63827" - integrity sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w== - dependencies: - "@babel/template" "^7.27.2" - "@babel/types" "^7.28.4" + resolve "^1.22.11" + +"@babel/helper-globals@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.29.7.tgz#f04a96fbd8473241b1079243f5b3f03a3010ab7b" + integrity sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA== + +"@babel/helper-member-expression-to-functions@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.29.7.tgz#8dbdb3ce0b5c487e1aec10e13c9a43a500814df8" + integrity sha512-j+7JYmk1JYDtACIGj0QJqqWZjoUpMoEikQGADMaHgCMCSDqd2+P32rfcibUNrGOMWrlzK1WJBdxrB3JJQZwWtg== + dependencies: + "@babel/traverse" "^7.29.7" + "@babel/types" "^7.29.7" + +"@babel/helper-module-imports@^7.16.7", "@babel/helper-module-imports@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz#ef25048a518e828d7393fac5882ddd73921d7396" + integrity sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g== + dependencies: + "@babel/traverse" "^7.29.7" + "@babel/types" "^7.29.7" + +"@babel/helper-module-transforms@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz#b062747a5997ba138637201328bbff77960574ae" + integrity sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg== + dependencies: + "@babel/helper-module-imports" "^7.29.7" + "@babel/helper-validator-identifier" "^7.29.7" + "@babel/traverse" "^7.29.7" + +"@babel/helper-optimise-call-expression@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.29.7.tgz#77b0b5b94f1997fa9d6e3125f445227b1faf9d85" + integrity sha512-+kmGVjcT9RGYzoDwdwEqEvGgKe3BYq+O1iGzjFubaNgZHwYHP6lsF2Yghf4kEuv9BV7tYDZ913aBW9am6YKong== + dependencies: + "@babel/types" "^7.29.7" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.28.6", "@babel/helper-plugin-utils@^7.29.7", "@babel/helper-plugin-utils@^7.8.0": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz#c0a0766f1a13617d8a17407d7ab8f9d486225ea4" + integrity sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw== + +"@babel/helper-remap-async-to-generator@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.29.7.tgz#34b1f68dd75b86d31df781a29c3ff2df88da82e6" + integrity sha512-16AMiW26DbXWBbr3B8wNozKM0ydMLB892vaOaJW/fPJdnT8vJk5sdkQcU/isqUxyCE0cEoa8wZOcbgDuC4b6Og== + dependencies: + "@babel/helper-annotate-as-pure" "^7.29.7" + "@babel/helper-wrap-function" "^7.29.7" + "@babel/traverse" "^7.29.7" + +"@babel/helper-replace-supers@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.29.7.tgz#bc3c3964329043c79112e513c1b198f16589ac21" + integrity sha512-atfGXWSeCiF4DnKZIfmJfQRkSw9b9gNNXR1kqKjbhG4pGYCOnkp8OcTB8E3NXjBu8NpheSnOeNKz8KT7UNFTmQ== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.29.7" + "@babel/helper-optimise-call-expression" "^7.29.7" + "@babel/traverse" "^7.29.7" + +"@babel/helper-skip-transparent-expression-wrappers@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.29.7.tgz#50c95c7e4c4f54936cfa0116428edc559862d551" + integrity sha512-brcMGQaVzIeUb+6/bs1Av0f8YuNNjKY2JyvfRCsFuFsdKccEQ5Ges2y74D74NZ1Rz8lKJ9ksJkfqwQFJ/iNEyQ== + dependencies: + "@babel/traverse" "^7.29.7" + "@babel/types" "^7.29.7" + +"@babel/helper-string-parser@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz#7f0871d99824d23137d60f86fcf6130fd5a1b51f" + integrity sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw== + +"@babel/helper-validator-identifier@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz#bd87084ced0c796ec46bda492de6e83d29e89fc2" + integrity sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg== + +"@babel/helper-validator-option@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz#cf315be940213b354eb4abcc0bd01ebe3f73bc2a" + integrity sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw== + +"@babel/helper-wrap-function@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.29.7.tgz#eec72163044548a0935e9d182bf2d547ec5ff483" + integrity sha512-iES0Skag9ERIF68aXadpO6dbXa03mNWK3sEqJaMnLNs/eC3l0lkImdfoy6Y09/SfkpawdAB4RjQ7PVA7TcVGdw== + dependencies: + "@babel/template" "^7.29.7" + "@babel/traverse" "^7.29.7" + "@babel/types" "^7.29.7" + +"@babel/helpers@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.29.7.tgz#45abfde7548997e34376c3e69feb475cffb4a607" + integrity sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg== + dependencies: + "@babel/template" "^7.29.7" + "@babel/types" "^7.29.7" -"@babel/parser@^7.27.2", "@babel/parser@^7.28.3", "@babel/parser@^7.28.4": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.4.tgz#da25d4643532890932cc03f7705fe19637e03fa8" - integrity sha512-yZbBqeM6TkpP9du/I2pUZnJsRMGGvOuIrhjzC1AwHwW+6he4mni6Bp/m8ijn0iOuZuPI2BfkCoSRunpyjnrQKg== +"@babel/parser@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.29.7.tgz#837b87387cbf5ec5530cb634b3c622f68edb9334" + integrity sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg== dependencies: - "@babel/types" "^7.28.4" - -"@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.27.1.tgz#61dd8a8e61f7eb568268d1b5f129da3eee364bf9" - integrity sha512-QPG3C9cCVRQLxAVwmefEmwdTanECuUBMQZ/ym5kiw3XKCGA7qkuQLcjWWHcrD/GKbn/WmJwaezfuuAOcyKlRPA== + "@babel/types" "^7.29.7" + +"@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.29.7.tgz#2b535896d933a85aa92377eaa3d51a437d54a4e3" + integrity sha512-j8SrR0zLZrRsC09DlszEx8FpMiwukKffYXMK0d5LmOglO7vGG6sz/BR/20yHqWH+Lnn31JTt2PE3hIWNgM2J6w== + dependencies: + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/traverse" "^7.29.7" + +"@babel/plugin-bugfix-safari-class-field-initializer-scope@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.29.7.tgz#b00711a9e52bf4fe55ef7e54b2ef4a881bf804c8" + integrity sha512-r8j8escF+U2FUHo0KOhPUdMzUO+jp9fInva6+ACVAF3Y97Ev+5iNZwiqTghmzNeWwDkOPlYuTcfb1vDaoZKmAQ== + dependencies: + "@babel/helper-plugin-utils" "^7.29.7" + +"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.29.7.tgz#2375328852026a3cf6bc0bcf2de7d236f2d5e701" + integrity sha512-GE1TFSiuFeGsCxmYXZl8HwoPrVlwe4rHPFE8weieGKZqnDORK+Ar3vgWMgW+AOxQ6/2TgLSKx9p6W7O4rC6qgQ== + dependencies: + "@babel/helper-plugin-utils" "^7.29.7" + +"@babel/plugin-bugfix-safari-rest-destructuring-rhs-array@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-rest-destructuring-rhs-array/-/plugin-bugfix-safari-rest-destructuring-rhs-array-7.29.7.tgz#759a857c46c4d2a6199685cf71070d81ae5f743a" + integrity sha512-oBNVCvnO5tND+xSopWvV8WNGfpTfgP4Zr/YXXSj8zfmcPktp5Ku/aZlsIowgSD4fjmgHn6sGmB9APVsU5zOdhA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/traverse" "^7.27.1" - -"@babel/plugin-bugfix-safari-class-field-initializer-scope@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.27.1.tgz#43f70a6d7efd52370eefbdf55ae03d91b293856d" - integrity sha512-qNeq3bCKnGgLkEXUuFry6dPlGfCdQNZbn7yUAPCInwAJHMU7THJfrBSozkcWq5sNM6RcF3S8XyQL2A52KNR9IA== + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.29.7" + +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.29.7.tgz#86de98dd8e03836178231ea96c27dab26016a705" + integrity sha512-QQt9qKHZ2sg/kivaLr7lnQr8HVrQDdBNSfCsTjiDxRuX/K5ORyKq+Bu8Xr0cDE3Dfkv0cw28Ve0EKyKMvulkOw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - -"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.27.1.tgz#beb623bd573b8b6f3047bd04c32506adc3e58a72" - integrity sha512-g4L7OYun04N1WyqMNjldFwlfPCLVkgB54A/YCXICZYBsvJJE3kByKv9c9+R/nAfmIfjl2rKYLNyMHboYbZaWaA== - dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.29.7" + "@babel/plugin-transform-optional-chaining" "^7.29.7" -"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.27.1.tgz#e134a5479eb2ba9c02714e8c1ebf1ec9076124fd" - integrity sha512-oO02gcONcD5O1iTLi/6frMJBIwWEHceWGSGqrpCmEL8nogiS6J9PBlE48CaK20/Jx1LuRml9aDftLgdjXT8+Cw== +"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.29.7.tgz#f5d892681dbf4b08753436a5e55000d5ba728d6d" + integrity sha512-pn6QacGLgvCcwc+syUhKE/qSjV2D1IHDB84RNxWYSt1mW3K/SCtjinZ2p0cETJxAWBjPy3K/1lHwG5BjjPxNlw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" - "@babel/plugin-transform-optional-chaining" "^7.27.1" - -"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.28.3": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.28.3.tgz#373f6e2de0016f73caf8f27004f61d167743742a" - integrity sha512-b6YTX108evsvE4YgWyQ921ZAFFQm3Bn+CA3+ZXlNVnPhx+UfsVURoPjfGAPCjBgrqo30yX/C2nZGX96DxvR9Iw== - dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/traverse" "^7.28.3" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/traverse" "^7.29.7" "@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2": version "7.21.0-placeholder-for-preset-env.2" @@ -415,33 +454,33 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-import-assertions@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.27.1.tgz#88894aefd2b03b5ee6ad1562a7c8e1587496aecd" - integrity sha512-UT/Jrhw57xg4ILHLFnzFpPDlMbcdEicaAtjPQpbj9wa8T4r5KVWCimHcL/460g8Ht0DMxDyjsLgiWSkVjnwPFg== +"@babel/plugin-syntax-import-assertions@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.29.7.tgz#c5cd868505269126cc18882e1f01f7b0e0e24b4e" + integrity sha512-/An1OCBN93thpBAGyfsK2pcf0jvju1SAtKkL2Ny++B5Sy6sqgzXDQH1cZxWbF96Wuk+bn41MDA9bLd4VVAw6rw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-syntax-import-attributes@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.27.1.tgz#34c017d54496f9b11b61474e7ea3dfd5563ffe07" - integrity sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww== +"@babel/plugin-syntax-import-attributes@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.29.7.tgz#6115264516e95ead0f35a41710906612e447f605" + integrity sha512-zGYcYfq/WmZ4V+kBIXQon9dSSc8ircGZqw9ZaNhhGj9nZkeBu1jHLBDQqYYi5WA9uawvA2sIMbry2nCFhf5Djg== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-syntax-jsx@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.27.1.tgz#2f9beb5eff30fa507c5532d107daac7b888fa34c" - integrity sha512-y8YTNIeKoyhGd9O0Jiyzyyqk8gdjnumGTQPsz0xOZOQ2RmkVJeZ1vmmfIvFEKqucBG6axJGBZDE/7iI5suUI/w== +"@babel/plugin-syntax-jsx@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.29.7.tgz#622c16f9ad63782fe6e83dadc7e40330744b7f1e" + integrity sha512-TSu8+mHCoEaaCDEZ0I3+6mvTBYR4PCxQwf2z9/r5Tbztv6NaLR3B9thGTTxX2WGuGHJqRiAbKPeGTJ5XWXVg6A== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-syntax-typescript@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz#5147d29066a793450f220c63fa3a9431b7e6dd18" - integrity sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ== +"@babel/plugin-syntax-typescript@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.29.7.tgz#7c29388932313ed58413a0343048d75d92fb5b24" + integrity sha512-ngr+82Sh0xMz25TPCZi+nC2iTzjfCdWS2ONXTp/PtSCHCgaCNBpdMqgvJ2ccdLlClVZ7sisIgB914j/JFe+RZA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" "@babel/plugin-syntax-unicode-sets-regex@^7.18.6": version "7.18.6" @@ -451,540 +490,541 @@ "@babel/helper-create-regexp-features-plugin" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-arrow-functions@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.27.1.tgz#6e2061067ba3ab0266d834a9f94811196f2aba9a" - integrity sha512-8Z4TGic6xW70FKThA5HYEKKyBpOOsucTOD1DjU3fZxDg+K3zBJcXMFnt/4yQiZnf5+MiOMSXQ9PaEK/Ilh1DeA== +"@babel/plugin-transform-arrow-functions@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.29.7.tgz#d651343f562c03f47951bd1802195d0e10605f27" + integrity sha512-N7zArUXWzAMzm+/N0uPBeVB3Fam5lMxtUwMmDK5f/IBBS7a7p1qeUoxd/6CckXoxUdgsntq1Dh8xNW06maZbDQ== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-async-generator-functions@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.28.0.tgz#1276e6c7285ab2cd1eccb0bc7356b7a69ff842c2" - integrity sha512-BEOdvX4+M765icNPZeidyADIvQ1m1gmunXufXxvRESy/jNNyfovIqUyE7MVgGBjWktCoJlzvFA1To2O4ymIO3Q== +"@babel/plugin-transform-async-generator-functions@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.29.7.tgz#a5365617921d82a1fee33124a1102bb38a1e677d" + integrity sha512-d98gXZkgswvkyohMBABkhm3GeXhYj8psWfwQ2C7gtfrKGTykQa/iOIi+JJhwMjPlZ6Vm2XN+DCf3Es1EoG4ZLA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-remap-async-to-generator" "^7.27.1" - "@babel/traverse" "^7.28.0" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-remap-async-to-generator" "^7.29.7" + "@babel/traverse" "^7.29.7" -"@babel/plugin-transform-async-to-generator@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.27.1.tgz#9a93893b9379b39466c74474f55af03de78c66e7" - integrity sha512-NREkZsZVJS4xmTr8qzE5y8AfIPqsdQfRuUiLRTEzb7Qii8iFWCyDKaUV2c0rCuh4ljDZ98ALHP/PetiBV2nddA== +"@babel/plugin-transform-async-to-generator@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.29.7.tgz#3b5e8f1fb58133cf701bcf0baaf6f01bfd1a8889" + integrity sha512-pcUb2SS+RMo9TWVBwKGI5ShtoG7R+zBsFmCKDa6fe8c+hPr3XJlZgoE5j6i8W7gDjhyvy+85vmYexanvXh3d1w== dependencies: - "@babel/helper-module-imports" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-remap-async-to-generator" "^7.27.1" + "@babel/helper-module-imports" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-remap-async-to-generator" "^7.29.7" -"@babel/plugin-transform-block-scoped-functions@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.27.1.tgz#558a9d6e24cf72802dd3b62a4b51e0d62c0f57f9" - integrity sha512-cnqkuOtZLapWYZUYM5rVIdv1nXYuFVIltZ6ZJ7nIj585QsjKM5dhL2Fu/lICXZ1OyIAFc7Qy+bvDAtTXqGrlhg== +"@babel/plugin-transform-block-scoped-functions@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.29.7.tgz#96d292634434082d6687bcdb81139affedf77e8c" + integrity sha512-cUSmjh72N+rN4PrkFlN1dJwNCwjVp5d38/CQrEsFggkD10UiFlBFgdH3tv5dNsLuHY+3S8db2xCHjhZcv5WgvA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-block-scoping@^7.28.0": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.28.4.tgz#e19ac4ddb8b7858bac1fd5c1be98a994d9726410" - integrity sha512-1yxmvN0MJHOhPVmAsmoW5liWwoILobu/d/ShymZmj867bAdxGbehIrew1DuLpw2Ukv+qDSSPQdYW1dLNE7t11A== +"@babel/plugin-transform-block-scoping@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.29.7.tgz#baa376691ae16244cd14335422fca6900f54e17d" + integrity sha512-ONyr4+AZhKh8yKWInVxU9AXA9EbsyeLcL6V0dJy6M2/62vuvpGm29zzuymbTpdc451GEpDIdAyPLP3r+P61yKQ== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-class-properties@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.27.1.tgz#dd40a6a370dfd49d32362ae206ddaf2bb082a925" - integrity sha512-D0VcalChDMtuRvJIu3U/fwWjf8ZMykz5iZsg77Nuj821vCKI3zCyRLwRdWbsuJ/uRwZhZ002QtCqIkwC/ZkvbA== +"@babel/plugin-transform-class-properties@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.29.7.tgz#034897b8a21beec163332fac2de235b14409abdf" + integrity sha512-GtcpjFvanPfzNQi3eTitsCqtRRmmqzpy/A+yhTR1HaZo1Ly3EA8ZXxlPyHdR8/IuRMYc3E4wdGBewB2QKQjAaA== dependencies: - "@babel/helper-create-class-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-class-features-plugin" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-class-static-block@^7.28.3": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.28.3.tgz#d1b8e69b54c9993bc558203e1f49bfc979bfd852" - integrity sha512-LtPXlBbRoc4Njl/oh1CeD/3jC+atytbnf/UqLoqTDcEYGUPj022+rvfkbDYieUrSj3CaV4yHDByPE+T2HwfsJg== +"@babel/plugin-transform-class-static-block@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.29.7.tgz#fed8efd19f3dd3e1114ee390707c70912778fd7c" + integrity sha512-kibJgmEdX2iMwsHY2tSZNDgj8PwIlCQz7FK9KuGKO8zsuoUwSEhoNnNVp/emKWrbY4HeO6kkXfdMqRKKKXBm2A== dependencies: - "@babel/helper-create-class-features-plugin" "^7.28.3" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-class-features-plugin" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-classes@^7.28.3": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.28.4.tgz#75d66175486788c56728a73424d67cbc7473495c" - integrity sha512-cFOlhIYPBv/iBoc+KS3M6et2XPtbT2HiCRfBXWtfpc9OAyostldxIf9YAYB6ypURBBbx+Qv6nyrLzASfJe+hBA== +"@babel/plugin-transform-classes@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.29.7.tgz#61d3e5aaae0c838acc3204d9db7c8dc05c25815b" + integrity sha512-qV0OGGBVacduzQHE649JyCneOFI/maT+YKsO+K4Yi3xv2wTPNjM/W2o2gdzMwEAZz7fXNTHAe0NcSg30bIN69g== dependencies: - "@babel/helper-annotate-as-pure" "^7.27.3" - "@babel/helper-compilation-targets" "^7.27.2" - "@babel/helper-globals" "^7.28.0" - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-replace-supers" "^7.27.1" - "@babel/traverse" "^7.28.4" + "@babel/helper-annotate-as-pure" "^7.29.7" + "@babel/helper-compilation-targets" "^7.29.7" + "@babel/helper-globals" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-replace-supers" "^7.29.7" + "@babel/traverse" "^7.29.7" -"@babel/plugin-transform-computed-properties@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.27.1.tgz#81662e78bf5e734a97982c2b7f0a793288ef3caa" - integrity sha512-lj9PGWvMTVksbWiDT2tW68zGS/cyo4AkZ/QTp0sQT0mjPopCmrSkzxeXkznjqBxzDI6TclZhOJbBmbBLjuOZUw== +"@babel/plugin-transform-computed-properties@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.29.7.tgz#95028787ca31901b9a20b5c6d9605c32346f55ad" + integrity sha512-RK7/IyU5phpuCdBAuig5VkzG/EnbDaui5SQGdU9BFrHdV+mV4cUjLMQ9lJDjLNtWHsqtiefpGZUXQP2BiTYMsA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/template" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/template" "^7.29.7" -"@babel/plugin-transform-destructuring@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.28.0.tgz#0f156588f69c596089b7d5b06f5af83d9aa7f97a" - integrity sha512-v1nrSMBiKcodhsyJ4Gf+Z0U/yawmJDBOTpEB3mcQY52r9RIyPneGyAS/yM6seP/8I+mWI3elOMtT5dB8GJVs+A== +"@babel/plugin-transform-destructuring@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.29.7.tgz#5781ec6947852e27b64c1165f0db431f408090e4" + integrity sha512-iPX8aD6H9zV5s7ZsqTdNocPN/MGQ5sSMnElKrktxjJRMnB2jN/1p2+R7GkfD6CAYoVFqy5A4XnSIUeGgJzIWpg== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/traverse" "^7.28.0" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/traverse" "^7.29.7" -"@babel/plugin-transform-dotall-regex@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.27.1.tgz#aa6821de864c528b1fecf286f0a174e38e826f4d" - integrity sha512-gEbkDVGRvjj7+T1ivxrfgygpT7GUd4vmODtYpbs0gZATdkX8/iSnOtZSxiZnsgm1YjTgjI6VKBGSJJevkrclzw== +"@babel/plugin-transform-dotall-regex@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.29.7.tgz#b203de9740e4c7ff6b55ce436ed5313b88d70af8" + integrity sha512-3qc18hsD2RdZiyJNDNc7HQpv6xbncwh8FYtxNFFzclSyh/trPD9KkVR9BDECUjDLvb7yJVF15GfYUuC+LMkkiQ== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-regexp-features-plugin" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-duplicate-keys@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.27.1.tgz#f1fbf628ece18e12e7b32b175940e68358f546d1" - integrity sha512-MTyJk98sHvSs+cvZ4nOauwTTG1JeonDjSGvGGUNHreGQns+Mpt6WX/dVzWBHgg+dYZhkC4X+zTDfkTU+Vy9y7Q== +"@babel/plugin-transform-duplicate-keys@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.29.7.tgz#8f3fe721835cb7a433420841dae90afc962ea7ae" + integrity sha512-6IvRRriEMqnBwD6chtxdLpMYCHWEzN+oL5cyQtjykya19UgzbmKhxmhZgKC/LHxS2nYr9Q/qYPZ5Lr6jOL9+yQ== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-duplicate-named-capturing-groups-regex@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.27.1.tgz#5043854ca620a94149372e69030ff8cb6a9eb0ec" - integrity sha512-hkGcueTEzuhB30B3eJCbCYeCaaEQOmQR0AdvzpD4LoN0GXMWzzGSuRrxR2xTnCrvNbVwK9N6/jQ92GSLfiZWoQ== +"@babel/plugin-transform-duplicate-named-capturing-groups-regex@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.29.7.tgz#dc6c405e55c01b7657e1827a25332c4ac17e9cac" + integrity sha512-2wiIyo2BjtgU7HufSeDnL9L2O7zr8jmhFKuSr65VpRkUiRKRNpb0mdlk56+XPPKoIrfHqzbMuglDvZun0RISsA== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-regexp-features-plugin" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-dynamic-import@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.27.1.tgz#4c78f35552ac0e06aa1f6e3c573d67695e8af5a4" - integrity sha512-MHzkWQcEmjzzVW9j2q8LGjwGWpG2mjwaaB0BNQwst3FIjqsg8Ct/mIZlvSPJvfi9y2AC8mi/ktxbFVL9pZ1I4A== +"@babel/plugin-transform-dynamic-import@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.29.7.tgz#a83a6faec5bab5b619adf9d0eac6c1c270123c2a" + integrity sha512-giOlEm/EFjfjr+te9NsdjkUo2v4f8rS/SXPumRVHAtbNcyNlvtREkU1dZzaIDclNpnaVhlCqRdFKhJBjBikzLg== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-explicit-resource-management@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-explicit-resource-management/-/plugin-transform-explicit-resource-management-7.28.0.tgz#45be6211b778dbf4b9d54c4e8a2b42fa72e09a1a" - integrity sha512-K8nhUcn3f6iB+P3gwCv/no7OdzOZQcKchW6N389V6PD8NUWKZHzndOd9sPDVbMoBsbmjMqlB4L9fm+fEFNVlwQ== +"@babel/plugin-transform-explicit-resource-management@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-explicit-resource-management/-/plugin-transform-explicit-resource-management-7.29.7.tgz#65c8b9f76ec915b02a0e1df703125a0fca58abaa" + integrity sha512-Rstj7coNz8sE+7Ju7ihpHLI564lsK5pUpNNlvptCIC/16E/S5hbl6n3kESPKdNRmqEWlpn5xpS5Q2dvXBsySLw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/plugin-transform-destructuring" "^7.28.0" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/plugin-transform-destructuring" "^7.29.7" -"@babel/plugin-transform-exponentiation-operator@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.27.1.tgz#fc497b12d8277e559747f5a3ed868dd8064f83e1" - integrity sha512-uspvXnhHvGKf2r4VVtBpeFnuDWsJLQ6MF6lGJLC89jBR1uoVeqM416AZtTuhTezOfgHicpJQmoD5YUakO/YmXQ== +"@babel/plugin-transform-exponentiation-operator@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.29.7.tgz#00bf002fde8794356171f5d4df200f6bc0d5a303" + integrity sha512-zFpMOTLZBdW5LfObqcSbL6kefg4R4eLdmvS0wbN9M6D5Mym/sKm9toOoWyVOa+xDjvCnuWcHls2YonXwHvH3CQ== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-export-namespace-from@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.27.1.tgz#71ca69d3471edd6daa711cf4dfc3400415df9c23" - integrity sha512-tQvHWSZ3/jH2xuq/vZDy0jNn+ZdXJeM8gHvX4lnJmsc3+50yPlWdZXIc5ay+umX+2/tJIqHqiEqcJvxlmIvRvQ== +"@babel/plugin-transform-export-namespace-from@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.29.7.tgz#d6014f45cec61d7691335c6c9804204bee801d51" + integrity sha512-24B2nOy2TeJSMheqwPD4DDQOV/elLSIlKxjZt4i05H5AgdPdWR3n18HnNrcJ+j76WJd9gbwb9jPjNYUy6RautA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-for-of@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.27.1.tgz#bc24f7080e9ff721b63a70ac7b2564ca15b6c40a" - integrity sha512-BfbWFFEJFQzLCQ5N8VocnCtA8J1CLkNTe2Ms2wocj75dd6VpiqS5Z5quTYcUoo4Yq+DN0rtikODccuv7RU81sw== +"@babel/plugin-transform-for-of@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.29.7.tgz#c65a678592117717aacdb10c1b73a9cb85e830be" + integrity sha512-zeSIHh0+E1Um1WJRXCFlHQYu2ieJNdivLLjlBEp+dIBu3S51n+SZZmIXjxnItw6pz56Cn+KvK68BIBVsxq2JiQ== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.29.7" -"@babel/plugin-transform-function-name@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.27.1.tgz#4d0bf307720e4dce6d7c30fcb1fd6ca77bdeb3a7" - integrity sha512-1bQeydJF9Nr1eBCMMbC+hdwmRlsv5XYOMu03YSWFwNs0HsAmtSxxF1fyuYPqemVldVyFmlCU7w8UE14LupUSZQ== +"@babel/plugin-transform-function-name@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.29.7.tgz#8b87f8a7504dbcd96135167e3fc4f61126a7bd86" + integrity sha512-otRWaHXE6fbAGkePvaj/kvs3HsqXfPhlnzwSOlnFgbqCPMd975dW+4wZ00WFBt+/YlBGcJwNrARQTOJOb4ZrIg== dependencies: - "@babel/helper-compilation-targets" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/traverse" "^7.27.1" + "@babel/helper-compilation-targets" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/traverse" "^7.29.7" -"@babel/plugin-transform-json-strings@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.27.1.tgz#a2e0ce6ef256376bd527f290da023983527a4f4c" - integrity sha512-6WVLVJiTjqcQauBhn1LkICsR2H+zm62I3h9faTDKt1qP4jn2o72tSvqMwtGFKGTpojce0gJs+76eZ2uCHRZh0Q== +"@babel/plugin-transform-json-strings@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.29.7.tgz#f57d63dcc05b4481c281acedcd8fc4e3e439a1d4" + integrity sha512-RRnE2+eon1rJAq8MnoF1b5kTpY1vU88twHcvcKMrsqP/jxIRqDVs9iJB5fqPuqyeFAW0wJo4MlUIPpQCq/aRsg== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-literals@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.27.1.tgz#baaefa4d10a1d4206f9dcdda50d7d5827bb70b24" - integrity sha512-0HCFSepIpLTkLcsi86GG3mTUzxV5jpmbv97hTETW3yzrAij8aqlD36toB1D0daVFJM8NK6GvKO0gslVQmm+zZA== +"@babel/plugin-transform-literals@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.29.7.tgz#b90bd47463326c2a9d779e1bd5e1f88b9f421921" + integrity sha512-DZ/oLP21ZuWx1vKqnoNv6/tvEK48AQOBRai40CX9dTjGluvT/YZCyY3rryDtyUqCEoyNroy5KKPwX2iQCiRvyw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-logical-assignment-operators@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.27.1.tgz#890cb20e0270e0e5bebe3f025b434841c32d5baa" - integrity sha512-SJvDs5dXxiae4FbSL1aBJlG4wvl594N6YEVVn9e3JGulwioy6z3oPjx/sQBO3Y4NwUu5HNix6KJ3wBZoewcdbw== +"@babel/plugin-transform-logical-assignment-operators@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.29.7.tgz#9b29425adf5c794967aabe4b046a046a167bac2f" + integrity sha512-A0H91hh6W8MFRkp5TqJmMr39jzGD1A1E1Ysiv2O06Sfbhkapm+XyIzxWCEh5kqwOZ1/8QZ0dY3SeQ7XBqfJd5Q== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-member-expression-literals@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.27.1.tgz#37b88ba594d852418e99536f5612f795f23aeaf9" - integrity sha512-hqoBX4dcZ1I33jCSWcXrP+1Ku7kdqXf1oeah7ooKOIiAdKQ+uqftgCFNOSzA5AMS2XIHEYeGFg4cKRCdpxzVOQ== +"@babel/plugin-transform-member-expression-literals@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.29.7.tgz#1281689fa2fefc17b110d21ebafd0fe9402d5309" + integrity sha512-hl1kwFZCCiDyfH25Xmco9jTrkPgnS9pmOzSG7W5I4SaGbLeqKv417hcU2RKmaxoPEgsoJh7ZPOrnPGq99bHoUg== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-modules-amd@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.27.1.tgz#a4145f9d87c2291fe2d05f994b65dba4e3e7196f" - integrity sha512-iCsytMg/N9/oFq6n+gFTvUYDZQOMK5kEdeYxmxt91fcJGycfxVP9CnrxoliM0oumFERba2i8ZtwRUCMhvP1LnA== +"@babel/plugin-transform-modules-amd@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.29.7.tgz#f05ca662c8a1dc4be2f337af9c7e80369c942d6c" + integrity sha512-fxtQoH3m5ywUSIfaH0FGCzWu4McsYon5bD3K4XnskC7f+OyQMj7rsOMi4NvvmJ83WwBAg4UCe+ov4VZlqEvyew== dependencies: - "@babel/helper-module-transforms" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-module-transforms" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-modules-commonjs@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.27.1.tgz#8e44ed37c2787ecc23bdc367f49977476614e832" - integrity sha512-OJguuwlTYlN0gBZFRPqwOGNWssZjfIUdS7HMYtN8c1KmwpwHFBwTeFZrg9XZa+DFTitWOW5iTAG7tyCUPsCCyw== +"@babel/plugin-transform-modules-commonjs@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.29.7.tgz#70e6835abf2663dafbe94b8ef1f51de7351ef135" + integrity sha512-j0vCldybPC5b5dwCQOJ21uKtHzt7hxLygJTg9eF1ScfaikEDNfzn94XoW5Fi+seBR0nCyL23xaBFFkq7dTM8XQ== dependencies: - "@babel/helper-module-transforms" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-module-transforms" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-modules-systemjs@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.27.1.tgz#00e05b61863070d0f3292a00126c16c0e024c4ed" - integrity sha512-w5N1XzsRbc0PQStASMksmUeqECuzKuTJer7kFagK8AXgpCMkeDMO5S+aaFb7A51ZYDF7XI34qsTX+fkHiIm5yA== +"@babel/plugin-transform-modules-systemjs@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.29.7.tgz#e575dd2ab9882906de120ff7dc9dee9914d8b6f3" + integrity sha512-TM2ZcQLoG2/y4HODiStCo10DibYhWhGWAwVv+EQKmG/7GFl0N+AAmUiXOMKM+aiJ9XBJ9AHVZBvTzMnJ2sM3cQ== dependencies: - "@babel/helper-module-transforms" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" - "@babel/traverse" "^7.27.1" + "@babel/helper-module-transforms" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-validator-identifier" "^7.29.7" + "@babel/traverse" "^7.29.7" -"@babel/plugin-transform-modules-umd@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.27.1.tgz#63f2cf4f6dc15debc12f694e44714863d34cd334" - integrity sha512-iQBE/xC5BV1OxJbp6WG7jq9IWiD+xxlZhLrdwpPkTX3ydmXdvoCpyfJN7acaIBZaOqTfr76pgzqBJflNbeRK+w== +"@babel/plugin-transform-modules-umd@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.29.7.tgz#391d1c0215aca6307257f2f608598dfe55feb6cf" + integrity sha512-B4UkaTK3QpgCwJnrxKfMPKdo92CN7OKXAlpAAnM3UPu0Q0lCCk57ylA9AJbRy2v8dDKOPAAWcoR6CMyeoHwRCA== dependencies: - "@babel/helper-module-transforms" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-module-transforms" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-named-capturing-groups-regex@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.27.1.tgz#f32b8f7818d8fc0cc46ee20a8ef75f071af976e1" - integrity sha512-SstR5JYy8ddZvD6MhV0tM/j16Qds4mIpJTOd1Yu9J9pJjH93bxHECF7pgtc28XvkzTD6Pxcm/0Z73Hvk7kb3Ng== +"@babel/plugin-transform-named-capturing-groups-regex@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.29.7.tgz#21e75d847b31189842fa7a77703722ed4b43d27d" + integrity sha512-vuFoLwr4qnv2xbZ16SQd6uPcH5FNrLHhk/Jzo++0XJFcaDsr4gjJVg6j398oMHiC+83k/GiBzviwF5KBJkPUtQ== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-regexp-features-plugin" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-new-target@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.27.1.tgz#259c43939728cad1706ac17351b7e6a7bea1abeb" - integrity sha512-f6PiYeqXQ05lYq3TIfIDu/MtliKUbNwkGApPUvyo6+tc7uaR4cPjPe7DFPr15Uyycg2lZU6btZ575CuQoYh7MQ== +"@babel/plugin-transform-new-target@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.29.7.tgz#714147ce7947e1b49cbd84137ca2e75e92b2a067" + integrity sha512-fEo41GmsOUhOBlw8ioo6zvjX5Xc2Lqkzlyfqbpsk3eB6TReV18uhxZ0esfEokVbY2+PVJAQHNKxER6lGrzNd3A== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-nullish-coalescing-operator@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.27.1.tgz#4f9d3153bf6782d73dd42785a9d22d03197bc91d" - integrity sha512-aGZh6xMo6q9vq1JGcw58lZ1Z0+i0xB2x0XaauNIUXd6O1xXc3RwoWEBlsTQrY4KQ9Jf0s5rgD6SiNkaUdJegTA== +"@babel/plugin-transform-nullish-coalescing-operator@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.29.7.tgz#8a54cdf88c3f50433a6173117a286195b67714cc" + integrity sha512-idmp1dFaekP9GbcMvG24Kvw2BfhFZjHnNJCkV4WuIY4PskJzwI3f1N5OdgYke38T7rftO6ERulFRn2cFeZwRkg== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-numeric-separator@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.27.1.tgz#614e0b15cc800e5997dadd9bd6ea524ed6c819c6" - integrity sha512-fdPKAcujuvEChxDBJ5c+0BTaS6revLV7CJL08e4m3de8qJfNIuCc2nc7XJYOjBoTMJeqSmwXJ0ypE14RCjLwaw== +"@babel/plugin-transform-numeric-separator@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.29.7.tgz#0266d5cd42ab87ec40fee45a4e36483cfdcbc66a" + integrity sha512-zR7fv/z14OjgHl4AgRtkDBvBMhIzCxqV/qN/2BCRC7LjFwvuzjYe7gDWxC4Wl/SNsLM6SE1IWvRPYMgSJaUvNw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-object-rest-spread@^7.28.0": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.28.4.tgz#9ee1ceca80b3e6c4bac9247b2149e36958f7f98d" - integrity sha512-373KA2HQzKhQCYiRVIRr+3MjpCObqzDlyrM6u4I201wL8Mp2wHf7uB8GhDwis03k2ti8Zr65Zyyqs1xOxUF/Ew== +"@babel/plugin-transform-object-rest-spread@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.29.7.tgz#e0d5060241803922c545676613cc8acbbda0d266" + integrity sha512-Ld98jn4c0smUywL57m7SgsHq3OpThOa6LqZJif3G6jYOovPleoFhVrBJ1WegRApSFB2wu4+RelAj9AC9G08Z4A== dependencies: - "@babel/helper-compilation-targets" "^7.27.2" - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/plugin-transform-destructuring" "^7.28.0" - "@babel/plugin-transform-parameters" "^7.27.7" - "@babel/traverse" "^7.28.4" + "@babel/helper-compilation-targets" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/plugin-transform-destructuring" "^7.29.7" + "@babel/plugin-transform-parameters" "^7.29.7" + "@babel/traverse" "^7.29.7" -"@babel/plugin-transform-object-super@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.27.1.tgz#1c932cd27bf3874c43a5cac4f43ebf970c9871b5" - integrity sha512-SFy8S9plRPbIcxlJ8A6mT/CxFdJx/c04JEctz4jf8YZaVS2px34j7NXRrlGlHkN/M2gnpL37ZpGRGVFLd3l8Ng== +"@babel/plugin-transform-object-super@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.29.7.tgz#e89283d14fa3c35817d4493ffc6bc649aa10e4eb" + integrity sha512-Ea/diGcw0twB5IlZPO5sgET6fJsLJqPABqTuFWIR+iMPGPZJkATEIWx0wa+aEQ5UY1CBQyP/gkAiLEqn1vBiQA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-replace-supers" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-replace-supers" "^7.29.7" -"@babel/plugin-transform-optional-catch-binding@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.27.1.tgz#84c7341ebde35ccd36b137e9e45866825072a30c" - integrity sha512-txEAEKzYrHEX4xSZN4kJ+OfKXFVSWKB2ZxM9dpcE3wT7smwkNmXo5ORRlVzMVdJbD+Q8ILTgSD7959uj+3Dm3Q== +"@babel/plugin-transform-optional-catch-binding@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.29.7.tgz#729664f79985be504eba112c51de9f71d009030b" + integrity sha512-sLsyndxK2VwX6yNUOakMb7Sh553ZTe/vVM1XJ+9Z5aW1ytsc8xOIwmyk05NNjN60vkc5/KqoTH6hB4V41LJhng== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-optional-chaining@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.27.1.tgz#874ce3c4f06b7780592e946026eb76a32830454f" - integrity sha512-BQmKPPIuc8EkZgNKsv0X4bPmOoayeu4F1YCwx2/CfmDSXDbp7GnzlUH+/ul5VGfRg1AoFPsrIThlEBj2xb4CAg== +"@babel/plugin-transform-optional-chaining@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.29.7.tgz#b84a1b574b3c73001023092567e16c492b720e51" + integrity sha512-6GM1dhvK3gNODkXcEcMCOLEDCLSoZ/sBbro2Ax8HURyasQ4NshagQixkRFdh5niI6E4gmA/jYI/4aT7rRos3ZQ== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.29.7" -"@babel/plugin-transform-parameters@^7.27.7": - version "7.27.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.27.7.tgz#1fd2febb7c74e7d21cf3b05f7aebc907940af53a" - integrity sha512-qBkYTYCb76RRxUM6CcZA5KRu8K4SM8ajzVeUgVdMVO9NN9uI/GaVmBg/WKJJGnNokV9SY8FxNOVWGXzqzUidBg== +"@babel/plugin-transform-parameters@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.29.7.tgz#a5ddc3b9bfb534814cb8334cbeba47d9cf9db090" + integrity sha512-ZDOBqV/qLYJI0YElr8DcENEyARsFQeESqWXH6gZlghYXuPPjvweuDhP4VyEi4BlUBlLRFZVjxoZDMjxhLW766g== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-private-methods@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.27.1.tgz#fdacbab1c5ed81ec70dfdbb8b213d65da148b6af" - integrity sha512-10FVt+X55AjRAYI9BrdISN9/AQWHqldOeZDUoLyif1Kn05a56xVBXb8ZouL8pZ9jem8QpXaOt8TS7RHUIS+GPA== +"@babel/plugin-transform-private-methods@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.29.7.tgz#cea8bd3ab99533892897a02999d5b752584ad145" + integrity sha512-/6Rz4DK1ETDEM/bWHsPHcaEe7ZaT1EqSXjtSP/L0DijOYuaUhiRiOKcwpZ8P7zR4xXEHc2ITdiCgBm9Tpyv9ug== dependencies: - "@babel/helper-create-class-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-class-features-plugin" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-private-property-in-object@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.27.1.tgz#4dbbef283b5b2f01a21e81e299f76e35f900fb11" - integrity sha512-5J+IhqTi1XPa0DXF83jYOaARrX+41gOewWbkPyjMNRDqgOCqdffGh8L3f/Ek5utaEBZExjSAzcyjmV9SSAWObQ== +"@babel/plugin-transform-private-property-in-object@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.29.7.tgz#4a2f6be5aba47be7afbdb4cd7903c46edf3a7661" + integrity sha512-+BNo06dnrzdNNqCm1X6YUaVv0DKk8Q+JYcoZfOkLhYWNCXzlwTSRq8zGWayT1csjcpNXV9CQTBRRbmTLZac5cA== dependencies: - "@babel/helper-annotate-as-pure" "^7.27.1" - "@babel/helper-create-class-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-annotate-as-pure" "^7.29.7" + "@babel/helper-create-class-features-plugin" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-property-literals@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.27.1.tgz#07eafd618800591e88073a0af1b940d9a42c6424" - integrity sha512-oThy3BCuCha8kDZ8ZkgOg2exvPYUlprMukKQXI1r1pJ47NCvxfkEy8vK+r/hT9nF0Aa4H1WUPZZjHTFtAhGfmQ== +"@babel/plugin-transform-property-literals@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.29.7.tgz#d45817cd72f9e134ab1f7fbb79264cfcb85cf636" + integrity sha512-bOMRLQuI0A5ZqHq3OWJ89/rXpJ/NJrbVhXiP4zwPGMs6kpcVsuTUNjwoE30K0Qm3mf48a/TnRYYD6vPNqcg6jA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" "@babel/plugin-transform-react-constant-elements@^7.21.3": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.27.1.tgz#6c6b50424e749a6e48afd14cf7b92f98cb9383f9" - integrity sha512-edoidOjl/ZxvYo4lSBOQGDSyToYVkTAwyVoa2tkuYTSmjrB1+uAedoL5iROVLXkxH+vRgA7uP4tMg2pUJpZ3Ug== + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.29.7.tgz#8264440ea2ffc5ec405aebd7eac074815d6e28b1" + integrity sha512-J0wGhKan+rIiE2OhfhRptySLrJ6SjQYM6b6N1FMlhyhCcw1Mig8vQjWchyB+bgHGDvaWo6Diu6CLRMra2uMtmg== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-react-display-name@^7.27.1": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.28.0.tgz#6f20a7295fea7df42eb42fed8f896813f5b934de" - integrity sha512-D6Eujc2zMxKjfa4Zxl4GHMsmhKKZ9VpcqIchJLvwTxad9zWIYulwYItBovpDOoNLISpcZSXoDJ5gaGbQUDqViA== +"@babel/plugin-transform-react-display-name@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.29.7.tgz#bf161a6d750267b79db7ff6f8fb89c3369b02df3" + integrity sha512-+1wdDMGNb4UPeY3Q4L5yLiYe6TXPXubs4NjrgRFw13hPRLJfEMw2Q5OXkee6/IfdqePIeW4Jjwe3aBh7SdKz4Q== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-react-jsx-development@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.27.1.tgz#47ff95940e20a3a70e68ad3d4fcb657b647f6c98" - integrity sha512-ykDdF5yI4f1WrAolLqeF3hmYU12j9ntLQl/AOG1HAS21jxyg1Q0/J/tpREuYLfatGdGmXp/3yS0ZA76kOlVq9Q== +"@babel/plugin-transform-react-jsx-development@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.29.7.tgz#64e6aacb5cb43b9e80d3d5f19ddefc158a624f09" + integrity sha512-Xfy3UVMF04+ypnFbkhvfqtmvwfe92qwQdbGZVonhE+6v35GzlofmOnA1szaZqzb9xYWr0nl1e5EMmzi0DNON1g== dependencies: - "@babel/plugin-transform-react-jsx" "^7.27.1" + "@babel/plugin-transform-react-jsx" "^7.29.7" -"@babel/plugin-transform-react-jsx@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.27.1.tgz#1023bc94b78b0a2d68c82b5e96aed573bcfb9db0" - integrity sha512-2KH4LWGSrJIkVf5tSiBFYuXDAoWRq2MMwgivCf+93dd0GQi8RXLjKA/0EvRnVV5G0hrHczsquXuD01L8s6dmBw== +"@babel/plugin-transform-react-jsx@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.29.7.tgz#3d16a0e5773f079400a8c82a190709cdf92ee204" + integrity sha512-WsZulLVBUHXVj2cUcPVx6UE21TpalB6bHbSFErKT0Ib++ax24jjXe73FqlWvdylFOjiuPHYi6VCcgRad1ItN+A== dependencies: - "@babel/helper-annotate-as-pure" "^7.27.1" - "@babel/helper-module-imports" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/plugin-syntax-jsx" "^7.27.1" - "@babel/types" "^7.27.1" + "@babel/helper-annotate-as-pure" "^7.29.7" + "@babel/helper-module-imports" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/plugin-syntax-jsx" "^7.29.7" + "@babel/types" "^7.29.7" -"@babel/plugin-transform-react-pure-annotations@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.27.1.tgz#339f1ce355eae242e0649f232b1c68907c02e879" - integrity sha512-JfuinvDOsD9FVMTHpzA/pBLisxpv1aSf+OIV8lgH3MuWrks19R27e6a6DipIg4aX1Zm9Wpb04p8wljfKrVSnPA== +"@babel/plugin-transform-react-pure-annotations@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.29.7.tgz#76445c90112dd0a7371b63264563bfa9a4fcd6e3" + integrity sha512-H5E+HBgDpr6Q5t+Aj11tL7XkIui1jhbIoArVQnqjgXo5/3YxkN7ZEBcWF4RQlB0T4rrxJQbXS6kiFV6B7XTqUA== dependencies: - "@babel/helper-annotate-as-pure" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-annotate-as-pure" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-regenerator@^7.28.3": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.28.4.tgz#9d3fa3bebb48ddd0091ce5729139cd99c67cea51" - integrity sha512-+ZEdQlBoRg9m2NnzvEeLgtvBMO4tkFBw5SQIUgLICgTrumLoU7lr+Oghi6km2PFj+dbUt2u1oby2w3BDO9YQnA== +"@babel/plugin-transform-regenerator@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.29.7.tgz#0f42626a7dbb0e7a7f52e036d3e43deebdc3ea4e" + integrity sha512-rNNFV0DBAJp988xW2DOntfDoYn1eR8GGF5AT5vYc+rjyfaQkM242c9tZUHHPe7KYaiJizXPWhQTzzdbXySyhBw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-regexp-modifiers@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.27.1.tgz#df9ba5577c974e3f1449888b70b76169998a6d09" - integrity sha512-TtEciroaiODtXvLZv4rmfMhkCv8jx3wgKpL68PuiPh2M4fvz5jhsA7697N1gMvkvr/JTF13DrFYyEbY9U7cVPA== +"@babel/plugin-transform-regexp-modifiers@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.29.7.tgz#68311c0c10af2198212528863f8542843e424025" + integrity sha512-mB5Fs0VWrJ42ZCmc8114v60qetdaUVNkj9PmSZRmanCZM3S9hm0CFRLjRmYIsuXav14l2jvZ+4T8iiCGnhj3nQ== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-regexp-features-plugin" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-reserved-words@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.27.1.tgz#40fba4878ccbd1c56605a4479a3a891ac0274bb4" - integrity sha512-V2ABPHIJX4kC7HegLkYoDpfg9PVmuWy/i6vUM5eGK22bx4YVFD3M5F0QQnWQoDs6AGsUWTVOopBiMFQgHaSkVw== +"@babel/plugin-transform-reserved-words@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.29.7.tgz#a6feeb179b36a5f1fc6e3154c1eb727bdbe35876" + integrity sha512-5+YhdpVgmfSmwZyLMftfaiffLRMHjzIRHFHHLdibcSyJm2pasMrKHrO3Ptrt2DRshjvpgjEJJ1zVW14WPq/6QA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" "@babel/plugin-transform-runtime@^7.25.9": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.28.3.tgz#f5990a1b2d2bde950ed493915e0719841c8d0eaa" - integrity sha512-Y6ab1kGqZ0u42Zv/4a7l0l72n9DKP/MKoKWaUSBylrhNZO2prYuqFOLbn5aW5SIFXwSH93yfjbgllL8lxuGKLg== + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.29.7.tgz#7c7fb6e2a46dce67e278b6cc84421c1d16da5695" + integrity sha512-xmAscdE/AsqRW7vutbPNoUmu/nF5SrLKPs7aoJgEjo35lLKA/Bc0i2rMv/hr1+Y0o1bQCiVtith3u2vdgRL39Q== dependencies: - "@babel/helper-module-imports" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-module-imports" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" babel-plugin-polyfill-corejs2 "^0.4.14" babel-plugin-polyfill-corejs3 "^0.13.0" babel-plugin-polyfill-regenerator "^0.6.5" semver "^6.3.1" -"@babel/plugin-transform-shorthand-properties@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.27.1.tgz#532abdacdec87bfee1e0ef8e2fcdee543fe32b90" - integrity sha512-N/wH1vcn4oYawbJ13Y/FxcQrWk63jhfNa7jef0ih7PHSIHX2LB7GWE1rkPrOnka9kwMxb6hMl19p7lidA+EHmQ== +"@babel/plugin-transform-shorthand-properties@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.29.7.tgz#25c0436b98f4bd9ca4b98e1fbd662743bbaab9bf" + integrity sha512-I+WYbGBAiCn7nA6xBrlgPH+MB7HWb4u8pv5S0Pv7OtwNvIFvCCb24YlttKEeUFVurfBCEaOTnuhlqsb7f0Z5Dg== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-spread@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.27.1.tgz#1a264d5fc12750918f50e3fe3e24e437178abb08" - integrity sha512-kpb3HUqaILBJcRFVhFUs6Trdd4mkrzcGXss+6/mxUd273PfbWqSDHRzMT2234gIg2QYfAjvXLSquP1xECSg09Q== +"@babel/plugin-transform-spread@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.29.7.tgz#a128bcdd6b5e5e47054907b2e50bc19c3f856edd" + integrity sha512-/u5K1QWada7tbYNqTjMh96718g9NTwh9tfPJMsSmVsQwGT447FskV+KcfeXkXq2GWki4EM/MuTdmBec+hOuVTQ== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.29.7" -"@babel/plugin-transform-sticky-regex@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.27.1.tgz#18984935d9d2296843a491d78a014939f7dcd280" - integrity sha512-lhInBO5bi/Kowe2/aLdBAawijx+q1pQzicSgnkB6dUPc1+RC8QmJHKf2OjvU+NZWitguJHEaEmbV6VWEouT58g== +"@babel/plugin-transform-sticky-regex@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.29.7.tgz#a42c0fd1fa42f7e98e1e0c7757f72a1bbca3a015" + integrity sha512-BCHzNYJGe9l7EpwwDBN/ztlL2NYFFq8hp9ddjtUEM9f2O7S7kKV/lL6Fwo7IF7NSkYhPK2vO+86nIGltA90MsA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-template-literals@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.27.1.tgz#1a0eb35d8bb3e6efc06c9fd40eb0bcef548328b8" - integrity sha512-fBJKiV7F2DxZUkg5EtHKXQdbsbURW3DZKQUWphDum0uRP6eHGGa/He9mc0mypL680pb+e/lDIthRohlv8NCHkg== +"@babel/plugin-transform-template-literals@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.29.7.tgz#ada97d8e0832bca8edb315888aa654b1570f3835" + integrity sha512-NCSEJ4sLFU2gqAub45HYh4fus2yQ36rr6ei6vpU7NdoJqCpxvEG8E6eJpscGyXP3VHD2Ny+fSXr04k1hoUrFqA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-typeof-symbol@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.27.1.tgz#70e966bb492e03509cf37eafa6dcc3051f844369" - integrity sha512-RiSILC+nRJM7FY5srIyc4/fGIwUhyDuuBSdWn4y6yT6gm652DpCHZjIipgn6B7MQ1ITOUnAKWixEUjQRIBIcLw== +"@babel/plugin-transform-typeof-symbol@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.29.7.tgz#d848a4677c1ee3485ab017f4018f04597798911c" + integrity sha512-223mNGoTkBiTEWFoK+Q6Go3tueMRclO8vxxxxquNCYuNI4jWOofFKJRRDu6SDrB8Sgo1UEGW9T4GAQ8ZyRso1A== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-typescript@^7.27.1": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.28.0.tgz#796cbd249ab56c18168b49e3e1d341b72af04a6b" - integrity sha512-4AEiDEBPIZvLQaWlc9liCavE0xRM0dNca41WtBeM3jgFptfUOSG9z0uteLhq6+3rq+WB6jIvUwKDTpXEHPJ2Vg== +"@babel/plugin-transform-typescript@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.29.7.tgz#f0449c3df7037bbe232043476851c38f5e4a7615" + integrity sha512-jK52h8LaLc7JarhQV2ofeFMts4H7vnOXnqZNA6fYglBTZewRBE51KWt3BUltW1P+KoPsYkHoJeXePuz4zo2LMw== dependencies: - "@babel/helper-annotate-as-pure" "^7.27.3" - "@babel/helper-create-class-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" - "@babel/plugin-syntax-typescript" "^7.27.1" + "@babel/helper-annotate-as-pure" "^7.29.7" + "@babel/helper-create-class-features-plugin" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-skip-transparent-expression-wrappers" "^7.29.7" + "@babel/plugin-syntax-typescript" "^7.29.7" -"@babel/plugin-transform-unicode-escapes@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.27.1.tgz#3e3143f8438aef842de28816ece58780190cf806" - integrity sha512-Ysg4v6AmF26k9vpfFuTZg8HRfVWzsh1kVfowA23y9j/Gu6dOuahdUVhkLqpObp3JIv27MLSii6noRnuKN8H0Mg== +"@babel/plugin-transform-unicode-escapes@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.29.7.tgz#1e99554b0cddfd650d649a9f2b996049893e5720" + integrity sha512-jCfXxSjf94lf4E0hKE0AByxF6F3/pVFqRdUUNkDJhsY0m1ZKjnN6ZYyMeHNpzflxb/0q5b7t3p+BE+SLF1WOtA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-unicode-property-regex@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.27.1.tgz#bdfe2d3170c78c5691a3c3be934c8c0087525956" - integrity sha512-uW20S39PnaTImxp39O5qFlHLS9LJEmANjMG7SxIhap8rCHqu0Ik+tLEPX5DKmHn6CsWQ7j3lix2tFOa5YtL12Q== +"@babel/plugin-transform-unicode-property-regex@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.29.7.tgz#44444afc73768c2190fac4d95f7716817b7f204a" + integrity sha512-OgZ+zoAJgZLUCunsTRQ5LAjOywDv5zzZ2/hQ5aMw1pGXyY2rtE8/chXYUmu3AlVHKpm10KEdG9aMwbI/K76ZGw== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-regexp-features-plugin" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-unicode-regex@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.27.1.tgz#25948f5c395db15f609028e370667ed8bae9af97" - integrity sha512-xvINq24TRojDuyt6JGtHmkVkrfVV3FPT16uytxImLeBZqW3/H52yN+kM1MGuyPkIQxrzKwPHs5U/MP3qKyzkGw== +"@babel/plugin-transform-unicode-regex@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.29.7.tgz#c3064b293ff7f1794b71f7650eec8db9896d3e59" + integrity sha512-7D/x/23/d/3VqZ0QA+LGbZMlGwZjztBygSWWWsfTPoQ1oQ6Q1P6Mr3d0kk42XabyUVw+fha3LqdRsFqeKqvCyA== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-regexp-features-plugin" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" -"@babel/plugin-transform-unicode-sets-regex@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.27.1.tgz#6ab706d10f801b5c72da8bb2548561fa04193cd1" - integrity sha512-EtkOujbc4cgvb0mlpQefi4NTPBzhSIevblFevACNLUspmrALgmEBdL/XfnyyITfd8fKBZrZys92zOWcik7j9Tw== +"@babel/plugin-transform-unicode-sets-regex@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.29.7.tgz#b03ac9f27326f6197e8e574add83bbf33fc34ecd" + integrity sha512-BLOhLht9DOJwIxlmp91wHvkXv1lguuHS3/FwUO8HL1H0u8s4hR1gASVFyilu9iGtcTRYqjTZmlsFFeQletntEg== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-regexp-features-plugin" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" "@babel/preset-env@^7.20.2", "@babel/preset-env@^7.25.9": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.28.3.tgz#2b18d9aff9e69643789057ae4b942b1654f88187" - integrity sha512-ROiDcM+GbYVPYBOeCR6uBXKkQpBExLl8k9HO1ygXEyds39j+vCCsjmj7S8GOniZQlEs81QlkdJZe76IpLSiqpg== - dependencies: - "@babel/compat-data" "^7.28.0" - "@babel/helper-compilation-targets" "^7.27.2" - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-validator-option" "^7.27.1" - "@babel/plugin-bugfix-firefox-class-in-computed-class-key" "^7.27.1" - "@babel/plugin-bugfix-safari-class-field-initializer-scope" "^7.27.1" - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.27.1" - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.27.1" - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly" "^7.28.3" + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.29.7.tgz#5e2ab5e764b493fdefc99c43aeaa70a9533a37fd" + integrity sha512-GYzX36n1nsciIb0uyH0GHwxwtNwPQIcpxSeiVLDtG/B7jB5xXgchnmL1f/jCX5o+pwnaDBtO60ONSJhEBJfxYA== + dependencies: + "@babel/compat-data" "^7.29.7" + "@babel/helper-compilation-targets" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-validator-option" "^7.29.7" + "@babel/plugin-bugfix-firefox-class-in-computed-class-key" "^7.29.7" + "@babel/plugin-bugfix-safari-class-field-initializer-scope" "^7.29.7" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.29.7" + "@babel/plugin-bugfix-safari-rest-destructuring-rhs-array" "^7.29.7" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.29.7" + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly" "^7.29.7" "@babel/plugin-proposal-private-property-in-object" "7.21.0-placeholder-for-preset-env.2" - "@babel/plugin-syntax-import-assertions" "^7.27.1" - "@babel/plugin-syntax-import-attributes" "^7.27.1" + "@babel/plugin-syntax-import-assertions" "^7.29.7" + "@babel/plugin-syntax-import-attributes" "^7.29.7" "@babel/plugin-syntax-unicode-sets-regex" "^7.18.6" - "@babel/plugin-transform-arrow-functions" "^7.27.1" - "@babel/plugin-transform-async-generator-functions" "^7.28.0" - "@babel/plugin-transform-async-to-generator" "^7.27.1" - "@babel/plugin-transform-block-scoped-functions" "^7.27.1" - "@babel/plugin-transform-block-scoping" "^7.28.0" - "@babel/plugin-transform-class-properties" "^7.27.1" - "@babel/plugin-transform-class-static-block" "^7.28.3" - "@babel/plugin-transform-classes" "^7.28.3" - "@babel/plugin-transform-computed-properties" "^7.27.1" - "@babel/plugin-transform-destructuring" "^7.28.0" - "@babel/plugin-transform-dotall-regex" "^7.27.1" - "@babel/plugin-transform-duplicate-keys" "^7.27.1" - "@babel/plugin-transform-duplicate-named-capturing-groups-regex" "^7.27.1" - "@babel/plugin-transform-dynamic-import" "^7.27.1" - "@babel/plugin-transform-explicit-resource-management" "^7.28.0" - "@babel/plugin-transform-exponentiation-operator" "^7.27.1" - "@babel/plugin-transform-export-namespace-from" "^7.27.1" - "@babel/plugin-transform-for-of" "^7.27.1" - "@babel/plugin-transform-function-name" "^7.27.1" - "@babel/plugin-transform-json-strings" "^7.27.1" - "@babel/plugin-transform-literals" "^7.27.1" - "@babel/plugin-transform-logical-assignment-operators" "^7.27.1" - "@babel/plugin-transform-member-expression-literals" "^7.27.1" - "@babel/plugin-transform-modules-amd" "^7.27.1" - "@babel/plugin-transform-modules-commonjs" "^7.27.1" - "@babel/plugin-transform-modules-systemjs" "^7.27.1" - "@babel/plugin-transform-modules-umd" "^7.27.1" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.27.1" - "@babel/plugin-transform-new-target" "^7.27.1" - "@babel/plugin-transform-nullish-coalescing-operator" "^7.27.1" - "@babel/plugin-transform-numeric-separator" "^7.27.1" - "@babel/plugin-transform-object-rest-spread" "^7.28.0" - "@babel/plugin-transform-object-super" "^7.27.1" - "@babel/plugin-transform-optional-catch-binding" "^7.27.1" - "@babel/plugin-transform-optional-chaining" "^7.27.1" - "@babel/plugin-transform-parameters" "^7.27.7" - "@babel/plugin-transform-private-methods" "^7.27.1" - "@babel/plugin-transform-private-property-in-object" "^7.27.1" - "@babel/plugin-transform-property-literals" "^7.27.1" - "@babel/plugin-transform-regenerator" "^7.28.3" - "@babel/plugin-transform-regexp-modifiers" "^7.27.1" - "@babel/plugin-transform-reserved-words" "^7.27.1" - "@babel/plugin-transform-shorthand-properties" "^7.27.1" - "@babel/plugin-transform-spread" "^7.27.1" - "@babel/plugin-transform-sticky-regex" "^7.27.1" - "@babel/plugin-transform-template-literals" "^7.27.1" - "@babel/plugin-transform-typeof-symbol" "^7.27.1" - "@babel/plugin-transform-unicode-escapes" "^7.27.1" - "@babel/plugin-transform-unicode-property-regex" "^7.27.1" - "@babel/plugin-transform-unicode-regex" "^7.27.1" - "@babel/plugin-transform-unicode-sets-regex" "^7.27.1" + "@babel/plugin-transform-arrow-functions" "^7.29.7" + "@babel/plugin-transform-async-generator-functions" "^7.29.7" + "@babel/plugin-transform-async-to-generator" "^7.29.7" + "@babel/plugin-transform-block-scoped-functions" "^7.29.7" + "@babel/plugin-transform-block-scoping" "^7.29.7" + "@babel/plugin-transform-class-properties" "^7.29.7" + "@babel/plugin-transform-class-static-block" "^7.29.7" + "@babel/plugin-transform-classes" "^7.29.7" + "@babel/plugin-transform-computed-properties" "^7.29.7" + "@babel/plugin-transform-destructuring" "^7.29.7" + "@babel/plugin-transform-dotall-regex" "^7.29.7" + "@babel/plugin-transform-duplicate-keys" "^7.29.7" + "@babel/plugin-transform-duplicate-named-capturing-groups-regex" "^7.29.7" + "@babel/plugin-transform-dynamic-import" "^7.29.7" + "@babel/plugin-transform-explicit-resource-management" "^7.29.7" + "@babel/plugin-transform-exponentiation-operator" "^7.29.7" + "@babel/plugin-transform-export-namespace-from" "^7.29.7" + "@babel/plugin-transform-for-of" "^7.29.7" + "@babel/plugin-transform-function-name" "^7.29.7" + "@babel/plugin-transform-json-strings" "^7.29.7" + "@babel/plugin-transform-literals" "^7.29.7" + "@babel/plugin-transform-logical-assignment-operators" "^7.29.7" + "@babel/plugin-transform-member-expression-literals" "^7.29.7" + "@babel/plugin-transform-modules-amd" "^7.29.7" + "@babel/plugin-transform-modules-commonjs" "^7.29.7" + "@babel/plugin-transform-modules-systemjs" "^7.29.7" + "@babel/plugin-transform-modules-umd" "^7.29.7" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.29.7" + "@babel/plugin-transform-new-target" "^7.29.7" + "@babel/plugin-transform-nullish-coalescing-operator" "^7.29.7" + "@babel/plugin-transform-numeric-separator" "^7.29.7" + "@babel/plugin-transform-object-rest-spread" "^7.29.7" + "@babel/plugin-transform-object-super" "^7.29.7" + "@babel/plugin-transform-optional-catch-binding" "^7.29.7" + "@babel/plugin-transform-optional-chaining" "^7.29.7" + "@babel/plugin-transform-parameters" "^7.29.7" + "@babel/plugin-transform-private-methods" "^7.29.7" + "@babel/plugin-transform-private-property-in-object" "^7.29.7" + "@babel/plugin-transform-property-literals" "^7.29.7" + "@babel/plugin-transform-regenerator" "^7.29.7" + "@babel/plugin-transform-regexp-modifiers" "^7.29.7" + "@babel/plugin-transform-reserved-words" "^7.29.7" + "@babel/plugin-transform-shorthand-properties" "^7.29.7" + "@babel/plugin-transform-spread" "^7.29.7" + "@babel/plugin-transform-sticky-regex" "^7.29.7" + "@babel/plugin-transform-template-literals" "^7.29.7" + "@babel/plugin-transform-typeof-symbol" "^7.29.7" + "@babel/plugin-transform-unicode-escapes" "^7.29.7" + "@babel/plugin-transform-unicode-property-regex" "^7.29.7" + "@babel/plugin-transform-unicode-regex" "^7.29.7" + "@babel/plugin-transform-unicode-sets-regex" "^7.29.7" "@babel/preset-modules" "0.1.6-no-external-plugins" - babel-plugin-polyfill-corejs2 "^0.4.14" - babel-plugin-polyfill-corejs3 "^0.13.0" - babel-plugin-polyfill-regenerator "^0.6.5" - core-js-compat "^3.43.0" + babel-plugin-polyfill-corejs2 "^0.4.15" + babel-plugin-polyfill-corejs3 "^0.14.0" + babel-plugin-polyfill-regenerator "^0.6.6" + core-js-compat "^3.48.0" semver "^6.3.1" "@babel/preset-modules@0.1.6-no-external-plugins": @@ -997,69 +1037,72 @@ esutils "^2.0.2" "@babel/preset-react@^7.18.6", "@babel/preset-react@^7.25.9": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.27.1.tgz#86ea0a5ca3984663f744be2fd26cb6747c3fd0ec" - integrity sha512-oJHWh2gLhU9dW9HHr42q0cI0/iHHXTLGe39qvpAZZzagHy0MzYLCnCVV0symeRvzmjHyVU7mw2K06E6u/JwbhA== + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.29.7.tgz#2ed18366e38c2081bbf1760dc01e88fa5674eb17" + integrity sha512-C+PV1TFUPTmBQGoPBL8j2QmLpZ117YTCwxIZeJOM96GbYMFSc7/pOXU5lVykwnZxyTqQxRsvoRk6f2FktZgGHA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-validator-option" "^7.27.1" - "@babel/plugin-transform-react-display-name" "^7.27.1" - "@babel/plugin-transform-react-jsx" "^7.27.1" - "@babel/plugin-transform-react-jsx-development" "^7.27.1" - "@babel/plugin-transform-react-pure-annotations" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-validator-option" "^7.29.7" + "@babel/plugin-transform-react-display-name" "^7.29.7" + "@babel/plugin-transform-react-jsx" "^7.29.7" + "@babel/plugin-transform-react-jsx-development" "^7.29.7" + "@babel/plugin-transform-react-pure-annotations" "^7.29.7" "@babel/preset-typescript@^7.21.0", "@babel/preset-typescript@^7.25.9": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.27.1.tgz#190742a6428d282306648a55b0529b561484f912" - integrity sha512-l7WfQfX0WK4M0v2RudjuQK4u99BS6yLHYEmdtVPP7lKV013zr9DygFuWNlnbvQ9LR+LS0Egz/XAvGx5U9MX0fQ== - dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-validator-option" "^7.27.1" - "@babel/plugin-syntax-jsx" "^7.27.1" - "@babel/plugin-transform-modules-commonjs" "^7.27.1" - "@babel/plugin-transform-typescript" "^7.27.1" - -"@babel/runtime-corejs3@^7.25.9": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.28.4.tgz#c25be39c7997ce2f130d70b9baecb8ed94df93fa" - integrity sha512-h7iEYiW4HebClDEhtvFObtPmIvrd1SSfpI9EhOeKk4CtIK/ngBWFpuhCzhdmRKtg71ylcue+9I6dv54XYO1epQ== - dependencies: - core-js-pure "^3.43.0" - -"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.18.3", "@babel/runtime@^7.25.9", "@babel/runtime@^7.28.3", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.7": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.4.tgz#a70226016fabe25c5783b2f22d3e1c9bc5ca3326" - integrity sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ== - -"@babel/template@^7.27.1", "@babel/template@^7.27.2": - version "7.27.2" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.2.tgz#fa78ceed3c4e7b63ebf6cb39e5852fca45f6809d" - integrity sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw== - dependencies: - "@babel/code-frame" "^7.27.1" - "@babel/parser" "^7.27.2" - "@babel/types" "^7.27.1" - -"@babel/traverse@^7.25.9", "@babel/traverse@^7.27.1", "@babel/traverse@^7.28.0", "@babel/traverse@^7.28.3", "@babel/traverse@^7.28.4": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.28.4.tgz#8d456101b96ab175d487249f60680221692b958b" - integrity sha512-YEzuboP2qvQavAcjgQNVgsvHIDv6ZpwXvcvjmyySP2DIMuByS/6ioU5G9pYrWHM6T2YDfc7xga9iNzYOs12CFQ== - dependencies: - "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.28.3" - "@babel/helper-globals" "^7.28.0" - "@babel/parser" "^7.28.4" - "@babel/template" "^7.27.2" - "@babel/types" "^7.28.4" + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.29.7.tgz#de9be1f47b785c979ec7b3a71f4cd8bae5267b62" + integrity sha512-/Foi8vKY2EVbed/1eZx0gJEEwHAIxogrySI7rULcRIvhZzbvoE/b5qG5Ghc0WKAFKOHA9SD1x7RsFlOYdutIiQ== + dependencies: + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-validator-option" "^7.29.7" + "@babel/plugin-syntax-jsx" "^7.29.7" + "@babel/plugin-transform-modules-commonjs" "^7.29.7" + "@babel/plugin-transform-typescript" "^7.29.7" + +"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.18.3", "@babel/runtime@^7.25.9", "@babel/runtime@^7.28.6", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.29.7.tgz#12022450c45a4da6d8d8287b18a4ff2ddb23f768" + integrity sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw== + +"@babel/template@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.29.7.tgz#4d9d4004f645cdd304de958c725162784ecac700" + integrity sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/parser" "^7.29.7" + "@babel/types" "^7.29.7" + +"@babel/traverse@^7.25.9", "@babel/traverse@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.29.7.tgz#c47b07a41b95da0907d026b5dd894d98de7d2f2d" + integrity sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/generator" "^7.29.7" + "@babel/helper-globals" "^7.29.7" + "@babel/parser" "^7.29.7" + "@babel/template" "^7.29.7" + "@babel/types" "^7.29.7" debug "^4.3.1" -"@babel/types@^7.21.3", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.28.2", "@babel/types@^7.28.4", "@babel/types@^7.4.4": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.4.tgz#0a4e618f4c60a7cd6c11cb2d48060e4dbe38ac3a" - integrity sha512-bkFqkLhh3pMBUQQkpVgWDWq/lqzc2678eUyDlTBhRqhCHFguYYGM0Efga7tYk4TogG/3x0EEl66/OQ+WGbWB/Q== +"@babel/types@^7.21.3", "@babel/types@^7.29.7", "@babel/types@^7.4.4": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.29.7.tgz#8005e31d82712ee7adaef6e23c63b71a62770a92" + integrity sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA== dependencies: - "@babel/helper-string-parser" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" + "@babel/helper-string-parser" "^7.29.7" + "@babel/helper-validator-identifier" "^7.29.7" + +"@braintree/sanitize-url@^7.1.2": + version "7.1.2" + resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-7.1.2.tgz#ca2035b0fefe956a8676ff0c69af73e605fcd81f" + integrity sha512-jigsZK+sMF/cuiB7sERuo9V7N9jx+dhmHHnQyDSVdpZwVutaBu7WvNYqMDLSgFgfB30n452TP3vjDAvFC973mA== + +"@chevrotain/types@~11.1.2": + version "11.1.2" + resolved "https://registry.yarnpkg.com/@chevrotain/types/-/types-11.1.2.tgz#e83a1a2704f0c5e49e7592b214031a0f4a34d7e5" + integrity sha512-U+HFai5+zmJCkK86QsaJtoITlboZHBqrVketcO2ROv865xfCMSFpELQoz1GkX5GzME8pTa+3kbKrZHQtI0gdbw== "@colors/colors@1.5.0": version "1.5.0" @@ -1104,15 +1147,15 @@ resolved "https://registry.yarnpkg.com/@csstools/media-query-list-parser/-/media-query-list-parser-4.0.3.tgz#7aec77bcb89c2da80ef207e73f474ef9e1b3cdf1" integrity sha512-HAYH7d3TLRHDOUQK4mZKf9k9Ph/m8Akstg66ywKR4SFAigjs3yBiUeZtFxywiTm5moZMAp/5W/ZuFnNXXYLuuQ== -"@csstools/postcss-alpha-function@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@csstools/postcss-alpha-function/-/postcss-alpha-function-1.0.0.tgz#8764fbbf25a5f1e106fb623ae632e01a220a6fc2" - integrity sha512-r2L8KNg5Wriq5n8IUQcjzy2Rh37J5YjzP9iOyHZL5fxdWYHB08vqykHQa4wAzN/tXwDuCHnhQDGCtxfS76xn7g== +"@csstools/postcss-alpha-function@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@csstools/postcss-alpha-function/-/postcss-alpha-function-1.0.1.tgz#7989605711de7831bc7cd75b94c9b5bac9c3728e" + integrity sha512-isfLLwksH3yHkFXfCI2Gcaqg7wGGHZZwunoJzEZk0yKYIokgre6hYVFibKL3SYAoR1kBXova8LB+JoO5vZzi9w== dependencies: "@csstools/css-color-parser" "^3.1.0" "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" "@csstools/postcss-cascade-layers@^5.0.2": @@ -1123,58 +1166,69 @@ "@csstools/selector-specificity" "^5.0.0" postcss-selector-parser "^7.0.0" -"@csstools/postcss-color-function-display-p3-linear@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@csstools/postcss-color-function-display-p3-linear/-/postcss-color-function-display-p3-linear-1.0.0.tgz#27395b62a5d9a108eefcc0eb463247a15f4269a1" - integrity sha512-7q+OuUqfowRrP84m/Jl0wv3pfCQyUTCW5MxDIux+/yty5IkUUHOTigCjrC0Fjy3OT0ncGLudHbfLWmP7E1arNA== +"@csstools/postcss-color-function-display-p3-linear@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@csstools/postcss-color-function-display-p3-linear/-/postcss-color-function-display-p3-linear-1.0.1.tgz#3017ff5e1f65307d6083e58e93d76724fb1ebf9f" + integrity sha512-E5qusdzhlmO1TztYzDIi8XPdPoYOjoTY6HBYBCYSj+Gn4gQRBlvjgPQXzfzuPQqt8EhkC/SzPKObg4Mbn8/xMg== dependencies: "@csstools/css-color-parser" "^3.1.0" "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" -"@csstools/postcss-color-function@^4.0.11": - version "4.0.11" - resolved "https://registry.yarnpkg.com/@csstools/postcss-color-function/-/postcss-color-function-4.0.11.tgz#03c34a51dc00943a6674294fb1163e7af9e87ffd" - integrity sha512-AtH22zLHTLm64HLdpv5EedT/zmYTm1MtdQbQhRZXxEB6iYtS6SrS1jLX3TcmUWMFzpumK/OVylCm3HcLms4slw== +"@csstools/postcss-color-function@^4.0.12": + version "4.0.12" + resolved "https://registry.yarnpkg.com/@csstools/postcss-color-function/-/postcss-color-function-4.0.12.tgz#a7c85a98c77b522a194a1bbb00dd207f40c7a771" + integrity sha512-yx3cljQKRaSBc2hfh8rMZFZzChaFgwmO2JfFgFr1vMcF3C/uyy5I4RFIBOIWGq1D+XbKCG789CGkG6zzkLpagA== dependencies: "@csstools/css-color-parser" "^3.1.0" "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" -"@csstools/postcss-color-mix-function@^3.0.11": - version "3.0.11" - resolved "https://registry.yarnpkg.com/@csstools/postcss-color-mix-function/-/postcss-color-mix-function-3.0.11.tgz#6db0a1c749fabaf2bf978b37044700d1c1b09fc2" - integrity sha512-cQpXBelpTx0YhScZM5Ve0jDCA4RzwFc7oNafzZOGgCHt/GQVYiU8Vevz9QJcwy/W0Pyi/BneY+KMjz23lI9r+Q== +"@csstools/postcss-color-mix-function@^3.0.12": + version "3.0.12" + resolved "https://registry.yarnpkg.com/@csstools/postcss-color-mix-function/-/postcss-color-mix-function-3.0.12.tgz#2f1ee9f8208077af069545c9bd79bb9733382c2a" + integrity sha512-4STERZfCP5Jcs13P1U5pTvI9SkgLgfMUMhdXW8IlJWkzOOOqhZIjcNhWtNJZes2nkBDsIKJ0CJtFtuaZ00moag== dependencies: "@csstools/css-color-parser" "^3.1.0" "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" -"@csstools/postcss-color-mix-variadic-function-arguments@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@csstools/postcss-color-mix-variadic-function-arguments/-/postcss-color-mix-variadic-function-arguments-1.0.1.tgz#2dd9d66ded0d41cd7b2c13a1188f03e894c17d7e" - integrity sha512-c7hyBtbF+jlHIcUGVdWY06bHICgguV9ypfcELU3eU3W/9fiz2dxM8PqxQk2ndXYTzLnwPvNNqu1yCmQ++N6Dcg== +"@csstools/postcss-color-mix-variadic-function-arguments@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@csstools/postcss-color-mix-variadic-function-arguments/-/postcss-color-mix-variadic-function-arguments-1.0.2.tgz#b4012b62a4eaa24d694172bb7137f9d2319cb8f2" + integrity sha512-rM67Gp9lRAkTo+X31DUqMEq+iK+EFqsidfecmhrteErxJZb6tUoJBVQca1Vn1GpDql1s1rD1pKcuYzMsg7Z1KQ== dependencies: "@csstools/css-color-parser" "^3.1.0" "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" -"@csstools/postcss-content-alt-text@^2.0.7": - version "2.0.7" - resolved "https://registry.yarnpkg.com/@csstools/postcss-content-alt-text/-/postcss-content-alt-text-2.0.7.tgz#ac0a263e8acb0be99cdcfc0b1792c62141825747" - integrity sha512-cq/zWaEkpcg3RttJ5+GdNwk26NwxY5KgqgtNL777Fdd28AVGHxuBvqmK4Jq4oKhW1NX4M2LbgYAVVN0NZ+/XYQ== +"@csstools/postcss-content-alt-text@^2.0.8": + version "2.0.8" + resolved "https://registry.yarnpkg.com/@csstools/postcss-content-alt-text/-/postcss-content-alt-text-2.0.8.tgz#1d52da1762893c32999ff76839e48d6ec7c7a4cb" + integrity sha512-9SfEW9QCxEpTlNMnpSqFaHyzsiRpZ5J5+KqCu1u5/eEJAWsMhzT40qf0FIbeeglEvrGRMdDzAxMIz3wqoGSb+Q== + dependencies: + "@csstools/css-parser-algorithms" "^3.0.5" + "@csstools/css-tokenizer" "^3.0.4" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" + "@csstools/utilities" "^2.0.0" + +"@csstools/postcss-contrast-color-function@^2.0.12": + version "2.0.12" + resolved "https://registry.yarnpkg.com/@csstools/postcss-contrast-color-function/-/postcss-contrast-color-function-2.0.12.tgz#ca46986d095c60f208d9e3f24704d199c9172637" + integrity sha512-YbwWckjK3qwKjeYz/CijgcS7WDUCtKTd8ShLztm3/i5dhh4NaqzsbYnhm4bjrpFpnLZ31jVcbK8YL77z3GBPzA== dependencies: + "@csstools/css-color-parser" "^3.1.0" "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" "@csstools/postcss-exponential-functions@^2.0.9": @@ -1203,34 +1257,34 @@ "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" -"@csstools/postcss-gradients-interpolation-method@^5.0.11": - version "5.0.11" - resolved "https://registry.yarnpkg.com/@csstools/postcss-gradients-interpolation-method/-/postcss-gradients-interpolation-method-5.0.11.tgz#f1c5c431a44ed9655cb408aea8666ed2c5250490" - integrity sha512-8M3mcNTL3cGIJXDnvrJ2oWEcKi3zyw7NeYheFKePUlBmLYm1gkw9Rr/BA7lFONrOPeQA3yeMPldrrws6lqHrug== +"@csstools/postcss-gradients-interpolation-method@^5.0.12": + version "5.0.12" + resolved "https://registry.yarnpkg.com/@csstools/postcss-gradients-interpolation-method/-/postcss-gradients-interpolation-method-5.0.12.tgz#0955cce4d97203b861bf66742bbec611b2f3661c" + integrity sha512-jugzjwkUY0wtNrZlFeyXzimUL3hN4xMvoPnIXxoZqxDvjZRiSh+itgHcVUWzJ2VwD/VAMEgCLvtaJHX+4Vj3Ow== dependencies: "@csstools/css-color-parser" "^3.1.0" "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" -"@csstools/postcss-hwb-function@^4.0.11": - version "4.0.11" - resolved "https://registry.yarnpkg.com/@csstools/postcss-hwb-function/-/postcss-hwb-function-4.0.11.tgz#4bb173f1c8c2361bf46a842a948ee687471ae4ea" - integrity sha512-9meZbsVWTZkWsSBazQips3cHUOT29a/UAwFz0AMEXukvpIGGDR9+GMl3nIckWO5sPImsadu4F5Zy+zjt8QgCdA== +"@csstools/postcss-hwb-function@^4.0.12": + version "4.0.12" + resolved "https://registry.yarnpkg.com/@csstools/postcss-hwb-function/-/postcss-hwb-function-4.0.12.tgz#07f7ecb08c50e094673bd20eaf7757db0162beee" + integrity sha512-mL/+88Z53KrE4JdePYFJAQWFrcADEqsLprExCM04GDNgHIztwFzj0Mbhd/yxMBngq0NIlz58VVxjt5abNs1VhA== dependencies: "@csstools/css-color-parser" "^3.1.0" "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" -"@csstools/postcss-ic-unit@^4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@csstools/postcss-ic-unit/-/postcss-ic-unit-4.0.3.tgz#ba0375e9d346e6e5a42dc8c2cb1133b2262f9ffa" - integrity sha512-RtYYm2qUIu9vAaHB0cC8rQGlOCQAUgEc2tMr7ewlGXYipBQKjoWmyVArqsk7SEr8N3tErq6P6UOJT3amaVof5Q== +"@csstools/postcss-ic-unit@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@csstools/postcss-ic-unit/-/postcss-ic-unit-4.0.4.tgz#2ee2da0690db7edfbc469279711b9e69495659d2" + integrity sha512-yQ4VmossuOAql65sCPppVO1yfb7hDscf4GseF0VCA/DTDaBc0Wtf8MTqVPfjGYlT5+2buokG0Gp7y0atYZpwjg== dependencies: - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" postcss-value-parser "^4.2.0" @@ -1247,14 +1301,14 @@ "@csstools/selector-specificity" "^5.0.0" postcss-selector-parser "^7.0.0" -"@csstools/postcss-light-dark-function@^2.0.10": - version "2.0.10" - resolved "https://registry.yarnpkg.com/@csstools/postcss-light-dark-function/-/postcss-light-dark-function-2.0.10.tgz#b606f13d1f81efd297763c6ad1ac515c3ca4165b" - integrity sha512-g7Lwb294lSoNnyrwcqoooh9fTAp47rRNo+ILg7SLRSMU3K9ePIwRt566sNx+pehiCelv4E1ICaU1EwLQuyF2qw== +"@csstools/postcss-light-dark-function@^2.0.11": + version "2.0.11" + resolved "https://registry.yarnpkg.com/@csstools/postcss-light-dark-function/-/postcss-light-dark-function-2.0.11.tgz#0df448aab9a33cb9a085264ff1f396fb80c4437d" + integrity sha512-fNJcKXJdPM3Lyrbmgw2OBbaioU7yuKZtiXClf4sGdQttitijYlZMD5K7HrC/eF83VRWRrYq6OZ0Lx92leV2LFA== dependencies: "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" "@csstools/postcss-logical-float-and-clear@^3.0.0": @@ -1314,31 +1368,44 @@ "@csstools/utilities" "^2.0.0" postcss-value-parser "^4.2.0" -"@csstools/postcss-normalize-display-values@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@csstools/postcss-normalize-display-values/-/postcss-normalize-display-values-4.0.0.tgz#ecdde2daf4e192e5da0c6fd933b6d8aff32f2a36" - integrity sha512-HlEoG0IDRoHXzXnkV4in47dzsxdsjdz6+j7MLjaACABX2NfvjFS6XVAnpaDyGesz9gK2SC7MbNwdCHusObKJ9Q== +"@csstools/postcss-normalize-display-values@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@csstools/postcss-normalize-display-values/-/postcss-normalize-display-values-4.0.1.tgz#3738ecadb38cd6521c9565635d61aa4bf5457d27" + integrity sha512-TQUGBuRvxdc7TgNSTevYqrL8oItxiwPDixk20qCB5me/W8uF7BPbhRrAvFuhEoywQp/woRsUZ6SJ+sU5idZAIA== dependencies: postcss-value-parser "^4.2.0" -"@csstools/postcss-oklab-function@^4.0.11": - version "4.0.11" - resolved "https://registry.yarnpkg.com/@csstools/postcss-oklab-function/-/postcss-oklab-function-4.0.11.tgz#d69242a9b027dda731bd79db7293bc938bb6df97" - integrity sha512-9f03ZGxZ2VmSCrM4SDXlAYP+Xpu4VFzemfQUQFL9OYxAbpvDy0FjDipZ0i8So1pgs8VIbQI0bNjFWgfdpGw8ig== +"@csstools/postcss-oklab-function@^4.0.12": + version "4.0.12" + resolved "https://registry.yarnpkg.com/@csstools/postcss-oklab-function/-/postcss-oklab-function-4.0.12.tgz#416640ef10227eea1375b47b72d141495950971d" + integrity sha512-HhlSmnE1NKBhXsTnNGjxvhryKtO7tJd1w42DKOGFD6jSHtYOrsJTQDKPMwvOfrzUAk8t7GcpIfRyM7ssqHpFjg== dependencies: "@csstools/css-color-parser" "^3.1.0" "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" -"@csstools/postcss-progressive-custom-properties@^4.2.0": - version "4.2.0" - resolved "https://registry.yarnpkg.com/@csstools/postcss-progressive-custom-properties/-/postcss-progressive-custom-properties-4.2.0.tgz#7f15349c2cd108478d28e1503c660d4037925030" - integrity sha512-fWCXRasX17N1NCPTCuwC3FJDV+Wc031f16cFuuMEfIsYJ1q5ABCa59W0C6VeMGqjNv6ldf37vvwXXAeaZjD9PA== +"@csstools/postcss-position-area-property@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@csstools/postcss-position-area-property/-/postcss-position-area-property-1.0.0.tgz#41f0cbc737a81a42890d5ec035fa26a45f4f4ad4" + integrity sha512-fUP6KR8qV2NuUZV3Cw8itx0Ep90aRjAZxAEzC3vrl6yjFv+pFsQbR18UuQctEKmA72K9O27CoYiKEgXxkqjg8Q== + +"@csstools/postcss-progressive-custom-properties@^4.2.1": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@csstools/postcss-progressive-custom-properties/-/postcss-progressive-custom-properties-4.2.1.tgz#c39780b9ff0d554efb842b6bd75276aa6f1705db" + integrity sha512-uPiiXf7IEKtUQXsxu6uWtOlRMXd2QWWy5fhxHDnPdXKCQckPP3E34ZgDoZ62r2iT+UOgWsSbM4NvHE5m3mAEdw== dependencies: postcss-value-parser "^4.2.0" +"@csstools/postcss-property-rule-prelude-list@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@csstools/postcss-property-rule-prelude-list/-/postcss-property-rule-prelude-list-1.0.0.tgz#700b7aa41228c02281bda074ae778f36a09da188" + integrity sha512-IxuQjUXq19fobgmSSvUDO7fVwijDJaZMvWQugxfEUxmjBeDCVaDuMpsZ31MsTm5xbnhA+ElDi0+rQ7sQQGisFA== + dependencies: + "@csstools/css-parser-algorithms" "^3.0.5" + "@csstools/css-tokenizer" "^3.0.4" + "@csstools/postcss-random-function@^2.0.1": version "2.0.1" resolved "https://registry.yarnpkg.com/@csstools/postcss-random-function/-/postcss-random-function-2.0.1.tgz#3191f32fe72936e361dadf7dbfb55a0209e2691e" @@ -1348,15 +1415,15 @@ "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" -"@csstools/postcss-relative-color-syntax@^3.0.11": - version "3.0.11" - resolved "https://registry.yarnpkg.com/@csstools/postcss-relative-color-syntax/-/postcss-relative-color-syntax-3.0.11.tgz#d81d59ff123fa5f3e4a0493b1e2b0585353bb541" - integrity sha512-oQ5fZvkcBrWR+k6arHXk0F8FlkmD4IxM+rcGDLWrF2f31tWyEM3lSraeWAV0f7BGH6LIrqmyU3+Qo/1acfoJng== +"@csstools/postcss-relative-color-syntax@^3.0.12": + version "3.0.12" + resolved "https://registry.yarnpkg.com/@csstools/postcss-relative-color-syntax/-/postcss-relative-color-syntax-3.0.12.tgz#ced792450102441f7c160e1d106f33e4b44181f8" + integrity sha512-0RLIeONxu/mtxRtf3o41Lq2ghLimw0w9ByLWnnEVuy89exmEEq8bynveBxNW3nyHqLAFEeNtVEmC1QK9MZ8Huw== dependencies: "@csstools/css-color-parser" "^3.1.0" "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" "@csstools/postcss-scope-pseudo-class@^4.0.1": @@ -1384,6 +1451,21 @@ "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" +"@csstools/postcss-syntax-descriptor-syntax-production@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@csstools/postcss-syntax-descriptor-syntax-production/-/postcss-syntax-descriptor-syntax-production-1.0.1.tgz#98590e372e547cdae60aef47cfee11f3881307dd" + integrity sha512-GneqQWefjM//f4hJ/Kbox0C6f2T7+pi4/fqTqOFGTL3EjnvOReTqO1qUQ30CaUjkwjYq9qZ41hzarrAxCc4gow== + dependencies: + "@csstools/css-tokenizer" "^3.0.4" + +"@csstools/postcss-system-ui-font-family@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@csstools/postcss-system-ui-font-family/-/postcss-system-ui-font-family-1.0.0.tgz#bd65b79078debf6f67b318dc9b71a8f9fa16f8c8" + integrity sha512-s3xdBvfWYfoPSBsikDXbuorcMG1nN1M6GdU0qBsGfcmNR0A/qhloQZpTxjA3Xsyrk1VJvwb2pOfiOT3at/DuIQ== + dependencies: + "@csstools/css-parser-algorithms" "^3.0.5" + "@csstools/css-tokenizer" "^3.0.4" + "@csstools/postcss-text-decoration-shorthand@^4.0.3": version "4.0.3" resolved "https://registry.yarnpkg.com/@csstools/postcss-text-decoration-shorthand/-/postcss-text-decoration-shorthand-4.0.3.tgz#fae1b70f07d1b7beb4c841c86d69e41ecc6f743c" @@ -1426,25 +1508,29 @@ resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== -"@docsearch/css@3.9.0": - version "3.9.0" - resolved "https://registry.yarnpkg.com/@docsearch/css/-/css-3.9.0.tgz#3bc29c96bf024350d73b0cfb7c2a7b71bf251cd5" - integrity sha512-cQbnVbq0rrBwNAKegIac/t6a8nWoUAn8frnkLFW6YARaRmAQr5/Eoe6Ln2fqkUCZ40KpdrKbpSAmgrkviOxuWA== +"@docsearch/core@4.6.3": + version "4.6.3" + resolved "https://registry.yarnpkg.com/@docsearch/core/-/core-4.6.3.tgz#9954c75c3ae28418e06f8e7537a920d6cd2bc22e" + integrity sha512-rUOujwIpxJRgD7+kicVsI3D5sqBvdiRTquzWBpTEXZs8ZXfGbfzpus5HqumaNYTppN2HvH8E2yNuRwYdHJeOlA== -"@docsearch/react@^3.9.0": - version "3.9.0" - resolved "https://registry.yarnpkg.com/@docsearch/react/-/react-3.9.0.tgz#d0842b700c3ee26696786f3c8ae9f10c1a3f0db3" - integrity sha512-mb5FOZYZIkRQ6s/NWnM98k879vu5pscWqTLubLFBO87igYYT4VzVazh4h5o/zCvTIZgEt3PvsCOMOswOUo9yHQ== +"@docsearch/css@4.6.3": + version "4.6.3" + resolved "https://registry.yarnpkg.com/@docsearch/css/-/css-4.6.3.tgz#a94065af4a996dd927dc5dda383395e583dbd638" + integrity sha512-nlOwcXcsNAptQl4vlL4MA78qNJKO0Qlds5GuBjCoePgkebTXLSf8Qt1oyZ3YBshYupKXG9VRGEsk1zr23d+bzQ== + +"@docsearch/react@^3.9.0 || ^4.3.2": + version "4.6.3" + resolved "https://registry.yarnpkg.com/@docsearch/react/-/react-4.6.3.tgz#80df785f9c5e484c960b914a22ea2a3e4c7210ad" + integrity sha512-Bg2wdDsoQVlNCcEKuEJAU04tvHCqgx8rIu+uIoM4pRtcx3TBKJuXutJik3LTA8LRc9YEyHkrYUrmcC0D7BYf+g== dependencies: - "@algolia/autocomplete-core" "1.17.9" - "@algolia/autocomplete-preset-algolia" "1.17.9" - "@docsearch/css" "3.9.0" - algoliasearch "^5.14.2" + "@algolia/autocomplete-core" "1.19.2" + "@docsearch/core" "4.6.3" + "@docsearch/css" "4.6.3" -"@docusaurus/babel@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/babel/-/babel-3.8.1.tgz#db329ac047184214e08e2dbc809832c696c18506" - integrity sha512-3brkJrml8vUbn9aeoZUlJfsI/GqyFcDgQJwQkmBtclJgWDEQBKKeagZfOgx0WfUQhagL1sQLNW0iBdxnI863Uw== +"@docusaurus/babel@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/babel/-/babel-3.10.2.tgz#4d5f8ac4d16bfe26c06f256687831787edb46e8a" + integrity sha512-aJ1hpGyvfkte3dDAfNbWM4biW4yWZBVz7TIGLZP+v+tWOBgxX3e0N5ZIXHIvmfNNXTI77pcHUx3KmtOk05Ze3Q== dependencies: "@babel/core" "^7.25.9" "@babel/generator" "^7.25.9" @@ -1454,25 +1540,24 @@ "@babel/preset-react" "^7.25.9" "@babel/preset-typescript" "^7.25.9" "@babel/runtime" "^7.25.9" - "@babel/runtime-corejs3" "^7.25.9" "@babel/traverse" "^7.25.9" - "@docusaurus/logger" "3.8.1" - "@docusaurus/utils" "3.8.1" + "@docusaurus/logger" "3.10.2" + "@docusaurus/utils" "3.10.2" babel-plugin-dynamic-import-node "^2.3.3" fs-extra "^11.1.1" tslib "^2.6.0" -"@docusaurus/bundler@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/bundler/-/bundler-3.8.1.tgz#e2b11d615f09a6e470774bb36441b8d06736b94c" - integrity sha512-/z4V0FRoQ0GuSLToNjOSGsk6m2lQUG4FRn8goOVoZSRsTrU8YR2aJacX5K3RG18EaX9b+52pN4m1sL3MQZVsQA== +"@docusaurus/bundler@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/bundler/-/bundler-3.10.2.tgz#323492eb0550b6a7f6e5fa6b9877cdb2c53b1be3" + integrity sha512-i0ZNcy0f0WhaOlYVgzLsWhIoEXO9kS3HRoKPtgE6vQtZUq7arKZaYdNBudr3mqCmd+TyOkwtwfHgs1ENj07r5g== dependencies: "@babel/core" "^7.25.9" - "@docusaurus/babel" "3.8.1" - "@docusaurus/cssnano-preset" "3.8.1" - "@docusaurus/logger" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils" "3.8.1" + "@docusaurus/babel" "3.10.2" + "@docusaurus/cssnano-preset" "3.10.2" + "@docusaurus/logger" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils" "3.10.2" babel-loader "^9.2.1" clean-css "^5.3.3" copy-webpack-plugin "^11.0.0" @@ -1490,20 +1575,20 @@ tslib "^2.6.0" url-loader "^4.1.1" webpack "^5.95.0" - webpackbar "^6.0.1" - -"@docusaurus/core@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/core/-/core-3.8.1.tgz#c22e47c16a22cb7d245306c64bc54083838ff3db" - integrity sha512-ENB01IyQSqI2FLtOzqSI3qxG2B/jP4gQPahl2C3XReiLebcVh5B5cB9KYFvdoOqOWPyr5gXK4sjgTKv7peXCrA== - dependencies: - "@docusaurus/babel" "3.8.1" - "@docusaurus/bundler" "3.8.1" - "@docusaurus/logger" "3.8.1" - "@docusaurus/mdx-loader" "3.8.1" - "@docusaurus/utils" "3.8.1" - "@docusaurus/utils-common" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" + webpackbar "^7.0.0" + +"@docusaurus/core@3.10.2", "@docusaurus/core@^3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/core/-/core-3.10.2.tgz#349cae728fc3769b3f8aef4cf538ccb79aace8d0" + integrity sha512-EYByj6nk+aD9KeVxV6Hmo2/nAAT79P21Y82ycTBOBtrmqilloIbIEhgL2/8Xpt2Jz/pgNqHAwyusOGwmbKeJmA== + dependencies: + "@docusaurus/babel" "3.10.2" + "@docusaurus/bundler" "3.10.2" + "@docusaurus/logger" "3.10.2" + "@docusaurus/mdx-loader" "3.10.2" + "@docusaurus/utils" "3.10.2" + "@docusaurus/utils-common" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" boxen "^6.2.1" chalk "^4.1.2" chokidar "^3.5.3" @@ -1511,11 +1596,11 @@ combine-promises "^1.1.0" commander "^5.1.0" core-js "^3.31.1" - detect-port "^1.5.1" + detect-port "^2.1.0" escape-html "^1.0.3" eta "^2.2.0" eval "^0.1.8" - execa "5.1.1" + execa "^5.1.1" fs-extra "^11.1.1" html-tags "^3.3.1" html-webpack-plugin "^5.6.0" @@ -1526,46 +1611,73 @@ prompts "^2.4.2" react-helmet-async "npm:@slorber/react-helmet-async@1.3.0" react-loadable "npm:@docusaurus/react-loadable@6.0.0" - react-loadable-ssr-addon-v5-slorber "^1.0.1" + react-loadable-ssr-addon-v5-slorber "^1.0.3" react-router "^5.3.4" react-router-config "^5.1.1" react-router-dom "^5.3.4" semver "^7.5.4" - serve-handler "^6.1.6" + serve-handler "^6.1.7" tinypool "^1.0.2" tslib "^2.6.0" update-notifier "^6.0.2" webpack "^5.95.0" webpack-bundle-analyzer "^4.10.2" - webpack-dev-server "^4.15.2" + webpack-dev-server "^5.2.2" webpack-merge "^6.0.1" -"@docusaurus/cssnano-preset@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/cssnano-preset/-/cssnano-preset-3.8.1.tgz#bd55026251a6ab8e2194839a2042458ef9880c44" - integrity sha512-G7WyR2N6SpyUotqhGznERBK+x84uyhfMQM2MmDLs88bw4Flom6TY46HzkRkSEzaP9j80MbTN8naiL1fR17WQug== +"@docusaurus/cssnano-preset@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/cssnano-preset/-/cssnano-preset-3.10.2.tgz#e3ac7e85585f77e8fdef95176ab7c211d1296630" + integrity sha512-4gCnHRbJLTloiwfvFAa92tgb2gI4KYhvjfQVYnEaiMO/EgvWfCo1LwytHXen+1oZAN0VAlS0JAPxp3MsvKDa3A== dependencies: cssnano-preset-advanced "^6.1.2" postcss "^8.5.4" postcss-sort-media-queries "^5.2.0" tslib "^2.6.0" -"@docusaurus/logger@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/logger/-/logger-3.8.1.tgz#45321b2e2e14695d0dbd8b4104ea7b0fbaa98700" - integrity sha512-2wjeGDhKcExEmjX8k1N/MRDiPKXGF2Pg+df/bDDPnnJWHXnVEZxXj80d6jcxp1Gpnksl0hF8t/ZQw9elqj2+ww== +"@docusaurus/faster@^3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/faster/-/faster-3.10.2.tgz#6cacd14085445d5826990f7525c5df1cf371e04a" + integrity sha512-p/5E5/RyHv+QWusJMPN5i3OMJTqTgkhuwzVbB1AReDWTUHXQCmf5mlTFzGiDrWeQWIDOKsuOPn1jJh0s9LUOHA== + dependencies: + "@docusaurus/types" "3.10.2" + "@rspack/core" "^1.7.10" + "@swc/core" "^1.15.40" + "@swc/html" "^1.15.40" + browserslist "^4.24.2" + lightningcss "^1.27.0" + semver "^7.5.4" + swc-loader "^0.2.6" + tslib "^2.6.0" + webpack "^5.95.0" + +"@docusaurus/logger@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/logger/-/logger-3.10.2.tgz#280bed53d0eb9cdc56e896a155036207910e89c9" + integrity sha512-gSEwqtPfCAnC3ZSJY6xL7tcIfgg0vFD39jbv93eakuweyvO2864xR0K+kmKwBhkTCtWRNjuGGnb5rdmkD/ndqw== dependencies: chalk "^4.1.2" tslib "^2.6.0" -"@docusaurus/mdx-loader@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/mdx-loader/-/mdx-loader-3.8.1.tgz#74309b3614bbcef1d55fb13e6cc339b7fb000b5f" - integrity sha512-DZRhagSFRcEq1cUtBMo4TKxSNo/W6/s44yhr8X+eoXqCLycFQUylebOMPseHi5tc4fkGJqwqpWJLz6JStU9L4w== +"@docusaurus/lqip-loader@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/lqip-loader/-/lqip-loader-3.10.2.tgz#6cfe52091e4df3832acfec4001910d0e0889158b" + integrity sha512-U9ON9YXhfQcF7s4JUrcw02Nxez9ctI5nu/+6XGGmLJ+yx36ALT1fFCHzHfd7+TvSB1H7aoT/6T5BdfZvRp++Wg== + dependencies: + "@docusaurus/logger" "3.10.2" + file-loader "^6.2.0" + lodash "^4.17.21" + sharp "^0.32.3" + tslib "^2.6.0" + +"@docusaurus/mdx-loader@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/mdx-loader/-/mdx-loader-3.10.2.tgz#3b4e7ffacff4ed856db2ec4e94c13b0a652d62eb" + integrity sha512-9Fd4V/SFjfrVQ0JH5EN0+iPWyFunvTeQE3gfyFeetqPaXMP0OylIjOw16dCuXG4NZJrYdBqwzjh18/h3gRi47w== dependencies: - "@docusaurus/logger" "3.8.1" - "@docusaurus/utils" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" + "@docusaurus/logger" "3.10.2" + "@docusaurus/utils" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" "@mdx-js/mdx" "^3.0.0" "@slorber/remark-comment" "^1.0.0" escape-html "^1.0.3" @@ -1588,12 +1700,12 @@ vfile "^6.0.1" webpack "^5.88.1" -"@docusaurus/module-type-aliases@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/module-type-aliases/-/module-type-aliases-3.8.1.tgz#454de577bd7f50b5eae16db0f76b49ca5e4e281a" - integrity sha512-6xhvAJiXzsaq3JdosS7wbRt/PwEPWHr9eM4YNYqVlbgG1hSK3uQDXTVvQktasp3VO6BmfYWPozueLWuj4gB+vg== +"@docusaurus/module-type-aliases@3.10.2", "@docusaurus/module-type-aliases@^3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/module-type-aliases/-/module-type-aliases-3.10.2.tgz#7c3b940c77d72e71d33a1e76f0e003b418e6163a" + integrity sha512-h/I5e4jaAhDHW4vaLENi1i2hnOEnXY1t9R+nnRTbgUl7ymVRzN/HF7dDfj8rKYGj8gfIge+Ef+iYRAMtbGvsrQ== dependencies: - "@docusaurus/types" "3.8.1" + "@docusaurus/types" "3.10.2" "@types/history" "^4.7.11" "@types/react" "*" "@types/react-router-config" "*" @@ -1601,20 +1713,21 @@ react-helmet-async "npm:@slorber/react-helmet-async@1.3.0" react-loadable "npm:@docusaurus/react-loadable@6.0.0" -"@docusaurus/plugin-content-blog@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-3.8.1.tgz#88d842b562b04cf59df900d9f6984b086f821525" - integrity sha512-vNTpMmlvNP9n3hGEcgPaXyvTljanAKIUkuG9URQ1DeuDup0OR7Ltvoc8yrmH+iMZJbcQGhUJF+WjHLwuk8HSdw== - dependencies: - "@docusaurus/core" "3.8.1" - "@docusaurus/logger" "3.8.1" - "@docusaurus/mdx-loader" "3.8.1" - "@docusaurus/theme-common" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils" "3.8.1" - "@docusaurus/utils-common" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" +"@docusaurus/plugin-content-blog@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-3.10.2.tgz#2374886ec3d76e8f014e85db8c3c010de6c419be" + integrity sha512-0cbEnNKf0InmLkhj/+nVRmqEnWEoOE8Mh+2x1qOXI0qYpCnphq4RXknVJ8BvybKRXqYVvbmdMfiJSup+k4tm5w== + dependencies: + "@docusaurus/core" "3.10.2" + "@docusaurus/logger" "3.10.2" + "@docusaurus/mdx-loader" "3.10.2" + "@docusaurus/theme-common" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils" "3.10.2" + "@docusaurus/utils-common" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" cheerio "1.0.0-rc.12" + combine-promises "^1.1.0" feed "^4.2.2" fs-extra "^11.1.1" lodash "^4.17.21" @@ -1625,20 +1738,20 @@ utility-types "^3.10.0" webpack "^5.88.1" -"@docusaurus/plugin-content-docs@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-docs/-/plugin-content-docs-3.8.1.tgz#40686a206abb6373bee5638de100a2c312f112a4" - integrity sha512-oByRkSZzeGNQByCMaX+kif5Nl2vmtj2IHQI2fWjCfCootsdKZDPFLonhIp5s3IGJO7PLUfe0POyw0Xh/RrGXJA== - dependencies: - "@docusaurus/core" "3.8.1" - "@docusaurus/logger" "3.8.1" - "@docusaurus/mdx-loader" "3.8.1" - "@docusaurus/module-type-aliases" "3.8.1" - "@docusaurus/theme-common" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils" "3.8.1" - "@docusaurus/utils-common" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" +"@docusaurus/plugin-content-docs@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-docs/-/plugin-content-docs-3.10.2.tgz#249bbc806437f227b06410ecc771eb67d8910a9a" + integrity sha512-Sqwl4FPoZBDrlY8I2VU2H8O0M91CHp9T8ToMSkTZmjvHCif+1laqfXi6sTk8IfyVS/trN5yNjcWd1bFsGB6W5Q== + dependencies: + "@docusaurus/core" "3.10.2" + "@docusaurus/logger" "3.10.2" + "@docusaurus/mdx-loader" "3.10.2" + "@docusaurus/module-type-aliases" "3.10.2" + "@docusaurus/theme-common" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils" "3.10.2" + "@docusaurus/utils-common" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" "@types/react-router-config" "^5.0.7" combine-promises "^1.1.0" fs-extra "^11.1.1" @@ -1649,142 +1762,163 @@ utility-types "^3.10.0" webpack "^5.88.1" -"@docusaurus/plugin-content-pages@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-pages/-/plugin-content-pages-3.8.1.tgz#41b684dbd15390b7bb6a627f78bf81b6324511ac" - integrity sha512-a+V6MS2cIu37E/m7nDJn3dcxpvXb6TvgdNI22vJX8iUTp8eoMoPa0VArEbWvCxMY/xdC26WzNv4wZ6y0iIni/w== +"@docusaurus/plugin-content-pages@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-pages/-/plugin-content-pages-3.10.2.tgz#377c11b36a6a5e0c0c14dd9dea799f986d662ed7" + integrity sha512-h5R12sZ/vV9EPiVjvIl9YFCOwkpwXes7dQMYt3EvP6Pphu4amHxxTqWxf08Fl5DR8h+oZMbWpFTNw5vKEYfvzQ== dependencies: - "@docusaurus/core" "3.8.1" - "@docusaurus/mdx-loader" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" + "@docusaurus/core" "3.10.2" + "@docusaurus/mdx-loader" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" fs-extra "^11.1.1" tslib "^2.6.0" webpack "^5.88.1" -"@docusaurus/plugin-css-cascade-layers@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-css-cascade-layers/-/plugin-css-cascade-layers-3.8.1.tgz#cb414b4a82aa60fc64ef2a435ad0105e142a6c71" - integrity sha512-VQ47xRxfNKjHS5ItzaVXpxeTm7/wJLFMOPo1BkmoMG4Cuz4nuI+Hs62+RMk1OqVog68Swz66xVPK8g9XTrBKRw== +"@docusaurus/plugin-css-cascade-layers@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-css-cascade-layers/-/plugin-css-cascade-layers-3.10.2.tgz#54edc6450b0bb95be5990ea416b4c4dc5e6bdde0" + integrity sha512-UkdvQby5OQUKWrw3lLnSTJXQ6VETaUVTuPQX9AABtmFm5h+ifEBx1OQ+LN726Q4byuwBf2ElHkf4qU4hTxdvRg== dependencies: - "@docusaurus/core" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" + "@docusaurus/core" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" tslib "^2.6.0" -"@docusaurus/plugin-debug@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-debug/-/plugin-debug-3.8.1.tgz#45b107e46b627caaae66995f53197ace78af3491" - integrity sha512-nT3lN7TV5bi5hKMB7FK8gCffFTBSsBsAfV84/v293qAmnHOyg1nr9okEw8AiwcO3bl9vije5nsUvP0aRl2lpaw== +"@docusaurus/plugin-debug@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-debug/-/plugin-debug-3.10.2.tgz#2452f258668bb2514085d2d5fff700457c531aad" + integrity sha512-8vbZNOSCpnsT57EY6CgN7sgRVmx3KTYwO8Uvo2pbxOyb8tbqAwtT9SslqaQ41HbA1v1hpn5RP7u5s2KvRwAFpQ== dependencies: - "@docusaurus/core" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils" "3.8.1" + "@docusaurus/core" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils" "3.10.2" fs-extra "^11.1.1" react-json-view-lite "^2.3.0" tslib "^2.6.0" -"@docusaurus/plugin-google-analytics@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-analytics/-/plugin-google-analytics-3.8.1.tgz#64a302e62fe5cb6e007367c964feeef7b056764a" - integrity sha512-Hrb/PurOJsmwHAsfMDH6oVpahkEGsx7F8CWMjyP/dw1qjqmdS9rcV1nYCGlM8nOtD3Wk/eaThzUB5TSZsGz+7Q== +"@docusaurus/plugin-google-analytics@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-analytics/-/plugin-google-analytics-3.10.2.tgz#7a0375c5a238cd9220166d9be8afc00ba508c55d" + integrity sha512-kMHMBK9j4VAtgd5owwrRLRIi0EjkrpXlX7ePj1+y68XfVZV9I1T4S+koPDm+Hfw2TtnyHvh0uNrDvjz+DjQGVA== dependencies: - "@docusaurus/core" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" + "@docusaurus/core" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" tslib "^2.6.0" -"@docusaurus/plugin-google-gtag@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-gtag/-/plugin-google-gtag-3.8.1.tgz#8c76f8a1d96448f2f0f7b10e6bde451c40672b95" - integrity sha512-tKE8j1cEZCh8KZa4aa80zpSTxsC2/ZYqjx6AAfd8uA8VHZVw79+7OTEP2PoWi0uL5/1Is0LF5Vwxd+1fz5HlKg== +"@docusaurus/plugin-google-gtag@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-gtag/-/plugin-google-gtag-3.10.2.tgz#65df25eb5fb3f2a3f2d0fba8ddd423060e09e1ca" + integrity sha512-Vt90nNFhtAChRe9+it1hcHFgFvETdSnOkL5Bma+p6E/yU2tAYrvvyk+gv+LJGM2ZUkyKuKXLRsZ2Lb0bO7+Vog== dependencies: - "@docusaurus/core" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" - "@types/gtag.js" "^0.0.12" + "@docusaurus/core" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" tslib "^2.6.0" -"@docusaurus/plugin-google-tag-manager@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-tag-manager/-/plugin-google-tag-manager-3.8.1.tgz#88241ffd06369f4a4d5fb982ff3ac2777561ae37" - integrity sha512-iqe3XKITBquZq+6UAXdb1vI0fPY5iIOitVjPQ581R1ZKpHr0qe+V6gVOrrcOHixPDD/BUKdYwkxFjpNiEN+vBw== +"@docusaurus/plugin-google-tag-manager@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-tag-manager/-/plugin-google-tag-manager-3.10.2.tgz#882a24e51dc42487d2c1d4f2cde3f59c99a276cb" + integrity sha512-MLCffCldysi/R0nzJQP7ZWd0xAoGNnSTiVOo6TTR6mKVGFhE+/XArGe67ZcaZv1uytgQXoXs92VJrgVDrz80rQ== dependencies: - "@docusaurus/core" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" + "@docusaurus/core" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" + tslib "^2.6.0" + +"@docusaurus/plugin-ideal-image@^3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-ideal-image/-/plugin-ideal-image-3.10.2.tgz#51fa3048328ce403b2f153aee1fa676827d49106" + integrity sha512-M1uRffUaE5hqbo7368jSclYSU6oOOFdJ3/fq644kwaoComeG+jjBJ9piFrHkExtiU2Q7zcm1dWaqtfJVrR9wSQ== + dependencies: + "@docusaurus/core" "3.10.2" + "@docusaurus/lqip-loader" "3.10.2" + "@docusaurus/responsive-loader" "^1.7.0" + "@docusaurus/theme-translations" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" + sharp "^0.32.3" tslib "^2.6.0" + webpack "^5.88.1" -"@docusaurus/plugin-sitemap@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-sitemap/-/plugin-sitemap-3.8.1.tgz#3aebd39186dc30e53023f1aab44625bc0bdac892" - integrity sha512-+9YV/7VLbGTq8qNkjiugIelmfUEVkTyLe6X8bWq7K5qPvGXAjno27QAfFq63mYfFFbJc7z+pudL63acprbqGzw== - dependencies: - "@docusaurus/core" "3.8.1" - "@docusaurus/logger" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils" "3.8.1" - "@docusaurus/utils-common" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" +"@docusaurus/plugin-sitemap@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-sitemap/-/plugin-sitemap-3.10.2.tgz#6c662c7df3bb7d36887f8b73f54d85dc4d36371d" + integrity sha512-PODkwg5XetLML3hU/3xpCKJUZ9cqExLaBnD/Fzzwj2VHogLeqnDisLIujae87zuze7T4mCm2A6KEqZkyiz07EQ== + dependencies: + "@docusaurus/core" "3.10.2" + "@docusaurus/logger" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils" "3.10.2" + "@docusaurus/utils-common" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" fs-extra "^11.1.1" sitemap "^7.1.1" tslib "^2.6.0" -"@docusaurus/plugin-svgr@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-svgr/-/plugin-svgr-3.8.1.tgz#6f340be8eae418a2cce540d8ece096ffd9c9b6ab" - integrity sha512-rW0LWMDsdlsgowVwqiMb/7tANDodpy1wWPwCcamvhY7OECReN3feoFwLjd/U4tKjNY3encj0AJSTxJA+Fpe+Gw== +"@docusaurus/plugin-svgr@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-svgr/-/plugin-svgr-3.10.2.tgz#916fd0a5d39bf73cb621de9789cce243a7ef1754" + integrity sha512-JgfT3jWM0TJ8Uw0cEcqxHpybngQY1vlBYpuuNO+gEh5iPh5Ar+vxq/u9CFrYsWeXy48BN7Db76Pzp2edNXUQ8A== dependencies: - "@docusaurus/core" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" + "@docusaurus/core" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" "@svgr/core" "8.1.0" "@svgr/webpack" "^8.1.0" tslib "^2.6.0" webpack "^5.88.1" -"@docusaurus/preset-classic@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/preset-classic/-/preset-classic-3.8.1.tgz#bb79fd12f3211363720c569a526c7e24d3aa966b" - integrity sha512-yJSjYNHXD8POMGc2mKQuj3ApPrN+eG0rO1UPgSx7jySpYU+n4WjBikbrA2ue5ad9A7aouEtMWUoiSRXTH/g7KQ== - dependencies: - "@docusaurus/core" "3.8.1" - "@docusaurus/plugin-content-blog" "3.8.1" - "@docusaurus/plugin-content-docs" "3.8.1" - "@docusaurus/plugin-content-pages" "3.8.1" - "@docusaurus/plugin-css-cascade-layers" "3.8.1" - "@docusaurus/plugin-debug" "3.8.1" - "@docusaurus/plugin-google-analytics" "3.8.1" - "@docusaurus/plugin-google-gtag" "3.8.1" - "@docusaurus/plugin-google-tag-manager" "3.8.1" - "@docusaurus/plugin-sitemap" "3.8.1" - "@docusaurus/plugin-svgr" "3.8.1" - "@docusaurus/theme-classic" "3.8.1" - "@docusaurus/theme-common" "3.8.1" - "@docusaurus/theme-search-algolia" "3.8.1" - "@docusaurus/types" "3.8.1" - -"@docusaurus/theme-classic@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-classic/-/theme-classic-3.8.1.tgz#1e45c66d89ded359225fcd29bf3258d9205765c1" - integrity sha512-bqDUCNqXeYypMCsE1VcTXSI1QuO4KXfx8Cvl6rYfY0bhhqN6d2WZlRkyLg/p6pm+DzvanqHOyYlqdPyP0iz+iw== - dependencies: - "@docusaurus/core" "3.8.1" - "@docusaurus/logger" "3.8.1" - "@docusaurus/mdx-loader" "3.8.1" - "@docusaurus/module-type-aliases" "3.8.1" - "@docusaurus/plugin-content-blog" "3.8.1" - "@docusaurus/plugin-content-docs" "3.8.1" - "@docusaurus/plugin-content-pages" "3.8.1" - "@docusaurus/theme-common" "3.8.1" - "@docusaurus/theme-translations" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils" "3.8.1" - "@docusaurus/utils-common" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" +"@docusaurus/preset-classic@^3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/preset-classic/-/preset-classic-3.10.2.tgz#e4419c811723ab913a946c63efcc15e7f5f60a0a" + integrity sha512-a4B3VczmDl99zK0EufDQYomdJ186WDingjmDXxhN2PNPS9Ty/Y2M5CLFX1KQMRKqRTLiRDKfutzG5IY1FC/ceg== + dependencies: + "@docusaurus/core" "3.10.2" + "@docusaurus/plugin-content-blog" "3.10.2" + "@docusaurus/plugin-content-docs" "3.10.2" + "@docusaurus/plugin-content-pages" "3.10.2" + "@docusaurus/plugin-css-cascade-layers" "3.10.2" + "@docusaurus/plugin-debug" "3.10.2" + "@docusaurus/plugin-google-analytics" "3.10.2" + "@docusaurus/plugin-google-gtag" "3.10.2" + "@docusaurus/plugin-google-tag-manager" "3.10.2" + "@docusaurus/plugin-sitemap" "3.10.2" + "@docusaurus/plugin-svgr" "3.10.2" + "@docusaurus/theme-classic" "3.10.2" + "@docusaurus/theme-common" "3.10.2" + "@docusaurus/theme-search-algolia" "3.10.2" + "@docusaurus/types" "3.10.2" + +"@docusaurus/responsive-loader@^1.7.0": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@docusaurus/responsive-loader/-/responsive-loader-1.7.1.tgz#fe22a657263350cbc777e296e8d8403c53d2f247" + integrity sha512-jAebZ43f8GVpZSrijLGHVVp7Y0OMIPRaL+HhiIWQ+f/b72lTsKLkSkOVHEzvd2psNJ9lsoiM3gt6akpak6508w== + dependencies: + loader-utils "^2.0.0" + +"@docusaurus/theme-classic@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-classic/-/theme-classic-3.10.2.tgz#a64bd600c789b33c67c30c256b07e2ca0f57e2ae" + integrity sha512-JqTSLQmqmA9uKWZsD5iwBGJ4JyKB4/yTw6PsSXVPRJG/6GAm/u+add9Iip+hvwP12/AnPNztrdxsI14NJW4KeA== + dependencies: + "@docusaurus/core" "3.10.2" + "@docusaurus/logger" "3.10.2" + "@docusaurus/mdx-loader" "3.10.2" + "@docusaurus/module-type-aliases" "3.10.2" + "@docusaurus/plugin-content-blog" "3.10.2" + "@docusaurus/plugin-content-docs" "3.10.2" + "@docusaurus/plugin-content-pages" "3.10.2" + "@docusaurus/theme-common" "3.10.2" + "@docusaurus/theme-translations" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils" "3.10.2" + "@docusaurus/utils-common" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" "@mdx-js/react" "^3.0.0" clsx "^2.0.0" copy-text-to-clipboard "^3.2.0" @@ -1799,15 +1933,15 @@ tslib "^2.6.0" utility-types "^3.10.0" -"@docusaurus/theme-common@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-common/-/theme-common-3.8.1.tgz#17c23316fbe3ee3f7e707c7298cb59a0fff38b4b" - integrity sha512-UswMOyTnPEVRvN5Qzbo+l8k4xrd5fTFu2VPPfD6FcW/6qUtVLmJTQCktbAL3KJ0BVXGm5aJXz/ZrzqFuZERGPw== +"@docusaurus/theme-common@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-common/-/theme-common-3.10.2.tgz#5cf2a8b76554b8b38c6afe8448470c411f683e5b" + integrity sha512-R9b/vMpK1yye6hNZTA6x/ivRv+at6GhxnXcxkpzCGzO1R1RwiquqiFg2wMFh6aqlJTpWRFKpFD2TzCDQcyOU0A== dependencies: - "@docusaurus/mdx-loader" "3.8.1" - "@docusaurus/module-type-aliases" "3.8.1" - "@docusaurus/utils" "3.8.1" - "@docusaurus/utils-common" "3.8.1" + "@docusaurus/mdx-loader" "3.10.2" + "@docusaurus/module-type-aliases" "3.10.2" + "@docusaurus/utils" "3.10.2" + "@docusaurus/utils-common" "3.10.2" "@types/history" "^4.7.11" "@types/react" "*" "@types/react-router-config" "*" @@ -1817,21 +1951,35 @@ tslib "^2.6.0" utility-types "^3.10.0" -"@docusaurus/theme-search-algolia@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-search-algolia/-/theme-search-algolia-3.8.1.tgz#3aa3d99c35cc2d4b709fcddd4df875a9b536e29b" - integrity sha512-NBFH5rZVQRAQM087aYSRKQ9yGEK9eHd+xOxQjqNpxMiV85OhJDD4ZGz6YJIod26Fbooy54UWVdzNU0TFeUUUzQ== - dependencies: - "@docsearch/react" "^3.9.0" - "@docusaurus/core" "3.8.1" - "@docusaurus/logger" "3.8.1" - "@docusaurus/plugin-content-docs" "3.8.1" - "@docusaurus/theme-common" "3.8.1" - "@docusaurus/theme-translations" "3.8.1" - "@docusaurus/utils" "3.8.1" - "@docusaurus/utils-validation" "3.8.1" - algoliasearch "^5.17.1" - algoliasearch-helper "^3.22.6" +"@docusaurus/theme-mermaid@^3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-mermaid/-/theme-mermaid-3.10.2.tgz#826e47a01fefbe49fdbb0f4f575c9399d3ccd92c" + integrity sha512-Stssh5MYQJ+EdYugUXf+ZcpeJFQPKXf0KCd/SWp10o3CmXNaOoh5IEgVjVqY1e1XhQf3on4+Y4BnrMiD95E2SQ== + dependencies: + "@docusaurus/core" "3.10.2" + "@docusaurus/module-type-aliases" "3.10.2" + "@docusaurus/theme-common" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" + mermaid ">=11.6.0" + tslib "^2.6.0" + +"@docusaurus/theme-search-algolia@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-search-algolia/-/theme-search-algolia-3.10.2.tgz#e7756d4088a7df4d11fd734bfe0e8fa28ceac1dd" + integrity sha512-1msxllyhi/5m77JukXtp5UFnUAriwZIC1oJ7MTnpQpCwLTbclJi5BK5n28CTZuSXpQN2ewbbnqRgAhMM6c6ihg== + dependencies: + "@algolia/autocomplete-core" "^1.19.2" + "@docsearch/react" "^3.9.0 || ^4.3.2" + "@docusaurus/core" "3.10.2" + "@docusaurus/logger" "3.10.2" + "@docusaurus/plugin-content-docs" "3.10.2" + "@docusaurus/theme-common" "3.10.2" + "@docusaurus/theme-translations" "3.10.2" + "@docusaurus/utils" "3.10.2" + "@docusaurus/utils-validation" "3.10.2" + algoliasearch "^5.37.0" + algoliasearch-helper "^3.26.0" clsx "^2.0.0" eta "^2.2.0" fs-extra "^11.1.1" @@ -1839,21 +1987,22 @@ tslib "^2.6.0" utility-types "^3.10.0" -"@docusaurus/theme-translations@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-translations/-/theme-translations-3.8.1.tgz#4b1d76973eb53861e167c7723485e059ba4ffd0a" - integrity sha512-OTp6eebuMcf2rJt4bqnvuwmm3NVXfzfYejL+u/Y1qwKhZPrjPoKWfk1CbOP5xH5ZOPkiAsx4dHdQBRJszK3z2g== +"@docusaurus/theme-translations@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-translations/-/theme-translations-3.10.2.tgz#cd649083babd12df324e7129008aaccacd4cfb13" + integrity sha512-iv20wrxnyXkY89LM3TzRlzGlt5fIGO5UnaR6UL1ZVfB9RRFjxQFQ6awDrwAc6Km8Y5gD8pInuwYPF+6/TiCxXA== dependencies: fs-extra "^11.1.1" tslib "^2.6.0" -"@docusaurus/types@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/types/-/types-3.8.1.tgz#83ab66c345464e003b576a49f78897482061fc26" - integrity sha512-ZPdW5AB+pBjiVrcLuw3dOS6BFlrG0XkS2lDGsj8TizcnREQg3J8cjsgfDviszOk4CweNfwo1AEELJkYaMUuOPg== +"@docusaurus/types@3.10.2", "@docusaurus/types@^3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/types/-/types-3.10.2.tgz#9ffe35adfb4587e49158ee9e10d94b86419a5932" + integrity sha512-B6rvfwIFSapUqUJjMriZswX13K8l5Z7AcmVE6uTEJpYddQieSTR12DsGaFtcZAIDsQd4p+0WTl0Vc6jmZK0Trw== dependencies: "@mdx-js/mdx" "^3.0.0" "@types/history" "^4.7.11" + "@types/mdast" "^4.0.2" "@types/react" "*" commander "^5.1.0" joi "^17.9.2" @@ -1862,43 +2011,43 @@ webpack "^5.95.0" webpack-merge "^5.9.0" -"@docusaurus/utils-common@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/utils-common/-/utils-common-3.8.1.tgz#c369b8c3041afb7dcd595d4172beb1cc1015c85f" - integrity sha512-zTZiDlvpvoJIrQEEd71c154DkcriBecm4z94OzEE9kz7ikS3J+iSlABhFXM45mZ0eN5pVqqr7cs60+ZlYLewtg== +"@docusaurus/utils-common@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/utils-common/-/utils-common-3.10.2.tgz#a65fcfffafa4e15a59fe61d7ba315ee5d4c49269" + integrity sha512-x3Dz6jv6iQKBNjBmVTu8p57abMp/VNTUgKBMgRVXJc5444orBTsArv0+cdfrXTiz/VMmHfDRVkPbL7GH2B7T7w== dependencies: - "@docusaurus/types" "3.8.1" + "@docusaurus/types" "3.10.2" tslib "^2.6.0" -"@docusaurus/utils-validation@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/utils-validation/-/utils-validation-3.8.1.tgz#0499c0d151a4098a0963237057993282cfbd538e" - integrity sha512-gs5bXIccxzEbyVecvxg6upTwaUbfa0KMmTj7HhHzc016AGyxH2o73k1/aOD0IFrdCsfJNt37MqNI47s2MgRZMA== +"@docusaurus/utils-validation@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/utils-validation/-/utils-validation-3.10.2.tgz#2624b0ca6675675da2f063828115b43c9a22de47" + integrity sha512-sn8unbDfUL585NtR3cwHefPicOyaHvPaX7VD0aOg/siIxUBoKyKKaGEqzJZDS64mM43TnxurkYDtmB1wsJlZsw== dependencies: - "@docusaurus/logger" "3.8.1" - "@docusaurus/utils" "3.8.1" - "@docusaurus/utils-common" "3.8.1" + "@docusaurus/logger" "3.10.2" + "@docusaurus/utils" "3.10.2" + "@docusaurus/utils-common" "3.10.2" fs-extra "^11.2.0" joi "^17.9.2" js-yaml "^4.1.0" lodash "^4.17.21" tslib "^2.6.0" -"@docusaurus/utils@3.8.1": - version "3.8.1" - resolved "https://registry.yarnpkg.com/@docusaurus/utils/-/utils-3.8.1.tgz#2ac1e734106e2f73dbd0f6a8824d525f9064e9f0" - integrity sha512-P1ml0nvOmEFdmu0smSXOqTS1sxU5tqvnc0dA4MTKV39kye+bhQnjkIKEE18fNOvxjyB86k8esoCIFM3x4RykOQ== +"@docusaurus/utils@3.10.2": + version "3.10.2" + resolved "https://registry.yarnpkg.com/@docusaurus/utils/-/utils-3.10.2.tgz#d99c1ffc5c7961e912344269a8728ce2aad8b3dc" + integrity sha512-xx0W3eav2uW1NRIpuHJWNwLTC15xPNjU4Uxi9NSnd3swYC96BE3vFiT93SD8s24kmAAWNwgZwfZ2fghGZ01Lcw== dependencies: - "@docusaurus/logger" "3.8.1" - "@docusaurus/types" "3.8.1" - "@docusaurus/utils-common" "3.8.1" + "@11ty/gray-matter" "^1.0.0" + "@docusaurus/logger" "3.10.2" + "@docusaurus/types" "3.10.2" + "@docusaurus/utils-common" "3.10.2" escape-string-regexp "^4.0.0" - execa "5.1.1" + execa "^5.1.1" file-loader "^6.2.0" fs-extra "^11.1.1" github-slugger "^1.5.0" globby "^11.1.0" - gray-matter "^4.0.3" jiti "^1.20.0" js-yaml "^4.1.0" lodash "^4.17.21" @@ -1911,6 +2060,28 @@ utility-types "^3.10.0" webpack "^5.88.1" +"@emnapi/core@^1.5.0": + version "1.11.2" + resolved "https://registry.yarnpkg.com/@emnapi/core/-/core-1.11.2.tgz#fab0a0f3c492d11f5a9ac9065d0d73955ee1c1c9" + integrity sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA== + dependencies: + "@emnapi/wasi-threads" "1.2.2" + tslib "^2.4.0" + +"@emnapi/runtime@^1.2.0", "@emnapi/runtime@^1.5.0": + version "1.11.2" + resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.11.2.tgz#eb22f04d76febfdf4f87fdaff54c8a53f6bf0dbd" + integrity sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA== + dependencies: + tslib "^2.4.0" + +"@emnapi/wasi-threads@1.2.2": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz#4c93becf5bfa3b13d1bbdcc06aee38321ad8139a" + integrity sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA== + dependencies: + tslib "^2.4.0" + "@emotion/babel-plugin@^11.13.5": version "11.13.5" resolved "https://registry.yarnpkg.com/@emotion/babel-plugin/-/babel-plugin-11.13.5.tgz#eab8d65dbded74e0ecfd28dc218e75607c4e7bc0" @@ -2042,6 +2213,128 @@ resolved "https://registry.yarnpkg.com/@iconify/types/-/types-2.0.0.tgz#ab0e9ea681d6c8a1214f30cd741fe3a20cc57f57" integrity sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg== +"@iconify/utils@^3.0.2": + version "3.1.4" + resolved "https://registry.yarnpkg.com/@iconify/utils/-/utils-3.1.4.tgz#04dad014e8ed80b1bbe341f5d090059ea0c60578" + integrity sha512-b1S7B1k9ohZ+iNTi2ATxbRYG9fTrJmUT0rc46bvVnNxqNRGW7dyo/vRREwyniI5IRN2RSJHDcm+s3BjWrSAjHw== + dependencies: + "@antfu/install-pkg" "^1.1.0" + "@iconify/types" "^2.0.0" + import-meta-resolve "^4.2.0" + +"@img/sharp-darwin-arm64@0.33.5": + version "0.33.5" + resolved "https://registry.yarnpkg.com/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz#ef5b5a07862805f1e8145a377c8ba6e98813ca08" + integrity sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ== + optionalDependencies: + "@img/sharp-libvips-darwin-arm64" "1.0.4" + +"@img/sharp-darwin-x64@0.33.5": + version "0.33.5" + resolved "https://registry.yarnpkg.com/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz#e03d3451cd9e664faa72948cc70a403ea4063d61" + integrity sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q== + optionalDependencies: + "@img/sharp-libvips-darwin-x64" "1.0.4" + +"@img/sharp-libvips-darwin-arm64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz#447c5026700c01a993c7804eb8af5f6e9868c07f" + integrity sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg== + +"@img/sharp-libvips-darwin-x64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz#e0456f8f7c623f9dbfbdc77383caa72281d86062" + integrity sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ== + +"@img/sharp-libvips-linux-arm64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz#979b1c66c9a91f7ff2893556ef267f90ebe51704" + integrity sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA== + +"@img/sharp-libvips-linux-arm@1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz#99f922d4e15216ec205dcb6891b721bfd2884197" + integrity sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g== + +"@img/sharp-libvips-linux-s390x@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz#f8a5eb1f374a082f72b3f45e2fb25b8118a8a5ce" + integrity sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA== + +"@img/sharp-libvips-linux-x64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz#d4c4619cdd157774906e15770ee119931c7ef5e0" + integrity sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw== + +"@img/sharp-libvips-linuxmusl-arm64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz#166778da0f48dd2bded1fa3033cee6b588f0d5d5" + integrity sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA== + +"@img/sharp-libvips-linuxmusl-x64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz#93794e4d7720b077fcad3e02982f2f1c246751ff" + integrity sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw== + +"@img/sharp-linux-arm64@0.33.5": + version "0.33.5" + resolved "https://registry.yarnpkg.com/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz#edb0697e7a8279c9fc829a60fc35644c4839bb22" + integrity sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA== + optionalDependencies: + "@img/sharp-libvips-linux-arm64" "1.0.4" + +"@img/sharp-linux-arm@0.33.5": + version "0.33.5" + resolved "https://registry.yarnpkg.com/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz#422c1a352e7b5832842577dc51602bcd5b6f5eff" + integrity sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ== + optionalDependencies: + "@img/sharp-libvips-linux-arm" "1.0.5" + +"@img/sharp-linux-s390x@0.33.5": + version "0.33.5" + resolved "https://registry.yarnpkg.com/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz#f5c077926b48e97e4a04d004dfaf175972059667" + integrity sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q== + optionalDependencies: + "@img/sharp-libvips-linux-s390x" "1.0.4" + +"@img/sharp-linux-x64@0.33.5": + version "0.33.5" + resolved "https://registry.yarnpkg.com/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz#d806e0afd71ae6775cc87f0da8f2d03a7c2209cb" + integrity sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA== + optionalDependencies: + "@img/sharp-libvips-linux-x64" "1.0.4" + +"@img/sharp-linuxmusl-arm64@0.33.5": + version "0.33.5" + resolved "https://registry.yarnpkg.com/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz#252975b915894fb315af5deea174651e208d3d6b" + integrity sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g== + optionalDependencies: + "@img/sharp-libvips-linuxmusl-arm64" "1.0.4" + +"@img/sharp-linuxmusl-x64@0.33.5": + version "0.33.5" + resolved "https://registry.yarnpkg.com/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz#3f4609ac5d8ef8ec7dadee80b560961a60fd4f48" + integrity sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw== + optionalDependencies: + "@img/sharp-libvips-linuxmusl-x64" "1.0.4" + +"@img/sharp-wasm32@0.33.5": + version "0.33.5" + resolved "https://registry.yarnpkg.com/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz#6f44f3283069d935bb5ca5813153572f3e6f61a1" + integrity sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg== + dependencies: + "@emnapi/runtime" "^1.2.0" + +"@img/sharp-win32-ia32@0.33.5": + version "0.33.5" + resolved "https://registry.yarnpkg.com/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz#1a0c839a40c5351e9885628c85f2e5dfd02b52a9" + integrity sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ== + +"@img/sharp-win32-x64@0.33.5": + version "0.33.5" + resolved "https://registry.yarnpkg.com/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz#56f00962ff0c4e0eb93d34a047d29fa995e3e342" + integrity sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg== + "@jest/schemas@^29.6.3": version "29.6.3" resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" @@ -2103,6 +2396,167 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@jsonjoy.com/base64@17.67.0": + version "17.67.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/base64/-/base64-17.67.0.tgz#7eeda3cb41138d77a90408fd2e42b2aba10576d7" + integrity sha512-5SEsJGsm15aP8TQGkDfJvz9axgPwAEm98S5DxOuYe8e1EbfajcDmgeXXzccEjh+mLnjqEKrkBdjHWS5vFNwDdw== + +"@jsonjoy.com/base64@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/base64/-/base64-1.1.2.tgz#cf8ea9dcb849b81c95f14fc0aaa151c6b54d2578" + integrity sha512-q6XAnWQDIMA3+FTiOYajoYqySkO+JSat0ytXGSuRdq9uXE7o92gzuQwQM14xaCRlBLGq3v5miDGC4vkVTn54xA== + +"@jsonjoy.com/buffers@17.67.0", "@jsonjoy.com/buffers@^17.65.0": + version "17.67.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/buffers/-/buffers-17.67.0.tgz#5c58dbcdeea8824ce296bd1cfce006c2eb167b3d" + integrity sha512-tfExRpYxBvi32vPs9ZHaTjSP4fHAfzSmcahOfNxtvGHcyJel+aibkPlGeBB+7AoC6hL7lXIE++8okecBxx7lcw== + +"@jsonjoy.com/buffers@^1.0.0", "@jsonjoy.com/buffers@^1.2.0": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/buffers/-/buffers-1.2.1.tgz#8d99c7f67eaf724d3428dfd9826c6455266a5c83" + integrity sha512-12cdlDwX4RUM3QxmUbVJWqZ/mrK6dFQH4Zxq6+r1YXKXYBNgZXndx2qbCJwh3+WWkCSn67IjnlG3XYTvmvYtgA== + +"@jsonjoy.com/codegen@17.67.0": + version "17.67.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/codegen/-/codegen-17.67.0.tgz#3635fd8769d77e19b75dc5574bc9756019b2e591" + integrity sha512-idnkUplROpdBOV0HMcwhsCUS5TRUi9poagdGs70A6S4ux9+/aPuKbh8+UYRTLYQHtXvAdNfQWXDqZEx5k4Dj2Q== + +"@jsonjoy.com/codegen@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/codegen/-/codegen-1.0.0.tgz#5c23f796c47675f166d23b948cdb889184b93207" + integrity sha512-E8Oy+08cmCf0EK/NMxpaJZmOxPqM+6iSe2S4nlSBrPZOORoDJILxtbSUEDKQyTamm/BVAhIGllOBNU79/dwf0g== + +"@jsonjoy.com/fs-core@4.64.0": + version "4.64.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/fs-core/-/fs-core-4.64.0.tgz#82378ecedc5cbd8558fcc0a8e3c6b254db070fc8" + integrity sha512-zs2TAq7Six5jgMuoMNjpspAvOP3mhtgq/k1UyQodEzCtQi/N83y2/y+zcvnZSGp/Rxq96DBN+bValOBQAyn/ew== + dependencies: + "@jsonjoy.com/fs-node-builtins" "4.64.0" + "@jsonjoy.com/fs-node-utils" "4.64.0" + thingies "^2.5.0" + +"@jsonjoy.com/fs-fsa@4.64.0": + version "4.64.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/fs-fsa/-/fs-fsa-4.64.0.tgz#3cb0af64a33f075300ef63be97af89bb7849e6bd" + integrity sha512-nMWOVbkLFyEgmXZih3wyvxA9XpgyyqyfrINMHvEFqhi7uqfRl7c9ERJt6yX7vgMPrB9Uo+OJO+Spa0cFzPD01w== + dependencies: + "@jsonjoy.com/fs-core" "4.64.0" + "@jsonjoy.com/fs-node-builtins" "4.64.0" + "@jsonjoy.com/fs-node-utils" "4.64.0" + thingies "^2.5.0" + +"@jsonjoy.com/fs-node-builtins@4.64.0": + version "4.64.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/fs-node-builtins/-/fs-node-builtins-4.64.0.tgz#84371474b2a06d209ae9f0b2b06fc570b00fb612" + integrity sha512-/o7WRFhUWaM/fOrslwLZGnzn4RmRILykn+lAL+mNObqqRNw+CQSiij6hpCeZ+C7buhdoVo7go/OYqzaSUfDYmA== + +"@jsonjoy.com/fs-node-to-fsa@4.64.0": + version "4.64.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/fs-node-to-fsa/-/fs-node-to-fsa-4.64.0.tgz#fbb3026befa07d690f1523c0c166f0d447fa555e" + integrity sha512-WDD9WVs0hb7UAEKTgZW2f66WDrbj7gIIWwpP3spbLyXa0rghtUaFTB8L4gdR3ZCWwiKIsj38/CNijpVmpnuPUw== + dependencies: + "@jsonjoy.com/fs-fsa" "4.64.0" + "@jsonjoy.com/fs-node-builtins" "4.64.0" + "@jsonjoy.com/fs-node-utils" "4.64.0" + +"@jsonjoy.com/fs-node-utils@4.64.0": + version "4.64.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/fs-node-utils/-/fs-node-utils-4.64.0.tgz#5803eee4abd6871644a35ea35ad63a6b7f159892" + integrity sha512-k5Indsx9hWW9xSF7Y6oSKKwtCUNhzZxadub3owhIlitc+iMRVlPPdX2duTKQWBL3qNWpXya8jykgaaWpheeS4w== + dependencies: + "@jsonjoy.com/fs-node-builtins" "4.64.0" + glob-to-regex.js "^1.0.1" + +"@jsonjoy.com/fs-node@4.64.0": + version "4.64.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/fs-node/-/fs-node-4.64.0.tgz#e8c9c4346b38cc116ca0e9fb34b10419bcfc1916" + integrity sha512-dO+NNkODbUli4uV42bcNrrLvq5rE7SNpdZ5TNd0dtbLsAaNK3MDiIC9lUi+brboGoIjW6vd2fB1qao60nrk5xA== + dependencies: + "@jsonjoy.com/fs-core" "4.64.0" + "@jsonjoy.com/fs-node-builtins" "4.64.0" + "@jsonjoy.com/fs-node-utils" "4.64.0" + "@jsonjoy.com/fs-print" "4.64.0" + "@jsonjoy.com/fs-snapshot" "4.64.0" + glob-to-regex.js "^1.0.0" + thingies "^2.5.0" + +"@jsonjoy.com/fs-print@4.64.0": + version "4.64.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/fs-print/-/fs-print-4.64.0.tgz#375085d90b50c85754667671f58d13a63da4330d" + integrity sha512-PHZFccchvkhWrwPWHjmVAhbC3vSHCtyZvlZfJJ3ho2bnzl450hXri6/8e6pbkWdH+SkmLXNml0sV8e5HDAfxKw== + dependencies: + "@jsonjoy.com/fs-node-utils" "4.64.0" + tree-dump "^1.1.0" + +"@jsonjoy.com/fs-snapshot@4.64.0": + version "4.64.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/fs-snapshot/-/fs-snapshot-4.64.0.tgz#99a76af8664595875def5b20ed1cf159adc5f098" + integrity sha512-oM7UDeL83q6NBzzsfKAsYKXKVXlykKFqqOLh4xZZKAzzROTlInkPbc6LTDGThEOnPiFiUzA7tYziHG9xavd76Q== + dependencies: + "@jsonjoy.com/buffers" "^17.65.0" + "@jsonjoy.com/fs-node-utils" "4.64.0" + "@jsonjoy.com/json-pack" "^17.65.0" + "@jsonjoy.com/util" "^17.65.0" + +"@jsonjoy.com/json-pack@^1.11.0": + version "1.21.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/json-pack/-/json-pack-1.21.0.tgz#93f8dd57fe3a3a92132b33d1eb182dcd9e7629fa" + integrity sha512-+AKG+R2cfZMShzrF2uQw34v3zbeDYUqnQ+jg7ORic3BGtfw9p/+N6RJbq/kkV8JmYZaINknaEQ2m0/f693ZPpg== + dependencies: + "@jsonjoy.com/base64" "^1.1.2" + "@jsonjoy.com/buffers" "^1.2.0" + "@jsonjoy.com/codegen" "^1.0.0" + "@jsonjoy.com/json-pointer" "^1.0.2" + "@jsonjoy.com/util" "^1.9.0" + hyperdyperid "^1.2.0" + thingies "^2.5.0" + tree-dump "^1.1.0" + +"@jsonjoy.com/json-pack@^17.65.0": + version "17.67.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/json-pack/-/json-pack-17.67.0.tgz#8dd8ff65dd999c5d4d26df46c63915c7bdec093a" + integrity sha512-t0ejURcGaZsn1ClbJ/3kFqSOjlryd92eQY465IYrezsXmPcfHPE/av4twRSxf6WE+TkZgLY+71vCZbiIiFKA/w== + dependencies: + "@jsonjoy.com/base64" "17.67.0" + "@jsonjoy.com/buffers" "17.67.0" + "@jsonjoy.com/codegen" "17.67.0" + "@jsonjoy.com/json-pointer" "17.67.0" + "@jsonjoy.com/util" "17.67.0" + hyperdyperid "^1.2.0" + thingies "^2.5.0" + tree-dump "^1.1.0" + +"@jsonjoy.com/json-pointer@17.67.0": + version "17.67.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/json-pointer/-/json-pointer-17.67.0.tgz#74439573dc046e0c9a3a552fb94b391bc75313b8" + integrity sha512-+iqOFInH+QZGmSuaybBUNdh7yvNrXvqR+h3wjXm0N/3JK1EyyFAeGJvqnmQL61d1ARLlk/wJdFKSL+LHJ1eaUA== + dependencies: + "@jsonjoy.com/util" "17.67.0" + +"@jsonjoy.com/json-pointer@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/json-pointer/-/json-pointer-1.0.2.tgz#049cb530ac24e84cba08590c5e36b431c4843408" + integrity sha512-Fsn6wM2zlDzY1U+v4Nc8bo3bVqgfNTGcn6dMgs6FjrEnt4ZCe60o6ByKRjOGlI2gow0aE/Q41QOigdTqkyK5fg== + dependencies: + "@jsonjoy.com/codegen" "^1.0.0" + "@jsonjoy.com/util" "^1.9.0" + +"@jsonjoy.com/util@17.67.0", "@jsonjoy.com/util@^17.65.0": + version "17.67.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/util/-/util-17.67.0.tgz#7c4288fc3808233e55c7610101e7bb4590cddd3f" + integrity sha512-6+8xBaz1rLSohlGh68D1pdw3AwDi9xydm8QNlAFkvnavCJYSze+pxoW2VKP8p308jtlMRLs5NTHfPlZLd4w7ew== + dependencies: + "@jsonjoy.com/buffers" "17.67.0" + "@jsonjoy.com/codegen" "17.67.0" + +"@jsonjoy.com/util@^1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@jsonjoy.com/util/-/util-1.9.0.tgz#7ee95586aed0a766b746cd8d8363e336c3c47c46" + integrity sha512-pLuQo+VPRnN8hfPqUTLTHk126wuYdXVxE6aDmjSeV4NCAgyxWbiOIeNJVtID3h1Vzpoi9m4jXezf73I6LgabgQ== + dependencies: + "@jsonjoy.com/buffers" "^1.0.0" + "@jsonjoy.com/codegen" "^1.0.0" + "@leichtgewicht/ip-codec@^2.0.1": version "2.0.5" resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz#4fc56c15c580b9adb7dc3c333a134e540b44bfb1" @@ -2146,89 +2600,153 @@ dependencies: "@types/mdx" "^2.0.0" -"@mui/core-downloads-tracker@^7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@mui/core-downloads-tracker/-/core-downloads-tracker-7.3.2.tgz#896a7890864d619093dc79541ec1ecfa3b507ad2" - integrity sha512-AOyfHjyDKVPGJJFtxOlept3EYEdLoar/RvssBTWVAvDJGIE676dLi2oT/Kx+FoVXFoA/JdV7DEMq/BVWV3KHRw== +"@mermaid-js/parser@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@mermaid-js/parser/-/parser-1.2.0.tgz#266d728c54d2d4034d270f8b31d790e26296a5fa" + integrity sha512-oYPyv8A4As1yH5Bx+04iQEQxXuIQDe0GKCNSRgao6z8AM9jixXIfP0vsppRLvGf+nKIOb9/LdpWA4YuJiVvESA== + dependencies: + "@chevrotain/types" "~11.1.2" + +"@module-federation/error-codes@0.22.0": + version "0.22.0" + resolved "https://registry.yarnpkg.com/@module-federation/error-codes/-/error-codes-0.22.0.tgz#31ccc990dc240d73912ba7bd001f7e35ac751992" + integrity sha512-xF9SjnEy7vTdx+xekjPCV5cIHOGCkdn3pIxo9vU7gEZMIw0SvAEdsy6Uh17xaCpm8V0FWvR0SZoK9Ik6jGOaug== + +"@module-federation/runtime-core@0.22.0": + version "0.22.0" + resolved "https://registry.yarnpkg.com/@module-federation/runtime-core/-/runtime-core-0.22.0.tgz#7321ec792bb7d1d22bee6162ec43564b769d2a3c" + integrity sha512-GR1TcD6/s7zqItfhC87zAp30PqzvceoeDGYTgF3Vx2TXvsfDrhP6Qw9T4vudDQL3uJRne6t7CzdT29YyVxlgIA== + dependencies: + "@module-federation/error-codes" "0.22.0" + "@module-federation/sdk" "0.22.0" + +"@module-federation/runtime-tools@0.22.0": + version "0.22.0" + resolved "https://registry.yarnpkg.com/@module-federation/runtime-tools/-/runtime-tools-0.22.0.tgz#36f2a7cb267af208a9d1a237fe9a71b4bf31431e" + integrity sha512-4ScUJ/aUfEernb+4PbLdhM/c60VHl698Gn1gY21m9vyC1Ucn69fPCA1y2EwcCB7IItseRMoNhdcWQnzt/OPCNA== + dependencies: + "@module-federation/runtime" "0.22.0" + "@module-federation/webpack-bundler-runtime" "0.22.0" + +"@module-federation/runtime@0.22.0": + version "0.22.0" + resolved "https://registry.yarnpkg.com/@module-federation/runtime/-/runtime-0.22.0.tgz#f789c9ef40d846d110711c8221ecc0ad938d43d8" + integrity sha512-38g5iPju2tPC3KHMPxRKmy4k4onNp6ypFPS1eKGsNLUkXgHsPMBFqAjDw96iEcjri91BrahG4XcdyKi97xZzlA== + dependencies: + "@module-federation/error-codes" "0.22.0" + "@module-federation/runtime-core" "0.22.0" + "@module-federation/sdk" "0.22.0" + +"@module-federation/sdk@0.22.0": + version "0.22.0" + resolved "https://registry.yarnpkg.com/@module-federation/sdk/-/sdk-0.22.0.tgz#6ad4c1de85a900c3c80ff26cb87cce253e3a2770" + integrity sha512-x4aFNBKn2KVQRuNVC5A7SnrSCSqyfIWmm1DvubjbO9iKFe7ith5niw8dqSFBekYBg2Fwy+eMg4sEFNVvCAdo6g== + +"@module-federation/webpack-bundler-runtime@0.22.0": + version "0.22.0" + resolved "https://registry.yarnpkg.com/@module-federation/webpack-bundler-runtime/-/webpack-bundler-runtime-0.22.0.tgz#dcbe8f972d722fe278e6a7c21988d4bee53d401d" + integrity sha512-aM8gCqXu+/4wBmJtVeMeeMN5guw3chf+2i6HajKtQv7SJfxV/f4IyNQJUeUQu9HfiAZHjqtMV5Lvq/Lvh8LdyA== + dependencies: + "@module-federation/runtime" "0.22.0" + "@module-federation/sdk" "0.22.0" + +"@mui/core-downloads-tracker@^7.3.11": + version "7.3.11" + resolved "https://registry.yarnpkg.com/@mui/core-downloads-tracker/-/core-downloads-tracker-7.3.11.tgz#93251cf192641b9582641991feea60149159902c" + integrity sha512-a7I/b/nBTdXYz2cOSlEmkQ9WWE1x8FHpqMhFPp+Y1VPFxcOw91G5ELOHARQAGSPy5V+UCgJua6K/1x70bAtQPw== "@mui/icons-material@^7.3.1": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-7.3.2.tgz#050049cd6195b815e85888aaebd436e8e95084b8" - integrity sha512-TZWazBjWXBjR6iGcNkbKklnwodcwj0SrChCNHc9BhD9rBgET22J1eFhHsEmvSvru9+opDy3umqAimQjokhfJlQ== + version "7.3.11" + resolved "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-7.3.11.tgz#dfea40829d1ca96c074c85093fdfe0de170af5ad" + integrity sha512-+hz5ilwHZ3djd5es3sCErLioqe/NhZcYTsV/TNXZAMdJdb23F4xzJjqnnZdnurc3S1+ietcssRNqieOhPQLZ7Q== dependencies: - "@babel/runtime" "^7.28.3" + "@babel/runtime" "^7.28.6" "@mui/material@^7.3.1": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@mui/material/-/material-7.3.2.tgz#21ad66bba695e2cd36e4a93e2e4ff5e04d8636a1" - integrity sha512-qXvbnawQhqUVfH1LMgMaiytP+ZpGoYhnGl7yYq2x57GYzcFL/iPzSZ3L30tlbwEjSVKNYcbiKO8tANR1tadjUg== - dependencies: - "@babel/runtime" "^7.28.3" - "@mui/core-downloads-tracker" "^7.3.2" - "@mui/system" "^7.3.2" - "@mui/types" "^7.4.6" - "@mui/utils" "^7.3.2" + version "7.3.11" + resolved "https://registry.yarnpkg.com/@mui/material/-/material-7.3.11.tgz#aa6e0640bb29bd01e6c353ac3436fa0b20e5a36b" + integrity sha512-yq8bPc3LxOwKRWpcjRgDkYFmpM6aKlARfESTmOQcvLYFeJwtHte2tw6hJDrb8sk8wcvpDprHEHVaoUU0MslIkw== + dependencies: + "@babel/runtime" "^7.28.6" + "@mui/core-downloads-tracker" "^7.3.11" + "@mui/system" "^7.3.11" + "@mui/types" "^7.4.12" + "@mui/utils" "^7.3.11" "@popperjs/core" "^2.11.8" "@types/react-transition-group" "^4.4.12" clsx "^2.1.1" - csstype "^3.1.3" + csstype "^3.2.3" prop-types "^15.8.1" - react-is "^19.1.1" + react-is "^19.2.3" react-transition-group "^4.4.5" -"@mui/private-theming@^7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-7.3.2.tgz#9b883ac9ec9288327de038da6ddf8ffa179be831" - integrity sha512-ha7mFoOyZGJr75xeiO9lugS3joRROjc8tG1u4P50dH0KR7bwhHznVMcYg7MouochUy0OxooJm/OOSpJ7gKcMvg== +"@mui/private-theming@^7.3.11": + version "7.3.11" + resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-7.3.11.tgz#96d4cde586624916816f5a97fef3c808cf562fb0" + integrity sha512-9B+YKms0fRHbNrqp9tOT/DNbNnU5gyvJ1o3qAGXfq8GmZcbJnE3At9x07Zr/o0pkhzg4aDdwXVqe4+AcgtOCPA== dependencies: - "@babel/runtime" "^7.28.3" - "@mui/utils" "^7.3.2" + "@babel/runtime" "^7.28.6" + "@mui/utils" "^7.3.11" prop-types "^15.8.1" -"@mui/styled-engine@^7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-7.3.2.tgz#cac6acb9480d6eaf60d9c99a7d24503e53236b32" - integrity sha512-PkJzW+mTaek4e0nPYZ6qLnW5RGa0KN+eRTf5FA2nc7cFZTeM+qebmGibaTLrgQBy3UpcpemaqfzToBNkzuxqew== +"@mui/styled-engine@^7.3.10": + version "7.3.10" + resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-7.3.10.tgz#53e98c1fdeda972b5932c76f6a2a29faf33f0d11" + integrity sha512-WxE9SiF8xskAQqGjsp0poXCkCqsoXFEsSr0HBXfApmGHR+DBnXRp+z46Vsltg4gpPM4Z96DeAQRpeAOnhNg7Ng== dependencies: - "@babel/runtime" "^7.28.3" + "@babel/runtime" "^7.28.6" "@emotion/cache" "^11.14.0" "@emotion/serialize" "^1.3.3" "@emotion/sheet" "^1.4.0" - csstype "^3.1.3" + csstype "^3.2.3" prop-types "^15.8.1" -"@mui/system@^7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@mui/system/-/system-7.3.2.tgz#e838097fc6cb0a2e4c1822478950db89affb116a" - integrity sha512-9d8JEvZW+H6cVkaZ+FK56R53vkJe3HsTpcjMUtH8v1xK6Y1TjzHdZ7Jck02mGXJsE6MQGWVs3ogRHTQmS9Q/rA== +"@mui/system@^7.3.11": + version "7.3.11" + resolved "https://registry.yarnpkg.com/@mui/system/-/system-7.3.11.tgz#ffb8ba06f43d697db80257b9a2dfc8042b18554a" + integrity sha512-7izwGWdNawAKpBKcRlx7f2gFnAAjmASBWvMcyX4YYEeLOFsbfGRbUYGInvnAcUeql3rPxI7F9Ft4oY2OLRz44g== dependencies: - "@babel/runtime" "^7.28.3" - "@mui/private-theming" "^7.3.2" - "@mui/styled-engine" "^7.3.2" - "@mui/types" "^7.4.6" - "@mui/utils" "^7.3.2" + "@babel/runtime" "^7.28.6" + "@mui/private-theming" "^7.3.11" + "@mui/styled-engine" "^7.3.10" + "@mui/types" "^7.4.12" + "@mui/utils" "^7.3.11" clsx "^2.1.1" - csstype "^3.1.3" + csstype "^3.2.3" prop-types "^15.8.1" -"@mui/types@^7.4.6": - version "7.4.6" - resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.4.6.tgz#1432e0814cf155287283f6bbd1e95976a148ef07" - integrity sha512-NVBbIw+4CDMMppNamVxyTccNv0WxtDb7motWDlMeSC8Oy95saj1TIZMGynPpFLePt3yOD8TskzumeqORCgRGWw== +"@mui/types@^7.4.12": + version "7.4.12" + resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.4.12.tgz#e4eba37a7506419ea5c5e0604322ba82b271bf46" + integrity sha512-iKNAF2u9PzSIj40CjvKJWxFXJo122jXVdrmdh0hMYd+FR+NuJMkr/L88XwWLCRiJ5P1j+uyac25+Kp6YC4hu6w== dependencies: - "@babel/runtime" "^7.28.3" + "@babel/runtime" "^7.28.6" -"@mui/utils@^7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-7.3.2.tgz#361775d72c557a03115150e8aec4329c7ef14563" - integrity sha512-4DMWQGenOdLnM3y/SdFQFwKsCLM+mqxzvoWp9+x2XdEzXapkznauHLiXtSohHs/mc0+5/9UACt1GdugCX2te5g== +"@mui/utils@^7.3.11": + version "7.3.11" + resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-7.3.11.tgz#493f46f053fe3a692e041b1b6b8295e2f46d9448" + integrity sha512-XTjGnifwteg71/ij+0e7Y7d+hwyntMYP5wPoA/g2drdGH+Flkvjwy0OfrVpKBbaOvofq4zU/LIyUZyKgmWu18g== dependencies: - "@babel/runtime" "^7.28.3" - "@mui/types" "^7.4.6" + "@babel/runtime" "^7.28.6" + "@mui/types" "^7.4.12" "@types/prop-types" "^15.7.15" clsx "^2.1.1" prop-types "^15.8.1" - react-is "^19.1.1" + react-is "^19.2.3" + +"@napi-rs/wasm-runtime@1.0.7": + version "1.0.7" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-runtime/-/wasm-runtime-1.0.7.tgz#dcfea99a75f06209a235f3d941e3460a51e9b14c" + integrity sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw== + dependencies: + "@emnapi/core" "^1.5.0" + "@emnapi/runtime" "^1.5.0" + "@tybys/wasm-util" "^0.10.1" + +"@noble/hashes@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" + integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -2251,6 +2769,136 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@peculiar/asn1-cms@^2.6.0", "@peculiar/asn1-cms@^2.8.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-cms/-/asn1-cms-2.8.0.tgz#b48a8389319228f929e9acd8cee8da6c858738de" + integrity sha512-NgekZOrSJFSBFLFoLfwePguAWAx7z1+f2TEsWFUMyiqqfntZ4+S/S5hzqME3q4pCA0iOsFKdwiQ35dwY24eVqA== + dependencies: + "@peculiar/asn1-schema" "^2.8.0" + "@peculiar/asn1-x509" "^2.8.0" + "@peculiar/asn1-x509-attr" "^2.8.0" + asn1js "^3.0.10" + tslib "^2.8.1" + +"@peculiar/asn1-csr@^2.6.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-csr/-/asn1-csr-2.8.0.tgz#c9bb5dec2eaff824a705e82a4a58d45e6d2c35d0" + integrity sha512-akbF8+uvleHs8sejNPQxwmVFuInAg6FMNHOwMILXfP518YfFJwdR3jr6oNUPOaEJfuEhn/vkNOCIT6ASUd4mbg== + dependencies: + "@peculiar/asn1-schema" "^2.8.0" + "@peculiar/asn1-x509" "^2.8.0" + asn1js "^3.0.10" + tslib "^2.8.1" + +"@peculiar/asn1-ecc@^2.6.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-ecc/-/asn1-ecc-2.8.0.tgz#d51ab2b07eca98e0cf492d051e98bbd0a071305a" + integrity sha512-ohwlk+u9Rv2NOAY1c6MfHj45ATVF8R1DUN/WCgABiRtLi2ZftlZWZX7KvpAbU8v9xPcmoILfELeEABj/rn18AQ== + dependencies: + "@peculiar/asn1-schema" "^2.8.0" + "@peculiar/asn1-x509" "^2.8.0" + asn1js "^3.0.10" + tslib "^2.8.1" + +"@peculiar/asn1-pfx@^2.8.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-pfx/-/asn1-pfx-2.8.0.tgz#8e189b6455e2bf9e5f921bb150ea86d7e7d1875d" + integrity sha512-5yof1ytoB++RQtaFbqSUJ8pxDJtZT6vbVqZ8XoJ61ph7UjNVvfFwAilnCodqkNsAodpy13gDhoxZXw00pghnyg== + dependencies: + "@peculiar/asn1-cms" "^2.8.0" + "@peculiar/asn1-pkcs8" "^2.8.0" + "@peculiar/asn1-rsa" "^2.8.0" + "@peculiar/asn1-schema" "^2.8.0" + asn1js "^3.0.10" + tslib "^2.8.1" + +"@peculiar/asn1-pkcs8@^2.8.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-pkcs8/-/asn1-pkcs8-2.8.0.tgz#a46cf8857b9b063896afa41d2b8b2aa6a07a70a2" + integrity sha512-qAKXtLpBEw9LqhKpjw3ajZSXlBur+ipW+y2ivVBQAG6F6qRx94yO+1ZR4mvw+YaCfKSaOzLeYEzsPaBp4SJELA== + dependencies: + "@peculiar/asn1-schema" "^2.8.0" + "@peculiar/asn1-x509" "^2.8.0" + asn1js "^3.0.10" + tslib "^2.8.1" + +"@peculiar/asn1-pkcs9@^2.6.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-pkcs9/-/asn1-pkcs9-2.8.0.tgz#6d62697af0bbd4f30fdf0d23b4018f3f09620de3" + integrity sha512-b5nDWCnkV60+cQ141D6sVVwK9nz64R5n3zSVnklGd+ECdkW2Ol3U1a6yYFlalpSOaD557yuJB64A+q42jG7lUQ== + dependencies: + "@peculiar/asn1-cms" "^2.8.0" + "@peculiar/asn1-pfx" "^2.8.0" + "@peculiar/asn1-pkcs8" "^2.8.0" + "@peculiar/asn1-schema" "^2.8.0" + "@peculiar/asn1-x509" "^2.8.0" + "@peculiar/asn1-x509-attr" "^2.8.0" + asn1js "^3.0.10" + tslib "^2.8.1" + +"@peculiar/asn1-rsa@^2.6.0", "@peculiar/asn1-rsa@^2.8.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-rsa/-/asn1-rsa-2.8.0.tgz#9d98d0fc42fec50119d2881b8a9925d36daaea73" + integrity sha512-zHEUlCqB2mk7x2lxDwHHJy7hWZOPdGHVlsmITWKB5/PbQo61atbu9PJ/0r9dQNMwFzbKPXZ8uK8/91eUhRznSg== + dependencies: + "@peculiar/asn1-schema" "^2.8.0" + "@peculiar/asn1-x509" "^2.8.0" + asn1js "^3.0.10" + tslib "^2.8.1" + +"@peculiar/asn1-schema@^2.6.0", "@peculiar/asn1-schema@^2.8.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-schema/-/asn1-schema-2.8.0.tgz#69699f84259b2161607cabfc34e512a4023dbef9" + integrity sha512-7YT0U/ze0tF2QOBbE15gKZwy5tvgGyLRiRHLzhlbOpf7BT032oBSd0haZqXn5W6l26WLlu3dyxzjM+2638/z2Q== + dependencies: + "@peculiar/utils" "^2.0.2" + asn1js "^3.0.10" + tslib "^2.8.1" + +"@peculiar/asn1-x509-attr@^2.8.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-x509-attr/-/asn1-x509-attr-2.8.0.tgz#bd168e3f5e8bc23e56b1a97891f9f2fb7f730204" + integrity sha512-tHjkfS/qhMnmrlB2J9NhflQlQ7In3khO3CfmVrriOlpTeErY9ZIKOso1hQ5JQiyrJ7ShvqVPk7E5fQmbclkSKA== + dependencies: + "@peculiar/asn1-schema" "^2.8.0" + "@peculiar/asn1-x509" "^2.8.0" + asn1js "^3.0.10" + tslib "^2.8.1" + +"@peculiar/asn1-x509@^2.6.0", "@peculiar/asn1-x509@^2.8.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-x509/-/asn1-x509-2.8.0.tgz#9958a9ef35dec8426aabad78ffe8798e318b06e2" + integrity sha512-N0CMuhWUzsWEVq6F1q9X6+VKUnWzSW+cSVg+aPaGGwDdbFoFWTYgin5MHwXgpWd6y9COMBxnfy/Qc+Xc7F0Zwg== + dependencies: + "@peculiar/asn1-schema" "^2.8.0" + "@peculiar/utils" "^2.0.2" + asn1js "^3.0.10" + tslib "^2.8.1" + +"@peculiar/utils@^2.0.2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@peculiar/utils/-/utils-2.0.3.tgz#a27ca4c4b73652e110f19a7d16d664f458a5528e" + integrity sha512-+oL3HPFRIZ1St2K50lWCXiioIgSoxzz7R1J3uF6neO2yl1sgmpgY6XXJH4BdpoDkMWznQTeYF6oWNDZLCdQ4eQ== + dependencies: + tslib "^2.8.1" + +"@peculiar/x509@^1.14.2": + version "1.14.3" + resolved "https://registry.yarnpkg.com/@peculiar/x509/-/x509-1.14.3.tgz#2c44c2b89474346afec38a0c2803ec4fb8ce959e" + integrity sha512-C2Xj8FZ0uHWeCXXqX5B4/gVFQmtSkiuOolzAgutjTfseNOHT3pUjljDZsTSxXFGgio54bCzVFqmEOUrIVk8RDA== + dependencies: + "@peculiar/asn1-cms" "^2.6.0" + "@peculiar/asn1-csr" "^2.6.0" + "@peculiar/asn1-ecc" "^2.6.0" + "@peculiar/asn1-pkcs9" "^2.6.0" + "@peculiar/asn1-rsa" "^2.6.0" + "@peculiar/asn1-schema" "^2.6.0" + "@peculiar/asn1-x509" "^2.6.0" + pvtsutils "^1.3.6" + reflect-metadata "^0.2.2" + tslib "^2.8.1" + tsyringe "^4.10.0" + "@pnpm/config.env-replace@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz#ab29da53df41e8948a00f2433f085f54de8b3a4c" @@ -2263,10 +2911,10 @@ dependencies: graceful-fs "4.2.10" -"@pnpm/npm-conf@^2.1.0": - version "2.3.1" - resolved "https://registry.yarnpkg.com/@pnpm/npm-conf/-/npm-conf-2.3.1.tgz#bb375a571a0bd63ab0a23bece33033c683e9b6b0" - integrity sha512-c83qWb22rNRuB0UaVCI0uRPNRr8Z0FWnEIvT47jiHAmOIUHbBOg5XvV7pM5x+rKn9HRpjxquDbXYSXr3fAKFcw== +"@pnpm/npm-conf@^3.0.2": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@pnpm/npm-conf/-/npm-conf-3.0.3.tgz#17b59982126c86294a8d248aa1d7b185f2df6484" + integrity sha512-//0sR/cow/s4ICQaYoAobOl4aU8cjU6x/V24V7XkKotb9+O+3zySIYp146vpaobYHnxa4pZX8NkV54Z5AwbDKA== dependencies: "@pnpm/config.env-replace" "^1.1.0" "@pnpm/network.ca-file" "^1.0.1" @@ -2282,6 +2930,88 @@ resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f" integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A== +"@rspack/binding-darwin-arm64@1.7.12": + version "1.7.12" + resolved "https://registry.yarnpkg.com/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-1.7.12.tgz#e6e10e7ff15c2254d6cbe9125a747ada880a34f3" + integrity sha512-rbFprJaJiqrmfy8SHth8EsoRS0wg4bXcucwj9NiMzpGFq14Opw8c04iQ6H9BECYzgmN0PKZ9rh41LdVvhdZe4A== + +"@rspack/binding-darwin-x64@1.7.12": + version "1.7.12" + resolved "https://registry.yarnpkg.com/@rspack/binding-darwin-x64/-/binding-darwin-x64-1.7.12.tgz#fe90b64228eb49612e4932049325f52a4ddcfd28" + integrity sha512-jnOp+/UXOJa9xqUb8KXH03sysoO2e4Ij6tw6MqDdmdj8n/A8PQENRPUbW9AwXpPtVDJPus9r4fi7b3+6e4B8Hg== + +"@rspack/binding-linux-arm64-gnu@1.7.12": + version "1.7.12" + resolved "https://registry.yarnpkg.com/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.7.12.tgz#61d63a0fcb9b4eb25b9d68e1f897c8e2619a8a5a" + integrity sha512-C8owWG+yvo7X0oVLIXetkoJhIFBP1LYNcAQqtgLmJnQLQDklGuP83dKC+zISGQWpjawHfZ1ER96vLgoTrxKZdw== + +"@rspack/binding-linux-arm64-musl@1.7.12": + version "1.7.12" + resolved "https://registry.yarnpkg.com/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.7.12.tgz#fd5157890b1250937bb98332dcbb35ff2d7aafd3" + integrity sha512-i51WWI64aRpsfSki6rN0aepPqXkVfS+vZM7+4bWDcmnhUmdMvhIPcYg0QRk3DtyJnu33jqNLM0WHY78k00NyfA== + +"@rspack/binding-linux-x64-gnu@1.7.12": + version "1.7.12" + resolved "https://registry.yarnpkg.com/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.7.12.tgz#a8c963c47a043069b154c704d87bf6a658772ac7" + integrity sha512-MSos0FuPEefqo9V92ULd5hggKG29EkSNg1zDcypy0OkpsKh5pfjVxTLYFXgTcVyFoUQQbdG8zFBzYbwmJ8V4ew== + +"@rspack/binding-linux-x64-musl@1.7.12": + version "1.7.12" + resolved "https://registry.yarnpkg.com/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-1.7.12.tgz#1e95af2b152a0833272c26c3473cfa60832ef8b0" + integrity sha512-JcAMVKXOnjfpC3coWjCFPWD3Yl8RBw6a+IXQQ8mfRlHaHMIiOv8IfZqx15XRxMUn49CtP7Z0Na8iiAg2aKrcfw== + +"@rspack/binding-wasm32-wasi@1.7.12": + version "1.7.12" + resolved "https://registry.yarnpkg.com/@rspack/binding-wasm32-wasi/-/binding-wasm32-wasi-1.7.12.tgz#37a10f322e82cbd51114e8a3182f46c6af101a20" + integrity sha512-n+ZqP6ZMc0nhOgvadg5VhEs9ojtbES80AcWeFnmGkbzIszvGSO63GKNiRkXtjJ9KFuRzytbbmsCqkUVH+Tywxg== + dependencies: + "@napi-rs/wasm-runtime" "1.0.7" + +"@rspack/binding-win32-arm64-msvc@1.7.12": + version "1.7.12" + resolved "https://registry.yarnpkg.com/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.7.12.tgz#77f648ee1cb717c50fdd02126a528b4960654116" + integrity sha512-8+h5fYDXYdmugbdfZ+D1y8IQ3rv2EhSfyGP7vBe+bjNyaMa4jWrpucmZbtxojUL1AzaeuHbvMdj9UO/gelk/+g== + +"@rspack/binding-win32-ia32-msvc@1.7.12": + version "1.7.12" + resolved "https://registry.yarnpkg.com/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.7.12.tgz#9f7cbb26a9c8d9a1cc15d2059de21172b1623c41" + integrity sha512-cDMGwTRSa2p9fNBVe1wTRkF2AEXZ9ARWW36QeC5CkLaI0Ezz8lvhF2+CSOPnhaQ1O1qtn0L0SF+lFnrY+I7xGQ== + +"@rspack/binding-win32-x64-msvc@1.7.12": + version "1.7.12" + resolved "https://registry.yarnpkg.com/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.7.12.tgz#b4c6dceaa63def4aa205d25246c1a5b05d7f36b0" + integrity sha512-wIqFvlgFqrgUyj/6S/FJcvShnkZOmIeXTfqvheLY67MGq8qd8jb1YimQVKAIrmWB3yuJKUFACI3Ag1UBtEedEA== + +"@rspack/binding@1.7.12": + version "1.7.12" + resolved "https://registry.yarnpkg.com/@rspack/binding/-/binding-1.7.12.tgz#8c0b19795f980b0e513855245e689719352c08a4" + integrity sha512-f4HHuLbvuld8Ba4iB/4ibse5XrKxFrgmM3S4P2AOKnPlekAFlBjmltCuaTL/W2ggYvILaVY+YcFXrEH1rrKeQA== + optionalDependencies: + "@rspack/binding-darwin-arm64" "1.7.12" + "@rspack/binding-darwin-x64" "1.7.12" + "@rspack/binding-linux-arm64-gnu" "1.7.12" + "@rspack/binding-linux-arm64-musl" "1.7.12" + "@rspack/binding-linux-x64-gnu" "1.7.12" + "@rspack/binding-linux-x64-musl" "1.7.12" + "@rspack/binding-wasm32-wasi" "1.7.12" + "@rspack/binding-win32-arm64-msvc" "1.7.12" + "@rspack/binding-win32-ia32-msvc" "1.7.12" + "@rspack/binding-win32-x64-msvc" "1.7.12" + +"@rspack/core@^1.7.10": + version "1.7.12" + resolved "https://registry.yarnpkg.com/@rspack/core/-/core-1.7.12.tgz#e2a36bd16a10e10aee5905827064ac4b8a63b321" + integrity sha512-6CwFIHlhRmXfZoMj3v9MZ1SMTPBn+cHVXeMIeaGp5sufqinKsISbsqHu6ZMJu2wDSmZLdmQJX6zLxkhcAUlhkQ== + dependencies: + "@module-federation/runtime-tools" "0.22.0" + "@rspack/binding" "1.7.12" + "@rspack/lite-tapable" "1.1.0" + +"@rspack/lite-tapable@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@rspack/lite-tapable/-/lite-tapable-1.1.0.tgz#3cfdafeed01078e116bd4f191b684c8b484de425" + integrity sha512-E2B0JhYFmVAwdDiG14+DW0Di4Ze4Jg10Pc4/lILUrd5DRCaklduz2OvJ5HYQ6G+hd+WTzqQb3QnDNfK4yvAFYw== + "@sideway/address@^4.1.5": version "4.1.5" resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.5.tgz#4bc149a0076623ced99ca8208ba780d65a99b9d5" @@ -2300,9 +3030,9 @@ integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== "@sinclair/typebox@^0.27.8": - version "0.27.8" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" - integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== + version "0.27.10" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.10.tgz#beefe675f1853f73676aecc915b2bd2ac98c4fc6" + integrity sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA== "@sindresorhus/is@^4.6.0": version "4.6.0" @@ -2429,6 +3159,179 @@ "@svgr/plugin-jsx" "8.1.0" "@svgr/plugin-svgo" "8.1.0" +"@swc/core-darwin-arm64@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.15.43.tgz#386294f8427dde2df1a70dd0a5826d67af70e996" + integrity sha512-v1aVuvXdo/BHxJzco9V2xpHrvwWmhfS8t6gziY5wJxd+Z2h8AeJRnAwPD8itCDaGXVBwJ/CaKfxEzTkG0Va0OA== + +"@swc/core-darwin-x64@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.15.43.tgz#c4823529c424e2ae25b7eb786438474741521fcb" + integrity sha512-lp3d4Lamc8dt5huYdGLSR+9hLxmfr1jb0l+4XXG2zPqZwYWRN9R0U2qYoTrggiU2RWW0oV9VbWM3kBnqIc2kdQ== + +"@swc/core-linux-arm-gnueabihf@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.15.43.tgz#c0a0ed17cffc5d4af192935667f12f05feeb39f9" + integrity sha512-JWTQQELtsG5GgphDrr/XqqmM2pDN3cZqbMS0Mrg+iTiXL3F74sn/S2IyYE/5u4h2KLkTf9qQ7dXyxsbx7YzkeA== + +"@swc/core-linux-arm64-gnu@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.15.43.tgz#1eb2d9c5eeee5bb9d00599b475ddc31dc2870d22" + integrity sha512-B4otJRdPWIsmiSBf0uG7Z/+vMWmkufjz5MmYxubwKuZazDW14Zd3symga1N62QR4RT+kEFeHEgsXfZGyn/w0hw== + +"@swc/core-linux-arm64-musl@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.15.43.tgz#ea6b5c38088f3921a57922d3931b2d74fd23a9fd" + integrity sha512-6zB6OnpViBxYy4tgY3v2i6AZY9fwkcHZ032UOwtwUuW1d19sdT07qF0kZe6/3UR1tUaK6jjg2rmVcUIBCEYVjQ== + +"@swc/core-linux-ppc64-gnu@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core-linux-ppc64-gnu/-/core-linux-ppc64-gnu-1.15.43.tgz#538fac30bbd5f1e678bb7bac9ccc62246a6f6d7a" + integrity sha512-coxE1ZWdB3uSDVNoEtYNrRi/1epvckZx9cTJ8ICUxTMTxGk+yvQ/Twacp3ruZSaMPGCriUjP86C37VhaT6nyRg== + +"@swc/core-linux-s390x-gnu@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core-linux-s390x-gnu/-/core-linux-s390x-gnu-1.15.43.tgz#ee564b45f3f578b1fc82136c4dab163189316641" + integrity sha512-lXfLhs+LpBsD5inuYx+YDH5WsPPBQ95KPUiy8P5wq9ob9xKDZFqwNfU2QW6bGO8NqRO/H9JQomTSt5Yyh+FGfA== + +"@swc/core-linux-x64-gnu@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.15.43.tgz#e6e3bfea76921c7f5e16d50a126615f2e04ce1c8" + integrity sha512-07XnKwTmKy8TGOZG3D9fRnLWGynxPjwQnZLVmBFbo6F+7vHYzBIOuwXEhemrChBWb6yDNZsVCcMWCPX6FDD2xg== + +"@swc/core-linux-x64-musl@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.15.43.tgz#539f6f2721c0cc32e5db5cf0d453c82045f6662d" + integrity sha512-TJc+bsSIaBh+hZvZ5GRtW/K1bw66TJ9vsUwvVIsZdiWxU5ObLwZvfcnZ3UpgVfMnFibRes9uriJrQNBHEEogRQ== + +"@swc/core-win32-arm64-msvc@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.15.43.tgz#b7bb6b611d484ac19d0ee21469e7012d646c28b5" + integrity sha512-jfd7s2/bUQYkOHLs+LWQNKZdmDa8+sufKLllhpWAhVQ2GDCwsHe3vR/j+OSiItZNtkzFuaawa3+SAKz9y5gYfw== + +"@swc/core-win32-ia32-msvc@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.15.43.tgz#e5b25722a7d27bb0c9a9bdee7863f29c8674364e" + integrity sha512-rLAE8JvucqEW1ZGohxPQrQWPBQeJG4+ypKbWfdlU/qmKScvCkxf9/Jxnzki1dkUQCQ7P5Enp13RlvqOlvx/32g== + +"@swc/core-win32-x64-msvc@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.15.43.tgz#d28842621201c345383d468d40c09648b6cd6e68" + integrity sha512-h8MLDHZcfIukwQWj03rIJZx1I0E81AYj2X7J/nGErG4nz+QAv6G1Z+peotvinL3lqpbo32tLYSMFo32/ySzxKg== + +"@swc/core@^1.15.40": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.15.43.tgz#653e6573968fd5c74163b9885ea0a933012c9f22" + integrity sha512-1CuKjFkPxIgGdeHVuNbkxmBxkcbdc08u0aiI43pFq6yY1tTVKmXT9hFEooyyKs/sJ3xf1GPHyEwTtk9Xl8dvQw== + dependencies: + "@swc/counter" "^0.1.3" + "@swc/types" "^0.1.27" + optionalDependencies: + "@swc/core-darwin-arm64" "1.15.43" + "@swc/core-darwin-x64" "1.15.43" + "@swc/core-linux-arm-gnueabihf" "1.15.43" + "@swc/core-linux-arm64-gnu" "1.15.43" + "@swc/core-linux-arm64-musl" "1.15.43" + "@swc/core-linux-ppc64-gnu" "1.15.43" + "@swc/core-linux-s390x-gnu" "1.15.43" + "@swc/core-linux-x64-gnu" "1.15.43" + "@swc/core-linux-x64-musl" "1.15.43" + "@swc/core-win32-arm64-msvc" "1.15.43" + "@swc/core-win32-ia32-msvc" "1.15.43" + "@swc/core-win32-x64-msvc" "1.15.43" + +"@swc/counter@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.3.tgz#cc7463bd02949611c6329596fccd2b0ec782b0e9" + integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ== + +"@swc/html-darwin-arm64@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html-darwin-arm64/-/html-darwin-arm64-1.15.43.tgz#c88069f140ead901724018f96ad709779526a368" + integrity sha512-+PFbHbeeN+zB0zfvR1V1NmvPriuWPI+sijQXpI+wq/nLIujxvtENWjOKVHgouC9TIN/uKmL2zu9HAq6L6YxnPA== + +"@swc/html-darwin-x64@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html-darwin-x64/-/html-darwin-x64-1.15.43.tgz#9bc8171494d3b98eac017b5b73f0f63054558626" + integrity sha512-LQJ2U8Oxcx4T1rRF25y4h+/p05nn58FugTe/uGxC5OT3K83c2MftcSZLYaahOu4GVHRZeS1NI94CkSvQV++TVw== + +"@swc/html-linux-arm-gnueabihf@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html-linux-arm-gnueabihf/-/html-linux-arm-gnueabihf-1.15.43.tgz#271a5d345719fa2c381df45355f70870faaaf35c" + integrity sha512-DKIen6DuIRO7Xc5gAbgBT5QyRHJGEGXreIdM1VBosYWTGnnrQ//Hwd7bLD6UbT8X8eU1vqvpXwQ1E24QRqRaBQ== + +"@swc/html-linux-arm64-gnu@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html-linux-arm64-gnu/-/html-linux-arm64-gnu-1.15.43.tgz#93cd3202f204351e7279efd07abc280fe0b2d193" + integrity sha512-0AuHiyfcE86CZ/CajFIszLzZVzbM2wn5p01oet8Q9RikflCGwyH79Nv9TrAKD1Cx7juUrONzDk+f2b/x73wLTg== + +"@swc/html-linux-arm64-musl@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html-linux-arm64-musl/-/html-linux-arm64-musl-1.15.43.tgz#a6c0c2a1646755b1ee53a6bddbee68674f8edaea" + integrity sha512-TweIdl/g9ugkoiYvcL/qbu+gbglDY3TqNxfXH84WXc4rSqEP20owVlxLya2NjVct8LIP2wDrtutpOwAXWC+Eew== + +"@swc/html-linux-ppc64-gnu@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html-linux-ppc64-gnu/-/html-linux-ppc64-gnu-1.15.43.tgz#51319cc1a4184b788613e0e556fc33ff77af0c52" + integrity sha512-4oue1pB38/W6mbudp+w0q1jbwxuwdbdbaOj85ay0pisCs213WkgP+MPN8Zqa5VVPjQnVk2CTY9kmEc74XQI/sA== + +"@swc/html-linux-s390x-gnu@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html-linux-s390x-gnu/-/html-linux-s390x-gnu-1.15.43.tgz#a612115a5f2f6c9df438a52ab2cf8bc4fd3865b1" + integrity sha512-/tceMNvAxK70SKUZtcn3X+K0vcElMGk3i8Sz0CmPdtooso8MZ7WfAvVP1qi3TWgh1rpQ3cC+Al3433AHlET6+w== + +"@swc/html-linux-x64-gnu@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html-linux-x64-gnu/-/html-linux-x64-gnu-1.15.43.tgz#028980da812e1797316f0a06a758a49aca699318" + integrity sha512-YE7ltlTt5ZFl59GsoHTDrIHnCBY8EDBio66CVj4bqkElFXbE/28xmpVE5ksdGoI5c5aQ/8byUCfHxqzCzQQSVg== + +"@swc/html-linux-x64-musl@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html-linux-x64-musl/-/html-linux-x64-musl-1.15.43.tgz#363ac7ce3866b664db0c35d78a6a90636f280139" + integrity sha512-nS20HmbOk+dEEzdosJqqxAeyjMIiS5yrCAti8LUf0+dgr4eRmjkH4MlkjfPjf49aayR8o+eMJ1jsDZ7whx4zog== + +"@swc/html-win32-arm64-msvc@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html-win32-arm64-msvc/-/html-win32-arm64-msvc-1.15.43.tgz#d0aa3f99c091577aaaa1aaf51a3695c98278564d" + integrity sha512-Yz7aQQhXT/Yc6QcuMDQDZP9jqf2phkVyU+qSu8ZRWEcJgIorrPL6q7YLqMk+MB5PpZyu5XJEODvc1/UVDE1Kyg== + +"@swc/html-win32-ia32-msvc@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html-win32-ia32-msvc/-/html-win32-ia32-msvc-1.15.43.tgz#e2cfe4dd26ce8b8c5787ca1fdd69ef6b5dc94822" + integrity sha512-muUgfsSQRZk6YBRuhaGKSLvXy0bV9BW6/mHLI0N/06btWuf0hekoHhIzR7dUmS98NXKCA7Hv+buBPE/0vXUwyA== + +"@swc/html-win32-x64-msvc@1.15.43": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html-win32-x64-msvc/-/html-win32-x64-msvc-1.15.43.tgz#ee1a8a7fe4d928595268c214cf17c72867ee8f0f" + integrity sha512-tuLDy4MxPXsLi6jW+ozCdFWO61AoMMnlhePWJxMafefC2Ojm+iILxP2zI2Hgfu6F16y1q7ITdXdpEuqptu5fHw== + +"@swc/html@^1.15.40": + version "1.15.43" + resolved "https://registry.yarnpkg.com/@swc/html/-/html-1.15.43.tgz#421da1ffc3226d149fd57c73f73755c6e6148427" + integrity sha512-SKbkbdGi9SDO9cTdV+6H0/AYifnb2nDOlz5BlWxlWMXACV3kmX6WwZDo0bBdyGlO/G4jCVWdR5r84qfotU2now== + dependencies: + "@swc/counter" "^0.1.3" + optionalDependencies: + "@swc/html-darwin-arm64" "1.15.43" + "@swc/html-darwin-x64" "1.15.43" + "@swc/html-linux-arm-gnueabihf" "1.15.43" + "@swc/html-linux-arm64-gnu" "1.15.43" + "@swc/html-linux-arm64-musl" "1.15.43" + "@swc/html-linux-ppc64-gnu" "1.15.43" + "@swc/html-linux-s390x-gnu" "1.15.43" + "@swc/html-linux-x64-gnu" "1.15.43" + "@swc/html-linux-x64-musl" "1.15.43" + "@swc/html-win32-arm64-msvc" "1.15.43" + "@swc/html-win32-ia32-msvc" "1.15.43" + "@swc/html-win32-x64-msvc" "1.15.43" + +"@swc/types@^0.1.27": + version "0.1.27" + resolved "https://registry.yarnpkg.com/@swc/types/-/types-0.1.27.tgz#12080b0c426dea450634f202d9a3c82ac396e793" + integrity sha512-K6h3iUlqeM946U4sXFYeahefR1YBbXJvko+hv8WS8/0BNJ4OHiHRywMnQUJCqkR7Y9+hqQ1TvEpiKqUhz7NEFg== + dependencies: + "@swc/counter" "^0.1.3" + "@szmarczak/http-timer@^5.0.1": version "5.0.1" resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz#c7c1bf1141cdd4751b0399c8fc7b8b664cd5be3a" @@ -2436,10 +3339,12 @@ dependencies: defer-to-connect "^2.0.1" -"@trysound/sax@0.2.0": - version "0.2.0" - resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad" - integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA== +"@tybys/wasm-util@^0.10.1": + version "0.10.3" + resolved "https://registry.yarnpkg.com/@tybys/wasm-util/-/wasm-util-0.10.3.tgz#015cba9e9dd47ce14d03d2a8c5d547bfb169665d" + integrity sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg== + dependencies: + tslib "^2.4.0" "@types/body-parser@*": version "1.19.6" @@ -2449,14 +3354,14 @@ "@types/connect" "*" "@types/node" "*" -"@types/bonjour@^3.5.9": +"@types/bonjour@^3.5.13": version "3.5.13" resolved "https://registry.yarnpkg.com/@types/bonjour/-/bonjour-3.5.13.tgz#adf90ce1a105e81dd1f9c61fdc5afda1bfb92956" integrity sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ== dependencies: "@types/node" "*" -"@types/connect-history-api-fallback@^1.3.5": +"@types/connect-history-api-fallback@^1.5.4": version "1.5.4" resolved "https://registry.yarnpkg.com/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.4.tgz#7de71645a103056b48ac3ce07b3520b819c1d5b3" integrity sha512-n6Cr2xS1h4uAulPRdlw6Jl6s1oG8KrVilPN2yUITEs+K48EzMJJ3W1xy8K5eWuFvjp3R74AOIGSmp2UfBJ8HFw== @@ -2471,28 +3376,222 @@ dependencies: "@types/node" "*" -"@types/debug@^4.0.0": - version "4.1.12" - resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" - integrity sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ== +"@types/d3-array@*": + version "3.2.2" + resolved "https://registry.yarnpkg.com/@types/d3-array/-/d3-array-3.2.2.tgz#e02151464d02d4a1b44646d0fcdb93faf88fde8c" + integrity sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw== + +"@types/d3-axis@*": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-axis/-/d3-axis-3.0.6.tgz#e760e5765b8188b1defa32bc8bb6062f81e4c795" + integrity sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw== dependencies: - "@types/ms" "*" + "@types/d3-selection" "*" -"@types/eslint-scope@^3.7.7": - version "3.7.7" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5" - integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg== +"@types/d3-brush@*": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-brush/-/d3-brush-3.0.6.tgz#c2f4362b045d472e1b186cdbec329ba52bdaee6c" + integrity sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A== dependencies: - "@types/eslint" "*" - "@types/estree" "*" + "@types/d3-selection" "*" -"@types/eslint@*": - version "9.6.1" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-9.6.1.tgz#d5795ad732ce81715f27f75da913004a56751584" - integrity sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag== +"@types/d3-chord@*": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-chord/-/d3-chord-3.0.6.tgz#1706ca40cf7ea59a0add8f4456efff8f8775793d" + integrity sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg== + +"@types/d3-color@*": + version "3.1.3" + resolved "https://registry.yarnpkg.com/@types/d3-color/-/d3-color-3.1.3.tgz#368c961a18de721da8200e80bf3943fb53136af2" + integrity sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A== + +"@types/d3-contour@*": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-contour/-/d3-contour-3.0.6.tgz#9ada3fa9c4d00e3a5093fed0356c7ab929604231" + integrity sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg== dependencies: - "@types/estree" "*" - "@types/json-schema" "*" + "@types/d3-array" "*" + "@types/geojson" "*" + +"@types/d3-delaunay@*": + version "6.0.4" + resolved "https://registry.yarnpkg.com/@types/d3-delaunay/-/d3-delaunay-6.0.4.tgz#185c1a80cc807fdda2a3fe960f7c11c4a27952e1" + integrity sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw== + +"@types/d3-dispatch@*": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@types/d3-dispatch/-/d3-dispatch-3.0.7.tgz#ef004d8a128046cfce434d17182f834e44ef95b2" + integrity sha512-5o9OIAdKkhN1QItV2oqaE5KMIiXAvDWBDPrD85e58Qlz1c1kI/J0NcqbEG88CoTwJrYe7ntUCVfeUl2UJKbWgA== + +"@types/d3-drag@*": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@types/d3-drag/-/d3-drag-3.0.7.tgz#b13aba8b2442b4068c9a9e6d1d82f8bcea77fc02" + integrity sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ== + dependencies: + "@types/d3-selection" "*" + +"@types/d3-dsv@*": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@types/d3-dsv/-/d3-dsv-3.0.7.tgz#0a351f996dc99b37f4fa58b492c2d1c04e3dac17" + integrity sha512-n6QBF9/+XASqcKK6waudgL0pf/S5XHPPI8APyMLLUHd8NqouBGLsU8MgtO7NINGtPBtk9Kko/W4ea0oAspwh9g== + +"@types/d3-ease@*": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/d3-ease/-/d3-ease-3.0.2.tgz#e28db1bfbfa617076f7770dd1d9a48eaa3b6c51b" + integrity sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA== + +"@types/d3-fetch@*": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@types/d3-fetch/-/d3-fetch-3.0.7.tgz#c04a2b4f23181aa376f30af0283dbc7b3b569980" + integrity sha512-fTAfNmxSb9SOWNB9IoG5c8Hg6R+AzUHDRlsXsDZsNp6sxAEOP0tkP3gKkNSO/qmHPoBFTxNrjDprVHDQDvo5aA== + dependencies: + "@types/d3-dsv" "*" + +"@types/d3-force@*": + version "3.0.10" + resolved "https://registry.yarnpkg.com/@types/d3-force/-/d3-force-3.0.10.tgz#6dc8fc6e1f35704f3b057090beeeb7ac674bff1a" + integrity sha512-ZYeSaCF3p73RdOKcjj+swRlZfnYpK1EbaDiYICEEp5Q6sUiqFaFQ9qgoshp5CzIyyb/yD09kD9o2zEltCexlgw== + +"@types/d3-format@*": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/d3-format/-/d3-format-3.0.4.tgz#b1e4465644ddb3fdf3a263febb240a6cd616de90" + integrity sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g== + +"@types/d3-geo@*": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@types/d3-geo/-/d3-geo-3.1.0.tgz#b9e56a079449174f0a2c8684a9a4df3f60522440" + integrity sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ== + dependencies: + "@types/geojson" "*" + +"@types/d3-hierarchy@*": + version "3.1.7" + resolved "https://registry.yarnpkg.com/@types/d3-hierarchy/-/d3-hierarchy-3.1.7.tgz#6023fb3b2d463229f2d680f9ac4b47466f71f17b" + integrity sha512-tJFtNoYBtRtkNysX1Xq4sxtjK8YgoWUNpIiUee0/jHGRwqvzYxkq0hGVbbOGSz+JgFxxRu4K8nb3YpG3CMARtg== + +"@types/d3-interpolate@*": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz#412b90e84870285f2ff8a846c6eb60344f12a41c" + integrity sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA== + dependencies: + "@types/d3-color" "*" + +"@types/d3-path@*": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@types/d3-path/-/d3-path-3.1.1.tgz#f632b380c3aca1dba8e34aa049bcd6a4af23df8a" + integrity sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg== + +"@types/d3-polygon@*": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/d3-polygon/-/d3-polygon-3.0.2.tgz#dfae54a6d35d19e76ac9565bcb32a8e54693189c" + integrity sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA== + +"@types/d3-quadtree@*": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-quadtree/-/d3-quadtree-3.0.6.tgz#d4740b0fe35b1c58b66e1488f4e7ed02952f570f" + integrity sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg== + +"@types/d3-random@*": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/d3-random/-/d3-random-3.0.4.tgz#6bd3683b8332fc0f01e7059b7636bc5c7ede7337" + integrity sha512-UHYId5WTCx4L4YNel7NU00XUXXgvgpgZOvp10PuvsQENjMDXhh2RyFc0KBjO7B45ne4Ha1yVH7ii0vnzKkuzWA== + +"@types/d3-scale-chromatic@*": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz#dc6d4f9a98376f18ea50bad6c39537f1b5463c39" + integrity sha512-iWMJgwkK7yTRmWqRB5plb1kadXyQ5Sj8V/zYlFGMUBbIPKQScw+Dku9cAAMgJG+z5GYDoMjWGLVOvjghDEFnKQ== + +"@types/d3-scale@*": + version "4.0.9" + resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-4.0.9.tgz#57a2f707242e6fe1de81ad7bfcccaaf606179afb" + integrity sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw== + dependencies: + "@types/d3-time" "*" + +"@types/d3-selection@*": + version "3.0.11" + resolved "https://registry.yarnpkg.com/@types/d3-selection/-/d3-selection-3.0.11.tgz#bd7a45fc0a8c3167a631675e61bc2ca2b058d4a3" + integrity sha512-bhAXu23DJWsrI45xafYpkQ4NtcKMwWnAC/vKrd2l+nxMFuvOT3XMYTIj2opv8vq8AO5Yh7Qac/nSeP/3zjTK0w== + +"@types/d3-shape@*": + version "3.1.8" + resolved "https://registry.yarnpkg.com/@types/d3-shape/-/d3-shape-3.1.8.tgz#d1516cc508753be06852cd06758e3bb54a22b0e3" + integrity sha512-lae0iWfcDeR7qt7rA88BNiqdvPS5pFVPpo5OfjElwNaT2yyekbM0C9vK+yqBqEmHr6lDkRnYNoTBYlAgJa7a4w== + dependencies: + "@types/d3-path" "*" + +"@types/d3-time-format@*": + version "4.0.3" + resolved "https://registry.yarnpkg.com/@types/d3-time-format/-/d3-time-format-4.0.3.tgz#d6bc1e6b6a7db69cccfbbdd4c34b70632d9e9db2" + integrity sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg== + +"@types/d3-time@*": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/d3-time/-/d3-time-3.0.4.tgz#8472feecd639691450dd8000eb33edd444e1323f" + integrity sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g== + +"@types/d3-timer@*": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/d3-timer/-/d3-timer-3.0.2.tgz#70bbda77dc23aa727413e22e214afa3f0e852f70" + integrity sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw== + +"@types/d3-transition@*": + version "3.0.9" + resolved "https://registry.yarnpkg.com/@types/d3-transition/-/d3-transition-3.0.9.tgz#1136bc57e9ddb3c390dccc9b5ff3b7d2b8d94706" + integrity sha512-uZS5shfxzO3rGlu0cC3bjmMFKsXv+SmZZcgp0KD22ts4uGXp5EVYGzu/0YdwZeKmddhcAccYtREJKkPfXkZuCg== + dependencies: + "@types/d3-selection" "*" + +"@types/d3-zoom@*": + version "3.0.8" + resolved "https://registry.yarnpkg.com/@types/d3-zoom/-/d3-zoom-3.0.8.tgz#dccb32d1c56b1e1c6e0f1180d994896f038bc40b" + integrity sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw== + dependencies: + "@types/d3-interpolate" "*" + "@types/d3-selection" "*" + +"@types/d3@^7.4.3": + version "7.4.3" + resolved "https://registry.yarnpkg.com/@types/d3/-/d3-7.4.3.tgz#d4550a85d08f4978faf0a4c36b848c61eaac07e2" + integrity sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww== + dependencies: + "@types/d3-array" "*" + "@types/d3-axis" "*" + "@types/d3-brush" "*" + "@types/d3-chord" "*" + "@types/d3-color" "*" + "@types/d3-contour" "*" + "@types/d3-delaunay" "*" + "@types/d3-dispatch" "*" + "@types/d3-drag" "*" + "@types/d3-dsv" "*" + "@types/d3-ease" "*" + "@types/d3-fetch" "*" + "@types/d3-force" "*" + "@types/d3-format" "*" + "@types/d3-geo" "*" + "@types/d3-hierarchy" "*" + "@types/d3-interpolate" "*" + "@types/d3-path" "*" + "@types/d3-polygon" "*" + "@types/d3-quadtree" "*" + "@types/d3-random" "*" + "@types/d3-scale" "*" + "@types/d3-scale-chromatic" "*" + "@types/d3-selection" "*" + "@types/d3-shape" "*" + "@types/d3-time" "*" + "@types/d3-time-format" "*" + "@types/d3-timer" "*" + "@types/d3-transition" "*" + "@types/d3-zoom" "*" + +"@types/debug@^4.0.0": + version "4.1.13" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.13.tgz#22d1cc9d542d3593caea764f974306ab36286ee7" + integrity sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw== + dependencies: + "@types/ms" "*" "@types/estree-jsx@^1.0.0": version "1.0.5" @@ -2502,24 +3601,24 @@ "@types/estree" "*" "@types/estree@*", "@types/estree@^1.0.0", "@types/estree@^1.0.8": - version "1.0.8" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" - integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== + version "1.0.9" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.9.tgz#cf3f0e876d7bee15a93ab925b82bf570a3904a24" + integrity sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg== "@types/express-serve-static-core@*", "@types/express-serve-static-core@^5.0.0": - version "5.0.7" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-5.0.7.tgz#2fa94879c9d46b11a5df4c74ac75befd6b283de6" - integrity sha512-R+33OsgWw7rOhD1emjU7dzCDHucJrgJXMA5PYCzJxVil0dsyx5iBEPHqpPfiKNJQb7lZ1vxwoLR4Z87bBUpeGQ== + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-5.1.2.tgz#19afe821c79f18d05946892bbd5b924b96c8a4f6" + integrity sha512-d3KvEXBSo/lOAMc2u6fkyDHBvetBHeqD7wm/AcXfLpSOQwlmG9D/aQ0SFswVjv05p7ullQS7Mjohj6/VdbZuTg== dependencies: "@types/node" "*" "@types/qs" "*" "@types/range-parser" "*" "@types/send" "*" -"@types/express-serve-static-core@^4.17.33": - version "4.19.6" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.19.6.tgz#e01324c2a024ff367d92c66f48553ced0ab50267" - integrity sha512-N4LZ2xG7DatVqhCZzOGb1Yi5lMbXSZcmdLDe9EzSndPV2HpWYWzRbaerl2n27irrm94EPpprqa8KpskPT085+A== +"@types/express-serve-static-core@^4.17.21", "@types/express-serve-static-core@^4.17.33": + version "4.19.9" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.19.9.tgz#b746a8bb6c389af7a31141397bb539f775b0ae84" + integrity sha512-QP2ESEe/ImWY0HDwNAnK9PvEffUyhLTnWkk7KXzHfyeWAnlrDe1fN77bXl6ia8KT3wPlmA7t9/VPRpnf4Ex9sg== dependencies: "@types/node" "*" "@types/qs" "*" @@ -2527,28 +3626,28 @@ "@types/send" "*" "@types/express@*": - version "5.0.3" - resolved "https://registry.yarnpkg.com/@types/express/-/express-5.0.3.tgz#6c4bc6acddc2e2a587142e1d8be0bce20757e956" - integrity sha512-wGA0NX93b19/dZC1J18tKWVIYWyyF2ZjT9vin/NRu0qzzvfVzWjs04iq2rQ3H65vCTQYlRqs3YHfY7zjdV+9Kw== + version "5.0.6" + resolved "https://registry.yarnpkg.com/@types/express/-/express-5.0.6.tgz#2d724b2c990dcb8c8444063f3580a903f6d500cc" + integrity sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA== dependencies: "@types/body-parser" "*" "@types/express-serve-static-core" "^5.0.0" - "@types/serve-static" "*" + "@types/serve-static" "^2" -"@types/express@^4.17.13": - version "4.17.23" - resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.23.tgz#35af3193c640bfd4d7fe77191cd0ed411a433bef" - integrity sha512-Crp6WY9aTYP3qPi2wGDo9iUe/rceX01UMhnF1jmwDcKCFM6cx7YhGP/Mpr3y9AASpfHixIG0E6azCcL5OcDHsQ== +"@types/express@^4.17.25": + version "4.17.25" + resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.25.tgz#070c8c73a6fee6936d65c195dbbfb7da5026649b" + integrity sha512-dVd04UKsfpINUnK0yBoYHDF3xu7xVH4BuDotC/xGuycx4CgbP48X/KF/586bcObxT0HENHXEU8Nqtu6NR+eKhw== dependencies: "@types/body-parser" "*" "@types/express-serve-static-core" "^4.17.33" "@types/qs" "*" - "@types/serve-static" "*" + "@types/serve-static" "^1" -"@types/gtag.js@^0.0.12": - version "0.0.12" - resolved "https://registry.yarnpkg.com/@types/gtag.js/-/gtag.js-0.0.12.tgz#095122edca896689bdfcdd73b057e23064d23572" - integrity sha512-YQV9bUsemkzG81Ea295/nF/5GijnD2Af7QhEofh7xu+kvCN6RdodgNwwGWXB5GMI3NoyvQo0odNctoH/qLMIpg== +"@types/geojson@*": + version "7946.0.16" + resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.16.tgz#8ebe53d69efada7044454e3305c19017d97ced2a" + integrity sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg== "@types/hast@^3.0.0": version "3.0.4" @@ -2568,9 +3667,9 @@ integrity sha512-oh/6byDPnL1zeNXFrDXFLyZjkr1MsBG667IM792caf1L2UPOOMf65NFzjUH/ltyfwjAGfs1rsX1eftK0jC/KIg== "@types/http-cache-semantics@^4.0.2": - version "4.0.4" - resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz#b979ebad3919799c979b17c72621c0bc0a31c6c4" - integrity sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA== + version "4.2.0" + resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz#f6a7788f438cbfde15f29acad46512b4c01913b3" + integrity sha512-L3LgimLHXtGkWikKnsPg0/VFx9OGZaC+eN1u4r+OB1XRqH3meBIAVC2zr1WdMH+RHmnRkqliQAOHNJ/E0j/e0Q== "@types/http-errors@*": version "2.0.5" @@ -2578,9 +3677,9 @@ integrity sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg== "@types/http-proxy@^1.17.8": - version "1.17.16" - resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.16.tgz#dee360707b35b3cc85afcde89ffeebff7d7f9240" - integrity sha512-sdWoUajOB1cd0A8cRRQ1cfyWNbmFKLAqBB89Y8x5iYyG/mkJHc0YUH8pdWBy2omi9qtCpiIgGjuwO0dQST2l5w== + version "1.17.17" + resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.17.tgz#d9e2c4571fe3507343cb210cd41790375e59a533" + integrity sha512-ED6LB+Z1AVylNTu7hdzuBqOgMnvG/ld6wGCG8wFnAzKX5uyW2K3WD52v0gnLCTK/VLpXtKckgWuyScYK6cSPaw== dependencies: "@types/node" "*" @@ -2603,7 +3702,7 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/json-schema@*", "@types/json-schema@^7.0.15", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": +"@types/json-schema@^7.0.15", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== @@ -2616,9 +3715,9 @@ "@types/unist" "*" "@types/mdx@^2.0.0": - version "2.0.13" - resolved "https://registry.yarnpkg.com/@types/mdx/-/mdx-2.0.13.tgz#68f6877043d377092890ff5b298152b0a21671bd" - integrity sha512-+OWZQfAYyio6YkJb3HLxDrvnx6SWWDbC0zVPfBRzUk0/nqoDyf6dNxQi3eArPe8rJ473nobTMQ/8Zk+LxJ+Yuw== + version "2.0.14" + resolved "https://registry.yarnpkg.com/@types/mdx/-/mdx-2.0.14.tgz#c1e54113265b152021ab0afe0434e3cadd90bfe3" + integrity sha512-T48PeuJtvLosNTPVhfnIp3i/n3a4g4Bad7YCq5k64D4u7NwDrAotikQ+5+sjtUvBmxCMlbo3dVL+C2dP0rWHzg== "@types/mime@^1": version "1.3.5" @@ -2630,19 +3729,12 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-2.1.0.tgz#052aa67a48eccc4309d7f0191b7e41434b90bb78" integrity sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA== -"@types/node-forge@^1.3.0": - version "1.3.14" - resolved "https://registry.yarnpkg.com/@types/node-forge/-/node-forge-1.3.14.tgz#006c2616ccd65550560c2757d8472eb6d3ecea0b" - integrity sha512-mhVF2BnD4BO+jtOp7z1CdzaK4mbuK0LLQYAvdOLqHTavxFNq4zA1EmYkpnFjP8HOUzedfQkRnp0E2ulSAYSzAw== - dependencies: - "@types/node" "*" - "@types/node@*": - version "24.5.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.5.2.tgz#52ceb83f50fe0fcfdfbd2a9fab6db2e9e7ef6446" - integrity sha512-FYxk1I7wPv3K2XBaoyH2cTnocQEu8AOZ60hPbsyukMPLv5/5qr7V1i8PLHdl6Zf87I+xZXFvPCXYjiTFq+YSDQ== + version "26.1.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-26.1.1.tgz#bad758d601e97d6cf457d204ee76a35fce7bd119" + integrity sha512-nxAkRSVkN1Y0JC1W8ky/fTfkGsMmcrRsbx+3XoZE+rMOX71kLYTV7fLXpqud1GpbpP5TuffXFqfX7fH2GgZREw== dependencies: - undici-types "~7.12.0" + undici-types "~8.3.0" "@types/node@^17.0.5": version "17.0.45" @@ -2655,9 +3747,9 @@ integrity sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw== "@types/prismjs@^1.26.0": - version "1.26.5" - resolved "https://registry.yarnpkg.com/@types/prismjs/-/prismjs-1.26.5.tgz#72499abbb4c4ec9982446509d2f14fb8483869d6" - integrity sha512-AUZTa7hQ2KY5L7AmtSiqxlhWxb4ina0yd8hNbl4TWuqnv/pFP0nDMb3YrfSBf4hJVGLh2YEIBfKaBW/9UEl6IQ== + version "1.26.6" + resolved "https://registry.yarnpkg.com/@types/prismjs/-/prismjs-1.26.6.tgz#6ea27c126d645319ae4f7055eda63a9e835c0187" + integrity sha512-vqlvI7qlMvcCBbVe0AKAb4f97//Hy0EBTaiW8AalRnG/xAN5zOiWWyrNqNXeq8+KAuvRewjCVY1+IPxk4RdNYw== "@types/prop-types@^15.7.15": version "15.7.15" @@ -2665,9 +3757,9 @@ integrity sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw== "@types/qs@*": - version "6.14.0" - resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.14.0.tgz#d8b60cecf62f2db0fb68e5e006077b9178b85de5" - integrity sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ== + version "6.15.1" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.15.1.tgz#8606884272c63f0db96986bd3548650d8a9388bf" + integrity sha512-GZHUBZR9hckSUhrxmp1nG6NwdpM9fCunJwyThLW1X3AyHgd9IlHb6VANpQQqDr2o/qQp6McZ3y/IA2rVzKzSbw== "@types/range-parser@*": version "1.2.7" @@ -2706,16 +3798,16 @@ integrity sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w== "@types/react@*": - version "19.1.13" - resolved "https://registry.yarnpkg.com/@types/react/-/react-19.1.13.tgz#fc650ffa680d739a25a530f5d7ebe00cdd771883" - integrity sha512-hHkbU/eoO3EG5/MZkuFSKmYqPbSVk5byPFa3e7y/8TybHiLMACgI8seVYlicwk7H5K/rI2px9xrQp/C+AUDTiQ== + version "19.2.17" + resolved "https://registry.yarnpkg.com/@types/react/-/react-19.2.17.tgz#dccac365baa0f1734ec270ff4b51c89465e8dc7f" + integrity sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw== dependencies: - csstype "^3.0.2" + csstype "^3.2.2" -"@types/retry@0.12.0": - version "0.12.0" - resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.0.tgz#2b35eccfcee7d38cd72ad99232fbd58bffb3c84d" - integrity sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA== +"@types/retry@0.12.2": + version "0.12.2" + resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.2.tgz#ed279a64fa438bb69f2480eda44937912bb7480a" + integrity sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow== "@types/sax@^1.2.1": version "1.2.7" @@ -2725,36 +3817,56 @@ "@types/node" "*" "@types/send@*": - version "0.17.5" - resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.5.tgz#d991d4f2b16f2b1ef497131f00a9114290791e74" - integrity sha512-z6F2D3cOStZvuk2SaP6YrwkNO65iTZcwA2ZkSABegdkAh/lf+Aa/YQndZVfmEXT5vgAp6zv06VQ3ejSVjAny4w== + version "1.2.1" + resolved "https://registry.yarnpkg.com/@types/send/-/send-1.2.1.tgz#6a784e45543c18c774c049bff6d3dbaf045c9c74" + integrity sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ== + dependencies: + "@types/node" "*" + +"@types/send@<1": + version "0.17.6" + resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.6.tgz#aeb5385be62ff58a52cd5459daa509ae91651d25" + integrity sha512-Uqt8rPBE8SY0RK8JB1EzVOIZ32uqy8HwdxCnoCOsYrvnswqmFZ/k+9Ikidlk/ImhsdvBsloHbAlewb2IEBV/Og== dependencies: "@types/mime" "^1" "@types/node" "*" -"@types/serve-index@^1.9.1": +"@types/serve-index@^1.9.4": version "1.9.4" resolved "https://registry.yarnpkg.com/@types/serve-index/-/serve-index-1.9.4.tgz#e6ae13d5053cb06ed36392110b4f9a49ac4ec898" integrity sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug== dependencies: "@types/express" "*" -"@types/serve-static@*", "@types/serve-static@^1.13.10": - version "1.15.8" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.8.tgz#8180c3fbe4a70e8f00b9f70b9ba7f08f35987877" - integrity sha512-roei0UY3LhpOJvjbIP6ZZFngyLKl5dskOtDhxY5THRSpO+ZI+nzJ+m5yUMzGrp89YRa7lvknKkMYjqQFGwA7Sg== +"@types/serve-static@^1", "@types/serve-static@^1.15.5": + version "1.15.10" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.10.tgz#768169145a778f8f5dfcb6360aead414a3994fee" + integrity sha512-tRs1dB+g8Itk72rlSI2ZrW6vZg0YrLI81iQSTkMmOqnqCaNr/8Ek4VwWcN5vZgCYWbg/JJSGBlUaYGAOP73qBw== + dependencies: + "@types/http-errors" "*" + "@types/node" "*" + "@types/send" "<1" + +"@types/serve-static@^2": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-2.2.0.tgz#d4a447503ead0d1671132d1ab6bd58b805d8de6a" + integrity sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ== dependencies: "@types/http-errors" "*" "@types/node" "*" - "@types/send" "*" -"@types/sockjs@^0.3.33": +"@types/sockjs@^0.3.36": version "0.3.36" resolved "https://registry.yarnpkg.com/@types/sockjs/-/sockjs-0.3.36.tgz#ce322cf07bcc119d4cbf7f88954f3a3bd0f67535" integrity sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q== dependencies: "@types/node" "*" +"@types/trusted-types@^2.0.7": + version "2.0.7" + resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.7.tgz#baccb07a970b91707df3a3e8ba6896c57ead2d11" + integrity sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw== + "@types/unist@*", "@types/unist@^3.0.0": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/unist/-/unist-3.0.3.tgz#acaab0f919ce69cce629c2d4ed2eb4adc1b6c20c" @@ -2765,7 +3877,7 @@ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.11.tgz#11af57b127e32487774841f7a4e54eab166d03c4" integrity sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA== -"@types/ws@^8.5.5": +"@types/ws@^8.5.10": version "8.18.1" resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.18.1.tgz#48464e4bf2ddfd17db13d845467f6070ffea4aa9" integrity sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg== @@ -2778,16 +3890,24 @@ integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== "@types/yargs@^17.0.8": - version "17.0.33" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.33.tgz#8c32303da83eec050a84b3c7ae7b9f922d13e32d" - integrity sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA== + version "17.0.35" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.35.tgz#07013e46aa4d7d7d50a49e15604c1c5340d4eb24" + integrity sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg== dependencies: "@types/yargs-parser" "*" -"@ungap/structured-clone@^1.0.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.3.0.tgz#d06bbb384ebcf6c505fde1c3d0ed4ddffe0aaff8" - integrity sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g== +"@ungap/structured-clone@^1.0.0", "@ungap/structured-clone@^1.3.1": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.3.2.tgz#a03ad82cd5676414d068ba86f880c5681194aadf" + integrity sha512-5jsZFwgR5rTdKwidH9Qmat75RKwqfpKlWWB1frDkljN127mwqBu8K0PYo7/hFpF03IEJpfVPpCQDY/eDx3iHvA== + +"@upsetjs/venn.js@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@upsetjs/venn.js/-/venn.js-2.0.0.tgz#3be192038cdda927aa4f8b22ab51af82abf47f34" + integrity sha512-WbBhLrooyePuQ1VZxrJjtLvTc4NVfpOyKx0sKqioq9bX1C1m7Jgykkn8gLrtwumBioXIqam8DLxp88Adbue6Hw== + optionalDependencies: + d3-selection "^3.0.0" + d3-transition "^3.0.1" "@webassemblyjs/ast@1.14.1", "@webassemblyjs/ast@^1.14.1": version "1.14.1" @@ -2920,7 +4040,7 @@ resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== -accepts@~1.3.4, accepts@~1.3.8: +accepts@~1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== @@ -2939,21 +4059,21 @@ acorn-jsx@^5.0.0: integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn-walk@^8.0.0: - version "8.3.4" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" - integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== + version "8.3.5" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.5.tgz#8a6b8ca8fc5b34685af15dabb44118663c296496" + integrity sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw== dependencies: acorn "^8.11.0" -acorn@^8.0.0, acorn@^8.0.4, acorn@^8.11.0, acorn@^8.15.0: - version "8.15.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" - integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== +acorn@^8.0.0, acorn@^8.0.4, acorn@^8.11.0, acorn@^8.15.0, acorn@^8.16.0: + version "8.17.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.17.0.tgz#1785adb84faf8d8add10369b93826fc2bd08f1fe" + integrity sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg== -address@^1.0.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/address/-/address-1.2.2.tgz#2b5248dac5485a6390532c6a517fda2e3faac89e" - integrity sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA== +address@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/address/-/address-2.0.3.tgz#e910900615db3d8a20c040d4c710631062fc4ba8" + integrity sha512-XNAb/a6TCqou+TufU8/u11HCu9x1gYvOoxLwtlXgIqmkrYQADVv6ljyW2zwiPhHz9R1gItAWpuDrdJMmrOBFEA== aggregate-error@^3.0.0: version "3.1.0" @@ -2983,9 +4103,9 @@ ajv-keywords@^5.1.0: fast-deep-equal "^3.1.3" ajv@^6.12.5: - version "6.12.6" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" - integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + version "6.15.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.15.0.tgz#07e982c74626167aa7a2495c53817892d7139492" + integrity sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw== dependencies: fast-deep-equal "^3.1.1" fast-json-stable-stringify "^2.0.0" @@ -2993,41 +4113,41 @@ ajv@^6.12.5: uri-js "^4.2.2" ajv@^8.0.0, ajv@^8.9.0: - version "8.17.1" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" - integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== + version "8.20.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.20.0.tgz#304b3636add88ba7d936760dd50ece006dea95f9" + integrity sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA== dependencies: fast-deep-equal "^3.1.3" fast-uri "^3.0.1" json-schema-traverse "^1.0.0" require-from-string "^2.0.2" -algoliasearch-helper@^3.22.6: - version "3.26.0" - resolved "https://registry.yarnpkg.com/algoliasearch-helper/-/algoliasearch-helper-3.26.0.tgz#d6e283396a9fc5bf944f365dc3b712570314363f" - integrity sha512-Rv2x3GXleQ3ygwhkhJubhhYGsICmShLAiqtUuJTUkr9uOCOXyF2E71LVT4XDnVffbknv8XgScP4U0Oxtgm+hIw== +algoliasearch-helper@^3.26.0: + version "3.29.2" + resolved "https://registry.yarnpkg.com/algoliasearch-helper/-/algoliasearch-helper-3.29.2.tgz#ceb699ae6ec9bb088f8a2b781b66868222e9c23a" + integrity sha512-SaV+rZM3drExb0punEYYjT+sNcH74YFwN8ocjya7IDOyQvKWeQpEaSMVG3+IGTVos+feuatj7ljQ4BXlXdUp3w== dependencies: "@algolia/events" "^4.0.1" -algoliasearch@^5.14.2, algoliasearch@^5.17.1: - version "5.37.0" - resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-5.37.0.tgz#73dc4a09654e6e02b529300018d639706b95b47b" - integrity sha512-y7gau/ZOQDqoInTQp0IwTOjkrHc4Aq4R8JgpmCleFwiLl+PbN2DMWoDUWZnrK8AhNJwT++dn28Bt4NZYNLAmuA== - dependencies: - "@algolia/abtesting" "1.3.0" - "@algolia/client-abtesting" "5.37.0" - "@algolia/client-analytics" "5.37.0" - "@algolia/client-common" "5.37.0" - "@algolia/client-insights" "5.37.0" - "@algolia/client-personalization" "5.37.0" - "@algolia/client-query-suggestions" "5.37.0" - "@algolia/client-search" "5.37.0" - "@algolia/ingestion" "1.37.0" - "@algolia/monitoring" "1.37.0" - "@algolia/recommend" "5.37.0" - "@algolia/requester-browser-xhr" "5.37.0" - "@algolia/requester-fetch" "5.37.0" - "@algolia/requester-node-http" "5.37.0" +algoliasearch@^5.37.0: + version "5.55.2" + resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-5.55.2.tgz#5aa9426faedfa63c6433e6ba78b1843c8208e012" + integrity sha512-OyacJsaeuLUvGWOynNqYc6sx88XvyoG39wMT8SYqL3l9wwaorDW/LPRbUPfhzw0bWsUWzNCZTnFYOrWFBKsUaw== + dependencies: + "@algolia/abtesting" "1.21.2" + "@algolia/client-abtesting" "5.55.2" + "@algolia/client-analytics" "5.55.2" + "@algolia/client-common" "5.55.2" + "@algolia/client-insights" "5.55.2" + "@algolia/client-personalization" "5.55.2" + "@algolia/client-query-suggestions" "5.55.2" + "@algolia/client-search" "5.55.2" + "@algolia/ingestion" "1.55.2" + "@algolia/monitoring" "1.55.2" + "@algolia/recommend" "5.55.2" + "@algolia/requester-browser-xhr" "5.55.2" + "@algolia/requester-fetch" "5.55.2" + "@algolia/requester-node-http" "5.55.2" ansi-align@^3.0.1: version "3.0.1" @@ -3036,13 +4156,6 @@ ansi-align@^3.0.1: dependencies: string-width "^4.1.0" -ansi-escapes@^4.3.2: - version "4.3.2" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" - integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== - dependencies: - type-fest "^0.21.3" - ansi-html-community@^0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/ansi-html-community/-/ansi-html-community-0.0.8.tgz#69fbc4d6ccbe383f9736934ae34c3f8290f1bf41" @@ -3053,12 +4166,12 @@ ansi-regex@^5.0.1: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== -ansi-regex@^6.0.1: +ansi-regex@^6.2.2: version "6.2.2" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.2.2.tgz#60216eea464d864597ce2832000738a0589650c1" integrity sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg== -ansi-styles@^4.0.0, ansi-styles@^4.1.0: +ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== @@ -3070,6 +4183,11 @@ ansi-styles@^6.1.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.3.tgz#c044d5dcc521a076413472597a1acb1f103c4041" integrity sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg== +ansis@^3.2.0: + version "3.17.0" + resolved "https://registry.yarnpkg.com/ansis/-/ansis-3.17.0.tgz#fa8d9c2a93fe7d1177e0c17f9eeb562a58a832d7" + integrity sha512-0qWUglt9JEqLFr3w1I1pbrChn1grhaiAR2ocX1PP/flRmxgtwTzPFFFnfIlD6aMOLQZgSuCRlidD70lvx8yhzg== + anymatch@~3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" @@ -3083,13 +4201,6 @@ arg@^5.0.0: resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c" integrity sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg== -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - dependencies: - sprintf-js "~1.0.2" - argparse@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" @@ -3105,20 +4216,28 @@ array-union@^2.1.0: resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== +asn1js@^3.0.10, asn1js@^3.0.6: + version "3.0.10" + resolved "https://registry.yarnpkg.com/asn1js/-/asn1js-3.0.10.tgz#df26c874c8a8b41ca605efea47b2ad07551013dd" + integrity sha512-S2s3aOytiKdFRdulw2qPE51MzjzVOisppcVv7jVFR+Kw0kxwvFrDcYA0h7Ndqbmj0HkMIXYWaoj7fli8kgx1eg== + dependencies: + pvtsutils "^1.3.6" + pvutils "^1.1.5" + tslib "^2.8.1" + astring@^1.8.0: version "1.9.0" resolved "https://registry.yarnpkg.com/astring/-/astring-1.9.0.tgz#cc73e6062a7eb03e7d19c22d8b0b3451fd9bfeef" integrity sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg== -autoprefixer@^10.4.19, autoprefixer@^10.4.21: - version "10.4.21" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.21.tgz#77189468e7a8ad1d9a37fbc08efc9f480cf0a95d" - integrity sha512-O+A6LWV5LDHSJD3LjHYoNi4VLsj/Whi7k6zG12xTYaU4cQ8oxQGckXNX8cRHK5yOZ/ppVHe0ZBXGzSV9jXdVbQ== +autoprefixer@^10.4.19, autoprefixer@^10.4.23: + version "10.5.2" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.5.2.tgz#5d7dcaab1c294038fe51e0fa3738d28e559caac0" + integrity sha512-rD5t5DwOjJdmSORcTq64j8MawTC+tbQ+HHqjR4NDumamy/ambn1UJrlKL+KdwujWxMkFjPM3pPHOEA9tl4767Q== dependencies: - browserslist "^4.24.4" - caniuse-lite "^1.0.30001702" - fraction.js "^4.3.7" - normalize-range "^0.1.2" + browserslist "^4.28.4" + caniuse-lite "^1.0.30001799" + fraction.js "^5.3.4" picocolors "^1.1.1" postcss-value-parser "^4.2.0" @@ -3146,13 +4265,13 @@ babel-plugin-macros@^3.1.0: cosmiconfig "^7.0.0" resolve "^1.19.0" -babel-plugin-polyfill-corejs2@^0.4.14: - version "0.4.14" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.14.tgz#8101b82b769c568835611542488d463395c2ef8f" - integrity sha512-Co2Y9wX854ts6U8gAAPXfn0GmAyctHuK8n0Yhfjd6t30g7yvKjspvvOo9yG+z52PZRgFErt7Ka2pYnXCjLKEpg== +babel-plugin-polyfill-corejs2@^0.4.14, babel-plugin-polyfill-corejs2@^0.4.15: + version "0.4.17" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.17.tgz#198f970f1c99a856b466d1187e88ce30bd199d91" + integrity sha512-aTyf30K/rqAsNwN76zYrdtx8obu0E4KoUME29B1xj+B3WxgvWkp943vYQ+z8Mv3lw9xHXMHpvSPOBxzAkIa94w== dependencies: - "@babel/compat-data" "^7.27.7" - "@babel/helper-define-polyfill-provider" "^0.6.5" + "@babel/compat-data" "^7.28.6" + "@babel/helper-define-polyfill-provider" "^0.6.8" semver "^6.3.1" babel-plugin-polyfill-corejs3@^0.13.0: @@ -3163,12 +4282,20 @@ babel-plugin-polyfill-corejs3@^0.13.0: "@babel/helper-define-polyfill-provider" "^0.6.5" core-js-compat "^3.43.0" -babel-plugin-polyfill-regenerator@^0.6.5: - version "0.6.5" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.5.tgz#32752e38ab6f6767b92650347bf26a31b16ae8c5" - integrity sha512-ISqQ2frbiNU9vIJkzg7dlPpznPZ4jOiUQ1uSmB0fEHeowtN3COYRsXr/xexn64NpU13P06jc/L5TgiJXOgrbEg== +babel-plugin-polyfill-corejs3@^0.14.0: + version "0.14.2" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.14.2.tgz#6ac08d2f312affb70c4c69c0fbba4cb417ee5587" + integrity sha512-coWpDLJ410R781Npmn/SIBZEsAetR4xVi0SxLMXPaMO4lSf1MwnkGYMtkFxew0Dn8B3/CpbpYxN0JCgg8mn67g== dependencies: - "@babel/helper-define-polyfill-provider" "^0.6.5" + "@babel/helper-define-polyfill-provider" "^0.6.8" + core-js-compat "^3.48.0" + +babel-plugin-polyfill-regenerator@^0.6.5, babel-plugin-polyfill-regenerator@^0.6.6: + version "0.6.8" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.8.tgz#8a6bfd5dd54239362b3d06ce47ac52b2d95d7721" + integrity sha512-M762rNHfSF1EV3SLtnCJXFoQbbIIz0OyRwnCmV0KPC7qosSfCO0QLTSuJX3ayAebubhE6oYBAYPrBA5ljowaZg== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.6.8" bail@^2.0.0: version "2.0.2" @@ -3180,10 +4307,15 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -baseline-browser-mapping@^2.8.3: - version "2.8.5" - resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.8.5.tgz#3147fe6b01a0c49ce1952daebcfc2057fc43fedb" - integrity sha512-TiU4qUT9jdCuh4aVOG7H1QozyeI2sZRqoRPdqBIaslfNt4WUSanRBueAwl2x5jt4rXBMim3lIN2x6yT8PDi24Q== +balanced-match@^4.0.2: + version "4.0.4" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-4.0.4.tgz#bfb10662feed8196a2c62e7c68e17720c274179a" + integrity sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA== + +baseline-browser-mapping@^2.10.42: + version "2.10.42" + resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.10.42.tgz#195dcc76baa269a497f0b07decace169fee9ac58" + integrity sha512-c/jurFrDLyui7o1J86yLkRu4LMsTYcBohveus7/I2Hzdn9KIP2bdJPTue/lR1KH46enoPbD77GKeSYNdyPoD3Q== batch@0.6.1: version "0.6.1" @@ -3200,28 +4332,28 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== -body-parser@1.20.3: - version "1.20.3" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.3.tgz#1953431221c6fb5cd63c4b36d53fab0928e548c6" - integrity sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g== +body-parser@~1.20.5: + version "1.20.5" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.5.tgz#303c8c34423d1d6fa799bc764e93c1e4dc6ebf64" + integrity sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA== dependencies: - bytes "3.1.2" + bytes "~3.1.2" content-type "~1.0.5" debug "2.6.9" depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.13.0" - raw-body "2.5.2" + destroy "~1.2.0" + http-errors "~2.0.1" + iconv-lite "~0.4.24" + on-finished "~2.4.1" + qs "~6.15.1" + raw-body "~2.5.3" type-is "~1.6.18" - unpipe "1.0.0" + unpipe "~1.0.0" -bonjour-service@^1.0.11: - version "1.3.0" - resolved "https://registry.yarnpkg.com/bonjour-service/-/bonjour-service-1.3.0.tgz#80d867430b5a0da64e82a8047fc1e355bdb71722" - integrity sha512-3YuAUiSkWykd+2Azjgyxei8OWf8thdn8AITIog2M4UICzoqfjlqr64WIjEXZllf/W6vK1goqleSR6brGomxQqA== +bonjour-service@^1.2.1: + version "1.4.2" + resolved "https://registry.yarnpkg.com/bonjour-service/-/bonjour-service-1.4.2.tgz#33ce18eddf13047e5eeb08939018b20bae1a1473" + integrity sha512-lMskhnsW70yWHr4PhPeh2rvaIkLSaDpp+nmtbXBZaNKTXwxL73QOkW6HhbzqTImXjevn9TreGT4GACGBCGP9nQ== dependencies: fast-deep-equal "^3.1.3" multicast-dns "^7.2.5" @@ -3260,13 +4392,20 @@ boxen@^7.0.0: wrap-ansi "^8.1.0" brace-expansion@^1.1.7: - version "1.1.12" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843" - integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg== + version "1.1.16" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.16.tgz#723d3a30c0558c225abc9fc479a73e14e26c3c2f" + integrity sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" +brace-expansion@^5.0.5: + version "5.0.7" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-5.0.7.tgz#1b0e46965b479dad65af737b4a02790a05498337" + integrity sha512-7oFy703dxfY3/NLxC1fh2SUCQ0H9rmAY+5EpDVfXjUTTs+HEwR2nYaqLv+GWcTsumwxPfiz6CzCNkwXwBUwqCA== + dependencies: + balanced-match "^4.0.2" + braces@^3.0.3, braces@~3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" @@ -3274,32 +4413,44 @@ braces@^3.0.3, braces@~3.0.2: dependencies: fill-range "^7.1.1" -browserslist@^4.0.0, browserslist@^4.23.0, browserslist@^4.24.0, browserslist@^4.24.4, browserslist@^4.25.1, browserslist@^4.25.3: - version "4.26.2" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.26.2.tgz#7db3b3577ec97f1140a52db4936654911078cef3" - integrity sha512-ECFzp6uFOSB+dcZ5BK/IBaGWssbSYBHvuMeMt3MMFyhI0Z8SqGgEkBLARgpRH3hutIgPVsALcMwbDrJqPxQ65A== +browserslist@^4.0.0, browserslist@^4.23.0, browserslist@^4.24.0, browserslist@^4.24.2, browserslist@^4.28.1, browserslist@^4.28.4: + version "4.28.5" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.28.5.tgz#438b7d38c0d4b47740bbb36778d5bdca01b37838" + integrity sha512-Cu2E6QejHWzuDMTkuwgpABFgDfZrXLQq5V13YOACZx4mFAG4IwGTbTfHPMr4WtxlHoXSM8FIuRwYYCz5XiabaQ== dependencies: - baseline-browser-mapping "^2.8.3" - caniuse-lite "^1.0.30001741" - electron-to-chromium "^1.5.218" - node-releases "^2.0.21" - update-browserslist-db "^1.1.3" + baseline-browser-mapping "^2.10.42" + caniuse-lite "^1.0.30001800" + electron-to-chromium "^1.5.387" + node-releases "^2.0.50" + update-browserslist-db "^1.2.3" buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +bundle-name@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/bundle-name/-/bundle-name-4.1.0.tgz#f3b96b34160d6431a19d7688135af7cfb8797889" + integrity sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q== + dependencies: + run-applescript "^7.0.0" + bytes@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" integrity sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw== -bytes@3.1.2: +bytes@3.1.2, bytes@~3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== +bytestreamjs@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/bytestreamjs/-/bytestreamjs-2.0.1.tgz#a32947c7ce389a6fa11a09a9a563d0a45889535e" + integrity sha512-U1Z/ob71V/bXfVABvNr/Kumf5VyeQRBEm6Txb0PQ6S7V5GpBM3w4Cbqz/xPDicR5tN0uvDifng8C+5qECeGwyQ== + cacheable-lookup@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz#3476a8215d046e5a3202a9209dd13fec1f933a27" @@ -3318,7 +4469,7 @@ cacheable-request@^10.2.8: normalize-url "^8.0.0" responselike "^3.0.0" -call-bind-apply-helpers@^1.0.0, call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: +call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== @@ -3327,13 +4478,13 @@ call-bind-apply-helpers@^1.0.0, call-bind-apply-helpers@^1.0.1, call-bind-apply- function-bind "^1.1.2" call-bind@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.8.tgz#0736a9660f537e3388826f440d5ec45f744eaa4c" - integrity sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww== + version "1.0.9" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.9.tgz#39a644700c80bc7d0ca9102fc6d1d43b2fd7eee7" + integrity sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ== dependencies: - call-bind-apply-helpers "^1.0.0" - es-define-property "^1.0.0" - get-intrinsic "^1.2.4" + call-bind-apply-helpers "^1.0.2" + es-define-property "^1.0.1" + get-intrinsic "^1.3.0" set-function-length "^1.2.2" call-bound@^1.0.2, call-bound@^1.0.3: @@ -3377,10 +4528,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001702, caniuse-lite@^1.0.30001741: - version "1.0.30001743" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001743.tgz#50ff91a991220a1ee2df5af00650dd5c308ea7cd" - integrity sha512-e6Ojr7RV14Un7dz6ASD0aZDmQPT/A+eZU+nuTNfjqmRrmkmQlnTNWH0SKmqagx9PeW87UVqapSurtAXifmtdmw== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001799, caniuse-lite@^1.0.30001800: + version "1.0.30001803" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001803.tgz#b2a5d696e042bc8304dcd4942c39fe330fbbcb24" + integrity sha512-g/uHREV2ZpK9qMalCsWaxmA6ol+DX8GYhuf3T40RKoP+oL7vhRJh8LNt73PCjpnR6l14FzfPrB5Yux4PKm2meg== ccount@^2.0.0: version "2.0.1" @@ -3450,7 +4601,7 @@ cheerio@1.0.0-rc.12: parse5 "^7.0.0" parse5-htmlparser2-tree-adapter "^7.0.0" -chokidar@^3.5.3: +chokidar@^3.5.3, chokidar@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== @@ -3536,11 +4687,27 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@~1.1.4: +color-name@^1.0.0, color-name@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +color-string@^1.9.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.9.1.tgz#4467f9146f036f855b764dfb5bf8582bf342c7a4" + integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg== + dependencies: + color-name "^1.0.0" + simple-swizzle "^0.2.2" + +color@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/color/-/color-4.2.3.tgz#d781ecb5e57224ee43ea9627560107c0e0c6463a" + integrity sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A== + dependencies: + color-convert "^2.0.1" + color-string "^1.9.0" + colord@^2.9.3: version "2.9.3" resolved "https://registry.yarnpkg.com/colord/-/colord-2.9.3.tgz#4f8ce919de456f1d5c1c368c307fe20f3e59fb43" @@ -3561,6 +4728,11 @@ comma-separated-tokens@^2.0.0: resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz#4e89c9458acb61bc8fef19f4529973b2392839ee" integrity sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg== +commander@7, commander@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" + integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== + commander@^10.0.0: version "10.0.1" resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" @@ -3576,11 +4748,6 @@ commander@^5.1.0: resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== -commander@^7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" - integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== - commander@^8.3.0: version "8.3.0" resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" @@ -3598,7 +4765,7 @@ compressible@~2.0.18: dependencies: mime-db ">= 1.43.0 < 2" -compression@^1.7.4: +compression@^1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/compression/-/compression-1.8.1.tgz#4a45d909ac16509195a9a28bd91094889c180d79" integrity sha512-9mAqGPHLakhCLeNyxPkK4xVo746zQ/czLH1Ky+vkitMnWfWZps8r0qXuwhwizagCRttsL4lfG4pIOvaWLpAP0w== @@ -3650,7 +4817,7 @@ content-disposition@0.5.2: resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" integrity sha512-kRGRZw3bLlFISDBgwTSA1TMBFN6J6GWDeubmDE3AF+3+yXL8hTWv8r5rkLbqYXY4RjPk/EzHnClI3zQf1cFmHA== -content-disposition@0.5.4: +content-disposition@~0.5.4: version "0.5.4" resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== @@ -3672,20 +4839,20 @@ convert-source-map@^2.0.0: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== +cookie-signature@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.7.tgz#ab5dd7ab757c54e60f37ef6550f481c426d10454" + integrity sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA== -cookie@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.1.tgz#2f73c42142d5d5cf71310a74fc4ae61670e5dbc9" - integrity sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w== +cookie@~0.7.1: + version "0.7.2" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.2.tgz#556369c472a2ba910f2979891b526b3436237ed7" + integrity sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w== copy-text-to-clipboard@^3.2.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.2.1.tgz#01c3656d6c81a6aa713aa0a8d361214a1eeac6ae" - integrity sha512-3am6cw+WOicd0+HyzhC4kYS02wHJUiVQXmAADxfUARKsHBkWl1Vl3QQEiILlSs8YcPS/C0+y/urCNEYQk+byWA== + version "3.2.2" + resolved "https://registry.yarnpkg.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.2.2.tgz#99bc79db3f2d355ec33a08d573aff6804491ddb9" + integrity sha512-T6SqyLd1iLuqPA90J5N4cTalrtovCySh58iiZDGJ6FGznbclKh4UI+FGacQSgFzwKG77W7XT5gwbVEbd9cIH1A== copy-webpack-plugin@^11.0.0: version "11.0.0" @@ -3699,28 +4866,37 @@ copy-webpack-plugin@^11.0.0: schema-utils "^4.0.0" serialize-javascript "^6.0.0" -core-js-compat@^3.43.0: - version "3.45.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.45.1.tgz#424f3f4af30bf676fd1b67a579465104f64e9c7a" - integrity sha512-tqTt5T4PzsMIZ430XGviK4vzYSoeNJ6CXODi6c/voxOT6IZqBht5/EKaSNnYiEjjRYxjVz7DQIsOsY0XNi8PIA== +core-js-compat@^3.43.0, core-js-compat@^3.48.0: + version "3.49.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.49.0.tgz#06145447d92f4aaf258a0c44f24b47afaeaffef6" + integrity sha512-VQXt1jr9cBz03b331DFDCCP90b3fanciLkgiOoy8SBHy06gNf+vQ1A3WFLqG7I8TipYIKeYK9wxd0tUrvHcOZA== dependencies: - browserslist "^4.25.3" - -core-js-pure@^3.43.0: - version "3.45.1" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.45.1.tgz#b129d86a5f7f8380378577c7eaee83608570a05a" - integrity sha512-OHnWFKgTUshEU8MK+lOs1H8kC8GkTi9Z1tvNkxrCcw9wl3MJIO7q2ld77wjWn4/xuGrVu2X+nME1iIIPBSdyEQ== + browserslist "^4.28.1" core-js@^3.31.1: - version "3.45.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.45.1.tgz#5810e04a1b4e9bc5ddaa4dd12e702ff67300634d" - integrity sha512-L4NPsJlCfZsPeXukyzHFlg/i7IIVwHSItR0wg0FLNqYClJ4MQYTYLbC7EkjKYRLZF2iof2MUgN0EGy7MdQFChg== + version "3.49.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.49.0.tgz#8b4d520ac034311fa21aa616f017ada0e0dbbddd" + integrity sha512-es1U2+YTtzpwkxVLwAFdSpaIMyQaq0PBgm3YD1W3Qpsn1NAmO3KSgZfu+oGSWVu6NvLHoHCV/aYcsE5wiB7ALg== core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== +cose-base@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/cose-base/-/cose-base-1.0.3.tgz#650334b41b869578a543358b80cda7e0abe0a60a" + integrity sha512-s9whTXInMSgAp/NVXVNuVxVKzGH2qck3aQlVHxDCdAEPgtMKwc4Wq6/QKhgdEdgbLSi9rBTAcPoRa6JpiG4ksg== + dependencies: + layout-base "^1.0.0" + +cose-base@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cose-base/-/cose-base-2.2.0.tgz#1c395c35b6e10bb83f9769ca8b817d614add5c01" + integrity sha512-AzlgcsCbUMymkADOJtQm3wO9S3ltPfYOFD5033keQn9NJzIbtnZj+UdBJe7DYml/8TdbtHJW3j58SOnKhWY/5g== + dependencies: + layout-base "^2.0.0" + cosmiconfig@^7.0.0: version "7.1.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.1.0.tgz#1443b9afa596b670082ea46cbd8f6a62b84635f6" @@ -3766,9 +4942,9 @@ css-blank-pseudo@^7.0.1: postcss-selector-parser "^7.0.0" css-declaration-sorter@^7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/css-declaration-sorter/-/css-declaration-sorter-7.2.0.tgz#6dec1c9523bc4a643e088aab8f09e67a54961024" - integrity sha512-h70rUM+3PNFuaBDTLe8wF/cdWu+dOZmb7pJt8Z2sedYbAcQVQV/tEchueg3GWxwqS0cxtbxmaHEdkNACqcvsow== + version "7.4.0" + resolved "https://registry.yarnpkg.com/css-declaration-sorter/-/css-declaration-sorter-7.4.0.tgz#9c215fbda2dcf4083bae69f125688158ae847deb" + integrity sha512-LTuzjPoyA2vMGKKcaOqKSp7Ub2eGrNfKiZH4LpezxpNrsICGCSFvsQOI29psISxNZtaXibkC2CXzrQ5enMeGGw== css-has-pseudo@^7.0.3: version "7.0.3" @@ -3853,10 +5029,10 @@ css-what@^6.0.1, css-what@^6.1.0: resolved "https://registry.yarnpkg.com/css-what/-/css-what-6.2.2.tgz#cdcc8f9b6977719fdfbd1de7aec24abf756b9dea" integrity sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA== -cssdb@^8.4.0: - version "8.4.0" - resolved "https://registry.yarnpkg.com/cssdb/-/cssdb-8.4.0.tgz#232a1aa7751983ed2b40331634902d4c93f0456c" - integrity sha512-lyATYGyvXwQ8h55WeQeEHXhI+47rl52pXSYkFK/ZrCbAJSgVIaPFjYc3RM8TpRHKk7W3wsAZImmLps+P5VyN9g== +cssdb@^8.6.0: + version "8.9.0" + resolved "https://registry.yarnpkg.com/cssdb/-/cssdb-8.9.0.tgz#e24d44824895957a4a5c75ba72c910f94e7aed77" + integrity sha512-J8jOU/hLjaXcO1LldOLraJSQpfLXRKof0I7mtbRyOy2AAXgqst0x9rlgi2qXeD6d0ou3ZLqcPAMqYVbpCbrxEw== cssesc@^3.0.0: version "3.0.0" @@ -3932,10 +5108,313 @@ csso@^5.0.5: dependencies: css-tree "~2.2.0" -csstype@^3.0.2, csstype@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81" - integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw== +csstype@^3.0.2, csstype@^3.2.2, csstype@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.2.3.tgz#ec48c0f3e993e50648c86da559e2610995cf989a" + integrity sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ== + +cytoscape-cose-bilkent@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cytoscape-cose-bilkent/-/cytoscape-cose-bilkent-4.1.0.tgz#762fa121df9930ffeb51a495d87917c570ac209b" + integrity sha512-wgQlVIUJF13Quxiv5e1gstZ08rnZj2XaLHGoFMYXz7SkNfCDOOteKBE6SYRfA9WxxI/iBc3ajfDoc6hb/MRAHQ== + dependencies: + cose-base "^1.0.0" + +cytoscape-fcose@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cytoscape-fcose/-/cytoscape-fcose-2.2.0.tgz#e4d6f6490df4fab58ae9cea9e5c3ab8d7472f471" + integrity sha512-ki1/VuRIHFCzxWNrsshHYPs6L7TvLu3DL+TyIGEsRcvVERmxokbf5Gdk7mFxZnTdiGtnA4cfSmjZJMviqSuZrQ== + dependencies: + cose-base "^2.2.0" + +cytoscape@^3.33.3: + version "3.34.0" + resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.34.0.tgz#5fbe2eb1cf76b070a8ecd5647c35f65aa097c9c6" + integrity sha512-62rNSrioXw93uliKFBwjukeQyeWwH2PqDrTac31r2P6464u3AUvTk0xS4LVvT251g7IgkFunrI48ZEZGjywSOg== + +"d3-array@1 - 2": + version "2.12.1" + resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-2.12.1.tgz#e20b41aafcdffdf5d50928004ececf815a465e81" + integrity sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ== + dependencies: + internmap "^1.0.0" + +"d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@3, d3-array@^3.2.0: + version "3.2.4" + resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-3.2.4.tgz#15fec33b237f97ac5d7c986dc77da273a8ed0bb5" + integrity sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg== + dependencies: + internmap "1 - 2" + +d3-axis@3: + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-axis/-/d3-axis-3.0.0.tgz#c42a4a13e8131d637b745fc2973824cfeaf93322" + integrity sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw== + +d3-brush@3: + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-brush/-/d3-brush-3.0.0.tgz#6f767c4ed8dcb79de7ede3e1c0f89e63ef64d31c" + integrity sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ== + dependencies: + d3-dispatch "1 - 3" + d3-drag "2 - 3" + d3-interpolate "1 - 3" + d3-selection "3" + d3-transition "3" + +d3-chord@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-chord/-/d3-chord-3.0.1.tgz#d156d61f485fce8327e6abf339cb41d8cbba6966" + integrity sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g== + dependencies: + d3-path "1 - 3" + +"d3-color@1 - 3", d3-color@3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-3.1.0.tgz#395b2833dfac71507f12ac2f7af23bf819de24e2" + integrity sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA== + +d3-contour@4: + version "4.0.2" + resolved "https://registry.yarnpkg.com/d3-contour/-/d3-contour-4.0.2.tgz#bb92063bc8c5663acb2422f99c73cbb6c6ae3bcc" + integrity sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA== + dependencies: + d3-array "^3.2.0" + +d3-delaunay@6: + version "6.0.4" + resolved "https://registry.yarnpkg.com/d3-delaunay/-/d3-delaunay-6.0.4.tgz#98169038733a0a5babbeda55054f795bb9e4a58b" + integrity sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A== + dependencies: + delaunator "5" + +"d3-dispatch@1 - 3", d3-dispatch@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-3.0.1.tgz#5fc75284e9c2375c36c839411a0cf550cbfc4d5e" + integrity sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg== + +"d3-drag@2 - 3", d3-drag@3: + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-drag/-/d3-drag-3.0.0.tgz#994aae9cd23c719f53b5e10e3a0a6108c69607ba" + integrity sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg== + dependencies: + d3-dispatch "1 - 3" + d3-selection "3" + +"d3-dsv@1 - 3", d3-dsv@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-3.0.1.tgz#c63af978f4d6a0d084a52a673922be2160789b73" + integrity sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q== + dependencies: + commander "7" + iconv-lite "0.6" + rw "1" + +"d3-ease@1 - 3", d3-ease@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-ease/-/d3-ease-3.0.1.tgz#9658ac38a2140d59d346160f1f6c30fda0bd12f4" + integrity sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w== + +d3-fetch@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-fetch/-/d3-fetch-3.0.1.tgz#83141bff9856a0edb5e38de89cdcfe63d0a60a22" + integrity sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw== + dependencies: + d3-dsv "1 - 3" + +d3-force@3: + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-force/-/d3-force-3.0.0.tgz#3e2ba1a61e70888fe3d9194e30d6d14eece155c4" + integrity sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg== + dependencies: + d3-dispatch "1 - 3" + d3-quadtree "1 - 3" + d3-timer "1 - 3" + +"d3-format@1 - 3", d3-format@3: + version "3.1.2" + resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-3.1.2.tgz#01fdb46b58beb1f55b10b42ad70b6e344d5eb2ae" + integrity sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg== + +d3-geo@3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/d3-geo/-/d3-geo-3.1.1.tgz#6027cf51246f9b2ebd64f99e01dc7c3364033a4d" + integrity sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q== + dependencies: + d3-array "2.5.0 - 3" + +d3-hierarchy@3: + version "3.1.2" + resolved "https://registry.yarnpkg.com/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz#b01cd42c1eed3d46db77a5966cf726f8c09160c6" + integrity sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA== + +"d3-interpolate@1 - 3", "d3-interpolate@1.2.0 - 3", d3-interpolate@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-3.0.1.tgz#3c47aa5b32c5b3dfb56ef3fd4342078a632b400d" + integrity sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g== + dependencies: + d3-color "1 - 3" + +d3-path@1: + version "1.0.9" + resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-1.0.9.tgz#48c050bb1fe8c262493a8caf5524e3e9591701cf" + integrity sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg== + +"d3-path@1 - 3", d3-path@3, d3-path@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-3.1.0.tgz#22df939032fb5a71ae8b1800d61ddb7851c42526" + integrity sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ== + +d3-polygon@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-polygon/-/d3-polygon-3.0.1.tgz#0b45d3dd1c48a29c8e057e6135693ec80bf16398" + integrity sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg== + +"d3-quadtree@1 - 3", d3-quadtree@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-3.0.1.tgz#6dca3e8be2b393c9a9d514dabbd80a92deef1a4f" + integrity sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw== + +d3-random@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-random/-/d3-random-3.0.1.tgz#d4926378d333d9c0bfd1e6fa0194d30aebaa20f4" + integrity sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ== + +d3-sankey@^0.12.3: + version "0.12.3" + resolved "https://registry.yarnpkg.com/d3-sankey/-/d3-sankey-0.12.3.tgz#b3c268627bd72e5d80336e8de6acbfec9d15d01d" + integrity sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ== + dependencies: + d3-array "1 - 2" + d3-shape "^1.2.0" + +d3-scale-chromatic@3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz#34c39da298b23c20e02f1a4b239bd0f22e7f1314" + integrity sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ== + dependencies: + d3-color "1 - 3" + d3-interpolate "1 - 3" + +d3-scale@4: + version "4.0.2" + resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-4.0.2.tgz#82b38e8e8ff7080764f8dcec77bd4be393689396" + integrity sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ== + dependencies: + d3-array "2.10.0 - 3" + d3-format "1 - 3" + d3-interpolate "1.2.0 - 3" + d3-time "2.1.1 - 3" + d3-time-format "2 - 4" + +"d3-selection@2 - 3", d3-selection@3, d3-selection@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-3.0.0.tgz#c25338207efa72cc5b9bd1458a1a41901f1e1b31" + integrity sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ== + +d3-shape@3: + version "3.2.0" + resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-3.2.0.tgz#a1a839cbd9ba45f28674c69d7f855bcf91dfc6a5" + integrity sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA== + dependencies: + d3-path "^3.1.0" + +d3-shape@^1.2.0: + version "1.3.7" + resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-1.3.7.tgz#df63801be07bc986bc54f63789b4fe502992b5d7" + integrity sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw== + dependencies: + d3-path "1" + +"d3-time-format@2 - 4", d3-time-format@4: + version "4.1.0" + resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-4.1.0.tgz#7ab5257a5041d11ecb4fe70a5c7d16a195bb408a" + integrity sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg== + dependencies: + d3-time "1 - 3" + +"d3-time@1 - 3", "d3-time@2.1.1 - 3", d3-time@3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-3.1.0.tgz#9310db56e992e3c0175e1ef385e545e48a9bb5c7" + integrity sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q== + dependencies: + d3-array "2 - 3" + +"d3-timer@1 - 3", d3-timer@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-3.0.1.tgz#6284d2a2708285b1abb7e201eda4380af35e63b0" + integrity sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA== + +"d3-transition@2 - 3", d3-transition@3, d3-transition@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-transition/-/d3-transition-3.0.1.tgz#6869fdde1448868077fdd5989200cb61b2a1645f" + integrity sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w== + dependencies: + d3-color "1 - 3" + d3-dispatch "1 - 3" + d3-ease "1 - 3" + d3-interpolate "1 - 3" + d3-timer "1 - 3" + +d3-zoom@3: + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-zoom/-/d3-zoom-3.0.0.tgz#d13f4165c73217ffeaa54295cd6969b3e7aee8f3" + integrity sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw== + dependencies: + d3-dispatch "1 - 3" + d3-drag "2 - 3" + d3-interpolate "1 - 3" + d3-selection "2 - 3" + d3-transition "2 - 3" + +d3@^7.9.0: + version "7.9.0" + resolved "https://registry.yarnpkg.com/d3/-/d3-7.9.0.tgz#579e7acb3d749caf8860bd1741ae8d371070cd5d" + integrity sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA== + dependencies: + d3-array "3" + d3-axis "3" + d3-brush "3" + d3-chord "3" + d3-color "3" + d3-contour "4" + d3-delaunay "6" + d3-dispatch "3" + d3-drag "3" + d3-dsv "3" + d3-ease "3" + d3-fetch "3" + d3-force "3" + d3-format "3" + d3-geo "3" + d3-hierarchy "3" + d3-interpolate "3" + d3-path "3" + d3-polygon "3" + d3-quadtree "3" + d3-random "3" + d3-scale "4" + d3-scale-chromatic "3" + d3-selection "3" + d3-shape "3" + d3-time "3" + d3-time-format "4" + d3-timer "3" + d3-transition "3" + d3-zoom "3" + +dagre-d3-es@7.0.14: + version "7.0.14" + resolved "https://registry.yarnpkg.com/dagre-d3-es/-/dagre-d3-es-7.0.14.tgz#1272276e26457cf3b97dac569f8f0531ec33c377" + integrity sha512-P4rFMVq9ESWqmOgK+dlXvOtLwYg0i7u0HBGJER0LZDJT2VHIPAMZ/riPxqJceWMStH5+E61QxFra9kIS3AqdMg== + dependencies: + d3 "^7.9.0" + lodash-es "^4.17.21" + +dayjs@^1.11.20: + version "1.11.21" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.21.tgz#57f87562e62de76f3c704bd2b8d522fc33068eb2" + integrity sha512-98IT+HOahAisibz/yjKbzuOBwYcjJ7BCLPzARyHiyEBmRz4fatF+KPJszEHXsGYjUG234aH/cOjW1wwTbKUZlA== debounce@^1.2.1: version "1.2.1" @@ -3949,7 +5428,7 @@ debug@2.6.9: dependencies: ms "2.0.0" -debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.3.1, debug@^4.4.1: +debug@^4.0.0, debug@^4.1.0, debug@^4.3.1, debug@^4.4.3: version "4.4.3" resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== @@ -3957,9 +5436,9 @@ debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.3.1, debug@^4.4.1: ms "^2.1.3" decode-named-character-reference@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decode-named-character-reference/-/decode-named-character-reference-1.2.0.tgz#25c32ae6dd5e21889549d40f676030e9514cc0ed" - integrity sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q== + version "1.3.0" + resolved "https://registry.yarnpkg.com/decode-named-character-reference/-/decode-named-character-reference-1.3.0.tgz#3e40603760874c2e5867691b599d73a7da25b53f" + integrity sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q== dependencies: character-entities "^2.0.0" @@ -3980,12 +5459,18 @@ deepmerge@^4.3.1: resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== -default-gateway@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/default-gateway/-/default-gateway-6.0.3.tgz#819494c888053bdb743edbf343d6cdf7f2943a71" - integrity sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg== +default-browser-id@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/default-browser-id/-/default-browser-id-5.0.1.tgz#f7a7ccb8f5104bf8e0f71ba3b1ccfa5eafdb21e8" + integrity sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q== + +default-browser@^5.2.1: + version "5.5.0" + resolved "https://registry.yarnpkg.com/default-browser/-/default-browser-5.5.0.tgz#2792e886f2422894545947cc80e1a444496c5976" + integrity sha512-H9LMLr5zwIbSxrmvikGuI/5KGhZ8E2zH3stkMgM5LpOWDutGM2JZaj460Udnf1a+946zc7YBgrqEWwbk7zHvGw== dependencies: - execa "^5.0.0" + bundle-name "^4.1.0" + default-browser-id "^5.0.0" defer-to-connect@^2.0.1: version "2.0.1" @@ -4006,6 +5491,11 @@ define-lazy-prop@^2.0.0: resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f" integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og== +define-lazy-prop@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz#dbb19adfb746d7fc6d734a06b72f4a00d021255f" + integrity sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg== + define-properties@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c" @@ -4015,12 +5505,19 @@ define-properties@^1.2.1: has-property-descriptors "^1.0.0" object-keys "^1.1.1" +delaunator@5: + version "5.1.0" + resolved "https://registry.yarnpkg.com/delaunator/-/delaunator-5.1.0.tgz#d13271fbf3aff6753f9ea6e235557f20901046ea" + integrity sha512-AGrQ4QSgssa1NGmWmLPqN5NY2KajF5MqxetNEO+o0n3ZwZZeTmt7bBnvzHWrmkZFxGgr4HdyFgelzgi06otLuQ== + dependencies: + robust-predicates "^3.0.2" + delegate@^3.1.2: version "3.2.0" resolved "https://registry.yarnpkg.com/delegate/-/delegate-3.2.0.tgz#b66b71c3158522e8ab5744f720d8ca0c2af59166" integrity sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw== -depd@2.0.0: +depd@2.0.0, depd@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== @@ -4035,23 +5532,27 @@ dequal@^2.0.0: resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be" integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== -destroy@1.2.0: +destroy@1.2.0, destroy@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== +detect-libc@^2.0.3: + version "2.1.2" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.1.2.tgz#689c5dcdc1900ef5583a4cb9f6d7b473742074ad" + integrity sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ== + detect-node@^2.0.4: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== -detect-port@^1.5.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/detect-port/-/detect-port-1.6.1.tgz#45e4073997c5f292b957cb678fb0bb8ed4250a67" - integrity sha512-CmnVc+Hek2egPx1PeTFVta2W78xy2K/9Rkf6cC4T59S50tVnzKj+tnx5mmx5lwvCkujZ4uRrpRSuV+IVs3f90Q== +detect-port@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/detect-port/-/detect-port-2.1.0.tgz#03d72644891fa451ca5609b83107a8a0ebd03f91" + integrity sha512-epZuWb/6Q62L+nDHJc/hQAqf8pylsqgk3BpZXVBx1CDnr3nkrVNn73Uu1rXcFzkNcc+hkP3whuOg7JZYaQB65Q== dependencies: - address "^1.0.1" - debug "4" + address "^2.0.1" devlop@^1.0.0, devlop@^1.1.0: version "1.1.0" @@ -4126,6 +5627,13 @@ domhandler@^5.0.2, domhandler@^5.0.3: dependencies: domelementtype "^2.3.0" +dompurify@^3.3.3: + version "3.4.11" + resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.4.11.tgz#29c8ba496475f279ef4015784068452fb14a0680" + integrity sha512-zhlUV12GsaRzMsf9q5M254YhA4+VuF0fG+QFqu6aYpoGlKtz+w8//jBcGVYBgQkR5GHjUomejY84AV+/uPbWdw== + optionalDependencies: + "@types/trusted-types" "^2.0.7" + domutils@^2.5.2, domutils@^2.8.0: version "2.8.0" resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.8.0.tgz#4437def5db6e2d1f5d6ee859bd95ca7d02048135" @@ -4183,10 +5691,10 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== -electron-to-chromium@^1.5.218: - version "1.5.221" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.221.tgz#bd98014b2a247701c4ebd713080448d539545d79" - integrity sha512-/1hFJ39wkW01ogqSyYoA4goOXOtMRy6B+yvA1u42nnsEGtHzIzmk93aPISumVQeblj47JUHLC9coCjUxb1EvtQ== +electron-to-chromium@^1.5.387: + version "1.5.389" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.389.tgz#538be9ebec78026d4daba6be321ab854dfac2a8f" + integrity sha512-cEto7aeOqBfU1D+c5py5pE+ooscKE75JifxLBdFUZsqAxRS6y7kebtxAZvICszSl05gPjYHDTjY+lXpyGvpJbg== emoji-regex@^8.0.0: version "8.0.0" @@ -4213,23 +5721,18 @@ emoticon@^4.0.1: resolved "https://registry.yarnpkg.com/emoticon/-/emoticon-4.1.0.tgz#d5a156868ee173095627a33de3f1e914c3dde79e" integrity sha512-VWZfnxqwNcc51hIy/sbOdEem6D+cVtpPzEEtVAFdaas30+1dgkyaOQ4sQ6Bp0tOMqWO1v+HQfYaoodOkdhK6SQ== -encodeurl@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== - encodeurl@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-2.0.0.tgz#7b8ea898077d7e409d3ac45474ea38eaf0857a58" integrity sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg== -enhanced-resolve@^5.17.3: - version "5.18.3" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz#9b5f4c5c076b8787c78fe540392ce76a88855b44" - integrity sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww== +enhanced-resolve@^5.22.2: + version "5.24.2" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.24.2.tgz#f25d703a24431cb1e02f944adb74aefa4fcb8d7e" + integrity sha512-rpsZEGT1jFuve6QlpyRp9ckQ+kN61hvF9BzCPyMdaKTm8UJce96KBn3sorXOFXlzjPrs3Vc4T1NsSroZ3PxlFw== dependencies: graceful-fs "^4.2.4" - tapable "^2.2.0" + tapable "^2.3.3" entities@^2.0.0: version "2.2.0" @@ -4263,18 +5766,23 @@ es-errors@^1.3.0: resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== -es-module-lexer@^1.2.1: - version "1.7.0" - resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.7.0.tgz#9159601561880a85f2734560a9099b2c31e5372a" - integrity sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA== +es-module-lexer@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-2.3.0.tgz#fda770234c345064c122eb905e1c4200ffa4ce7e" + integrity sha512-KLdwQm2NvGLDkQDCGvmiQrhkd0JbMzXthwQAUgWjQuQdBLFa3eiBP5arXZyA+f8x+x7OXgud6bq2rxjGtHV2tw== es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" - integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== + version "1.1.2" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.2.tgz#a2d0b373205724dfa525d23b0c3e1b1ca582c99b" + integrity sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw== dependencies: es-errors "^1.3.0" +es-toolkit@^1.45.1: + version "1.49.0" + resolved "https://registry.yarnpkg.com/es-toolkit/-/es-toolkit-1.49.0.tgz#93c5b031865792fc03cbf5bd20c132a4f976a52a" + integrity sha512-G5iZ6Pc/FNRY/soKZHC+TxGDD83rHUDXxzaWhGCX44vAv/tMs56WMusnm/KMNK+luUPsgA9U28cGr4RDlSzL2g== + esast-util-from-estree@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/esast-util-from-estree/-/esast-util-from-estree-2.0.0.tgz#8d1cfb51ad534d2f159dc250e604f3478a79f1ad" @@ -4310,11 +5818,6 @@ escape-html@^1.0.3, escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== -escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== - escape-string-regexp@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" @@ -4333,11 +5836,6 @@ eslint-scope@5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -esprima@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - esrecurse@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" @@ -4395,9 +5893,9 @@ estree-util-to-js@^2.0.0: source-map "^0.7.0" estree-util-value-to-estree@^3.0.1: - version "3.4.0" - resolved "https://registry.yarnpkg.com/estree-util-value-to-estree/-/estree-util-value-to-estree-3.4.0.tgz#827122e40c3a756d3c4cf5d5d296fa06026a1a4f" - integrity sha512-Zlp+gxis+gCfK12d3Srl2PdX2ybsEA8ZYy6vQGVQTNNYLEGRQQ56XB64bjemN8kxIKXP1nC9ip4Z+ILy9LGzvQ== + version "3.5.0" + resolved "https://registry.yarnpkg.com/estree-util-value-to-estree/-/estree-util-value-to-estree-3.5.0.tgz#cd70cf37e7f78eae3e110d66a3436ce0d18a8f80" + integrity sha512-aMV56R27Gv3QmfmF1MY12GWkGzzeAezAX+UplqHVASfjc9wNzI/X6hC0S9oxq61WT4aQesLGslWP9tKk6ghRZQ== dependencies: "@types/estree" "^1.0.0" @@ -4449,7 +5947,7 @@ events@^3.2.0: resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== -execa@5.1.1, execa@^5.0.0: +execa@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== @@ -4464,39 +5962,39 @@ execa@5.1.1, execa@^5.0.0: signal-exit "^3.0.3" strip-final-newline "^2.0.0" -express@^4.17.3: - version "4.21.2" - resolved "https://registry.yarnpkg.com/express/-/express-4.21.2.tgz#cf250e48362174ead6cea4a566abef0162c1ec32" - integrity sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA== +express@^4.22.1: + version "4.22.2" + resolved "https://registry.yarnpkg.com/express/-/express-4.22.2.tgz#c17ae0981e5efc24b22272f0e041c4662503b700" + integrity sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q== dependencies: accepts "~1.3.8" array-flatten "1.1.1" - body-parser "1.20.3" - content-disposition "0.5.4" + body-parser "~1.20.5" + content-disposition "~0.5.4" content-type "~1.0.4" - cookie "0.7.1" - cookie-signature "1.0.6" + cookie "~0.7.1" + cookie-signature "~1.0.6" debug "2.6.9" depd "2.0.0" encodeurl "~2.0.0" escape-html "~1.0.3" etag "~1.8.1" - finalhandler "1.3.1" - fresh "0.5.2" - http-errors "2.0.0" + finalhandler "~1.3.1" + fresh "~0.5.2" + http-errors "~2.0.0" merge-descriptors "1.0.3" methods "~1.1.2" - on-finished "2.4.1" + on-finished "~2.4.1" parseurl "~1.3.3" - path-to-regexp "0.1.12" + path-to-regexp "~0.1.12" proxy-addr "~2.0.7" - qs "6.13.0" + qs "~6.15.1" range-parser "~1.2.1" safe-buffer "5.2.1" - send "0.19.0" - serve-static "1.16.2" + send "~0.19.0" + serve-static "~1.16.2" setprototypeof "1.2.0" - statuses "2.0.1" + statuses "~2.0.1" type-is "~1.6.18" utils-merge "1.0.1" vary "~1.1.2" @@ -4535,14 +6033,14 @@ fast-json-stable-stringify@^2.0.0: integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fast-uri@^3.0.1: - version "3.1.0" - resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.0.tgz#66eecff6c764c0df9b762e62ca7edcfb53b4edfa" - integrity sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA== + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.3.tgz#f695a40f006aba505631573a0021ddb21194ad11" + integrity sha512-i70LwGWUduXqzicKXWshooq+sWL1K3WUU5rKZNG/0i3a1OSoX3HqhH5WbWwTmqWfor4urUakGPiRQcleRZTwOg== fastq@^1.6.0: - version "1.19.1" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.19.1.tgz#d50eaba803c8846a883c16492821ebcd2cda55f5" - integrity sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ== + version "1.20.1" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.20.1.tgz#ca750a10dc925bc8b18839fd203e3ef4b3ced675" + integrity sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw== dependencies: reusify "^1.0.4" @@ -4565,14 +6063,7 @@ feed@^4.2.2: resolved "https://registry.yarnpkg.com/feed/-/feed-4.2.2.tgz#865783ef6ed12579e2c44bbef3c9113bc4956a7e" integrity sha512-u5/sxGfiMfZNtJ3OvQpXcvotFpYkL0n9u9mM2vkui2nGo8b4wvDkJ8gAkYqbA8QpGyFCv3RK0Z+Iv+9veCS9bQ== dependencies: - xml-js "^1.6.11" - -figures@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" - integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== - dependencies: - escape-string-regexp "^1.0.5" + xml-js "^1.6.11" file-loader@^6.2.0: version "6.2.0" @@ -4589,17 +6080,17 @@ fill-range@^7.1.1: dependencies: to-regex-range "^5.0.1" -finalhandler@1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.3.1.tgz#0c575f1d1d324ddd1da35ad7ece3df7d19088019" - integrity sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ== +finalhandler@~1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.3.2.tgz#1ebc2228fc7673aac4a472c310cc05b77d852b88" + integrity sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg== dependencies: debug "2.6.9" encodeurl "~2.0.0" escape-html "~1.0.3" - on-finished "2.4.1" + on-finished "~2.4.1" parseurl "~1.3.3" - statuses "2.0.1" + statuses "~2.0.2" unpipe "~1.0.0" find-cache-dir@^4.0.0: @@ -4629,9 +6120,9 @@ flat@^5.0.2: integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== follow-redirects@^1.0.0: - version "1.15.11" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.11.tgz#777d73d72a92f8ec4d2e410eb47352a56b8e8340" - integrity sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ== + version "1.16.0" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.16.0.tgz#28474a159d3b9d11ef62050a14ed60e4df6d61bc" + integrity sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw== form-data-encoder@^2.1.2: version "2.1.4" @@ -4648,35 +6139,25 @@ forwarded@0.2.0: resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== -fraction.js@^4.3.7: - version "4.3.7" - resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.3.7.tgz#06ca0085157e42fda7f9e726e79fefc4068840f7" - integrity sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew== +fraction.js@^5.3.4: + version "5.3.4" + resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-5.3.4.tgz#8c0fcc6a9908262df4ed197427bdeef563e0699a" + integrity sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ== -fresh@0.5.2: +fresh@~0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== fs-extra@^11.1.1, fs-extra@^11.2.0: - version "11.3.2" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.3.2.tgz#c838aeddc6f4a8c74dd15f85e11fe5511bfe02a4" - integrity sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A== + version "11.3.6" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.3.6.tgz#f7cb80e9df550cd1db6f537fa5cdd568d3e70d10" + integrity sha512-w8ZNZr2mKIc7qeNaQ9AVPT1+iFaI+Avd4xudVOvdDJ8VytREi1Ft5Ih7hd9jjehod8vAM5GMsfQ/TpPf4EyoEA== dependencies: graceful-fs "^4.2.0" jsonfile "^6.0.1" universalify "^2.0.0" -fs-monkey@^1.0.4: - version "1.1.0" - resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-1.1.0.tgz#632aa15a20e71828ed56b24303363fb1414e5997" - integrity sha512-QMUezzXWII9EV5aTFXW1UBVUO77wYPpjqIF8/AviUCThNeSYZykpoTixUeaNNBwmCev0AMDWMAni+f8Hxb1IFw== - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - fsevents@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" @@ -4745,22 +6226,19 @@ glob-parent@^6.0.1: dependencies: is-glob "^4.0.3" -glob-to-regexp@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" - integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== +glob-to-regex.js@^1.0.0, glob-to-regex.js@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/glob-to-regex.js/-/glob-to-regex.js-1.2.0.tgz#2b323728271d133830850e32311f40766c5f6413" + integrity sha512-QMwlOQKU/IzqMUOAZWubUOT8Qft+Y0KQWnX9nK3ch0CJg0tTp4TvGZsTfudYKv2NzoQSyPcnA6TYeIQ3jGichQ== -glob@^7.1.3: - version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== +glob@^13.0.0, glob@^13.0.3: + version "13.0.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-13.0.6.tgz#078666566a425147ccacfbd2e332deb66a2be71d" + integrity sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw== dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" + minimatch "^10.2.2" + minipass "^7.1.3" + path-scurry "^2.0.2" global-dirs@^3.0.0: version "3.0.1" @@ -4831,16 +6309,6 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11, resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -gray-matter@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/gray-matter/-/gray-matter-4.0.3.tgz#e893c064825de73ea1f5f7d88c7a9f7274288798" - integrity sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q== - dependencies: - js-yaml "^3.13.1" - kind-of "^6.0.2" - section-matter "^1.0.0" - strip-bom-string "^1.0.0" - gzip-size@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462" @@ -4848,6 +6316,11 @@ gzip-size@^6.0.0: dependencies: duplexer "^0.1.2" +hachure-fill@^0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/hachure-fill/-/hachure-fill-0.5.2.tgz#d19bc4cc8750a5962b47fb1300557a85fcf934cc" + integrity sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg== + handle-thing@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" @@ -4875,10 +6348,10 @@ has-yarn@^3.0.0: resolved "https://registry.yarnpkg.com/has-yarn/-/has-yarn-3.0.0.tgz#c3c21e559730d1d3b57e28af1f30d06fac38147d" integrity sha512-IrsVwUHhEULx3R8f/aA8AHuEzAorplsab/v8HBzEiIukwq5i/EC+xmOW+HfP1OaDP+2JkgT1yILHN2O3UFIbcA== -hasown@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" - integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== +hasown@^2.0.2, hasown@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.4.tgz#8c62d8cb90beb2aad5d0a5b67581ad9854c3f003" + integrity sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A== dependencies: function-bind "^1.1.2" @@ -4966,14 +6439,14 @@ hast-util-to-jsx-runtime@^2.0.0: vfile-message "^4.0.0" hast-util-to-parse5@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/hast-util-to-parse5/-/hast-util-to-parse5-8.0.0.tgz#477cd42d278d4f036bc2ea58586130f6f39ee6ed" - integrity sha512-3KKrV5ZVI8if87DVSi1vDeByYrkGzg4mEfeu4alwgmmIeARiBLKCZS2uw5Gb6nU9x9Yufyj3iudm6i7nl52PFw== + version "8.0.1" + resolved "https://registry.yarnpkg.com/hast-util-to-parse5/-/hast-util-to-parse5-8.0.1.tgz#95aa391cc0514b4951418d01c883d1038af42f5d" + integrity sha512-MlWT6Pjt4CG9lFCjiz4BH7l9wmrMkfkJYCxFwKQic8+RTZgWPuWxwAfjJElsXkex7DJjfSJsQIt931ilUgmwdA== dependencies: "@types/hast" "^3.0.0" comma-separated-tokens "^2.0.0" devlop "^1.0.0" - property-information "^6.0.0" + property-information "^7.0.0" space-separated-tokens "^2.0.0" web-namespaces "^2.0.0" zwitch "^2.0.0" @@ -5030,11 +6503,6 @@ hpack.js@^2.1.6: readable-stream "^2.0.1" wbuf "^1.1.0" -html-entities@^2.3.2: - version "2.6.0" - resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.6.0.tgz#7c64f1ea3b36818ccae3d3fb48b6974208e984f8" - integrity sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ== - html-escaper@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" @@ -5077,9 +6545,9 @@ html-void-elements@^3.0.0: integrity sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg== html-webpack-plugin@^5.6.0: - version "5.6.4" - resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-5.6.4.tgz#d8cb0f7edff7745ae7d6cccb0bff592e9f7f7959" - integrity sha512-V/PZeWsqhfpE27nKeX9EO2sbR+D17A+tLf6qU+ht66jdUsN0QLKJN27Z+1+gHrVMKgndBahes0PU6rRihDgHTw== + version "5.6.7" + resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-5.6.7.tgz#429bab4e12abf3c07e1c608886608e2df2c06b11" + integrity sha512-md+vXtdCAe60s1k6AU3dUyMJnDxUyQAwfwPKoLisvgUF1IXjtlLsk2se54+qfL9Mdm26bbwvjJybpNx48NKRLw== dependencies: "@types/html-minifier-terser" "^6.0.0" html-minifier-terser "^6.0.2" @@ -5117,36 +6585,37 @@ http-deceiver@^1.2.7: resolved "https://registry.yarnpkg.com/http-deceiver/-/http-deceiver-1.2.7.tgz#fa7168944ab9a519d337cb0bec7284dc3e723d87" integrity sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw== -http-errors@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" - integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== +http-errors@~1.8.0: + version "1.8.1" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.8.1.tgz#7c3f28577cbc8a207388455dbd62295ed07bd68c" + integrity sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g== dependencies: - depd "2.0.0" + depd "~1.1.2" inherits "2.0.4" setprototypeof "1.2.0" - statuses "2.0.1" + statuses ">= 1.5.0 < 2" toidentifier "1.0.1" -http-errors@~1.6.2: - version "1.6.3" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" - integrity sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A== +http-errors@~2.0.0, http-errors@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.1.tgz#36d2f65bc909c8790018dd36fb4d93da6caae06b" + integrity sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ== dependencies: - depd "~1.1.2" - inherits "2.0.3" - setprototypeof "1.1.0" - statuses ">= 1.4.0 < 2" + depd "~2.0.0" + inherits "~2.0.4" + setprototypeof "~1.2.0" + statuses "~2.0.2" + toidentifier "~1.0.1" http-parser-js@>=0.5.1: version "0.5.10" resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.5.10.tgz#b3277bd6d7ed5588e20ea73bf724fcbe44609075" integrity sha512-Pysuw9XpUq5dVc/2SMHpuTY01RFl8fttgcyunjL7eEMhGM3cI4eOmiCycJDVCo/7O7ClfQD3SaI6ftDzqOXYMA== -http-proxy-middleware@^2.0.3: - version "2.0.9" - resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-2.0.9.tgz#e9e63d68afaa4eee3d147f39149ab84c0c2815ef" - integrity sha512-c1IyJYLYppU574+YI7R4QyX2ystMtVXZwIdzazUIPIJsHuWNd+mho2j+bKoHftndicGj9yh+xjd+l0yj7VeT1Q== +http-proxy-middleware@^2.0.9: + version "2.0.10" + resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-2.0.10.tgz#b2df7b705203d7a8c269ac8450cf96b00c532f94" + integrity sha512-RKzRWNPxUZqbuk3BC5mGVJbBnWgr+diEnjJexIOytFbBzDy88Fbh/YvBr3DsNrl1jYAfjWfpATEv0NO35FDuPQ== dependencies: "@types/http-proxy" "^1.17.8" http-proxy "^1.18.1" @@ -5176,7 +6645,19 @@ human-signals@^2.1.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== -iconv-lite@0.4.24: +hyperdyperid@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/hyperdyperid/-/hyperdyperid-1.2.0.tgz#59668d323ada92228d2a869d3e474d5a33b69e6b" + integrity sha512-Y93lCzHYgGWdrJ66yIktxiaGULYc6oGiABxhcO5AufBeOyoIdZF7bIfLaOrbM0iGIOXQQgxxRrFEnb+Y6w1n4A== + +iconv-lite@0.6: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + +iconv-lite@~0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -5211,6 +6692,11 @@ import-lazy@^4.0.0: resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-4.0.0.tgz#e8eb627483a0a43da3c03f3e35548be5cb0cc153" integrity sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw== +import-meta-resolve@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/import-meta-resolve/-/import-meta-resolve-4.2.0.tgz#08cb85b5bd37ecc8eb1e0f670dc2767002d43734" + integrity sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg== + imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" @@ -5226,24 +6712,11 @@ infima@0.2.0-alpha.45: resolved "https://registry.yarnpkg.com/infima/-/infima-0.2.0-alpha.45.tgz#542aab5a249274d81679631b492973dd2c1e7466" integrity sha512-uyH0zfr1erU1OohLk0fT4Rrb94AOhguWNOcD9uGrSpRvNB+6gZXUoJX5J0NtvzBO10YZ9PgvA4NFgt+fYg8ojw== -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3: +inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3, inherits@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -inherits@2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== - ini@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ini/-/ini-2.0.0.tgz#e5fd556ecdd5726be978fa1001862eacb0a94bc5" @@ -5254,10 +6727,20 @@ ini@^1.3.4, ini@~1.3.0: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== -inline-style-parser@0.2.4: - version "0.2.4" - resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.2.4.tgz#f4af5fe72e612839fcd453d989a586566d695f22" - integrity sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q== +inline-style-parser@0.2.7: + version "0.2.7" + resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.2.7.tgz#b1fc68bfc0313b8685745e4464e37f9376b9c909" + integrity sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA== + +"internmap@1 - 2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.3.tgz#6685f23755e43c524e251d29cbc97248e3061009" + integrity sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg== + +internmap@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/internmap/-/internmap-1.0.1.tgz#0017cc8a3b99605f0302f2b198d272e015e5df95" + integrity sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw== invariant@^2.2.4: version "2.2.4" @@ -5271,10 +6754,10 @@ ipaddr.js@1.9.1: resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== -ipaddr.js@^2.0.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-2.2.0.tgz#d33fa7bac284f4de7af949638c9d68157c6b92e8" - integrity sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA== +ipaddr.js@^2.1.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-2.4.0.tgz#038e9ceaf8219efc5bb76347b7eb787875d5095b" + integrity sha512-9VGk3HGanVE6JoZXHiCpnGy5X0jYDnN4EA4lntFPj+1vIWlFhIylq2CrrCOJH9EAhc5CYhq18F2Av2tgoAPsYQ== is-alphabetical@^2.0.0: version "2.0.1" @@ -5294,6 +6777,11 @@ is-arrayish@^0.2.1: resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== +is-arrayish@^0.3.1: + version "0.3.4" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.4.tgz#1ee5553818511915685d33bb13d31bf854e5059d" + integrity sha512-m6UrgzFVUYawGBh1dUsWR5M2Clqic9RVXC/9f8ceNlv2IcO9j9J/z8UoCLPqtsPBFNzEpfR3xftohbfqDx8EQA== + is-binary-path@~2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" @@ -5308,12 +6796,12 @@ is-ci@^3.0.1: dependencies: ci-info "^3.2.0" -is-core-module@^2.16.0: - version "2.16.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" - integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== +is-core-module@^2.16.1: + version "2.16.2" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.2.tgz#3e07450a8080ebce3fbf0cac494f4d2ab324e082" + integrity sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA== dependencies: - hasown "^2.0.2" + hasown "^2.0.3" is-decimal@^2.0.0: version "2.0.1" @@ -5325,6 +6813,11 @@ is-docker@^2.0.0, is-docker@^2.1.1: resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== +is-docker@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-3.0.0.tgz#90093aa3106277d8a77a5910dbae71747e15a200" + integrity sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ== + is-extendable@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -5352,6 +6845,13 @@ is-hexadecimal@^2.0.0: resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz#86b5bf668fca307498d319dfc03289d781a90027" integrity sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg== +is-inside-container@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-inside-container/-/is-inside-container-1.0.0.tgz#e81fba699662eb31dbdaf26766a61d4814717ea4" + integrity sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA== + dependencies: + is-docker "^3.0.0" + is-installed-globally@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.4.0.tgz#9a0fd407949c30f86eb6959ef1b7994ed0b7b520" @@ -5360,6 +6860,11 @@ is-installed-globally@^0.4.0: global-dirs "^3.0.0" is-path-inside "^3.0.2" +is-network-error@^1.0.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/is-network-error/-/is-network-error-1.3.2.tgz#9460bc30f8419a4bca77114f4de88a3ee5e0c519" + integrity sha512-PhBY86zaxNZUuWP6h13Vu5oFe0XY6/UlKzQnYFELzGVHygP3MxmvTfYSG7GN3aIab/iWudSMgjSnG9Dq+nHrgA== + is-npm@^6.0.0: version "6.1.0" resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-6.1.0.tgz#f70e0b6c132dfc817ac97d3badc0134945b098d3" @@ -5424,6 +6929,13 @@ is-wsl@^2.2.0: dependencies: is-docker "^2.0.0" +is-wsl@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-3.1.1.tgz#327897b26832a3eb117da6c27492d04ca132594f" + integrity sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw== + dependencies: + is-inside-container "^1.0.0" + is-yarn-global@^0.4.0: version "0.4.1" resolved "https://registry.yarnpkg.com/is-yarn-global/-/is-yarn-global-0.4.1.tgz#b312d902b313f81e4eaf98b6361ba2b45cd694bb" @@ -5486,9 +6998,9 @@ jiti@^1.20.0: integrity sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A== joi@^17.9.2: - version "17.13.3" - resolved "https://registry.yarnpkg.com/joi/-/joi-17.13.3.tgz#0f5cc1169c999b30d344366d384b12d92558bcec" - integrity sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA== + version "17.13.4" + resolved "https://registry.yarnpkg.com/joi/-/joi-17.13.4.tgz#ad6153d97ce558eb3a3b593e0d43eab51df1c474" + integrity sha512-1RuuER6kmt8K8I3nIWvPZKi5RQCb568ZPyY4Pwjlua+yo+63ZTmIwxLZH0heBmiKN4uxjvCiarDrjaeH84xicQ== dependencies: "@hapi/hoek" "^9.3.0" "@hapi/topo" "^5.1.0" @@ -5501,37 +7013,24 @@ joi@^17.9.2: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.13.1: - version "3.14.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" - integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - js-yaml@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + version "4.3.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.3.0.tgz#d1900572a7f7cf0b5f540c83673e60bad3436592" + integrity sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q== dependencies: argparse "^2.0.1" -jsesc@^3.0.2: +jsesc@^3.0.2, jsesc@~3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.1.0.tgz#74d335a234f67ed19907fdadfac7ccf9d409825d" integrity sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA== -jsesc@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.0.2.tgz#bb8b09a6597ba426425f2e4a07245c3d00b9343e" - integrity sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g== - json-buffer@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== -json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: +json-parse-even-better-errors@^2.3.0: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== @@ -5552,14 +7051,21 @@ json5@^2.1.2, json5@^2.2.3: integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== jsonfile@^6.0.1: - version "6.2.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.2.0.tgz#7c265bd1b65de6977478300087c99f1c84383f62" - integrity sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg== + version "6.2.1" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.2.1.tgz#b6e31717f22cc37330b081ce0051ed5de53af2f6" + integrity sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q== dependencies: universalify "^2.0.0" optionalDependencies: graceful-fs "^4.1.6" +katex@^0.16.45: + version "0.16.47" + resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.47.tgz#0a13a42c2deb4f74e61f162d440b9165a548030f" + integrity sha512-Eeo8Ys1doU1z+x8AZsPpQu+p/QcZBI5PeOo7QGQdy2x2m0MU/hYagBbGOmXwr5KVbEfVuWv9LpnQWeehogurjg== + dependencies: + commander "^8.3.0" + keyv@^4.5.3: version "4.5.4" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" @@ -5567,7 +7073,12 @@ keyv@^4.5.3: dependencies: json-buffer "3.0.1" -kind-of@^6.0.0, kind-of@^6.0.2: +khroma@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/khroma/-/khroma-2.1.0.tgz#45f2ce94ce231a437cf5b63c2e886e6eb42bbbb1" + integrity sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw== + +kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== @@ -5584,19 +7095,103 @@ latest-version@^7.0.0: dependencies: package-json "^8.1.0" -launch-editor@^2.6.0: - version "2.11.1" - resolved "https://registry.yarnpkg.com/launch-editor/-/launch-editor-2.11.1.tgz#61a0b7314a42fd84a6cbb564573d9e9ffcf3d72b" - integrity sha512-SEET7oNfgSaB6Ym0jufAdCeo3meJVeCaaDyzRygy0xsp2BFKCprcfHljTq4QkzTLUxEKkFK6OK4811YM2oSrRg== +launch-editor@^2.14.1: + version "2.14.1" + resolved "https://registry.yarnpkg.com/launch-editor/-/launch-editor-2.14.1.tgz#f7e0da3f58aaea03fea01074d840b5f739ed7ddc" + integrity sha512-QWBrQsMpH7gPr965dsKD/3cKWiNoTjpATQf++Xq63N6sKRGMwlVXz41O1IZTMfZQgBctD/K5Zt06+/I6pP6+HA== dependencies: picocolors "^1.1.1" - shell-quote "^1.8.3" + shell-quote "^1.8.4" + +layout-base@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/layout-base/-/layout-base-1.0.2.tgz#1291e296883c322a9dd4c5dd82063721b53e26e2" + integrity sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg== + +layout-base@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/layout-base/-/layout-base-2.0.1.tgz#d0337913586c90f9c2c075292069f5c2da5dd285" + integrity sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg== leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== +lightningcss-android-arm64@1.32.0: + version "1.32.0" + resolved "https://registry.yarnpkg.com/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz#f033885116dfefd9c6f54787523e3514b61e1968" + integrity sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg== + +lightningcss-darwin-arm64@1.32.0: + version "1.32.0" + resolved "https://registry.yarnpkg.com/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz#50b71871b01c8199584b649e292547faea7af9b5" + integrity sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ== + +lightningcss-darwin-x64@1.32.0: + version "1.32.0" + resolved "https://registry.yarnpkg.com/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz#35f3e97332d130b9ca181e11b568ded6aebc6d5e" + integrity sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w== + +lightningcss-freebsd-x64@1.32.0: + version "1.32.0" + resolved "https://registry.yarnpkg.com/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz#9777a76472b64ed6ff94342ad64c7bafd794a575" + integrity sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig== + +lightningcss-linux-arm-gnueabihf@1.32.0: + version "1.32.0" + resolved "https://registry.yarnpkg.com/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz#13ae652e1ab73b9135d7b7da172f666c410ad53d" + integrity sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw== + +lightningcss-linux-arm64-gnu@1.32.0: + version "1.32.0" + resolved "https://registry.yarnpkg.com/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz#417858795a94592f680123a1b1f9da8a0e1ef335" + integrity sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ== + +lightningcss-linux-arm64-musl@1.32.0: + version "1.32.0" + resolved "https://registry.yarnpkg.com/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz#6be36692e810b718040802fd809623cffe732133" + integrity sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg== + +lightningcss-linux-x64-gnu@1.32.0: + version "1.32.0" + resolved "https://registry.yarnpkg.com/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz#0b7803af4eb21cfd38dd39fe2abbb53c7dd091f6" + integrity sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA== + +lightningcss-linux-x64-musl@1.32.0: + version "1.32.0" + resolved "https://registry.yarnpkg.com/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz#88dc8ba865ddddb1ac5ef04b0f161804418c163b" + integrity sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg== + +lightningcss-win32-arm64-msvc@1.32.0: + version "1.32.0" + resolved "https://registry.yarnpkg.com/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz#4f30ba3fa5e925f5b79f945e8cc0d176c3b1ab38" + integrity sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw== + +lightningcss-win32-x64-msvc@1.32.0: + version "1.32.0" + resolved "https://registry.yarnpkg.com/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz#141aa5605645064928902bb4af045fa7d9f4220a" + integrity sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q== + +lightningcss@^1.27.0: + version "1.32.0" + resolved "https://registry.yarnpkg.com/lightningcss/-/lightningcss-1.32.0.tgz#b85aae96486dcb1bf49a7c8571221273f4f1e4a9" + integrity sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ== + dependencies: + detect-libc "^2.0.3" + optionalDependencies: + lightningcss-android-arm64 "1.32.0" + lightningcss-darwin-arm64 "1.32.0" + lightningcss-darwin-x64 "1.32.0" + lightningcss-freebsd-x64 "1.32.0" + lightningcss-linux-arm-gnueabihf "1.32.0" + lightningcss-linux-arm64-gnu "1.32.0" + lightningcss-linux-arm64-musl "1.32.0" + lightningcss-linux-x64-gnu "1.32.0" + lightningcss-linux-x64-musl "1.32.0" + lightningcss-win32-arm64-msvc "1.32.0" + lightningcss-win32-x64-msvc "1.32.0" + lilconfig@^3.1.1: version "3.1.3" resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.3.tgz#a1bcfd6257f9585bf5ae14ceeebb7b559025e4c4" @@ -5607,10 +7202,10 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -loader-runner@^4.2.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" - integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== +loader-runner@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.2.tgz#9913d3a15971f8f635915e601fb5c9d495d918e9" + integrity sha512-DFEqQ3ihfS9blba08cLfYf1NRAIEm+dDjic073DRDc3/JspI/8wYmtDsHwd3+4hwvdxSK7PGaElfTmm0awWJ4w== loader-utils@^2.0.0: version "2.0.4" @@ -5628,6 +7223,11 @@ locate-path@^7.1.0: dependencies: p-locate "^6.0.0" +lodash-es@^4.17.21: + version "4.18.1" + resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.18.1.tgz#b962eeb80d9d983a900bf342961fb7418ca10b1d" + integrity sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A== + lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" @@ -5644,9 +7244,9 @@ lodash.uniq@^4.5.0: integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ== lodash@^4.17.20, lodash@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + version "4.18.1" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.18.1.tgz#ff2b66c1f6326d59513de2407bf881439812771c" + integrity sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q== longest-streak@^3.0.0: version "3.1.0" @@ -5672,6 +7272,11 @@ lowercase-keys@^3.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== +lru-cache@^11.0.0: + version "11.5.2" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.5.2.tgz#00e16665c90c620fba14a3c368732a976493f760" + integrity sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g== + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -5684,18 +7289,16 @@ markdown-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/markdown-extensions/-/markdown-extensions-2.0.0.tgz#34bebc83e9938cae16e0e017e4a9814a8330d3c4" integrity sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q== -markdown-table@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-2.0.0.tgz#194a90ced26d31fe753d8b9434430214c011865b" - integrity sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A== - dependencies: - repeat-string "^1.0.0" - markdown-table@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-3.0.4.tgz#fe44d6d410ff9d6f2ea1797a3f60aa4d2b631c2a" integrity sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw== +marked@^16.3.0: + version "16.4.2" + resolved "https://registry.yarnpkg.com/marked/-/marked-16.4.2.tgz#4959a64be6c486f0db7467ead7ce288de54290a3" + integrity sha512-TI3V8YYWvkVf3KJe1dRkpnjs68JUPyEa5vjKrp1XEEJUAOaQc+Qj+L1qWbPd0SJuAdQkFU0h73sXXqwDYxsiDA== + math-intrinsics@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" @@ -5727,9 +7330,9 @@ mdast-util-find-and-replace@^3.0.0, mdast-util-find-and-replace@^3.0.1: unist-util-visit-parents "^6.0.0" mdast-util-from-markdown@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz#4850390ca7cf17413a9b9a0fbefcd1bc0eb4160a" - integrity sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA== + version "2.0.3" + resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.3.tgz#c95822b91aab75f18a4cbe8b2f51b873ed2cf0c7" + integrity sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q== dependencies: "@types/mdast" "^4.0.0" "@types/unist" "^3.0.0" @@ -5883,9 +7486,9 @@ mdast-util-phrasing@^4.0.0: unist-util-is "^6.0.0" mdast-util-to-hast@^13.0.0: - version "13.2.0" - resolved "https://registry.yarnpkg.com/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz#5ca58e5b921cc0a3ded1bc02eed79a4fe4fe41f4" - integrity sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA== + version "13.2.1" + resolved "https://registry.yarnpkg.com/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz#d7ff84ca499a57e2c060ae67548ad950e689a053" + integrity sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA== dependencies: "@types/hast" "^3.0.0" "@types/mdast" "^4.0.0" @@ -5934,12 +7537,25 @@ media-typer@0.3.0: resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== -memfs@^3.4.3: - version "3.6.0" - resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.6.0.tgz#d7a2110f86f79dd950a8b6df6d57bc984aa185f6" - integrity sha512-EGowvkkgbMcIChjMTMkESFDbZeSh8xZ7kNSF0hAiAN4Jh6jgHCRS0Ga/+C8y6Au+oqpezRHCfPsmJ2+DwAgiwQ== - dependencies: - fs-monkey "^1.0.4" +memfs@^4.17.0, memfs@^4.43.1: + version "4.64.0" + resolved "https://registry.yarnpkg.com/memfs/-/memfs-4.64.0.tgz#88bb85610804c154a8121424d2aeba7c5bdf4e38" + integrity sha512-Kw72fgY7Wn+sD8KmtNWSafl1dz0UvAsE/PHs3YVfLiaZuA3HxNm9sRLqAu0ATiBGJvME1PxZXbBZPv5GycDeAw== + dependencies: + "@jsonjoy.com/fs-core" "4.64.0" + "@jsonjoy.com/fs-fsa" "4.64.0" + "@jsonjoy.com/fs-node" "4.64.0" + "@jsonjoy.com/fs-node-builtins" "4.64.0" + "@jsonjoy.com/fs-node-to-fsa" "4.64.0" + "@jsonjoy.com/fs-node-utils" "4.64.0" + "@jsonjoy.com/fs-print" "4.64.0" + "@jsonjoy.com/fs-snapshot" "4.64.0" + "@jsonjoy.com/json-pack" "^1.11.0" + "@jsonjoy.com/util" "^1.9.0" + glob-to-regex.js "^1.0.1" + thingies "^2.5.0" + tree-dump "^1.0.3" + tslib "^2.0.0" merge-descriptors@1.0.3: version "1.0.3" @@ -5956,6 +7572,33 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== +mermaid@>=11.6.0: + version "11.16.0" + resolved "https://registry.yarnpkg.com/mermaid/-/mermaid-11.16.0.tgz#dc946bc84bde9d093ba14940d49df1d9f7d8c32f" + integrity sha512-Zvm3kbstgdpvIJPPItlL7fppIZ3kibvc1oZIGxdvk9t6UFz6flv+Jw7FtRGKwfcI8OckmH04LqG6LlS6X4B1pA== + dependencies: + "@braintree/sanitize-url" "^7.1.2" + "@iconify/utils" "^3.0.2" + "@mermaid-js/parser" "^1.2.0" + "@types/d3" "^7.4.3" + "@upsetjs/venn.js" "^2.0.0" + cytoscape "^3.33.3" + cytoscape-cose-bilkent "^4.1.0" + cytoscape-fcose "^2.2.0" + d3 "^7.9.0" + d3-sankey "^0.12.3" + dagre-d3-es "7.0.14" + dayjs "^1.11.20" + dompurify "^3.3.3" + es-toolkit "^1.45.1" + katex "^0.16.45" + khroma "^2.1.0" + marked "^16.3.0" + roughjs "^4.6.6" + stylis "^4.3.6" + ts-dedent "^2.2.0" + uuid "^11.1.0 || ^12 || ^13 || ^14.0.0" + methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" @@ -6390,7 +8033,7 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -"mime-db@>= 1.43.0 < 2": +"mime-db@>= 1.43.0 < 2", mime-db@^1.54.0: version "1.54.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.54.0.tgz#cddb3ee4f9c64530dff640236661d42cb6a314f5" integrity sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ== @@ -6407,13 +8050,20 @@ mime-types@2.1.18: dependencies: mime-db "~1.33.0" -mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.27, mime-types@~2.1.24, mime-types@~2.1.34, mime-types@~2.1.35: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: mime-db "1.52.0" +mime-types@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-3.0.2.tgz#39002d4182575d5af036ffa118100f2524b2e2ab" + integrity sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A== + dependencies: + mime-db "^1.54.0" + mime@1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" @@ -6435,9 +8085,9 @@ mimic-response@^4.0.0: integrity sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg== mini-css-extract-plugin@^2.9.2: - version "2.9.4" - resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-2.9.4.tgz#cafa1a42f8c71357f49cd1566810d74ff1cb0200" - integrity sha512-ZWYT7ln73Hptxqxk2DxPU9MmapXRhxkJD6tkSR04dnQxm8BGu2hzgKLugK5yySD97u/8yy7Ma7E76k9ZdvtjkQ== + version "2.10.2" + resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-2.10.2.tgz#5c85ec9450c05d26e32531b465a15a08c3a57253" + integrity sha512-AOSS0IdEB95ayVkxn5oGzNQwqAi2J0Jb/kKm43t7H73s8+f5873g0yuj0PNvK4dO75mu5DHg4nlgp4k6Kga8eg== dependencies: schema-utils "^4.0.0" tapable "^2.2.1" @@ -6447,18 +8097,40 @@ minimalistic-assert@^1.0.0: resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== -minimatch@3.1.2, minimatch@^3.1.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== +minimatch@3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.5.tgz#580c88f8d5445f2bd6aa8f3cadefa0de79fbd69e" + integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== dependencies: brace-expansion "^1.1.7" +minimatch@^10.2.2: + version "10.2.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.2.5.tgz#bd48687a0be38ed2961399105600f832095861d1" + integrity sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg== + dependencies: + brace-expansion "^5.0.5" + minimist@^1.2.0: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== +minimizer-webpack-plugin@^5.6.1: + version "5.6.1" + resolved "https://registry.yarnpkg.com/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.6.1.tgz#289922a4c96c4ed1ddb76b8a00bd8074e89a2f7f" + integrity sha512-DoeAZz8Q1C1znwsUzej1fdoi4jCf7/+Em27ouLqfK/+3m8G+D7yDhUwrc3CNhjSzGUN1kn7Iv4sWmjflQHenpw== + dependencies: + "@jridgewell/trace-mapping" "^0.3.25" + jest-worker "^27.4.5" + schema-utils "^4.3.0" + terser "^5.31.1" + +minipass@^7.1.2, minipass@^7.1.3: + version "7.1.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.3.tgz#79389b4eb1bb2d003a9bba87d492f2bd37bdc65b" + integrity sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A== + mrmime@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/mrmime/-/mrmime-2.0.1.tgz#bc3e87f7987853a54c9850eeb1f1078cd44adddc" @@ -6482,10 +8154,10 @@ multicast-dns@^7.2.5: dns-packet "^5.2.2" thunky "^1.0.2" -nanoid@^3.3.11: - version "3.3.11" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.11.tgz#4f4f112cefbe303202f2199838128936266d185b" - integrity sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w== +nanoid@^3.3.12: + version "3.3.15" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.15.tgz#36c490fad8c6e86c824c940dfdde999b69ed4316" + integrity sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA== negotiator@0.6.3: version "0.6.3" @@ -6520,30 +8192,20 @@ node-emoji@^2.1.0: emojilib "^2.4.0" skin-tone "^2.0.0" -node-forge@^1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" - integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA== - -node-releases@^2.0.21: - version "2.0.21" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.21.tgz#f59b018bc0048044be2d4c4c04e4c8b18160894c" - integrity sha512-5b0pgg78U3hwXkCM8Z9b2FJdPZlr9Psr9V2gQPESdGHqbntyFJKFW4r5TeWGFzafGY3hzs1JC62VEQMbl1JFkw== +node-releases@^2.0.50: + version "2.0.50" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.50.tgz#597197a852071ce42fc2550e58e223242bcba969" + integrity sha512-J6l92tKHX6w8Jy5nO1Vuc01NoIiRGi/d6qBKVxh+IQ8Cr3b6HbVNfKiF8ZpFKufTwpwxMmce2W3iQZ861ZRyTg== normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -normalize-range@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" - integrity sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA== - normalize-url@^8.0.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-8.1.0.tgz#d33504f67970decf612946fd4880bc8c0983486d" - integrity sha512-X06Mfd/5aKsRHc0O0J5CUedwnPmnDtLF2+nq+KN9KSDlJHkPuh0JUviWjEWMe0SW/9TDdSLVPuk7L5gGTIA1/w== + version "8.1.1" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-8.1.1.tgz#751a20c8520e5725404c06015fea21d7567f25ef" + integrity sha512-JYc0DPlpGWB40kH5g07gGTrYuMqV653k3uBKY6uITPWds3M0ov3GaWGp9lbE3Bzngx8+XkfzgvASb9vk9JDFXQ== npm-run-path@^4.0.1: version "4.0.1" @@ -6577,7 +8239,7 @@ object-assign@^4.1.1: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== -object-inspect@^1.13.3: +object-inspect@^1.13.3, object-inspect@^1.13.4: version "1.13.4" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.4.tgz#8375265e21bc20d0fa582c22e1b13485d6e00213" integrity sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew== @@ -6604,7 +8266,7 @@ obuf@^1.0.0, obuf@^1.1.2: resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" integrity sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg== -on-finished@2.4.1: +on-finished@^2.4.1, on-finished@~2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== @@ -6616,13 +8278,6 @@ on-headers@~1.1.0: resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.1.0.tgz#59da4f91c45f5f989c6e4bcedc5a3b0aed70ff65" integrity sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A== -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - onetime@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" @@ -6630,7 +8285,17 @@ onetime@^5.1.2: dependencies: mimic-fn "^2.1.0" -open@^8.0.9, open@^8.4.0: +open@^10.0.3: + version "10.2.0" + resolved "https://registry.yarnpkg.com/open/-/open-10.2.0.tgz#b9d855be007620e80b6fb05fac98141fe62db73c" + integrity sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA== + dependencies: + default-browser "^5.2.1" + define-lazy-prop "^3.0.0" + is-inside-container "^1.0.0" + wsl-utils "^0.1.0" + +open@^8.4.0: version "8.4.2" resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9" integrity sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ== @@ -6683,12 +8348,13 @@ p-queue@^6.6.2: eventemitter3 "^4.0.4" p-timeout "^3.2.0" -p-retry@^4.5.0: - version "4.6.2" - resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-4.6.2.tgz#9baae7184057edd4e17231cee04264106e092a16" - integrity sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ== +p-retry@^6.2.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-6.2.1.tgz#81828f8dc61c6ef5a800585491572cc9892703af" + integrity sha512-hEt02O4hUct5wtwg4H4KcWgDdm+l1bOaEy/hWzd8xtXB9BqxTWBBhb+2ImAtH4Cv4rPjV76xN3Zumqk3k3AhhQ== dependencies: - "@types/retry" "0.12.0" + "@types/retry" "0.12.2" + is-network-error "^1.0.0" retry "^0.13.1" p-timeout@^3.2.0: @@ -6698,6 +8364,11 @@ p-timeout@^3.2.0: dependencies: p-finally "^1.0.0" +package-json-from-dist@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" + integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== + package-json@^8.1.0: version "8.1.1" resolved "https://registry.yarnpkg.com/package-json/-/package-json-8.1.1.tgz#3e9948e43df40d1e8e78a85485f1070bf8f03dc8" @@ -6708,6 +8379,11 @@ package-json@^8.1.0: registry-url "^6.0.0" semver "^7.3.7" +package-manager-detector@^1.3.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/package-manager-detector/-/package-manager-detector-1.7.0.tgz#0a6d6d3856627b8ac9331f95fc891ea81247aafd" + integrity sha512-xg1eHpwYL/D/HEdWw2goFZP6vV0FH7W+PZ5rFkGjdIDLtxq7EkzBUeT3m+lndYCt8wKbmofUu1MUdMCXkCk9ZQ== + param-case@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/param-case/-/param-case-3.0.4.tgz#7d17fe4aa12bde34d4a77d91acfb6219caad01c5" @@ -6766,7 +8442,7 @@ parse5@^7.0.0: dependencies: entities "^6.0.0" -parseurl@~1.3.2, parseurl@~1.3.3: +parseurl@~1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== @@ -6779,16 +8455,16 @@ pascal-case@^3.1.2: no-case "^3.0.4" tslib "^2.0.3" +path-data-parser@0.1.0, path-data-parser@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/path-data-parser/-/path-data-parser-0.1.0.tgz#8f5ba5cc70fc7becb3dcefaea08e2659aba60b8c" + integrity sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w== + path-exists@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-5.0.0.tgz#a6aad9489200b21fab31e49cf09277e5116fb9e7" integrity sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ== -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== - path-is-inside@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" @@ -6804,10 +8480,13 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -path-to-regexp@0.1.12: - version "0.1.12" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.12.tgz#d5e1a12e478a976d432ef3c58d534b9923164bb7" - integrity sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ== +path-scurry@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.2.tgz#6be0d0ee02a10d9e0de7a98bae65e182c9061f85" + integrity sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg== + dependencies: + lru-cache "^11.0.0" + minipass "^7.1.2" path-to-regexp@3.3.0: version "3.3.0" @@ -6821,6 +8500,11 @@ path-to-regexp@^1.7.0: dependencies: isarray "0.0.1" +path-to-regexp@~0.1.12: + version "0.1.13" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.13.tgz#9b22ec16bc3ab88d05a0c7e369869421401ab17d" + integrity sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA== + path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" @@ -6832,9 +8516,9 @@ picocolors@^1.0.0, picocolors@^1.1.1: integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + version "2.3.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.2.tgz#5a942915e26b372dc0f0e6753149a16e6b1c5601" + integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA== pkg-dir@^7.0.0: version "7.0.0" @@ -6843,6 +8527,31 @@ pkg-dir@^7.0.0: dependencies: find-up "^6.3.0" +pkijs@^3.3.3: + version "3.4.0" + resolved "https://registry.yarnpkg.com/pkijs/-/pkijs-3.4.0.tgz#d9164def30ff6d97be2d88966d5e36192499ca9c" + integrity sha512-emEcLuomt2j03vxD54giVB4SxTjnsqkU692xZOZXHDVoYyypEm+b3jpiTcc+Cf+myooc+/Ly0z01jqeNHVgJGw== + dependencies: + "@noble/hashes" "1.4.0" + asn1js "^3.0.6" + bytestreamjs "^2.0.1" + pvtsutils "^1.3.6" + pvutils "^1.1.3" + tslib "^2.8.1" + +points-on-curve@0.2.0, points-on-curve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/points-on-curve/-/points-on-curve-0.2.0.tgz#7dbb98c43791859434284761330fa893cb81b4d1" + integrity sha512-0mYKnYYe9ZcqMCWhUjItv/oHjvgEsfKvnUTg8sAtnHr3GVy7rGkXCb6d5cSyqrWqL4k81b9CPg3urd+T7aop3A== + +points-on-path@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/points-on-path/-/points-on-path-0.2.1.tgz#553202b5424c53bed37135b318858eacff85dd52" + integrity sha512-25ClnWWuw7JbWZcgqY/gJ4FQWadKxGWk+3kR/7kD0tCaDtPPMj7oHu2ToLaVhfpnHrZzYby2w6tUA0eOIuUg8g== + dependencies: + path-data-parser "0.1.0" + points-on-curve "0.2.0" + postcss-attribute-case-insensitive@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/postcss-attribute-case-insensitive/-/postcss-attribute-case-insensitive-7.0.1.tgz#0c4500e3bcb2141848e89382c05b5a31c23033a3" @@ -6865,15 +8574,15 @@ postcss-clamp@^4.1.0: dependencies: postcss-value-parser "^4.2.0" -postcss-color-functional-notation@^7.0.11: - version "7.0.11" - resolved "https://registry.yarnpkg.com/postcss-color-functional-notation/-/postcss-color-functional-notation-7.0.11.tgz#ad6b3d2e71fedd94a932f96260b596c33c53c6a5" - integrity sha512-zfqoUSaHMko/k2PA9xnaydVTHqYv5vphq5Q2AHcG/dCdv/OkHYWcVWfVTBKZ526uzT8L7NghuvSw3C9PxlKnLg== +postcss-color-functional-notation@^7.0.12: + version "7.0.12" + resolved "https://registry.yarnpkg.com/postcss-color-functional-notation/-/postcss-color-functional-notation-7.0.12.tgz#9a3df2296889e629fde18b873bb1f50a4ecf4b83" + integrity sha512-TLCW9fN5kvO/u38/uesdpbx3e8AkTYhMvDZYa9JpmImWuTE99bDQ7GU7hdOADIZsiI9/zuxfAJxny/khknp1Zw== dependencies: "@csstools/css-color-parser" "^3.1.0" "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" postcss-color-hex-alpha@^10.0.0: @@ -6975,12 +8684,12 @@ postcss-discard-unused@^6.0.5: dependencies: postcss-selector-parser "^6.0.16" -postcss-double-position-gradients@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/postcss-double-position-gradients/-/postcss-double-position-gradients-6.0.3.tgz#d8c4b126af89855a3aa6687e5b1a0d5460d4a5b7" - integrity sha512-Dl0Z9sdbMwrPslgOaGBZRGo3TASmmgTcqcUODr82MTYyJk6devXZM6MlQjpQKMJqlLJ6oL1w78U7IXFdPA5+ug== +postcss-double-position-gradients@^6.0.4: + version "6.0.4" + resolved "https://registry.yarnpkg.com/postcss-double-position-gradients/-/postcss-double-position-gradients-6.0.4.tgz#b482d08b5ced092b393eb297d07976ab482d4cad" + integrity sha512-m6IKmxo7FxSP5nF2l63QbCC3r+bWpFUWmZXZf096WxG0m7Vl1Q1+ruFOhpdDRmKrRS+S3Jtk+TVk/7z0+BVK6g== dependencies: - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" postcss-value-parser "^4.2.0" @@ -7016,15 +8725,15 @@ postcss-image-set-function@^7.0.0: "@csstools/utilities" "^2.0.0" postcss-value-parser "^4.2.0" -postcss-lab-function@^7.0.11: - version "7.0.11" - resolved "https://registry.yarnpkg.com/postcss-lab-function/-/postcss-lab-function-7.0.11.tgz#455934181eea130f8e649c1f54692e1768046f6a" - integrity sha512-BEA4jId8uQe1gyjZZ6Bunb6ZsH2izks+v25AxQJDBtigXCjTLmCPWECwQpLTtcxH589MVxhs/9TAmRC6lUEmXQ== +postcss-lab-function@^7.0.12: + version "7.0.12" + resolved "https://registry.yarnpkg.com/postcss-lab-function/-/postcss-lab-function-7.0.12.tgz#eb555ac542607730eb0a87555074e4a5c6eef6e4" + integrity sha512-tUcyRk1ZTPec3OuKFsqtRzW2Go5lehW29XA21lZ65XmzQkz43VY2tyWEC202F7W3mILOjw0voOiuxRGTsN+J9w== dependencies: "@csstools/css-color-parser" "^3.1.0" "@csstools/css-parser-algorithms" "^3.0.5" "@csstools/css-tokenizer" "^3.0.4" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" "@csstools/utilities" "^2.0.0" postcss-loader@^7.3.4: @@ -7233,26 +8942,27 @@ postcss-place@^10.0.0: postcss-value-parser "^4.2.0" postcss-preset-env@^10.2.1: - version "10.3.1" - resolved "https://registry.yarnpkg.com/postcss-preset-env/-/postcss-preset-env-10.3.1.tgz#f3799f0f7a7ea384b3c16e073055c231d11bb3bf" - integrity sha512-8ZOOWVwQ0iMpfEYkYo+U6W7fE2dJ/tP6dtEFwPJ66eB5JjnFupfYh+y6zo+vWDO72nGhKOVdxwhTjfzcSNRg4Q== + version "10.6.1" + resolved "https://registry.yarnpkg.com/postcss-preset-env/-/postcss-preset-env-10.6.1.tgz#df30cfc54e90af2dcff5f94104e6f272359c9f65" + integrity sha512-yrk74d9EvY+W7+lO9Aj1QmjWY9q5NsKjK2V9drkOPZB/X6KZ0B3igKsHUYakb7oYVhnioWypQX3xGuePf89f3g== dependencies: - "@csstools/postcss-alpha-function" "^1.0.0" + "@csstools/postcss-alpha-function" "^1.0.1" "@csstools/postcss-cascade-layers" "^5.0.2" - "@csstools/postcss-color-function" "^4.0.11" - "@csstools/postcss-color-function-display-p3-linear" "^1.0.0" - "@csstools/postcss-color-mix-function" "^3.0.11" - "@csstools/postcss-color-mix-variadic-function-arguments" "^1.0.1" - "@csstools/postcss-content-alt-text" "^2.0.7" + "@csstools/postcss-color-function" "^4.0.12" + "@csstools/postcss-color-function-display-p3-linear" "^1.0.1" + "@csstools/postcss-color-mix-function" "^3.0.12" + "@csstools/postcss-color-mix-variadic-function-arguments" "^1.0.2" + "@csstools/postcss-content-alt-text" "^2.0.8" + "@csstools/postcss-contrast-color-function" "^2.0.12" "@csstools/postcss-exponential-functions" "^2.0.9" "@csstools/postcss-font-format-keywords" "^4.0.0" "@csstools/postcss-gamut-mapping" "^2.0.11" - "@csstools/postcss-gradients-interpolation-method" "^5.0.11" - "@csstools/postcss-hwb-function" "^4.0.11" - "@csstools/postcss-ic-unit" "^4.0.3" + "@csstools/postcss-gradients-interpolation-method" "^5.0.12" + "@csstools/postcss-hwb-function" "^4.0.12" + "@csstools/postcss-ic-unit" "^4.0.4" "@csstools/postcss-initial" "^2.0.1" "@csstools/postcss-is-pseudo-class" "^5.0.3" - "@csstools/postcss-light-dark-function" "^2.0.10" + "@csstools/postcss-light-dark-function" "^2.0.11" "@csstools/postcss-logical-float-and-clear" "^3.0.0" "@csstools/postcss-logical-overflow" "^2.0.0" "@csstools/postcss-logical-overscroll-behavior" "^2.0.0" @@ -7261,39 +8971,43 @@ postcss-preset-env@^10.2.1: "@csstools/postcss-media-minmax" "^2.0.9" "@csstools/postcss-media-queries-aspect-ratio-number-values" "^3.0.5" "@csstools/postcss-nested-calc" "^4.0.0" - "@csstools/postcss-normalize-display-values" "^4.0.0" - "@csstools/postcss-oklab-function" "^4.0.11" - "@csstools/postcss-progressive-custom-properties" "^4.2.0" + "@csstools/postcss-normalize-display-values" "^4.0.1" + "@csstools/postcss-oklab-function" "^4.0.12" + "@csstools/postcss-position-area-property" "^1.0.0" + "@csstools/postcss-progressive-custom-properties" "^4.2.1" + "@csstools/postcss-property-rule-prelude-list" "^1.0.0" "@csstools/postcss-random-function" "^2.0.1" - "@csstools/postcss-relative-color-syntax" "^3.0.11" + "@csstools/postcss-relative-color-syntax" "^3.0.12" "@csstools/postcss-scope-pseudo-class" "^4.0.1" "@csstools/postcss-sign-functions" "^1.1.4" "@csstools/postcss-stepped-value-functions" "^4.0.9" + "@csstools/postcss-syntax-descriptor-syntax-production" "^1.0.1" + "@csstools/postcss-system-ui-font-family" "^1.0.0" "@csstools/postcss-text-decoration-shorthand" "^4.0.3" "@csstools/postcss-trigonometric-functions" "^4.0.9" "@csstools/postcss-unset-value" "^4.0.0" - autoprefixer "^10.4.21" - browserslist "^4.25.1" + autoprefixer "^10.4.23" + browserslist "^4.28.1" css-blank-pseudo "^7.0.1" css-has-pseudo "^7.0.3" css-prefers-color-scheme "^10.0.0" - cssdb "^8.4.0" + cssdb "^8.6.0" postcss-attribute-case-insensitive "^7.0.1" postcss-clamp "^4.1.0" - postcss-color-functional-notation "^7.0.11" + postcss-color-functional-notation "^7.0.12" postcss-color-hex-alpha "^10.0.0" postcss-color-rebeccapurple "^10.0.0" postcss-custom-media "^11.0.6" postcss-custom-properties "^14.0.6" postcss-custom-selectors "^8.0.5" postcss-dir-pseudo-class "^9.0.1" - postcss-double-position-gradients "^6.0.3" + postcss-double-position-gradients "^6.0.4" postcss-focus-visible "^10.0.1" postcss-focus-within "^9.0.1" postcss-font-variant "^5.0.0" postcss-gap-properties "^6.0.0" postcss-image-set-function "^7.0.0" - postcss-lab-function "^7.0.11" + postcss-lab-function "^7.0.12" postcss-logical "^8.1.0" postcss-nesting "^13.0.2" postcss-opacity-percentage "^3.0.0" @@ -7346,17 +9060,17 @@ postcss-selector-not@^8.0.1: postcss-selector-parser "^7.0.0" postcss-selector-parser@^6.0.11, postcss-selector-parser@^6.0.16: - version "6.1.2" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz#27ecb41fb0e3b6ba7a1ec84fff347f734c7929de" - integrity sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg== + version "6.1.4" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.1.4.tgz#fdec4ca80f5781bd216ca9bf89a2a0fccfffa5f0" + integrity sha512-bIoJLOmjCO1S9XdY/DcnR5hJxvrDir1PbGChrzXG3vw0/FOliy/fA3dmdhQ441kah4gKv+TwckGzex6wNS5cnQ== dependencies: cssesc "^3.0.0" util-deprecate "^1.0.2" postcss-selector-parser@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-7.1.0.tgz#4d6af97eba65d73bc4d84bcb343e865d7dd16262" - integrity sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA== + version "7.1.4" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-7.1.4.tgz#69dc7a526517572ff6b150e352b36a016017b485" + integrity sha512-HeP7D2wyhkR+XaK6v4W8oRF62Dsz4flyuczALJp61GckGm42u1saSSJ/0auvcBqxs3jMRFEcPK34At/0JBKdOg== dependencies: cssesc "^3.0.0" util-deprecate "^1.0.2" @@ -7394,11 +9108,11 @@ postcss-zindex@^6.0.2: integrity sha512-5BxW9l1evPB/4ZIc+2GobEBoKC+h8gPGCMi+jxsYvd2x0mjq7wazk6DrP71pStqxE9Foxh5TVnonbWpFZzXaYg== postcss@^8.4.21, postcss@^8.4.24, postcss@^8.4.33, postcss@^8.5.4: - version "8.5.6" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.6.tgz#2825006615a619b4f62a9e7426cc120b349a8f3c" - integrity sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg== + version "8.5.16" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.16.tgz#1230ce0b5df354c24c0ea45f99ce5f6a88279d28" + integrity sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg== dependencies: - nanoid "^3.3.11" + nanoid "^3.3.12" picocolors "^1.1.1" source-map-js "^1.2.1" @@ -7450,15 +9164,10 @@ prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1: object-assign "^4.1.1" react-is "^16.13.1" -property-information@^6.0.0: - version "6.5.0" - resolved "https://registry.yarnpkg.com/property-information/-/property-information-6.5.0.tgz#6212fbb52ba757e92ef4fb9d657563b933b7ffec" - integrity sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig== - property-information@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/property-information/-/property-information-7.1.0.tgz#b622e8646e02b580205415586b40804d3e8bfd5d" - integrity sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ== + version "7.2.0" + resolved "https://registry.yarnpkg.com/property-information/-/property-information-7.2.0.tgz#0809b34264e995c0bfcd3227028a1e35210af80a" + integrity sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg== proto-list@~1.2.1: version "1.2.4" @@ -7485,12 +9194,25 @@ pupa@^3.1.0: dependencies: escape-goat "^4.0.0" -qs@6.13.0: - version "6.13.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" - integrity sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg== +pvtsutils@^1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/pvtsutils/-/pvtsutils-1.3.6.tgz#ec46e34db7422b9e4fdc5490578c1883657d6001" + integrity sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg== + dependencies: + tslib "^2.8.1" + +pvutils@^1.1.3, pvutils@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/pvutils/-/pvutils-1.1.5.tgz#84b0dea4a5d670249aa9800511804ee0b7c2809c" + integrity sha512-KTqnxsgGiQ6ZAzZCVlJH5eOjSnvlyEgx1m8bkRJfOhmGRqfo5KLvmAlACQkrjEtOQ4B7wF9TdSLIs9O90MX9xA== + +qs@~6.15.1: + version "6.15.3" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.15.3.tgz#76852132a58ed5c7c0ef67e4441b9bb5d6061b3b" + integrity sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A== dependencies: - side-channel "^1.0.6" + es-define-property "^1.0.1" + side-channel "^1.1.1" queue-microtask@^1.2.2: version "1.2.3" @@ -7514,20 +9236,25 @@ range-parser@1.2.0: resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" integrity sha512-kA5WQoNVo4t9lNx2kQNFCxKeBl5IbbSNBl1M/tLkw9WCn+hxNBAW5Qh8gdhs63CJnhjJ2zQWFoqPJP2sK1AV5A== -range-parser@^1.2.1, range-parser@~1.2.1: +range-parser@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.3.0.tgz#d7f19be812bb62721472b45d3be219ef09572b47" + integrity sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw== + +range-parser@~1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -raw-body@2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" - integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== +raw-body@~2.5.3: + version "2.5.3" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.3.tgz#11c6650ee770a7de1b494f197927de0c923822e2" + integrity sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA== dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.4.24" - unpipe "1.0.0" + bytes "~3.1.2" + http-errors "~2.0.1" + iconv-lite "~0.4.24" + unpipe "~1.0.0" rc@1.2.8: version "1.2.8" @@ -7540,11 +9267,11 @@ rc@1.2.8: strip-json-comments "~2.0.1" react-dom@^19.0.0: - version "19.1.1" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-19.1.1.tgz#2daa9ff7f3ae384aeb30e76d5ee38c046dc89893" - integrity sha512-Dlq/5LAZgF0Gaz6yiqZCf6VCcZs1ghAJyrsu84Q/GT0gV+mCxbfmKNoGRKBYMJ8IEdGPqu49YWXD02GCknEDkw== + version "19.2.7" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-19.2.7.tgz#0450dc9ae9ddbff76ef196401cd8b8c7fb466ccc" + integrity sha512-t0BRVXvbiE/o20Hfw669rLbMCDWtYZLvmJigy2f0MxsXF+71pxhR3xOkspmsO8h3ZlNzyibAmtCa3l4lYKk6gQ== dependencies: - scheduler "^0.26.0" + scheduler "^0.27.0" react-fast-compare@^3.2.0: version "3.2.2" @@ -7567,20 +9294,20 @@ react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== -react-is@^19.1.1: - version "19.1.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-19.1.1.tgz#038ebe313cf18e1fd1235d51c87360eb87f7c36a" - integrity sha512-tr41fA15Vn8p4X9ntI+yCyeGSf1TlYaY5vlTZfQmeLBrFo3psOPX6HhTDnFNL9uj3EhP0KAQ80cugCl4b4BERA== +react-is@^19.2.3: + version "19.2.7" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-19.2.7.tgz#57668ee86a78574a542b0a539455212b2c086df2" + integrity sha512-kZFnouyVv7eP/Phmrlo9FK+zcAdriZJvzxXHF1Sl1P377WSGe2G/JxVolhTrB/jeV47lKImhNUsijjHAAbcl/A== react-json-view-lite@^2.3.0: version "2.5.0" resolved "https://registry.yarnpkg.com/react-json-view-lite/-/react-json-view-lite-2.5.0.tgz#c7ff011c7cc80e9900abc7aa4916c6a5c6d6c1c6" integrity sha512-tk7o7QG9oYyELWHL8xiMQ8x4WzjCzbWNyig3uexmkLb54r8jO0yH3WCWx8UZS0c49eSA4QUmG5caiRJ8fAn58g== -react-loadable-ssr-addon-v5-slorber@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/react-loadable-ssr-addon-v5-slorber/-/react-loadable-ssr-addon-v5-slorber-1.0.1.tgz#2cdc91e8a744ffdf9e3556caabeb6e4278689883" - integrity sha512-lq3Lyw1lGku8zUEJPDxsNm1AfYHBrO9Y1+olAYwpUJ2IGFBskM0DMKok97A6LWUpHm+o7IvQBOWu9MLenp9Z+A== +react-loadable-ssr-addon-v5-slorber@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/react-loadable-ssr-addon-v5-slorber/-/react-loadable-ssr-addon-v5-slorber-1.0.3.tgz#bb3791bf481222c63a5bc6b96ee23f68cb5614b9" + integrity sha512-GXfh9VLwB5ERaCsU6RULh7tkemeX15aNh6wuMEBtfdyMa7fFG8TXrhXlx1SoEK2Ty/l6XIkzzYIQmyaWW3JgdQ== dependencies: "@babel/runtime" "^7.10.3" @@ -7637,9 +9364,9 @@ react-transition-group@^4.4.5: prop-types "^15.6.2" react@^19.0.0: - version "19.1.1" - resolved "https://registry.yarnpkg.com/react/-/react-19.1.1.tgz#06d9149ec5e083a67f9a1e39ce97b06a03b644af" - integrity sha512-w8nqGImo45dmMIfljjMwOGtbmC/mk4CMYhWIicdSflH91J9TyCyczcPFXJzrZ/ZXcgGRFeP6BU0BEJTw6tZdfQ== + version "19.2.7" + resolved "https://registry.yarnpkg.com/react/-/react-19.2.7.tgz#1f47a1bfc06f8ec885752c6f4af14369a9f8260b" + integrity sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ== readable-stream@^2.0.1: version "2.3.8" @@ -7710,6 +9437,11 @@ recma-stringify@^1.0.0: unified "^11.0.0" vfile "^6.0.0" +reflect-metadata@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.2.2.tgz#400c845b6cba87a21f2c65c4aeb158f4fa4d9c5b" + integrity sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q== + regenerate-unicode-properties@^10.2.2: version "10.2.2" resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.2.tgz#aa113812ba899b630658c7623466be71e1f86f66" @@ -7722,24 +9454,24 @@ regenerate@^1.4.2: resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a" integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A== -regexpu-core@^6.2.0: - version "6.3.1" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-6.3.1.tgz#fb8b707d0efe18e9464d3ae76ae1e3c96c8467ae" - integrity sha512-DzcswPr252wEr7Qz8AyAVbfyBDKLoYp6eRA1We2Fa9qirRFSdtkP5sHr3yglDKy2BbA0fd2T+j/CUSKes3FeVQ== +regexpu-core@^6.3.1: + version "6.4.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-6.4.0.tgz#3580ce0c4faedef599eccb146612436b62a176e5" + integrity sha512-0ghuzq67LI9bLXpOX/ISfve/Mq33a4aFRzoQYhnnok1JOFpmE/A2TBGkNVenOGEeSBCjIiWcc6MVOG5HEQv0sA== dependencies: regenerate "^1.4.2" regenerate-unicode-properties "^10.2.2" regjsgen "^0.8.0" - regjsparser "^0.12.0" + regjsparser "^0.13.0" unicode-match-property-ecmascript "^2.0.0" unicode-match-property-value-ecmascript "^2.2.1" registry-auth-token@^5.0.1: - version "5.1.0" - resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-5.1.0.tgz#3c659047ecd4caebd25bc1570a3aa979ae490eca" - integrity sha512-GdekYuwLXLxMuFTwAPg5UKGLW/UXzQrZvH/Zj791BQif5T05T0RsaLfHc9q3ZOKi7n+BoprPD9mJ0O0k4xzUlw== + version "5.1.1" + resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-5.1.1.tgz#f1ff69c8e492e7edee07110b4752dd0a8aa82853" + integrity sha512-P7B4+jq8DeD2nMsAcdfaqHbssgHtZ7Z5+++a5ask90fvmJ8p5je4mOa+wzu+DB4vQ5tdJV/xywY+UnVFeQLV5Q== dependencies: - "@pnpm/npm-conf" "^2.1.0" + "@pnpm/npm-conf" "^3.0.2" registry-url@^6.0.0: version "6.0.1" @@ -7753,12 +9485,12 @@ regjsgen@^0.8.0: resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.8.0.tgz#df23ff26e0c5b300a6470cad160a9d090c3a37ab" integrity sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q== -regjsparser@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.12.0.tgz#0e846df6c6530586429377de56e0475583b088dc" - integrity sha512-cnE+y8bz4NhMjISKbgeVJtqNbtf5QpjZP+Bslo+UqkIt9QPnX9q095eiRRASJG1/tz6dlNr6Z5NsBiWYokp6EQ== +regjsparser@^0.13.0: + version "0.13.2" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.13.2.tgz#f654734b5c588b22ba3e21693b30523417180808" + integrity sha512-NgRBy2Nx/bE+9F27nVHnqcN5HjyLmecqsqx2PJHu3/IEtADD4WuxuXIVExD5PoSDFVrl78dOonfcOe5O+5nbzQ== dependencies: - jsesc "~3.0.2" + jsesc "~3.1.0" rehype-raw@^7.0.0: version "7.0.0" @@ -7875,11 +9607,6 @@ renderkid@^3.0.0: lodash "^4.17.21" strip-ansi "^6.0.1" -repeat-string@^1.0.0: - version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - integrity sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w== - require-from-string@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" @@ -7910,12 +9637,13 @@ resolve-pathname@^3.0.0: resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd" integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng== -resolve@^1.19.0, resolve@^1.22.10: - version "1.22.10" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" - integrity sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w== +resolve@^1.19.0, resolve@^1.22.11: + version "1.22.12" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.12.tgz#f5b2a680897c69c238a13cd16b15671f8b73549f" + integrity sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA== dependencies: - is-core-module "^2.16.0" + es-errors "^1.3.0" + is-core-module "^2.16.1" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -7936,12 +9664,28 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.1.0.tgz#0fe13b9522e1473f51b558ee796e08f11f9b489f" integrity sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw== -rimraf@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" - integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== +rimraf@^6.0.1: + version "6.1.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-6.1.3.tgz#afbee236b3bd2be331d4e7ce4493bac1718981af" + integrity sha512-LKg+Cr2ZF61fkcaK1UdkH2yEBBKnYjTyWzTJT6KNPcSPaiT7HSdhtMXQuN5wkTX0Xu72KQ1l8S42rlmexS2hSA== + dependencies: + glob "^13.0.3" + package-json-from-dist "^1.0.1" + +robust-predicates@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/robust-predicates/-/robust-predicates-3.0.3.tgz#1099061b3349e2c5abec6c2ab0acd440d24d4062" + integrity sha512-NS3levdsRIUOmiJ8FZWCP7LG3QpJyrs/TE0Zpf1yvZu8cAJJ6QMW92H1c7kWpdIHo8RvmLxN/o2JXTKHp74lUA== + +roughjs@^4.6.6: + version "4.6.6" + resolved "https://registry.yarnpkg.com/roughjs/-/roughjs-4.6.6.tgz#1059f49a5e0c80dee541a005b20cc322b222158b" + integrity sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ== dependencies: - glob "^7.1.3" + hachure-fill "^0.5.2" + path-data-parser "^0.1.0" + points-on-curve "^0.2.0" + points-on-path "^0.2.1" rtlcss@^4.1.0: version "4.3.0" @@ -7953,6 +9697,11 @@ rtlcss@^4.1.0: postcss "^8.4.21" strip-json-comments "^3.1.1" +run-applescript@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/run-applescript/-/run-applescript-7.1.0.tgz#2e9e54c4664ec3106c5b5630e249d3d6595c4911" + integrity sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q== + run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -7960,6 +9709,11 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +rw@1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4" + integrity sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ== + safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.1.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" @@ -7970,20 +9724,20 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -"safer-buffer@>= 2.1.2 < 3": +"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sax@^1.2.4: - version "1.4.1" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.4.1.tgz#44cc8988377f126304d3b3fc1010c733b929ef0f" - integrity sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg== +sax@^1.2.4, sax@^1.5.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.6.0.tgz#da59637629307b97e7c4cb28e080a7bc38560d5b" + integrity sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA== -scheduler@^0.26.0: - version "0.26.0" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.26.0.tgz#4ce8a8c2a2095f13ea11bf9a445be50c555d6337" - integrity sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA== +scheduler@^0.27.0: + version "0.27.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.27.0.tgz#0c4ef82d67d1e5c1e359e8fc76d3a87f045fe5bd" + integrity sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q== schema-dts@^1.1.2: version "1.1.5" @@ -7999,10 +9753,10 @@ schema-utils@^3.0.0: ajv "^6.12.5" ajv-keywords "^3.5.2" -schema-utils@^4.0.0, schema-utils@^4.0.1, schema-utils@^4.3.0, schema-utils@^4.3.2: - version "4.3.2" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.3.2.tgz#0c10878bf4a73fd2b1dfd14b9462b26788c806ae" - integrity sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ== +schema-utils@^4.0.0, schema-utils@^4.0.1, schema-utils@^4.2.0, schema-utils@^4.3.0, schema-utils@^4.3.3: + version "4.3.3" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.3.3.tgz#5b1850912fa31df90716963d45d9121fdfc09f46" + integrity sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA== dependencies: "@types/json-schema" "^7.0.9" ajv "^8.9.0" @@ -8027,13 +9781,13 @@ select@^1.1.2: resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d" integrity sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA== -selfsigned@^2.1.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-2.4.1.tgz#560d90565442a3ed35b674034cec4e95dceb4ae0" - integrity sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q== +selfsigned@^5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-5.5.0.tgz#4c9ab7c7c9f35f18fb6a9882c253eb0e6bd6557b" + integrity sha512-ftnu3TW4+3eBfLRFnDEkzGxSF/10BJBkaLJuBHZX0kiPS7bRdlpZGu6YGt4KngMkdTwJE6MbjavFpqHvqVt+Ew== dependencies: - "@types/node-forge" "^1.3.0" - node-forge "^1" + "@peculiar/x509" "^1.14.2" + pkijs "^3.3.3" semver-diff@^4.0.0: version "4.0.0" @@ -8047,72 +9801,72 @@ semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.5, semver@^7.3.7, semver@^7.5.4: - version "7.7.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58" - integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA== +semver@^7.3.5, semver@^7.3.7, semver@^7.5.4, semver@^7.6.3: + version "7.8.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.8.5.tgz#39b646037dd50c14fb451e7e4cac58ed8b863f69" + integrity sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA== -send@0.19.0: - version "0.19.0" - resolved "https://registry.yarnpkg.com/send/-/send-0.19.0.tgz#bbc5a388c8ea6c048967049dbeac0e4a3f09d7f8" - integrity sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw== +send@~0.19.0, send@~0.19.1: + version "0.19.2" + resolved "https://registry.yarnpkg.com/send/-/send-0.19.2.tgz#59bc0da1b4ea7ad42736fd642b1c4294e114ff29" + integrity sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg== dependencies: debug "2.6.9" depd "2.0.0" destroy "1.2.0" - encodeurl "~1.0.2" + encodeurl "~2.0.0" escape-html "~1.0.3" etag "~1.8.1" - fresh "0.5.2" - http-errors "2.0.0" + fresh "~0.5.2" + http-errors "~2.0.1" mime "1.6.0" ms "2.1.3" - on-finished "2.4.1" + on-finished "~2.4.1" range-parser "~1.2.1" - statuses "2.0.1" + statuses "~2.0.2" -serialize-javascript@^6.0.0, serialize-javascript@^6.0.1, serialize-javascript@^6.0.2: +serialize-javascript@^6.0.0, serialize-javascript@^6.0.1: version "6.0.2" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== dependencies: randombytes "^2.1.0" -serve-handler@^6.1.6: - version "6.1.6" - resolved "https://registry.yarnpkg.com/serve-handler/-/serve-handler-6.1.6.tgz#50803c1d3e947cd4a341d617f8209b22bd76cfa1" - integrity sha512-x5RL9Y2p5+Sh3D38Fh9i/iQ5ZK+e4xuXRd/pGbM4D13tgo/MGwbttUk8emytcr1YYzBYs+apnUngBDFYfpjPuQ== +serve-handler@^6.1.7: + version "6.1.7" + resolved "https://registry.yarnpkg.com/serve-handler/-/serve-handler-6.1.7.tgz#e9bb864e87ee71e8dab874cde44d146b77e3fb78" + integrity sha512-CinAq1xWb0vR3twAv9evEU8cNWkXCb9kd5ePAHUKJBkOsUpR1wt/CvGdeca7vqumL1U5cSaeVQ6zZMxiJ3yWsg== dependencies: bytes "3.0.0" content-disposition "0.5.2" mime-types "2.1.18" - minimatch "3.1.2" + minimatch "3.1.5" path-is-inside "1.0.2" path-to-regexp "3.3.0" range-parser "1.2.0" serve-index@^1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" - integrity sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw== + version "1.9.2" + resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.2.tgz#2988e3612106d78a5e4849ddff552ce7bd3d9bcb" + integrity sha512-KDj11HScOaLmrPxl70KYNW1PksP4Nb/CLL2yvC+Qd2kHMPEEpfc4Re2e4FOay+bC/+XQl/7zAcWON3JVo5v3KQ== dependencies: - accepts "~1.3.4" + accepts "~1.3.8" batch "0.6.1" debug "2.6.9" escape-html "~1.0.3" - http-errors "~1.6.2" - mime-types "~2.1.17" - parseurl "~1.3.2" + http-errors "~1.8.0" + mime-types "~2.1.35" + parseurl "~1.3.3" -serve-static@1.16.2: - version "1.16.2" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.16.2.tgz#b6a5343da47f6bdd2673848bf45754941e803296" - integrity sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw== +serve-static@~1.16.2: + version "1.16.3" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.16.3.tgz#a97b74d955778583f3862a4f0b841eb4d5d78cf9" + integrity sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA== dependencies: encodeurl "~2.0.0" escape-html "~1.0.3" parseurl "~1.3.3" - send "0.19.0" + send "~0.19.1" set-function-length@^1.2.2: version "1.2.2" @@ -8126,12 +9880,7 @@ set-function-length@^1.2.2: gopd "^1.0.1" has-property-descriptors "^1.0.2" -setprototypeof@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" - integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ== - -setprototypeof@1.2.0: +setprototypeof@1.2.0, setprototypeof@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== @@ -8148,6 +9897,35 @@ shallowequal@^1.1.0: resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ== +sharp@^0.32.3, sharp@^0.33.0: + version "0.33.5" + resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.33.5.tgz#13e0e4130cc309d6a9497596715240b2ec0c594e" + integrity sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw== + dependencies: + color "^4.2.3" + detect-libc "^2.0.3" + semver "^7.6.3" + optionalDependencies: + "@img/sharp-darwin-arm64" "0.33.5" + "@img/sharp-darwin-x64" "0.33.5" + "@img/sharp-libvips-darwin-arm64" "1.0.4" + "@img/sharp-libvips-darwin-x64" "1.0.4" + "@img/sharp-libvips-linux-arm" "1.0.5" + "@img/sharp-libvips-linux-arm64" "1.0.4" + "@img/sharp-libvips-linux-s390x" "1.0.4" + "@img/sharp-libvips-linux-x64" "1.0.4" + "@img/sharp-libvips-linuxmusl-arm64" "1.0.4" + "@img/sharp-libvips-linuxmusl-x64" "1.0.4" + "@img/sharp-linux-arm" "0.33.5" + "@img/sharp-linux-arm64" "0.33.5" + "@img/sharp-linux-s390x" "0.33.5" + "@img/sharp-linux-x64" "0.33.5" + "@img/sharp-linuxmusl-arm64" "0.33.5" + "@img/sharp-linuxmusl-x64" "0.33.5" + "@img/sharp-wasm32" "0.33.5" + "@img/sharp-win32-ia32" "0.33.5" + "@img/sharp-win32-x64" "0.33.5" + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -8160,18 +9938,18 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -shell-quote@^1.8.3: - version "1.8.3" - resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.8.3.tgz#55e40ef33cf5c689902353a3d8cd1a6725f08b4b" - integrity sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw== +shell-quote@^1.8.4: + version "1.9.0" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.9.0.tgz#e108b1a136586d5964edb3300016d4bedba0fe57" + integrity sha512-Iov+JwFv/2HcTpcwNMKd8+IWNb8tboQJNQTkAY/LLVK7gGH9jy+LGkVqPxfekHl+yMmiqXszdGWXgkfml7hjqA== -side-channel-list@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.0.tgz#10cb5984263115d3b7a0e336591e290a830af8ad" - integrity sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA== +side-channel-list@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.1.tgz#c2e0b5a14a540aebee3bbc6c3f8666cc9b509127" + integrity sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w== dependencies: es-errors "^1.3.0" - object-inspect "^1.13.3" + object-inspect "^1.13.4" side-channel-map@^1.0.1: version "1.0.1" @@ -8194,14 +9972,14 @@ side-channel-weakmap@^1.0.2: object-inspect "^1.13.3" side-channel-map "^1.0.1" -side-channel@^1.0.6: - version "1.1.0" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" - integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== +side-channel@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.1.tgz#ea02c62e05dc4bea67d4442f0fb71ee192f8e0ab" + integrity sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ== dependencies: es-errors "^1.3.0" - object-inspect "^1.13.3" - side-channel-list "^1.0.0" + object-inspect "^1.13.4" + side-channel-list "^1.0.1" side-channel-map "^1.0.1" side-channel-weakmap "^1.0.2" @@ -8210,6 +9988,13 @@ signal-exit@^3.0.2, signal-exit@^3.0.3: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +simple-swizzle@^0.2.2: + version "0.2.4" + resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.4.tgz#a8d11a45a11600d6a1ecdff6363329e3648c3667" + integrity sha512-nAu1WFPQSMNr2Zn9PGSZK9AGn4t/y97lEm+MXTtUDwfP0ksAIX4nO+6ruD9Jwut4C49SB1Ws+fbXsm/yScWOHw== + dependencies: + is-arrayish "^0.3.1" + sirv@^2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/sirv/-/sirv-2.0.4.tgz#5dd9a725c578e34e449f332703eb2a74e46a29b0" @@ -8225,9 +10010,9 @@ sisteransi@^1.0.5: integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== sitemap@^7.1.1: - version "7.1.2" - resolved "https://registry.yarnpkg.com/sitemap/-/sitemap-7.1.2.tgz#6ce1deb43f6f177c68bc59cf93632f54e3ae6b72" - integrity sha512-ARCqzHJ0p4gWt+j7NlU5eDlIO9+Rkr/JhPFZKKQ1l5GCus7rJH4UdrlVAh0xC/gDS/Qir2UMxqYNHtsKr2rpCw== + version "7.1.3" + resolved "https://registry.yarnpkg.com/sitemap/-/sitemap-7.1.3.tgz#2b756f79f0b77527c0eaba280c722e4c66c08886" + integrity sha512-tAjEd+wt/YwnEbfNB2ht51ybBJxbEWwe5ki/Z//Wh0rpBFTCUSj46GnxUKEWzhfuJTsee8x3lybHxFgUMig2hw== dependencies: "@types/node" "^17.0.5" "@types/sax" "^1.2.1" @@ -8329,30 +10114,25 @@ spdy@^4.0.2: select-hose "^2.0.0" spdy-transport "^3.0.0" -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== - srcset@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/srcset/-/srcset-4.0.0.tgz#336816b665b14cd013ba545b6fe62357f86e65f4" integrity sha512-wvLeHgcVHKO8Sc/H/5lkGreJQVeYMm9rlmt8PuR1xE31rIuXhuzznUUqAt8MqLhB3MqJdFzlNAfpcWnxiFUcPw== -statuses@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" - integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== - -"statuses@>= 1.4.0 < 2": +"statuses@>= 1.5.0 < 2": version "1.5.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== +statuses@~2.0.1, statuses@~2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.2.tgz#8f75eecef765b5e1cfcdc080da59409ed424e382" + integrity sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw== + std-env@^3.7.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.9.0.tgz#1a6f7243b339dca4c9fd55e1c7504c77ef23e8f1" - integrity sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw== + version "3.10.0" + resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.10.0.tgz#d810b27e3a073047b2b5e40034881f5ea6f9c83b" + integrity sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg== string-width@^4.1.0, string-width@^4.2.0: version "4.2.3" @@ -8403,7 +10183,7 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -8411,11 +10191,11 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: ansi-regex "^5.0.1" strip-ansi@^7.0.1: - version "7.1.2" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.2.tgz#132875abde678c7ea8d691533f2e7e22bb744dba" - integrity sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA== + version "7.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.2.0.tgz#d22a269522836a627af8d04b5c3fd2c7fa3e32e3" + integrity sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w== dependencies: - ansi-regex "^6.0.1" + ansi-regex "^6.2.2" strip-bom-string@^1.0.0: version "1.0.0" @@ -8438,18 +10218,18 @@ strip-json-comments@~2.0.1: integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== style-to-js@^1.0.0: - version "1.1.17" - resolved "https://registry.yarnpkg.com/style-to-js/-/style-to-js-1.1.17.tgz#488b1558a8c1fd05352943f088cc3ce376813d83" - integrity sha512-xQcBGDxJb6jjFCTzvQtfiPn6YvvP2O8U1MDIPNfJQlWMYfktPy+iGsHE7cssjs7y84d9fQaK4UF3RIJaAHSoYA== + version "1.1.21" + resolved "https://registry.yarnpkg.com/style-to-js/-/style-to-js-1.1.21.tgz#2908941187f857e79e28e9cd78008b9a0b3e0e8d" + integrity sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ== dependencies: - style-to-object "1.0.9" + style-to-object "1.0.14" -style-to-object@1.0.9: - version "1.0.9" - resolved "https://registry.yarnpkg.com/style-to-object/-/style-to-object-1.0.9.tgz#35c65b713f4a6dba22d3d0c61435f965423653f0" - integrity sha512-G4qppLgKu/k6FwRpHiGiKPaPTFcG3g4wNVX/Qsfu+RqQM30E7Tyu/TEgxcL9PNLF5pdRLwQdE3YKKf+KF2Dzlw== +style-to-object@1.0.14: + version "1.0.14" + resolved "https://registry.yarnpkg.com/style-to-object/-/style-to-object-1.0.14.tgz#1d22f0e7266bb8c6d8cae5caf4ec4f005e08f611" + integrity sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw== dependencies: - inline-style-parser "0.2.4" + inline-style-parser "0.2.7" stylehacks@^6.1.1: version "6.1.1" @@ -8464,6 +10244,11 @@ stylis@4.2.0: resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.2.0.tgz#79daee0208964c8fe695a42fcffcac633a211a51" integrity sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw== +stylis@^4.3.6: + version "4.4.0" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.4.0.tgz#c5846c9345f4bfc51bd0cbd7ca35a0744f485a5d" + integrity sha512-5Z9ZpRzfuH6l/UAvCPAPUo3665Nk2wLaZU3x+TLHKVzIz33+sbJqbtrYoC3KD4/uVOr2Zp+L0LySezP9OHV9yA== + supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" @@ -8489,44 +10274,55 @@ svg-parser@^2.0.4: integrity sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ== svgo@^3.0.2, svgo@^3.2.0: - version "3.3.2" - resolved "https://registry.yarnpkg.com/svgo/-/svgo-3.3.2.tgz#ad58002652dffbb5986fc9716afe52d869ecbda8" - integrity sha512-OoohrmuUlBs8B8o6MB2Aevn+pRIH9zDALSR+6hhqVfa6fRwG/Qw9VUMSMW9VNg2CFc/MTIfabtdOVl9ODIJjpw== + version "3.3.3" + resolved "https://registry.yarnpkg.com/svgo/-/svgo-3.3.3.tgz#8246aee0b08791fde3b0ed22b5661b471fadf58e" + integrity sha512-+wn7I4p7YgJhHs38k2TNjy1vCfPIfLIJWR5MnCStsN8WuuTcBnRKcMHQLMM2ijxGZmDoZwNv8ipl5aTTen62ng== dependencies: - "@trysound/sax" "0.2.0" commander "^7.2.0" css-select "^5.1.0" css-tree "^2.3.1" css-what "^6.1.0" csso "^5.0.5" picocolors "^1.0.0" + sax "^1.5.0" -tapable@^2.0.0, tapable@^2.1.1, tapable@^2.2.0, tapable@^2.2.1: - version "2.2.3" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.3.tgz#4b67b635b2d97578a06a2713d2f04800c237e99b" - integrity sha512-ZL6DDuAlRlLGghwcfmSn9sK3Hr6ArtyudlSAiCqQ6IfE+b+HHbydbYDIG15IfS5do+7XQQBdBiubF/cV2dnDzg== +swc-loader@^0.2.6: + version "0.2.7" + resolved "https://registry.yarnpkg.com/swc-loader/-/swc-loader-0.2.7.tgz#2d1611ab314c5d8342d74aa5e5901b3fbf490de2" + integrity sha512-nwYWw3Fh9ame3Rtm7StS9SBLpHRRnYcK7bnpF3UKZmesAK0gw2/ADvlURFAINmPvKtDLzp+GBiP9yLoEjg6S9w== + dependencies: + "@swc/counter" "^0.1.3" + +tapable@^2.0.0, tapable@^2.2.1, tapable@^2.3.0, tapable@^2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.3.3.tgz#5da7c9992c46038221267985ab28421a8879f160" + integrity sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A== -terser-webpack-plugin@^5.3.11, terser-webpack-plugin@^5.3.9: - version "5.3.14" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz#9031d48e57ab27567f02ace85c7d690db66c3e06" - integrity sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw== +terser-webpack-plugin@^5.3.9: + version "5.6.1" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.6.1.tgz#47bc41bd8b8fab8383b62ec763b7394829097e7b" + integrity sha512-201R5j+sJpK8nFWwKVyNfZot8FaJbLZDq5evriVzbV1wDtSXDjRUDRfJzHpAaxFDMEhsZL1QkeqM61wgsS3KaQ== dependencies: "@jridgewell/trace-mapping" "^0.3.25" jest-worker "^27.4.5" schema-utils "^4.3.0" - serialize-javascript "^6.0.2" terser "^5.31.1" terser@^5.10.0, terser@^5.15.1, terser@^5.31.1: - version "5.44.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.44.0.tgz#ebefb8e5b8579d93111bfdfc39d2cf63879f4a82" - integrity sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w== + version "5.49.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.49.0.tgz#30b341fdf70cfc98486965125ae660fda8403670" + integrity sha512-SNiDnXyHSrxVcIOtVbULzcTmniUiwcV7Nwdyj1twVubeTmbjoa8p69KKDpfkdoOavuM4/GRm1+ykI8qqnavHoA== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.15.0" commander "^2.20.0" source-map-support "~0.5.20" +thingies@^2.5.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/thingies/-/thingies-2.6.0.tgz#e09b98b9e6f6caf8a759eca8481fea1de974d2b1" + integrity sha512-rMHRjmlFLM1R96UYPvpmnc3LYtdFrT33JIB7L9hetGue1qAPfn1N2LJeEjxUSidu1Iku+haLZXDuEXUHNGO/lg== + thunky@^1.0.2: version "1.1.0" resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" @@ -8547,6 +10343,11 @@ tiny-warning@^1.0.0: resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== +tinyexec@^1.0.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/tinyexec/-/tinyexec-1.2.4.tgz#ae45bb2edebda94c70f4ea897e0f1243e470db71" + integrity sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg== + tinypool@^1.0.2: version "1.1.1" resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-1.1.1.tgz#059f2d042bd37567fbc017d3d426bdd2a2612591" @@ -8559,7 +10360,7 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -toidentifier@1.0.1: +toidentifier@1.0.1, toidentifier@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== @@ -8569,6 +10370,11 @@ totalist@^3.0.0: resolved "https://registry.yarnpkg.com/totalist/-/totalist-3.0.1.tgz#ba3a3d600c915b1a97872348f79c127475f6acf8" integrity sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ== +tree-dump@^1.0.3, tree-dump@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/tree-dump/-/tree-dump-1.1.0.tgz#ab29129169dc46004414f5a9d4a3c6e89f13e8a4" + integrity sha512-rMuvhU4MCDbcbnleZTFezWsaZXRFemSqAM+7jPnzUl1fo9w3YEKOxAeui0fz3OI4EU4hf23iyA7uQRVko+UaBA== + trim-lines@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/trim-lines/-/trim-lines-3.0.1.tgz#d802e332a07df861c48802c04321017b1bd87338" @@ -8579,15 +10385,27 @@ trough@^2.0.0: resolved "https://registry.yarnpkg.com/trough/-/trough-2.2.0.tgz#94a60bd6bd375c152c1df911a4b11d5b0256f50f" integrity sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw== -tslib@^2.0.3, tslib@^2.6.0: +ts-dedent@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/ts-dedent/-/ts-dedent-2.3.0.tgz#8fac36c7902b541c154ac13a27ac467997af11f8" + integrity sha512-JfJeIHke7y2egdGGgRAvpCwYFUsHlM2gPcrVOxFkznt/4uzQ7HFmvE63iFHVLBJNDuyDOQgijDK/tXH/f6Msjg== + +tslib@^1.9.3: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tslib@^2.0.0, tslib@^2.0.3, tslib@^2.4.0, tslib@^2.6.0, tslib@^2.8.1: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== -type-fest@^0.21.3: - version "0.21.3" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" - integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== +tsyringe@^4.10.0: + version "4.10.0" + resolved "https://registry.yarnpkg.com/tsyringe/-/tsyringe-4.10.0.tgz#d0c95815d584464214060285eaaadd94aa03299c" + integrity sha512-axr3IdNuVIxnaK5XGEUFTu3YmAQ6lllgrvqfEoR16g/HGnYY/6We4oWENtAnzK6/LpJ2ur9PAb80RBt7/U4ugw== + dependencies: + tslib "^1.9.3" type-fest@^1.0.1: version "1.4.0" @@ -8614,10 +10432,10 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -undici-types@~7.12.0: - version "7.12.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.12.0.tgz#15c5c7475c2a3ba30659529f5cdb4674b622fafb" - integrity sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ== +undici-types@~8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-8.3.0.tgz#44e9fc9f3244648cdea35e4f9bb2d681e9410809" + integrity sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ== unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.1" @@ -8668,9 +10486,9 @@ unique-string@^3.0.0: crypto-random-string "^4.0.0" unist-util-is@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-6.0.0.tgz#b775956486aff107a9ded971d996c173374be424" - integrity sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw== + version "6.0.1" + resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-6.0.1.tgz#d0a3f86f2dd0db7acd7d8c2478080b5c67f9c6a9" + integrity sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g== dependencies: "@types/unist" "^3.0.0" @@ -8696,17 +10514,17 @@ unist-util-stringify-position@^4.0.0: "@types/unist" "^3.0.0" unist-util-visit-parents@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz#4d5f85755c3b8f0dc69e21eca5d6d82d22162815" - integrity sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw== + version "6.0.2" + resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz#777df7fb98652ce16b4b7cd999d0a1a40efa3a02" + integrity sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ== dependencies: "@types/unist" "^3.0.0" unist-util-is "^6.0.0" unist-util-visit@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-5.0.0.tgz#a7de1f31f72ffd3519ea71814cccf5fd6a9217d6" - integrity sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg== + version "5.1.0" + resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-5.1.0.tgz#9a2a28b0aa76a15e0da70a08a5863a2f060e2468" + integrity sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg== dependencies: "@types/unist" "^3.0.0" unist-util-is "^6.0.0" @@ -8717,15 +10535,15 @@ universalify@^2.0.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== -unpipe@1.0.0, unpipe@~1.0.0: +unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== -update-browserslist-db@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz#348377dd245216f9e7060ff50b15a1b740b75420" - integrity sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw== +update-browserslist-db@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz#64d76db58713136acbeb4c49114366cc6cc2e80d" + integrity sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w== dependencies: escalade "^3.2.0" picocolors "^1.1.1" @@ -8786,10 +10604,10 @@ utils-merge@1.0.1: resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== -uuid@^8.3.2: - version "8.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" - integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== +uuid@^11.0.0, "uuid@^11.1.0 || ^12 || ^13 || ^14.0.0", uuid@^8.3.2: + version "11.1.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-11.1.1.tgz#f6d81d2e1c65d00762e5e29b16c5d2d995e208ad" + integrity sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ== value-equal@^1.0.1: version "1.0.1" @@ -8825,12 +10643,11 @@ vfile@^6.0.0, vfile@^6.0.1: "@types/unist" "^3.0.0" vfile-message "^4.0.0" -watchpack@^2.4.1: - version "2.4.4" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.4.tgz#473bda72f0850453da6425081ea46fc0d7602947" - integrity sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA== +watchpack@^2.5.2: + version "2.5.2" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.5.2.tgz#e12e82d84674266fc1c6dbfe38891b92ff0522ec" + integrity sha512-6i/00NBjP4yGPs+caKSyRfpTF/8Torsu0MOW3mMzIbhgISFder8i7xbqgHlLMwJrdiN8ndBV3UA1/AfzPSr+jg== dependencies: - glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" wbuf@^1.1.0, wbuf@^1.7.3: @@ -8863,52 +10680,51 @@ webpack-bundle-analyzer@^4.10.2: sirv "^2.0.3" ws "^7.3.1" -webpack-dev-middleware@^5.3.4: - version "5.3.4" - resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz#eb7b39281cbce10e104eb2b8bf2b63fce49a3517" - integrity sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q== +webpack-dev-middleware@^7.4.2: + version "7.4.5" + resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-7.4.5.tgz#d4e8720aa29cb03bc158084a94edb4594e3b7ac0" + integrity sha512-uxQ6YqGdE4hgDKNf7hUiPXOdtkXvBJXrfEGYSx7P7LC8hnUYGK70X6xQXUvXeNyBDDcsiQXpG2m3G9vxowaEuA== dependencies: colorette "^2.0.10" - memfs "^3.4.3" - mime-types "^2.1.31" + memfs "^4.43.1" + mime-types "^3.0.1" + on-finished "^2.4.1" range-parser "^1.2.1" schema-utils "^4.0.0" -webpack-dev-server@^4.15.2: - version "4.15.2" - resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.15.2.tgz#9e0c70a42a012560860adb186986da1248333173" - integrity sha512-0XavAZbNJ5sDrCbkpWL8mia0o5WPOd2YGtxrEiZkBK9FjLppIUK2TgxK6qGD2P3hUXTJNNPVibrerKcx5WkR1g== - dependencies: - "@types/bonjour" "^3.5.9" - "@types/connect-history-api-fallback" "^1.3.5" - "@types/express" "^4.17.13" - "@types/serve-index" "^1.9.1" - "@types/serve-static" "^1.13.10" - "@types/sockjs" "^0.3.33" - "@types/ws" "^8.5.5" +webpack-dev-server@^5.2.2: + version "5.2.6" + resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-5.2.6.tgz#3a5d41233cbb7504f814d19e59a59173fb8ae23d" + integrity sha512-HNLRmamRvVavZQ+avceZifmv8hmdUjg43t6MI4SqJDwFdW7RPQwH5vzGhDRZSX59SgfbeHhLnq3g+uooWo7pVw== + dependencies: + "@types/bonjour" "^3.5.13" + "@types/connect-history-api-fallback" "^1.5.4" + "@types/express" "^4.17.25" + "@types/express-serve-static-core" "^4.17.21" + "@types/serve-index" "^1.9.4" + "@types/serve-static" "^1.15.5" + "@types/sockjs" "^0.3.36" + "@types/ws" "^8.5.10" ansi-html-community "^0.0.8" - bonjour-service "^1.0.11" - chokidar "^3.5.3" + bonjour-service "^1.2.1" + chokidar "^3.6.0" colorette "^2.0.10" - compression "^1.7.4" + compression "^1.8.1" connect-history-api-fallback "^2.0.0" - default-gateway "^6.0.3" - express "^4.17.3" + express "^4.22.1" graceful-fs "^4.2.6" - html-entities "^2.3.2" - http-proxy-middleware "^2.0.3" - ipaddr.js "^2.0.1" - launch-editor "^2.6.0" - open "^8.0.9" - p-retry "^4.5.0" - rimraf "^3.0.2" - schema-utils "^4.0.0" - selfsigned "^2.1.1" + http-proxy-middleware "^2.0.9" + ipaddr.js "^2.1.0" + launch-editor "^2.14.1" + open "^10.0.3" + p-retry "^6.2.0" + schema-utils "^4.2.0" + selfsigned "^5.5.0" serve-index "^1.9.1" sockjs "^0.3.24" spdy "^4.0.2" - webpack-dev-middleware "^5.3.4" - ws "^8.13.0" + webpack-dev-middleware "^7.4.2" + ws "^8.18.0" webpack-merge@^5.9.0: version "5.10.0" @@ -8928,60 +10744,53 @@ webpack-merge@^6.0.1: flat "^5.0.2" wildcard "^2.0.1" -webpack-sources@^3.3.3: - version "3.3.3" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.3.3.tgz#d4bf7f9909675d7a070ff14d0ef2a4f3c982c723" - integrity sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg== +webpack-sources@^3.5.0: + version "3.5.1" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.5.1.tgz#76c2418486dcc02b2aa0694c104176c2858fe84a" + integrity sha512-jyuiGJdtvY434z5bUZrjz67v76/ePNvFZTp9Mdz29IlH4+GPsgyGjiv0fKI+M7BdkU6ADjulUcKAd3tUK3WlEw== webpack@^5.88.1, webpack@^5.95.0: - version "5.101.3" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.101.3.tgz#3633b2375bb29ea4b06ffb1902734d977bc44346" - integrity sha512-7b0dTKR3Ed//AD/6kkx/o7duS8H3f1a4w3BYpIriX4BzIhjkn4teo05cptsxvLesHFKK5KObnadmCHBwGc+51A== + version "5.108.4" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.108.4.tgz#141818a411662773a0bb32dc5536acc5409943b7" + integrity sha512-yur8LyJoeiWh47dErD+Ok7vlbmDsJ3UbbRPAoxbGJ54WpE2y5yVo5G/inUzujnYgw3tPmBRdn+G7PoxXaYC33w== dependencies: - "@types/eslint-scope" "^3.7.7" "@types/estree" "^1.0.8" "@types/json-schema" "^7.0.15" "@webassemblyjs/ast" "^1.14.1" "@webassemblyjs/wasm-edit" "^1.14.1" "@webassemblyjs/wasm-parser" "^1.14.1" - acorn "^8.15.0" + acorn "^8.16.0" acorn-import-phases "^1.0.3" - browserslist "^4.24.0" + browserslist "^4.28.1" chrome-trace-event "^1.0.2" - enhanced-resolve "^5.17.3" - es-module-lexer "^1.2.1" + enhanced-resolve "^5.22.2" + es-module-lexer "^2.1.0" eslint-scope "5.1.1" events "^3.2.0" - glob-to-regexp "^0.4.1" graceful-fs "^4.2.11" - json-parse-even-better-errors "^2.3.1" - loader-runner "^4.2.0" - mime-types "^2.1.27" + loader-runner "^4.3.2" + mime-db "^1.54.0" + minimizer-webpack-plugin "^5.6.1" neo-async "^2.6.2" - schema-utils "^4.3.2" - tapable "^2.1.1" - terser-webpack-plugin "^5.3.11" - watchpack "^2.4.1" - webpack-sources "^3.3.3" + schema-utils "^4.3.3" + tapable "^2.3.0" + watchpack "^2.5.2" + webpack-sources "^3.5.0" -webpackbar@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/webpackbar/-/webpackbar-6.0.1.tgz#5ef57d3bf7ced8b19025477bc7496ea9d502076b" - integrity sha512-TnErZpmuKdwWBdMoexjio3KKX6ZtoKHRVvLIU0A47R0VVBDtx3ZyOJDktgYixhoJokZTYTt1Z37OkO9pnGJa9Q== +webpackbar@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/webpackbar/-/webpackbar-7.0.0.tgz#7228d32881af2392381b6514499ddea73cdf218a" + integrity sha512-aS9soqSO2iCHgqHoCrj4LbfGQUboDCYJPSFOAchEK+9psIjNrfSWW4Y0YEz67MKURNvMmfo0ycOg9d/+OOf9/Q== dependencies: - ansi-escapes "^4.3.2" - chalk "^4.1.2" + ansis "^3.2.0" consola "^3.2.3" - figures "^3.2.0" - markdown-table "^2.0.0" pretty-time "^1.1.0" std-env "^3.7.0" - wrap-ansi "^7.0.0" websocket-driver@>=0.5.1, websocket-driver@^0.7.4: - version "0.7.4" - resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.4.tgz#89ad5295bbf64b480abcba31e4953aca706f5760" - integrity sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg== + version "0.7.5" + resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.5.tgz#569d22764ab21f2de20af0e74b411e8ae5a0fa46" + integrity sha512-ZL2+3c7kMBdIRCMz6l8jQMHyGVxj+UL+xVk74Ombiciboca8rHa15L86B19E5oh1pL9Ii/uj54gtsIrZGMo6zA== dependencies: http-parser-js ">=0.5.1" safe-buffer ">=5.1.0" @@ -9011,15 +10820,6 @@ wildcard@^2.0.0, wildcard@^2.0.1: resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.1.tgz#5ab10d02487198954836b6349f74fff961e10f67" integrity sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ== -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" @@ -9029,11 +10829,6 @@ wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: string-width "^5.0.1" strip-ansi "^7.0.1" -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - write-file-atomic@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" @@ -9045,14 +10840,21 @@ write-file-atomic@^3.0.3: typedarray-to-buffer "^3.1.5" ws@^7.3.1: - version "7.5.10" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" - integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== + version "7.5.11" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.11.tgz#9460daf1812bb81a423c5b9eac746941a86310fa" + integrity sha512-zS54Oen9bITtp7kp2XM3AydrCIq1D+HwJOuH+c+e4LfpL/lotP5osijd+UoMnxwAam1GN8R4KtLAyIrIcBNpiA== -ws@^8.13.0: - version "8.18.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.3.tgz#b56b88abffde62791c639170400c93dcb0c95472" - integrity sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg== +ws@^8.18.0: + version "8.21.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.21.0.tgz#012e413fc07429945121b0c153158c4343086951" + integrity sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g== + +wsl-utils@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/wsl-utils/-/wsl-utils-0.1.0.tgz#8783d4df671d4d50365be2ee4c71917a0557baab" + integrity sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw== + dependencies: + is-wsl "^3.1.0" xdg-basedir@^5.0.1, xdg-basedir@^5.1.0: version "5.1.0" @@ -9072,14 +10874,14 @@ yallist@^3.0.2: integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== yaml@^1.10.0: - version "1.10.2" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" - integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== + version "1.10.3" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.3.tgz#76e407ed95c42684fb8e14641e5de62fe65bbcb3" + integrity sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA== yocto-queue@^1.0.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.2.1.tgz#36d7c4739f775b3cbc28e6136e21aa057adec418" - integrity sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg== + version "1.2.2" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.2.2.tgz#3e09c95d3f1aa89a58c114c99223edf639152c00" + integrity sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ== zwitch@^2.0.0: version "2.0.4"