SpyBara
Go Premium

Reference 2026-09-10 18:01 UTC to 2026-09-11 20:00 UTC

89 files changed +58,409 −191,809. View all changes and history on the product overview
2026
Wed 30 22:59 Tue 29 22:57 Mon 28 22:57 Sun 27 23:58 Sat 26 23:59 Fri 25 23:58 Thu 24 23:58 Wed 23 23:58 Tue 22 23:57 Mon 21 23:00 Sat 19 23:00 Fri 18 22:59 Wed 16 22:58 Fri 11 20:00 Thu 10 18:01 Wed 9 16:02 Fri 4 23:59 Thu 3 23:00 Wed 2 01:58 Tue 1 01:57
Details

2 2 

3> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.3> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.

4 4 

5<a id="transcript.text.segment"></a>

6 

5## transcript.text.segment7## transcript.text.segment

6 8 

7Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with `stream` set to `true` and `response_format` set to `diarized_json`.9Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with `stream` set to `true` and `response_format` set to `diarized_json`.


10 12 

11Schema name: `TranscriptTextSegmentEvent`13Schema name: `TranscriptTextSegmentEvent`

12 14 

13```json15- `id: string`

14{16 

15 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema)": {17 Unique identifier for the segment.

16 "kind": "HttpDeclTypeAlias",18 

17 "oasRef": "#/components/schemas/TranscriptTextSegmentEvent",19- `end: number`

18 "docstring": "Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you [create a transcription](/api/reference/resources/audio/subresources/transcriptions/methods/create) with `stream` set to `true` and `response_format` set to `diarized_json`.\n",20 

19 "ident": "TranscriptionTextSegmentEvent",21 End timestamp of the segment in seconds.

20 "type": {22 

21 "kind": "HttpTypeObject",23- `speaker: string`

22 "members": [24 

23 {25 Speaker label for this segment.

24 "ident": "id"26 

25 },27- `start: number`

26 {28 

27 "ident": "end"29 Start timestamp of the segment in seconds.

28 },30 

29 {31- `text: string`

30 "ident": "speaker"32 

31 },33 Transcript text for this segment.

32 {34 

33 "ident": "start"35- `type: "transcript.text.segment"`

34 },36 

35 {37 The type of the event. Always `transcript.text.segment`.

36 "ident": "text"38 

37 },39 - `"transcript.text.segment"`

38 {

39 "ident": "type"

40 }

41 ]

42 },

43 "childrenParentSchema": "object",

44 "children": [

45 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) id",

46 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) end",

47 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) speaker",

48 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) start",

49 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) text",

50 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) type"

51 ]

52 },

53 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) id": {

54 "kind": "HttpDeclProperty",

55 "oasRef": "#/components/schemas/TranscriptTextSegmentEvent/properties/id",

56 "deprecated": false,

57 "key": "id",

58 "docstring": "Unique identifier for the segment.",

59 "type": {

60 "kind": "HttpTypeString"

61 },

62 "optional": false,

63 "nullable": false,

64 "schemaType": "string",

65 "children": []

66 },

67 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) end": {

68 "kind": "HttpDeclProperty",

69 "oasRef": "#/components/schemas/TranscriptTextSegmentEvent/properties/end",

70 "deprecated": false,

71 "key": "end",

72 "docstring": "End timestamp of the segment in seconds.",

73 "type": {

74 "kind": "HttpTypeNumber"

75 },

76 "constraints": {

77 "format": "double"

78 },

79 "optional": false,

80 "nullable": false,

81 "schemaType": "number",

82 "children": []

83 },

84 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) speaker": {

85 "kind": "HttpDeclProperty",

86 "oasRef": "#/components/schemas/TranscriptTextSegmentEvent/properties/speaker",

87 "deprecated": false,

88 "key": "speaker",

89 "docstring": "Speaker label for this segment.",

90 "type": {

91 "kind": "HttpTypeString"

92 },

93 "optional": false,

94 "nullable": false,

95 "schemaType": "string",

96 "children": []

97 },

98 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) start": {

99 "kind": "HttpDeclProperty",

100 "oasRef": "#/components/schemas/TranscriptTextSegmentEvent/properties/start",

101 "deprecated": false,

102 "key": "start",

103 "docstring": "Start timestamp of the segment in seconds.",

104 "type": {

105 "kind": "HttpTypeNumber"

106 },

107 "constraints": {

108 "format": "double"

109 },

110 "optional": false,

111 "nullable": false,

112 "schemaType": "number",

113 "children": []

114 },

115 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) text": {

116 "kind": "HttpDeclProperty",

117 "oasRef": "#/components/schemas/TranscriptTextSegmentEvent/properties/text",

118 "deprecated": false,

119 "key": "text",

120 "docstring": "Transcript text for this segment.",

121 "type": {

122 "kind": "HttpTypeString"

123 },

124 "optional": false,

125 "nullable": false,

126 "schemaType": "string",

127 "children": []

128 },

129 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) type": {

130 "kind": "HttpDeclProperty",

131 "oasRef": "#/components/schemas/TranscriptTextSegmentEvent/properties/type",

132 "deprecated": false,

133 "key": "type",

134 "docstring": "The type of the event. Always `transcript.text.segment`.",

135 "type": {

136 "kind": "HttpTypeUnion",

137 "oasRef": "#/components/schemas/TranscriptTextSegmentEvent/properties/type",

138 "types": [

139 {

140 "kind": "HttpTypeLiteral",

141 "literal": "transcript.text.segment"

142 }

143 ]

144 },

145 "optional": false,

146 "nullable": false,

147 "schemaType": "enum",

148 "childrenParentSchema": "enum",

149 "children": [

150 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) type > (member) 0"

151 ]

152 },

153 "(resource) audio.transcriptions > (model) transcription_text_segment_event > (schema) > (property) type > (member) 0": {

154 "kind": "HttpDeclReference",

155 "type": {

156 "kind": "HttpTypeLiteral",

157 "literal": "transcript.text.segment"

158 }

159 }

160}

161```

162 40 

163### Example41### Example

164 42 


173}51}

174```52```

175 53 

54<a id="transcript.text.delta"></a>

55 

176## transcript.text.delta56## transcript.text.delta

177 57 

178Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`.58Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`.


181 61 

182Schema name: `TranscriptTextDeltaEvent`62Schema name: `TranscriptTextDeltaEvent`

183 63 

184```json64- `delta: string`

185{65 

186 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema)": {66 The text delta that was additionally transcribed.

187 "kind": "HttpDeclTypeAlias",67 

188 "oasRef": "#/components/schemas/TranscriptTextDeltaEvent",68- `type: "transcript.text.delta"`

189 "docstring": "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](/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`.",69 

190 "ident": "TranscriptionTextDeltaEvent",70 The type of the event. Always `transcript.text.delta`.

191 "type": {71 

192 "kind": "HttpTypeObject",72 - `"transcript.text.delta"`

193 "members": [73 

194 {74- `logprobs: optional array of object { token, bytes, logprob }`

195 "ident": "delta"75 

196 },76 The log probabilities of the delta. Only included if you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `include[]` parameter set to `logprobs`.

197 {77 

198 "ident": "type"78 - `token: optional string`

199 },79 

200 {80 The token that was used to generate the log probability.

201 "ident": "logprobs"81 

202 },82 - `bytes: optional array of number`

203 {83 

204 "ident": "segment_id"84 The bytes that were used to generate the log probability.

205 }85 

206 ]86 - `logprob: optional number`

207 },87 

208 "childrenParentSchema": "object",88 The log probability of the token.

209 "children": [89 

210 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) delta",90- `segment_id: optional string`

211 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) type",91 

212 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) logprobs",92 Identifier of the diarized segment that this delta belongs to. Only present when using `gpt-4o-transcribe-diarize`.

213 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) segment_id"

214 ]

215 },

216 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) delta": {

217 "kind": "HttpDeclProperty",

218 "oasRef": "#/components/schemas/TranscriptTextDeltaEvent/properties/delta",

219 "deprecated": false,

220 "key": "delta",

221 "docstring": "The text delta that was additionally transcribed.\n",

222 "type": {

223 "kind": "HttpTypeString"

224 },

225 "optional": false,

226 "nullable": false,

227 "schemaType": "string",

228 "children": []

229 },

230 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) type": {

231 "kind": "HttpDeclProperty",

232 "oasRef": "#/components/schemas/TranscriptTextDeltaEvent/properties/type",

233 "deprecated": false,

234 "key": "type",

235 "docstring": "The type of the event. Always `transcript.text.delta`.\n",

236 "type": {

237 "kind": "HttpTypeUnion",

238 "oasRef": "#/components/schemas/TranscriptTextDeltaEvent/properties/type",

239 "types": [

240 {

241 "kind": "HttpTypeLiteral",

242 "literal": "transcript.text.delta"

243 }

244 ]

245 },

246 "optional": false,

247 "nullable": false,

248 "schemaType": "enum",

249 "childrenParentSchema": "enum",

250 "children": [

251 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) type > (member) 0"

252 ]

253 },

254 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) logprobs": {

255 "kind": "HttpDeclProperty",

256 "oasRef": "#/components/schemas/TranscriptTextDeltaEvent/properties/logprobs",

257 "deprecated": false,

258 "key": "logprobs",

259 "docstring": "The log probabilities of the delta. Only included if you [create a transcription](/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `include[]` parameter set to `logprobs`.\n",

260 "type": {

261 "kind": "HttpTypeArray",

262 "oasRef": "#/components/schemas/TranscriptTextDeltaEvent/properties/logprobs",

263 "elementType": {

264 "kind": "HttpTypeObject",

265 "members": [

266 {

267 "ident": "token"

268 },

269 {

270 "ident": "bytes"

271 },

272 {

273 "ident": "logprob"

274 }

275 ]

276 }

277 },

278 "optional": true,

279 "nullable": false,

280 "schemaType": "array",

281 "childrenParentSchema": "object",

282 "children": [

283 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) logprobs > (items) > (property) token",

284 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) logprobs > (items) > (property) bytes",

285 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) logprobs > (items) > (property) logprob"

286 ]

287 },

288 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) segment_id": {

289 "kind": "HttpDeclProperty",

290 "oasRef": "#/components/schemas/TranscriptTextDeltaEvent/properties/segment_id",

291 "deprecated": false,

292 "key": "segment_id",

293 "docstring": "Identifier of the diarized segment that this delta belongs to. Only present when using `gpt-4o-transcribe-diarize`.\n",

294 "type": {

295 "kind": "HttpTypeString"

296 },

297 "optional": true,

298 "nullable": false,

299 "schemaType": "string",

300 "children": []

301 },

302 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) type > (member) 0": {

303 "kind": "HttpDeclReference",

304 "type": {

305 "kind": "HttpTypeLiteral",

306 "literal": "transcript.text.delta"

307 }

308 },

309 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) logprobs > (items) > (property) token": {

310 "kind": "HttpDeclProperty",

311 "oasRef": "#/components/schemas/TranscriptTextDeltaEvent/properties/logprobs/items/properties/token",

312 "deprecated": false,

313 "key": "token",

314 "docstring": "The token that was used to generate the log probability.\n",

315 "type": {

316 "kind": "HttpTypeString"

317 },

318 "optional": true,

319 "nullable": false,

320 "schemaType": "string",

321 "children": []

322 },

323 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) logprobs > (items) > (property) bytes": {

324 "kind": "HttpDeclProperty",

325 "oasRef": "#/components/schemas/TranscriptTextDeltaEvent/properties/logprobs/items/properties/bytes",

326 "deprecated": false,

327 "key": "bytes",

328 "docstring": "The bytes that were used to generate the log probability.\n",

329 "type": {

330 "kind": "HttpTypeArray",

331 "oasRef": "#/components/schemas/TranscriptTextDeltaEvent/properties/logprobs/items/properties/bytes",

332 "elementType": {

333 "kind": "HttpTypeNumber"

334 }

335 },

336 "optional": true,

337 "nullable": false,

338 "schemaType": "array",

339 "children": []

340 },

341 "(resource) audio.transcriptions > (model) transcription_text_delta_event > (schema) > (property) logprobs > (items) > (property) logprob": {

342 "kind": "HttpDeclProperty",

343 "oasRef": "#/components/schemas/TranscriptTextDeltaEvent/properties/logprobs/items/properties/logprob",

344 "deprecated": false,

345 "key": "logprob",

346 "docstring": "The log probability of the token.\n",

347 "type": {

348 "kind": "HttpTypeNumber"

349 },

350 "optional": true,

351 "nullable": false,

352 "schemaType": "number",

353 "children": []

354 }

355}

356```

357 93 

358### Example94### Example

359 95 


364}100}

365```101```

366 102 

103<a id="transcript.text.done"></a>

104 

367## transcript.text.done105## transcript.text.done

368 106 

369Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`.107Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`.


372 110 

373Schema name: `TranscriptTextDoneEvent`111Schema name: `TranscriptTextDoneEvent`

374 112 

375```json113- `text: string`

376{114 

377 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema)": {115 The text that was transcribed.

378 "kind": "HttpDeclTypeAlias",116 

379 "oasRef": "#/components/schemas/TranscriptTextDoneEvent",117- `type: "transcript.text.done"`

380 "docstring": "Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`.",118 

381 "ident": "TranscriptionTextDoneEvent",119 The type of the event. Always `transcript.text.done`.

382 "type": {120 

383 "kind": "HttpTypeObject",121 - `"transcript.text.done"`

384 "members": [122 

385 {123- `languages: optional array of TranscriptionLanguage`

386 "ident": "text"124 

387 },125 The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected.

388 {126 

389 "ident": "type"127 - `code: string`

390 },128 

391 {129 The code of a language detected in the audio.

392 "ident": "languages"130 

393 },131- `logprobs: optional array of object { token, bytes, logprob }`

394 {132 

395 "ident": "logprobs"133 The log probabilities of the individual tokens in the transcription. Only included if you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `include[]` parameter set to `logprobs`.

396 },134 

397 {135 - `token: optional string`

398 "ident": "usage"136 

399 }137 The token that was used to generate the log probability.

400 ]138 

401 },139 - `bytes: optional array of number`

402 "childrenParentSchema": "object",140 

403 "children": [141 The bytes that were used to generate the log probability.

404 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) text",142 

405 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) type",143 - `logprob: optional number`

406 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) languages",144 

407 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) logprobs",145 The log probability of the token.

408 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage"146 

409 ]147- `usage: optional object { input_tokens, output_tokens, total_tokens, 2 more }`

410 },148 

411 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) text": {149 Usage statistics for models billed by token usage.

412 "kind": "HttpDeclProperty",150 

413 "oasRef": "#/components/schemas/TranscriptTextDoneEvent/properties/text",151 - `input_tokens: number`

414 "deprecated": false,152 

415 "key": "text",153 Number of input tokens billed for this request.

416 "docstring": "The text that was transcribed.\n",154 

417 "type": {155 - `output_tokens: number`

418 "kind": "HttpTypeString"156 

419 },157 Number of output tokens generated.

420 "optional": false,158 

421 "nullable": false,159 - `total_tokens: number`

422 "schemaType": "string",160 

423 "children": []161 Total number of tokens used (input + output).

424 },162 

425 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) type": {163 - `type: "tokens"`

426 "kind": "HttpDeclProperty",164 

427 "oasRef": "#/components/schemas/TranscriptTextDoneEvent/properties/type",165 The type of the usage object. Always `tokens` for this variant.

428 "deprecated": false,166 

429 "key": "type",167 - `"tokens"`

430 "docstring": "The type of the event. Always `transcript.text.done`.\n",168 

431 "type": {169 - `input_token_details: optional object { audio_tokens, text_tokens }`

432 "kind": "HttpTypeUnion",170 

433 "oasRef": "#/components/schemas/TranscriptTextDoneEvent/properties/type",171 Details about the input tokens billed for this request.

434 "types": [172 

435 {173 - `audio_tokens: optional number`

436 "kind": "HttpTypeLiteral",174 

437 "literal": "transcript.text.done"175 Number of audio tokens billed for this request.

438 }176 

439 ]177 - `text_tokens: optional number`

440 },178 

441 "optional": false,179 Number of text tokens billed for this request.

442 "nullable": false,

443 "schemaType": "enum",

444 "childrenParentSchema": "enum",

445 "children": [

446 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) type > (member) 0"

447 ]

448 },

449 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) languages": {

450 "kind": "HttpDeclProperty",

451 "oasRef": "#/components/schemas/TranscriptTextDoneEvent/properties/languages",

452 "deprecated": false,

453 "key": "languages",

454 "docstring": "The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected.\n",

455 "type": {

456 "kind": "HttpTypeArray",

457 "oasRef": "#/components/schemas/TranscriptTextDoneEvent/properties/languages",

458 "elementType": {

459 "kind": "HttpTypeReference",

460 "ident": "TranscriptionLanguage",

461 "$ref": "(resource) audio.transcriptions > (model) transcription_language > (schema)"

462 }

463 },

464 "optional": true,

465 "nullable": false,

466 "schemaType": "array",

467 "childrenParentSchema": "object",

468 "children": [

469 "(resource) audio.transcriptions > (model) transcription_language > (schema) > (property) code"

470 ]

471 },

472 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) logprobs": {

473 "kind": "HttpDeclProperty",

474 "oasRef": "#/components/schemas/TranscriptTextDoneEvent/properties/logprobs",

475 "deprecated": false,

476 "key": "logprobs",

477 "docstring": "The log probabilities of the individual tokens in the transcription. Only included if you [create a transcription](/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `include[]` parameter set to `logprobs`.\n",

478 "type": {

479 "kind": "HttpTypeArray",

480 "oasRef": "#/components/schemas/TranscriptTextDoneEvent/properties/logprobs",

481 "elementType": {

482 "kind": "HttpTypeObject",

483 "members": [

484 {

485 "ident": "token"

486 },

487 {

488 "ident": "bytes"

489 },

490 {

491 "ident": "logprob"

492 }

493 ]

494 }

495 },

496 "optional": true,

497 "nullable": false,

498 "schemaType": "array",

499 "childrenParentSchema": "object",

500 "children": [

501 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) logprobs > (items) > (property) token",

502 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) logprobs > (items) > (property) bytes",

503 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) logprobs > (items) > (property) logprob"

504 ]

505 },

506 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage": {

507 "kind": "HttpDeclProperty",

508 "oasRef": "#/components/schemas/TranscriptTextDoneEvent/properties/usage",

509 "deprecated": false,

510 "key": "usage",

511 "docstring": "Usage statistics for models billed by token usage.",

512 "title": "Token Usage",

513 "type": {

514 "kind": "HttpTypeObject",

515 "members": [

516 {

517 "ident": "input_tokens"

518 },

519 {

520 "ident": "output_tokens"

521 },

522 {

523 "ident": "total_tokens"

524 },

525 {

526 "ident": "type"

527 },

528 {

529 "ident": "input_token_details"

530 }

531 ]

532 },

533 "optional": true,

534 "nullable": false,

535 "schemaType": "object",

536 "childrenParentSchema": "object",

537 "children": [

538 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) input_tokens",

539 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) output_tokens",

540 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) total_tokens",

541 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) type",

542 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) input_token_details"

543 ]

544 },

545 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) type > (member) 0": {

546 "kind": "HttpDeclReference",

547 "type": {

548 "kind": "HttpTypeLiteral",

549 "literal": "transcript.text.done"

550 }

551 },

552 "(resource) audio.transcriptions > (model) transcription_language > (schema) > (property) code": {

553 "kind": "HttpDeclProperty",

554 "oasRef": "#/components/schemas/TranscriptionLanguage/properties/code",

555 "deprecated": false,

556 "key": "code",

557 "docstring": "The code of a language detected in the audio.",

558 "type": {

559 "kind": "HttpTypeString"

560 },

561 "optional": false,

562 "nullable": false,

563 "schemaType": "string",

564 "children": []

565 },

566 "(resource) audio.transcriptions > (model) transcription_language > (schema)": {

567 "kind": "HttpDeclTypeAlias",

568 "oasRef": "#/components/schemas/TranscriptionLanguage",

569 "docstring": "A language detected in transcribed audio.",

570 "ident": "TranscriptionLanguage",

571 "type": {

572 "kind": "HttpTypeObject",

573 "members": [

574 {

575 "ident": "code"

576 }

577 ]

578 },

579 "childrenParentSchema": "object",

580 "children": [

581 "(resource) audio.transcriptions > (model) transcription_language > (schema) > (property) code"

582 ]

583 },

584 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) logprobs > (items) > (property) token": {

585 "kind": "HttpDeclProperty",

586 "oasRef": "#/components/schemas/TranscriptTextDoneEvent/properties/logprobs/items/properties/token",

587 "deprecated": false,

588 "key": "token",

589 "docstring": "The token that was used to generate the log probability.\n",

590 "type": {

591 "kind": "HttpTypeString"

592 },

593 "optional": true,

594 "nullable": false,

595 "schemaType": "string",

596 "children": []

597 },

598 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) logprobs > (items) > (property) bytes": {

599 "kind": "HttpDeclProperty",

600 "oasRef": "#/components/schemas/TranscriptTextDoneEvent/properties/logprobs/items/properties/bytes",

601 "deprecated": false,

602 "key": "bytes",

603 "docstring": "The bytes that were used to generate the log probability.\n",

604 "type": {

605 "kind": "HttpTypeArray",

606 "oasRef": "#/components/schemas/TranscriptTextDoneEvent/properties/logprobs/items/properties/bytes",

607 "elementType": {

608 "kind": "HttpTypeNumber"

609 }

610 },

611 "optional": true,

612 "nullable": false,

613 "schemaType": "array",

614 "children": []

615 },

616 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) logprobs > (items) > (property) logprob": {

617 "kind": "HttpDeclProperty",

618 "oasRef": "#/components/schemas/TranscriptTextDoneEvent/properties/logprobs/items/properties/logprob",

619 "deprecated": false,

620 "key": "logprob",

621 "docstring": "The log probability of the token.\n",

622 "type": {

623 "kind": "HttpTypeNumber"

624 },

625 "optional": true,

626 "nullable": false,

627 "schemaType": "number",

628 "children": []

629 },

630 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) input_tokens": {

631 "kind": "HttpDeclProperty",

632 "oasRef": "#/components/schemas/TranscriptTextUsageTokens/properties/input_tokens",

633 "deprecated": false,

634 "key": "input_tokens",

635 "docstring": "Number of input tokens billed for this request.",

636 "type": {

637 "kind": "HttpTypeNumber"

638 },

639 "optional": false,

640 "nullable": false,

641 "schemaType": "integer",

642 "children": []

643 },

644 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) output_tokens": {

645 "kind": "HttpDeclProperty",

646 "oasRef": "#/components/schemas/TranscriptTextUsageTokens/properties/output_tokens",

647 "deprecated": false,

648 "key": "output_tokens",

649 "docstring": "Number of output tokens generated.",

650 "type": {

651 "kind": "HttpTypeNumber"

652 },

653 "optional": false,

654 "nullable": false,

655 "schemaType": "integer",

656 "children": []

657 },

658 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) total_tokens": {

659 "kind": "HttpDeclProperty",

660 "oasRef": "#/components/schemas/TranscriptTextUsageTokens/properties/total_tokens",

661 "deprecated": false,

662 "key": "total_tokens",

663 "docstring": "Total number of tokens used (input + output).",

664 "type": {

665 "kind": "HttpTypeNumber"

666 },

667 "optional": false,

668 "nullable": false,

669 "schemaType": "integer",

670 "children": []

671 },

672 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) type": {

673 "kind": "HttpDeclProperty",

674 "oasRef": "#/components/schemas/TranscriptTextUsageTokens/properties/type",

675 "deprecated": false,

676 "key": "type",

677 "docstring": "The type of the usage object. Always `tokens` for this variant.",

678 "type": {

679 "kind": "HttpTypeUnion",

680 "oasRef": "#/components/schemas/TranscriptTextUsageTokens/properties/type",

681 "types": [

682 {

683 "kind": "HttpTypeLiteral",

684 "literal": "tokens"

685 }

686 ]

687 },

688 "optional": false,

689 "nullable": false,

690 "schemaType": "enum",

691 "childrenParentSchema": "enum",

692 "children": [

693 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) type > (member) 0"

694 ]

695 },

696 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) input_token_details": {

697 "kind": "HttpDeclProperty",

698 "oasRef": "#/components/schemas/TranscriptTextUsageTokens/properties/input_token_details",

699 "deprecated": false,

700 "key": "input_token_details",

701 "docstring": "Details about the input tokens billed for this request.",

702 "type": {

703 "kind": "HttpTypeObject",

704 "members": [

705 {

706 "ident": "audio_tokens"

707 },

708 {

709 "ident": "text_tokens"

710 }

711 ]

712 },

713 "optional": true,

714 "nullable": false,

715 "schemaType": "object",

716 "childrenParentSchema": "object",

717 "children": [

718 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) input_token_details > (property) audio_tokens",

719 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) input_token_details > (property) text_tokens"

720 ]

721 },

722 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) type > (member) 0": {

723 "kind": "HttpDeclReference",

724 "type": {

725 "kind": "HttpTypeLiteral",

726 "literal": "tokens"

727 }

728 },

729 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) input_token_details > (property) audio_tokens": {

730 "kind": "HttpDeclProperty",

731 "oasRef": "#/components/schemas/TranscriptTextUsageTokens/properties/input_token_details/properties/audio_tokens",

732 "deprecated": false,

733 "key": "audio_tokens",

734 "docstring": "Number of audio tokens billed for this request.",

735 "type": {

736 "kind": "HttpTypeNumber"

737 },

738 "optional": true,

739 "nullable": false,

740 "schemaType": "integer",

741 "children": []

742 },

743 "(resource) audio.transcriptions > (model) transcription_text_done_event > (schema) > (property) usage > (property) input_token_details > (property) text_tokens": {

744 "kind": "HttpDeclProperty",

745 "oasRef": "#/components/schemas/TranscriptTextUsageTokens/properties/input_token_details/properties/text_tokens",

746 "deprecated": false,

747 "key": "text_tokens",

748 "docstring": "Number of text tokens billed for this request.",

749 "type": {

750 "kind": "HttpTypeNumber"

751 },

752 "optional": true,

753 "nullable": false,

754 "schemaType": "integer",

755 "children": []

756 }

757}

758```

759 180 

760### Example181### Example

761 182 

Details

1## Create an agent

2 

3**post** `/agents`

4 

5Creates a reusable agent without storing credentials. See [agent configuration](/api/docs/guides/agents-api/configuration).

6 

7### Body Parameters

8 

9- `model: string`

10 

11 The model to use for the agent. The requested model name is preserved.

12 

13- `instructions: optional string or null`

14 

15 Additional instructions appended to the agent's default base instructions. Omit or set to null to add no custom instructions.

16 

17- `metadata: optional map[string] or null`

18 

19 Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map.

20 

21- `multi_agent: optional MultiAgentConfigParam or null`

22 

23 Explicit configuration for creating and coordinating subagents.

24 

25 - `enabled: boolean`

26 

27 Whether subagent tools are enabled.

28 

29 - `max_concurrent_subagents: optional number`

30 

31 Maximum number of subagents that may run concurrently. Defaults to 6.

32 

33- `name: optional string or null`

34 

35 A human-readable name for the agent. Omission or null leaves the agent unnamed.

36 

37- `reasoning: optional AgentReasoningParam or null`

38 

39 Reasoning configuration for the agent.

40 

41 - `effort: optional "none" or "minimal" or "low" or 4 more or null`

42 

43 The amount of reasoning effort the model should use.

44 

45 - `"none"`

46 

47 - `"minimal"`

48 

49 - `"low"`

50 

51 - `"medium"`

52 

53 - `"high"`

54 

55 - `"xhigh"`

56 

57 - `"max"`

58 

59 - `summary: optional "concise" or "detailed" or "auto" or null`

60 

61 The reasoning summary format requested from the model.

62 

63 - `"concise"`

64 

65 Returns a concise reasoning summary when supported.

66 

67 - `"detailed"`

68 

69 Returns a detailed reasoning summary when supported.

70 

71 - `"auto"`

72 

73 Automatically selects the most detailed summary supported by the model.

74 

75- `service_tier: optional "auto" or "default" or "flex" or 2 more or null`

76 

77 The service tier used for model requests.

78 

79 - `"auto"`

80 

81 Selects the service tier automatically.

82 

83 - `"default"`

84 

85 Uses the default service tier.

86 

87 - `"flex"`

88 

89 Uses the flex service tier.

90 

91 - `"priority"`

92 

93 Uses the priority service tier.

94 

95 - `"fast"`

96 

97 Uses the fast service tier.

98 

99- `text: optional AgentTextParam or null`

100 

101 Configuration for text generated by the agent.

102 

103 - `format: optional TextFormatParam or null`

104 

105 The output format for generated text.

106 

107 - `Text object { type }`

108 

109 Generates ordinary text without a structured-output constraint.

110 

111 - `type: "text"`

112 

113 The type of the object. Always `text`.

114 

115 - `"text"`

116 

117 - `JSONSchema object { schema, type }`

118 

119 Constrains generated text to a JSON Schema.

120 

121 - `schema: map[unknown]`

122 

123 The JSON Schema that generated text must match.

124 

125 - `type: "json_schema"`

126 

127 The type of the object. Always `json_schema`.

128 

129 - `"json_schema"`

130 

131 - `verbosity: optional "low" or "medium" or "high" or null`

132 

133 The amount of text the model should produce.

134 

135 - `"low"`

136 

137 Produces less text.

138 

139 - `"medium"`

140 

141 Uses the default amount of text.

142 

143 - `"high"`

144 

145 Produces more text.

146 

147- `tools: optional array of PersistedAgentToolParam or null`

148 

149 Tools available to the agent. Defaults to an empty list.

150 

151 - `Function object { description, name, parameters, 2 more }`

152 

153 A function defined by the application.

154 

155 - `description: string`

156 

157 A description of what the function does.

158 

159 - `name: string`

160 

161 The name of the function.

162 

163 - `parameters: map[unknown]`

164 

165 A JSON Schema object describing the function's arguments.

166 

167 - `type: "function"`

168 

169 The type of the object. Always `function`.

170 

171 - `"function"`

172 

173 - `defer_loading: optional boolean`

174 

175 Whether this function is deferred and discovered through tool search. Defaults to `false`.

176 

177 - `ToolSearch object { type }`

178 

179 Discovers deferred function tools and loads them into the model context.

180 

181 - `type: "tool_search"`

182 

183 The type of the object. Always `tool_search`.

184 

185 - `"tool_search"`

186 

187 - `ProgrammaticToolCalling object { type, enabled }`

188 

189 Enables calling tools from model-generated code.

190 

191 - `type: "programmatic_tool_calling"`

192 

193 The type of the object. Always `programmatic_tool_calling`.

194 

195 - `"programmatic_tool_calling"`

196 

197 - `enabled: optional boolean`

198 

199 Whether tools can be called from model-generated code. Defaults to `true`.

200 

201 - `Mcp object { server_label, transport, type, 5 more }`

202 

203 Tools provided by a remote MCP server without stored credentials.

204 

205 - `server_label: string`

206 

207 A label used to identify the MCP server in tool calls.

208 

209 - `transport: PersistedMcpTransportParam`

210 

211 The credential-free transport used to connect to the MCP server.

212 

213 - `HTTP object { server_url, type, headers }`

214 

215 Connects to an MCP server over HTTP.

216 

217 - `server_url: string`

218 

219 The URL of the MCP server.

220 

221 - `type: "http"`

222 

223 The type of the object. Always `http`.

224 

225 - `"http"`

226 

227 - `headers: optional map[string] or null`

228 

229 Non-secret HTTP headers sent to the MCP server.

230 

231 - `Stdio object { command, cwd, type, 2 more }`

232 

233 Starts an MCP server as a local process.

234 

235 - `command: string`

236 

237 The command used to start the MCP server.

238 

239 - `cwd: string`

240 

241 The working directory used to start the MCP server.

242 

243 - `type: "stdio"`

244 

245 The type of the object. Always `stdio`.

246 

247 - `"stdio"`

248 

249 - `args: optional array of string or null`

250 

251 Arguments passed to the MCP server command.

252 

253 - `env_vars: optional array of string or null`

254 

255 Environment variable names to inherit from the selected execution environment.

256 

257 - `type: "mcp"`

258 

259 The type of the object. Always `mcp`.

260 

261 - `"mcp"`

262 

263 - `allowed_tools: optional array of string or null`

264 

265 The MCP tools the agent may call. All server tools are allowed when omitted.

266 

267 - `connection_origin: optional "service" or "environment" or null`

268 

269 Where outbound MCP HTTP connections originate.

270 

271 - `"service"`

272 

273 Uses the Managed Agents service network.

274 

275 - `"environment"`

276 

277 Uses the session's execution environment.

278 

279 - `credential_id: optional string or null`

280 

281 The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL.

282 

283 - `request_metadata: optional map[unknown] or null`

284 

285 Metadata included with requests to this MCP server.

286 

287 - `required: optional boolean`

288 

289 Whether this MCP server must initialize before the first turn. Defaults to `false`.

290 

291 - `WebSearch object { type, allowed_domains, context_size, 2 more }`

292 

293 Web search.

294 

295 - `type: "web_search"`

296 

297 The type of the object. Always `web_search`.

298 

299 - `"web_search"`

300 

301 - `allowed_domains: optional array of string or null`

302 

303 Domains the search may include.

304 

305 - `context_size: optional "low" or "medium" or "high" or null`

306 

307 The amount of web search context made available to the model.

308 

309 - `"low"`

310 

311 - `"medium"`

312 

313 - `"high"`

314 

315 - `location: optional object { city, country, region, timezone } or null`

316 

317 Approximate user location used to localize web search results.

318 

319 - `city: optional string or null`

320 

321 The city name.

322 

323 - `country: optional string or null`

324 

325 The two-letter ISO country code, such as `US`.

326 

327 - `region: optional string or null`

328 

329 The region or state name.

330 

331 - `timezone: optional string or null`

332 

333 The IANA timezone, such as `America/Los_Angeles`.

334 

335 - `mode: optional "disabled" or "cached" or "live" or null`

336 

337 The source used for web search results.

338 

339 - `"disabled"`

340 

341 Disables web search.

342 

343 - `"cached"`

344 

345 Uses cached search results.

346 

347 - `"live"`

348 

349 Searches the live web.

350 

351### Returns

352 

353- `Agent object { id, created_at, instructions, 10 more }`

354 

355 A reusable agent scoped to the caller's project.

356 

357 - `id: string`

358 

359 The ID of the reusable agent.

360 

361 - `created_at: number`

362 

363 The Unix timestamp, in seconds, when the agent was created.

364 

365 - `instructions: string or null`

366 

367 Custom instructions appended to the agent's default base instructions.

368 

369 - `metadata: map[string]`

370 

371 Custom string key-value pairs attached to the agent.

372 

373 - `model: string`

374 

375 The requested model name used for inference.

376 

377 - `multi_agent: MultiAgentConfig`

378 

379 The resolved configuration for creating and coordinating subagents.

380 

381 - `enabled: boolean`

382 

383 Whether subagent tools are enabled. Defaults to false.

384 

385 - `max_concurrent_subagents: number or null`

386 

387 Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

388 

389 - `name: string or null`

390 

391 A human-readable name for the agent, or null if it is unnamed.

392 

393 - `object: "agent"`

394 

395 The object type. Always `agent`.

396 

397 - `"agent"`

398 

399 - `reasoning: AgentReasoning`

400 

401 The resolved reasoning configuration, including the model default for an omitted effort.

402 

403 - `effort: "none" or "minimal" or "low" or 4 more or null`

404 

405 The amount of reasoning effort used by an agent.

406 

407 - `"none"`

408 

409 - `"minimal"`

410 

411 - `"low"`

412 

413 - `"medium"`

414 

415 - `"high"`

416 

417 - `"xhigh"`

418 

419 - `"max"`

420 

421 - `summary: "concise" or "detailed" or "auto" or null`

422 

423 The reasoning summary format requested from an agent.

424 

425 - `"concise"`

426 

427 Returns a concise reasoning summary when supported.

428 

429 - `"detailed"`

430 

431 Returns a detailed reasoning summary when supported.

432 

433 - `"auto"`

434 

435 Automatically selects the most detailed summary supported by the model.

436 

437 - `service_tier: "auto" or "default" or "flex" or 2 more`

438 

439 The resolved service-tier policy used for model requests.

440 

441 - `"auto"`

442 

443 - `"default"`

444 

445 - `"flex"`

446 

447 - `"priority"`

448 

449 - `"fast"`

450 

451 - `text: AgentText`

452 

453 The resolved configuration for text generated by the agent.

454 

455 - `format: TextFormat`

456 

457 The effective output format. Defaults to ordinary text.

458 

459 - `Text object { type }`

460 

461 Generates ordinary text without a structured-output constraint.

462 

463 - `type: "text"`

464 

465 The type of the object. Always `text`.

466 

467 - `"text"`

468 

469 - `JSONSchema object { schema, type }`

470 

471 Constrains generated text to a JSON Schema.

472 

473 - `schema: map[unknown]`

474 

475 The JSON Schema that generated text must match.

476 

477 - `type: "json_schema"`

478 

479 The type of the object. Always `json_schema`.

480 

481 - `"json_schema"`

482 

483 - `verbosity: "low" or "medium" or "high"`

484 

485 The amount of text produced by the agent. Defaults to `medium`.

486 

487 - `"low"`

488 

489 - `"medium"`

490 

491 - `"high"`

492 

493 - `tools: array of PersistedAgentTool`

494 

495 Tools available to the agent.

496 

497 - `Function object { defer_loading, description, name, 2 more }`

498 

499 A function defined by the application.

500 

501 - `defer_loading: boolean`

502 

503 Whether the function is deferred and discovered through tool search.

504 

505 - `description: string`

506 

507 A description of what the function does.

508 

509 - `name: string`

510 

511 The name of the function.

512 

513 - `parameters: map[unknown]`

514 

515 A JSON Schema object describing the function's arguments.

516 

517 - `type: "function"`

518 

519 The type of the object. Always `function`.

520 

521 - `"function"`

522 

523 - `ToolSearch object { type }`

524 

525 Discovers deferred function tools and loads them into the model context.

526 

527 - `type: "tool_search"`

528 

529 The type of the object. Always `tool_search`.

530 

531 - `"tool_search"`

532 

533 - `ProgrammaticToolCalling object { enabled, type }`

534 

535 Enables calling tools from model-generated code.

536 

537 - `enabled: boolean`

538 

539 Whether tools can be called from model-generated code.

540 

541 - `type: "programmatic_tool_calling"`

542 

543 The type of the object. Always `programmatic_tool_calling`.

544 

545 - `"programmatic_tool_calling"`

546 

547 - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

548 

549 Tools provided by a remote MCP server without stored credentials.

550 

551 - `allowed_tools: array of string or null`

552 

553 The MCP tools the agent may call, or null when all server tools are allowed.

554 

555 - `connection_origin: "service" or "environment"`

556 

557 Where outbound MCP HTTP connections originate.

558 

559 - `"service"`

560 

561 - `"environment"`

562 

563 - `credential_id: string or null`

564 

565 The vault credential selected for this MCP server, if any.

566 

567 - `request_metadata: map[unknown]`

568 

569 Metadata included with requests to this MCP server.

570 

571 - `required: boolean`

572 

573 Whether this MCP server must initialize before the first turn.

574 

575 - `server_label: string`

576 

577 A label used to identify the MCP server in tool calls.

578 

579 - `transport: PersistedMcpTransport`

580 

581 The credential-free transport used to connect to the MCP server.

582 

583 - `HTTP object { headers, server_url, type }`

584 

585 Connects to an MCP server over HTTP.

586 

587 - `headers: map[string]`

588 

589 Non-secret HTTP headers sent to the MCP server.

590 

591 - `server_url: string`

592 

593 The URL of the MCP server.

594 

595 - `type: "http"`

596 

597 The type of the object. Always `http`.

598 

599 - `"http"`

600 

601 - `Stdio object { args, command, cwd, 2 more }`

602 

603 Starts an MCP server as a local process.

604 

605 - `args: array of string`

606 

607 Arguments passed to the MCP server command.

608 

609 - `command: string`

610 

611 The command used to start the MCP server.

612 

613 - `cwd: string`

614 

615 The working directory used to start the MCP server.

616 

617 - `env_vars: array of string`

618 

619 Environment variable names inherited from the execution environment.

620 

621 - `type: "stdio"`

622 

623 The type of the object. Always `stdio`.

624 

625 - `"stdio"`

626 

627 - `type: "mcp"`

628 

629 The type of the object. Always `mcp`.

630 

631 - `"mcp"`

632 

633 - `WebSearch object { allowed_domains, context_size, location, 2 more }`

634 

635 Web search.

636 

637 - `allowed_domains: array of string or null`

638 

639 Allowed search domains, or `null` when the search is unrestricted.

640 

641 - `context_size: "low" or "medium" or "high"`

642 

643 The amount of search context made available to the model. Defaults to `medium`.

644 

645 - `"low"`

646 

647 - `"medium"`

648 

649 - `"high"`

650 

651 - `location: object { city, country, region, timezone } or null`

652 

653 Approximate user location used to localize web search results.

654 

655 - `city: string or null`

656 

657 The city name.

658 

659 - `country: string or null`

660 

661 The two-letter ISO country code, such as `US`.

662 

663 - `region: string or null`

664 

665 The region or state name.

666 

667 - `timezone: string or null`

668 

669 The IANA timezone, such as `America/Los_Angeles`.

670 

671 - `mode: "disabled" or "cached" or "live"`

672 

673 The source used for web search results.

674 

675 - `"disabled"`

676 

677 - `"cached"`

678 

679 - `"live"`

680 

681 - `type: "web_search"`

682 

683 The type of the object. Always `web_search`.

684 

685 - `"web_search"`

686 

687 - `updated_at: number`

688 

689 The Unix timestamp, in seconds, when the agent was last updated.

690 

691### Example

692 

693```http

694curl https://api.openai.com/v1/agents \

695 -H 'Content-Type: application/json' \

696 -H 'OpenAI-Beta: agents=v1' \

697 -H "Authorization: Bearer $OPENAI_API_KEY" \

698 -d '{

699 "model": "model"

700 }'

701```

702 

703#### Response

704 

705```json

706{

707 "id": "id",

708 "created_at": 0,

709 "instructions": "instructions",

710 "metadata": {

711 "foo": "string"

712 },

713 "model": "model",

714 "multi_agent": {

715 "enabled": true,

716 "max_concurrent_subagents": 1

717 },

718 "name": "name",

719 "object": "agent",

720 "reasoning": {

721 "effort": "none",

722 "summary": "concise"

723 },

724 "service_tier": "auto",

725 "text": {

726 "format": {

727 "type": "text"

728 },

729 "verbosity": "low"

730 },

731 "tools": [

732 {

733 "defer_loading": true,

734 "description": "description",

735 "name": "name",

736 "parameters": {

737 "foo": "bar"

738 },

739 "type": "function"

740 }

741 ],

742 "updated_at": 0

743}

744```

Details

1## Delete an agent

2 

3**delete** `/agents/{agent_id}`

4 

5Deletes a reusable agent. See [agent configuration](/api/docs/guides/agents-api/configuration).

6 

7### Path Parameters

8 

9- `agent_id: string`

10 

11### Returns

12 

13- `AgentDeleted object { id, deleted, object }`

14 

15 A deleted reusable agent.

16 

17 - `id: string`

18 

19 The ID of the deleted agent.

20 

21 - `deleted: boolean`

22 

23 Whether the agent was deleted. Always `true`.

24 

25 - `object: "agent.deleted"`

26 

27 The object type. Always `agent.deleted`.

28 

29 - `"agent.deleted"`

30 

31### Example

32 

33```http

34curl https://api.openai.com/v1/agents/$AGENT_ID \

35 -X DELETE \

36 -H 'OpenAI-Beta: agents=v1' \

37 -H "Authorization: Bearer $OPENAI_API_KEY"

38```

39 

40#### Response

41 

42```json

43{

44 "id": "id",

45 "deleted": true,

46 "object": "agent.deleted"

47}

48```

Details

1## List agents

2 

3**get** `/agents`

4 

5Lists reusable agents in the current project. See [agent configuration](/api/docs/guides/agents-api/configuration).

6 

7### Query Parameters

8 

9- `after: optional string`

10 

11 Return resources after this resource ID in the selected order.

12 

13- `limit: optional number or null`

14 

15 The maximum number of resources to return.

16 

17- `order: optional "asc" or "desc"`

18 

19 The order in which resources are returned. Defaults to `desc`.

20 

21 - `"asc"`

22 

23 Returns resources in ascending order.

24 

25 - `"desc"`

26 

27 Returns resources in descending order.

28 

29### Returns

30 

31- `data: array of Agent`

32 

33 The resources returned in this page, in the requested sort order.

34 

35 - `id: string`

36 

37 The ID of the reusable agent.

38 

39 - `created_at: number`

40 

41 The Unix timestamp, in seconds, when the agent was created.

42 

43 - `instructions: string or null`

44 

45 Custom instructions appended to the agent's default base instructions.

46 

47 - `metadata: map[string]`

48 

49 Custom string key-value pairs attached to the agent.

50 

51 - `model: string`

52 

53 The requested model name used for inference.

54 

55 - `multi_agent: MultiAgentConfig`

56 

57 The resolved configuration for creating and coordinating subagents.

58 

59 - `enabled: boolean`

60 

61 Whether subagent tools are enabled. Defaults to false.

62 

63 - `max_concurrent_subagents: number or null`

64 

65 Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

66 

67 - `name: string or null`

68 

69 A human-readable name for the agent, or null if it is unnamed.

70 

71 - `object: "agent"`

72 

73 The object type. Always `agent`.

74 

75 - `"agent"`

76 

77 - `reasoning: AgentReasoning`

78 

79 The resolved reasoning configuration, including the model default for an omitted effort.

80 

81 - `effort: "none" or "minimal" or "low" or 4 more or null`

82 

83 The amount of reasoning effort used by an agent.

84 

85 - `"none"`

86 

87 - `"minimal"`

88 

89 - `"low"`

90 

91 - `"medium"`

92 

93 - `"high"`

94 

95 - `"xhigh"`

96 

97 - `"max"`

98 

99 - `summary: "concise" or "detailed" or "auto" or null`

100 

101 The reasoning summary format requested from an agent.

102 

103 - `"concise"`

104 

105 Returns a concise reasoning summary when supported.

106 

107 - `"detailed"`

108 

109 Returns a detailed reasoning summary when supported.

110 

111 - `"auto"`

112 

113 Automatically selects the most detailed summary supported by the model.

114 

115 - `service_tier: "auto" or "default" or "flex" or 2 more`

116 

117 The resolved service-tier policy used for model requests.

118 

119 - `"auto"`

120 

121 - `"default"`

122 

123 - `"flex"`

124 

125 - `"priority"`

126 

127 - `"fast"`

128 

129 - `text: AgentText`

130 

131 The resolved configuration for text generated by the agent.

132 

133 - `format: TextFormat`

134 

135 The effective output format. Defaults to ordinary text.

136 

137 - `Text object { type }`

138 

139 Generates ordinary text without a structured-output constraint.

140 

141 - `type: "text"`

142 

143 The type of the object. Always `text`.

144 

145 - `"text"`

146 

147 - `JSONSchema object { schema, type }`

148 

149 Constrains generated text to a JSON Schema.

150 

151 - `schema: map[unknown]`

152 

153 The JSON Schema that generated text must match.

154 

155 - `type: "json_schema"`

156 

157 The type of the object. Always `json_schema`.

158 

159 - `"json_schema"`

160 

161 - `verbosity: "low" or "medium" or "high"`

162 

163 The amount of text produced by the agent. Defaults to `medium`.

164 

165 - `"low"`

166 

167 - `"medium"`

168 

169 - `"high"`

170 

171 - `tools: array of PersistedAgentTool`

172 

173 Tools available to the agent.

174 

175 - `Function object { defer_loading, description, name, 2 more }`

176 

177 A function defined by the application.

178 

179 - `defer_loading: boolean`

180 

181 Whether the function is deferred and discovered through tool search.

182 

183 - `description: string`

184 

185 A description of what the function does.

186 

187 - `name: string`

188 

189 The name of the function.

190 

191 - `parameters: map[unknown]`

192 

193 A JSON Schema object describing the function's arguments.

194 

195 - `type: "function"`

196 

197 The type of the object. Always `function`.

198 

199 - `"function"`

200 

201 - `ToolSearch object { type }`

202 

203 Discovers deferred function tools and loads them into the model context.

204 

205 - `type: "tool_search"`

206 

207 The type of the object. Always `tool_search`.

208 

209 - `"tool_search"`

210 

211 - `ProgrammaticToolCalling object { enabled, type }`

212 

213 Enables calling tools from model-generated code.

214 

215 - `enabled: boolean`

216 

217 Whether tools can be called from model-generated code.

218 

219 - `type: "programmatic_tool_calling"`

220 

221 The type of the object. Always `programmatic_tool_calling`.

222 

223 - `"programmatic_tool_calling"`

224 

225 - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

226 

227 Tools provided by a remote MCP server without stored credentials.

228 

229 - `allowed_tools: array of string or null`

230 

231 The MCP tools the agent may call, or null when all server tools are allowed.

232 

233 - `connection_origin: "service" or "environment"`

234 

235 Where outbound MCP HTTP connections originate.

236 

237 - `"service"`

238 

239 - `"environment"`

240 

241 - `credential_id: string or null`

242 

243 The vault credential selected for this MCP server, if any.

244 

245 - `request_metadata: map[unknown]`

246 

247 Metadata included with requests to this MCP server.

248 

249 - `required: boolean`

250 

251 Whether this MCP server must initialize before the first turn.

252 

253 - `server_label: string`

254 

255 A label used to identify the MCP server in tool calls.

256 

257 - `transport: PersistedMcpTransport`

258 

259 The credential-free transport used to connect to the MCP server.

260 

261 - `HTTP object { headers, server_url, type }`

262 

263 Connects to an MCP server over HTTP.

264 

265 - `headers: map[string]`

266 

267 Non-secret HTTP headers sent to the MCP server.

268 

269 - `server_url: string`

270 

271 The URL of the MCP server.

272 

273 - `type: "http"`

274 

275 The type of the object. Always `http`.

276 

277 - `"http"`

278 

279 - `Stdio object { args, command, cwd, 2 more }`

280 

281 Starts an MCP server as a local process.

282 

283 - `args: array of string`

284 

285 Arguments passed to the MCP server command.

286 

287 - `command: string`

288 

289 The command used to start the MCP server.

290 

291 - `cwd: string`

292 

293 The working directory used to start the MCP server.

294 

295 - `env_vars: array of string`

296 

297 Environment variable names inherited from the execution environment.

298 

299 - `type: "stdio"`

300 

301 The type of the object. Always `stdio`.

302 

303 - `"stdio"`

304 

305 - `type: "mcp"`

306 

307 The type of the object. Always `mcp`.

308 

309 - `"mcp"`

310 

311 - `WebSearch object { allowed_domains, context_size, location, 2 more }`

312 

313 Web search.

314 

315 - `allowed_domains: array of string or null`

316 

317 Allowed search domains, or `null` when the search is unrestricted.

318 

319 - `context_size: "low" or "medium" or "high"`

320 

321 The amount of search context made available to the model. Defaults to `medium`.

322 

323 - `"low"`

324 

325 - `"medium"`

326 

327 - `"high"`

328 

329 - `location: object { city, country, region, timezone } or null`

330 

331 Approximate user location used to localize web search results.

332 

333 - `city: string or null`

334 

335 The city name.

336 

337 - `country: string or null`

338 

339 The two-letter ISO country code, such as `US`.

340 

341 - `region: string or null`

342 

343 The region or state name.

344 

345 - `timezone: string or null`

346 

347 The IANA timezone, such as `America/Los_Angeles`.

348 

349 - `mode: "disabled" or "cached" or "live"`

350 

351 The source used for web search results.

352 

353 - `"disabled"`

354 

355 - `"cached"`

356 

357 - `"live"`

358 

359 - `type: "web_search"`

360 

361 The type of the object. Always `web_search`.

362 

363 - `"web_search"`

364 

365 - `updated_at: number`

366 

367 The Unix timestamp, in seconds, when the agent was last updated.

368 

369- `first_id: string or null`

370 

371 The ID of the first resource in `data`, or `null` if the page is empty.

372 

373- `has_more: boolean`

374 

375 Whether there are more resources to retrieve after this page.

376 

377- `last_id: string or null`

378 

379 The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

380 

381- `object: "list"`

382 

383 The object type, which is always `list`.

384 

385 - `"list"`

386 

387### Example

388 

389```http

390curl https://api.openai.com/v1/agents \

391 -H 'OpenAI-Beta: agents=v1' \

392 -H "Authorization: Bearer $OPENAI_API_KEY"

393```

394 

395#### Response

396 

397```json

398{

399 "data": [

400 {

401 "id": "id",

402 "created_at": 0,

403 "instructions": "instructions",

404 "metadata": {

405 "foo": "string"

406 },

407 "model": "model",

408 "multi_agent": {

409 "enabled": true,

410 "max_concurrent_subagents": 1

411 },

412 "name": "name",

413 "object": "agent",

414 "reasoning": {

415 "effort": "none",

416 "summary": "concise"

417 },

418 "service_tier": "auto",

419 "text": {

420 "format": {

421 "type": "text"

422 },

423 "verbosity": "low"

424 },

425 "tools": [

426 {

427 "defer_loading": true,

428 "description": "description",

429 "name": "name",

430 "parameters": {

431 "foo": "bar"

432 },

433 "type": "function"

434 }

435 ],

436 "updated_at": 0

437 }

438 ],

439 "first_id": "first_id",

440 "has_more": true,

441 "last_id": "last_id",

442 "object": "list"

443}

444```

Details

1## Retrieve an agent

2 

3**get** `/agents/{agent_id}`

4 

5Retrieves a reusable agent by ID. See [agent configuration](/api/docs/guides/agents-api/configuration).

6 

7### Path Parameters

8 

9- `agent_id: string`

10 

11### Returns

12 

13- `Agent object { id, created_at, instructions, 10 more }`

14 

15 A reusable agent scoped to the caller's project.

16 

17 - `id: string`

18 

19 The ID of the reusable agent.

20 

21 - `created_at: number`

22 

23 The Unix timestamp, in seconds, when the agent was created.

24 

25 - `instructions: string or null`

26 

27 Custom instructions appended to the agent's default base instructions.

28 

29 - `metadata: map[string]`

30 

31 Custom string key-value pairs attached to the agent.

32 

33 - `model: string`

34 

35 The requested model name used for inference.

36 

37 - `multi_agent: MultiAgentConfig`

38 

39 The resolved configuration for creating and coordinating subagents.

40 

41 - `enabled: boolean`

42 

43 Whether subagent tools are enabled. Defaults to false.

44 

45 - `max_concurrent_subagents: number or null`

46 

47 Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

48 

49 - `name: string or null`

50 

51 A human-readable name for the agent, or null if it is unnamed.

52 

53 - `object: "agent"`

54 

55 The object type. Always `agent`.

56 

57 - `"agent"`

58 

59 - `reasoning: AgentReasoning`

60 

61 The resolved reasoning configuration, including the model default for an omitted effort.

62 

63 - `effort: "none" or "minimal" or "low" or 4 more or null`

64 

65 The amount of reasoning effort used by an agent.

66 

67 - `"none"`

68 

69 - `"minimal"`

70 

71 - `"low"`

72 

73 - `"medium"`

74 

75 - `"high"`

76 

77 - `"xhigh"`

78 

79 - `"max"`

80 

81 - `summary: "concise" or "detailed" or "auto" or null`

82 

83 The reasoning summary format requested from an agent.

84 

85 - `"concise"`

86 

87 Returns a concise reasoning summary when supported.

88 

89 - `"detailed"`

90 

91 Returns a detailed reasoning summary when supported.

92 

93 - `"auto"`

94 

95 Automatically selects the most detailed summary supported by the model.

96 

97 - `service_tier: "auto" or "default" or "flex" or 2 more`

98 

99 The resolved service-tier policy used for model requests.

100 

101 - `"auto"`

102 

103 - `"default"`

104 

105 - `"flex"`

106 

107 - `"priority"`

108 

109 - `"fast"`

110 

111 - `text: AgentText`

112 

113 The resolved configuration for text generated by the agent.

114 

115 - `format: TextFormat`

116 

117 The effective output format. Defaults to ordinary text.

118 

119 - `Text object { type }`

120 

121 Generates ordinary text without a structured-output constraint.

122 

123 - `type: "text"`

124 

125 The type of the object. Always `text`.

126 

127 - `"text"`

128 

129 - `JSONSchema object { schema, type }`

130 

131 Constrains generated text to a JSON Schema.

132 

133 - `schema: map[unknown]`

134 

135 The JSON Schema that generated text must match.

136 

137 - `type: "json_schema"`

138 

139 The type of the object. Always `json_schema`.

140 

141 - `"json_schema"`

142 

143 - `verbosity: "low" or "medium" or "high"`

144 

145 The amount of text produced by the agent. Defaults to `medium`.

146 

147 - `"low"`

148 

149 - `"medium"`

150 

151 - `"high"`

152 

153 - `tools: array of PersistedAgentTool`

154 

155 Tools available to the agent.

156 

157 - `Function object { defer_loading, description, name, 2 more }`

158 

159 A function defined by the application.

160 

161 - `defer_loading: boolean`

162 

163 Whether the function is deferred and discovered through tool search.

164 

165 - `description: string`

166 

167 A description of what the function does.

168 

169 - `name: string`

170 

171 The name of the function.

172 

173 - `parameters: map[unknown]`

174 

175 A JSON Schema object describing the function's arguments.

176 

177 - `type: "function"`

178 

179 The type of the object. Always `function`.

180 

181 - `"function"`

182 

183 - `ToolSearch object { type }`

184 

185 Discovers deferred function tools and loads them into the model context.

186 

187 - `type: "tool_search"`

188 

189 The type of the object. Always `tool_search`.

190 

191 - `"tool_search"`

192 

193 - `ProgrammaticToolCalling object { enabled, type }`

194 

195 Enables calling tools from model-generated code.

196 

197 - `enabled: boolean`

198 

199 Whether tools can be called from model-generated code.

200 

201 - `type: "programmatic_tool_calling"`

202 

203 The type of the object. Always `programmatic_tool_calling`.

204 

205 - `"programmatic_tool_calling"`

206 

207 - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

208 

209 Tools provided by a remote MCP server without stored credentials.

210 

211 - `allowed_tools: array of string or null`

212 

213 The MCP tools the agent may call, or null when all server tools are allowed.

214 

215 - `connection_origin: "service" or "environment"`

216 

217 Where outbound MCP HTTP connections originate.

218 

219 - `"service"`

220 

221 - `"environment"`

222 

223 - `credential_id: string or null`

224 

225 The vault credential selected for this MCP server, if any.

226 

227 - `request_metadata: map[unknown]`

228 

229 Metadata included with requests to this MCP server.

230 

231 - `required: boolean`

232 

233 Whether this MCP server must initialize before the first turn.

234 

235 - `server_label: string`

236 

237 A label used to identify the MCP server in tool calls.

238 

239 - `transport: PersistedMcpTransport`

240 

241 The credential-free transport used to connect to the MCP server.

242 

243 - `HTTP object { headers, server_url, type }`

244 

245 Connects to an MCP server over HTTP.

246 

247 - `headers: map[string]`

248 

249 Non-secret HTTP headers sent to the MCP server.

250 

251 - `server_url: string`

252 

253 The URL of the MCP server.

254 

255 - `type: "http"`

256 

257 The type of the object. Always `http`.

258 

259 - `"http"`

260 

261 - `Stdio object { args, command, cwd, 2 more }`

262 

263 Starts an MCP server as a local process.

264 

265 - `args: array of string`

266 

267 Arguments passed to the MCP server command.

268 

269 - `command: string`

270 

271 The command used to start the MCP server.

272 

273 - `cwd: string`

274 

275 The working directory used to start the MCP server.

276 

277 - `env_vars: array of string`

278 

279 Environment variable names inherited from the execution environment.

280 

281 - `type: "stdio"`

282 

283 The type of the object. Always `stdio`.

284 

285 - `"stdio"`

286 

287 - `type: "mcp"`

288 

289 The type of the object. Always `mcp`.

290 

291 - `"mcp"`

292 

293 - `WebSearch object { allowed_domains, context_size, location, 2 more }`

294 

295 Web search.

296 

297 - `allowed_domains: array of string or null`

298 

299 Allowed search domains, or `null` when the search is unrestricted.

300 

301 - `context_size: "low" or "medium" or "high"`

302 

303 The amount of search context made available to the model. Defaults to `medium`.

304 

305 - `"low"`

306 

307 - `"medium"`

308 

309 - `"high"`

310 

311 - `location: object { city, country, region, timezone } or null`

312 

313 Approximate user location used to localize web search results.

314 

315 - `city: string or null`

316 

317 The city name.

318 

319 - `country: string or null`

320 

321 The two-letter ISO country code, such as `US`.

322 

323 - `region: string or null`

324 

325 The region or state name.

326 

327 - `timezone: string or null`

328 

329 The IANA timezone, such as `America/Los_Angeles`.

330 

331 - `mode: "disabled" or "cached" or "live"`

332 

333 The source used for web search results.

334 

335 - `"disabled"`

336 

337 - `"cached"`

338 

339 - `"live"`

340 

341 - `type: "web_search"`

342 

343 The type of the object. Always `web_search`.

344 

345 - `"web_search"`

346 

347 - `updated_at: number`

348 

349 The Unix timestamp, in seconds, when the agent was last updated.

350 

351### Example

352 

353```http

354curl https://api.openai.com/v1/agents/$AGENT_ID \

355 -H 'OpenAI-Beta: agents=v1' \

356 -H "Authorization: Bearer $OPENAI_API_KEY"

357```

358 

359#### Response

360 

361```json

362{

363 "id": "id",

364 "created_at": 0,

365 "instructions": "instructions",

366 "metadata": {

367 "foo": "string"

368 },

369 "model": "model",

370 "multi_agent": {

371 "enabled": true,

372 "max_concurrent_subagents": 1

373 },

374 "name": "name",

375 "object": "agent",

376 "reasoning": {

377 "effort": "none",

378 "summary": "concise"

379 },

380 "service_tier": "auto",

381 "text": {

382 "format": {

383 "type": "text"

384 },

385 "verbosity": "low"

386 },

387 "tools": [

388 {

389 "defer_loading": true,

390 "description": "description",

391 "name": "name",

392 "parameters": {

393 "foo": "bar"

394 },

395 "type": "function"

396 }

397 ],

398 "updated_at": 0

399}

400```

Details

1## Update an agent

2 

3**post** `/agents/{agent_id}`

4 

5Updates a reusable agent. See [agent configuration](/api/docs/guides/agents-api/configuration).

6 

7### Path Parameters

8 

9- `agent_id: string`

10 

11### Body Parameters

12 

13- `instructions: optional string or null`

14 

15 Additional instructions appended to the agent's default base instructions. Omit to leave unchanged.

16 

17- `metadata: optional map[string] or null`

18 

19 Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters.

20 

21- `model: optional string`

22 

23 The model to use for the agent. The requested model name is preserved.

24 

25- `multi_agent: optional MultiAgentConfigParam or null`

26 

27 Explicit configuration for creating and coordinating subagents.

28 

29 - `enabled: boolean`

30 

31 Whether subagent tools are enabled.

32 

33 - `max_concurrent_subagents: optional number`

34 

35 Maximum number of subagents that may run concurrently. Defaults to 6.

36 

37- `name: optional string or null`

38 

39 A replacement name. Omit to leave unchanged, or pass null to clear it.

40 

41- `reasoning: optional AgentReasoningParam or null`

42 

43 Reasoning configuration for the agent.

44 

45 - `effort: optional "none" or "minimal" or "low" or 4 more or null`

46 

47 The amount of reasoning effort the model should use.

48 

49 - `"none"`

50 

51 - `"minimal"`

52 

53 - `"low"`

54 

55 - `"medium"`

56 

57 - `"high"`

58 

59 - `"xhigh"`

60 

61 - `"max"`

62 

63 - `summary: optional "concise" or "detailed" or "auto" or null`

64 

65 The reasoning summary format requested from the model.

66 

67 - `"concise"`

68 

69 Returns a concise reasoning summary when supported.

70 

71 - `"detailed"`

72 

73 Returns a detailed reasoning summary when supported.

74 

75 - `"auto"`

76 

77 Automatically selects the most detailed summary supported by the model.

78 

79- `service_tier: optional "auto" or "default" or "flex" or 2 more or null`

80 

81 The service tier used for model requests.

82 

83 - `"auto"`

84 

85 Selects the service tier automatically.

86 

87 - `"default"`

88 

89 Uses the default service tier.

90 

91 - `"flex"`

92 

93 Uses the flex service tier.

94 

95 - `"priority"`

96 

97 Uses the priority service tier.

98 

99 - `"fast"`

100 

101 Uses the fast service tier.

102 

103- `text: optional AgentTextParam or null`

104 

105 Configuration for text generated by the agent.

106 

107 - `format: optional TextFormatParam or null`

108 

109 The output format for generated text.

110 

111 - `Text object { type }`

112 

113 Generates ordinary text without a structured-output constraint.

114 

115 - `type: "text"`

116 

117 The type of the object. Always `text`.

118 

119 - `"text"`

120 

121 - `JSONSchema object { schema, type }`

122 

123 Constrains generated text to a JSON Schema.

124 

125 - `schema: map[unknown]`

126 

127 The JSON Schema that generated text must match.

128 

129 - `type: "json_schema"`

130 

131 The type of the object. Always `json_schema`.

132 

133 - `"json_schema"`

134 

135 - `verbosity: optional "low" or "medium" or "high" or null`

136 

137 The amount of text the model should produce.

138 

139 - `"low"`

140 

141 Produces less text.

142 

143 - `"medium"`

144 

145 Uses the default amount of text.

146 

147 - `"high"`

148 

149 Produces more text.

150 

151- `tools: optional array of PersistedAgentToolParam or null`

152 

153 Tools available to the agent.

154 

155 - `Function object { description, name, parameters, 2 more }`

156 

157 A function defined by the application.

158 

159 - `description: string`

160 

161 A description of what the function does.

162 

163 - `name: string`

164 

165 The name of the function.

166 

167 - `parameters: map[unknown]`

168 

169 A JSON Schema object describing the function's arguments.

170 

171 - `type: "function"`

172 

173 The type of the object. Always `function`.

174 

175 - `"function"`

176 

177 - `defer_loading: optional boolean`

178 

179 Whether this function is deferred and discovered through tool search. Defaults to `false`.

180 

181 - `ToolSearch object { type }`

182 

183 Discovers deferred function tools and loads them into the model context.

184 

185 - `type: "tool_search"`

186 

187 The type of the object. Always `tool_search`.

188 

189 - `"tool_search"`

190 

191 - `ProgrammaticToolCalling object { type, enabled }`

192 

193 Enables calling tools from model-generated code.

194 

195 - `type: "programmatic_tool_calling"`

196 

197 The type of the object. Always `programmatic_tool_calling`.

198 

199 - `"programmatic_tool_calling"`

200 

201 - `enabled: optional boolean`

202 

203 Whether tools can be called from model-generated code. Defaults to `true`.

204 

205 - `Mcp object { server_label, transport, type, 5 more }`

206 

207 Tools provided by a remote MCP server without stored credentials.

208 

209 - `server_label: string`

210 

211 A label used to identify the MCP server in tool calls.

212 

213 - `transport: PersistedMcpTransportParam`

214 

215 The credential-free transport used to connect to the MCP server.

216 

217 - `HTTP object { server_url, type, headers }`

218 

219 Connects to an MCP server over HTTP.

220 

221 - `server_url: string`

222 

223 The URL of the MCP server.

224 

225 - `type: "http"`

226 

227 The type of the object. Always `http`.

228 

229 - `"http"`

230 

231 - `headers: optional map[string] or null`

232 

233 Non-secret HTTP headers sent to the MCP server.

234 

235 - `Stdio object { command, cwd, type, 2 more }`

236 

237 Starts an MCP server as a local process.

238 

239 - `command: string`

240 

241 The command used to start the MCP server.

242 

243 - `cwd: string`

244 

245 The working directory used to start the MCP server.

246 

247 - `type: "stdio"`

248 

249 The type of the object. Always `stdio`.

250 

251 - `"stdio"`

252 

253 - `args: optional array of string or null`

254 

255 Arguments passed to the MCP server command.

256 

257 - `env_vars: optional array of string or null`

258 

259 Environment variable names to inherit from the selected execution environment.

260 

261 - `type: "mcp"`

262 

263 The type of the object. Always `mcp`.

264 

265 - `"mcp"`

266 

267 - `allowed_tools: optional array of string or null`

268 

269 The MCP tools the agent may call. All server tools are allowed when omitted.

270 

271 - `connection_origin: optional "service" or "environment" or null`

272 

273 Where outbound MCP HTTP connections originate.

274 

275 - `"service"`

276 

277 Uses the Managed Agents service network.

278 

279 - `"environment"`

280 

281 Uses the session's execution environment.

282 

283 - `credential_id: optional string or null`

284 

285 The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL.

286 

287 - `request_metadata: optional map[unknown] or null`

288 

289 Metadata included with requests to this MCP server.

290 

291 - `required: optional boolean`

292 

293 Whether this MCP server must initialize before the first turn. Defaults to `false`.

294 

295 - `WebSearch object { type, allowed_domains, context_size, 2 more }`

296 

297 Web search.

298 

299 - `type: "web_search"`

300 

301 The type of the object. Always `web_search`.

302 

303 - `"web_search"`

304 

305 - `allowed_domains: optional array of string or null`

306 

307 Domains the search may include.

308 

309 - `context_size: optional "low" or "medium" or "high" or null`

310 

311 The amount of web search context made available to the model.

312 

313 - `"low"`

314 

315 - `"medium"`

316 

317 - `"high"`

318 

319 - `location: optional object { city, country, region, timezone } or null`

320 

321 Approximate user location used to localize web search results.

322 

323 - `city: optional string or null`

324 

325 The city name.

326 

327 - `country: optional string or null`

328 

329 The two-letter ISO country code, such as `US`.

330 

331 - `region: optional string or null`

332 

333 The region or state name.

334 

335 - `timezone: optional string or null`

336 

337 The IANA timezone, such as `America/Los_Angeles`.

338 

339 - `mode: optional "disabled" or "cached" or "live" or null`

340 

341 The source used for web search results.

342 

343 - `"disabled"`

344 

345 Disables web search.

346 

347 - `"cached"`

348 

349 Uses cached search results.

350 

351 - `"live"`

352 

353 Searches the live web.

354 

355### Returns

356 

357- `Agent object { id, created_at, instructions, 10 more }`

358 

359 A reusable agent scoped to the caller's project.

360 

361 - `id: string`

362 

363 The ID of the reusable agent.

364 

365 - `created_at: number`

366 

367 The Unix timestamp, in seconds, when the agent was created.

368 

369 - `instructions: string or null`

370 

371 Custom instructions appended to the agent's default base instructions.

372 

373 - `metadata: map[string]`

374 

375 Custom string key-value pairs attached to the agent.

376 

377 - `model: string`

378 

379 The requested model name used for inference.

380 

381 - `multi_agent: MultiAgentConfig`

382 

383 The resolved configuration for creating and coordinating subagents.

384 

385 - `enabled: boolean`

386 

387 Whether subagent tools are enabled. Defaults to false.

388 

389 - `max_concurrent_subagents: number or null`

390 

391 Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

392 

393 - `name: string or null`

394 

395 A human-readable name for the agent, or null if it is unnamed.

396 

397 - `object: "agent"`

398 

399 The object type. Always `agent`.

400 

401 - `"agent"`

402 

403 - `reasoning: AgentReasoning`

404 

405 The resolved reasoning configuration, including the model default for an omitted effort.

406 

407 - `effort: "none" or "minimal" or "low" or 4 more or null`

408 

409 The amount of reasoning effort used by an agent.

410 

411 - `"none"`

412 

413 - `"minimal"`

414 

415 - `"low"`

416 

417 - `"medium"`

418 

419 - `"high"`

420 

421 - `"xhigh"`

422 

423 - `"max"`

424 

425 - `summary: "concise" or "detailed" or "auto" or null`

426 

427 The reasoning summary format requested from an agent.

428 

429 - `"concise"`

430 

431 Returns a concise reasoning summary when supported.

432 

433 - `"detailed"`

434 

435 Returns a detailed reasoning summary when supported.

436 

437 - `"auto"`

438 

439 Automatically selects the most detailed summary supported by the model.

440 

441 - `service_tier: "auto" or "default" or "flex" or 2 more`

442 

443 The resolved service-tier policy used for model requests.

444 

445 - `"auto"`

446 

447 - `"default"`

448 

449 - `"flex"`

450 

451 - `"priority"`

452 

453 - `"fast"`

454 

455 - `text: AgentText`

456 

457 The resolved configuration for text generated by the agent.

458 

459 - `format: TextFormat`

460 

461 The effective output format. Defaults to ordinary text.

462 

463 - `Text object { type }`

464 

465 Generates ordinary text without a structured-output constraint.

466 

467 - `type: "text"`

468 

469 The type of the object. Always `text`.

470 

471 - `"text"`

472 

473 - `JSONSchema object { schema, type }`

474 

475 Constrains generated text to a JSON Schema.

476 

477 - `schema: map[unknown]`

478 

479 The JSON Schema that generated text must match.

480 

481 - `type: "json_schema"`

482 

483 The type of the object. Always `json_schema`.

484 

485 - `"json_schema"`

486 

487 - `verbosity: "low" or "medium" or "high"`

488 

489 The amount of text produced by the agent. Defaults to `medium`.

490 

491 - `"low"`

492 

493 - `"medium"`

494 

495 - `"high"`

496 

497 - `tools: array of PersistedAgentTool`

498 

499 Tools available to the agent.

500 

501 - `Function object { defer_loading, description, name, 2 more }`

502 

503 A function defined by the application.

504 

505 - `defer_loading: boolean`

506 

507 Whether the function is deferred and discovered through tool search.

508 

509 - `description: string`

510 

511 A description of what the function does.

512 

513 - `name: string`

514 

515 The name of the function.

516 

517 - `parameters: map[unknown]`

518 

519 A JSON Schema object describing the function's arguments.

520 

521 - `type: "function"`

522 

523 The type of the object. Always `function`.

524 

525 - `"function"`

526 

527 - `ToolSearch object { type }`

528 

529 Discovers deferred function tools and loads them into the model context.

530 

531 - `type: "tool_search"`

532 

533 The type of the object. Always `tool_search`.

534 

535 - `"tool_search"`

536 

537 - `ProgrammaticToolCalling object { enabled, type }`

538 

539 Enables calling tools from model-generated code.

540 

541 - `enabled: boolean`

542 

543 Whether tools can be called from model-generated code.

544 

545 - `type: "programmatic_tool_calling"`

546 

547 The type of the object. Always `programmatic_tool_calling`.

548 

549 - `"programmatic_tool_calling"`

550 

551 - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

552 

553 Tools provided by a remote MCP server without stored credentials.

554 

555 - `allowed_tools: array of string or null`

556 

557 The MCP tools the agent may call, or null when all server tools are allowed.

558 

559 - `connection_origin: "service" or "environment"`

560 

561 Where outbound MCP HTTP connections originate.

562 

563 - `"service"`

564 

565 - `"environment"`

566 

567 - `credential_id: string or null`

568 

569 The vault credential selected for this MCP server, if any.

570 

571 - `request_metadata: map[unknown]`

572 

573 Metadata included with requests to this MCP server.

574 

575 - `required: boolean`

576 

577 Whether this MCP server must initialize before the first turn.

578 

579 - `server_label: string`

580 

581 A label used to identify the MCP server in tool calls.

582 

583 - `transport: PersistedMcpTransport`

584 

585 The credential-free transport used to connect to the MCP server.

586 

587 - `HTTP object { headers, server_url, type }`

588 

589 Connects to an MCP server over HTTP.

590 

591 - `headers: map[string]`

592 

593 Non-secret HTTP headers sent to the MCP server.

594 

595 - `server_url: string`

596 

597 The URL of the MCP server.

598 

599 - `type: "http"`

600 

601 The type of the object. Always `http`.

602 

603 - `"http"`

604 

605 - `Stdio object { args, command, cwd, 2 more }`

606 

607 Starts an MCP server as a local process.

608 

609 - `args: array of string`

610 

611 Arguments passed to the MCP server command.

612 

613 - `command: string`

614 

615 The command used to start the MCP server.

616 

617 - `cwd: string`

618 

619 The working directory used to start the MCP server.

620 

621 - `env_vars: array of string`

622 

623 Environment variable names inherited from the execution environment.

624 

625 - `type: "stdio"`

626 

627 The type of the object. Always `stdio`.

628 

629 - `"stdio"`

630 

631 - `type: "mcp"`

632 

633 The type of the object. Always `mcp`.

634 

635 - `"mcp"`

636 

637 - `WebSearch object { allowed_domains, context_size, location, 2 more }`

638 

639 Web search.

640 

641 - `allowed_domains: array of string or null`

642 

643 Allowed search domains, or `null` when the search is unrestricted.

644 

645 - `context_size: "low" or "medium" or "high"`

646 

647 The amount of search context made available to the model. Defaults to `medium`.

648 

649 - `"low"`

650 

651 - `"medium"`

652 

653 - `"high"`

654 

655 - `location: object { city, country, region, timezone } or null`

656 

657 Approximate user location used to localize web search results.

658 

659 - `city: string or null`

660 

661 The city name.

662 

663 - `country: string or null`

664 

665 The two-letter ISO country code, such as `US`.

666 

667 - `region: string or null`

668 

669 The region or state name.

670 

671 - `timezone: string or null`

672 

673 The IANA timezone, such as `America/Los_Angeles`.

674 

675 - `mode: "disabled" or "cached" or "live"`

676 

677 The source used for web search results.

678 

679 - `"disabled"`

680 

681 - `"cached"`

682 

683 - `"live"`

684 

685 - `type: "web_search"`

686 

687 The type of the object. Always `web_search`.

688 

689 - `"web_search"`

690 

691 - `updated_at: number`

692 

693 The Unix timestamp, in seconds, when the agent was last updated.

694 

695### Example

696 

697```http

698curl https://api.openai.com/v1/agents/$AGENT_ID \

699 -X POST \

700 -H 'OpenAI-Beta: agents=v1' \

701 -H "Authorization: Bearer $OPENAI_API_KEY"

702```

703 

704#### Response

705 

706```json

707{

708 "id": "id",

709 "created_at": 0,

710 "instructions": "instructions",

711 "metadata": {

712 "foo": "string"

713 },

714 "model": "model",

715 "multi_agent": {

716 "enabled": true,

717 "max_concurrent_subagents": 1

718 },

719 "name": "name",

720 "object": "agent",

721 "reasoning": {

722 "effort": "none",

723 "summary": "concise"

724 },

725 "service_tier": "auto",

726 "text": {

727 "format": {

728 "type": "text"

729 },

730 "verbosity": "low"

731 },

732 "tools": [

733 {

734 "defer_loading": true,

735 "description": "description",

736 "name": "name",

737 "parameters": {

738 "foo": "bar"

739 },

740 "type": "function"

741 }

742 ],

743 "updated_at": 0

744}

745```

Details

1## Retrieve an agent environment

2 

3**get** `/agents/environments/{environment_id}`

4 

5Retrieves an execution environment's connection status and safe installed metadata. See [environment lifecycle](/api/docs/guides/agents-api/environments/lifecycle).

6 

7### Path Parameters

8 

9- `environment_id: string`

10 

11### Returns

12 

13- `EnvironmentInfo object { id, files, object, 4 more }`

14 

15 Safe metadata for a first-class execution environment.

16 

17 - `id: string`

18 

19 The ID of the environment.

20 

21 - `files: array of HostedEnvironmentFile`

22 

23 Files installed in the environment, without their contents.

24 

25 - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

26 

27 A file copied from the OpenAI Files API.

28 

29 - `id: string`

30 

31 The session-scoped ID of the file in the execution environment.

32 

33 - `file_id: string`

34 

35 The ID of the uploaded file.

36 

37 - `path: string`

38 

39 The file's absolute path inside the environment.

40 

41 - `size_bytes: number`

42 

43 The decoded file size in bytes.

44 

45 - `type: "file_id"`

46 

47 The type of the object. Always `file_id`.

48 

49 - `"file_id"`

50 

51 - `Inline object { id, path, size_bytes, type }`

52 

53 A file supplied inline when the session was created.

54 

55 - `id: string`

56 

57 The session-scoped ID of the file in the execution environment.

58 

59 - `path: string`

60 

61 The file's absolute path inside the environment.

62 

63 - `size_bytes: number`

64 

65 The decoded file size in bytes.

66 

67 - `type: "inline"`

68 

69 The type of the object. Always `inline`.

70 

71 - `"inline"`

72 

73 - `object: "agent.environment"`

74 

75 The object type. Always `agent.environment`.

76 

77 - `"agent.environment"`

78 

79 - `plugins: array of HostedPlugin`

80 

81 Plugins installed in the environment, without their archive contents.

82 

83 - `description: string`

84 

85 The installed plugin description.

86 

87 - `name: string`

88 

89 The installed plugin name.

90 

91 - `type: "inline"`

92 

93 The type of the object. Always `inline`.

94 

95 - `"inline"`

96 

97 - `skills: array of HostedSkill`

98 

99 Skills installed in the environment, without their archive contents.

100 

101 - `HostedSkillReference object { description, name, skill_id, 2 more }`

102 

103 A skill installed from the Skills API.

104 

105 - `description: string`

106 

107 The installed skill description.

108 

109 - `name: string`

110 

111 The installed skill name.

112 

113 - `skill_id: string`

114 

115 The referenced skill ID.

116 

117 - `type: "skill_reference"`

118 

119 The type of the object. Always `skill_reference`.

120 

121 - `"skill_reference"`

122 

123 - `version: string`

124 

125 The concrete skill version installed for this session.

126 

127 - `Inline object { description, name, type }`

128 

129 A skill installed from an inline ZIP archive.

130 

131 - `description: string`

132 

133 The installed skill description.

134 

135 - `name: string`

136 

137 The installed skill name.

138 

139 - `type: "inline"`

140 

141 The type of the object. Always `inline`.

142 

143 - `"inline"`

144 

145 - `status: "pending" or "connected" or "disconnected" or 2 more`

146 

147 The current environment connection status.

148 

149 - `"pending"`

150 

151 - `"connected"`

152 

153 - `"disconnected"`

154 

155 - `"expired"`

156 

157 - `"failed"`

158 

159 - `type: "openai_hosted" or "self_hosted"`

160 

161 Whether the environment is hosted by OpenAI or by the application.

162 

163 - `"openai_hosted"`

164 

165 - `"self_hosted"`

166 

167### Example

168 

169```http

170curl https://api.openai.com/v1/agents/environments/$ENVIRONMENT_ID \

171 -H 'OpenAI-Beta: agents=v1' \

172 -H "Authorization: Bearer $OPENAI_API_KEY"

173```

174 

175#### Response

176 

177```json

178{

179 "id": "id",

180 "files": [

181 {

182 "id": "id",

183 "file_id": "file_id",

184 "path": "path",

185 "size_bytes": 0,

186 "type": "file_id"

187 }

188 ],

189 "object": "agent.environment",

190 "plugins": [

191 {

192 "description": "description",

193 "name": "name",

194 "type": "inline"

195 }

196 ],

197 "skills": [

198 {

199 "description": "description",

200 "name": "name",

201 "skill_id": "skill_id",

202 "type": "skill_reference",

203 "version": "version"

204 }

205 ],

206 "status": "pending",

207 "type": "openai_hosted"

208}

209```

Details

1## Create an agent environment file

2 

3**post** `/agents/environments/{environment_id}/files`

4 

5Copies inline bytes or a Files API file into a connected execution environment. See [environment files](/api/docs/guides/agents-api/environments/files).

6 

7### Path Parameters

8 

9- `environment_id: string`

10 

11### Body Parameters

12 

13- `hosted_environment_file_param: HostedEnvironmentFileParam`

14 

15 A file materialized in an OpenAI-hosted execution environment.

16 

17 - `FileID object { file_id, path, type }`

18 

19 A file previously uploaded through the OpenAI Files API.

20 

21 - `file_id: string`

22 

23 The ID of the uploaded file.

24 

25 - `path: string`

26 

27 The absolute destination path inside `/workspace`.

28 

29 - `type: "file_id"`

30 

31 The type of the object. Always `file_id`.

32 

33 - `"file_id"`

34 

35 - `Inline object { data, path, type }`

36 

37 A file supplied directly as standard-base64 data.

38 

39 - `data: string`

40 

41 The standard-base64-encoded file contents.

42 

43 - `path: string`

44 

45 The absolute destination path inside `/workspace`.

46 

47 - `type: "inline"`

48 

49 The type of the object. Always `inline`.

50 

51 - `"inline"`

52 

53### Returns

54 

55- `EnvironmentFile object { environment_id, object, path, size_bytes }`

56 

57 A live file in an execution environment.

58 

59 - `environment_id: string`

60 

61 The ID of the environment containing this file.

62 

63 - `object: "agent.environment.file"`

64 

65 The object type. Always `agent.environment.file`.

66 

67 - `"agent.environment.file"`

68 

69 - `path: string`

70 

71 The absolute file path inside the environment's workspace.

72 

73 - `size_bytes: number`

74 

75 The file size in bytes.

76 

77### Example

78 

79```http

80curl https://api.openai.com/v1/agents/environments/$ENVIRONMENT_ID/files \

81 -X POST \

82 -H 'OpenAI-Beta: agents=v1' \

83 -H "Authorization: Bearer $OPENAI_API_KEY"

84```

85 

86#### Response

87 

88```json

89{

90 "environment_id": "environment_id",

91 "object": "agent.environment.file",

92 "path": "path",

93 "size_bytes": 0

94}

95```

Details

1## List agent environment files

2 

3**get** `/agents/environments/{environment_id}/files`

4 

5Lists live files on a connected execution environment with optional directory filtering and opaque cursor pagination. See [environment files](/api/docs/guides/agents-api/environments/files).

6 

7### Path Parameters

8 

9- `environment_id: string`

10 

11### Query Parameters

12 

13- `limit: optional number or null`

14 

15 The maximum number of files to return, between 1 and 100.

16 

17- `order: optional "asc" or "desc"`

18 

19 Sort by case-sensitive path components. Defaults to descending.

20 

21 - `"asc"`

22 

23 Returns resources in ascending order.

24 

25 - `"desc"`

26 

27 Returns resources in descending order.

28 

29- `page: optional string`

30 

31 The opaque token from the previous page. Keep the same path, order, and limit.

32 

33- `path: optional string or null`

34 

35 Restrict the listing to this absolute workspace directory.

36 

37### Returns

38 

39- `data: array of EnvironmentFile`

40 

41 Files available on the current page.

42 

43 - `environment_id: string`

44 

45 The ID of the environment containing this file.

46 

47 - `object: "agent.environment.file"`

48 

49 The object type. Always `agent.environment.file`.

50 

51 - `"agent.environment.file"`

52 

53 - `path: string`

54 

55 The absolute file path inside the environment's workspace.

56 

57 - `size_bytes: number`

58 

59 The file size in bytes.

60 

61- `has_more: boolean`

62 

63 Whether more files follow this page.

64 

65- `next: string or null`

66 

67 The opaque cursor to use when requesting the next page, if any.

68 

69- `object: "page"`

70 

71 The object type. Always `page`.

72 

73 - `"page"`

74 

75### Example

76 

77```http

78curl https://api.openai.com/v1/agents/environments/$ENVIRONMENT_ID/files \

79 -H 'OpenAI-Beta: agents=v1' \

80 -H "Authorization: Bearer $OPENAI_API_KEY"

81```

82 

83#### Response

84 

85```json

86{

87 "data": [

88 {

89 "environment_id": "environment_id",

90 "object": "agent.environment.file",

91 "path": "path",

92 "size_bytes": 0

93 }

94 ],

95 "has_more": true,

96 "next": "next",

97 "object": "page"

98}

99```

Details

1## Create an agent environment template

2 

3**post** `/agents/environments/templates`

4 

5Creates reusable environment configuration without returning confidential setup commands or environment values. See [reusing a hosted setup](/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).

6 

7### Body Parameters

8 

9- `capability_directories: optional array of string or null`

10 

11 Directories that contain capabilities exposed to the agent. Defaults to an empty list.

12 

13- `env: optional map[string] or null`

14 

15 Environment variables made available to the agent.

16 

17- `files: optional array of HostedEnvironmentFileParam or null`

18 

19 Files available before the agent starts. Defaults to an empty list.

20 

21 - `FileID object { file_id, path, type }`

22 

23 A file previously uploaded through the OpenAI Files API.

24 

25 - `file_id: string`

26 

27 The ID of the uploaded file.

28 

29 - `path: string`

30 

31 The absolute destination path inside `/workspace`.

32 

33 - `type: "file_id"`

34 

35 The type of the object. Always `file_id`.

36 

37 - `"file_id"`

38 

39 - `Inline object { data, path, type }`

40 

41 A file supplied directly as standard-base64 data.

42 

43 - `data: string`

44 

45 The standard-base64-encoded file contents.

46 

47 - `path: string`

48 

49 The absolute destination path inside `/workspace`.

50 

51 - `type: "inline"`

52 

53 The type of the object. Always `inline`.

54 

55 - `"inline"`

56 

57- `name: optional string or null`

58 

59 An optional human-readable display name for the template.

60 

61- `network: optional object { access, allowed_domains } or null`

62 

63 Network access for an OpenAI-hosted environment.

64 

65 - `access: "enabled" or "disabled" or "restricted"`

66 

67 The environment's network access mode.

68 

69 - `"enabled"`

70 

71 Allows unrestricted network access, matching an omitted network policy.

72 

73 - `"disabled"`

74 

75 Disables network access.

76 

77 - `"restricted"`

78 

79 Allows access only to configured domains.

80 

81 - `allowed_domains: optional array of string or null`

82 

83 Domains the environment may access when network access is restricted.

84 

85- `packages: optional object { npm, python, system } or null`

86 

87 Packages to install in an OpenAI-hosted environment.

88 

89 - `npm: optional array of string or null`

90 

91 npm packages to install globally. Defaults to an empty list.

92 

93 - `python: optional array of string or null`

94 

95 Python packages to install. Defaults to an empty list.

96 

97 - `system: optional array of string or null`

98 

99 System packages to install. Defaults to an empty list.

100 

101- `plugins: optional array of HostedPluginParam or null`

102 

103 Plugins provided as inline ZIP archives. Defaults to an empty list.

104 

105 - `description: string`

106 

107 The plugin description declared in `.codex-plugin/plugin.json`.

108 

109 - `name: string`

110 

111 The plugin name declared in `.codex-plugin/plugin.json`.

112 

113 - `source: InlineCapabilitySourceParam`

114 

115 Provides ZIP bytes encoded with standard base64.

116 

117 - `data: string`

118 

119 Standard-base64 encoded ZIP archive bytes.

120 

121 - `media_type: "application/zip"`

122 

123 The archive media type, always `application/zip`.

124 

125 - `"application/zip"`

126 

127 A ZIP archive.

128 

129 - `type: "base64"`

130 

131 The type of the object. Always `base64`.

132 

133 - `"base64"`

134 

135 - `type: "inline"`

136 

137 The type of the object. Always `inline`.

138 

139 - `"inline"`

140 

141- `setup_commands: optional array of SetupCommandParam or null`

142 

143 Ordered, confidential setup commands. Command bodies are never returned.

144 

145 - `command: string`

146 

147 The shell command to execute.

148 

149 - `cwd: optional string or null`

150 

151 The absolute working directory. Defaults to `/workspace`.

152 

153- `skills: optional array of HostedSkillParam or null`

154 

155 Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

156 

157 - `SkillReference object { skill_id, type, version }`

158 

159 References a skill uploaded through the Skills API.

160 

161 - `skill_id: string`

162 

163 The ID of the skill created through `/v1/skills`.

164 

165 - `type: "skill_reference"`

166 

167 The type of the object. Always `skill_reference`.

168 

169 - `"skill_reference"`

170 

171 - `version: optional string or null`

172 

173 The skill version, a positive integer or `latest`; omission selects the default.

174 

175 - `Inline object { description, name, source, type }`

176 

177 Supplies a skill ZIP directly in the session request.

178 

179 - `description: string`

180 

181 The skill description declared in `SKILL.md`.

182 

183 - `name: string`

184 

185 The skill name declared in `SKILL.md`.

186 

187 - `source: InlineCapabilitySourceParam`

188 

189 Provides ZIP bytes encoded with standard base64.

190 

191 - `type: "inline"`

192 

193 The type of the object. Always `inline`.

194 

195 - `"inline"`

196 

197### Returns

198 

199- `EnvironmentTemplate object { id, capability_directories, created_at, 8 more }`

200 

201 Reusable configuration that provisions a fresh OpenAI-hosted environment for each session.

202 

203 - `id: string`

204 

205 The ID of the reusable environment template.

206 

207 - `capability_directories: array of string`

208 

209 Directories that expose capabilities to the agent.

210 

211 - `created_at: number`

212 

213 The Unix timestamp, in seconds, when the template was created.

214 

215 - `files: array of object { file_id, path, type } or object { path, size_bytes, type }`

216 

217 Safe file metadata, excluding contents and session-scoped file IDs.

218 

219 - `FileID object { file_id, path, type }`

220 

221 A project-scoped Files API reference resolved separately for each session.

222 

223 - `file_id: string`

224 

225 The ID of the uploaded file.

226 

227 - `path: string`

228 

229 The file's absolute path inside the environment.

230 

231 - `type: "file_id"`

232 

233 The type of the object. Always `file_id`.

234 

235 - `"file_id"`

236 

237 - `Inline object { path, size_bytes, type }`

238 

239 Metadata for confidential inline file contents.

240 

241 - `path: string`

242 

243 The file's absolute path inside the environment.

244 

245 - `size_bytes: number`

246 

247 The decoded size of the inline file in bytes.

248 

249 - `type: "inline"`

250 

251 The type of the object. Always `inline`.

252 

253 - `"inline"`

254 

255 - `name: string or null`

256 

257 An optional human-readable display name for the template.

258 

259 - `network: object { access, allowed_domains }`

260 

261 Runtime network access for each OpenAI-hosted environment.

262 

263 - `access: "enabled" or "disabled" or "restricted"`

264 

265 The environment's network access mode.

266 

267 - `"enabled"`

268 

269 Allows unrestricted network access.

270 

271 - `"disabled"`

272 

273 Disables network access.

274 

275 - `"restricted"`

276 

277 Allows access only to configured domains.

278 

279 - `allowed_domains: array of string`

280 

281 Domains the environment may access when network access is restricted.

282 

283 - `object: "agent.environment.template"`

284 

285 The object type. Always `agent.environment.template`.

286 

287 - `"agent.environment.template"`

288 

289 - `packages: object { npm, python, system }`

290 

291 Packages installed in each fresh OpenAI-hosted environment.

292 

293 - `npm: array of string`

294 

295 npm packages installed globally in the environment.

296 

297 - `python: array of string`

298 

299 Python packages installed in the environment.

300 

301 - `system: array of string`

302 

303 System packages installed in the environment.

304 

305 - `plugins: array of HostedPlugin`

306 

307 Safe plugin metadata, excluding inline archive contents.

308 

309 - `description: string`

310 

311 The installed plugin description.

312 

313 - `name: string`

314 

315 The installed plugin name.

316 

317 - `type: "inline"`

318 

319 The type of the object. Always `inline`.

320 

321 - `"inline"`

322 

323 - `skills: array of object { skill_id, type, version } or object { description, name, type }`

324 

325 Safe skill metadata, preserving unresolved version selectors.

326 

327 - `SkillReference object { skill_id, type, version }`

328 

329 A skill resolved afresh from the Skills API whenever a session starts.

330 

331 - `skill_id: string`

332 

333 The referenced skill ID.

334 

335 - `type: "skill_reference"`

336 

337 The type of the object. Always `skill_reference`.

338 

339 - `"skill_reference"`

340 

341 - `version: string or null`

342 

343 The requested version selector, including `latest`.

344 

345 - `Inline object { description, name, type }`

346 

347 Safe metadata for an inline skill archive.

348 

349 - `description: string`

350 

351 The skill description declared in `SKILL.md`.

352 

353 - `name: string`

354 

355 The skill name declared in `SKILL.md`.

356 

357 - `type: "inline"`

358 

359 The type of the object. Always `inline`.

360 

361 - `"inline"`

362 

363 - `updated_at: number`

364 

365 The Unix timestamp, in seconds, when the template was last updated.

366 

367### Example

368 

369```http

370curl https://api.openai.com/v1/agents/environments/templates \

371 -X POST \

372 -H 'OpenAI-Beta: agents=v1' \

373 -H "Authorization: Bearer $OPENAI_API_KEY"

374```

375 

376#### Response

377 

378```json

379{

380 "id": "id",

381 "capability_directories": [

382 "string"

383 ],

384 "created_at": 0,

385 "files": [

386 {

387 "file_id": "file_id",

388 "path": "path",

389 "type": "file_id"

390 }

391 ],

392 "name": "name",

393 "network": {

394 "access": "enabled",

395 "allowed_domains": [

396 "string"

397 ]

398 },

399 "object": "agent.environment.template",

400 "packages": {

401 "npm": [

402 "string"

403 ],

404 "python": [

405 "string"

406 ],

407 "system": [

408 "string"

409 ]

410 },

411 "plugins": [

412 {

413 "description": "description",

414 "name": "name",

415 "type": "inline"

416 }

417 ],

418 "skills": [

419 {

420 "skill_id": "skill_id",

421 "type": "skill_reference",

422 "version": "version"

423 }

424 ],

425 "updated_at": 0

426}

427```

Details

1## Delete an agent environment template

2 

3**delete** `/agents/environments/templates/{environment_template_id}`

4 

5Deletes reusable environment configuration and all confidential template inputs. See [reusing a hosted setup](/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).

6 

7### Path Parameters

8 

9- `environment_template_id: string`

10 

11### Returns

12 

13- `EnvironmentTemplateDeleted object { id, deleted, object }`

14 

15 A deleted reusable environment template.

16 

17 - `id: string`

18 

19 The ID of the deleted environment template.

20 

21 - `deleted: boolean`

22 

23 Whether the environment template was deleted. Always `true`.

24 

25 - `object: "agent.environment.template.deleted"`

26 

27 The object type. Always `agent.environment.template.deleted`.

28 

29 - `"agent.environment.template.deleted"`

30 

31### Example

32 

33```http

34curl https://api.openai.com/v1/agents/environments/templates/$ENVIRONMENT_TEMPLATE_ID \

35 -X DELETE \

36 -H 'OpenAI-Beta: agents=v1' \

37 -H "Authorization: Bearer $OPENAI_API_KEY"

38```

39 

40#### Response

41 

42```json

43{

44 "id": "id",

45 "deleted": true,

46 "object": "agent.environment.template.deleted"

47}

48```

Details

1## List agent environment templates

2 

3**get** `/agents/environments/templates`

4 

5Lists reusable environment templates without returning confidential values. See [reusing a hosted setup](/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).

6 

7### Query Parameters

8 

9- `after: optional string`

10 

11 Return resources after this resource ID in the selected order.

12 

13- `limit: optional number`

14 

15 The maximum number of resources to return, between 1 and 100. Defaults to 20.

16 

17- `order: optional "asc" or "desc"`

18 

19 The order in which resources are returned. Defaults to `desc`.

20 

21 - `"asc"`

22 

23 Returns resources in ascending order.

24 

25 - `"desc"`

26 

27 Returns resources in descending order.

28 

29### Returns

30 

31- `data: array of EnvironmentTemplate`

32 

33 The resources returned in this page, in the requested sort order.

34 

35 - `id: string`

36 

37 The ID of the reusable environment template.

38 

39 - `capability_directories: array of string`

40 

41 Directories that expose capabilities to the agent.

42 

43 - `created_at: number`

44 

45 The Unix timestamp, in seconds, when the template was created.

46 

47 - `files: array of object { file_id, path, type } or object { path, size_bytes, type }`

48 

49 Safe file metadata, excluding contents and session-scoped file IDs.

50 

51 - `FileID object { file_id, path, type }`

52 

53 A project-scoped Files API reference resolved separately for each session.

54 

55 - `file_id: string`

56 

57 The ID of the uploaded file.

58 

59 - `path: string`

60 

61 The file's absolute path inside the environment.

62 

63 - `type: "file_id"`

64 

65 The type of the object. Always `file_id`.

66 

67 - `"file_id"`

68 

69 - `Inline object { path, size_bytes, type }`

70 

71 Metadata for confidential inline file contents.

72 

73 - `path: string`

74 

75 The file's absolute path inside the environment.

76 

77 - `size_bytes: number`

78 

79 The decoded size of the inline file in bytes.

80 

81 - `type: "inline"`

82 

83 The type of the object. Always `inline`.

84 

85 - `"inline"`

86 

87 - `name: string or null`

88 

89 An optional human-readable display name for the template.

90 

91 - `network: object { access, allowed_domains }`

92 

93 Runtime network access for each OpenAI-hosted environment.

94 

95 - `access: "enabled" or "disabled" or "restricted"`

96 

97 The environment's network access mode.

98 

99 - `"enabled"`

100 

101 Allows unrestricted network access.

102 

103 - `"disabled"`

104 

105 Disables network access.

106 

107 - `"restricted"`

108 

109 Allows access only to configured domains.

110 

111 - `allowed_domains: array of string`

112 

113 Domains the environment may access when network access is restricted.

114 

115 - `object: "agent.environment.template"`

116 

117 The object type. Always `agent.environment.template`.

118 

119 - `"agent.environment.template"`

120 

121 - `packages: object { npm, python, system }`

122 

123 Packages installed in each fresh OpenAI-hosted environment.

124 

125 - `npm: array of string`

126 

127 npm packages installed globally in the environment.

128 

129 - `python: array of string`

130 

131 Python packages installed in the environment.

132 

133 - `system: array of string`

134 

135 System packages installed in the environment.

136 

137 - `plugins: array of HostedPlugin`

138 

139 Safe plugin metadata, excluding inline archive contents.

140 

141 - `description: string`

142 

143 The installed plugin description.

144 

145 - `name: string`

146 

147 The installed plugin name.

148 

149 - `type: "inline"`

150 

151 The type of the object. Always `inline`.

152 

153 - `"inline"`

154 

155 - `skills: array of object { skill_id, type, version } or object { description, name, type }`

156 

157 Safe skill metadata, preserving unresolved version selectors.

158 

159 - `SkillReference object { skill_id, type, version }`

160 

161 A skill resolved afresh from the Skills API whenever a session starts.

162 

163 - `skill_id: string`

164 

165 The referenced skill ID.

166 

167 - `type: "skill_reference"`

168 

169 The type of the object. Always `skill_reference`.

170 

171 - `"skill_reference"`

172 

173 - `version: string or null`

174 

175 The requested version selector, including `latest`.

176 

177 - `Inline object { description, name, type }`

178 

179 Safe metadata for an inline skill archive.

180 

181 - `description: string`

182 

183 The skill description declared in `SKILL.md`.

184 

185 - `name: string`

186 

187 The skill name declared in `SKILL.md`.

188 

189 - `type: "inline"`

190 

191 The type of the object. Always `inline`.

192 

193 - `"inline"`

194 

195 - `updated_at: number`

196 

197 The Unix timestamp, in seconds, when the template was last updated.

198 

199- `first_id: string or null`

200 

201 The ID of the first resource in `data`, or `null` if the page is empty.

202 

203- `has_more: boolean`

204 

205 Whether there are more resources to retrieve after this page.

206 

207- `last_id: string or null`

208 

209 The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

210 

211- `object: "list"`

212 

213 The object type, which is always `list`.

214 

215 - `"list"`

216 

217### Example

218 

219```http

220curl https://api.openai.com/v1/agents/environments/templates \

221 -H 'OpenAI-Beta: agents=v1' \

222 -H "Authorization: Bearer $OPENAI_API_KEY"

223```

224 

225#### Response

226 

227```json

228{

229 "data": [

230 {

231 "id": "id",

232 "capability_directories": [

233 "string"

234 ],

235 "created_at": 0,

236 "files": [

237 {

238 "file_id": "file_id",

239 "path": "path",

240 "type": "file_id"

241 }

242 ],

243 "name": "name",

244 "network": {

245 "access": "enabled",

246 "allowed_domains": [

247 "string"

248 ]

249 },

250 "object": "agent.environment.template",

251 "packages": {

252 "npm": [

253 "string"

254 ],

255 "python": [

256 "string"

257 ],

258 "system": [

259 "string"

260 ]

261 },

262 "plugins": [

263 {

264 "description": "description",

265 "name": "name",

266 "type": "inline"

267 }

268 ],

269 "skills": [

270 {

271 "skill_id": "skill_id",

272 "type": "skill_reference",

273 "version": "version"

274 }

275 ],

276 "updated_at": 0

277 }

278 ],

279 "first_id": "first_id",

280 "has_more": true,

281 "last_id": "last_id",

282 "object": "list"

283}

284```

Details

1## Retrieve an agent environment template

2 

3**get** `/agents/environments/templates/{environment_template_id}`

4 

5Retrieves reusable environment configuration without returning confidential values. See [reusing a hosted setup](/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).

6 

7### Path Parameters

8 

9- `environment_template_id: string`

10 

11### Returns

12 

13- `EnvironmentTemplate object { id, capability_directories, created_at, 8 more }`

14 

15 Reusable configuration that provisions a fresh OpenAI-hosted environment for each session.

16 

17 - `id: string`

18 

19 The ID of the reusable environment template.

20 

21 - `capability_directories: array of string`

22 

23 Directories that expose capabilities to the agent.

24 

25 - `created_at: number`

26 

27 The Unix timestamp, in seconds, when the template was created.

28 

29 - `files: array of object { file_id, path, type } or object { path, size_bytes, type }`

30 

31 Safe file metadata, excluding contents and session-scoped file IDs.

32 

33 - `FileID object { file_id, path, type }`

34 

35 A project-scoped Files API reference resolved separately for each session.

36 

37 - `file_id: string`

38 

39 The ID of the uploaded file.

40 

41 - `path: string`

42 

43 The file's absolute path inside the environment.

44 

45 - `type: "file_id"`

46 

47 The type of the object. Always `file_id`.

48 

49 - `"file_id"`

50 

51 - `Inline object { path, size_bytes, type }`

52 

53 Metadata for confidential inline file contents.

54 

55 - `path: string`

56 

57 The file's absolute path inside the environment.

58 

59 - `size_bytes: number`

60 

61 The decoded size of the inline file in bytes.

62 

63 - `type: "inline"`

64 

65 The type of the object. Always `inline`.

66 

67 - `"inline"`

68 

69 - `name: string or null`

70 

71 An optional human-readable display name for the template.

72 

73 - `network: object { access, allowed_domains }`

74 

75 Runtime network access for each OpenAI-hosted environment.

76 

77 - `access: "enabled" or "disabled" or "restricted"`

78 

79 The environment's network access mode.

80 

81 - `"enabled"`

82 

83 Allows unrestricted network access.

84 

85 - `"disabled"`

86 

87 Disables network access.

88 

89 - `"restricted"`

90 

91 Allows access only to configured domains.

92 

93 - `allowed_domains: array of string`

94 

95 Domains the environment may access when network access is restricted.

96 

97 - `object: "agent.environment.template"`

98 

99 The object type. Always `agent.environment.template`.

100 

101 - `"agent.environment.template"`

102 

103 - `packages: object { npm, python, system }`

104 

105 Packages installed in each fresh OpenAI-hosted environment.

106 

107 - `npm: array of string`

108 

109 npm packages installed globally in the environment.

110 

111 - `python: array of string`

112 

113 Python packages installed in the environment.

114 

115 - `system: array of string`

116 

117 System packages installed in the environment.

118 

119 - `plugins: array of HostedPlugin`

120 

121 Safe plugin metadata, excluding inline archive contents.

122 

123 - `description: string`

124 

125 The installed plugin description.

126 

127 - `name: string`

128 

129 The installed plugin name.

130 

131 - `type: "inline"`

132 

133 The type of the object. Always `inline`.

134 

135 - `"inline"`

136 

137 - `skills: array of object { skill_id, type, version } or object { description, name, type }`

138 

139 Safe skill metadata, preserving unresolved version selectors.

140 

141 - `SkillReference object { skill_id, type, version }`

142 

143 A skill resolved afresh from the Skills API whenever a session starts.

144 

145 - `skill_id: string`

146 

147 The referenced skill ID.

148 

149 - `type: "skill_reference"`

150 

151 The type of the object. Always `skill_reference`.

152 

153 - `"skill_reference"`

154 

155 - `version: string or null`

156 

157 The requested version selector, including `latest`.

158 

159 - `Inline object { description, name, type }`

160 

161 Safe metadata for an inline skill archive.

162 

163 - `description: string`

164 

165 The skill description declared in `SKILL.md`.

166 

167 - `name: string`

168 

169 The skill name declared in `SKILL.md`.

170 

171 - `type: "inline"`

172 

173 The type of the object. Always `inline`.

174 

175 - `"inline"`

176 

177 - `updated_at: number`

178 

179 The Unix timestamp, in seconds, when the template was last updated.

180 

181### Example

182 

183```http

184curl https://api.openai.com/v1/agents/environments/templates/$ENVIRONMENT_TEMPLATE_ID \

185 -H 'OpenAI-Beta: agents=v1' \

186 -H "Authorization: Bearer $OPENAI_API_KEY"

187```

188 

189#### Response

190 

191```json

192{

193 "id": "id",

194 "capability_directories": [

195 "string"

196 ],

197 "created_at": 0,

198 "files": [

199 {

200 "file_id": "file_id",

201 "path": "path",

202 "type": "file_id"

203 }

204 ],

205 "name": "name",

206 "network": {

207 "access": "enabled",

208 "allowed_domains": [

209 "string"

210 ]

211 },

212 "object": "agent.environment.template",

213 "packages": {

214 "npm": [

215 "string"

216 ],

217 "python": [

218 "string"

219 ],

220 "system": [

221 "string"

222 ]

223 },

224 "plugins": [

225 {

226 "description": "description",

227 "name": "name",

228 "type": "inline"

229 }

230 ],

231 "skills": [

232 {

233 "skill_id": "skill_id",

234 "type": "skill_reference",

235 "version": "version"

236 }

237 ],

238 "updated_at": 0

239}

240```

Details

1## Update an agent environment template

2 

3**post** `/agents/environments/templates/{environment_template_id}`

4 

5Updates reusable environment configuration without returning confidential values. See [reusing a hosted setup](/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).

6 

7### Path Parameters

8 

9- `environment_template_id: string`

10 

11### Body Parameters

12 

13- `capability_directories: optional array of string or null`

14 

15 Directories that expose capabilities to the agent.

16 

17- `env: optional map[string] or null`

18 

19 Replacement confidential environment values.

20 

21- `files: optional array of HostedEnvironmentFileParam or null`

22 

23 Replacement file configuration materialized for each new session.

24 

25 - `FileID object { file_id, path, type }`

26 

27 A file previously uploaded through the OpenAI Files API.

28 

29 - `file_id: string`

30 

31 The ID of the uploaded file.

32 

33 - `path: string`

34 

35 The absolute destination path inside `/workspace`.

36 

37 - `type: "file_id"`

38 

39 The type of the object. Always `file_id`.

40 

41 - `"file_id"`

42 

43 - `Inline object { data, path, type }`

44 

45 A file supplied directly as standard-base64 data.

46 

47 - `data: string`

48 

49 The standard-base64-encoded file contents.

50 

51 - `path: string`

52 

53 The absolute destination path inside `/workspace`.

54 

55 - `type: "inline"`

56 

57 The type of the object. Always `inline`.

58 

59 - `"inline"`

60 

61- `name: optional string or null`

62 

63 A replacement human-readable display name, or `null` to clear the name.

64 

65- `network: optional object { access, allowed_domains } or null`

66 

67 Network access for an OpenAI-hosted environment.

68 

69 - `access: "enabled" or "disabled" or "restricted"`

70 

71 The environment's network access mode.

72 

73 - `"enabled"`

74 

75 Allows unrestricted network access, matching an omitted network policy.

76 

77 - `"disabled"`

78 

79 Disables network access.

80 

81 - `"restricted"`

82 

83 Allows access only to configured domains.

84 

85 - `allowed_domains: optional array of string or null`

86 

87 Domains the environment may access when network access is restricted.

88 

89- `packages: optional object { npm, python, system } or null`

90 

91 Packages to install in an OpenAI-hosted environment.

92 

93 - `npm: optional array of string or null`

94 

95 npm packages to install globally. Defaults to an empty list.

96 

97 - `python: optional array of string or null`

98 

99 Python packages to install. Defaults to an empty list.

100 

101 - `system: optional array of string or null`

102 

103 System packages to install. Defaults to an empty list.

104 

105- `plugins: optional array of HostedPluginParam or null`

106 

107 Replacement plugin configuration installed for each new session.

108 

109 - `description: string`

110 

111 The plugin description declared in `.codex-plugin/plugin.json`.

112 

113 - `name: string`

114 

115 The plugin name declared in `.codex-plugin/plugin.json`.

116 

117 - `source: InlineCapabilitySourceParam`

118 

119 Provides ZIP bytes encoded with standard base64.

120 

121 - `data: string`

122 

123 Standard-base64 encoded ZIP archive bytes.

124 

125 - `media_type: "application/zip"`

126 

127 The archive media type, always `application/zip`.

128 

129 - `"application/zip"`

130 

131 A ZIP archive.

132 

133 - `type: "base64"`

134 

135 The type of the object. Always `base64`.

136 

137 - `"base64"`

138 

139 - `type: "inline"`

140 

141 The type of the object. Always `inline`.

142 

143 - `"inline"`

144 

145- `setup_commands: optional array of SetupCommandParam or null`

146 

147 Replacement confidential setup commands, never included in returned resources.

148 

149 - `command: string`

150 

151 The shell command to execute.

152 

153 - `cwd: optional string or null`

154 

155 The absolute working directory. Defaults to `/workspace`.

156 

157- `skills: optional array of HostedSkillParam or null`

158 

159 Replacement skill configuration installed for each new session.

160 

161 - `SkillReference object { skill_id, type, version }`

162 

163 References a skill uploaded through the Skills API.

164 

165 - `skill_id: string`

166 

167 The ID of the skill created through `/v1/skills`.

168 

169 - `type: "skill_reference"`

170 

171 The type of the object. Always `skill_reference`.

172 

173 - `"skill_reference"`

174 

175 - `version: optional string or null`

176 

177 The skill version, a positive integer or `latest`; omission selects the default.

178 

179 - `Inline object { description, name, source, type }`

180 

181 Supplies a skill ZIP directly in the session request.

182 

183 - `description: string`

184 

185 The skill description declared in `SKILL.md`.

186 

187 - `name: string`

188 

189 The skill name declared in `SKILL.md`.

190 

191 - `source: InlineCapabilitySourceParam`

192 

193 Provides ZIP bytes encoded with standard base64.

194 

195 - `type: "inline"`

196 

197 The type of the object. Always `inline`.

198 

199 - `"inline"`

200 

201### Returns

202 

203- `EnvironmentTemplate object { id, capability_directories, created_at, 8 more }`

204 

205 Reusable configuration that provisions a fresh OpenAI-hosted environment for each session.

206 

207 - `id: string`

208 

209 The ID of the reusable environment template.

210 

211 - `capability_directories: array of string`

212 

213 Directories that expose capabilities to the agent.

214 

215 - `created_at: number`

216 

217 The Unix timestamp, in seconds, when the template was created.

218 

219 - `files: array of object { file_id, path, type } or object { path, size_bytes, type }`

220 

221 Safe file metadata, excluding contents and session-scoped file IDs.

222 

223 - `FileID object { file_id, path, type }`

224 

225 A project-scoped Files API reference resolved separately for each session.

226 

227 - `file_id: string`

228 

229 The ID of the uploaded file.

230 

231 - `path: string`

232 

233 The file's absolute path inside the environment.

234 

235 - `type: "file_id"`

236 

237 The type of the object. Always `file_id`.

238 

239 - `"file_id"`

240 

241 - `Inline object { path, size_bytes, type }`

242 

243 Metadata for confidential inline file contents.

244 

245 - `path: string`

246 

247 The file's absolute path inside the environment.

248 

249 - `size_bytes: number`

250 

251 The decoded size of the inline file in bytes.

252 

253 - `type: "inline"`

254 

255 The type of the object. Always `inline`.

256 

257 - `"inline"`

258 

259 - `name: string or null`

260 

261 An optional human-readable display name for the template.

262 

263 - `network: object { access, allowed_domains }`

264 

265 Runtime network access for each OpenAI-hosted environment.

266 

267 - `access: "enabled" or "disabled" or "restricted"`

268 

269 The environment's network access mode.

270 

271 - `"enabled"`

272 

273 Allows unrestricted network access.

274 

275 - `"disabled"`

276 

277 Disables network access.

278 

279 - `"restricted"`

280 

281 Allows access only to configured domains.

282 

283 - `allowed_domains: array of string`

284 

285 Domains the environment may access when network access is restricted.

286 

287 - `object: "agent.environment.template"`

288 

289 The object type. Always `agent.environment.template`.

290 

291 - `"agent.environment.template"`

292 

293 - `packages: object { npm, python, system }`

294 

295 Packages installed in each fresh OpenAI-hosted environment.

296 

297 - `npm: array of string`

298 

299 npm packages installed globally in the environment.

300 

301 - `python: array of string`

302 

303 Python packages installed in the environment.

304 

305 - `system: array of string`

306 

307 System packages installed in the environment.

308 

309 - `plugins: array of HostedPlugin`

310 

311 Safe plugin metadata, excluding inline archive contents.

312 

313 - `description: string`

314 

315 The installed plugin description.

316 

317 - `name: string`

318 

319 The installed plugin name.

320 

321 - `type: "inline"`

322 

323 The type of the object. Always `inline`.

324 

325 - `"inline"`

326 

327 - `skills: array of object { skill_id, type, version } or object { description, name, type }`

328 

329 Safe skill metadata, preserving unresolved version selectors.

330 

331 - `SkillReference object { skill_id, type, version }`

332 

333 A skill resolved afresh from the Skills API whenever a session starts.

334 

335 - `skill_id: string`

336 

337 The referenced skill ID.

338 

339 - `type: "skill_reference"`

340 

341 The type of the object. Always `skill_reference`.

342 

343 - `"skill_reference"`

344 

345 - `version: string or null`

346 

347 The requested version selector, including `latest`.

348 

349 - `Inline object { description, name, type }`

350 

351 Safe metadata for an inline skill archive.

352 

353 - `description: string`

354 

355 The skill description declared in `SKILL.md`.

356 

357 - `name: string`

358 

359 The skill name declared in `SKILL.md`.

360 

361 - `type: "inline"`

362 

363 The type of the object. Always `inline`.

364 

365 - `"inline"`

366 

367 - `updated_at: number`

368 

369 The Unix timestamp, in seconds, when the template was last updated.

370 

371### Example

372 

373```http

374curl https://api.openai.com/v1/agents/environments/templates/$ENVIRONMENT_TEMPLATE_ID \

375 -X POST \

376 -H 'OpenAI-Beta: agents=v1' \

377 -H "Authorization: Bearer $OPENAI_API_KEY"

378```

379 

380#### Response

381 

382```json

383{

384 "id": "id",

385 "capability_directories": [

386 "string"

387 ],

388 "created_at": 0,

389 "files": [

390 {

391 "file_id": "file_id",

392 "path": "path",

393 "type": "file_id"

394 }

395 ],

396 "name": "name",

397 "network": {

398 "access": "enabled",

399 "allowed_domains": [

400 "string"

401 ]

402 },

403 "object": "agent.environment.template",

404 "packages": {

405 "npm": [

406 "string"

407 ],

408 "python": [

409 "string"

410 ],

411 "system": [

412 "string"

413 ]

414 },

415 "plugins": [

416 {

417 "description": "description",

418 "name": "name",

419 "type": "inline"

420 }

421 ],

422 "skills": [

423 {

424 "skill_id": "skill_id",

425 "type": "skill_reference",

426 "version": "version"

427 }

428 ],

429 "updated_at": 0

430}

431```

Details

1## Create an agent session

2 

3**post** `/agents/sessions`

4 

5Creates a managed agent session, optionally submits initial input, and returns the session or streams its events when stream is true. See [running sessions](/api/docs/guides/agents-api/sessions).

6 

7### Body Parameters

8 

9- `environment: EnvironmentParam`

10 

11 An inline execution environment or a reference to an environment template.

12 

13 - `None object { type }`

14 

15 Runs the agent without an execution environment.

16 

17 - `type: "none"`

18 

19 The type of the object. Always `none`.

20 

21 - `"none"`

22 

23 - `OpenAIHosted object { type, capability_directories, env, 7 more }`

24 

25 An OpenAI-hosted environment, optionally based on a reusable template.

26 

27 - `type: "openai_hosted"`

28 

29 The type of the object. Always `openai_hosted`.

30 

31 - `"openai_hosted"`

32 

33 - `capability_directories: optional array of string or null`

34 

35 Directories that contain capabilities exposed to the agent. Defaults to an empty list.

36 

37 - `env: optional map[string] or null`

38 

39 Environment variables made available to the agent.

40 

41 - `environment_template_id: optional string`

42 

43 A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy.

44 

45 - `files: optional array of HostedEnvironmentFileParam or null`

46 

47 Files available before the agent starts. Defaults to an empty list.

48 

49 - `FileID object { file_id, path, type }`

50 

51 A file previously uploaded through the OpenAI Files API.

52 

53 - `file_id: string`

54 

55 The ID of the uploaded file.

56 

57 - `path: string`

58 

59 The absolute destination path inside `/workspace`.

60 

61 - `type: "file_id"`

62 

63 The type of the object. Always `file_id`.

64 

65 - `"file_id"`

66 

67 - `Inline object { data, path, type }`

68 

69 A file supplied directly as standard-base64 data.

70 

71 - `data: string`

72 

73 The standard-base64-encoded file contents.

74 

75 - `path: string`

76 

77 The absolute destination path inside `/workspace`.

78 

79 - `type: "inline"`

80 

81 The type of the object. Always `inline`.

82 

83 - `"inline"`

84 

85 - `network: optional object { access, allowed_domains } or null`

86 

87 Network access for an OpenAI-hosted environment.

88 

89 - `access: "enabled" or "disabled" or "restricted"`

90 

91 The environment's network access mode.

92 

93 - `"enabled"`

94 

95 Allows unrestricted network access, matching an omitted network policy.

96 

97 - `"disabled"`

98 

99 Disables network access.

100 

101 - `"restricted"`

102 

103 Allows access only to configured domains.

104 

105 - `allowed_domains: optional array of string or null`

106 

107 Domains the environment may access when network access is restricted.

108 

109 - `packages: optional object { npm, python, system } or null`

110 

111 Packages to install in an OpenAI-hosted environment.

112 

113 - `npm: optional array of string or null`

114 

115 npm packages to install globally. Defaults to an empty list.

116 

117 - `python: optional array of string or null`

118 

119 Python packages to install. Defaults to an empty list.

120 

121 - `system: optional array of string or null`

122 

123 System packages to install. Defaults to an empty list.

124 

125 - `plugins: optional array of HostedPluginParam or null`

126 

127 Plugins provided as inline ZIP archives. Defaults to an empty list.

128 

129 - `description: string`

130 

131 The plugin description declared in `.codex-plugin/plugin.json`.

132 

133 - `name: string`

134 

135 The plugin name declared in `.codex-plugin/plugin.json`.

136 

137 - `source: InlineCapabilitySourceParam`

138 

139 Provides ZIP bytes encoded with standard base64.

140 

141 - `data: string`

142 

143 Standard-base64 encoded ZIP archive bytes.

144 

145 - `media_type: "application/zip"`

146 

147 The archive media type, always `application/zip`.

148 

149 - `"application/zip"`

150 

151 A ZIP archive.

152 

153 - `type: "base64"`

154 

155 The type of the object. Always `base64`.

156 

157 - `"base64"`

158 

159 - `type: "inline"`

160 

161 The type of the object. Always `inline`.

162 

163 - `"inline"`

164 

165 - `setup_commands: optional array of SetupCommandParam or null`

166 

167 Ordered, confidential setup commands. Command bodies are never returned.

168 

169 - `command: string`

170 

171 The shell command to execute.

172 

173 - `cwd: optional string or null`

174 

175 The absolute working directory. Defaults to `/workspace`.

176 

177 - `skills: optional array of HostedSkillParam or null`

178 

179 Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

180 

181 - `SkillReference object { skill_id, type, version }`

182 

183 References a skill uploaded through the Skills API.

184 

185 - `skill_id: string`

186 

187 The ID of the skill created through `/v1/skills`.

188 

189 - `type: "skill_reference"`

190 

191 The type of the object. Always `skill_reference`.

192 

193 - `"skill_reference"`

194 

195 - `version: optional string or null`

196 

197 The skill version, a positive integer or `latest`; omission selects the default.

198 

199 - `Inline object { description, name, source, type }`

200 

201 Supplies a skill ZIP directly in the session request.

202 

203 - `description: string`

204 

205 The skill description declared in `SKILL.md`.

206 

207 - `name: string`

208 

209 The skill name declared in `SKILL.md`.

210 

211 - `source: InlineCapabilitySourceParam`

212 

213 Provides ZIP bytes encoded with standard base64.

214 

215 - `type: "inline"`

216 

217 The type of the object. Always `inline`.

218 

219 - `"inline"`

220 

221 - `SelfHosted object { type, workspace_directory, capability_directories }`

222 

223 An application-hosted environment configured inline.

224 

225 - `type: "self_hosted"`

226 

227 The type of the object. Always `self_hosted`.

228 

229 - `"self_hosted"`

230 

231 - `workspace_directory: string`

232 

233 Absolute project directory inside the self-hosted environment.

234 

235 - `capability_directories: optional array of string or null`

236 

237 Directories that contain capabilities exposed to the agent. Defaults to an empty list.

238 

239- `agent: optional object { instructions, model, multi_agent, 4 more }`

240 

241 Agent configuration. With `agent_id`, supplied fields override the saved agent for this session. Without `agent_id`, `model` is required.

242 

243 - `instructions: optional string or null`

244 

245 Additional instructions appended to the agent's default base instructions. Omit to leave unchanged.

246 

247 - `model: optional string`

248 

249 The model to use for the agent. The requested model name is preserved.

250 

251 - `multi_agent: optional MultiAgentConfigParam or null`

252 

253 Explicit configuration for creating and coordinating subagents.

254 

255 - `enabled: boolean`

256 

257 Whether subagent tools are enabled.

258 

259 - `max_concurrent_subagents: optional number`

260 

261 Maximum number of subagents that may run concurrently. Defaults to 6.

262 

263 - `reasoning: optional AgentReasoningParam or null`

264 

265 Reasoning configuration for the agent.

266 

267 - `effort: optional "none" or "minimal" or "low" or 4 more or null`

268 

269 The amount of reasoning effort the model should use.

270 

271 - `"none"`

272 

273 - `"minimal"`

274 

275 - `"low"`

276 

277 - `"medium"`

278 

279 - `"high"`

280 

281 - `"xhigh"`

282 

283 - `"max"`

284 

285 - `summary: optional "concise" or "detailed" or "auto" or null`

286 

287 The reasoning summary format requested from the model.

288 

289 - `"concise"`

290 

291 Returns a concise reasoning summary when supported.

292 

293 - `"detailed"`

294 

295 Returns a detailed reasoning summary when supported.

296 

297 - `"auto"`

298 

299 Automatically selects the most detailed summary supported by the model.

300 

301 - `service_tier: optional "auto" or "default" or "flex" or 2 more or null`

302 

303 The service tier used for model requests.

304 

305 - `"auto"`

306 

307 Selects the service tier automatically.

308 

309 - `"default"`

310 

311 Uses the default service tier.

312 

313 - `"flex"`

314 

315 Uses the flex service tier.

316 

317 - `"priority"`

318 

319 Uses the priority service tier.

320 

321 - `"fast"`

322 

323 Uses the fast service tier.

324 

325 - `text: optional AgentTextParam or null`

326 

327 Configuration for text generated by the agent.

328 

329 - `format: optional TextFormatParam or null`

330 

331 The output format for generated text.

332 

333 - `Text object { type }`

334 

335 Generates ordinary text without a structured-output constraint.

336 

337 - `type: "text"`

338 

339 The type of the object. Always `text`.

340 

341 - `"text"`

342 

343 - `JSONSchema object { schema, type }`

344 

345 Constrains generated text to a JSON Schema.

346 

347 - `schema: map[unknown]`

348 

349 The JSON Schema that generated text must match.

350 

351 - `type: "json_schema"`

352 

353 The type of the object. Always `json_schema`.

354 

355 - `"json_schema"`

356 

357 - `verbosity: optional "low" or "medium" or "high" or null`

358 

359 The amount of text the model should produce.

360 

361 - `"low"`

362 

363 Produces less text.

364 

365 - `"medium"`

366 

367 Uses the default amount of text.

368 

369 - `"high"`

370 

371 Produces more text.

372 

373 - `tools: optional array of AgentToolParam or null`

374 

375 Tools available to the agent. Omit to inherit, or pass null to clear them.

376 

377 - `Function object { description, name, parameters, 2 more }`

378 

379 A function defined by the application.

380 

381 - `description: string`

382 

383 A description of what the function does.

384 

385 - `name: string`

386 

387 The name of the function.

388 

389 - `parameters: map[unknown]`

390 

391 A JSON Schema object describing the function's arguments.

392 

393 - `type: "function"`

394 

395 The type of the object. Always `function`.

396 

397 - `"function"`

398 

399 - `defer_loading: optional boolean`

400 

401 Whether this function is deferred and discovered through tool search. Defaults to `false`.

402 

403 - `ToolSearch object { type }`

404 

405 Discovers deferred function tools and loads them into the model context.

406 

407 - `type: "tool_search"`

408 

409 The type of the object. Always `tool_search`.

410 

411 - `"tool_search"`

412 

413 - `ProgrammaticToolCalling object { type, enabled }`

414 

415 Enables calling tools from model-generated code.

416 

417 - `type: "programmatic_tool_calling"`

418 

419 The type of the object. Always `programmatic_tool_calling`.

420 

421 - `"programmatic_tool_calling"`

422 

423 - `enabled: optional boolean`

424 

425 Whether tools can be called from model-generated code. Defaults to `true`.

426 

427 - `Mcp object { server_label, transport, type, 5 more }`

428 

429 Tools provided by a remote MCP server.

430 

431 - `server_label: string`

432 

433 A label used to identify the MCP server in tool calls.

434 

435 - `transport: McpTransportParam`

436 

437 The transport used to connect to the MCP server.

438 

439 - `HTTP object { server_url, type, authorization, headers }`

440 

441 Connects to an MCP server over HTTP.

442 

443 - `server_url: string`

444 

445 The URL of the MCP server.

446 

447 - `type: "http"`

448 

449 The type of the object. Always `http`.

450 

451 - `"http"`

452 

453 - `authorization: optional string or null`

454 

455 The authorization value sent to the MCP server, if any.

456 

457 - `headers: optional map[string] or null`

458 

459 Additional HTTP headers sent to the MCP server.

460 

461 - `Stdio object { command, cwd, type, 3 more }`

462 

463 Starts an MCP server as a local process.

464 

465 - `command: string`

466 

467 The command used to start the MCP server.

468 

469 - `cwd: string`

470 

471 The working directory used to start the MCP server.

472 

473 - `type: "stdio"`

474 

475 The type of the object. Always `stdio`.

476 

477 - `"stdio"`

478 

479 - `args: optional array of string or null`

480 

481 Arguments passed to the MCP server command.

482 

483 - `env: optional map[string] or null`

484 

485 Environment variables set for the MCP server process.

486 

487 - `env_vars: optional array of string or null`

488 

489 Environment variable names to inherit from the selected execution environment.

490 

491 - `type: "mcp"`

492 

493 The type of the object. Always `mcp`.

494 

495 - `"mcp"`

496 

497 - `allowed_tools: optional array of string or null`

498 

499 The MCP tools the agent may call. All server tools are allowed when omitted.

500 

501 - `connection_origin: optional "service" or "environment" or null`

502 

503 Where outbound MCP HTTP connections originate.

504 

505 - `"service"`

506 

507 Uses the Managed Agents service network.

508 

509 - `"environment"`

510 

511 Uses the session's execution environment.

512 

513 - `credential_id: optional string or null`

514 

515 The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL.

516 

517 - `request_metadata: optional map[unknown] or null`

518 

519 Metadata included with requests to this MCP server.

520 

521 - `required: optional boolean`

522 

523 Whether this MCP server must initialize before the first turn. Defaults to `false`.

524 

525 - `WebSearch object { type, allowed_domains, context_size, 2 more }`

526 

527 Web search.

528 

529 - `type: "web_search"`

530 

531 The type of the object. Always `web_search`.

532 

533 - `"web_search"`

534 

535 - `allowed_domains: optional array of string or null`

536 

537 Domains the search may include.

538 

539 - `context_size: optional "low" or "medium" or "high" or null`

540 

541 The amount of web search context made available to the model.

542 

543 - `"low"`

544 

545 - `"medium"`

546 

547 - `"high"`

548 

549 - `location: optional object { city, country, region, timezone } or null`

550 

551 Approximate user location used to localize web search results.

552 

553 - `city: optional string or null`

554 

555 The city name.

556 

557 - `country: optional string or null`

558 

559 The two-letter ISO country code, such as `US`.

560 

561 - `region: optional string or null`

562 

563 The region or state name.

564 

565 - `timezone: optional string or null`

566 

567 The IANA timezone, such as `America/Los_Angeles`.

568 

569 - `mode: optional "disabled" or "cached" or "live" or null`

570 

571 The source used for web search results.

572 

573 - `"disabled"`

574 

575 Disables web search.

576 

577 - `"cached"`

578 

579 Uses cached search results.

580 

581 - `"live"`

582 

583 Searches the live web.

584 

585- `agent_id: optional string`

586 

587 The ID of a saved reusable agent. Omit `agent` to use its configuration unchanged.

588 

589- `input: optional string or array of AgentSessionInputMessageParam or null`

590 

591 Initial input submitted when creating a session.

592 

593 - `string`

594 

595 - `array of AgentSessionInputMessageParam`

596 

597 - `content: array of InputContentParam`

598 

599 The content of the message.

600 

601 - `InputText object { text, type }`

602 

603 Text input to the model.

604 

605 - `text: string`

606 

607 The text sent to the model.

608 

609 - `type: "input_text"`

610 

611 The type of the object. Always `input_text`.

612 

613 - `"input_text"`

614 

615 - `InputImage object { image_url, type }`

616 

617 Image input to the model.

618 

619 - `image_url: string`

620 

621 The URL of the image sent to the model.

622 

623 - `type: "input_image"`

624 

625 The type of the object. Always `input_image`.

626 

627 - `"input_image"`

628 

629 - `role: "user"`

630 

631 The role of the message author. Always `user`.

632 

633 - `"user"`

634 

635 - `type: optional "message"`

636 

637 The type of the input item. Always `message`.

638 

639 - `"message"`

640 

641- `metadata: optional map[string] or null`

642 

643 Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map.

644 

645- `stream: optional boolean`

646 

647 Whether to stream session events as server-sent events. Defaults to `false`.

648 

649- `vault_ids: optional array of string or null`

650 

651 The IDs of vaults made available to the session.

652 

653### Returns

654 

655- `AgentSession object { id, agent, created_at, 9 more }`

656 

657 A Managed Agents session.

658 

659 - `id: string`

660 

661 The ID of the session.

662 

663 - `agent: object { id, instructions, model, 6 more }`

664 

665 The agent running in the session.

666 

667 - `id: string`

668 

669 The ID of the agent.

670 

671 - `instructions: string or null`

672 

673 Custom instructions appended to the agent's default base instructions.

674 

675 - `model: string`

676 

677 The model used by the agent.

678 

679 - `multi_agent: MultiAgentConfig`

680 

681 Configuration for creating and coordinating subagents.

682 

683 - `enabled: boolean`

684 

685 Whether subagent tools are enabled. Defaults to false.

686 

687 - `max_concurrent_subagents: number or null`

688 

689 Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

690 

691 - `name: string or null`

692 

693 The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

694 

695 - `reasoning: AgentReasoning`

696 

697 The agent's reasoning configuration.

698 

699 - `effort: "none" or "minimal" or "low" or 4 more or null`

700 

701 The amount of reasoning effort used by an agent.

702 

703 - `"none"`

704 

705 - `"minimal"`

706 

707 - `"low"`

708 

709 - `"medium"`

710 

711 - `"high"`

712 

713 - `"xhigh"`

714 

715 - `"max"`

716 

717 - `summary: "concise" or "detailed" or "auto" or null`

718 

719 The reasoning summary format requested from an agent.

720 

721 - `"concise"`

722 

723 Returns a concise reasoning summary when supported.

724 

725 - `"detailed"`

726 

727 Returns a detailed reasoning summary when supported.

728 

729 - `"auto"`

730 

731 Automatically selects the most detailed summary supported by the model.

732 

733 - `service_tier: "auto" or "default" or "flex" or 2 more`

734 

735 The effective service-tier policy for model requests. Defaults to `auto`.

736 

737 - `"auto"`

738 

739 - `"default"`

740 

741 - `"flex"`

742 

743 - `"priority"`

744 

745 - `"fast"`

746 

747 - `text: AgentText`

748 

749 Configuration for text generated by the agent.

750 

751 - `format: TextFormat`

752 

753 The effective output format. Defaults to ordinary text.

754 

755 - `Text object { type }`

756 

757 Generates ordinary text without a structured-output constraint.

758 

759 - `type: "text"`

760 

761 The type of the object. Always `text`.

762 

763 - `"text"`

764 

765 - `JSONSchema object { schema, type }`

766 

767 Constrains generated text to a JSON Schema.

768 

769 - `schema: map[unknown]`

770 

771 The JSON Schema that generated text must match.

772 

773 - `type: "json_schema"`

774 

775 The type of the object. Always `json_schema`.

776 

777 - `"json_schema"`

778 

779 - `verbosity: "low" or "medium" or "high"`

780 

781 The amount of text produced by the agent. Defaults to `medium`.

782 

783 - `"low"`

784 

785 - `"medium"`

786 

787 - `"high"`

788 

789 - `tools: array of AgentTool`

790 

791 Tools available to the agent.

792 

793 - `Function object { defer_loading, description, name, 2 more }`

794 

795 A function defined by the application.

796 

797 - `defer_loading: boolean`

798 

799 Whether the function is deferred and discovered through tool search.

800 

801 - `description: string`

802 

803 A description of what the function does.

804 

805 - `name: string`

806 

807 The name of the function.

808 

809 - `parameters: map[unknown]`

810 

811 A JSON Schema object describing the function's arguments.

812 

813 - `type: "function"`

814 

815 The type of the object. Always `function`.

816 

817 - `"function"`

818 

819 - `ProgrammaticToolCalling object { enabled, type }`

820 

821 Enables calling tools from model-generated code.

822 

823 - `enabled: boolean`

824 

825 Whether tools can be called from model-generated code.

826 

827 - `type: "programmatic_tool_calling"`

828 

829 The type of the object. Always `programmatic_tool_calling`.

830 

831 - `"programmatic_tool_calling"`

832 

833 - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

834 

835 Tools provided by a remote MCP server.

836 

837 - `allowed_tools: array of string or null`

838 

839 The MCP tools the agent may call.

840 

841 - `connection_origin: "service" or "environment"`

842 

843 Where outbound MCP HTTP connections originate.

844 

845 - `"service"`

846 

847 - `"environment"`

848 

849 - `credential_id: string or null`

850 

851 The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

852 

853 - `request_metadata: map[unknown]`

854 

855 Metadata included with requests to this MCP server.

856 

857 - `required: boolean`

858 

859 Whether this MCP server must initialize before the first turn.

860 

861 - `server_label: string`

862 

863 A label used to identify the MCP server in tool calls.

864 

865 - `transport: McpTransport`

866 

867 The transport used to connect to the MCP server.

868 

869 - `HTTP object { server_url, type }`

870 

871 Connects to an MCP server over HTTP.

872 

873 - `server_url: string`

874 

875 The URL of the MCP server.

876 

877 - `type: "http"`

878 

879 The type of the object. Always `http`.

880 

881 - `"http"`

882 

883 - `Stdio object { args, command, cwd, 2 more }`

884 

885 Starts an MCP server as a local process.

886 

887 - `args: array of string`

888 

889 Arguments passed to the MCP server command.

890 

891 - `command: string`

892 

893 The command used to start the MCP server.

894 

895 - `cwd: string`

896 

897 The working directory used to start the MCP server.

898 

899 - `env_vars: array of string`

900 

901 Environment variable names inherited from the execution environment.

902 

903 - `type: "stdio"`

904 

905 The type of the object. Always `stdio`.

906 

907 - `"stdio"`

908 

909 - `type: "mcp"`

910 

911 The type of the object. Always `mcp`.

912 

913 - `"mcp"`

914 

915 - `WebSearch object { allowed_domains, context_size, location, 2 more }`

916 

917 Web search.

918 

919 - `allowed_domains: array of string or null`

920 

921 Allowed search domains, or `null` when the search is unrestricted.

922 

923 - `context_size: "low" or "medium" or "high"`

924 

925 The amount of search context made available to the model. Defaults to `medium`.

926 

927 - `"low"`

928 

929 - `"medium"`

930 

931 - `"high"`

932 

933 - `location: object { city, country, region, timezone } or null`

934 

935 Approximate user location used to localize web search results.

936 

937 - `city: string or null`

938 

939 The city name.

940 

941 - `country: string or null`

942 

943 The two-letter ISO country code, such as `US`.

944 

945 - `region: string or null`

946 

947 The region or state name.

948 

949 - `timezone: string or null`

950 

951 The IANA timezone, such as `America/Los_Angeles`.

952 

953 - `mode: "disabled" or "cached" or "live"`

954 

955 The source used for web search results.

956 

957 - `"disabled"`

958 

959 - `"cached"`

960 

961 - `"live"`

962 

963 - `type: "web_search"`

964 

965 The type of the object. Always `web_search`.

966 

967 - `"web_search"`

968 

969 - `created_at: number`

970 

971 The Unix timestamp, in seconds, when the session was created.

972 

973 - `environment: Environment`

974 

975 The execution environment for the session.

976 

977 - `None object { type }`

978 

979 The session talks to CCA without selecting or provisioning an execution environment.

980 

981 - `type: "none"`

982 

983 The type of the object. Always `none`.

984 

985 - `"none"`

986 

987 - `OpenAIHosted object { id, capability_directories, files, 5 more }`

988 

989 An environment hosted by OpenAI.

990 

991 - `id: string`

992 

993 The public ID of the environment.

994 

995 - `capability_directories: array of string`

996 

997 Directories that contain capabilities exposed to the agent.

998 

999 - `files: array of HostedEnvironmentFile`

1000 

1001 Files available in the environment, excluding their contents.

1002 

1003 - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

1004 

1005 A file copied from the OpenAI Files API.

1006 

1007 - `id: string`

1008 

1009 The session-scoped ID of the file in the execution environment.

1010 

1011 - `file_id: string`

1012 

1013 The ID of the uploaded file.

1014 

1015 - `path: string`

1016 

1017 The file's absolute path inside the environment.

1018 

1019 - `size_bytes: number`

1020 

1021 The decoded file size in bytes.

1022 

1023 - `type: "file_id"`

1024 

1025 The type of the object. Always `file_id`.

1026 

1027 - `"file_id"`

1028 

1029 - `Inline object { id, path, size_bytes, type }`

1030 

1031 A file supplied inline when the session was created.

1032 

1033 - `id: string`

1034 

1035 The session-scoped ID of the file in the execution environment.

1036 

1037 - `path: string`

1038 

1039 The file's absolute path inside the environment.

1040 

1041 - `size_bytes: number`

1042 

1043 The decoded file size in bytes.

1044 

1045 - `type: "inline"`

1046 

1047 The type of the object. Always `inline`.

1048 

1049 - `"inline"`

1050 

1051 - `network: object { access, allowed_domains }`

1052 

1053 The effective network access policy for the environment.

1054 

1055 - `access: "enabled" or "disabled" or "restricted"`

1056 

1057 The environment's network access mode.

1058 

1059 - `"enabled"`

1060 

1061 Allows unrestricted network access.

1062 

1063 - `"disabled"`

1064 

1065 Disables network access.

1066 

1067 - `"restricted"`

1068 

1069 Allows access only to configured domains.

1070 

1071 - `allowed_domains: array of string`

1072 

1073 Domains the environment may access when network access is restricted.

1074 

1075 - `packages: object { npm, python, system }`

1076 

1077 Packages installed in the environment.

1078 

1079 - `npm: array of string`

1080 

1081 npm packages installed globally in the environment.

1082 

1083 - `python: array of string`

1084 

1085 Python packages installed in the environment.

1086 

1087 - `system: array of string`

1088 

1089 System packages installed in the environment.

1090 

1091 - `plugins: array of HostedPlugin`

1092 

1093 Plugins installed in the environment, excluding their archive contents.

1094 

1095 - `description: string`

1096 

1097 The installed plugin description.

1098 

1099 - `name: string`

1100 

1101 The installed plugin name.

1102 

1103 - `type: "inline"`

1104 

1105 The type of the object. Always `inline`.

1106 

1107 - `"inline"`

1108 

1109 - `skills: array of HostedSkill`

1110 

1111 Skills installed in the environment, excluding their archive contents.

1112 

1113 - `HostedSkillReference object { description, name, skill_id, 2 more }`

1114 

1115 A skill installed from the Skills API.

1116 

1117 - `description: string`

1118 

1119 The installed skill description.

1120 

1121 - `name: string`

1122 

1123 The installed skill name.

1124 

1125 - `skill_id: string`

1126 

1127 The referenced skill ID.

1128 

1129 - `type: "skill_reference"`

1130 

1131 The type of the object. Always `skill_reference`.

1132 

1133 - `"skill_reference"`

1134 

1135 - `version: string`

1136 

1137 The concrete skill version installed for this session.

1138 

1139 - `Inline object { description, name, type }`

1140 

1141 A skill installed from an inline ZIP archive.

1142 

1143 - `description: string`

1144 

1145 The installed skill description.

1146 

1147 - `name: string`

1148 

1149 The installed skill name.

1150 

1151 - `type: "inline"`

1152 

1153 The type of the object. Always `inline`.

1154 

1155 - `"inline"`

1156 

1157 - `type: "openai_hosted"`

1158 

1159 The type of the object. Always `openai_hosted`.

1160 

1161 - `"openai_hosted"`

1162 

1163 - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

1164 

1165 An environment hosted by the application.

1166 

1167 - `id: string`

1168 

1169 The public ID of the environment.

1170 

1171 - `capability_directories: array of string`

1172 

1173 Directories that contain capabilities exposed to the agent.

1174 

1175 - `remote_url: string`

1176 

1177 Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

1178 

1179 - `type: "self_hosted"`

1180 

1181 The type of the object. Always `self_hosted`.

1182 

1183 - `"self_hosted"`

1184 

1185 - `workspace_directory: string`

1186 

1187 The absolute project directory inside the environment. Defaults to `/workspace`.

1188 

1189 - `error: string or null`

1190 

1191 The error that caused the session to fail, if any.

1192 

1193 - `last_active_at: number`

1194 

1195 The Unix timestamp, in seconds, when the session was last active.

1196 

1197 - `metadata: map[string]`

1198 

1199 Custom string key-value pairs attached to the session.

1200 

1201 - `object: "agent.session"`

1202 

1203 The object type. Always `agent.session`.

1204 

1205 - `"agent.session"`

1206 

1207 - `required_actions: array of object { arguments, call_id, name, 2 more } or object { environment_id, type }`

1208 

1209 Actions that must be completed before the session can continue.

1210 

1211 - `FunctionCall object { arguments, call_id, name, 2 more }`

1212 

1213 Run a function tool and submit its result.

1214 

1215 - `arguments: unknown`

1216 

1217 The arguments supplied by the model.

1218 

1219 - `call_id: string`

1220 

1221 The ID to include when submitting the function result.

1222 

1223 - `name: string`

1224 

1225 The function name.

1226 

1227 - `turn_id: string`

1228 

1229 The ID of the turn that requested the function call.

1230 

1231 - `type: "function_call"`

1232 

1233 The type of the object. Always `function_call`.

1234 

1235 - `"function_call"`

1236 

1237 - `EnvironmentConnection object { environment_id, type }`

1238 

1239 Reconnect a session environment.

1240 

1241 - `environment_id: string`

1242 

1243 The ID of the environment to reconnect.

1244 

1245 - `type: "environment_connection"`

1246 

1247 The type of the object. Always `environment_connection`.

1248 

1249 - `"environment_connection"`

1250 

1251 - `status: "idle" or "in_progress" or "requires_action" or "failed"`

1252 

1253 The current status of the session.

1254 

1255 - `"idle"`

1256 

1257 The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

1258 

1259 - `"in_progress"`

1260 

1261 The session is processing a turn.

1262 

1263 - `"requires_action"`

1264 

1265 The session is waiting for one or more required actions.

1266 

1267 - `"failed"`

1268 

1269 The session failed.

1270 

1271 - `usage: TokenUsage or null`

1272 

1273 Recorded token usage for a session or turn. Usage is best effort and may change.

1274 

1275 - `input_tokens: number`

1276 

1277 The number of input tokens used by the agent.

1278 

1279 - `input_tokens_details: object { cached_tokens }`

1280 

1281 A breakdown of the agent's input token usage.

1282 

1283 - `cached_tokens: number`

1284 

1285 The number of input tokens retrieved from the prompt cache.

1286 

1287 - `output_tokens: number`

1288 

1289 The number of output tokens generated by the agent.

1290 

1291 - `output_tokens_details: object { reasoning_tokens }`

1292 

1293 A breakdown of the agent's output token usage.

1294 

1295 - `reasoning_tokens: number`

1296 

1297 The number of output tokens used for reasoning.

1298 

1299 - `total_tokens: number`

1300 

1301 The total number of input and output tokens used by the agent.

1302 

1303 - `vault_ids: array of string`

1304 

1305 The IDs of vaults made available to the session.

1306 

1307### Example

1308 

1309```http

1310curl https://api.openai.com/v1/agents/sessions \

1311 -H 'Content-Type: application/json' \

1312 -H 'OpenAI-Beta: agents=v1' \

1313 -H "Authorization: Bearer $OPENAI_API_KEY" \

1314 -d '{

1315 "environment": {

1316 "type": "none"

1317 }

1318 }'

1319```

1320 

1321#### Response

1322 

1323```json

1324{

1325 "id": "id",

1326 "agent": {

1327 "id": "id",

1328 "instructions": "instructions",

1329 "model": "model",

1330 "multi_agent": {

1331 "enabled": true,

1332 "max_concurrent_subagents": 1

1333 },

1334 "name": "name",

1335 "reasoning": {

1336 "effort": "none",

1337 "summary": "concise"

1338 },

1339 "service_tier": "auto",

1340 "text": {

1341 "format": {

1342 "type": "text"

1343 },

1344 "verbosity": "low"

1345 },

1346 "tools": [

1347 {

1348 "defer_loading": true,

1349 "description": "description",

1350 "name": "name",

1351 "parameters": {

1352 "foo": "bar"

1353 },

1354 "type": "function"

1355 }

1356 ]

1357 },

1358 "created_at": 0,

1359 "environment": {

1360 "type": "none"

1361 },

1362 "error": "error",

1363 "last_active_at": 0,

1364 "metadata": {

1365 "foo": "string"

1366 },

1367 "object": "agent.session",

1368 "required_actions": [

1369 {

1370 "arguments": {},

1371 "call_id": "call_id",

1372 "name": "name",

1373 "turn_id": "turn_id",

1374 "type": "function_call"

1375 }

1376 ],

1377 "status": "idle",

1378 "usage": {

1379 "input_tokens": 0,

1380 "input_tokens_details": {

1381 "cached_tokens": 0

1382 },

1383 "output_tokens": 0,

1384 "output_tokens_details": {

1385 "reasoning_tokens": 0

1386 },

1387 "total_tokens": 0

1388 },

1389 "vault_ids": [

1390 "string"

1391 ]

1392}

1393```

Details

1## Delete an agent session

2 

3**delete** `/agents/sessions/{session_id}`

4 

5Removes a managed agent session from the public API and returns a deletion confirmation. Physical cleanup may continue asynchronously. See [managing sessions](/api/docs/guides/agents-api/sessions/manage).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11### Returns

12 

13- `AgentSessionDeleted object { id, deleted, object }`

14 

15 A Managed Agents session removed from the public API. Physical cleanup may continue asynchronously.

16 

17 - `id: string`

18 

19 The ID of the deleted session.

20 

21 - `deleted: boolean`

22 

23 Whether the session has been removed from the public API. Always `true`. Physical cleanup may still be in progress.

24 

25 - `object: "agent.session.deleted"`

26 

27 The object type. Always `agent.session.deleted`.

28 

29 - `"agent.session.deleted"`

30 

31### Example

32 

33```http

34curl https://api.openai.com/v1/agents/sessions/$SESSION_ID \

35 -X DELETE \

36 -H 'OpenAI-Beta: agents=v1' \

37 -H "Authorization: Bearer $OPENAI_API_KEY"

38```

39 

40#### Response

41 

42```json

43{

44 "id": "id",

45 "deleted": true,

46 "object": "agent.session.deleted"

47}

48```

Details

1## List agent sessions

2 

3**get** `/agents/sessions`

4 

5Lists managed agent sessions using ID-based pagination and the requested sort order. See [managing sessions](/api/docs/guides/agents-api/sessions/manage).

6 

7### Query Parameters

8 

9- `after: optional string`

10 

11 Return resources after this resource ID in the selected order.

12 

13- `agent_id: optional string`

14 

15 Only return sessions whose root agent has this ID. Omit to return sessions for all agents.

16 

17- `limit: optional number or null`

18 

19 The maximum number of resources to return.

20 

21- `order: optional "asc" or "desc"`

22 

23 Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`.

24 

25 - `"asc"`

26 

27 Returns resources in ascending order.

28 

29 - `"desc"`

30 

31 Returns resources in descending order.

32 

33### Returns

34 

35- `data: array of AgentSession`

36 

37 The resources returned in this page, in the requested sort order.

38 

39 - `id: string`

40 

41 The ID of the session.

42 

43 - `agent: object { id, instructions, model, 6 more }`

44 

45 The agent running in the session.

46 

47 - `id: string`

48 

49 The ID of the agent.

50 

51 - `instructions: string or null`

52 

53 Custom instructions appended to the agent's default base instructions.

54 

55 - `model: string`

56 

57 The model used by the agent.

58 

59 - `multi_agent: MultiAgentConfig`

60 

61 Configuration for creating and coordinating subagents.

62 

63 - `enabled: boolean`

64 

65 Whether subagent tools are enabled. Defaults to false.

66 

67 - `max_concurrent_subagents: number or null`

68 

69 Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

70 

71 - `name: string or null`

72 

73 The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

74 

75 - `reasoning: AgentReasoning`

76 

77 The agent's reasoning configuration.

78 

79 - `effort: "none" or "minimal" or "low" or 4 more or null`

80 

81 The amount of reasoning effort used by an agent.

82 

83 - `"none"`

84 

85 - `"minimal"`

86 

87 - `"low"`

88 

89 - `"medium"`

90 

91 - `"high"`

92 

93 - `"xhigh"`

94 

95 - `"max"`

96 

97 - `summary: "concise" or "detailed" or "auto" or null`

98 

99 The reasoning summary format requested from an agent.

100 

101 - `"concise"`

102 

103 Returns a concise reasoning summary when supported.

104 

105 - `"detailed"`

106 

107 Returns a detailed reasoning summary when supported.

108 

109 - `"auto"`

110 

111 Automatically selects the most detailed summary supported by the model.

112 

113 - `service_tier: "auto" or "default" or "flex" or 2 more`

114 

115 The effective service-tier policy for model requests. Defaults to `auto`.

116 

117 - `"auto"`

118 

119 - `"default"`

120 

121 - `"flex"`

122 

123 - `"priority"`

124 

125 - `"fast"`

126 

127 - `text: AgentText`

128 

129 Configuration for text generated by the agent.

130 

131 - `format: TextFormat`

132 

133 The effective output format. Defaults to ordinary text.

134 

135 - `Text object { type }`

136 

137 Generates ordinary text without a structured-output constraint.

138 

139 - `type: "text"`

140 

141 The type of the object. Always `text`.

142 

143 - `"text"`

144 

145 - `JSONSchema object { schema, type }`

146 

147 Constrains generated text to a JSON Schema.

148 

149 - `schema: map[unknown]`

150 

151 The JSON Schema that generated text must match.

152 

153 - `type: "json_schema"`

154 

155 The type of the object. Always `json_schema`.

156 

157 - `"json_schema"`

158 

159 - `verbosity: "low" or "medium" or "high"`

160 

161 The amount of text produced by the agent. Defaults to `medium`.

162 

163 - `"low"`

164 

165 - `"medium"`

166 

167 - `"high"`

168 

169 - `tools: array of AgentTool`

170 

171 Tools available to the agent.

172 

173 - `Function object { defer_loading, description, name, 2 more }`

174 

175 A function defined by the application.

176 

177 - `defer_loading: boolean`

178 

179 Whether the function is deferred and discovered through tool search.

180 

181 - `description: string`

182 

183 A description of what the function does.

184 

185 - `name: string`

186 

187 The name of the function.

188 

189 - `parameters: map[unknown]`

190 

191 A JSON Schema object describing the function's arguments.

192 

193 - `type: "function"`

194 

195 The type of the object. Always `function`.

196 

197 - `"function"`

198 

199 - `ProgrammaticToolCalling object { enabled, type }`

200 

201 Enables calling tools from model-generated code.

202 

203 - `enabled: boolean`

204 

205 Whether tools can be called from model-generated code.

206 

207 - `type: "programmatic_tool_calling"`

208 

209 The type of the object. Always `programmatic_tool_calling`.

210 

211 - `"programmatic_tool_calling"`

212 

213 - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

214 

215 Tools provided by a remote MCP server.

216 

217 - `allowed_tools: array of string or null`

218 

219 The MCP tools the agent may call.

220 

221 - `connection_origin: "service" or "environment"`

222 

223 Where outbound MCP HTTP connections originate.

224 

225 - `"service"`

226 

227 - `"environment"`

228 

229 - `credential_id: string or null`

230 

231 The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

232 

233 - `request_metadata: map[unknown]`

234 

235 Metadata included with requests to this MCP server.

236 

237 - `required: boolean`

238 

239 Whether this MCP server must initialize before the first turn.

240 

241 - `server_label: string`

242 

243 A label used to identify the MCP server in tool calls.

244 

245 - `transport: McpTransport`

246 

247 The transport used to connect to the MCP server.

248 

249 - `HTTP object { server_url, type }`

250 

251 Connects to an MCP server over HTTP.

252 

253 - `server_url: string`

254 

255 The URL of the MCP server.

256 

257 - `type: "http"`

258 

259 The type of the object. Always `http`.

260 

261 - `"http"`

262 

263 - `Stdio object { args, command, cwd, 2 more }`

264 

265 Starts an MCP server as a local process.

266 

267 - `args: array of string`

268 

269 Arguments passed to the MCP server command.

270 

271 - `command: string`

272 

273 The command used to start the MCP server.

274 

275 - `cwd: string`

276 

277 The working directory used to start the MCP server.

278 

279 - `env_vars: array of string`

280 

281 Environment variable names inherited from the execution environment.

282 

283 - `type: "stdio"`

284 

285 The type of the object. Always `stdio`.

286 

287 - `"stdio"`

288 

289 - `type: "mcp"`

290 

291 The type of the object. Always `mcp`.

292 

293 - `"mcp"`

294 

295 - `WebSearch object { allowed_domains, context_size, location, 2 more }`

296 

297 Web search.

298 

299 - `allowed_domains: array of string or null`

300 

301 Allowed search domains, or `null` when the search is unrestricted.

302 

303 - `context_size: "low" or "medium" or "high"`

304 

305 The amount of search context made available to the model. Defaults to `medium`.

306 

307 - `"low"`

308 

309 - `"medium"`

310 

311 - `"high"`

312 

313 - `location: object { city, country, region, timezone } or null`

314 

315 Approximate user location used to localize web search results.

316 

317 - `city: string or null`

318 

319 The city name.

320 

321 - `country: string or null`

322 

323 The two-letter ISO country code, such as `US`.

324 

325 - `region: string or null`

326 

327 The region or state name.

328 

329 - `timezone: string or null`

330 

331 The IANA timezone, such as `America/Los_Angeles`.

332 

333 - `mode: "disabled" or "cached" or "live"`

334 

335 The source used for web search results.

336 

337 - `"disabled"`

338 

339 - `"cached"`

340 

341 - `"live"`

342 

343 - `type: "web_search"`

344 

345 The type of the object. Always `web_search`.

346 

347 - `"web_search"`

348 

349 - `created_at: number`

350 

351 The Unix timestamp, in seconds, when the session was created.

352 

353 - `environment: Environment`

354 

355 The execution environment for the session.

356 

357 - `None object { type }`

358 

359 The session talks to CCA without selecting or provisioning an execution environment.

360 

361 - `type: "none"`

362 

363 The type of the object. Always `none`.

364 

365 - `"none"`

366 

367 - `OpenAIHosted object { id, capability_directories, files, 5 more }`

368 

369 An environment hosted by OpenAI.

370 

371 - `id: string`

372 

373 The public ID of the environment.

374 

375 - `capability_directories: array of string`

376 

377 Directories that contain capabilities exposed to the agent.

378 

379 - `files: array of HostedEnvironmentFile`

380 

381 Files available in the environment, excluding their contents.

382 

383 - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

384 

385 A file copied from the OpenAI Files API.

386 

387 - `id: string`

388 

389 The session-scoped ID of the file in the execution environment.

390 

391 - `file_id: string`

392 

393 The ID of the uploaded file.

394 

395 - `path: string`

396 

397 The file's absolute path inside the environment.

398 

399 - `size_bytes: number`

400 

401 The decoded file size in bytes.

402 

403 - `type: "file_id"`

404 

405 The type of the object. Always `file_id`.

406 

407 - `"file_id"`

408 

409 - `Inline object { id, path, size_bytes, type }`

410 

411 A file supplied inline when the session was created.

412 

413 - `id: string`

414 

415 The session-scoped ID of the file in the execution environment.

416 

417 - `path: string`

418 

419 The file's absolute path inside the environment.

420 

421 - `size_bytes: number`

422 

423 The decoded file size in bytes.

424 

425 - `type: "inline"`

426 

427 The type of the object. Always `inline`.

428 

429 - `"inline"`

430 

431 - `network: object { access, allowed_domains }`

432 

433 The effective network access policy for the environment.

434 

435 - `access: "enabled" or "disabled" or "restricted"`

436 

437 The environment's network access mode.

438 

439 - `"enabled"`

440 

441 Allows unrestricted network access.

442 

443 - `"disabled"`

444 

445 Disables network access.

446 

447 - `"restricted"`

448 

449 Allows access only to configured domains.

450 

451 - `allowed_domains: array of string`

452 

453 Domains the environment may access when network access is restricted.

454 

455 - `packages: object { npm, python, system }`

456 

457 Packages installed in the environment.

458 

459 - `npm: array of string`

460 

461 npm packages installed globally in the environment.

462 

463 - `python: array of string`

464 

465 Python packages installed in the environment.

466 

467 - `system: array of string`

468 

469 System packages installed in the environment.

470 

471 - `plugins: array of HostedPlugin`

472 

473 Plugins installed in the environment, excluding their archive contents.

474 

475 - `description: string`

476 

477 The installed plugin description.

478 

479 - `name: string`

480 

481 The installed plugin name.

482 

483 - `type: "inline"`

484 

485 The type of the object. Always `inline`.

486 

487 - `"inline"`

488 

489 - `skills: array of HostedSkill`

490 

491 Skills installed in the environment, excluding their archive contents.

492 

493 - `HostedSkillReference object { description, name, skill_id, 2 more }`

494 

495 A skill installed from the Skills API.

496 

497 - `description: string`

498 

499 The installed skill description.

500 

501 - `name: string`

502 

503 The installed skill name.

504 

505 - `skill_id: string`

506 

507 The referenced skill ID.

508 

509 - `type: "skill_reference"`

510 

511 The type of the object. Always `skill_reference`.

512 

513 - `"skill_reference"`

514 

515 - `version: string`

516 

517 The concrete skill version installed for this session.

518 

519 - `Inline object { description, name, type }`

520 

521 A skill installed from an inline ZIP archive.

522 

523 - `description: string`

524 

525 The installed skill description.

526 

527 - `name: string`

528 

529 The installed skill name.

530 

531 - `type: "inline"`

532 

533 The type of the object. Always `inline`.

534 

535 - `"inline"`

536 

537 - `type: "openai_hosted"`

538 

539 The type of the object. Always `openai_hosted`.

540 

541 - `"openai_hosted"`

542 

543 - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

544 

545 An environment hosted by the application.

546 

547 - `id: string`

548 

549 The public ID of the environment.

550 

551 - `capability_directories: array of string`

552 

553 Directories that contain capabilities exposed to the agent.

554 

555 - `remote_url: string`

556 

557 Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

558 

559 - `type: "self_hosted"`

560 

561 The type of the object. Always `self_hosted`.

562 

563 - `"self_hosted"`

564 

565 - `workspace_directory: string`

566 

567 The absolute project directory inside the environment. Defaults to `/workspace`.

568 

569 - `error: string or null`

570 

571 The error that caused the session to fail, if any.

572 

573 - `last_active_at: number`

574 

575 The Unix timestamp, in seconds, when the session was last active.

576 

577 - `metadata: map[string]`

578 

579 Custom string key-value pairs attached to the session.

580 

581 - `object: "agent.session"`

582 

583 The object type. Always `agent.session`.

584 

585 - `"agent.session"`

586 

587 - `required_actions: array of object { arguments, call_id, name, 2 more } or object { environment_id, type }`

588 

589 Actions that must be completed before the session can continue.

590 

591 - `FunctionCall object { arguments, call_id, name, 2 more }`

592 

593 Run a function tool and submit its result.

594 

595 - `arguments: unknown`

596 

597 The arguments supplied by the model.

598 

599 - `call_id: string`

600 

601 The ID to include when submitting the function result.

602 

603 - `name: string`

604 

605 The function name.

606 

607 - `turn_id: string`

608 

609 The ID of the turn that requested the function call.

610 

611 - `type: "function_call"`

612 

613 The type of the object. Always `function_call`.

614 

615 - `"function_call"`

616 

617 - `EnvironmentConnection object { environment_id, type }`

618 

619 Reconnect a session environment.

620 

621 - `environment_id: string`

622 

623 The ID of the environment to reconnect.

624 

625 - `type: "environment_connection"`

626 

627 The type of the object. Always `environment_connection`.

628 

629 - `"environment_connection"`

630 

631 - `status: "idle" or "in_progress" or "requires_action" or "failed"`

632 

633 The current status of the session.

634 

635 - `"idle"`

636 

637 The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

638 

639 - `"in_progress"`

640 

641 The session is processing a turn.

642 

643 - `"requires_action"`

644 

645 The session is waiting for one or more required actions.

646 

647 - `"failed"`

648 

649 The session failed.

650 

651 - `usage: TokenUsage or null`

652 

653 Recorded token usage for a session or turn. Usage is best effort and may change.

654 

655 - `input_tokens: number`

656 

657 The number of input tokens used by the agent.

658 

659 - `input_tokens_details: object { cached_tokens }`

660 

661 A breakdown of the agent's input token usage.

662 

663 - `cached_tokens: number`

664 

665 The number of input tokens retrieved from the prompt cache.

666 

667 - `output_tokens: number`

668 

669 The number of output tokens generated by the agent.

670 

671 - `output_tokens_details: object { reasoning_tokens }`

672 

673 A breakdown of the agent's output token usage.

674 

675 - `reasoning_tokens: number`

676 

677 The number of output tokens used for reasoning.

678 

679 - `total_tokens: number`

680 

681 The total number of input and output tokens used by the agent.

682 

683 - `vault_ids: array of string`

684 

685 The IDs of vaults made available to the session.

686 

687- `first_id: string or null`

688 

689 The ID of the first resource in `data`, or `null` if the page is empty.

690 

691- `has_more: boolean`

692 

693 Whether there are more resources to retrieve after this page.

694 

695- `last_id: string or null`

696 

697 The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

698 

699- `object: "list"`

700 

701 The object type, which is always `list`.

702 

703 - `"list"`

704 

705### Example

706 

707```http

708curl https://api.openai.com/v1/agents/sessions \

709 -H 'OpenAI-Beta: agents=v1' \

710 -H "Authorization: Bearer $OPENAI_API_KEY"

711```

712 

713#### Response

714 

715```json

716{

717 "data": [

718 {

719 "id": "id",

720 "agent": {

721 "id": "id",

722 "instructions": "instructions",

723 "model": "model",

724 "multi_agent": {

725 "enabled": true,

726 "max_concurrent_subagents": 1

727 },

728 "name": "name",

729 "reasoning": {

730 "effort": "none",

731 "summary": "concise"

732 },

733 "service_tier": "auto",

734 "text": {

735 "format": {

736 "type": "text"

737 },

738 "verbosity": "low"

739 },

740 "tools": [

741 {

742 "defer_loading": true,

743 "description": "description",

744 "name": "name",

745 "parameters": {

746 "foo": "bar"

747 },

748 "type": "function"

749 }

750 ]

751 },

752 "created_at": 0,

753 "environment": {

754 "type": "none"

755 },

756 "error": "error",

757 "last_active_at": 0,

758 "metadata": {

759 "foo": "string"

760 },

761 "object": "agent.session",

762 "required_actions": [

763 {

764 "arguments": {},

765 "call_id": "call_id",

766 "name": "name",

767 "turn_id": "turn_id",

768 "type": "function_call"

769 }

770 ],

771 "status": "idle",

772 "usage": {

773 "input_tokens": 0,

774 "input_tokens_details": {

775 "cached_tokens": 0

776 },

777 "output_tokens": 0,

778 "output_tokens_details": {

779 "reasoning_tokens": 0

780 },

781 "total_tokens": 0

782 },

783 "vault_ids": [

784 "string"

785 ]

786 }

787 ],

788 "first_id": "first_id",

789 "has_more": true,

790 "last_id": "last_id",

791 "object": "list"

792}

793```

Details

1## Retrieve an agent session

2 

3**get** `/agents/sessions/{session_id}`

4 

5Retrieves the current state of a managed agent session. See [managing sessions](/api/docs/guides/agents-api/sessions/manage).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11### Returns

12 

13- `AgentSession object { id, agent, created_at, 9 more }`

14 

15 A Managed Agents session.

16 

17 - `id: string`

18 

19 The ID of the session.

20 

21 - `agent: object { id, instructions, model, 6 more }`

22 

23 The agent running in the session.

24 

25 - `id: string`

26 

27 The ID of the agent.

28 

29 - `instructions: string or null`

30 

31 Custom instructions appended to the agent's default base instructions.

32 

33 - `model: string`

34 

35 The model used by the agent.

36 

37 - `multi_agent: MultiAgentConfig`

38 

39 Configuration for creating and coordinating subagents.

40 

41 - `enabled: boolean`

42 

43 Whether subagent tools are enabled. Defaults to false.

44 

45 - `max_concurrent_subagents: number or null`

46 

47 Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

48 

49 - `name: string or null`

50 

51 The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

52 

53 - `reasoning: AgentReasoning`

54 

55 The agent's reasoning configuration.

56 

57 - `effort: "none" or "minimal" or "low" or 4 more or null`

58 

59 The amount of reasoning effort used by an agent.

60 

61 - `"none"`

62 

63 - `"minimal"`

64 

65 - `"low"`

66 

67 - `"medium"`

68 

69 - `"high"`

70 

71 - `"xhigh"`

72 

73 - `"max"`

74 

75 - `summary: "concise" or "detailed" or "auto" or null`

76 

77 The reasoning summary format requested from an agent.

78 

79 - `"concise"`

80 

81 Returns a concise reasoning summary when supported.

82 

83 - `"detailed"`

84 

85 Returns a detailed reasoning summary when supported.

86 

87 - `"auto"`

88 

89 Automatically selects the most detailed summary supported by the model.

90 

91 - `service_tier: "auto" or "default" or "flex" or 2 more`

92 

93 The effective service-tier policy for model requests. Defaults to `auto`.

94 

95 - `"auto"`

96 

97 - `"default"`

98 

99 - `"flex"`

100 

101 - `"priority"`

102 

103 - `"fast"`

104 

105 - `text: AgentText`

106 

107 Configuration for text generated by the agent.

108 

109 - `format: TextFormat`

110 

111 The effective output format. Defaults to ordinary text.

112 

113 - `Text object { type }`

114 

115 Generates ordinary text without a structured-output constraint.

116 

117 - `type: "text"`

118 

119 The type of the object. Always `text`.

120 

121 - `"text"`

122 

123 - `JSONSchema object { schema, type }`

124 

125 Constrains generated text to a JSON Schema.

126 

127 - `schema: map[unknown]`

128 

129 The JSON Schema that generated text must match.

130 

131 - `type: "json_schema"`

132 

133 The type of the object. Always `json_schema`.

134 

135 - `"json_schema"`

136 

137 - `verbosity: "low" or "medium" or "high"`

138 

139 The amount of text produced by the agent. Defaults to `medium`.

140 

141 - `"low"`

142 

143 - `"medium"`

144 

145 - `"high"`

146 

147 - `tools: array of AgentTool`

148 

149 Tools available to the agent.

150 

151 - `Function object { defer_loading, description, name, 2 more }`

152 

153 A function defined by the application.

154 

155 - `defer_loading: boolean`

156 

157 Whether the function is deferred and discovered through tool search.

158 

159 - `description: string`

160 

161 A description of what the function does.

162 

163 - `name: string`

164 

165 The name of the function.

166 

167 - `parameters: map[unknown]`

168 

169 A JSON Schema object describing the function's arguments.

170 

171 - `type: "function"`

172 

173 The type of the object. Always `function`.

174 

175 - `"function"`

176 

177 - `ProgrammaticToolCalling object { enabled, type }`

178 

179 Enables calling tools from model-generated code.

180 

181 - `enabled: boolean`

182 

183 Whether tools can be called from model-generated code.

184 

185 - `type: "programmatic_tool_calling"`

186 

187 The type of the object. Always `programmatic_tool_calling`.

188 

189 - `"programmatic_tool_calling"`

190 

191 - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

192 

193 Tools provided by a remote MCP server.

194 

195 - `allowed_tools: array of string or null`

196 

197 The MCP tools the agent may call.

198 

199 - `connection_origin: "service" or "environment"`

200 

201 Where outbound MCP HTTP connections originate.

202 

203 - `"service"`

204 

205 - `"environment"`

206 

207 - `credential_id: string or null`

208 

209 The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

210 

211 - `request_metadata: map[unknown]`

212 

213 Metadata included with requests to this MCP server.

214 

215 - `required: boolean`

216 

217 Whether this MCP server must initialize before the first turn.

218 

219 - `server_label: string`

220 

221 A label used to identify the MCP server in tool calls.

222 

223 - `transport: McpTransport`

224 

225 The transport used to connect to the MCP server.

226 

227 - `HTTP object { server_url, type }`

228 

229 Connects to an MCP server over HTTP.

230 

231 - `server_url: string`

232 

233 The URL of the MCP server.

234 

235 - `type: "http"`

236 

237 The type of the object. Always `http`.

238 

239 - `"http"`

240 

241 - `Stdio object { args, command, cwd, 2 more }`

242 

243 Starts an MCP server as a local process.

244 

245 - `args: array of string`

246 

247 Arguments passed to the MCP server command.

248 

249 - `command: string`

250 

251 The command used to start the MCP server.

252 

253 - `cwd: string`

254 

255 The working directory used to start the MCP server.

256 

257 - `env_vars: array of string`

258 

259 Environment variable names inherited from the execution environment.

260 

261 - `type: "stdio"`

262 

263 The type of the object. Always `stdio`.

264 

265 - `"stdio"`

266 

267 - `type: "mcp"`

268 

269 The type of the object. Always `mcp`.

270 

271 - `"mcp"`

272 

273 - `WebSearch object { allowed_domains, context_size, location, 2 more }`

274 

275 Web search.

276 

277 - `allowed_domains: array of string or null`

278 

279 Allowed search domains, or `null` when the search is unrestricted.

280 

281 - `context_size: "low" or "medium" or "high"`

282 

283 The amount of search context made available to the model. Defaults to `medium`.

284 

285 - `"low"`

286 

287 - `"medium"`

288 

289 - `"high"`

290 

291 - `location: object { city, country, region, timezone } or null`

292 

293 Approximate user location used to localize web search results.

294 

295 - `city: string or null`

296 

297 The city name.

298 

299 - `country: string or null`

300 

301 The two-letter ISO country code, such as `US`.

302 

303 - `region: string or null`

304 

305 The region or state name.

306 

307 - `timezone: string or null`

308 

309 The IANA timezone, such as `America/Los_Angeles`.

310 

311 - `mode: "disabled" or "cached" or "live"`

312 

313 The source used for web search results.

314 

315 - `"disabled"`

316 

317 - `"cached"`

318 

319 - `"live"`

320 

321 - `type: "web_search"`

322 

323 The type of the object. Always `web_search`.

324 

325 - `"web_search"`

326 

327 - `created_at: number`

328 

329 The Unix timestamp, in seconds, when the session was created.

330 

331 - `environment: Environment`

332 

333 The execution environment for the session.

334 

335 - `None object { type }`

336 

337 The session talks to CCA without selecting or provisioning an execution environment.

338 

339 - `type: "none"`

340 

341 The type of the object. Always `none`.

342 

343 - `"none"`

344 

345 - `OpenAIHosted object { id, capability_directories, files, 5 more }`

346 

347 An environment hosted by OpenAI.

348 

349 - `id: string`

350 

351 The public ID of the environment.

352 

353 - `capability_directories: array of string`

354 

355 Directories that contain capabilities exposed to the agent.

356 

357 - `files: array of HostedEnvironmentFile`

358 

359 Files available in the environment, excluding their contents.

360 

361 - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

362 

363 A file copied from the OpenAI Files API.

364 

365 - `id: string`

366 

367 The session-scoped ID of the file in the execution environment.

368 

369 - `file_id: string`

370 

371 The ID of the uploaded file.

372 

373 - `path: string`

374 

375 The file's absolute path inside the environment.

376 

377 - `size_bytes: number`

378 

379 The decoded file size in bytes.

380 

381 - `type: "file_id"`

382 

383 The type of the object. Always `file_id`.

384 

385 - `"file_id"`

386 

387 - `Inline object { id, path, size_bytes, type }`

388 

389 A file supplied inline when the session was created.

390 

391 - `id: string`

392 

393 The session-scoped ID of the file in the execution environment.

394 

395 - `path: string`

396 

397 The file's absolute path inside the environment.

398 

399 - `size_bytes: number`

400 

401 The decoded file size in bytes.

402 

403 - `type: "inline"`

404 

405 The type of the object. Always `inline`.

406 

407 - `"inline"`

408 

409 - `network: object { access, allowed_domains }`

410 

411 The effective network access policy for the environment.

412 

413 - `access: "enabled" or "disabled" or "restricted"`

414 

415 The environment's network access mode.

416 

417 - `"enabled"`

418 

419 Allows unrestricted network access.

420 

421 - `"disabled"`

422 

423 Disables network access.

424 

425 - `"restricted"`

426 

427 Allows access only to configured domains.

428 

429 - `allowed_domains: array of string`

430 

431 Domains the environment may access when network access is restricted.

432 

433 - `packages: object { npm, python, system }`

434 

435 Packages installed in the environment.

436 

437 - `npm: array of string`

438 

439 npm packages installed globally in the environment.

440 

441 - `python: array of string`

442 

443 Python packages installed in the environment.

444 

445 - `system: array of string`

446 

447 System packages installed in the environment.

448 

449 - `plugins: array of HostedPlugin`

450 

451 Plugins installed in the environment, excluding their archive contents.

452 

453 - `description: string`

454 

455 The installed plugin description.

456 

457 - `name: string`

458 

459 The installed plugin name.

460 

461 - `type: "inline"`

462 

463 The type of the object. Always `inline`.

464 

465 - `"inline"`

466 

467 - `skills: array of HostedSkill`

468 

469 Skills installed in the environment, excluding their archive contents.

470 

471 - `HostedSkillReference object { description, name, skill_id, 2 more }`

472 

473 A skill installed from the Skills API.

474 

475 - `description: string`

476 

477 The installed skill description.

478 

479 - `name: string`

480 

481 The installed skill name.

482 

483 - `skill_id: string`

484 

485 The referenced skill ID.

486 

487 - `type: "skill_reference"`

488 

489 The type of the object. Always `skill_reference`.

490 

491 - `"skill_reference"`

492 

493 - `version: string`

494 

495 The concrete skill version installed for this session.

496 

497 - `Inline object { description, name, type }`

498 

499 A skill installed from an inline ZIP archive.

500 

501 - `description: string`

502 

503 The installed skill description.

504 

505 - `name: string`

506 

507 The installed skill name.

508 

509 - `type: "inline"`

510 

511 The type of the object. Always `inline`.

512 

513 - `"inline"`

514 

515 - `type: "openai_hosted"`

516 

517 The type of the object. Always `openai_hosted`.

518 

519 - `"openai_hosted"`

520 

521 - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

522 

523 An environment hosted by the application.

524 

525 - `id: string`

526 

527 The public ID of the environment.

528 

529 - `capability_directories: array of string`

530 

531 Directories that contain capabilities exposed to the agent.

532 

533 - `remote_url: string`

534 

535 Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

536 

537 - `type: "self_hosted"`

538 

539 The type of the object. Always `self_hosted`.

540 

541 - `"self_hosted"`

542 

543 - `workspace_directory: string`

544 

545 The absolute project directory inside the environment. Defaults to `/workspace`.

546 

547 - `error: string or null`

548 

549 The error that caused the session to fail, if any.

550 

551 - `last_active_at: number`

552 

553 The Unix timestamp, in seconds, when the session was last active.

554 

555 - `metadata: map[string]`

556 

557 Custom string key-value pairs attached to the session.

558 

559 - `object: "agent.session"`

560 

561 The object type. Always `agent.session`.

562 

563 - `"agent.session"`

564 

565 - `required_actions: array of object { arguments, call_id, name, 2 more } or object { environment_id, type }`

566 

567 Actions that must be completed before the session can continue.

568 

569 - `FunctionCall object { arguments, call_id, name, 2 more }`

570 

571 Run a function tool and submit its result.

572 

573 - `arguments: unknown`

574 

575 The arguments supplied by the model.

576 

577 - `call_id: string`

578 

579 The ID to include when submitting the function result.

580 

581 - `name: string`

582 

583 The function name.

584 

585 - `turn_id: string`

586 

587 The ID of the turn that requested the function call.

588 

589 - `type: "function_call"`

590 

591 The type of the object. Always `function_call`.

592 

593 - `"function_call"`

594 

595 - `EnvironmentConnection object { environment_id, type }`

596 

597 Reconnect a session environment.

598 

599 - `environment_id: string`

600 

601 The ID of the environment to reconnect.

602 

603 - `type: "environment_connection"`

604 

605 The type of the object. Always `environment_connection`.

606 

607 - `"environment_connection"`

608 

609 - `status: "idle" or "in_progress" or "requires_action" or "failed"`

610 

611 The current status of the session.

612 

613 - `"idle"`

614 

615 The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

616 

617 - `"in_progress"`

618 

619 The session is processing a turn.

620 

621 - `"requires_action"`

622 

623 The session is waiting for one or more required actions.

624 

625 - `"failed"`

626 

627 The session failed.

628 

629 - `usage: TokenUsage or null`

630 

631 Recorded token usage for a session or turn. Usage is best effort and may change.

632 

633 - `input_tokens: number`

634 

635 The number of input tokens used by the agent.

636 

637 - `input_tokens_details: object { cached_tokens }`

638 

639 A breakdown of the agent's input token usage.

640 

641 - `cached_tokens: number`

642 

643 The number of input tokens retrieved from the prompt cache.

644 

645 - `output_tokens: number`

646 

647 The number of output tokens generated by the agent.

648 

649 - `output_tokens_details: object { reasoning_tokens }`

650 

651 A breakdown of the agent's output token usage.

652 

653 - `reasoning_tokens: number`

654 

655 The number of output tokens used for reasoning.

656 

657 - `total_tokens: number`

658 

659 The total number of input and output tokens used by the agent.

660 

661 - `vault_ids: array of string`

662 

663 The IDs of vaults made available to the session.

664 

665### Example

666 

667```http

668curl https://api.openai.com/v1/agents/sessions/$SESSION_ID \

669 -H 'OpenAI-Beta: agents=v1' \

670 -H "Authorization: Bearer $OPENAI_API_KEY"

671```

672 

673#### Response

674 

675```json

676{

677 "id": "id",

678 "agent": {

679 "id": "id",

680 "instructions": "instructions",

681 "model": "model",

682 "multi_agent": {

683 "enabled": true,

684 "max_concurrent_subagents": 1

685 },

686 "name": "name",

687 "reasoning": {

688 "effort": "none",

689 "summary": "concise"

690 },

691 "service_tier": "auto",

692 "text": {

693 "format": {

694 "type": "text"

695 },

696 "verbosity": "low"

697 },

698 "tools": [

699 {

700 "defer_loading": true,

701 "description": "description",

702 "name": "name",

703 "parameters": {

704 "foo": "bar"

705 },

706 "type": "function"

707 }

708 ]

709 },

710 "created_at": 0,

711 "environment": {

712 "type": "none"

713 },

714 "error": "error",

715 "last_active_at": 0,

716 "metadata": {

717 "foo": "string"

718 },

719 "object": "agent.session",

720 "required_actions": [

721 {

722 "arguments": {},

723 "call_id": "call_id",

724 "name": "name",

725 "turn_id": "turn_id",

726 "type": "function_call"

727 }

728 ],

729 "status": "idle",

730 "usage": {

731 "input_tokens": 0,

732 "input_tokens_details": {

733 "cached_tokens": 0

734 },

735 "output_tokens": 0,

736 "output_tokens_details": {

737 "reasoning_tokens": 0

738 },

739 "total_tokens": 0

740 },

741 "vault_ids": [

742 "string"

743 ]

744}

745```

Details

1## Update an agent session

2 

3**post** `/agents/sessions/{session_id}`

4 

5Updates session metadata. Omitted fields are unchanged. See [managing sessions](/api/docs/guides/agents-api/sessions/manage).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11### Body Parameters

12 

13- `metadata: optional map[string] or null`

14 

15 Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters.

16 

17### Returns

18 

19- `AgentSession object { id, agent, created_at, 9 more }`

20 

21 A Managed Agents session.

22 

23 - `id: string`

24 

25 The ID of the session.

26 

27 - `agent: object { id, instructions, model, 6 more }`

28 

29 The agent running in the session.

30 

31 - `id: string`

32 

33 The ID of the agent.

34 

35 - `instructions: string or null`

36 

37 Custom instructions appended to the agent's default base instructions.

38 

39 - `model: string`

40 

41 The model used by the agent.

42 

43 - `multi_agent: MultiAgentConfig`

44 

45 Configuration for creating and coordinating subagents.

46 

47 - `enabled: boolean`

48 

49 Whether subagent tools are enabled. Defaults to false.

50 

51 - `max_concurrent_subagents: number or null`

52 

53 Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

54 

55 - `name: string or null`

56 

57 The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

58 

59 - `reasoning: AgentReasoning`

60 

61 The agent's reasoning configuration.

62 

63 - `effort: "none" or "minimal" or "low" or 4 more or null`

64 

65 The amount of reasoning effort used by an agent.

66 

67 - `"none"`

68 

69 - `"minimal"`

70 

71 - `"low"`

72 

73 - `"medium"`

74 

75 - `"high"`

76 

77 - `"xhigh"`

78 

79 - `"max"`

80 

81 - `summary: "concise" or "detailed" or "auto" or null`

82 

83 The reasoning summary format requested from an agent.

84 

85 - `"concise"`

86 

87 Returns a concise reasoning summary when supported.

88 

89 - `"detailed"`

90 

91 Returns a detailed reasoning summary when supported.

92 

93 - `"auto"`

94 

95 Automatically selects the most detailed summary supported by the model.

96 

97 - `service_tier: "auto" or "default" or "flex" or 2 more`

98 

99 The effective service-tier policy for model requests. Defaults to `auto`.

100 

101 - `"auto"`

102 

103 - `"default"`

104 

105 - `"flex"`

106 

107 - `"priority"`

108 

109 - `"fast"`

110 

111 - `text: AgentText`

112 

113 Configuration for text generated by the agent.

114 

115 - `format: TextFormat`

116 

117 The effective output format. Defaults to ordinary text.

118 

119 - `Text object { type }`

120 

121 Generates ordinary text without a structured-output constraint.

122 

123 - `type: "text"`

124 

125 The type of the object. Always `text`.

126 

127 - `"text"`

128 

129 - `JSONSchema object { schema, type }`

130 

131 Constrains generated text to a JSON Schema.

132 

133 - `schema: map[unknown]`

134 

135 The JSON Schema that generated text must match.

136 

137 - `type: "json_schema"`

138 

139 The type of the object. Always `json_schema`.

140 

141 - `"json_schema"`

142 

143 - `verbosity: "low" or "medium" or "high"`

144 

145 The amount of text produced by the agent. Defaults to `medium`.

146 

147 - `"low"`

148 

149 - `"medium"`

150 

151 - `"high"`

152 

153 - `tools: array of AgentTool`

154 

155 Tools available to the agent.

156 

157 - `Function object { defer_loading, description, name, 2 more }`

158 

159 A function defined by the application.

160 

161 - `defer_loading: boolean`

162 

163 Whether the function is deferred and discovered through tool search.

164 

165 - `description: string`

166 

167 A description of what the function does.

168 

169 - `name: string`

170 

171 The name of the function.

172 

173 - `parameters: map[unknown]`

174 

175 A JSON Schema object describing the function's arguments.

176 

177 - `type: "function"`

178 

179 The type of the object. Always `function`.

180 

181 - `"function"`

182 

183 - `ProgrammaticToolCalling object { enabled, type }`

184 

185 Enables calling tools from model-generated code.

186 

187 - `enabled: boolean`

188 

189 Whether tools can be called from model-generated code.

190 

191 - `type: "programmatic_tool_calling"`

192 

193 The type of the object. Always `programmatic_tool_calling`.

194 

195 - `"programmatic_tool_calling"`

196 

197 - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

198 

199 Tools provided by a remote MCP server.

200 

201 - `allowed_tools: array of string or null`

202 

203 The MCP tools the agent may call.

204 

205 - `connection_origin: "service" or "environment"`

206 

207 Where outbound MCP HTTP connections originate.

208 

209 - `"service"`

210 

211 - `"environment"`

212 

213 - `credential_id: string or null`

214 

215 The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

216 

217 - `request_metadata: map[unknown]`

218 

219 Metadata included with requests to this MCP server.

220 

221 - `required: boolean`

222 

223 Whether this MCP server must initialize before the first turn.

224 

225 - `server_label: string`

226 

227 A label used to identify the MCP server in tool calls.

228 

229 - `transport: McpTransport`

230 

231 The transport used to connect to the MCP server.

232 

233 - `HTTP object { server_url, type }`

234 

235 Connects to an MCP server over HTTP.

236 

237 - `server_url: string`

238 

239 The URL of the MCP server.

240 

241 - `type: "http"`

242 

243 The type of the object. Always `http`.

244 

245 - `"http"`

246 

247 - `Stdio object { args, command, cwd, 2 more }`

248 

249 Starts an MCP server as a local process.

250 

251 - `args: array of string`

252 

253 Arguments passed to the MCP server command.

254 

255 - `command: string`

256 

257 The command used to start the MCP server.

258 

259 - `cwd: string`

260 

261 The working directory used to start the MCP server.

262 

263 - `env_vars: array of string`

264 

265 Environment variable names inherited from the execution environment.

266 

267 - `type: "stdio"`

268 

269 The type of the object. Always `stdio`.

270 

271 - `"stdio"`

272 

273 - `type: "mcp"`

274 

275 The type of the object. Always `mcp`.

276 

277 - `"mcp"`

278 

279 - `WebSearch object { allowed_domains, context_size, location, 2 more }`

280 

281 Web search.

282 

283 - `allowed_domains: array of string or null`

284 

285 Allowed search domains, or `null` when the search is unrestricted.

286 

287 - `context_size: "low" or "medium" or "high"`

288 

289 The amount of search context made available to the model. Defaults to `medium`.

290 

291 - `"low"`

292 

293 - `"medium"`

294 

295 - `"high"`

296 

297 - `location: object { city, country, region, timezone } or null`

298 

299 Approximate user location used to localize web search results.

300 

301 - `city: string or null`

302 

303 The city name.

304 

305 - `country: string or null`

306 

307 The two-letter ISO country code, such as `US`.

308 

309 - `region: string or null`

310 

311 The region or state name.

312 

313 - `timezone: string or null`

314 

315 The IANA timezone, such as `America/Los_Angeles`.

316 

317 - `mode: "disabled" or "cached" or "live"`

318 

319 The source used for web search results.

320 

321 - `"disabled"`

322 

323 - `"cached"`

324 

325 - `"live"`

326 

327 - `type: "web_search"`

328 

329 The type of the object. Always `web_search`.

330 

331 - `"web_search"`

332 

333 - `created_at: number`

334 

335 The Unix timestamp, in seconds, when the session was created.

336 

337 - `environment: Environment`

338 

339 The execution environment for the session.

340 

341 - `None object { type }`

342 

343 The session talks to CCA without selecting or provisioning an execution environment.

344 

345 - `type: "none"`

346 

347 The type of the object. Always `none`.

348 

349 - `"none"`

350 

351 - `OpenAIHosted object { id, capability_directories, files, 5 more }`

352 

353 An environment hosted by OpenAI.

354 

355 - `id: string`

356 

357 The public ID of the environment.

358 

359 - `capability_directories: array of string`

360 

361 Directories that contain capabilities exposed to the agent.

362 

363 - `files: array of HostedEnvironmentFile`

364 

365 Files available in the environment, excluding their contents.

366 

367 - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

368 

369 A file copied from the OpenAI Files API.

370 

371 - `id: string`

372 

373 The session-scoped ID of the file in the execution environment.

374 

375 - `file_id: string`

376 

377 The ID of the uploaded file.

378 

379 - `path: string`

380 

381 The file's absolute path inside the environment.

382 

383 - `size_bytes: number`

384 

385 The decoded file size in bytes.

386 

387 - `type: "file_id"`

388 

389 The type of the object. Always `file_id`.

390 

391 - `"file_id"`

392 

393 - `Inline object { id, path, size_bytes, type }`

394 

395 A file supplied inline when the session was created.

396 

397 - `id: string`

398 

399 The session-scoped ID of the file in the execution environment.

400 

401 - `path: string`

402 

403 The file's absolute path inside the environment.

404 

405 - `size_bytes: number`

406 

407 The decoded file size in bytes.

408 

409 - `type: "inline"`

410 

411 The type of the object. Always `inline`.

412 

413 - `"inline"`

414 

415 - `network: object { access, allowed_domains }`

416 

417 The effective network access policy for the environment.

418 

419 - `access: "enabled" or "disabled" or "restricted"`

420 

421 The environment's network access mode.

422 

423 - `"enabled"`

424 

425 Allows unrestricted network access.

426 

427 - `"disabled"`

428 

429 Disables network access.

430 

431 - `"restricted"`

432 

433 Allows access only to configured domains.

434 

435 - `allowed_domains: array of string`

436 

437 Domains the environment may access when network access is restricted.

438 

439 - `packages: object { npm, python, system }`

440 

441 Packages installed in the environment.

442 

443 - `npm: array of string`

444 

445 npm packages installed globally in the environment.

446 

447 - `python: array of string`

448 

449 Python packages installed in the environment.

450 

451 - `system: array of string`

452 

453 System packages installed in the environment.

454 

455 - `plugins: array of HostedPlugin`

456 

457 Plugins installed in the environment, excluding their archive contents.

458 

459 - `description: string`

460 

461 The installed plugin description.

462 

463 - `name: string`

464 

465 The installed plugin name.

466 

467 - `type: "inline"`

468 

469 The type of the object. Always `inline`.

470 

471 - `"inline"`

472 

473 - `skills: array of HostedSkill`

474 

475 Skills installed in the environment, excluding their archive contents.

476 

477 - `HostedSkillReference object { description, name, skill_id, 2 more }`

478 

479 A skill installed from the Skills API.

480 

481 - `description: string`

482 

483 The installed skill description.

484 

485 - `name: string`

486 

487 The installed skill name.

488 

489 - `skill_id: string`

490 

491 The referenced skill ID.

492 

493 - `type: "skill_reference"`

494 

495 The type of the object. Always `skill_reference`.

496 

497 - `"skill_reference"`

498 

499 - `version: string`

500 

501 The concrete skill version installed for this session.

502 

503 - `Inline object { description, name, type }`

504 

505 A skill installed from an inline ZIP archive.

506 

507 - `description: string`

508 

509 The installed skill description.

510 

511 - `name: string`

512 

513 The installed skill name.

514 

515 - `type: "inline"`

516 

517 The type of the object. Always `inline`.

518 

519 - `"inline"`

520 

521 - `type: "openai_hosted"`

522 

523 The type of the object. Always `openai_hosted`.

524 

525 - `"openai_hosted"`

526 

527 - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

528 

529 An environment hosted by the application.

530 

531 - `id: string`

532 

533 The public ID of the environment.

534 

535 - `capability_directories: array of string`

536 

537 Directories that contain capabilities exposed to the agent.

538 

539 - `remote_url: string`

540 

541 Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

542 

543 - `type: "self_hosted"`

544 

545 The type of the object. Always `self_hosted`.

546 

547 - `"self_hosted"`

548 

549 - `workspace_directory: string`

550 

551 The absolute project directory inside the environment. Defaults to `/workspace`.

552 

553 - `error: string or null`

554 

555 The error that caused the session to fail, if any.

556 

557 - `last_active_at: number`

558 

559 The Unix timestamp, in seconds, when the session was last active.

560 

561 - `metadata: map[string]`

562 

563 Custom string key-value pairs attached to the session.

564 

565 - `object: "agent.session"`

566 

567 The object type. Always `agent.session`.

568 

569 - `"agent.session"`

570 

571 - `required_actions: array of object { arguments, call_id, name, 2 more } or object { environment_id, type }`

572 

573 Actions that must be completed before the session can continue.

574 

575 - `FunctionCall object { arguments, call_id, name, 2 more }`

576 

577 Run a function tool and submit its result.

578 

579 - `arguments: unknown`

580 

581 The arguments supplied by the model.

582 

583 - `call_id: string`

584 

585 The ID to include when submitting the function result.

586 

587 - `name: string`

588 

589 The function name.

590 

591 - `turn_id: string`

592 

593 The ID of the turn that requested the function call.

594 

595 - `type: "function_call"`

596 

597 The type of the object. Always `function_call`.

598 

599 - `"function_call"`

600 

601 - `EnvironmentConnection object { environment_id, type }`

602 

603 Reconnect a session environment.

604 

605 - `environment_id: string`

606 

607 The ID of the environment to reconnect.

608 

609 - `type: "environment_connection"`

610 

611 The type of the object. Always `environment_connection`.

612 

613 - `"environment_connection"`

614 

615 - `status: "idle" or "in_progress" or "requires_action" or "failed"`

616 

617 The current status of the session.

618 

619 - `"idle"`

620 

621 The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

622 

623 - `"in_progress"`

624 

625 The session is processing a turn.

626 

627 - `"requires_action"`

628 

629 The session is waiting for one or more required actions.

630 

631 - `"failed"`

632 

633 The session failed.

634 

635 - `usage: TokenUsage or null`

636 

637 Recorded token usage for a session or turn. Usage is best effort and may change.

638 

639 - `input_tokens: number`

640 

641 The number of input tokens used by the agent.

642 

643 - `input_tokens_details: object { cached_tokens }`

644 

645 A breakdown of the agent's input token usage.

646 

647 - `cached_tokens: number`

648 

649 The number of input tokens retrieved from the prompt cache.

650 

651 - `output_tokens: number`

652 

653 The number of output tokens generated by the agent.

654 

655 - `output_tokens_details: object { reasoning_tokens }`

656 

657 A breakdown of the agent's output token usage.

658 

659 - `reasoning_tokens: number`

660 

661 The number of output tokens used for reasoning.

662 

663 - `total_tokens: number`

664 

665 The total number of input and output tokens used by the agent.

666 

667 - `vault_ids: array of string`

668 

669 The IDs of vaults made available to the session.

670 

671### Example

672 

673```http

674curl https://api.openai.com/v1/agents/sessions/$SESSION_ID \

675 -X POST \

676 -H 'OpenAI-Beta: agents=v1' \

677 -H "Authorization: Bearer $OPENAI_API_KEY"

678```

679 

680#### Response

681 

682```json

683{

684 "id": "id",

685 "agent": {

686 "id": "id",

687 "instructions": "instructions",

688 "model": "model",

689 "multi_agent": {

690 "enabled": true,

691 "max_concurrent_subagents": 1

692 },

693 "name": "name",

694 "reasoning": {

695 "effort": "none",

696 "summary": "concise"

697 },

698 "service_tier": "auto",

699 "text": {

700 "format": {

701 "type": "text"

702 },

703 "verbosity": "low"

704 },

705 "tools": [

706 {

707 "defer_loading": true,

708 "description": "description",

709 "name": "name",

710 "parameters": {

711 "foo": "bar"

712 },

713 "type": "function"

714 }

715 ]

716 },

717 "created_at": 0,

718 "environment": {

719 "type": "none"

720 },

721 "error": "error",

722 "last_active_at": 0,

723 "metadata": {

724 "foo": "string"

725 },

726 "object": "agent.session",

727 "required_actions": [

728 {

729 "arguments": {},

730 "call_id": "call_id",

731 "name": "name",

732 "turn_id": "turn_id",

733 "type": "function_call"

734 }

735 ],

736 "status": "idle",

737 "usage": {

738 "input_tokens": 0,

739 "input_tokens_details": {

740 "cached_tokens": 0

741 },

742 "output_tokens": 0,

743 "output_tokens_details": {

744 "reasoning_tokens": 0

745 },

746 "total_tokens": 0

747 },

748 "vault_ids": [

749 "string"

750 ]

751}

752```

Details

1## Retrieve agent session artifact content

2 

3**get** `/agents/sessions/{session_id}/artifacts/{artifact_id}/content`

4 

5Downloads immutable session artifact bytes after the execution environment expires. See [session artifacts](/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11- `artifact_id: string`

12 

13### Example

14 

15```http

16curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/artifacts/$ARTIFACT_ID/content \

17 -H 'OpenAI-Beta: agents=v1' \

18 -H "Authorization: Bearer $OPENAI_API_KEY"

19```

Details

1## Delete an agent session artifact

2 

3**delete** `/agents/sessions/{session_id}/artifacts/{artifact_id}`

4 

5Deletes an immutable session artifact without deleting its live environment file or original Files API object. See [session artifacts](/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11- `artifact_id: string`

12 

13### Returns

14 

15- `SessionArtifactDeleted object { id, deleted, object }`

16 

17 Confirmation that an immutable session artifact was deleted.

18 

19 - `id: string`

20 

21 The ID of the deleted session artifact.

22 

23 - `deleted: boolean`

24 

25 Whether the session artifact was deleted. Always `true`.

26 

27 - `object: "agent.session.artifact.deleted"`

28 

29 The object type. Always `agent.session.artifact.deleted`.

30 

31 - `"agent.session.artifact.deleted"`

32 

33### Example

34 

35```http

36curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/artifacts/$ARTIFACT_ID \

37 -X DELETE \

38 -H 'OpenAI-Beta: agents=v1' \

39 -H "Authorization: Bearer $OPENAI_API_KEY"

40```

41 

42#### Response

43 

44```json

45{

46 "id": "id",

47 "deleted": true,

48 "object": "agent.session.artifact.deleted"

49}

50```

Details

1## List agent session artifacts

2 

3**get** `/agents/sessions/{session_id}/artifacts`

4 

5Lists immutable artifacts published by completed hosted session turns. See [session artifacts](/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11### Query Parameters

12 

13- `after: optional string or null`

14 

15 Return artifacts after this immutable artifact ID.

16 

17- `environment_id: optional string or null`

18 

19 Restrict the listing to artifacts produced by this environment.

20 

21- `limit: optional number or null`

22 

23 The maximum number of artifacts to return, between 1 and 100.

24 

25- `order: optional "asc" or "desc"`

26 

27 Sort by creation time and ID. Defaults to descending.

28 

29 - `"asc"`

30 

31 Returns resources in ascending order.

32 

33 - `"desc"`

34 

35 Returns resources in descending order.

36 

37### Returns

38 

39- `data: array of SessionArtifact`

40 

41 The resources returned in this page, in the requested sort order.

42 

43 - `id: string`

44 

45 The immutable artifact ID.

46 

47 - `created_at: number`

48 

49 The Unix timestamp, in seconds, when the artifact was published.

50 

51 - `environment_id: string`

52 

53 The ID of the environment that produced the artifact.

54 

55 - `object: "agent.session.artifact"`

56 

57 The object type. Always `agent.session.artifact`.

58 

59 - `"agent.session.artifact"`

60 

61 - `path: string`

62 

63 The original absolute file path in the execution environment.

64 

65 - `session_id: string`

66 

67 The ID of the session that owns the artifact.

68 

69 - `size_bytes: number`

70 

71 The immutable artifact size in bytes.

72 

73 - `turn_id: string`

74 

75 The ID of the completed turn that published the artifact.

76 

77- `first_id: string or null`

78 

79 The ID of the first resource in `data`, or `null` if the page is empty.

80 

81- `has_more: boolean`

82 

83 Whether there are more resources to retrieve after this page.

84 

85- `last_id: string or null`

86 

87 The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

88 

89- `object: "list"`

90 

91 The object type, which is always `list`.

92 

93 - `"list"`

94 

95### Example

96 

97```http

98curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/artifacts \

99 -H 'OpenAI-Beta: agents=v1' \

100 -H "Authorization: Bearer $OPENAI_API_KEY"

101```

102 

103#### Response

104 

105```json

106{

107 "data": [

108 {

109 "id": "id",

110 "created_at": 0,

111 "environment_id": "environment_id",

112 "object": "agent.session.artifact",

113 "path": "path",

114 "session_id": "session_id",

115 "size_bytes": 0,

116 "turn_id": "turn_id"

117 }

118 ],

119 "first_id": "first_id",

120 "has_more": true,

121 "last_id": "last_id",

122 "object": "list"

123}

124```

Details

1## Retrieve an agent session artifact

2 

3**get** `/agents/sessions/{session_id}/artifacts/{artifact_id}`

4 

5Retrieves immutable metadata for one durable session artifact. See [session artifacts](/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11- `artifact_id: string`

12 

13### Returns

14 

15- `SessionArtifact object { id, created_at, environment_id, 5 more }`

16 

17 An immutable file published by a completed hosted session turn.

18 

19 - `id: string`

20 

21 The immutable artifact ID.

22 

23 - `created_at: number`

24 

25 The Unix timestamp, in seconds, when the artifact was published.

26 

27 - `environment_id: string`

28 

29 The ID of the environment that produced the artifact.

30 

31 - `object: "agent.session.artifact"`

32 

33 The object type. Always `agent.session.artifact`.

34 

35 - `"agent.session.artifact"`

36 

37 - `path: string`

38 

39 The original absolute file path in the execution environment.

40 

41 - `session_id: string`

42 

43 The ID of the session that owns the artifact.

44 

45 - `size_bytes: number`

46 

47 The immutable artifact size in bytes.

48 

49 - `turn_id: string`

50 

51 The ID of the completed turn that published the artifact.

52 

53### Example

54 

55```http

56curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/artifacts/$ARTIFACT_ID \

57 -H 'OpenAI-Beta: agents=v1' \

58 -H "Authorization: Bearer $OPENAI_API_KEY"

59```

60 

61#### Response

62 

63```json

64{

65 "id": "id",

66 "created_at": 0,

67 "environment_id": "environment_id",

68 "object": "agent.session.artifact",

69 "path": "path",

70 "session_id": "session_id",

71 "size_bytes": 0,

72 "turn_id": "turn_id"

73}

74```

Details

1## Create agent session input events

2 

3**post** `/agents/sessions/{session_id}/events`

4 

5Submits message, cancellation, or tool-result events to a managed agent session. See [session events](/api/docs/guides/agents-api/sessions/events).

6 

7### Header Parameters

8 

9- `"Idempotency-Key": optional string`

10 

11### Path Parameters

12 

13- `session_id: string`

14 

15### Body Parameters

16 

17- `events: array of AgentSessionInputParam`

18 

19 The input events to submit to the session.

20 

21 - `AgentSessionInputMessage object { input, type }`

22 

23 Adds one or more user messages and starts a turn.

24 

25 - `input: array of AgentSessionInputMessageParam`

26 

27 The user messages to add to the session.

28 

29 - `content: array of InputContentParam`

30 

31 The content of the message.

32 

33 - `InputText object { text, type }`

34 

35 Text input to the model.

36 

37 - `text: string`

38 

39 The text sent to the model.

40 

41 - `type: "input_text"`

42 

43 The type of the object. Always `input_text`.

44 

45 - `"input_text"`

46 

47 - `InputImage object { image_url, type }`

48 

49 Image input to the model.

50 

51 - `image_url: string`

52 

53 The URL of the image sent to the model.

54 

55 - `type: "input_image"`

56 

57 The type of the object. Always `input_image`.

58 

59 - `"input_image"`

60 

61 - `role: "user"`

62 

63 The role of the message author. Always `user`.

64 

65 - `"user"`

66 

67 - `type: optional "message"`

68 

69 The type of the input item. Always `message`.

70 

71 - `"message"`

72 

73 - `type: "agent.session.input.message"`

74 

75 The type of the object. Always `agent.session.input.message`.

76 

77 - `"agent.session.input.message"`

78 

79 - `AgentSessionInputCancel object { type }`

80 

81 Cancels the session's active turn.

82 

83 - `type: "agent.session.input.cancel"`

84 

85 The type of the object. Always `agent.session.input.cancel`.

86 

87 - `"agent.session.input.cancel"`

88 

89 - `AgentSessionInputToolResult object { call_id, success, turn_id, 3 more }`

90 

91 Submits the result of a function call.

92 

93 - `call_id: string`

94 

95 The ID of the function call.

96 

97 - `success: boolean`

98 

99 Whether the function call succeeded.

100 

101 - `turn_id: string`

102 

103 The ID of the turn that requested the function call.

104 

105 - `type: "agent.session.input.tool_result"`

106 

107 The type of the object. Always `agent.session.input.tool_result`.

108 

109 - `"agent.session.input.tool_result"`

110 

111 - `error: optional string or null`

112 

113 The error message when the call failed.

114 

115 - `output: optional AgentFunctionCallOutputParam or null`

116 

117 A function result represented as text or supported model-input content.

118 

119 - `string`

120 

121 - `array of InputContentParam`

122 

123 - `InputText object { text, type }`

124 

125 Text input to the model.

126 

127 - `InputImage object { image_url, type }`

128 

129 Image input to the model.

130 

131### Example

132 

133```http

134curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/events \

135 -H 'Content-Type: application/json' \

136 -H 'OpenAI-Beta: agents=v1' \

137 -H "Authorization: Bearer $OPENAI_API_KEY" \

138 -d '{

139 "events": [

140 {

141 "input": [

142 {

143 "content": [

144 {

145 "text": "text",

146 "type": "input_text"

147 }

148 ],

149 "role": "user"

150 }

151 ],

152 "type": "agent.session.input.message"

153 }

154 ]

155 }'

156```

Details

1## Stream agent session events

2 

3**get** `/agents/sessions/{session_id}/events`

4 

5Streams live events for an agent session. See [session events](/api/docs/guides/agents-api/sessions/events).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11### Returns

12 

13- `AgentSessionEvent = AgentSessionErrorEvent or AgentSessionEnvironmentReadyEvent or AgentOutputCommandExecutionOutputDeltaEvent or 27 more`

14 

15 An event emitted by a Managed Agents session.

16 

17 - `AgentSessionErrorEvent object { error, event_id, session_id, type }`

18 

19 Emitted when a turn or session fails.

20 

21 - `error: SessionError`

22 

23 The error that occurred.

24 

25 - `code: string or null`

26 

27 The machine-readable error code, if any.

28 

29 - `message: string`

30 

31 A customer-safe explanation of the error.

32 

33 - `param: string or null`

34 

35 The request parameter associated with the error, if any.

36 

37 - `type: string`

38 

39 The error type.

40 

41 - `event_id: string`

42 

43 The unique ID of the event.

44 

45 - `session_id: string`

46 

47 The ID of the session associated with the event.

48 

49 - `type: "error"`

50 

51 The type of the object. Always `error`.

52 

53 - `"error"`

54 

55 - `AgentSessionEnvironmentReadyEvent object { environment, event_id, session_id, 2 more }`

56 

57 Emitted when a hosted session environment is ready to connect.

58 

59 - `environment: AgentSessionEnvironmentState`

60 

61 The current environment state.

62 

63 - `id: string`

64 

65 The public ID of the environment.

66 

67 - `error: object { code, message, type } or null`

68 

69 An error reported while preparing a session environment.

70 

71 - `code: string`

72 

73 A machine-readable error code.

74 

75 - `message: string`

76 

77 A human-readable error message.

78 

79 - `type: string`

80 

81 The error type.

82 

83 - `status: "pending" or "ready" or "connected" or 2 more`

84 

85 The environment's connection status.

86 

87 - `"pending"`

88 

89 The environment is being prepared.

90 

91 - `"ready"`

92 

93 The environment is ready to connect.

94 

95 - `"connected"`

96 

97 The environment is connected.

98 

99 - `"disconnected"`

100 

101 The environment is disconnected.

102 

103 - `"failed"`

104 

105 The environment failed to connect.

106 

107 - `type: string`

108 

109 The environment type.

110 

111 - `event_id: string`

112 

113 The unique ID of the event.

114 

115 - `session_id: string`

116 

117 The ID of the session associated with the event.

118 

119 - `turn_id: string or null`

120 

121 The ID of the turn associated with the event, when applicable.

122 

123 - `type: "agent.session.environment.ready"`

124 

125 The type of the object. Always `agent.session.environment.ready`.

126 

127 - `"agent.session.environment.ready"`

128 

129 - `AgentOutputCommandExecutionOutputDeltaEvent object { delta, event_id, item_id, 4 more }`

130 

131 Emitted when command execution produces an output delta.

132 

133 - `delta: string`

134 

135 The output text that was appended.

136 

137 - `event_id: string`

138 

139 The unique ID of the event.

140 

141 - `item_id: string`

142 

143 The ID of the command execution item.

144 

145 - `output_index: number`

146 

147 The index of the item in the turn output.

148 

149 - `session_id: string`

150 

151 The ID of the session associated with the event.

152 

153 - `turn_id: string or null`

154 

155 The ID of the turn associated with the event, when applicable.

156 

157 - `type: "agent.output.command_execution_output.delta"`

158 

159 The type of the object. Always `agent.output.command_execution_output.delta`.

160 

161 - `"agent.output.command_execution_output.delta"`

162 

163 - `AgentSessionCreatedEvent object { event_id, session, type }`

164 

165 Emitted when a session is created.

166 

167 - `event_id: string`

168 

169 The unique ID of the event.

170 

171 - `session: AgentSession`

172 

173 The session that was created.

174 

175 - `id: string`

176 

177 The ID of the session.

178 

179 - `agent: object { id, instructions, model, 6 more }`

180 

181 The agent running in the session.

182 

183 - `id: string`

184 

185 The ID of the agent.

186 

187 - `instructions: string or null`

188 

189 Custom instructions appended to the agent's default base instructions.

190 

191 - `model: string`

192 

193 The model used by the agent.

194 

195 - `multi_agent: MultiAgentConfig`

196 

197 Configuration for creating and coordinating subagents.

198 

199 - `enabled: boolean`

200 

201 Whether subagent tools are enabled. Defaults to false.

202 

203 - `max_concurrent_subagents: number or null`

204 

205 Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

206 

207 - `name: string or null`

208 

209 The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value.

210 

211 - `reasoning: AgentReasoning`

212 

213 The agent's reasoning configuration.

214 

215 - `effort: "none" or "minimal" or "low" or 4 more or null`

216 

217 The amount of reasoning effort used by an agent.

218 

219 - `"none"`

220 

221 - `"minimal"`

222 

223 - `"low"`

224 

225 - `"medium"`

226 

227 - `"high"`

228 

229 - `"xhigh"`

230 

231 - `"max"`

232 

233 - `summary: "concise" or "detailed" or "auto" or null`

234 

235 The reasoning summary format requested from an agent.

236 

237 - `"concise"`

238 

239 Returns a concise reasoning summary when supported.

240 

241 - `"detailed"`

242 

243 Returns a detailed reasoning summary when supported.

244 

245 - `"auto"`

246 

247 Automatically selects the most detailed summary supported by the model.

248 

249 - `service_tier: "auto" or "default" or "flex" or 2 more`

250 

251 The effective service-tier policy for model requests. Defaults to `auto`.

252 

253 - `"auto"`

254 

255 - `"default"`

256 

257 - `"flex"`

258 

259 - `"priority"`

260 

261 - `"fast"`

262 

263 - `text: AgentText`

264 

265 Configuration for text generated by the agent.

266 

267 - `format: TextFormat`

268 

269 The effective output format. Defaults to ordinary text.

270 

271 - `Text object { type }`

272 

273 Generates ordinary text without a structured-output constraint.

274 

275 - `type: "text"`

276 

277 The type of the object. Always `text`.

278 

279 - `"text"`

280 

281 - `JSONSchema object { schema, type }`

282 

283 Constrains generated text to a JSON Schema.

284 

285 - `schema: map[unknown]`

286 

287 The JSON Schema that generated text must match.

288 

289 - `type: "json_schema"`

290 

291 The type of the object. Always `json_schema`.

292 

293 - `"json_schema"`

294 

295 - `verbosity: "low" or "medium" or "high"`

296 

297 The amount of text produced by the agent. Defaults to `medium`.

298 

299 - `"low"`

300 

301 - `"medium"`

302 

303 - `"high"`

304 

305 - `tools: array of AgentTool`

306 

307 Tools available to the agent.

308 

309 - `Function object { defer_loading, description, name, 2 more }`

310 

311 A function defined by the application.

312 

313 - `defer_loading: boolean`

314 

315 Whether the function is deferred and discovered through tool search.

316 

317 - `description: string`

318 

319 A description of what the function does.

320 

321 - `name: string`

322 

323 The name of the function.

324 

325 - `parameters: map[unknown]`

326 

327 A JSON Schema object describing the function's arguments.

328 

329 - `type: "function"`

330 

331 The type of the object. Always `function`.

332 

333 - `"function"`

334 

335 - `ProgrammaticToolCalling object { enabled, type }`

336 

337 Enables calling tools from model-generated code.

338 

339 - `enabled: boolean`

340 

341 Whether tools can be called from model-generated code.

342 

343 - `type: "programmatic_tool_calling"`

344 

345 The type of the object. Always `programmatic_tool_calling`.

346 

347 - `"programmatic_tool_calling"`

348 

349 - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

350 

351 Tools provided by a remote MCP server.

352 

353 - `allowed_tools: array of string or null`

354 

355 The MCP tools the agent may call.

356 

357 - `connection_origin: "service" or "environment"`

358 

359 Where outbound MCP HTTP connections originate.

360 

361 - `"service"`

362 

363 - `"environment"`

364 

365 - `credential_id: string or null`

366 

367 The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

368 

369 - `request_metadata: map[unknown]`

370 

371 Metadata included with requests to this MCP server.

372 

373 - `required: boolean`

374 

375 Whether this MCP server must initialize before the first turn.

376 

377 - `server_label: string`

378 

379 A label used to identify the MCP server in tool calls.

380 

381 - `transport: McpTransport`

382 

383 The transport used to connect to the MCP server.

384 

385 - `HTTP object { server_url, type }`

386 

387 Connects to an MCP server over HTTP.

388 

389 - `server_url: string`

390 

391 The URL of the MCP server.

392 

393 - `type: "http"`

394 

395 The type of the object. Always `http`.

396 

397 - `"http"`

398 

399 - `Stdio object { args, command, cwd, 2 more }`

400 

401 Starts an MCP server as a local process.

402 

403 - `args: array of string`

404 

405 Arguments passed to the MCP server command.

406 

407 - `command: string`

408 

409 The command used to start the MCP server.

410 

411 - `cwd: string`

412 

413 The working directory used to start the MCP server.

414 

415 - `env_vars: array of string`

416 

417 Environment variable names inherited from the execution environment.

418 

419 - `type: "stdio"`

420 

421 The type of the object. Always `stdio`.

422 

423 - `"stdio"`

424 

425 - `type: "mcp"`

426 

427 The type of the object. Always `mcp`.

428 

429 - `"mcp"`

430 

431 - `WebSearch object { allowed_domains, context_size, location, 2 more }`

432 

433 Web search.

434 

435 - `allowed_domains: array of string or null`

436 

437 Allowed search domains, or `null` when the search is unrestricted.

438 

439 - `context_size: "low" or "medium" or "high"`

440 

441 The amount of search context made available to the model. Defaults to `medium`.

442 

443 - `"low"`

444 

445 - `"medium"`

446 

447 - `"high"`

448 

449 - `location: object { city, country, region, timezone } or null`

450 

451 Approximate user location used to localize web search results.

452 

453 - `city: string or null`

454 

455 The city name.

456 

457 - `country: string or null`

458 

459 The two-letter ISO country code, such as `US`.

460 

461 - `region: string or null`

462 

463 The region or state name.

464 

465 - `timezone: string or null`

466 

467 The IANA timezone, such as `America/Los_Angeles`.

468 

469 - `mode: "disabled" or "cached" or "live"`

470 

471 The source used for web search results.

472 

473 - `"disabled"`

474 

475 - `"cached"`

476 

477 - `"live"`

478 

479 - `type: "web_search"`

480 

481 The type of the object. Always `web_search`.

482 

483 - `"web_search"`

484 

485 - `created_at: number`

486 

487 The Unix timestamp, in seconds, when the session was created.

488 

489 - `environment: Environment`

490 

491 The execution environment for the session.

492 

493 - `None object { type }`

494 

495 The session talks to CCA without selecting or provisioning an execution environment.

496 

497 - `type: "none"`

498 

499 The type of the object. Always `none`.

500 

501 - `"none"`

502 

503 - `OpenAIHosted object { id, capability_directories, files, 5 more }`

504 

505 An environment hosted by OpenAI.

506 

507 - `id: string`

508 

509 The public ID of the environment.

510 

511 - `capability_directories: array of string`

512 

513 Directories that contain capabilities exposed to the agent.

514 

515 - `files: array of HostedEnvironmentFile`

516 

517 Files available in the environment, excluding their contents.

518 

519 - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

520 

521 A file copied from the OpenAI Files API.

522 

523 - `id: string`

524 

525 The session-scoped ID of the file in the execution environment.

526 

527 - `file_id: string`

528 

529 The ID of the uploaded file.

530 

531 - `path: string`

532 

533 The file's absolute path inside the environment.

534 

535 - `size_bytes: number`

536 

537 The decoded file size in bytes.

538 

539 - `type: "file_id"`

540 

541 The type of the object. Always `file_id`.

542 

543 - `"file_id"`

544 

545 - `Inline object { id, path, size_bytes, type }`

546 

547 A file supplied inline when the session was created.

548 

549 - `id: string`

550 

551 The session-scoped ID of the file in the execution environment.

552 

553 - `path: string`

554 

555 The file's absolute path inside the environment.

556 

557 - `size_bytes: number`

558 

559 The decoded file size in bytes.

560 

561 - `type: "inline"`

562 

563 The type of the object. Always `inline`.

564 

565 - `"inline"`

566 

567 - `network: object { access, allowed_domains }`

568 

569 The effective network access policy for the environment.

570 

571 - `access: "enabled" or "disabled" or "restricted"`

572 

573 The environment's network access mode.

574 

575 - `"enabled"`

576 

577 Allows unrestricted network access.

578 

579 - `"disabled"`

580 

581 Disables network access.

582 

583 - `"restricted"`

584 

585 Allows access only to configured domains.

586 

587 - `allowed_domains: array of string`

588 

589 Domains the environment may access when network access is restricted.

590 

591 - `packages: object { npm, python, system }`

592 

593 Packages installed in the environment.

594 

595 - `npm: array of string`

596 

597 npm packages installed globally in the environment.

598 

599 - `python: array of string`

600 

601 Python packages installed in the environment.

602 

603 - `system: array of string`

604 

605 System packages installed in the environment.

606 

607 - `plugins: array of HostedPlugin`

608 

609 Plugins installed in the environment, excluding their archive contents.

610 

611 - `description: string`

612 

613 The installed plugin description.

614 

615 - `name: string`

616 

617 The installed plugin name.

618 

619 - `type: "inline"`

620 

621 The type of the object. Always `inline`.

622 

623 - `"inline"`

624 

625 - `skills: array of HostedSkill`

626 

627 Skills installed in the environment, excluding their archive contents.

628 

629 - `HostedSkillReference object { description, name, skill_id, 2 more }`

630 

631 A skill installed from the Skills API.

632 

633 - `description: string`

634 

635 The installed skill description.

636 

637 - `name: string`

638 

639 The installed skill name.

640 

641 - `skill_id: string`

642 

643 The referenced skill ID.

644 

645 - `type: "skill_reference"`

646 

647 The type of the object. Always `skill_reference`.

648 

649 - `"skill_reference"`

650 

651 - `version: string`

652 

653 The concrete skill version installed for this session.

654 

655 - `Inline object { description, name, type }`

656 

657 A skill installed from an inline ZIP archive.

658 

659 - `description: string`

660 

661 The installed skill description.

662 

663 - `name: string`

664 

665 The installed skill name.

666 

667 - `type: "inline"`

668 

669 The type of the object. Always `inline`.

670 

671 - `"inline"`

672 

673 - `type: "openai_hosted"`

674 

675 The type of the object. Always `openai_hosted`.

676 

677 - `"openai_hosted"`

678 

679 - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

680 

681 An environment hosted by the application.

682 

683 - `id: string`

684 

685 The public ID of the environment.

686 

687 - `capability_directories: array of string`

688 

689 Directories that contain capabilities exposed to the agent.

690 

691 - `remote_url: string`

692 

693 Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

694 

695 - `type: "self_hosted"`

696 

697 The type of the object. Always `self_hosted`.

698 

699 - `"self_hosted"`

700 

701 - `workspace_directory: string`

702 

703 The absolute project directory inside the environment. Defaults to `/workspace`.

704 

705 - `error: string or null`

706 

707 The error that caused the session to fail, if any.

708 

709 - `last_active_at: number`

710 

711 The Unix timestamp, in seconds, when the session was last active.

712 

713 - `metadata: map[string]`

714 

715 Custom string key-value pairs attached to the session.

716 

717 - `object: "agent.session"`

718 

719 The object type. Always `agent.session`.

720 

721 - `"agent.session"`

722 

723 - `required_actions: array of object { arguments, call_id, name, 2 more } or object { environment_id, type }`

724 

725 Actions that must be completed before the session can continue.

726 

727 - `FunctionCall object { arguments, call_id, name, 2 more }`

728 

729 Run a function tool and submit its result.

730 

731 - `arguments: unknown`

732 

733 The arguments supplied by the model.

734 

735 - `call_id: string`

736 

737 The ID to include when submitting the function result.

738 

739 - `name: string`

740 

741 The function name.

742 

743 - `turn_id: string`

744 

745 The ID of the turn that requested the function call.

746 

747 - `type: "function_call"`

748 

749 The type of the object. Always `function_call`.

750 

751 - `"function_call"`

752 

753 - `EnvironmentConnection object { environment_id, type }`

754 

755 Reconnect a session environment.

756 

757 - `environment_id: string`

758 

759 The ID of the environment to reconnect.

760 

761 - `type: "environment_connection"`

762 

763 The type of the object. Always `environment_connection`.

764 

765 - `"environment_connection"`

766 

767 - `status: "idle" or "in_progress" or "requires_action" or "failed"`

768 

769 The current status of the session.

770 

771 - `"idle"`

772 

773 The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.

774 

775 - `"in_progress"`

776 

777 The session is processing a turn.

778 

779 - `"requires_action"`

780 

781 The session is waiting for one or more required actions.

782 

783 - `"failed"`

784 

785 The session failed.

786 

787 - `usage: TokenUsage or null`

788 

789 Recorded token usage for a session or turn. Usage is best effort and may change.

790 

791 - `input_tokens: number`

792 

793 The number of input tokens used by the agent.

794 

795 - `input_tokens_details: object { cached_tokens }`

796 

797 A breakdown of the agent's input token usage.

798 

799 - `cached_tokens: number`

800 

801 The number of input tokens retrieved from the prompt cache.

802 

803 - `output_tokens: number`

804 

805 The number of output tokens generated by the agent.

806 

807 - `output_tokens_details: object { reasoning_tokens }`

808 

809 A breakdown of the agent's output token usage.

810 

811 - `reasoning_tokens: number`

812 

813 The number of output tokens used for reasoning.

814 

815 - `total_tokens: number`

816 

817 The total number of input and output tokens used by the agent.

818 

819 - `vault_ids: array of string`

820 

821 The IDs of vaults made available to the session.

822 

823 - `type: "agent.session.created"`

824 

825 The type of the object. Always `agent.session.created`.

826 

827 - `"agent.session.created"`

828 

829 - `AgentSessionTurnCreatedEvent object { event_id, session_id, turn, 2 more }`

830 

831 Emitted when a turn is created.

832 

833 - `event_id: string`

834 

835 The unique ID of the event.

836 

837 - `session_id: string`

838 

839 The ID of the session associated with the event.

840 

841 - `turn: Turn`

842 

843 The turn at the time it was created.

844 

845 - `id: string`

846 

847 The ID of the turn.

848 

849 - `agent_id: string`

850 

851 The ID of the agent that ran the turn.

852 

853 - `completed_at: number or null`

854 

855 The Unix timestamp, in seconds, when the turn reached a terminal state.

856 

857 - `created_at: number`

858 

859 The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

860 

861 - `error: SessionTurnError or null`

862 

863 A customer-safe error describing why a session request failed.

864 

865 - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 14 more`

866 

867 A stable, machine-readable failure category.

868 

869 - `"context_length_exceeded"`

870 

871 The request exceeds the model's context window.

872 

873 - `"session_budget_exceeded"`

874 

875 The session has reached its usage budget.

876 

877 - `"usage_limit_exceeded"`

878 

879 The organization has reached a usage, plan, or billing limit.

880 

881 - `"credit_balance_exhausted"`

882 

883 The organization has no API credits remaining.

884 

885 - `"rate_limit_exceeded"`

886 

887 The request exceeds the available rate limit.

888 

889 - `"server_overloaded"`

890 

891 The model service is temporarily overloaded.

892 

893 - `"cyber_policy"`

894 

895 The request was rejected by a safety policy.

896 

897 - `"connection_failed"`

898 

899 The request could not connect to the model service.

900 

901 - `"server_error"`

902 

903 The model service encountered an unexpected error.

904 

905 - `"authentication_error"`

906 

907 The API credentials are invalid or lack the required access.

908 

909 - `"invalid_request"`

910 

911 The request contains invalid input or configuration.

912 

913 - `"resource_not_found"`

914 

915 The requested model or resource is unavailable.

916 

917 - `"sandbox_error"`

918 

919 The request could not complete in its execution environment.

920 

921 - `"executor_version_incompatible"`

922 

923 The executor must be upgraded before it can run this turn.

924 

925 - `"active_turn_not_steerable"`

926 

927 The session cannot accept additional input while a request is running.

928 

929 - `"request_timeout"`

930 

931 The request timed out before the model service responded.

932 

933 - `"internal_error"`

934 

935 An unexpected internal error prevented the session request from completing.

936 

937 - `message: string`

938 

939 A customer-safe explanation of the failure.

940 

941 - `object: "agent.session.turn"`

942 

943 The object type. Always `agent.session.turn`.

944 

945 - `"agent.session.turn"`

946 

947 - `session_id: string`

948 

949 The ID of the session that owns the turn.

950 

951 - `started_at: number or null`

952 

953 The Unix timestamp, in seconds, when the turn started.

954 

955 - `status: "queued" or "in_progress" or "waiting" or 3 more`

956 

957 The current status of the turn.

958 

959 - `"queued"`

960 

961 The turn is waiting to start.

962 

963 - `"in_progress"`

964 

965 The turn is in progress.

966 

967 - `"waiting"`

968 

969 The turn is waiting for external input.

970 

971 - `"completed"`

972 

973 The turn completed successfully.

974 

975 - `"failed"`

976 

977 The turn failed.

978 

979 - `"cancelled"`

980 

981 The turn was cancelled.

982 

983 - `subagent_id: string or null`

984 

985 The ID of the subagent that ran the turn, if applicable.

986 

987 - `usage: TokenUsage or null`

988 

989 Recorded token usage for a session or turn. Usage is best effort and may change.

990 

991 - `turn_id: string`

992 

993 The ID of the turn associated with the event.

994 

995 - `type: "agent.session.turn.created"`

996 

997 The type of the object. Always `agent.session.turn.created`.

998 

999 - `"agent.session.turn.created"`

1000 

1001 - `AgentSessionTurnInProgressEvent object { event_id, session_id, turn, 2 more }`

1002 

1003 Emitted when a turn starts running.

1004 

1005 - `event_id: string`

1006 

1007 The unique ID of the event.

1008 

1009 - `session_id: string`

1010 

1011 The ID of the session associated with the event.

1012 

1013 - `turn: Turn`

1014 

1015 The turn at the time it started running.

1016 

1017 - `turn_id: string`

1018 

1019 The ID of the turn associated with the event.

1020 

1021 - `type: "agent.session.turn.in_progress"`

1022 

1023 The type of the object. Always `agent.session.turn.in_progress`.

1024 

1025 - `"agent.session.turn.in_progress"`

1026 

1027 - `AgentSessionTurnCompletedEvent object { event_id, session_id, turn, 3 more }`

1028 

1029 Emitted when a turn completes.

1030 

1031 - `event_id: string`

1032 

1033 The unique ID of the event.

1034 

1035 - `session_id: string`

1036 

1037 The ID of the session associated with the event.

1038 

1039 - `turn: Turn`

1040 

1041 The completed turn.

1042 

1043 - `turn_id: string`

1044 

1045 The ID of the turn associated with the event.

1046 

1047 - `type: "agent.session.turn.completed"`

1048 

1049 The type of the object. Always `agent.session.turn.completed`.

1050 

1051 - `"agent.session.turn.completed"`

1052 

1053 - `usage: TokenUsage or null`

1054 

1055 Recorded token usage for a session or turn. Usage is best effort and may change.

1056 

1057 - `AgentSessionTurnFailedEvent object { event_id, session_id, turn, 3 more }`

1058 

1059 Emitted when a turn fails.

1060 

1061 - `event_id: string`

1062 

1063 The unique ID of the event.

1064 

1065 - `session_id: string`

1066 

1067 The ID of the session associated with the event.

1068 

1069 - `turn: Turn`

1070 

1071 The failed turn.

1072 

1073 - `turn_id: string`

1074 

1075 The ID of the turn associated with the event.

1076 

1077 - `type: "agent.session.turn.failed"`

1078 

1079 The type of the object. Always `agent.session.turn.failed`.

1080 

1081 - `"agent.session.turn.failed"`

1082 

1083 - `usage: TokenUsage or null`

1084 

1085 Recorded token usage for a session or turn. Usage is best effort and may change.

1086 

1087 - `AgentSessionTurnCancelledEvent object { event_id, session_id, turn, 3 more }`

1088 

1089 Emitted when a turn is cancelled.

1090 

1091 - `event_id: string`

1092 

1093 The unique ID of the event.

1094 

1095 - `session_id: string`

1096 

1097 The ID of the session associated with the event.

1098 

1099 - `turn: Turn`

1100 

1101 The cancelled turn.

1102 

1103 - `turn_id: string`

1104 

1105 The ID of the turn associated with the event.

1106 

1107 - `type: "agent.session.turn.cancelled"`

1108 

1109 The type of the object. Always `agent.session.turn.cancelled`.

1110 

1111 - `"agent.session.turn.cancelled"`

1112 

1113 - `usage: TokenUsage or null`

1114 

1115 Recorded token usage for a session or turn. Usage is best effort and may change.

1116 

1117 - `AgentSessionTurnItemAddedEvent object { event_id, item, output_index, 3 more }`

1118 

1119 Emitted when an item is added to a turn.

1120 

1121 - `event_id: string`

1122 

1123 The unique ID of the event.

1124 

1125 - `item: AgentSessionItem`

1126 

1127 The item that was added.

1128 

1129 - `AgentSessionMessage object { id, content, phase, 4 more }`

1130 

1131 A user or assistant message recorded in a session.

1132 

1133 - `id: string or null`

1134 

1135 The ID of this item, or null for legacy user messages whose ID was not recorded.

1136 

1137 - `content: array of AgentSessionMessageContent`

1138 

1139 The content of the message. User messages contain input text or images; assistant messages contain output text.

1140 

1141 - `InputText object { text, type }`

1142 

1143 Text supplied by the user.

1144 

1145 - `text: string`

1146 

1147 The text supplied by the user.

1148 

1149 - `type: "input_text"`

1150 

1151 The type of the object. Always `input_text`.

1152 

1153 - `"input_text"`

1154 

1155 - `InputImage object { image_url, type }`

1156 

1157 An image supplied by the user.

1158 

1159 - `image_url: string`

1160 

1161 The URL of the image supplied by the user, which may be a base64-encoded data URL.

1162 

1163 - `type: "input_image"`

1164 

1165 The type of the object. Always `input_image`.

1166 

1167 - `"input_image"`

1168 

1169 - `OutputText object { text, type }`

1170 

1171 Text produced by the assistant.

1172 

1173 - `text: string`

1174 

1175 The text produced by the assistant.

1176 

1177 - `type: "output_text"`

1178 

1179 The type of the object. Always `output_text`.

1180 

1181 - `"output_text"`

1182 

1183 - `phase: "commentary" or "final_answer" or null`

1184 

1185 The phase of an assistant message.

1186 

1187 - `"commentary"`

1188 

1189 Commentary produced while the agent works.

1190 

1191 - `"final_answer"`

1192 

1193 The agent's final answer.

1194 

1195 - `role: "user" or "assistant"`

1196 

1197 The role of the message author.

1198 

1199 - `"user"`

1200 

1201 - `"assistant"`

1202 

1203 - `status: AgentOutputItemStatus`

1204 

1205 The status of the message. User messages are always `completed`.

1206 

1207 - `"in_progress"`

1208 

1209 The item is in progress.

1210 

1211 - `"completed"`

1212 

1213 The item is complete.

1214 

1215 - `"incomplete"`

1216 

1217 The item stopped before completing.

1218 

1219 - `turn_id: string`

1220 

1221 The ID of the turn that contains this item.

1222 

1223 - `type: "message"`

1224 

1225 The item type. Always `message`.

1226 

1227 - `"message"`

1228 

1229 - `AgentReasoningItem object { id, status, summary, 2 more }`

1230 

1231 A reasoning item produced by the agent.

1232 

1233 - `id: string`

1234 

1235 The ID of the reasoning item.

1236 

1237 - `status: AgentOutputItemStatus or null`

1238 

1239 The status of an agent output item.

1240 

1241 - `summary: array of SummaryText`

1242 

1243 The reasoning summaries produced by the agent.

1244 

1245 - `text: string`

1246 

1247 The reasoning summary text.

1248 

1249 - `type: "summary_text"`

1250 

1251 The content type. Always `summary_text`.

1252 

1253 - `"summary_text"`

1254 

1255 - `turn_id: string`

1256 

1257 The ID of the turn that contains this item.

1258 

1259 - `type: "reasoning"`

1260 

1261 The item type. Always `reasoning`.

1262 

1263 - `"reasoning"`

1264 

1265 - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

1266 

1267 A function call produced by the agent.

1268 

1269 - `id: string`

1270 

1271 The ID of the function call item.

1272 

1273 - `arguments: unknown`

1274 

1275 The arguments to pass to the function.

1276 

1277 - `call_id: string`

1278 

1279 The ID used to submit the function result.

1280 

1281 - `name: string`

1282 

1283 The name of the function to call.

1284 

1285 - `status: AgentFunctionCallStatus`

1286 

1287 The status of the function call.

1288 

1289 - `"in_progress"`

1290 

1291 The call is in progress.

1292 

1293 - `"completed"`

1294 

1295 The call completed successfully.

1296 

1297 - `"failed"`

1298 

1299 The call failed.

1300 

1301 - `"incomplete"`

1302 

1303 The call stopped before completing.

1304 

1305 - `turn_id: string`

1306 

1307 The ID of the turn that contains this item.

1308 

1309 - `type: "function_call"`

1310 

1311 The item type. Always `function_call`.

1312 

1313 - `"function_call"`

1314 

1315 - `FunctionCallOutput object { id, call_id, error, 4 more }`

1316 

1317 The result supplied for a function call.

1318 

1319 - `id: string`

1320 

1321 The ID of the function call output item.

1322 

1323 - `call_id: string`

1324 

1325 The ID of the function call that produced this output.

1326 

1327 - `error: string or null`

1328 

1329 The error message, if the call failed.

1330 

1331 - `output: AgentFunctionCallOutput or null`

1332 

1333 The text or model-input content supplied as a function result.

1334 

1335 - `string`

1336 

1337 - `array of InputContent`

1338 

1339 - `InputText object { text, type }`

1340 

1341 Text input recorded in a session item.

1342 

1343 - `text: string`

1344 

1345 The text supplied to the agent.

1346 

1347 - `type: "input_text"`

1348 

1349 The type of the object. Always `input_text`.

1350 

1351 - `"input_text"`

1352 

1353 - `InputImage object { image_url, type }`

1354 

1355 Image input recorded in a session item.

1356 

1357 - `image_url: string`

1358 

1359 The URL of the image supplied to the agent, which may be a base64-encoded data URL.

1360 

1361 - `type: "input_image"`

1362 

1363 The type of the object. Always `input_image`.

1364 

1365 - `"input_image"`

1366 

1367 - `status: AgentFunctionCallStatus`

1368 

1369 The status of the function call.

1370 

1371 - `turn_id: string`

1372 

1373 The ID of the turn that contains this item.

1374 

1375 - `type: "function_call_output"`

1376 

1377 The item type. Always `function_call_output`.

1378 

1379 - `"function_call_output"`

1380 

1381 - `AgentMessage object { id, content, recipient_agent_id, 3 more }`

1382 

1383 A message exchanged between agent threads.

1384 

1385 - `id: string`

1386 

1387 The ID of the message.

1388 

1389 - `content: array of AgentContent`

1390 

1391 The content exchanged between the agents.

1392 

1393 - `OutputText object { text, type }`

1394 

1395 A text content part produced by the agent.

1396 

1397 - `text: string`

1398 

1399 The text produced by the agent.

1400 

1401 - `type: "output_text"`

1402 

1403 The content type. Always `output_text`.

1404 

1405 - `"output_text"`

1406 

1407 - `EncryptedContent object { encrypted_content, type }`

1408 

1409 Encrypted content exchanged between agents.

1410 

1411 - `encrypted_content: string`

1412 

1413 The encrypted content payload.

1414 

1415 - `type: "encrypted_content"`

1416 

1417 The content type. Always `encrypted_content`.

1418 

1419 - `"encrypted_content"`

1420 

1421 - `recipient_agent_id: string`

1422 

1423 The ID or name of the receiving agent.

1424 

1425 - `sender_agent_id: string`

1426 

1427 The ID or name of the sending agent.

1428 

1429 - `turn_id: string`

1430 

1431 The ID of the turn that contains this item.

1432 

1433 - `type: "agent_message"`

1434 

1435 The item type. Always `agent_message`.

1436 

1437 - `"agent_message"`

1438 

1439 - `AgentMcpCallItem object { id, arguments, error, 6 more }`

1440 

1441 A call to a tool on an MCP server.

1442 

1443 - `id: string`

1444 

1445 The ID of the MCP call item.

1446 

1447 - `arguments: unknown`

1448 

1449 The arguments passed to the MCP tool.

1450 

1451 - `error: unknown`

1452 

1453 The error returned by the MCP tool, if any.

1454 

1455 - `name: string`

1456 

1457 The name of the MCP tool.

1458 

1459 - `output: unknown`

1460 

1461 The output returned by the MCP tool, if any.

1462 

1463 - `server_label: string`

1464 

1465 The label of the MCP server.

1466 

1467 - `status: AgentFunctionCallStatus`

1468 

1469 The status of the MCP tool call.

1470 

1471 - `turn_id: string`

1472 

1473 The ID of the turn that contains this item.

1474 

1475 - `type: "mcp_call"`

1476 

1477 The item type. Always `mcp_call`.

1478 

1479 - `"mcp_call"`

1480 

1481 - `AgentWebSearchCallItem object { id, action, status, 2 more }`

1482 

1483 A web search call produced by the agent.

1484 

1485 - `id: string`

1486 

1487 The ID of the web search call.

1488 

1489 - `action: WebSearchAction or null`

1490 

1491 An action performed by the web search tool.

1492 

1493 - `Search object { queries, query, type }`

1494 

1495 A search query or group of search queries.

1496 

1497 - `queries: array of string or null`

1498 

1499 The search queries, when multiple queries were used.

1500 

1501 - `query: string or null`

1502 

1503 The search query, when a single query was used.

1504 

1505 - `type: "search"`

1506 

1507 The type of the object. Always `search`.

1508 

1509 - `"search"`

1510 

1511 - `OpenPage object { type, url }`

1512 

1513 Opens a web page.

1514 

1515 - `type: "open_page"`

1516 

1517 The type of the object. Always `open_page`.

1518 

1519 - `"open_page"`

1520 

1521 - `url: string or null`

1522 

1523 The URL of the page that was opened.

1524 

1525 - `FindInPage object { pattern, type, url }`

1526 

1527 Finds text within a web page.

1528 

1529 - `pattern: string or null`

1530 

1531 The text pattern that was searched for.

1532 

1533 - `type: "find_in_page"`

1534 

1535 The type of the object. Always `find_in_page`.

1536 

1537 - `"find_in_page"`

1538 

1539 - `url: string or null`

1540 

1541 The URL of the page that was searched.

1542 

1543 - `Other object { type }`

1544 

1545 Another web search action.

1546 

1547 - `type: "other"`

1548 

1549 The type of the object. Always `other`.

1550 

1551 - `"other"`

1552 

1553 - `status: AgentOutputItemStatus`

1554 

1555 The status of the web search call.

1556 

1557 - `turn_id: string`

1558 

1559 The ID of the turn that contains this item.

1560 

1561 - `type: "web_search_call"`

1562 

1563 The item type. Always `web_search_call`.

1564 

1565 - `"web_search_call"`

1566 

1567 - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

1568 

1569 A command execution produced by the agent.

1570 

1571 - `id: string`

1572 

1573 The ID of the command execution item.

1574 

1575 - `command: string`

1576 

1577 The command that was executed.

1578 

1579 - `cwd: string or null`

1580 

1581 The working directory used to execute the command.

1582 

1583 - `duration_ms: number or null`

1584 

1585 The command duration in milliseconds.

1586 

1587 - `exit_code: number or null`

1588 

1589 The process exit code, if the command completed.

1590 

1591 - `output: string or null`

1592 

1593 The command output, if available.

1594 

1595 - `status: AgentFunctionCallStatus`

1596 

1597 The status of the command execution.

1598 

1599 - `turn_id: string`

1600 

1601 The ID of the turn that contains this item.

1602 

1603 - `type: "command_execution"`

1604 

1605 The item type. Always `command_execution`.

1606 

1607 - `"command_execution"`

1608 

1609 - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

1610 

1611 A request to spawn a subagent.

1612 

1613 - `id: string`

1614 

1615 The ID of the tool call item.

1616 

1617 - `agent_id: string`

1618 

1619 The ID of the agent that requested the subagent.

1620 

1621 - `content: array of AgentContent`

1622 

1623 The task given to the spawned agent.

1624 

1625 - `OutputText object { text, type }`

1626 

1627 A text content part produced by the agent.

1628 

1629 - `EncryptedContent object { encrypted_content, type }`

1630 

1631 Encrypted content exchanged between agents.

1632 

1633 - `model: string or null`

1634 

1635 The model requested for the spawned agent.

1636 

1637 - `reasoning_effort: string or null`

1638 

1639 The reasoning effort requested for the spawned agent.

1640 

1641 - `status: AgentFunctionCallStatus`

1642 

1643 The status of the tool call.

1644 

1645 - `turn_id: string`

1646 

1647 The ID of the turn that contains this item.

1648 

1649 - `type: "create_subagent_call"`

1650 

1651 The item type. Always `create_subagent_call`.

1652 

1653 - `"create_subagent_call"`

1654 

1655 The current public item type.

1656 

1657 - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

1658 

1659 A request to send input to another agent.

1660 

1661 - `id: string`

1662 

1663 The ID of the tool call item.

1664 

1665 - `content: array of AgentContent`

1666 

1667 The input sent to the receiving agent.

1668 

1669 - `OutputText object { text, type }`

1670 

1671 A text content part produced by the agent.

1672 

1673 - `EncryptedContent object { encrypted_content, type }`

1674 

1675 Encrypted content exchanged between agents.

1676 

1677 - `recipient_agent_id: string`

1678 

1679 The ID of the agent receiving the input.

1680 

1681 - `sender_agent_id: string`

1682 

1683 The ID of the agent sending the input.

1684 

1685 - `status: AgentFunctionCallStatus`

1686 

1687 The status of the tool call.

1688 

1689 - `turn_id: string`

1690 

1691 The ID of the turn that contains this item.

1692 

1693 - `type: "send_subagent_input_call"`

1694 

1695 The item type. Always `send_subagent_input_call`.

1696 

1697 - `"send_subagent_input_call"`

1698 

1699 The current public item type.

1700 

1701 - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

1702 

1703 A request to resume a subagent.

1704 

1705 - `id: string`

1706 

1707 The ID of the tool call item.

1708 

1709 - `recipient_agent_id: string`

1710 

1711 The ID of the agent to resume.

1712 

1713 - `sender_agent_id: string`

1714 

1715 The ID of the agent requesting the resume.

1716 

1717 - `status: AgentFunctionCallStatus`

1718 

1719 The status of the tool call.

1720 

1721 - `turn_id: string`

1722 

1723 The ID of the turn that contains this item.

1724 

1725 - `type: "resume_subagent_call"`

1726 

1727 The item type. Always `resume_subagent_call`.

1728 

1729 - `"resume_subagent_call"`

1730 

1731 The current public item type.

1732 

1733 - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

1734 

1735 A request to wait for one or more subagents.

1736 

1737 - `id: string`

1738 

1739 The ID of the tool call item.

1740 

1741 - `recipient_agent_ids: array of string`

1742 

1743 The IDs of the agents to wait for.

1744 

1745 - `sender_agent_id: string`

1746 

1747 The ID of the agent waiting for results.

1748 

1749 - `status: AgentFunctionCallStatus`

1750 

1751 The status of the tool call.

1752 

1753 - `turn_id: string`

1754 

1755 The ID of the turn that contains this item.

1756 

1757 - `type: "wait_for_subagents_call"`

1758 

1759 The item type. Always `wait_for_subagents_call`.

1760 

1761 - `"wait_for_subagents_call"`

1762 

1763 The current public item type.

1764 

1765 - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

1766 

1767 A request to interrupt a subagent's current turn. The subagent remains available.

1768 

1769 - `id: string`

1770 

1771 The ID of the tool call item.

1772 

1773 - `recipient_agent_id: string`

1774 

1775 The ID of the agent to interrupt.

1776 

1777 - `sender_agent_id: string`

1778 

1779 The ID of the agent requesting the interrupt.

1780 

1781 - `status: AgentFunctionCallStatus`

1782 

1783 The status of the tool call.

1784 

1785 - `turn_id: string`

1786 

1787 The ID of the turn that contains this item.

1788 

1789 - `type: "interrupt_subagent_call"`

1790 

1791 The item type. Always `interrupt_subagent_call`.

1792 

1793 - `"interrupt_subagent_call"`

1794 

1795 The current public item type.

1796 

1797 - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

1798 

1799 A request to close a subagent.

1800 

1801 - `id: string`

1802 

1803 The ID of the tool call item.

1804 

1805 - `recipient_agent_id: string`

1806 

1807 The ID of the agent to close.

1808 

1809 - `sender_agent_id: string`

1810 

1811 The ID of the agent requesting the close.

1812 

1813 - `status: AgentFunctionCallStatus`

1814 

1815 The status of the tool call.

1816 

1817 - `turn_id: string`

1818 

1819 The ID of the turn that contains this item.

1820 

1821 - `type: "close_subagent_call"`

1822 

1823 The item type. Always `close_subagent_call`.

1824 

1825 - `"close_subagent_call"`

1826 

1827 The current public item type.

1828 

1829 - `output_index: number or null`

1830 

1831 The index of the item in the turn output, when the item is agent output.

1832 

1833 - `session_id: string`

1834 

1835 The ID of the session associated with the event.

1836 

1837 - `turn_id: string or null`

1838 

1839 The ID of the turn associated with the event, when applicable.

1840 

1841 - `type: "agent.session.turn.item.added"`

1842 

1843 The type of the object. Always `agent.session.turn.item.added`.

1844 

1845 - `"agent.session.turn.item.added"`

1846 

1847 - `AgentSessionIdleEvent object { event_id, session, type }`

1848 

1849 Emitted when a session becomes idle.

1850 

1851 - `event_id: string`

1852 

1853 The unique ID of the event.

1854 

1855 - `session: AgentSession`

1856 

1857 The session that became idle.

1858 

1859 - `type: "agent.session.idle"`

1860 

1861 The type of the object. Always `agent.session.idle`.

1862 

1863 - `"agent.session.idle"`

1864 

1865 - `AgentSessionInProgressEvent object { event_id, session, type }`

1866 

1867 Emitted when a session starts processing a turn.

1868 

1869 - `event_id: string`

1870 

1871 The unique ID of the event.

1872 

1873 - `session: AgentSession`

1874 

1875 The session that started processing.

1876 

1877 - `type: "agent.session.in_progress"`

1878 

1879 The type of the object. Always `agent.session.in_progress`.

1880 

1881 - `"agent.session.in_progress"`

1882 

1883 - `AgentSessionRequiresActionEvent object { event_id, session, type }`

1884 

1885 Emitted when a session is waiting for one or more required actions.

1886 

1887 - `event_id: string`

1888 

1889 The unique ID of the event.

1890 

1891 - `session: AgentSession`

1892 

1893 The session and its current required actions.

1894 

1895 - `type: "agent.session.requires_action"`

1896 

1897 The type of the object. Always `agent.session.requires_action`.

1898 

1899 - `"agent.session.requires_action"`

1900 

1901 - `AgentSessionFailedEvent object { event_id, session, type }`

1902 

1903 Emitted when a session fails.

1904 

1905 - `event_id: string`

1906 

1907 The unique ID of the event.

1908 

1909 - `session: AgentSession`

1910 

1911 The failed session.

1912 

1913 - `type: "agent.session.failed"`

1914 

1915 The type of the object. Always `agent.session.failed`.

1916 

1917 - `"agent.session.failed"`

1918 

1919 - `AgentSessionEnvironmentPendingEvent object { environment, event_id, session_id, 2 more }`

1920 

1921 Emitted while a session environment is being prepared.

1922 

1923 - `environment: AgentSessionEnvironmentState`

1924 

1925 The current environment state.

1926 

1927 - `event_id: string`

1928 

1929 The unique ID of the event.

1930 

1931 - `session_id: string`

1932 

1933 The ID of the session associated with the event.

1934 

1935 - `turn_id: string or null`

1936 

1937 The ID of the turn associated with the event, when applicable.

1938 

1939 - `type: "agent.session.environment.pending"`

1940 

1941 The type of the object. Always `agent.session.environment.pending`.

1942 

1943 - `"agent.session.environment.pending"`

1944 

1945 - `AgentSessionEnvironmentConnectedEvent object { environment, event_id, session_id, 2 more }`

1946 

1947 Emitted when a session environment connects.

1948 

1949 - `environment: AgentSessionEnvironmentState`

1950 

1951 The current environment state.

1952 

1953 - `event_id: string`

1954 

1955 The unique ID of the event.

1956 

1957 - `session_id: string`

1958 

1959 The ID of the session associated with the event.

1960 

1961 - `turn_id: string or null`

1962 

1963 The ID of the turn associated with the event, when applicable.

1964 

1965 - `type: "agent.session.environment.connected"`

1966 

1967 The type of the object. Always `agent.session.environment.connected`.

1968 

1969 - `"agent.session.environment.connected"`

1970 

1971 - `AgentSessionEnvironmentDisconnectedEvent object { environment, event_id, session_id, 2 more }`

1972 

1973 Emitted when a session environment disconnects.

1974 

1975 - `environment: AgentSessionEnvironmentState`

1976 

1977 The current environment state.

1978 

1979 - `event_id: string`

1980 

1981 The unique ID of the event.

1982 

1983 - `session_id: string`

1984 

1985 The ID of the session associated with the event.

1986 

1987 - `turn_id: string or null`

1988 

1989 The ID of the turn associated with the event, when applicable.

1990 

1991 - `type: "agent.session.environment.disconnected"`

1992 

1993 The type of the object. Always `agent.session.environment.disconnected`.

1994 

1995 - `"agent.session.environment.disconnected"`

1996 

1997 - `AgentSessionEnvironmentFailedEvent object { environment, event_id, session_id, 2 more }`

1998 

1999 Emitted when a session environment fails.

2000 

2001 - `environment: AgentSessionEnvironmentState`

2002 

2003 The current environment state.

2004 

2005 - `event_id: string`

2006 

2007 The unique ID of the event.

2008 

2009 - `session_id: string`

2010 

2011 The ID of the session associated with the event.

2012 

2013 - `turn_id: string or null`

2014 

2015 The ID of the turn associated with the event, when applicable.

2016 

2017 - `type: "agent.session.environment.failed"`

2018 

2019 The type of the object. Always `agent.session.environment.failed`.

2020 

2021 - `"agent.session.environment.failed"`

2022 

2023 - `AgentSessionSubagentCreatedEvent object { event_id, subagent, type }`

2024 

2025 Emitted when a subagent is created.

2026 

2027 - `event_id: string`

2028 

2029 The unique ID of the event.

2030 

2031 - `subagent: Subagent`

2032 

2033 The subagent that was created.

2034 

2035 - `id: string`

2036 

2037 The ID of the subagent.

2038 

2039 - `closed_at: number or null`

2040 

2041 The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

2042 

2043 - `instructions: array of AgentContent or null`

2044 

2045 Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

2046 

2047 - `OutputText object { text, type }`

2048 

2049 A text content part produced by the agent.

2050 

2051 - `EncryptedContent object { encrypted_content, type }`

2052 

2053 Encrypted content exchanged between agents.

2054 

2055 - `name: string or null`

2056 

2057 The runner-assigned nickname, or null when unavailable.

2058 

2059 - `object: "agent.session.subagent"`

2060 

2061 The object type. Always `agent.session.subagent`.

2062 

2063 - `"agent.session.subagent"`

2064 

2065 - `opened_at: number`

2066 

2067 The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it.

2068 

2069 - `parent_agent_id: string`

2070 

2071 The ID of the agent that created this subagent.

2072 

2073 - `session_id: string`

2074 

2075 The ID of the session that owns the subagent.

2076 

2077 - `status: "active" or "closed"`

2078 

2079 The current status of the subagent.

2080 

2081 - `"active"`

2082 

2083 The subagent remains available, including while idle between turns.

2084 

2085 - `"closed"`

2086 

2087 The subagent is closed.

2088 

2089 - `type: "agent.session.subagent.created"`

2090 

2091 The type of the object. Always `agent.session.subagent.created`.

2092 

2093 - `"agent.session.subagent.created"`

2094 

2095 - `AgentSessionSubagentActiveEvent object { event_id, subagent, type }`

2096 

2097 Emitted when a closed subagent successfully resumes.

2098 

2099 - `event_id: string`

2100 

2101 The unique ID of the event.

2102 

2103 - `subagent: Subagent`

2104 

2105 The subagent that resumed.

2106 

2107 - `type: "agent.session.subagent.active"`

2108 

2109 The type of the object. Always `agent.session.subagent.active`.

2110 

2111 - `"agent.session.subagent.active"`

2112 

2113 - `AgentSessionSubagentClosedEvent object { event_id, subagent, type }`

2114 

2115 Emitted when a subagent is closed.

2116 

2117 - `event_id: string`

2118 

2119 The unique ID of the event.

2120 

2121 - `subagent: Subagent`

2122 

2123 The subagent that was closed.

2124 

2125 - `type: "agent.session.subagent.closed"`

2126 

2127 The type of the object. Always `agent.session.subagent.closed`.

2128 

2129 - `"agent.session.subagent.closed"`

2130 

2131 - `AgentSessionTurnItemDoneEvent object { event_id, item, output_index, 3 more }`

2132 

2133 Emitted when an output item is complete.

2134 

2135 - `event_id: string`

2136 

2137 The unique ID of the event.

2138 

2139 - `item: AgentOutputItem`

2140 

2141 The completed output item.

2142 

2143 - `AgentSessionAssistantMessage object { id, content, phase, 4 more }`

2144 

2145 An assistant message produced by the agent.

2146 

2147 - `id: string`

2148 

2149 The ID of the message.

2150 

2151 - `content: array of OutputText`

2152 

2153 The content of the message.

2154 

2155 - `text: string`

2156 

2157 The text produced by the agent.

2158 

2159 - `type: "output_text"`

2160 

2161 The content type. Always `output_text`.

2162 

2163 - `phase: "commentary" or "final_answer" or null`

2164 

2165 The phase of an assistant message.

2166 

2167 - `"commentary"`

2168 

2169 Commentary produced while the agent works.

2170 

2171 - `"final_answer"`

2172 

2173 The agent's final answer.

2174 

2175 - `role: "assistant"`

2176 

2177 The role of the message author. Always `assistant`.

2178 

2179 - `"assistant"`

2180 

2181 - `status: AgentOutputItemStatus`

2182 

2183 The status of the message.

2184 

2185 - `turn_id: string`

2186 

2187 The ID of the turn that contains this item.

2188 

2189 - `type: "message"`

2190 

2191 The item type. Always `message`.

2192 

2193 - `"message"`

2194 

2195 - `AgentReasoningItem object { id, status, summary, 2 more }`

2196 

2197 A reasoning item produced by the agent.

2198 

2199 - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

2200 

2201 A function call produced by the agent.

2202 

2203 - `AgentMcpCallItem object { id, arguments, error, 6 more }`

2204 

2205 A call to a tool on an MCP server.

2206 

2207 - `AgentWebSearchCallItem object { id, action, status, 2 more }`

2208 

2209 A web search call produced by the agent.

2210 

2211 - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

2212 

2213 A command execution produced by the agent.

2214 

2215 - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

2216 

2217 A request to spawn a subagent.

2218 

2219 - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

2220 

2221 A request to send input to another agent.

2222 

2223 - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

2224 

2225 A request to resume a subagent.

2226 

2227 - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

2228 

2229 A request to wait for one or more subagents.

2230 

2231 - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

2232 

2233 A request to interrupt a subagent's current turn. The subagent remains available.

2234 

2235 - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

2236 

2237 A request to close a subagent.

2238 

2239 - `output_index: number`

2240 

2241 The index of the output item in the turn output.

2242 

2243 - `session_id: string`

2244 

2245 The ID of the session associated with the event.

2246 

2247 - `turn_id: string or null`

2248 

2249 The ID of the turn associated with the event, when applicable.

2250 

2251 - `type: "agent.session.turn.item.done"`

2252 

2253 The type of the object. Always `agent.session.turn.item.done`.

2254 

2255 - `"agent.session.turn.item.done"`

2256 

2257 - `AgentSessionTurnContentPartAddedEvent object { content_index, event_id, item_id, 5 more }`

2258 

2259 Emitted when an output text content part is added.

2260 

2261 - `content_index: number`

2262 

2263 The index of the content part in the message.

2264 

2265 - `event_id: string`

2266 

2267 The unique ID of the event.

2268 

2269 - `item_id: string`

2270 

2271 The ID of the message item.

2272 

2273 - `output_index: number`

2274 

2275 The index of the item in the turn output.

2276 

2277 - `part: OutputText`

2278 

2279 The initial content part.

2280 

2281 - `session_id: string`

2282 

2283 The ID of the session associated with the event.

2284 

2285 - `turn_id: string or null`

2286 

2287 The ID of the turn associated with the event, when applicable.

2288 

2289 - `type: "agent.session.turn.content_part.added"`

2290 

2291 The type of the object. Always `agent.session.turn.content_part.added`.

2292 

2293 - `"agent.session.turn.content_part.added"`

2294 

2295 - `AgentSessionTurnContentPartDoneEvent object { content_index, event_id, item_id, 5 more }`

2296 

2297 Emitted when an output content part is complete.

2298 

2299 - `content_index: number`

2300 

2301 The index of the content part in the message.

2302 

2303 - `event_id: string`

2304 

2305 The unique ID of the event.

2306 

2307 - `item_id: string`

2308 

2309 The ID of the message item.

2310 

2311 - `output_index: number`

2312 

2313 The index of the item in the turn output.

2314 

2315 - `part: OutputText`

2316 

2317 The completed content part.

2318 

2319 - `session_id: string`

2320 

2321 The ID of the session associated with the event.

2322 

2323 - `turn_id: string or null`

2324 

2325 The ID of the turn associated with the event, when applicable.

2326 

2327 - `type: "agent.session.turn.content_part.done"`

2328 

2329 The type of the object. Always `agent.session.turn.content_part.done`.

2330 

2331 - `"agent.session.turn.content_part.done"`

2332 

2333 - `AgentSessionTurnOutputTextDeltaEvent object { content_index, delta, event_id, 5 more }`

2334 

2335 Emitted when text is appended to an output text content part.

2336 

2337 - `content_index: number`

2338 

2339 The index of the content part in the message.

2340 

2341 - `delta: string`

2342 

2343 The text that was appended.

2344 

2345 - `event_id: string`

2346 

2347 The unique ID of the event.

2348 

2349 - `item_id: string`

2350 

2351 The ID of the message item.

2352 

2353 - `output_index: number`

2354 

2355 The index of the item in the turn output.

2356 

2357 - `session_id: string`

2358 

2359 The ID of the session associated with the event.

2360 

2361 - `turn_id: string or null`

2362 

2363 The ID of the turn associated with the event, when applicable.

2364 

2365 - `type: "agent.session.turn.output_text.delta"`

2366 

2367 The type of the object. Always `agent.session.turn.output_text.delta`.

2368 

2369 - `"agent.session.turn.output_text.delta"`

2370 

2371 - `AgentSessionTurnOutputTextDoneEvent object { content_index, event_id, item_id, 5 more }`

2372 

2373 Emitted when an output text content part is complete.

2374 

2375 - `content_index: number`

2376 

2377 The index of the content part in the message.

2378 

2379 - `event_id: string`

2380 

2381 The unique ID of the event.

2382 

2383 - `item_id: string`

2384 

2385 The ID of the message item.

2386 

2387 - `output_index: number`

2388 

2389 The index of the item in the turn output.

2390 

2391 - `session_id: string`

2392 

2393 The ID of the session associated with the event.

2394 

2395 - `text: string`

2396 

2397 The complete output text.

2398 

2399 - `turn_id: string or null`

2400 

2401 The ID of the turn associated with the event, when applicable.

2402 

2403 - `type: "agent.session.turn.output_text.done"`

2404 

2405 The type of the object. Always `agent.session.turn.output_text.done`.

2406 

2407 - `"agent.session.turn.output_text.done"`

2408 

2409 - `AgentSessionTurnReasoningSummaryPartAddedEvent object { event_id, item_id, output_index, 5 more }`

2410 

2411 Emitted when a reasoning summary content part is added.

2412 

2413 - `event_id: string`

2414 

2415 The unique ID of the event.

2416 

2417 - `item_id: string`

2418 

2419 The ID of the reasoning item.

2420 

2421 - `output_index: number`

2422 

2423 The index of the item in the turn output.

2424 

2425 - `part: SummaryText`

2426 

2427 The initial summary part.

2428 

2429 - `text: string`

2430 

2431 The reasoning summary text.

2432 

2433 - `type: "summary_text"`

2434 

2435 The content type. Always `summary_text`.

2436 

2437 - `session_id: string`

2438 

2439 The ID of the session associated with the event.

2440 

2441 - `summary_index: number`

2442 

2443 The index of the summary content part.

2444 

2445 - `turn_id: string or null`

2446 

2447 The ID of the turn associated with the event, when applicable.

2448 

2449 - `type: "agent.session.turn.reasoning_summary_part.added"`

2450 

2451 The type of the object. Always `agent.session.turn.reasoning_summary_part.added`.

2452 

2453 - `"agent.session.turn.reasoning_summary_part.added"`

2454 

2455 - `AgentSessionTurnReasoningSummaryPartDoneEvent object { event_id, item_id, output_index, 6 more }`

2456 

2457 Emitted when a reasoning summary part is complete.

2458 

2459 - `event_id: string`

2460 

2461 The unique ID of the event.

2462 

2463 - `item_id: string`

2464 

2465 The ID of the reasoning item.

2466 

2467 - `output_index: number`

2468 

2469 The index of the item in the turn output.

2470 

2471 - `part: SummaryText`

2472 

2473 The completed summary part.

2474 

2475 - `session_id: string`

2476 

2477 The ID of the session associated with the event.

2478 

2479 - `status: "incomplete" or null`

2480 

2481 Present as `incomplete` when summary generation was interrupted.

2482 

2483 - `"incomplete"`

2484 

2485 - `summary_index: number`

2486 

2487 The index of the summary part.

2488 

2489 - `turn_id: string or null`

2490 

2491 The ID of the turn associated with the event, when applicable.

2492 

2493 - `type: "agent.session.turn.reasoning_summary_part.done"`

2494 

2495 The type of the object. Always `agent.session.turn.reasoning_summary_part.done`.

2496 

2497 - `"agent.session.turn.reasoning_summary_part.done"`

2498 

2499 - `AgentSessionTurnReasoningSummaryTextDeltaEvent object { delta, event_id, item_id, 5 more }`

2500 

2501 Emitted when text is appended to a reasoning summary.

2502 

2503 - `delta: string`

2504 

2505 The summary text that was appended.

2506 

2507 - `event_id: string`

2508 

2509 The unique ID of the event.

2510 

2511 - `item_id: string`

2512 

2513 The ID of the reasoning item.

2514 

2515 - `output_index: number`

2516 

2517 The index of the item in the turn output.

2518 

2519 - `session_id: string`

2520 

2521 The ID of the session associated with the event.

2522 

2523 - `summary_index: number`

2524 

2525 The index of the summary content part.

2526 

2527 - `turn_id: string or null`

2528 

2529 The ID of the turn associated with the event, when applicable.

2530 

2531 - `type: "agent.session.turn.reasoning_summary_text.delta"`

2532 

2533 The type of the object. Always `agent.session.turn.reasoning_summary_text.delta`.

2534 

2535 - `"agent.session.turn.reasoning_summary_text.delta"`

2536 

2537 - `AgentSessionTurnReasoningSummaryTextDoneEvent object { event_id, item_id, output_index, 5 more }`

2538 

2539 Emitted when a reasoning summary content part is complete.

2540 

2541 - `event_id: string`

2542 

2543 The unique ID of the event.

2544 

2545 - `item_id: string`

2546 

2547 The ID of the reasoning item.

2548 

2549 - `output_index: number`

2550 

2551 The index of the item in the turn output.

2552 

2553 - `session_id: string`

2554 

2555 The ID of the session associated with the event.

2556 

2557 - `summary_index: number`

2558 

2559 The index of the summary content part.

2560 

2561 - `text: string`

2562 

2563 The complete reasoning summary text.

2564 

2565 - `turn_id: string or null`

2566 

2567 The ID of the turn associated with the event, when applicable.

2568 

2569 - `type: "agent.session.turn.reasoning_summary_text.done"`

2570 

2571 The type of the object. Always `agent.session.turn.reasoning_summary_text.done`.

2572 

2573 - `"agent.session.turn.reasoning_summary_text.done"`

2574 

2575### Example

2576 

2577```http

2578curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/events \

2579 -H 'OpenAI-Beta: agents=v1' \

2580 -H "Authorization: Bearer $OPENAI_API_KEY"

2581```

Details

1## List agent session items

2 

3**get** `/agents/sessions/{session_id}/items`

4 

5Lists items produced by the session's root agent, including its interactions with subagents. Each subagent has its own item history. See [inspecting agent output](/api/docs/guides/agents-api/observability).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11### Query Parameters

12 

13- `after: optional string`

14 

15 Return resources after this resource ID in the selected order.

16 

17- `limit: optional number`

18 

19 The maximum number of resources to return, between 1 and 100. Defaults to 20.

20 

21- `order: optional "asc" or "desc"`

22 

23 The order in which resources are returned. Defaults to `desc`.

24 

25 - `"asc"`

26 

27 Returns resources in ascending order.

28 

29 - `"desc"`

30 

31 Returns resources in descending order.

32 

33### Returns

34 

35- `data: array of AgentSessionItem`

36 

37 The resources returned in this page, in the requested sort order.

38 

39 - `AgentSessionMessage object { id, content, phase, 4 more }`

40 

41 A user or assistant message recorded in a session.

42 

43 - `id: string or null`

44 

45 The ID of this item, or null for legacy user messages whose ID was not recorded.

46 

47 - `content: array of AgentSessionMessageContent`

48 

49 The content of the message. User messages contain input text or images; assistant messages contain output text.

50 

51 - `InputText object { text, type }`

52 

53 Text supplied by the user.

54 

55 - `text: string`

56 

57 The text supplied by the user.

58 

59 - `type: "input_text"`

60 

61 The type of the object. Always `input_text`.

62 

63 - `"input_text"`

64 

65 - `InputImage object { image_url, type }`

66 

67 An image supplied by the user.

68 

69 - `image_url: string`

70 

71 The URL of the image supplied by the user, which may be a base64-encoded data URL.

72 

73 - `type: "input_image"`

74 

75 The type of the object. Always `input_image`.

76 

77 - `"input_image"`

78 

79 - `OutputText object { text, type }`

80 

81 Text produced by the assistant.

82 

83 - `text: string`

84 

85 The text produced by the assistant.

86 

87 - `type: "output_text"`

88 

89 The type of the object. Always `output_text`.

90 

91 - `"output_text"`

92 

93 - `phase: "commentary" or "final_answer" or null`

94 

95 The phase of an assistant message.

96 

97 - `"commentary"`

98 

99 Commentary produced while the agent works.

100 

101 - `"final_answer"`

102 

103 The agent's final answer.

104 

105 - `role: "user" or "assistant"`

106 

107 The role of the message author.

108 

109 - `"user"`

110 

111 - `"assistant"`

112 

113 - `status: AgentOutputItemStatus`

114 

115 The status of the message. User messages are always `completed`.

116 

117 - `"in_progress"`

118 

119 The item is in progress.

120 

121 - `"completed"`

122 

123 The item is complete.

124 

125 - `"incomplete"`

126 

127 The item stopped before completing.

128 

129 - `turn_id: string`

130 

131 The ID of the turn that contains this item.

132 

133 - `type: "message"`

134 

135 The item type. Always `message`.

136 

137 - `"message"`

138 

139 - `AgentReasoningItem object { id, status, summary, 2 more }`

140 

141 A reasoning item produced by the agent.

142 

143 - `id: string`

144 

145 The ID of the reasoning item.

146 

147 - `status: AgentOutputItemStatus or null`

148 

149 The status of an agent output item.

150 

151 - `summary: array of SummaryText`

152 

153 The reasoning summaries produced by the agent.

154 

155 - `text: string`

156 

157 The reasoning summary text.

158 

159 - `type: "summary_text"`

160 

161 The content type. Always `summary_text`.

162 

163 - `"summary_text"`

164 

165 - `turn_id: string`

166 

167 The ID of the turn that contains this item.

168 

169 - `type: "reasoning"`

170 

171 The item type. Always `reasoning`.

172 

173 - `"reasoning"`

174 

175 - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

176 

177 A function call produced by the agent.

178 

179 - `id: string`

180 

181 The ID of the function call item.

182 

183 - `arguments: unknown`

184 

185 The arguments to pass to the function.

186 

187 - `call_id: string`

188 

189 The ID used to submit the function result.

190 

191 - `name: string`

192 

193 The name of the function to call.

194 

195 - `status: AgentFunctionCallStatus`

196 

197 The status of the function call.

198 

199 - `"in_progress"`

200 

201 The call is in progress.

202 

203 - `"completed"`

204 

205 The call completed successfully.

206 

207 - `"failed"`

208 

209 The call failed.

210 

211 - `"incomplete"`

212 

213 The call stopped before completing.

214 

215 - `turn_id: string`

216 

217 The ID of the turn that contains this item.

218 

219 - `type: "function_call"`

220 

221 The item type. Always `function_call`.

222 

223 - `"function_call"`

224 

225 - `FunctionCallOutput object { id, call_id, error, 4 more }`

226 

227 The result supplied for a function call.

228 

229 - `id: string`

230 

231 The ID of the function call output item.

232 

233 - `call_id: string`

234 

235 The ID of the function call that produced this output.

236 

237 - `error: string or null`

238 

239 The error message, if the call failed.

240 

241 - `output: AgentFunctionCallOutput or null`

242 

243 The text or model-input content supplied as a function result.

244 

245 - `string`

246 

247 - `array of InputContent`

248 

249 - `InputText object { text, type }`

250 

251 Text input recorded in a session item.

252 

253 - `text: string`

254 

255 The text supplied to the agent.

256 

257 - `type: "input_text"`

258 

259 The type of the object. Always `input_text`.

260 

261 - `"input_text"`

262 

263 - `InputImage object { image_url, type }`

264 

265 Image input recorded in a session item.

266 

267 - `image_url: string`

268 

269 The URL of the image supplied to the agent, which may be a base64-encoded data URL.

270 

271 - `type: "input_image"`

272 

273 The type of the object. Always `input_image`.

274 

275 - `"input_image"`

276 

277 - `status: AgentFunctionCallStatus`

278 

279 The status of the function call.

280 

281 - `turn_id: string`

282 

283 The ID of the turn that contains this item.

284 

285 - `type: "function_call_output"`

286 

287 The item type. Always `function_call_output`.

288 

289 - `"function_call_output"`

290 

291 - `AgentMessage object { id, content, recipient_agent_id, 3 more }`

292 

293 A message exchanged between agent threads.

294 

295 - `id: string`

296 

297 The ID of the message.

298 

299 - `content: array of AgentContent`

300 

301 The content exchanged between the agents.

302 

303 - `OutputText object { text, type }`

304 

305 A text content part produced by the agent.

306 

307 - `text: string`

308 

309 The text produced by the agent.

310 

311 - `type: "output_text"`

312 

313 The content type. Always `output_text`.

314 

315 - `"output_text"`

316 

317 - `EncryptedContent object { encrypted_content, type }`

318 

319 Encrypted content exchanged between agents.

320 

321 - `encrypted_content: string`

322 

323 The encrypted content payload.

324 

325 - `type: "encrypted_content"`

326 

327 The content type. Always `encrypted_content`.

328 

329 - `"encrypted_content"`

330 

331 - `recipient_agent_id: string`

332 

333 The ID or name of the receiving agent.

334 

335 - `sender_agent_id: string`

336 

337 The ID or name of the sending agent.

338 

339 - `turn_id: string`

340 

341 The ID of the turn that contains this item.

342 

343 - `type: "agent_message"`

344 

345 The item type. Always `agent_message`.

346 

347 - `"agent_message"`

348 

349 - `AgentMcpCallItem object { id, arguments, error, 6 more }`

350 

351 A call to a tool on an MCP server.

352 

353 - `id: string`

354 

355 The ID of the MCP call item.

356 

357 - `arguments: unknown`

358 

359 The arguments passed to the MCP tool.

360 

361 - `error: unknown`

362 

363 The error returned by the MCP tool, if any.

364 

365 - `name: string`

366 

367 The name of the MCP tool.

368 

369 - `output: unknown`

370 

371 The output returned by the MCP tool, if any.

372 

373 - `server_label: string`

374 

375 The label of the MCP server.

376 

377 - `status: AgentFunctionCallStatus`

378 

379 The status of the MCP tool call.

380 

381 - `turn_id: string`

382 

383 The ID of the turn that contains this item.

384 

385 - `type: "mcp_call"`

386 

387 The item type. Always `mcp_call`.

388 

389 - `"mcp_call"`

390 

391 - `AgentWebSearchCallItem object { id, action, status, 2 more }`

392 

393 A web search call produced by the agent.

394 

395 - `id: string`

396 

397 The ID of the web search call.

398 

399 - `action: WebSearchAction or null`

400 

401 An action performed by the web search tool.

402 

403 - `Search object { queries, query, type }`

404 

405 A search query or group of search queries.

406 

407 - `queries: array of string or null`

408 

409 The search queries, when multiple queries were used.

410 

411 - `query: string or null`

412 

413 The search query, when a single query was used.

414 

415 - `type: "search"`

416 

417 The type of the object. Always `search`.

418 

419 - `"search"`

420 

421 - `OpenPage object { type, url }`

422 

423 Opens a web page.

424 

425 - `type: "open_page"`

426 

427 The type of the object. Always `open_page`.

428 

429 - `"open_page"`

430 

431 - `url: string or null`

432 

433 The URL of the page that was opened.

434 

435 - `FindInPage object { pattern, type, url }`

436 

437 Finds text within a web page.

438 

439 - `pattern: string or null`

440 

441 The text pattern that was searched for.

442 

443 - `type: "find_in_page"`

444 

445 The type of the object. Always `find_in_page`.

446 

447 - `"find_in_page"`

448 

449 - `url: string or null`

450 

451 The URL of the page that was searched.

452 

453 - `Other object { type }`

454 

455 Another web search action.

456 

457 - `type: "other"`

458 

459 The type of the object. Always `other`.

460 

461 - `"other"`

462 

463 - `status: AgentOutputItemStatus`

464 

465 The status of the web search call.

466 

467 - `turn_id: string`

468 

469 The ID of the turn that contains this item.

470 

471 - `type: "web_search_call"`

472 

473 The item type. Always `web_search_call`.

474 

475 - `"web_search_call"`

476 

477 - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

478 

479 A command execution produced by the agent.

480 

481 - `id: string`

482 

483 The ID of the command execution item.

484 

485 - `command: string`

486 

487 The command that was executed.

488 

489 - `cwd: string or null`

490 

491 The working directory used to execute the command.

492 

493 - `duration_ms: number or null`

494 

495 The command duration in milliseconds.

496 

497 - `exit_code: number or null`

498 

499 The process exit code, if the command completed.

500 

501 - `output: string or null`

502 

503 The command output, if available.

504 

505 - `status: AgentFunctionCallStatus`

506 

507 The status of the command execution.

508 

509 - `turn_id: string`

510 

511 The ID of the turn that contains this item.

512 

513 - `type: "command_execution"`

514 

515 The item type. Always `command_execution`.

516 

517 - `"command_execution"`

518 

519 - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

520 

521 A request to spawn a subagent.

522 

523 - `id: string`

524 

525 The ID of the tool call item.

526 

527 - `agent_id: string`

528 

529 The ID of the agent that requested the subagent.

530 

531 - `content: array of AgentContent`

532 

533 The task given to the spawned agent.

534 

535 - `OutputText object { text, type }`

536 

537 A text content part produced by the agent.

538 

539 - `EncryptedContent object { encrypted_content, type }`

540 

541 Encrypted content exchanged between agents.

542 

543 - `model: string or null`

544 

545 The model requested for the spawned agent.

546 

547 - `reasoning_effort: string or null`

548 

549 The reasoning effort requested for the spawned agent.

550 

551 - `status: AgentFunctionCallStatus`

552 

553 The status of the tool call.

554 

555 - `turn_id: string`

556 

557 The ID of the turn that contains this item.

558 

559 - `type: "create_subagent_call"`

560 

561 The item type. Always `create_subagent_call`.

562 

563 - `"create_subagent_call"`

564 

565 The current public item type.

566 

567 - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

568 

569 A request to send input to another agent.

570 

571 - `id: string`

572 

573 The ID of the tool call item.

574 

575 - `content: array of AgentContent`

576 

577 The input sent to the receiving agent.

578 

579 - `OutputText object { text, type }`

580 

581 A text content part produced by the agent.

582 

583 - `EncryptedContent object { encrypted_content, type }`

584 

585 Encrypted content exchanged between agents.

586 

587 - `recipient_agent_id: string`

588 

589 The ID of the agent receiving the input.

590 

591 - `sender_agent_id: string`

592 

593 The ID of the agent sending the input.

594 

595 - `status: AgentFunctionCallStatus`

596 

597 The status of the tool call.

598 

599 - `turn_id: string`

600 

601 The ID of the turn that contains this item.

602 

603 - `type: "send_subagent_input_call"`

604 

605 The item type. Always `send_subagent_input_call`.

606 

607 - `"send_subagent_input_call"`

608 

609 The current public item type.

610 

611 - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

612 

613 A request to resume a subagent.

614 

615 - `id: string`

616 

617 The ID of the tool call item.

618 

619 - `recipient_agent_id: string`

620 

621 The ID of the agent to resume.

622 

623 - `sender_agent_id: string`

624 

625 The ID of the agent requesting the resume.

626 

627 - `status: AgentFunctionCallStatus`

628 

629 The status of the tool call.

630 

631 - `turn_id: string`

632 

633 The ID of the turn that contains this item.

634 

635 - `type: "resume_subagent_call"`

636 

637 The item type. Always `resume_subagent_call`.

638 

639 - `"resume_subagent_call"`

640 

641 The current public item type.

642 

643 - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

644 

645 A request to wait for one or more subagents.

646 

647 - `id: string`

648 

649 The ID of the tool call item.

650 

651 - `recipient_agent_ids: array of string`

652 

653 The IDs of the agents to wait for.

654 

655 - `sender_agent_id: string`

656 

657 The ID of the agent waiting for results.

658 

659 - `status: AgentFunctionCallStatus`

660 

661 The status of the tool call.

662 

663 - `turn_id: string`

664 

665 The ID of the turn that contains this item.

666 

667 - `type: "wait_for_subagents_call"`

668 

669 The item type. Always `wait_for_subagents_call`.

670 

671 - `"wait_for_subagents_call"`

672 

673 The current public item type.

674 

675 - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

676 

677 A request to interrupt a subagent's current turn. The subagent remains available.

678 

679 - `id: string`

680 

681 The ID of the tool call item.

682 

683 - `recipient_agent_id: string`

684 

685 The ID of the agent to interrupt.

686 

687 - `sender_agent_id: string`

688 

689 The ID of the agent requesting the interrupt.

690 

691 - `status: AgentFunctionCallStatus`

692 

693 The status of the tool call.

694 

695 - `turn_id: string`

696 

697 The ID of the turn that contains this item.

698 

699 - `type: "interrupt_subagent_call"`

700 

701 The item type. Always `interrupt_subagent_call`.

702 

703 - `"interrupt_subagent_call"`

704 

705 The current public item type.

706 

707 - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

708 

709 A request to close a subagent.

710 

711 - `id: string`

712 

713 The ID of the tool call item.

714 

715 - `recipient_agent_id: string`

716 

717 The ID of the agent to close.

718 

719 - `sender_agent_id: string`

720 

721 The ID of the agent requesting the close.

722 

723 - `status: AgentFunctionCallStatus`

724 

725 The status of the tool call.

726 

727 - `turn_id: string`

728 

729 The ID of the turn that contains this item.

730 

731 - `type: "close_subagent_call"`

732 

733 The item type. Always `close_subagent_call`.

734 

735 - `"close_subagent_call"`

736 

737 The current public item type.

738 

739- `first_id: string or null`

740 

741 The ID of the first resource in `data`, or `null` if the page is empty.

742 

743- `has_more: boolean`

744 

745 Whether there are more resources to retrieve after this page.

746 

747- `last_id: string or null`

748 

749 The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

750 

751- `object: "list"`

752 

753 The object type, which is always `list`.

754 

755 - `"list"`

756 

757### Example

758 

759```http

760curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/items \

761 -H 'OpenAI-Beta: agents=v1' \

762 -H "Authorization: Bearer $OPENAI_API_KEY"

763```

764 

765#### Response

766 

767```json

768{

769 "data": [

770 {

771 "id": "id",

772 "content": [

773 {

774 "text": "text",

775 "type": "input_text"

776 }

777 ],

778 "phase": "commentary",

779 "role": "user",

780 "status": "in_progress",

781 "turn_id": "turn_id",

782 "type": "message"

783 }

784 ],

785 "first_id": "first_id",

786 "has_more": true,

787 "last_id": "last_id",

788 "object": "list"

789}

790```

Details

1## List session subagents

2 

3**get** `/agents/sessions/{session_id}/subagents`

4 

5Lists subagents in a session, including nested and closed subagents. See [subagent workflows](/api/docs/guides/agents-api/multi-agent).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11### Query Parameters

12 

13- `after: optional string`

14 

15 Return resources after this resource ID in the selected order.

16 

17- `limit: optional number`

18 

19 The maximum number of resources to return, between 1 and 100. Defaults to 20.

20 

21- `order: optional "asc" or "desc"`

22 

23 The order in which resources are returned. Defaults to `desc`.

24 

25 - `"asc"`

26 

27 Returns resources in ascending order.

28 

29 - `"desc"`

30 

31 Returns resources in descending order.

32 

33### Returns

34 

35- `data: array of Subagent`

36 

37 The resources returned in this page, in the requested sort order.

38 

39 - `id: string`

40 

41 The ID of the subagent.

42 

43 - `closed_at: number or null`

44 

45 The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

46 

47 - `instructions: array of AgentContent or null`

48 

49 Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

50 

51 - `OutputText object { text, type }`

52 

53 A text content part produced by the agent.

54 

55 - `text: string`

56 

57 The text produced by the agent.

58 

59 - `type: "output_text"`

60 

61 The content type. Always `output_text`.

62 

63 - `"output_text"`

64 

65 - `EncryptedContent object { encrypted_content, type }`

66 

67 Encrypted content exchanged between agents.

68 

69 - `encrypted_content: string`

70 

71 The encrypted content payload.

72 

73 - `type: "encrypted_content"`

74 

75 The content type. Always `encrypted_content`.

76 

77 - `"encrypted_content"`

78 

79 - `name: string or null`

80 

81 The runner-assigned nickname, or null when unavailable.

82 

83 - `object: "agent.session.subagent"`

84 

85 The object type. Always `agent.session.subagent`.

86 

87 - `"agent.session.subagent"`

88 

89 - `opened_at: number`

90 

91 The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it.

92 

93 - `parent_agent_id: string`

94 

95 The ID of the agent that created this subagent.

96 

97 - `session_id: string`

98 

99 The ID of the session that owns the subagent.

100 

101 - `status: "active" or "closed"`

102 

103 The current status of the subagent.

104 

105 - `"active"`

106 

107 The subagent remains available, including while idle between turns.

108 

109 - `"closed"`

110 

111 The subagent is closed.

112 

113- `first_id: string or null`

114 

115 The ID of the first resource in `data`, or `null` if the page is empty.

116 

117- `has_more: boolean`

118 

119 Whether there are more resources to retrieve after this page.

120 

121- `last_id: string or null`

122 

123 The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

124 

125- `object: "list"`

126 

127 The object type, which is always `list`.

128 

129 - `"list"`

130 

131### Example

132 

133```http

134curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents \

135 -H 'OpenAI-Beta: agents=v1' \

136 -H "Authorization: Bearer $OPENAI_API_KEY"

137```

138 

139#### Response

140 

141```json

142{

143 "data": [

144 {

145 "id": "id",

146 "closed_at": 0,

147 "instructions": [

148 {

149 "text": "text",

150 "type": "output_text"

151 }

152 ],

153 "name": "name",

154 "object": "agent.session.subagent",

155 "opened_at": 0,

156 "parent_agent_id": "parent_agent_id",

157 "session_id": "session_id",

158 "status": "active"

159 }

160 ],

161 "first_id": "first_id",

162 "has_more": true,

163 "last_id": "last_id",

164 "object": "list"

165}

166```

Details

1## Retrieve a session subagent

2 

3**get** `/agents/sessions/{session_id}/subagents/{subagent_id}`

4 

5Retrieves a subagent belonging to this session. See [subagent workflows](/api/docs/guides/agents-api/multi-agent).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11- `subagent_id: string`

12 

13### Returns

14 

15- `Subagent object { id, closed_at, instructions, 6 more }`

16 

17 A subagent created within a session.

18 

19 - `id: string`

20 

21 The ID of the subagent.

22 

23 - `closed_at: number or null`

24 

25 The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

26 

27 - `instructions: array of AgentContent or null`

28 

29 Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

30 

31 - `OutputText object { text, type }`

32 

33 A text content part produced by the agent.

34 

35 - `text: string`

36 

37 The text produced by the agent.

38 

39 - `type: "output_text"`

40 

41 The content type. Always `output_text`.

42 

43 - `"output_text"`

44 

45 - `EncryptedContent object { encrypted_content, type }`

46 

47 Encrypted content exchanged between agents.

48 

49 - `encrypted_content: string`

50 

51 The encrypted content payload.

52 

53 - `type: "encrypted_content"`

54 

55 The content type. Always `encrypted_content`.

56 

57 - `"encrypted_content"`

58 

59 - `name: string or null`

60 

61 The runner-assigned nickname, or null when unavailable.

62 

63 - `object: "agent.session.subagent"`

64 

65 The object type. Always `agent.session.subagent`.

66 

67 - `"agent.session.subagent"`

68 

69 - `opened_at: number`

70 

71 The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it.

72 

73 - `parent_agent_id: string`

74 

75 The ID of the agent that created this subagent.

76 

77 - `session_id: string`

78 

79 The ID of the session that owns the subagent.

80 

81 - `status: "active" or "closed"`

82 

83 The current status of the subagent.

84 

85 - `"active"`

86 

87 The subagent remains available, including while idle between turns.

88 

89 - `"closed"`

90 

91 The subagent is closed.

92 

93### Example

94 

95```http

96curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents/$SUBAGENT_ID \

97 -H 'OpenAI-Beta: agents=v1' \

98 -H "Authorization: Bearer $OPENAI_API_KEY"

99```

100 

101#### Response

102 

103```json

104{

105 "id": "id",

106 "closed_at": 0,

107 "instructions": [

108 {

109 "text": "text",

110 "type": "output_text"

111 }

112 ],

113 "name": "name",

114 "object": "agent.session.subagent",

115 "opened_at": 0,

116 "parent_agent_id": "parent_agent_id",

117 "session_id": "session_id",

118 "status": "active"

119}

120```

Details

1## List subagent items

2 

3**get** `/agents/sessions/{session_id}/subagents/{subagent_id}/items`

4 

5Lists this subagent's own items across all of its turns. See [subagent workflows](/api/docs/guides/agents-api/multi-agent).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11- `subagent_id: string`

12 

13### Query Parameters

14 

15- `after: optional string`

16 

17 Return resources after this resource ID in the selected order.

18 

19- `limit: optional number`

20 

21 The maximum number of resources to return, between 1 and 100. Defaults to 20.

22 

23- `order: optional "asc" or "desc"`

24 

25 The order in which resources are returned. Defaults to `desc`.

26 

27 - `"asc"`

28 

29 Returns resources in ascending order.

30 

31 - `"desc"`

32 

33 Returns resources in descending order.

34 

35### Returns

36 

37- `data: array of AgentSessionItem`

38 

39 The resources returned in this page, in the requested sort order.

40 

41 - `AgentSessionMessage object { id, content, phase, 4 more }`

42 

43 A user or assistant message recorded in a session.

44 

45 - `id: string or null`

46 

47 The ID of this item, or null for legacy user messages whose ID was not recorded.

48 

49 - `content: array of AgentSessionMessageContent`

50 

51 The content of the message. User messages contain input text or images; assistant messages contain output text.

52 

53 - `InputText object { text, type }`

54 

55 Text supplied by the user.

56 

57 - `text: string`

58 

59 The text supplied by the user.

60 

61 - `type: "input_text"`

62 

63 The type of the object. Always `input_text`.

64 

65 - `"input_text"`

66 

67 - `InputImage object { image_url, type }`

68 

69 An image supplied by the user.

70 

71 - `image_url: string`

72 

73 The URL of the image supplied by the user, which may be a base64-encoded data URL.

74 

75 - `type: "input_image"`

76 

77 The type of the object. Always `input_image`.

78 

79 - `"input_image"`

80 

81 - `OutputText object { text, type }`

82 

83 Text produced by the assistant.

84 

85 - `text: string`

86 

87 The text produced by the assistant.

88 

89 - `type: "output_text"`

90 

91 The type of the object. Always `output_text`.

92 

93 - `"output_text"`

94 

95 - `phase: "commentary" or "final_answer" or null`

96 

97 The phase of an assistant message.

98 

99 - `"commentary"`

100 

101 Commentary produced while the agent works.

102 

103 - `"final_answer"`

104 

105 The agent's final answer.

106 

107 - `role: "user" or "assistant"`

108 

109 The role of the message author.

110 

111 - `"user"`

112 

113 - `"assistant"`

114 

115 - `status: AgentOutputItemStatus`

116 

117 The status of the message. User messages are always `completed`.

118 

119 - `"in_progress"`

120 

121 The item is in progress.

122 

123 - `"completed"`

124 

125 The item is complete.

126 

127 - `"incomplete"`

128 

129 The item stopped before completing.

130 

131 - `turn_id: string`

132 

133 The ID of the turn that contains this item.

134 

135 - `type: "message"`

136 

137 The item type. Always `message`.

138 

139 - `"message"`

140 

141 - `AgentReasoningItem object { id, status, summary, 2 more }`

142 

143 A reasoning item produced by the agent.

144 

145 - `id: string`

146 

147 The ID of the reasoning item.

148 

149 - `status: AgentOutputItemStatus or null`

150 

151 The status of an agent output item.

152 

153 - `summary: array of SummaryText`

154 

155 The reasoning summaries produced by the agent.

156 

157 - `text: string`

158 

159 The reasoning summary text.

160 

161 - `type: "summary_text"`

162 

163 The content type. Always `summary_text`.

164 

165 - `"summary_text"`

166 

167 - `turn_id: string`

168 

169 The ID of the turn that contains this item.

170 

171 - `type: "reasoning"`

172 

173 The item type. Always `reasoning`.

174 

175 - `"reasoning"`

176 

177 - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

178 

179 A function call produced by the agent.

180 

181 - `id: string`

182 

183 The ID of the function call item.

184 

185 - `arguments: unknown`

186 

187 The arguments to pass to the function.

188 

189 - `call_id: string`

190 

191 The ID used to submit the function result.

192 

193 - `name: string`

194 

195 The name of the function to call.

196 

197 - `status: AgentFunctionCallStatus`

198 

199 The status of the function call.

200 

201 - `"in_progress"`

202 

203 The call is in progress.

204 

205 - `"completed"`

206 

207 The call completed successfully.

208 

209 - `"failed"`

210 

211 The call failed.

212 

213 - `"incomplete"`

214 

215 The call stopped before completing.

216 

217 - `turn_id: string`

218 

219 The ID of the turn that contains this item.

220 

221 - `type: "function_call"`

222 

223 The item type. Always `function_call`.

224 

225 - `"function_call"`

226 

227 - `FunctionCallOutput object { id, call_id, error, 4 more }`

228 

229 The result supplied for a function call.

230 

231 - `id: string`

232 

233 The ID of the function call output item.

234 

235 - `call_id: string`

236 

237 The ID of the function call that produced this output.

238 

239 - `error: string or null`

240 

241 The error message, if the call failed.

242 

243 - `output: AgentFunctionCallOutput or null`

244 

245 The text or model-input content supplied as a function result.

246 

247 - `string`

248 

249 - `array of InputContent`

250 

251 - `InputText object { text, type }`

252 

253 Text input recorded in a session item.

254 

255 - `text: string`

256 

257 The text supplied to the agent.

258 

259 - `type: "input_text"`

260 

261 The type of the object. Always `input_text`.

262 

263 - `"input_text"`

264 

265 - `InputImage object { image_url, type }`

266 

267 Image input recorded in a session item.

268 

269 - `image_url: string`

270 

271 The URL of the image supplied to the agent, which may be a base64-encoded data URL.

272 

273 - `type: "input_image"`

274 

275 The type of the object. Always `input_image`.

276 

277 - `"input_image"`

278 

279 - `status: AgentFunctionCallStatus`

280 

281 The status of the function call.

282 

283 - `turn_id: string`

284 

285 The ID of the turn that contains this item.

286 

287 - `type: "function_call_output"`

288 

289 The item type. Always `function_call_output`.

290 

291 - `"function_call_output"`

292 

293 - `AgentMessage object { id, content, recipient_agent_id, 3 more }`

294 

295 A message exchanged between agent threads.

296 

297 - `id: string`

298 

299 The ID of the message.

300 

301 - `content: array of AgentContent`

302 

303 The content exchanged between the agents.

304 

305 - `OutputText object { text, type }`

306 

307 A text content part produced by the agent.

308 

309 - `text: string`

310 

311 The text produced by the agent.

312 

313 - `type: "output_text"`

314 

315 The content type. Always `output_text`.

316 

317 - `"output_text"`

318 

319 - `EncryptedContent object { encrypted_content, type }`

320 

321 Encrypted content exchanged between agents.

322 

323 - `encrypted_content: string`

324 

325 The encrypted content payload.

326 

327 - `type: "encrypted_content"`

328 

329 The content type. Always `encrypted_content`.

330 

331 - `"encrypted_content"`

332 

333 - `recipient_agent_id: string`

334 

335 The ID or name of the receiving agent.

336 

337 - `sender_agent_id: string`

338 

339 The ID or name of the sending agent.

340 

341 - `turn_id: string`

342 

343 The ID of the turn that contains this item.

344 

345 - `type: "agent_message"`

346 

347 The item type. Always `agent_message`.

348 

349 - `"agent_message"`

350 

351 - `AgentMcpCallItem object { id, arguments, error, 6 more }`

352 

353 A call to a tool on an MCP server.

354 

355 - `id: string`

356 

357 The ID of the MCP call item.

358 

359 - `arguments: unknown`

360 

361 The arguments passed to the MCP tool.

362 

363 - `error: unknown`

364 

365 The error returned by the MCP tool, if any.

366 

367 - `name: string`

368 

369 The name of the MCP tool.

370 

371 - `output: unknown`

372 

373 The output returned by the MCP tool, if any.

374 

375 - `server_label: string`

376 

377 The label of the MCP server.

378 

379 - `status: AgentFunctionCallStatus`

380 

381 The status of the MCP tool call.

382 

383 - `turn_id: string`

384 

385 The ID of the turn that contains this item.

386 

387 - `type: "mcp_call"`

388 

389 The item type. Always `mcp_call`.

390 

391 - `"mcp_call"`

392 

393 - `AgentWebSearchCallItem object { id, action, status, 2 more }`

394 

395 A web search call produced by the agent.

396 

397 - `id: string`

398 

399 The ID of the web search call.

400 

401 - `action: WebSearchAction or null`

402 

403 An action performed by the web search tool.

404 

405 - `Search object { queries, query, type }`

406 

407 A search query or group of search queries.

408 

409 - `queries: array of string or null`

410 

411 The search queries, when multiple queries were used.

412 

413 - `query: string or null`

414 

415 The search query, when a single query was used.

416 

417 - `type: "search"`

418 

419 The type of the object. Always `search`.

420 

421 - `"search"`

422 

423 - `OpenPage object { type, url }`

424 

425 Opens a web page.

426 

427 - `type: "open_page"`

428 

429 The type of the object. Always `open_page`.

430 

431 - `"open_page"`

432 

433 - `url: string or null`

434 

435 The URL of the page that was opened.

436 

437 - `FindInPage object { pattern, type, url }`

438 

439 Finds text within a web page.

440 

441 - `pattern: string or null`

442 

443 The text pattern that was searched for.

444 

445 - `type: "find_in_page"`

446 

447 The type of the object. Always `find_in_page`.

448 

449 - `"find_in_page"`

450 

451 - `url: string or null`

452 

453 The URL of the page that was searched.

454 

455 - `Other object { type }`

456 

457 Another web search action.

458 

459 - `type: "other"`

460 

461 The type of the object. Always `other`.

462 

463 - `"other"`

464 

465 - `status: AgentOutputItemStatus`

466 

467 The status of the web search call.

468 

469 - `turn_id: string`

470 

471 The ID of the turn that contains this item.

472 

473 - `type: "web_search_call"`

474 

475 The item type. Always `web_search_call`.

476 

477 - `"web_search_call"`

478 

479 - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

480 

481 A command execution produced by the agent.

482 

483 - `id: string`

484 

485 The ID of the command execution item.

486 

487 - `command: string`

488 

489 The command that was executed.

490 

491 - `cwd: string or null`

492 

493 The working directory used to execute the command.

494 

495 - `duration_ms: number or null`

496 

497 The command duration in milliseconds.

498 

499 - `exit_code: number or null`

500 

501 The process exit code, if the command completed.

502 

503 - `output: string or null`

504 

505 The command output, if available.

506 

507 - `status: AgentFunctionCallStatus`

508 

509 The status of the command execution.

510 

511 - `turn_id: string`

512 

513 The ID of the turn that contains this item.

514 

515 - `type: "command_execution"`

516 

517 The item type. Always `command_execution`.

518 

519 - `"command_execution"`

520 

521 - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

522 

523 A request to spawn a subagent.

524 

525 - `id: string`

526 

527 The ID of the tool call item.

528 

529 - `agent_id: string`

530 

531 The ID of the agent that requested the subagent.

532 

533 - `content: array of AgentContent`

534 

535 The task given to the spawned agent.

536 

537 - `OutputText object { text, type }`

538 

539 A text content part produced by the agent.

540 

541 - `EncryptedContent object { encrypted_content, type }`

542 

543 Encrypted content exchanged between agents.

544 

545 - `model: string or null`

546 

547 The model requested for the spawned agent.

548 

549 - `reasoning_effort: string or null`

550 

551 The reasoning effort requested for the spawned agent.

552 

553 - `status: AgentFunctionCallStatus`

554 

555 The status of the tool call.

556 

557 - `turn_id: string`

558 

559 The ID of the turn that contains this item.

560 

561 - `type: "create_subagent_call"`

562 

563 The item type. Always `create_subagent_call`.

564 

565 - `"create_subagent_call"`

566 

567 The current public item type.

568 

569 - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

570 

571 A request to send input to another agent.

572 

573 - `id: string`

574 

575 The ID of the tool call item.

576 

577 - `content: array of AgentContent`

578 

579 The input sent to the receiving agent.

580 

581 - `OutputText object { text, type }`

582 

583 A text content part produced by the agent.

584 

585 - `EncryptedContent object { encrypted_content, type }`

586 

587 Encrypted content exchanged between agents.

588 

589 - `recipient_agent_id: string`

590 

591 The ID of the agent receiving the input.

592 

593 - `sender_agent_id: string`

594 

595 The ID of the agent sending the input.

596 

597 - `status: AgentFunctionCallStatus`

598 

599 The status of the tool call.

600 

601 - `turn_id: string`

602 

603 The ID of the turn that contains this item.

604 

605 - `type: "send_subagent_input_call"`

606 

607 The item type. Always `send_subagent_input_call`.

608 

609 - `"send_subagent_input_call"`

610 

611 The current public item type.

612 

613 - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

614 

615 A request to resume a subagent.

616 

617 - `id: string`

618 

619 The ID of the tool call item.

620 

621 - `recipient_agent_id: string`

622 

623 The ID of the agent to resume.

624 

625 - `sender_agent_id: string`

626 

627 The ID of the agent requesting the resume.

628 

629 - `status: AgentFunctionCallStatus`

630 

631 The status of the tool call.

632 

633 - `turn_id: string`

634 

635 The ID of the turn that contains this item.

636 

637 - `type: "resume_subagent_call"`

638 

639 The item type. Always `resume_subagent_call`.

640 

641 - `"resume_subagent_call"`

642 

643 The current public item type.

644 

645 - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

646 

647 A request to wait for one or more subagents.

648 

649 - `id: string`

650 

651 The ID of the tool call item.

652 

653 - `recipient_agent_ids: array of string`

654 

655 The IDs of the agents to wait for.

656 

657 - `sender_agent_id: string`

658 

659 The ID of the agent waiting for results.

660 

661 - `status: AgentFunctionCallStatus`

662 

663 The status of the tool call.

664 

665 - `turn_id: string`

666 

667 The ID of the turn that contains this item.

668 

669 - `type: "wait_for_subagents_call"`

670 

671 The item type. Always `wait_for_subagents_call`.

672 

673 - `"wait_for_subagents_call"`

674 

675 The current public item type.

676 

677 - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

678 

679 A request to interrupt a subagent's current turn. The subagent remains available.

680 

681 - `id: string`

682 

683 The ID of the tool call item.

684 

685 - `recipient_agent_id: string`

686 

687 The ID of the agent to interrupt.

688 

689 - `sender_agent_id: string`

690 

691 The ID of the agent requesting the interrupt.

692 

693 - `status: AgentFunctionCallStatus`

694 

695 The status of the tool call.

696 

697 - `turn_id: string`

698 

699 The ID of the turn that contains this item.

700 

701 - `type: "interrupt_subagent_call"`

702 

703 The item type. Always `interrupt_subagent_call`.

704 

705 - `"interrupt_subagent_call"`

706 

707 The current public item type.

708 

709 - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

710 

711 A request to close a subagent.

712 

713 - `id: string`

714 

715 The ID of the tool call item.

716 

717 - `recipient_agent_id: string`

718 

719 The ID of the agent to close.

720 

721 - `sender_agent_id: string`

722 

723 The ID of the agent requesting the close.

724 

725 - `status: AgentFunctionCallStatus`

726 

727 The status of the tool call.

728 

729 - `turn_id: string`

730 

731 The ID of the turn that contains this item.

732 

733 - `type: "close_subagent_call"`

734 

735 The item type. Always `close_subagent_call`.

736 

737 - `"close_subagent_call"`

738 

739 The current public item type.

740 

741- `first_id: string or null`

742 

743 The ID of the first resource in `data`, or `null` if the page is empty.

744 

745- `has_more: boolean`

746 

747 Whether there are more resources to retrieve after this page.

748 

749- `last_id: string or null`

750 

751 The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

752 

753- `object: "list"`

754 

755 The object type, which is always `list`.

756 

757 - `"list"`

758 

759### Example

760 

761```http

762curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents/$SUBAGENT_ID/items \

763 -H 'OpenAI-Beta: agents=v1' \

764 -H "Authorization: Bearer $OPENAI_API_KEY"

765```

766 

767#### Response

768 

769```json

770{

771 "data": [

772 {

773 "id": "id",

774 "content": [

775 {

776 "text": "text",

777 "type": "input_text"

778 }

779 ],

780 "phase": "commentary",

781 "role": "user",

782 "status": "in_progress",

783 "turn_id": "turn_id",

784 "type": "message"

785 }

786 ],

787 "first_id": "first_id",

788 "has_more": true,

789 "last_id": "last_id",

790 "object": "list"

791}

792```

Details

1## List subagent turns

2 

3**get** `/agents/sessions/{session_id}/subagents/{subagent_id}/turns`

4 

5Lists all turns of this subagent, including turns after a resume. See [subagent workflows](/api/docs/guides/agents-api/multi-agent).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11- `subagent_id: string`

12 

13### Query Parameters

14 

15- `after: optional string`

16 

17 Return resources after this resource ID in the selected order.

18 

19- `limit: optional number`

20 

21 The maximum number of resources to return, between 1 and 100. Defaults to 20.

22 

23- `order: optional "asc" or "desc"`

24 

25 The order in which resources are returned. Defaults to `desc`.

26 

27 - `"asc"`

28 

29 Returns resources in ascending order.

30 

31 - `"desc"`

32 

33 Returns resources in descending order.

34 

35### Returns

36 

37- `data: array of Turn`

38 

39 The resources returned in this page, in the requested sort order.

40 

41 - `id: string`

42 

43 The ID of the turn.

44 

45 - `agent_id: string`

46 

47 The ID of the agent that ran the turn.

48 

49 - `completed_at: number or null`

50 

51 The Unix timestamp, in seconds, when the turn reached a terminal state.

52 

53 - `created_at: number`

54 

55 The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

56 

57 - `error: SessionTurnError or null`

58 

59 A customer-safe error describing why a session request failed.

60 

61 - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 14 more`

62 

63 A stable, machine-readable failure category.

64 

65 - `"context_length_exceeded"`

66 

67 The request exceeds the model's context window.

68 

69 - `"session_budget_exceeded"`

70 

71 The session has reached its usage budget.

72 

73 - `"usage_limit_exceeded"`

74 

75 The organization has reached a usage, plan, or billing limit.

76 

77 - `"credit_balance_exhausted"`

78 

79 The organization has no API credits remaining.

80 

81 - `"rate_limit_exceeded"`

82 

83 The request exceeds the available rate limit.

84 

85 - `"server_overloaded"`

86 

87 The model service is temporarily overloaded.

88 

89 - `"cyber_policy"`

90 

91 The request was rejected by a safety policy.

92 

93 - `"connection_failed"`

94 

95 The request could not connect to the model service.

96 

97 - `"server_error"`

98 

99 The model service encountered an unexpected error.

100 

101 - `"authentication_error"`

102 

103 The API credentials are invalid or lack the required access.

104 

105 - `"invalid_request"`

106 

107 The request contains invalid input or configuration.

108 

109 - `"resource_not_found"`

110 

111 The requested model or resource is unavailable.

112 

113 - `"sandbox_error"`

114 

115 The request could not complete in its execution environment.

116 

117 - `"executor_version_incompatible"`

118 

119 The executor must be upgraded before it can run this turn.

120 

121 - `"active_turn_not_steerable"`

122 

123 The session cannot accept additional input while a request is running.

124 

125 - `"request_timeout"`

126 

127 The request timed out before the model service responded.

128 

129 - `"internal_error"`

130 

131 An unexpected internal error prevented the session request from completing.

132 

133 - `message: string`

134 

135 A customer-safe explanation of the failure.

136 

137 - `object: "agent.session.turn"`

138 

139 The object type. Always `agent.session.turn`.

140 

141 - `"agent.session.turn"`

142 

143 - `session_id: string`

144 

145 The ID of the session that owns the turn.

146 

147 - `started_at: number or null`

148 

149 The Unix timestamp, in seconds, when the turn started.

150 

151 - `status: "queued" or "in_progress" or "waiting" or 3 more`

152 

153 The current status of the turn.

154 

155 - `"queued"`

156 

157 The turn is waiting to start.

158 

159 - `"in_progress"`

160 

161 The turn is in progress.

162 

163 - `"waiting"`

164 

165 The turn is waiting for external input.

166 

167 - `"completed"`

168 

169 The turn completed successfully.

170 

171 - `"failed"`

172 

173 The turn failed.

174 

175 - `"cancelled"`

176 

177 The turn was cancelled.

178 

179 - `subagent_id: string or null`

180 

181 The ID of the subagent that ran the turn, if applicable.

182 

183 - `usage: TokenUsage or null`

184 

185 Recorded token usage for a session or turn. Usage is best effort and may change.

186 

187 - `input_tokens: number`

188 

189 The number of input tokens used by the agent.

190 

191 - `input_tokens_details: object { cached_tokens }`

192 

193 A breakdown of the agent's input token usage.

194 

195 - `cached_tokens: number`

196 

197 The number of input tokens retrieved from the prompt cache.

198 

199 - `output_tokens: number`

200 

201 The number of output tokens generated by the agent.

202 

203 - `output_tokens_details: object { reasoning_tokens }`

204 

205 A breakdown of the agent's output token usage.

206 

207 - `reasoning_tokens: number`

208 

209 The number of output tokens used for reasoning.

210 

211 - `total_tokens: number`

212 

213 The total number of input and output tokens used by the agent.

214 

215- `first_id: string or null`

216 

217 The ID of the first resource in `data`, or `null` if the page is empty.

218 

219- `has_more: boolean`

220 

221 Whether there are more resources to retrieve after this page.

222 

223- `last_id: string or null`

224 

225 The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

226 

227- `object: "list"`

228 

229 The object type, which is always `list`.

230 

231 - `"list"`

232 

233### Example

234 

235```http

236curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents/$SUBAGENT_ID/turns \

237 -H 'OpenAI-Beta: agents=v1' \

238 -H "Authorization: Bearer $OPENAI_API_KEY"

239```

240 

241#### Response

242 

243```json

244{

245 "data": [

246 {

247 "id": "id",

248 "agent_id": "agent_id",

249 "completed_at": 0,

250 "created_at": 0,

251 "error": {

252 "code": "context_length_exceeded",

253 "message": "message"

254 },

255 "object": "agent.session.turn",

256 "session_id": "session_id",

257 "started_at": 0,

258 "status": "queued",

259 "subagent_id": "subagent_id",

260 "usage": {

261 "input_tokens": 0,

262 "input_tokens_details": {

263 "cached_tokens": 0

264 },

265 "output_tokens": 0,

266 "output_tokens_details": {

267 "reasoning_tokens": 0

268 },

269 "total_tokens": 0

270 }

271 }

272 ],

273 "first_id": "first_id",

274 "has_more": true,

275 "last_id": "last_id",

276 "object": "list"

277}

278```

Details

1## Retrieve a subagent turn

2 

3**get** `/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}`

4 

5Retrieves a turn belonging to this subagent. See [subagent workflows](/api/docs/guides/agents-api/multi-agent).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11- `subagent_id: string`

12 

13- `turn_id: string`

14 

15### Returns

16 

17- `Turn object { id, agent_id, completed_at, 8 more }`

18 

19 The canonical public representation of a session turn.

20 

21 - `id: string`

22 

23 The ID of the turn.

24 

25 - `agent_id: string`

26 

27 The ID of the agent that ran the turn.

28 

29 - `completed_at: number or null`

30 

31 The Unix timestamp, in seconds, when the turn reached a terminal state.

32 

33 - `created_at: number`

34 

35 The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

36 

37 - `error: SessionTurnError or null`

38 

39 A customer-safe error describing why a session request failed.

40 

41 - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 14 more`

42 

43 A stable, machine-readable failure category.

44 

45 - `"context_length_exceeded"`

46 

47 The request exceeds the model's context window.

48 

49 - `"session_budget_exceeded"`

50 

51 The session has reached its usage budget.

52 

53 - `"usage_limit_exceeded"`

54 

55 The organization has reached a usage, plan, or billing limit.

56 

57 - `"credit_balance_exhausted"`

58 

59 The organization has no API credits remaining.

60 

61 - `"rate_limit_exceeded"`

62 

63 The request exceeds the available rate limit.

64 

65 - `"server_overloaded"`

66 

67 The model service is temporarily overloaded.

68 

69 - `"cyber_policy"`

70 

71 The request was rejected by a safety policy.

72 

73 - `"connection_failed"`

74 

75 The request could not connect to the model service.

76 

77 - `"server_error"`

78 

79 The model service encountered an unexpected error.

80 

81 - `"authentication_error"`

82 

83 The API credentials are invalid or lack the required access.

84 

85 - `"invalid_request"`

86 

87 The request contains invalid input or configuration.

88 

89 - `"resource_not_found"`

90 

91 The requested model or resource is unavailable.

92 

93 - `"sandbox_error"`

94 

95 The request could not complete in its execution environment.

96 

97 - `"executor_version_incompatible"`

98 

99 The executor must be upgraded before it can run this turn.

100 

101 - `"active_turn_not_steerable"`

102 

103 The session cannot accept additional input while a request is running.

104 

105 - `"request_timeout"`

106 

107 The request timed out before the model service responded.

108 

109 - `"internal_error"`

110 

111 An unexpected internal error prevented the session request from completing.

112 

113 - `message: string`

114 

115 A customer-safe explanation of the failure.

116 

117 - `object: "agent.session.turn"`

118 

119 The object type. Always `agent.session.turn`.

120 

121 - `"agent.session.turn"`

122 

123 - `session_id: string`

124 

125 The ID of the session that owns the turn.

126 

127 - `started_at: number or null`

128 

129 The Unix timestamp, in seconds, when the turn started.

130 

131 - `status: "queued" or "in_progress" or "waiting" or 3 more`

132 

133 The current status of the turn.

134 

135 - `"queued"`

136 

137 The turn is waiting to start.

138 

139 - `"in_progress"`

140 

141 The turn is in progress.

142 

143 - `"waiting"`

144 

145 The turn is waiting for external input.

146 

147 - `"completed"`

148 

149 The turn completed successfully.

150 

151 - `"failed"`

152 

153 The turn failed.

154 

155 - `"cancelled"`

156 

157 The turn was cancelled.

158 

159 - `subagent_id: string or null`

160 

161 The ID of the subagent that ran the turn, if applicable.

162 

163 - `usage: TokenUsage or null`

164 

165 Recorded token usage for a session or turn. Usage is best effort and may change.

166 

167 - `input_tokens: number`

168 

169 The number of input tokens used by the agent.

170 

171 - `input_tokens_details: object { cached_tokens }`

172 

173 A breakdown of the agent's input token usage.

174 

175 - `cached_tokens: number`

176 

177 The number of input tokens retrieved from the prompt cache.

178 

179 - `output_tokens: number`

180 

181 The number of output tokens generated by the agent.

182 

183 - `output_tokens_details: object { reasoning_tokens }`

184 

185 A breakdown of the agent's output token usage.

186 

187 - `reasoning_tokens: number`

188 

189 The number of output tokens used for reasoning.

190 

191 - `total_tokens: number`

192 

193 The total number of input and output tokens used by the agent.

194 

195### Example

196 

197```http

198curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents/$SUBAGENT_ID/turns/$TURN_ID \

199 -H 'OpenAI-Beta: agents=v1' \

200 -H "Authorization: Bearer $OPENAI_API_KEY"

201```

202 

203#### Response

204 

205```json

206{

207 "id": "id",

208 "agent_id": "agent_id",

209 "completed_at": 0,

210 "created_at": 0,

211 "error": {

212 "code": "context_length_exceeded",

213 "message": "message"

214 },

215 "object": "agent.session.turn",

216 "session_id": "session_id",

217 "started_at": 0,

218 "status": "queued",

219 "subagent_id": "subagent_id",

220 "usage": {

221 "input_tokens": 0,

222 "input_tokens_details": {

223 "cached_tokens": 0

224 },

225 "output_tokens": 0,

226 "output_tokens_details": {

227 "reasoning_tokens": 0

228 },

229 "total_tokens": 0

230 }

231}

232```

Details

1## List subagent turn items

2 

3**get** `/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}/items`

4 

5Lists items belonging to one turn of this subagent. See [subagent workflows](/api/docs/guides/agents-api/multi-agent).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11- `subagent_id: string`

12 

13- `turn_id: string`

14 

15### Query Parameters

16 

17- `after: optional string`

18 

19 Return resources after this resource ID in the selected order.

20 

21- `limit: optional number`

22 

23 The maximum number of resources to return, between 1 and 100. Defaults to 20.

24 

25- `order: optional "asc" or "desc"`

26 

27 The order in which resources are returned. Defaults to `desc`.

28 

29 - `"asc"`

30 

31 Returns resources in ascending order.

32 

33 - `"desc"`

34 

35 Returns resources in descending order.

36 

37### Returns

38 

39- `data: array of AgentSessionItem`

40 

41 The resources returned in this page, in the requested sort order.

42 

43 - `AgentSessionMessage object { id, content, phase, 4 more }`

44 

45 A user or assistant message recorded in a session.

46 

47 - `id: string or null`

48 

49 The ID of this item, or null for legacy user messages whose ID was not recorded.

50 

51 - `content: array of AgentSessionMessageContent`

52 

53 The content of the message. User messages contain input text or images; assistant messages contain output text.

54 

55 - `InputText object { text, type }`

56 

57 Text supplied by the user.

58 

59 - `text: string`

60 

61 The text supplied by the user.

62 

63 - `type: "input_text"`

64 

65 The type of the object. Always `input_text`.

66 

67 - `"input_text"`

68 

69 - `InputImage object { image_url, type }`

70 

71 An image supplied by the user.

72 

73 - `image_url: string`

74 

75 The URL of the image supplied by the user, which may be a base64-encoded data URL.

76 

77 - `type: "input_image"`

78 

79 The type of the object. Always `input_image`.

80 

81 - `"input_image"`

82 

83 - `OutputText object { text, type }`

84 

85 Text produced by the assistant.

86 

87 - `text: string`

88 

89 The text produced by the assistant.

90 

91 - `type: "output_text"`

92 

93 The type of the object. Always `output_text`.

94 

95 - `"output_text"`

96 

97 - `phase: "commentary" or "final_answer" or null`

98 

99 The phase of an assistant message.

100 

101 - `"commentary"`

102 

103 Commentary produced while the agent works.

104 

105 - `"final_answer"`

106 

107 The agent's final answer.

108 

109 - `role: "user" or "assistant"`

110 

111 The role of the message author.

112 

113 - `"user"`

114 

115 - `"assistant"`

116 

117 - `status: AgentOutputItemStatus`

118 

119 The status of the message. User messages are always `completed`.

120 

121 - `"in_progress"`

122 

123 The item is in progress.

124 

125 - `"completed"`

126 

127 The item is complete.

128 

129 - `"incomplete"`

130 

131 The item stopped before completing.

132 

133 - `turn_id: string`

134 

135 The ID of the turn that contains this item.

136 

137 - `type: "message"`

138 

139 The item type. Always `message`.

140 

141 - `"message"`

142 

143 - `AgentReasoningItem object { id, status, summary, 2 more }`

144 

145 A reasoning item produced by the agent.

146 

147 - `id: string`

148 

149 The ID of the reasoning item.

150 

151 - `status: AgentOutputItemStatus or null`

152 

153 The status of an agent output item.

154 

155 - `summary: array of SummaryText`

156 

157 The reasoning summaries produced by the agent.

158 

159 - `text: string`

160 

161 The reasoning summary text.

162 

163 - `type: "summary_text"`

164 

165 The content type. Always `summary_text`.

166 

167 - `"summary_text"`

168 

169 - `turn_id: string`

170 

171 The ID of the turn that contains this item.

172 

173 - `type: "reasoning"`

174 

175 The item type. Always `reasoning`.

176 

177 - `"reasoning"`

178 

179 - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

180 

181 A function call produced by the agent.

182 

183 - `id: string`

184 

185 The ID of the function call item.

186 

187 - `arguments: unknown`

188 

189 The arguments to pass to the function.

190 

191 - `call_id: string`

192 

193 The ID used to submit the function result.

194 

195 - `name: string`

196 

197 The name of the function to call.

198 

199 - `status: AgentFunctionCallStatus`

200 

201 The status of the function call.

202 

203 - `"in_progress"`

204 

205 The call is in progress.

206 

207 - `"completed"`

208 

209 The call completed successfully.

210 

211 - `"failed"`

212 

213 The call failed.

214 

215 - `"incomplete"`

216 

217 The call stopped before completing.

218 

219 - `turn_id: string`

220 

221 The ID of the turn that contains this item.

222 

223 - `type: "function_call"`

224 

225 The item type. Always `function_call`.

226 

227 - `"function_call"`

228 

229 - `FunctionCallOutput object { id, call_id, error, 4 more }`

230 

231 The result supplied for a function call.

232 

233 - `id: string`

234 

235 The ID of the function call output item.

236 

237 - `call_id: string`

238 

239 The ID of the function call that produced this output.

240 

241 - `error: string or null`

242 

243 The error message, if the call failed.

244 

245 - `output: AgentFunctionCallOutput or null`

246 

247 The text or model-input content supplied as a function result.

248 

249 - `string`

250 

251 - `array of InputContent`

252 

253 - `InputText object { text, type }`

254 

255 Text input recorded in a session item.

256 

257 - `text: string`

258 

259 The text supplied to the agent.

260 

261 - `type: "input_text"`

262 

263 The type of the object. Always `input_text`.

264 

265 - `"input_text"`

266 

267 - `InputImage object { image_url, type }`

268 

269 Image input recorded in a session item.

270 

271 - `image_url: string`

272 

273 The URL of the image supplied to the agent, which may be a base64-encoded data URL.

274 

275 - `type: "input_image"`

276 

277 The type of the object. Always `input_image`.

278 

279 - `"input_image"`

280 

281 - `status: AgentFunctionCallStatus`

282 

283 The status of the function call.

284 

285 - `turn_id: string`

286 

287 The ID of the turn that contains this item.

288 

289 - `type: "function_call_output"`

290 

291 The item type. Always `function_call_output`.

292 

293 - `"function_call_output"`

294 

295 - `AgentMessage object { id, content, recipient_agent_id, 3 more }`

296 

297 A message exchanged between agent threads.

298 

299 - `id: string`

300 

301 The ID of the message.

302 

303 - `content: array of AgentContent`

304 

305 The content exchanged between the agents.

306 

307 - `OutputText object { text, type }`

308 

309 A text content part produced by the agent.

310 

311 - `text: string`

312 

313 The text produced by the agent.

314 

315 - `type: "output_text"`

316 

317 The content type. Always `output_text`.

318 

319 - `"output_text"`

320 

321 - `EncryptedContent object { encrypted_content, type }`

322 

323 Encrypted content exchanged between agents.

324 

325 - `encrypted_content: string`

326 

327 The encrypted content payload.

328 

329 - `type: "encrypted_content"`

330 

331 The content type. Always `encrypted_content`.

332 

333 - `"encrypted_content"`

334 

335 - `recipient_agent_id: string`

336 

337 The ID or name of the receiving agent.

338 

339 - `sender_agent_id: string`

340 

341 The ID or name of the sending agent.

342 

343 - `turn_id: string`

344 

345 The ID of the turn that contains this item.

346 

347 - `type: "agent_message"`

348 

349 The item type. Always `agent_message`.

350 

351 - `"agent_message"`

352 

353 - `AgentMcpCallItem object { id, arguments, error, 6 more }`

354 

355 A call to a tool on an MCP server.

356 

357 - `id: string`

358 

359 The ID of the MCP call item.

360 

361 - `arguments: unknown`

362 

363 The arguments passed to the MCP tool.

364 

365 - `error: unknown`

366 

367 The error returned by the MCP tool, if any.

368 

369 - `name: string`

370 

371 The name of the MCP tool.

372 

373 - `output: unknown`

374 

375 The output returned by the MCP tool, if any.

376 

377 - `server_label: string`

378 

379 The label of the MCP server.

380 

381 - `status: AgentFunctionCallStatus`

382 

383 The status of the MCP tool call.

384 

385 - `turn_id: string`

386 

387 The ID of the turn that contains this item.

388 

389 - `type: "mcp_call"`

390 

391 The item type. Always `mcp_call`.

392 

393 - `"mcp_call"`

394 

395 - `AgentWebSearchCallItem object { id, action, status, 2 more }`

396 

397 A web search call produced by the agent.

398 

399 - `id: string`

400 

401 The ID of the web search call.

402 

403 - `action: WebSearchAction or null`

404 

405 An action performed by the web search tool.

406 

407 - `Search object { queries, query, type }`

408 

409 A search query or group of search queries.

410 

411 - `queries: array of string or null`

412 

413 The search queries, when multiple queries were used.

414 

415 - `query: string or null`

416 

417 The search query, when a single query was used.

418 

419 - `type: "search"`

420 

421 The type of the object. Always `search`.

422 

423 - `"search"`

424 

425 - `OpenPage object { type, url }`

426 

427 Opens a web page.

428 

429 - `type: "open_page"`

430 

431 The type of the object. Always `open_page`.

432 

433 - `"open_page"`

434 

435 - `url: string or null`

436 

437 The URL of the page that was opened.

438 

439 - `FindInPage object { pattern, type, url }`

440 

441 Finds text within a web page.

442 

443 - `pattern: string or null`

444 

445 The text pattern that was searched for.

446 

447 - `type: "find_in_page"`

448 

449 The type of the object. Always `find_in_page`.

450 

451 - `"find_in_page"`

452 

453 - `url: string or null`

454 

455 The URL of the page that was searched.

456 

457 - `Other object { type }`

458 

459 Another web search action.

460 

461 - `type: "other"`

462 

463 The type of the object. Always `other`.

464 

465 - `"other"`

466 

467 - `status: AgentOutputItemStatus`

468 

469 The status of the web search call.

470 

471 - `turn_id: string`

472 

473 The ID of the turn that contains this item.

474 

475 - `type: "web_search_call"`

476 

477 The item type. Always `web_search_call`.

478 

479 - `"web_search_call"`

480 

481 - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

482 

483 A command execution produced by the agent.

484 

485 - `id: string`

486 

487 The ID of the command execution item.

488 

489 - `command: string`

490 

491 The command that was executed.

492 

493 - `cwd: string or null`

494 

495 The working directory used to execute the command.

496 

497 - `duration_ms: number or null`

498 

499 The command duration in milliseconds.

500 

501 - `exit_code: number or null`

502 

503 The process exit code, if the command completed.

504 

505 - `output: string or null`

506 

507 The command output, if available.

508 

509 - `status: AgentFunctionCallStatus`

510 

511 The status of the command execution.

512 

513 - `turn_id: string`

514 

515 The ID of the turn that contains this item.

516 

517 - `type: "command_execution"`

518 

519 The item type. Always `command_execution`.

520 

521 - `"command_execution"`

522 

523 - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

524 

525 A request to spawn a subagent.

526 

527 - `id: string`

528 

529 The ID of the tool call item.

530 

531 - `agent_id: string`

532 

533 The ID of the agent that requested the subagent.

534 

535 - `content: array of AgentContent`

536 

537 The task given to the spawned agent.

538 

539 - `OutputText object { text, type }`

540 

541 A text content part produced by the agent.

542 

543 - `EncryptedContent object { encrypted_content, type }`

544 

545 Encrypted content exchanged between agents.

546 

547 - `model: string or null`

548 

549 The model requested for the spawned agent.

550 

551 - `reasoning_effort: string or null`

552 

553 The reasoning effort requested for the spawned agent.

554 

555 - `status: AgentFunctionCallStatus`

556 

557 The status of the tool call.

558 

559 - `turn_id: string`

560 

561 The ID of the turn that contains this item.

562 

563 - `type: "create_subagent_call"`

564 

565 The item type. Always `create_subagent_call`.

566 

567 - `"create_subagent_call"`

568 

569 The current public item type.

570 

571 - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

572 

573 A request to send input to another agent.

574 

575 - `id: string`

576 

577 The ID of the tool call item.

578 

579 - `content: array of AgentContent`

580 

581 The input sent to the receiving agent.

582 

583 - `OutputText object { text, type }`

584 

585 A text content part produced by the agent.

586 

587 - `EncryptedContent object { encrypted_content, type }`

588 

589 Encrypted content exchanged between agents.

590 

591 - `recipient_agent_id: string`

592 

593 The ID of the agent receiving the input.

594 

595 - `sender_agent_id: string`

596 

597 The ID of the agent sending the input.

598 

599 - `status: AgentFunctionCallStatus`

600 

601 The status of the tool call.

602 

603 - `turn_id: string`

604 

605 The ID of the turn that contains this item.

606 

607 - `type: "send_subagent_input_call"`

608 

609 The item type. Always `send_subagent_input_call`.

610 

611 - `"send_subagent_input_call"`

612 

613 The current public item type.

614 

615 - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

616 

617 A request to resume a subagent.

618 

619 - `id: string`

620 

621 The ID of the tool call item.

622 

623 - `recipient_agent_id: string`

624 

625 The ID of the agent to resume.

626 

627 - `sender_agent_id: string`

628 

629 The ID of the agent requesting the resume.

630 

631 - `status: AgentFunctionCallStatus`

632 

633 The status of the tool call.

634 

635 - `turn_id: string`

636 

637 The ID of the turn that contains this item.

638 

639 - `type: "resume_subagent_call"`

640 

641 The item type. Always `resume_subagent_call`.

642 

643 - `"resume_subagent_call"`

644 

645 The current public item type.

646 

647 - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

648 

649 A request to wait for one or more subagents.

650 

651 - `id: string`

652 

653 The ID of the tool call item.

654 

655 - `recipient_agent_ids: array of string`

656 

657 The IDs of the agents to wait for.

658 

659 - `sender_agent_id: string`

660 

661 The ID of the agent waiting for results.

662 

663 - `status: AgentFunctionCallStatus`

664 

665 The status of the tool call.

666 

667 - `turn_id: string`

668 

669 The ID of the turn that contains this item.

670 

671 - `type: "wait_for_subagents_call"`

672 

673 The item type. Always `wait_for_subagents_call`.

674 

675 - `"wait_for_subagents_call"`

676 

677 The current public item type.

678 

679 - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

680 

681 A request to interrupt a subagent's current turn. The subagent remains available.

682 

683 - `id: string`

684 

685 The ID of the tool call item.

686 

687 - `recipient_agent_id: string`

688 

689 The ID of the agent to interrupt.

690 

691 - `sender_agent_id: string`

692 

693 The ID of the agent requesting the interrupt.

694 

695 - `status: AgentFunctionCallStatus`

696 

697 The status of the tool call.

698 

699 - `turn_id: string`

700 

701 The ID of the turn that contains this item.

702 

703 - `type: "interrupt_subagent_call"`

704 

705 The item type. Always `interrupt_subagent_call`.

706 

707 - `"interrupt_subagent_call"`

708 

709 The current public item type.

710 

711 - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

712 

713 A request to close a subagent.

714 

715 - `id: string`

716 

717 The ID of the tool call item.

718 

719 - `recipient_agent_id: string`

720 

721 The ID of the agent to close.

722 

723 - `sender_agent_id: string`

724 

725 The ID of the agent requesting the close.

726 

727 - `status: AgentFunctionCallStatus`

728 

729 The status of the tool call.

730 

731 - `turn_id: string`

732 

733 The ID of the turn that contains this item.

734 

735 - `type: "close_subagent_call"`

736 

737 The item type. Always `close_subagent_call`.

738 

739 - `"close_subagent_call"`

740 

741 The current public item type.

742 

743- `first_id: string or null`

744 

745 The ID of the first resource in `data`, or `null` if the page is empty.

746 

747- `has_more: boolean`

748 

749 Whether there are more resources to retrieve after this page.

750 

751- `last_id: string or null`

752 

753 The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

754 

755- `object: "list"`

756 

757 The object type, which is always `list`.

758 

759 - `"list"`

760 

761### Example

762 

763```http

764curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents/$SUBAGENT_ID/turns/$TURN_ID/items \

765 -H 'OpenAI-Beta: agents=v1' \

766 -H "Authorization: Bearer $OPENAI_API_KEY"

767```

768 

769#### Response

770 

771```json

772{

773 "data": [

774 {

775 "id": "id",

776 "content": [

777 {

778 "text": "text",

779 "type": "input_text"

780 }

781 ],

782 "phase": "commentary",

783 "role": "user",

784 "status": "in_progress",

785 "turn_id": "turn_id",

786 "type": "message"

787 }

788 ],

789 "first_id": "first_id",

790 "has_more": true,

791 "last_id": "last_id",

792 "object": "list"

793}

794```

Details

1## List agent session turns

2 

3**get** `/agents/sessions/{session_id}/turns`

4 

5Lists turns by creation time and turn ID. The after cursor is exclusive in the selected order. See [session turns](/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11### Query Parameters

12 

13- `after: optional string`

14 

15 Return resources after this resource ID in the selected order.

16 

17- `limit: optional number`

18 

19 The maximum number of resources to return, between 1 and 100. Defaults to 20.

20 

21- `order: optional "asc" or "desc"`

22 

23 The order in which resources are returned. Defaults to `desc`.

24 

25 - `"asc"`

26 

27 Returns resources in ascending order.

28 

29 - `"desc"`

30 

31 Returns resources in descending order.

32 

33### Returns

34 

35- `data: array of Turn`

36 

37 The resources returned in this page, in the requested sort order.

38 

39 - `id: string`

40 

41 The ID of the turn.

42 

43 - `agent_id: string`

44 

45 The ID of the agent that ran the turn.

46 

47 - `completed_at: number or null`

48 

49 The Unix timestamp, in seconds, when the turn reached a terminal state.

50 

51 - `created_at: number`

52 

53 The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

54 

55 - `error: SessionTurnError or null`

56 

57 A customer-safe error describing why a session request failed.

58 

59 - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 14 more`

60 

61 A stable, machine-readable failure category.

62 

63 - `"context_length_exceeded"`

64 

65 The request exceeds the model's context window.

66 

67 - `"session_budget_exceeded"`

68 

69 The session has reached its usage budget.

70 

71 - `"usage_limit_exceeded"`

72 

73 The organization has reached a usage, plan, or billing limit.

74 

75 - `"credit_balance_exhausted"`

76 

77 The organization has no API credits remaining.

78 

79 - `"rate_limit_exceeded"`

80 

81 The request exceeds the available rate limit.

82 

83 - `"server_overloaded"`

84 

85 The model service is temporarily overloaded.

86 

87 - `"cyber_policy"`

88 

89 The request was rejected by a safety policy.

90 

91 - `"connection_failed"`

92 

93 The request could not connect to the model service.

94 

95 - `"server_error"`

96 

97 The model service encountered an unexpected error.

98 

99 - `"authentication_error"`

100 

101 The API credentials are invalid or lack the required access.

102 

103 - `"invalid_request"`

104 

105 The request contains invalid input or configuration.

106 

107 - `"resource_not_found"`

108 

109 The requested model or resource is unavailable.

110 

111 - `"sandbox_error"`

112 

113 The request could not complete in its execution environment.

114 

115 - `"executor_version_incompatible"`

116 

117 The executor must be upgraded before it can run this turn.

118 

119 - `"active_turn_not_steerable"`

120 

121 The session cannot accept additional input while a request is running.

122 

123 - `"request_timeout"`

124 

125 The request timed out before the model service responded.

126 

127 - `"internal_error"`

128 

129 An unexpected internal error prevented the session request from completing.

130 

131 - `message: string`

132 

133 A customer-safe explanation of the failure.

134 

135 - `object: "agent.session.turn"`

136 

137 The object type. Always `agent.session.turn`.

138 

139 - `"agent.session.turn"`

140 

141 - `session_id: string`

142 

143 The ID of the session that owns the turn.

144 

145 - `started_at: number or null`

146 

147 The Unix timestamp, in seconds, when the turn started.

148 

149 - `status: "queued" or "in_progress" or "waiting" or 3 more`

150 

151 The current status of the turn.

152 

153 - `"queued"`

154 

155 The turn is waiting to start.

156 

157 - `"in_progress"`

158 

159 The turn is in progress.

160 

161 - `"waiting"`

162 

163 The turn is waiting for external input.

164 

165 - `"completed"`

166 

167 The turn completed successfully.

168 

169 - `"failed"`

170 

171 The turn failed.

172 

173 - `"cancelled"`

174 

175 The turn was cancelled.

176 

177 - `subagent_id: string or null`

178 

179 The ID of the subagent that ran the turn, if applicable.

180 

181 - `usage: TokenUsage or null`

182 

183 Recorded token usage for a session or turn. Usage is best effort and may change.

184 

185 - `input_tokens: number`

186 

187 The number of input tokens used by the agent.

188 

189 - `input_tokens_details: object { cached_tokens }`

190 

191 A breakdown of the agent's input token usage.

192 

193 - `cached_tokens: number`

194 

195 The number of input tokens retrieved from the prompt cache.

196 

197 - `output_tokens: number`

198 

199 The number of output tokens generated by the agent.

200 

201 - `output_tokens_details: object { reasoning_tokens }`

202 

203 A breakdown of the agent's output token usage.

204 

205 - `reasoning_tokens: number`

206 

207 The number of output tokens used for reasoning.

208 

209 - `total_tokens: number`

210 

211 The total number of input and output tokens used by the agent.

212 

213- `first_id: string or null`

214 

215 The ID of the first resource in `data`, or `null` if the page is empty.

216 

217- `has_more: boolean`

218 

219 Whether there are more resources to retrieve after this page.

220 

221- `last_id: string or null`

222 

223 The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

224 

225- `object: "list"`

226 

227 The object type, which is always `list`.

228 

229 - `"list"`

230 

231### Example

232 

233```http

234curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/turns \

235 -H 'OpenAI-Beta: agents=v1' \

236 -H "Authorization: Bearer $OPENAI_API_KEY"

237```

238 

239#### Response

240 

241```json

242{

243 "data": [

244 {

245 "id": "id",

246 "agent_id": "agent_id",

247 "completed_at": 0,

248 "created_at": 0,

249 "error": {

250 "code": "context_length_exceeded",

251 "message": "message"

252 },

253 "object": "agent.session.turn",

254 "session_id": "session_id",

255 "started_at": 0,

256 "status": "queued",

257 "subagent_id": "subagent_id",

258 "usage": {

259 "input_tokens": 0,

260 "input_tokens_details": {

261 "cached_tokens": 0

262 },

263 "output_tokens": 0,

264 "output_tokens_details": {

265 "reasoning_tokens": 0

266 },

267 "total_tokens": 0

268 }

269 }

270 ],

271 "first_id": "first_id",

272 "has_more": true,

273 "last_id": "last_id",

274 "object": "list"

275}

276```

Details

1## Retrieve an agent session turn

2 

3**get** `/agents/sessions/{session_id}/turns/{turn_id}`

4 

5Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if the turn does not belong to the session. See [session turns](/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).

6 

7### Path Parameters

8 

9- `session_id: string`

10 

11- `turn_id: string`

12 

13### Returns

14 

15- `Turn object { id, agent_id, completed_at, 8 more }`

16 

17 The canonical public representation of a session turn.

18 

19 - `id: string`

20 

21 The ID of the turn.

22 

23 - `agent_id: string`

24 

25 The ID of the agent that ran the turn.

26 

27 - `completed_at: number or null`

28 

29 The Unix timestamp, in seconds, when the turn reached a terminal state.

30 

31 - `created_at: number`

32 

33 The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable.

34 

35 - `error: SessionTurnError or null`

36 

37 A customer-safe error describing why a session request failed.

38 

39 - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 14 more`

40 

41 A stable, machine-readable failure category.

42 

43 - `"context_length_exceeded"`

44 

45 The request exceeds the model's context window.

46 

47 - `"session_budget_exceeded"`

48 

49 The session has reached its usage budget.

50 

51 - `"usage_limit_exceeded"`

52 

53 The organization has reached a usage, plan, or billing limit.

54 

55 - `"credit_balance_exhausted"`

56 

57 The organization has no API credits remaining.

58 

59 - `"rate_limit_exceeded"`

60 

61 The request exceeds the available rate limit.

62 

63 - `"server_overloaded"`

64 

65 The model service is temporarily overloaded.

66 

67 - `"cyber_policy"`

68 

69 The request was rejected by a safety policy.

70 

71 - `"connection_failed"`

72 

73 The request could not connect to the model service.

74 

75 - `"server_error"`

76 

77 The model service encountered an unexpected error.

78 

79 - `"authentication_error"`

80 

81 The API credentials are invalid or lack the required access.

82 

83 - `"invalid_request"`

84 

85 The request contains invalid input or configuration.

86 

87 - `"resource_not_found"`

88 

89 The requested model or resource is unavailable.

90 

91 - `"sandbox_error"`

92 

93 The request could not complete in its execution environment.

94 

95 - `"executor_version_incompatible"`

96 

97 The executor must be upgraded before it can run this turn.

98 

99 - `"active_turn_not_steerable"`

100 

101 The session cannot accept additional input while a request is running.

102 

103 - `"request_timeout"`

104 

105 The request timed out before the model service responded.

106 

107 - `"internal_error"`

108 

109 An unexpected internal error prevented the session request from completing.

110 

111 - `message: string`

112 

113 A customer-safe explanation of the failure.

114 

115 - `object: "agent.session.turn"`

116 

117 The object type. Always `agent.session.turn`.

118 

119 - `"agent.session.turn"`

120 

121 - `session_id: string`

122 

123 The ID of the session that owns the turn.

124 

125 - `started_at: number or null`

126 

127 The Unix timestamp, in seconds, when the turn started.

128 

129 - `status: "queued" or "in_progress" or "waiting" or 3 more`

130 

131 The current status of the turn.

132 

133 - `"queued"`

134 

135 The turn is waiting to start.

136 

137 - `"in_progress"`

138 

139 The turn is in progress.

140 

141 - `"waiting"`

142 

143 The turn is waiting for external input.

144 

145 - `"completed"`

146 

147 The turn completed successfully.

148 

149 - `"failed"`

150 

151 The turn failed.

152 

153 - `"cancelled"`

154 

155 The turn was cancelled.

156 

157 - `subagent_id: string or null`

158 

159 The ID of the subagent that ran the turn, if applicable.

160 

161 - `usage: TokenUsage or null`

162 

163 Recorded token usage for a session or turn. Usage is best effort and may change.

164 

165 - `input_tokens: number`

166 

167 The number of input tokens used by the agent.

168 

169 - `input_tokens_details: object { cached_tokens }`

170 

171 A breakdown of the agent's input token usage.

172 

173 - `cached_tokens: number`

174 

175 The number of input tokens retrieved from the prompt cache.

176 

177 - `output_tokens: number`

178 

179 The number of output tokens generated by the agent.

180 

181 - `output_tokens_details: object { reasoning_tokens }`

182 

183 A breakdown of the agent's output token usage.

184 

185 - `reasoning_tokens: number`

186 

187 The number of output tokens used for reasoning.

188 

189 - `total_tokens: number`

190 

191 The total number of input and output tokens used by the agent.

192 

193### Example

194 

195```http

196curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/turns/$TURN_ID \

197 -H 'OpenAI-Beta: agents=v1' \

198 -H "Authorization: Bearer $OPENAI_API_KEY"

199```

200 

201#### Response

202 

203```json

204{

205 "id": "id",

206 "agent_id": "agent_id",

207 "completed_at": 0,

208 "created_at": 0,

209 "error": {

210 "code": "context_length_exceeded",

211 "message": "message"

212 },

213 "object": "agent.session.turn",

214 "session_id": "session_id",

215 "started_at": 0,

216 "status": "queued",

217 "subagent_id": "subagent_id",

218 "usage": {

219 "input_tokens": 0,

220 "input_tokens_details": {

221 "cached_tokens": 0

222 },

223 "output_tokens": 0,

224 "output_tokens_details": {

225 "reasoning_tokens": 0

226 },

227 "total_tokens": 0

228 }

229}

230```

Details

1## Create a vault

2 

3**post** `/vaults`

4 

5Creates a vault for the current project. See [vaults](/api/docs/guides/agents-api/tools/vaults).

6 

7### Body Parameters

8 

9- `metadata: optional map[string] or null`

10 

11 Key-value pairs to associate with the vault, such as an application or team identifier.

12 

13- `name: optional string`

14 

15 The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming.

16 

17### Returns

18 

19- `Vault object { id, created_at, metadata, 2 more }`

20 

21 A collection of credentials that agent tools can use to authenticate to MCP servers.

22 

23 - `id: string`

24 

25 The ID of the vault.

26 

27 - `created_at: number`

28 

29 The Unix timestamp, in seconds, when the vault was created.

30 

31 - `metadata: map[string]`

32 

33 Key-value pairs associated with the vault, such as an application or team identifier.

34 

35 - `name: string or null`

36 

37 The human-readable name of the vault, if set.

38 

39 - `object: "vault"`

40 

41 The object type. Always `vault`.

42 

43 - `"vault"`

44 

45### Example

46 

47```http

48curl https://api.openai.com/v1/vaults \

49 -X POST \

50 -H 'OpenAI-Beta: agents=v1' \

51 -H "Authorization: Bearer $OPENAI_API_KEY"

52```

53 

54#### Response

55 

56```json

57{

58 "id": "id",

59 "created_at": 0,

60 "metadata": {

61 "foo": "string"

62 },

63 "name": "name",

64 "object": "vault"

65}

66```

Details

1## Delete a vault

2 

3**delete** `/vaults/{vault_id}`

4 

5Deletes a vault and all its credentials. See [vaults](/api/docs/guides/agents-api/tools/vaults).

6 

7### Path Parameters

8 

9- `vault_id: string`

10 

11### Returns

12 

13- `VaultDeleted object { id, deleted, object }`

14 

15 Confirmation that a vault was deleted.

16 

17 - `id: string`

18 

19 The ID of the deleted vault.

20 

21 - `deleted: boolean`

22 

23 Whether the resource was deleted. Always `true`.

24 

25 - `object: "vault.deleted"`

26 

27 The object type. Always `vault.deleted`.

28 

29 - `"vault.deleted"`

30 

31### Example

32 

33```http

34curl https://api.openai.com/v1/vaults/$VAULT_ID \

35 -X DELETE \

36 -H 'OpenAI-Beta: agents=v1' \

37 -H "Authorization: Bearer $OPENAI_API_KEY"

38```

39 

40#### Response

41 

42```json

43{

44 "id": "id",

45 "deleted": true,

46 "object": "vault.deleted"

47}

48```

Details

1## List vaults

2 

3**get** `/vaults`

4 

5Lists vaults using ID-based pagination. See [vaults](/api/docs/guides/agents-api/tools/vaults).

6 

7### Query Parameters

8 

9- `after: optional string`

10 

11 Return resources after this resource ID in the selected order.

12 

13- `limit: optional number or null`

14 

15 The maximum number of resources to return. Defaults to 20. Values are clamped between 1 and 100.

16 

17- `order: optional "asc" or "desc"`

18 

19 Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`.

20 

21 - `"asc"`

22 

23 Returns resources in ascending order.

24 

25 - `"desc"`

26 

27 Returns resources in descending order.

28 

29- `status: optional VaultStatusFilter`

30 

31 Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default.

32 

33 - `VaultStatus = "active" or "archived"`

34 

35 Whether a vault or credential is active or archived.

36 

37 - `"active"`

38 

39 - `"archived"`

40 

41 - `array of VaultStatus`

42 

43 - `"active"`

44 

45 - `"archived"`

46 

47### Returns

48 

49- `data: array of Vault`

50 

51 The resources returned in this page, in the requested sort order.

52 

53 - `id: string`

54 

55 The ID of the vault.

56 

57 - `created_at: number`

58 

59 The Unix timestamp, in seconds, when the vault was created.

60 

61 - `metadata: map[string]`

62 

63 Key-value pairs associated with the vault, such as an application or team identifier.

64 

65 - `name: string or null`

66 

67 The human-readable name of the vault, if set.

68 

69 - `object: "vault"`

70 

71 The object type. Always `vault`.

72 

73 - `"vault"`

74 

75- `first_id: string or null`

76 

77 The ID of the first resource in `data`, or `null` if the page is empty.

78 

79- `has_more: boolean`

80 

81 Whether there are more resources to retrieve after this page.

82 

83- `last_id: string or null`

84 

85 The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

86 

87- `object: "list"`

88 

89 The object type, which is always `list`.

90 

91 - `"list"`

92 

93### Example

94 

95```http

96curl https://api.openai.com/v1/vaults \

97 -H 'OpenAI-Beta: agents=v1' \

98 -H "Authorization: Bearer $OPENAI_API_KEY"

99```

100 

101#### Response

102 

103```json

104{

105 "data": [

106 {

107 "id": "id",

108 "created_at": 0,

109 "metadata": {

110 "foo": "string"

111 },

112 "name": "name",

113 "object": "vault"

114 }

115 ],

116 "first_id": "first_id",

117 "has_more": true,

118 "last_id": "last_id",

119 "object": "list"

120}

121```

Details

1## Retrieve a vault

2 

3**get** `/vaults/{vault_id}`

4 

5Retrieves a vault by its ID. See [vaults](/api/docs/guides/agents-api/tools/vaults).

6 

7### Path Parameters

8 

9- `vault_id: string`

10 

11### Returns

12 

13- `Vault object { id, created_at, metadata, 2 more }`

14 

15 A collection of credentials that agent tools can use to authenticate to MCP servers.

16 

17 - `id: string`

18 

19 The ID of the vault.

20 

21 - `created_at: number`

22 

23 The Unix timestamp, in seconds, when the vault was created.

24 

25 - `metadata: map[string]`

26 

27 Key-value pairs associated with the vault, such as an application or team identifier.

28 

29 - `name: string or null`

30 

31 The human-readable name of the vault, if set.

32 

33 - `object: "vault"`

34 

35 The object type. Always `vault`.

36 

37 - `"vault"`

38 

39### Example

40 

41```http

42curl https://api.openai.com/v1/vaults/$VAULT_ID \

43 -H 'OpenAI-Beta: agents=v1' \

44 -H "Authorization: Bearer $OPENAI_API_KEY"

45```

46 

47#### Response

48 

49```json

50{

51 "id": "id",

52 "created_at": 0,

53 "metadata": {

54 "foo": "string"

55 },

56 "name": "name",

57 "object": "vault"

58}

59```

Details

1## Create a vault credential

2 

3**post** `/vaults/{vault_id}/credentials`

4 

5Creates a vault credential. Secret values are write-only and are never returned. See [vaults](/api/docs/guides/agents-api/tools/vaults).

6 

7### Path Parameters

8 

9- `vault_id: string`

10 

11### Body Parameters

12 

13- `auth: CredentialAuthCreateParam`

14 

15 The authentication method and secret values to store for the MCP server.

16 

17 - `McpOauth object { access_token, mcp_server_url, type, 2 more }`

18 

19 An OAuth credential for an HTTPS MCP destination.

20 

21 - `access_token: string`

22 

23 A write-only OAuth access token; never returned by credential resources.

24 

25 - `mcp_server_url: string`

26 

27 The HTTPS MCP server URL authorized by this credential.

28 

29 - `type: "mcp_oauth"`

30 

31 The type of the object. Always `mcp_oauth`.

32 

33 - `"mcp_oauth"`

34 

35 - `expires_at: optional string or null`

36 

37 When the OAuth access token expires, as an RFC 3339 timestamp, if known.

38 

39 - `refresh: optional object { client_id, refresh_token, token_endpoint, 3 more } or null`

40 

41 Configuration for refreshing the access token of an MCP OAuth credential.

42 

43 - `client_id: string`

44 

45 The OAuth client ID used when requesting a new access token.

46 

47 - `refresh_token: string`

48 

49 The refresh token to store. This secret is never returned in credential resources.

50 

51 - `token_endpoint: string`

52 

53 The HTTPS OAuth token endpoint used to exchange the refresh token for a new access token.

54 

55 - `token_endpoint_auth: McpOauthTokenEndpointAuthCreateParam`

56 

57 How the OAuth client authenticates to the token endpoint.

58 

59 - `None object { type }`

60 

61 Sends the client ID without a client secret.

62 

63 - `type: "none"`

64 

65 The type of the object. Always `none`.

66 

67 - `"none"`

68 

69 - `ClientSecretBasic object { client_secret, type }`

70 

71 Sends the client ID and secret using HTTP Basic authentication.

72 

73 - `client_secret: string`

74 

75 The OAuth client secret to store. Never returned in credential resources.

76 

77 - `type: "client_secret_basic"`

78 

79 The type of the object. Always `client_secret_basic`.

80 

81 - `"client_secret_basic"`

82 

83 - `ClientSecretPost object { client_secret, type }`

84 

85 Sends the client ID and secret in the token request body.

86 

87 - `client_secret: string`

88 

89 The OAuth client secret to store. Never returned in credential resources.

90 

91 - `type: "client_secret_post"`

92 

93 The type of the object. Always `client_secret_post`.

94 

95 - `"client_secret_post"`

96 

97 - `resource: optional string or null`

98 

99 The resource URI to send to the OAuth token endpoint during refresh, if required.

100 

101 - `scope: optional string or null`

102 

103 Space-separated OAuth scopes to request during refresh, if required.

104 

105 - `StaticBearer object { token, mcp_server_url, type }`

106 

107 A bearer token for an MCP server, without automatic OAuth refresh.

108 

109 - `token: string`

110 

111 The bearer token to store. This secret is never returned in credential resources.

112 

113 - `mcp_server_url: string`

114 

115 The HTTPS MCP server URL authorized by this credential.

116 

117 - `type: "static_bearer"`

118 

119 The type of the object. Always `static_bearer`.

120 

121 - `"static_bearer"`

122 

123- `name: string`

124 

125 The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming.

126 

127### Returns

128 

129- `Credential object { id, auth, created_at, 4 more }`

130 

131 Metadata for a stored MCP server credential. Secret values are never returned.

132 

133 - `id: string`

134 

135 The ID of the credential.

136 

137 - `auth: CredentialAuth`

138 

139 The authentication method and non-secret configuration for the MCP server.

140 

141 - `McpOauth object { expires_at, mcp_server_url, refresh, type }`

142 

143 Public metadata for an OAuth credential; tokens and client secrets are never returned.

144 

145 - `expires_at: string or null`

146 

147 When the OAuth access token expires, as an RFC 3339 timestamp, if known.

148 

149 - `mcp_server_url: string`

150 

151 The HTTPS MCP server URL authorized by this credential.

152 

153 - `refresh: object { client_id, resource, scope, 2 more } or null`

154 

155 Configuration used to refresh an MCP OAuth access token, excluding secret values.

156 

157 - `client_id: string`

158 

159 The OAuth client ID used when requesting a new access token.

160 

161 - `resource: string or null`

162 

163 The resource URI sent to the OAuth token endpoint during refresh, if configured.

164 

165 - `scope: string or null`

166 

167 Space-separated OAuth scopes requested during refresh, if configured.

168 

169 - `token_endpoint: string`

170 

171 The HTTPS OAuth token endpoint used for refresh.

172 

173 - `token_endpoint_auth: McpOauthTokenEndpointAuth`

174 

175 How the OAuth client authenticates to the token endpoint, excluding its client secret.

176 

177 - `None object { type }`

178 

179 Sends the client ID without a client secret.

180 

181 - `type: "none"`

182 

183 The type of the object. Always `none`.

184 

185 - `"none"`

186 

187 - `ClientSecretBasic object { type }`

188 

189 Sends the client ID and secret using HTTP Basic authentication.

190 

191 - `type: "client_secret_basic"`

192 

193 The type of the object. Always `client_secret_basic`.

194 

195 - `"client_secret_basic"`

196 

197 - `ClientSecretPost object { type }`

198 

199 Sends the client ID and secret in the token request body.

200 

201 - `type: "client_secret_post"`

202 

203 The type of the object. Always `client_secret_post`.

204 

205 - `"client_secret_post"`

206 

207 - `type: "mcp_oauth"`

208 

209 The type of the object. Always `mcp_oauth`.

210 

211 - `"mcp_oauth"`

212 

213 - `StaticBearer object { mcp_server_url, type }`

214 

215 Metadata for a bearer-token credential, without automatic OAuth refresh.

216 

217 - `mcp_server_url: string`

218 

219 The HTTPS MCP server URL authorized by this credential.

220 

221 - `type: "static_bearer"`

222 

223 The type of the object. Always `static_bearer`.

224 

225 - `"static_bearer"`

226 

227 - `created_at: number`

228 

229 The Unix timestamp, in seconds, when the credential was created.

230 

231 - `name: string`

232 

233 The human-readable name of the credential.

234 

235 - `object: "vault.credential"`

236 

237 The object type. Always `vault.credential`.

238 

239 - `"vault.credential"`

240 

241 - `updated_at: number`

242 

243 The Unix timestamp, in seconds, when the credential was last updated.

244 

245 - `vault_id: string`

246 

247 The ID of the vault containing this credential.

248 

249### Example

250 

251```http

252curl https://api.openai.com/v1/vaults/$VAULT_ID/credentials \

253 -H 'Content-Type: application/json' \

254 -H 'OpenAI-Beta: agents=v1' \

255 -H "Authorization: Bearer $OPENAI_API_KEY" \

256 -d '{

257 "auth": {

258 "access_token": "access_token",

259 "mcp_server_url": "mcp_server_url",

260 "type": "mcp_oauth"

261 },

262 "name": "x"

263 }'

264```

265 

266#### Response

267 

268```json

269{

270 "id": "id",

271 "auth": {

272 "expires_at": "expires_at",

273 "mcp_server_url": "mcp_server_url",

274 "refresh": {

275 "client_id": "client_id",

276 "resource": "resource",

277 "scope": "scope",

278 "token_endpoint": "token_endpoint",

279 "token_endpoint_auth": {

280 "type": "none"

281 }

282 },

283 "type": "mcp_oauth"

284 },

285 "created_at": 0,

286 "name": "name",

287 "object": "vault.credential",

288 "updated_at": 0,

289 "vault_id": "vault_id"

290}

291```

Details

1## Delete a vault credential

2 

3**delete** `/vaults/{vault_id}/credentials/{credential_id}`

4 

5Deletes a vault credential. See [vaults](/api/docs/guides/agents-api/tools/vaults).

6 

7### Path Parameters

8 

9- `vault_id: string`

10 

11- `credential_id: string`

12 

13### Returns

14 

15- `CredentialDeleted object { id, deleted, object }`

16 

17 Confirmation that a vault credential was deleted.

18 

19 - `id: string`

20 

21 The ID of the deleted credential.

22 

23 - `deleted: boolean`

24 

25 Whether the resource was deleted. Always `true`.

26 

27 - `object: "vault.credential.deleted"`

28 

29 The object type. Always `vault.credential.deleted`.

30 

31 - `"vault.credential.deleted"`

32 

33### Example

34 

35```http

36curl https://api.openai.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \

37 -X DELETE \

38 -H 'OpenAI-Beta: agents=v1' \

39 -H "Authorization: Bearer $OPENAI_API_KEY"

40```

41 

42#### Response

43 

44```json

45{

46 "id": "id",

47 "deleted": true,

48 "object": "vault.credential.deleted"

49}

50```

Details

1## List vault credentials

2 

3**get** `/vaults/{vault_id}/credentials`

4 

5Lists a vault's credentials using ID-based pagination without returning secret values. See [vaults](/api/docs/guides/agents-api/tools/vaults).

6 

7### Path Parameters

8 

9- `vault_id: string`

10 

11### Query Parameters

12 

13- `after: optional string`

14 

15 Return resources after this resource ID in the selected order.

16 

17- `limit: optional number or null`

18 

19 The maximum number of resources to return. Defaults to 20. Values are clamped between 1 and 100.

20 

21- `order: optional "asc" or "desc"`

22 

23 Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`.

24 

25 - `"asc"`

26 

27 Returns resources in ascending order.

28 

29 - `"desc"`

30 

31 Returns resources in descending order.

32 

33- `status: optional VaultStatusFilter`

34 

35 Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default.

36 

37 - `VaultStatus = "active" or "archived"`

38 

39 Whether a vault or credential is active or archived.

40 

41 - `"active"`

42 

43 - `"archived"`

44 

45 - `array of VaultStatus`

46 

47 - `"active"`

48 

49 - `"archived"`

50 

51### Returns

52 

53- `data: array of Credential`

54 

55 The resources returned in this page, in the requested sort order.

56 

57 - `id: string`

58 

59 The ID of the credential.

60 

61 - `auth: CredentialAuth`

62 

63 The authentication method and non-secret configuration for the MCP server.

64 

65 - `McpOauth object { expires_at, mcp_server_url, refresh, type }`

66 

67 Public metadata for an OAuth credential; tokens and client secrets are never returned.

68 

69 - `expires_at: string or null`

70 

71 When the OAuth access token expires, as an RFC 3339 timestamp, if known.

72 

73 - `mcp_server_url: string`

74 

75 The HTTPS MCP server URL authorized by this credential.

76 

77 - `refresh: object { client_id, resource, scope, 2 more } or null`

78 

79 Configuration used to refresh an MCP OAuth access token, excluding secret values.

80 

81 - `client_id: string`

82 

83 The OAuth client ID used when requesting a new access token.

84 

85 - `resource: string or null`

86 

87 The resource URI sent to the OAuth token endpoint during refresh, if configured.

88 

89 - `scope: string or null`

90 

91 Space-separated OAuth scopes requested during refresh, if configured.

92 

93 - `token_endpoint: string`

94 

95 The HTTPS OAuth token endpoint used for refresh.

96 

97 - `token_endpoint_auth: McpOauthTokenEndpointAuth`

98 

99 How the OAuth client authenticates to the token endpoint, excluding its client secret.

100 

101 - `None object { type }`

102 

103 Sends the client ID without a client secret.

104 

105 - `type: "none"`

106 

107 The type of the object. Always `none`.

108 

109 - `"none"`

110 

111 - `ClientSecretBasic object { type }`

112 

113 Sends the client ID and secret using HTTP Basic authentication.

114 

115 - `type: "client_secret_basic"`

116 

117 The type of the object. Always `client_secret_basic`.

118 

119 - `"client_secret_basic"`

120 

121 - `ClientSecretPost object { type }`

122 

123 Sends the client ID and secret in the token request body.

124 

125 - `type: "client_secret_post"`

126 

127 The type of the object. Always `client_secret_post`.

128 

129 - `"client_secret_post"`

130 

131 - `type: "mcp_oauth"`

132 

133 The type of the object. Always `mcp_oauth`.

134 

135 - `"mcp_oauth"`

136 

137 - `StaticBearer object { mcp_server_url, type }`

138 

139 Metadata for a bearer-token credential, without automatic OAuth refresh.

140 

141 - `mcp_server_url: string`

142 

143 The HTTPS MCP server URL authorized by this credential.

144 

145 - `type: "static_bearer"`

146 

147 The type of the object. Always `static_bearer`.

148 

149 - `"static_bearer"`

150 

151 - `created_at: number`

152 

153 The Unix timestamp, in seconds, when the credential was created.

154 

155 - `name: string`

156 

157 The human-readable name of the credential.

158 

159 - `object: "vault.credential"`

160 

161 The object type. Always `vault.credential`.

162 

163 - `"vault.credential"`

164 

165 - `updated_at: number`

166 

167 The Unix timestamp, in seconds, when the credential was last updated.

168 

169 - `vault_id: string`

170 

171 The ID of the vault containing this credential.

172 

173- `first_id: string or null`

174 

175 The ID of the first resource in `data`, or `null` if the page is empty.

176 

177- `has_more: boolean`

178 

179 Whether there are more resources to retrieve after this page.

180 

181- `last_id: string or null`

182 

183 The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

184 

185- `object: "list"`

186 

187 The object type, which is always `list`.

188 

189 - `"list"`

190 

191### Example

192 

193```http

194curl https://api.openai.com/v1/vaults/$VAULT_ID/credentials \

195 -H 'OpenAI-Beta: agents=v1' \

196 -H "Authorization: Bearer $OPENAI_API_KEY"

197```

198 

199#### Response

200 

201```json

202{

203 "data": [

204 {

205 "id": "id",

206 "auth": {

207 "expires_at": "expires_at",

208 "mcp_server_url": "mcp_server_url",

209 "refresh": {

210 "client_id": "client_id",

211 "resource": "resource",

212 "scope": "scope",

213 "token_endpoint": "token_endpoint",

214 "token_endpoint_auth": {

215 "type": "none"

216 }

217 },

218 "type": "mcp_oauth"

219 },

220 "created_at": 0,

221 "name": "name",

222 "object": "vault.credential",

223 "updated_at": 0,

224 "vault_id": "vault_id"

225 }

226 ],

227 "first_id": "first_id",

228 "has_more": true,

229 "last_id": "last_id",

230 "object": "list"

231}

232```

Details

1## Retrieve a vault credential

2 

3**get** `/vaults/{vault_id}/credentials/{credential_id}`

4 

5Retrieves vault credential metadata without returning secret values. See [vaults](/api/docs/guides/agents-api/tools/vaults).

6 

7### Path Parameters

8 

9- `vault_id: string`

10 

11- `credential_id: string`

12 

13### Returns

14 

15- `Credential object { id, auth, created_at, 4 more }`

16 

17 Metadata for a stored MCP server credential. Secret values are never returned.

18 

19 - `id: string`

20 

21 The ID of the credential.

22 

23 - `auth: CredentialAuth`

24 

25 The authentication method and non-secret configuration for the MCP server.

26 

27 - `McpOauth object { expires_at, mcp_server_url, refresh, type }`

28 

29 Public metadata for an OAuth credential; tokens and client secrets are never returned.

30 

31 - `expires_at: string or null`

32 

33 When the OAuth access token expires, as an RFC 3339 timestamp, if known.

34 

35 - `mcp_server_url: string`

36 

37 The HTTPS MCP server URL authorized by this credential.

38 

39 - `refresh: object { client_id, resource, scope, 2 more } or null`

40 

41 Configuration used to refresh an MCP OAuth access token, excluding secret values.

42 

43 - `client_id: string`

44 

45 The OAuth client ID used when requesting a new access token.

46 

47 - `resource: string or null`

48 

49 The resource URI sent to the OAuth token endpoint during refresh, if configured.

50 

51 - `scope: string or null`

52 

53 Space-separated OAuth scopes requested during refresh, if configured.

54 

55 - `token_endpoint: string`

56 

57 The HTTPS OAuth token endpoint used for refresh.

58 

59 - `token_endpoint_auth: McpOauthTokenEndpointAuth`

60 

61 How the OAuth client authenticates to the token endpoint, excluding its client secret.

62 

63 - `None object { type }`

64 

65 Sends the client ID without a client secret.

66 

67 - `type: "none"`

68 

69 The type of the object. Always `none`.

70 

71 - `"none"`

72 

73 - `ClientSecretBasic object { type }`

74 

75 Sends the client ID and secret using HTTP Basic authentication.

76 

77 - `type: "client_secret_basic"`

78 

79 The type of the object. Always `client_secret_basic`.

80 

81 - `"client_secret_basic"`

82 

83 - `ClientSecretPost object { type }`

84 

85 Sends the client ID and secret in the token request body.

86 

87 - `type: "client_secret_post"`

88 

89 The type of the object. Always `client_secret_post`.

90 

91 - `"client_secret_post"`

92 

93 - `type: "mcp_oauth"`

94 

95 The type of the object. Always `mcp_oauth`.

96 

97 - `"mcp_oauth"`

98 

99 - `StaticBearer object { mcp_server_url, type }`

100 

101 Metadata for a bearer-token credential, without automatic OAuth refresh.

102 

103 - `mcp_server_url: string`

104 

105 The HTTPS MCP server URL authorized by this credential.

106 

107 - `type: "static_bearer"`

108 

109 The type of the object. Always `static_bearer`.

110 

111 - `"static_bearer"`

112 

113 - `created_at: number`

114 

115 The Unix timestamp, in seconds, when the credential was created.

116 

117 - `name: string`

118 

119 The human-readable name of the credential.

120 

121 - `object: "vault.credential"`

122 

123 The object type. Always `vault.credential`.

124 

125 - `"vault.credential"`

126 

127 - `updated_at: number`

128 

129 The Unix timestamp, in seconds, when the credential was last updated.

130 

131 - `vault_id: string`

132 

133 The ID of the vault containing this credential.

134 

135### Example

136 

137```http

138curl https://api.openai.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \

139 -H 'OpenAI-Beta: agents=v1' \

140 -H "Authorization: Bearer $OPENAI_API_KEY"

141```

142 

143#### Response

144 

145```json

146{

147 "id": "id",

148 "auth": {

149 "expires_at": "expires_at",

150 "mcp_server_url": "mcp_server_url",

151 "refresh": {

152 "client_id": "client_id",

153 "resource": "resource",

154 "scope": "scope",

155 "token_endpoint": "token_endpoint",

156 "token_endpoint_auth": {

157 "type": "none"

158 }

159 },

160 "type": "mcp_oauth"

161 },

162 "created_at": 0,

163 "name": "name",

164 "object": "vault.credential",

165 "updated_at": 0,

166 "vault_id": "vault_id"

167}

168```

Details

1## Rotate a vault credential

2 

3**post** `/vaults/{vault_id}/credentials/{credential_id}`

4 

5Rotates a vault credential's write-only secret and returns only credential metadata. See [vaults](/api/docs/guides/agents-api/tools/vaults).

6 

7### Path Parameters

8 

9- `vault_id: string`

10 

11- `credential_id: string`

12 

13### Body Parameters

14 

15- `auth: CredentialAuthRotateParam`

16 

17 Replacement values for the credential's existing authentication method.

18 

19 - `McpOauth object { type, access_token, expires_at, refresh }`

20 

21 Rotate an OAuth credential for an HTTPS MCP destination.

22 

23 - `type: "mcp_oauth"`

24 

25 The type of the object. Always `mcp_oauth`.

26 

27 - `"mcp_oauth"`

28 

29 - `access_token: optional string or null`

30 

31 A write-only replacement OAuth access token.

32 

33 - `expires_at: optional string or null`

34 

35 The replacement expiry as an RFC 3339 timestamp, or `null` to clear it. Omitting this field preserves the expiry unless a new access token is supplied, in which case the expiry is cleared.

36 

37 - `refresh: optional object { refresh_token, scope, token_endpoint_auth } or null`

38 

39 Updates to an MCP credential's existing OAuth refresh configuration.

40 

41 - `refresh_token: optional string or null`

42 

43 The replacement refresh token. Omit or pass `null` to keep the stored token. This secret is never returned in resources.

44 

45 - `scope: optional string or null`

46 

47 Replacement space-separated OAuth scopes for refresh requests. Omit to keep the scopes, or pass `null` to stop sending a scope parameter.

48 

49 - `token_endpoint_auth: optional McpOauthTokenEndpointAuthRotateParam or null`

50 

51 Client-secret updates that preserve the credential's OAuth authentication method.

52 

53 - `ClientSecretBasic object { type, client_secret }`

54 

55 Updates credentials sent using HTTP Basic authentication.

56 

57 - `type: "client_secret_basic"`

58 

59 The type of the object. Always `client_secret_basic`.

60 

61 - `"client_secret_basic"`

62 

63 - `client_secret: optional string or null`

64 

65 The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

66 

67 - `ClientSecretPost object { type, client_secret }`

68 

69 Updates credentials sent in the token request body.

70 

71 - `type: "client_secret_post"`

72 

73 The type of the object. Always `client_secret_post`.

74 

75 - `"client_secret_post"`

76 

77 - `client_secret: optional string or null`

78 

79 The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

80 

81 - `StaticBearer object { token, type }`

82 

83 Replace the bearer token for the credential's MCP server.

84 

85 - `token: string`

86 

87 The replacement bearer token. This secret is never returned in credential resources.

88 

89 - `type: "static_bearer"`

90 

91 The type of the object. Always `static_bearer`.

92 

93 - `"static_bearer"`

94 

95### Returns

96 

97- `Credential object { id, auth, created_at, 4 more }`

98 

99 Metadata for a stored MCP server credential. Secret values are never returned.

100 

101 - `id: string`

102 

103 The ID of the credential.

104 

105 - `auth: CredentialAuth`

106 

107 The authentication method and non-secret configuration for the MCP server.

108 

109 - `McpOauth object { expires_at, mcp_server_url, refresh, type }`

110 

111 Public metadata for an OAuth credential; tokens and client secrets are never returned.

112 

113 - `expires_at: string or null`

114 

115 When the OAuth access token expires, as an RFC 3339 timestamp, if known.

116 

117 - `mcp_server_url: string`

118 

119 The HTTPS MCP server URL authorized by this credential.

120 

121 - `refresh: object { client_id, resource, scope, 2 more } or null`

122 

123 Configuration used to refresh an MCP OAuth access token, excluding secret values.

124 

125 - `client_id: string`

126 

127 The OAuth client ID used when requesting a new access token.

128 

129 - `resource: string or null`

130 

131 The resource URI sent to the OAuth token endpoint during refresh, if configured.

132 

133 - `scope: string or null`

134 

135 Space-separated OAuth scopes requested during refresh, if configured.

136 

137 - `token_endpoint: string`

138 

139 The HTTPS OAuth token endpoint used for refresh.

140 

141 - `token_endpoint_auth: McpOauthTokenEndpointAuth`

142 

143 How the OAuth client authenticates to the token endpoint, excluding its client secret.

144 

145 - `None object { type }`

146 

147 Sends the client ID without a client secret.

148 

149 - `type: "none"`

150 

151 The type of the object. Always `none`.

152 

153 - `"none"`

154 

155 - `ClientSecretBasic object { type }`

156 

157 Sends the client ID and secret using HTTP Basic authentication.

158 

159 - `type: "client_secret_basic"`

160 

161 The type of the object. Always `client_secret_basic`.

162 

163 - `"client_secret_basic"`

164 

165 - `ClientSecretPost object { type }`

166 

167 Sends the client ID and secret in the token request body.

168 

169 - `type: "client_secret_post"`

170 

171 The type of the object. Always `client_secret_post`.

172 

173 - `"client_secret_post"`

174 

175 - `type: "mcp_oauth"`

176 

177 The type of the object. Always `mcp_oauth`.

178 

179 - `"mcp_oauth"`

180 

181 - `StaticBearer object { mcp_server_url, type }`

182 

183 Metadata for a bearer-token credential, without automatic OAuth refresh.

184 

185 - `mcp_server_url: string`

186 

187 The HTTPS MCP server URL authorized by this credential.

188 

189 - `type: "static_bearer"`

190 

191 The type of the object. Always `static_bearer`.

192 

193 - `"static_bearer"`

194 

195 - `created_at: number`

196 

197 The Unix timestamp, in seconds, when the credential was created.

198 

199 - `name: string`

200 

201 The human-readable name of the credential.

202 

203 - `object: "vault.credential"`

204 

205 The object type. Always `vault.credential`.

206 

207 - `"vault.credential"`

208 

209 - `updated_at: number`

210 

211 The Unix timestamp, in seconds, when the credential was last updated.

212 

213 - `vault_id: string`

214 

215 The ID of the vault containing this credential.

216 

217### Example

218 

219```http

220curl https://api.openai.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \

221 -H 'Content-Type: application/json' \

222 -H 'OpenAI-Beta: agents=v1' \

223 -H "Authorization: Bearer $OPENAI_API_KEY" \

224 -d '{

225 "auth": {

226 "type": "mcp_oauth"

227 }

228 }'

229```

230 

231#### Response

232 

233```json

234{

235 "id": "id",

236 "auth": {

237 "expires_at": "expires_at",

238 "mcp_server_url": "mcp_server_url",

239 "refresh": {

240 "client_id": "client_id",

241 "resource": "resource",

242 "scope": "scope",

243 "token_endpoint": "token_endpoint",

244 "token_endpoint_auth": {

245 "type": "none"

246 }

247 },

248 "type": "mcp_oauth"

249 },

250 "created_at": 0,

251 "name": "name",

252 "object": "vault.credential",

253 "updated_at": 0,

254 "vault_id": "vault_id"

255}

256```

Details

6returned from the model using server-sent events.6returned from the model using server-sent events.

7[Learn more](https://developers.openai.com/api/docs/guides/streaming-responses).7[Learn more](https://developers.openai.com/api/docs/guides/streaming-responses).

8 8 

9<a id="chat.completion.chunk"></a>

10 

9## chat.completion.chunk11## chat.completion.chunk

10 12 

11Represents a streamed chunk of a chat completion response returned13Represents a streamed chunk of a chat completion response returned


16 18 

17Schema name: `CreateChatCompletionStreamResponse`19Schema name: `CreateChatCompletionStreamResponse`

18 20 

19```json21- `id: string`

20{22 

21 "(resource) chat.completions > (model) chat_completion_chunk > (schema)": {23 A unique identifier for the chat completion. Each chunk has the same ID.

22 "kind": "HttpDeclTypeAlias",24 

23 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse",25- `choices: array of object { delta, finish_reason, index, logprobs }`

24 "docstring": "Represents a streamed chunk of a chat completion response returned\nby the model, based on the provided input.\n[Learn more](/api/docs/guides/streaming-responses).\n",26 

25 "ident": "ChatCompletionChunk",27 A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the

26 "type": {28 last chunk if you set `stream_options: {"include_usage": true}`.

27 "kind": "HttpTypeObject",29 

28 "members": [30 - `delta: object { content, function_call, refusal, 2 more }`

29 {31 

30 "ident": "id"32 A chat completion delta generated by streamed model responses.

31 },33 

32 {34 - `content: optional string or null`

33 "ident": "choices"35 

34 },36 The contents of the chunk message.

35 {37 

36 "ident": "created"38 - `function_call: optional object { arguments, name }`

37 },39 

38 {40 Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.

39 "ident": "model"41 

40 },42 - `arguments: optional string`

41 {43 

42 "ident": "object"44 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.

43 },45 

44 {46 - `name: optional string`

45 "ident": "moderation"47 

46 },48 The name of the function to call.

47 {49 

48 "ident": "obfuscation"50 - `refusal: optional string or null`

49 },51 

50 {52 The refusal message generated by the model.

51 "ident": "service_tier"53 

52 },54 - `role: optional "developer" or "system" or "user" or 2 more`

53 {55 

54 "ident": "system_fingerprint"56 The role of the author of this message.

55 },57 

56 {58 - `"developer"`

57 "ident": "usage"59 

58 }60 - `"system"`

59 ]61 

60 },62 - `"user"`

61 "childrenParentSchema": "object",63 

62 "children": [64 - `"assistant"`

63 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) id",65 

64 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices",66 - `"tool"`

65 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) created",67 

66 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) model",68 - `tool_calls: optional array of object { index, id, function, type }`

67 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) object",69 

68 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation",70 - `index: number`

69 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) obfuscation",71 

70 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier",72 - `id: optional string`

71 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) system_fingerprint",73 

72 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) usage"74 The ID of the tool call.

73 ]75 

74 },76 - `function: optional object { arguments, name }`

75 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) id": {77 

76 "kind": "HttpDeclProperty",78 - `arguments: optional string`

77 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/id",79 

78 "deprecated": false,80 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.

79 "key": "id",81 

80 "docstring": "A unique identifier for the chat completion. Each chunk has the same ID.",82 - `name: optional string`

81 "type": {83 

82 "kind": "HttpTypeString"84 The name of the function to call.

83 },85 

84 "optional": false,86 - `type: optional "function"`

85 "nullable": false,87 

86 "schemaType": "string",88 The type of the tool. Currently, only `function` is supported.

87 "children": []89 

88 },90 - `"function"`

89 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices": {91 

90 "kind": "HttpDeclProperty",92 - `finish_reason: "stop" or "length" or "tool_calls" or 2 more or null`

91 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/choices",93 

92 "deprecated": false,94 The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,

93 "key": "choices",95 `length` if the maximum number of tokens specified in the request was reached,

94 "docstring": "A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the\nlast chunk if you set `stream_options: {\"include_usage\": true}`.\n",96 `content_filter` if content was omitted due to a flag from our content filters,

95 "type": {97 `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.

96 "kind": "HttpTypeArray",98 

97 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/choices",99 - `"stop"`

98 "elementType": {100 

99 "kind": "HttpTypeObject",101 - `"length"`

100 "members": [102 

101 {103 - `"tool_calls"`

102 "ident": "delta"104 

103 },105 - `"content_filter"`

104 {106 

105 "ident": "finish_reason"107 - `"function_call"`

106 },108 

107 {109 - `index: number`

108 "ident": "index"110 

109 },111 The index of the choice in the list of choices.

110 {112 

111 "ident": "logprobs"113 - `logprobs: optional object { content, refusal } or null`

112 }114 

113 ]115 Log probability information for the choice.

114 }116 

115 },117 - `content: array of ChatCompletionTokenLogprob or null`

116 "optional": false,118 

117 "nullable": false,119 A list of message content tokens with log probability information.

118 "schemaType": "array",120 

119 "childrenParentSchema": "object",121 - `token: string`

120 "children": [122 

121 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta",123 The token.

122 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) finish_reason",124 

123 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) index",125 - `bytes: array of number or null`

124 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) logprobs"126 

125 ]127 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.

126 },128 

127 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) created": {129 - `logprob: number`

128 "kind": "HttpDeclProperty",130 

129 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/created",131 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.

130 "deprecated": false,132 

131 "key": "created",133 - `top_logprobs: array of object { token, bytes, logprob }`

132 "docstring": "The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.",134 

133 "type": {135 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`.

134 "kind": "HttpTypeNumber"136 

135 },137 - `token: string`

136 "constraints": {138 

137 "format": "unixtime"139 The token.

138 },140 

139 "optional": false,141 - `bytes: array of number or null`

140 "nullable": false,142 

141 "schemaType": "integer",143 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.

142 "children": []144 

143 },145 - `logprob: number`

144 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) model": {146 

145 "kind": "HttpDeclProperty",147 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.

146 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/model",148 

147 "deprecated": false,149 - `refusal: array of ChatCompletionTokenLogprob or null`

148 "key": "model",150 

149 "docstring": "The model to generate the completion.",151 A list of message refusal tokens with log probability information.

150 "type": {152 

151 "kind": "HttpTypeString"153 - `token: string`

152 },154 

153 "optional": false,155 The token.

154 "nullable": false,156 

155 "schemaType": "string",157 - `bytes: array of number or null`

156 "children": []158 

157 },159 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.

158 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) object": {160 

159 "kind": "HttpDeclProperty",161 - `logprob: number`

160 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/object",162 

161 "deprecated": false,163 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.

162 "key": "object",164 

163 "docstring": "The object type, which is always `chat.completion.chunk`.",165 - `top_logprobs: array of object { token, bytes, logprob }`

164 "type": {166 

165 "kind": "HttpTypeUnion",167 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`.

166 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/object",168 

167 "types": [169- `created: number`

168 {170 

169 "kind": "HttpTypeLiteral",171 The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.

170 "literal": "chat.completion.chunk"172 

171 }173- `model: string`

172 ]174 

173 },175 The model to generate the completion.

174 "optional": false,176 

175 "nullable": false,177- `object: "chat.completion.chunk"`

176 "schemaType": "enum",178 

177 "childrenParentSchema": "enum",179 The object type, which is always `chat.completion.chunk`.

178 "children": [180 

179 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) object > (member) 0"181 - `"chat.completion.chunk"`

180 ]182 

181 },183- `moderation: optional object { input, output } or null`

182 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation": {184 

183 "kind": "HttpDeclProperty",185 Moderation results for the request input and generated output. Present

184 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/moderation",186 on the moderation chunk when moderated completions are requested.

185 "deprecated": false,187 

186 "key": "moderation",188 - `input: object { model, results, type } or object { code, message, type }`

187 "docstring": "Moderation results for the request input and generated output. Present\non the moderation chunk when moderated completions are requested.\n",189 

188 "type": {190 Moderation for the request input.

189 "kind": "HttpTypeObject",191 

190 "members": [192 - `ModerationResults object { model, results, type }`

191 {193 

192 "ident": "input"194 Successful moderation results for the request input or generated output.

193 },195 

194 {196 - `model: string`

195 "ident": "output"197 

196 }198 The moderation model used to generate the results.

197 ]199 

198 },200 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`

199 "optional": true,201 

200 "nullable": true,202 A list of moderation results.

201 "schemaType": "object",203 

202 "childrenParentSchema": "object",204 - `categories: map[boolean]`

203 "children": [205 

204 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input",206 A dictionary of moderation categories to booleans, True if the input is flagged under this category.

205 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output"207 

206 ]208 - `category_applied_input_types: map[array of "text" or "image"]`

207 },209 

208 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) obfuscation": {210 Which modalities of input are reflected by the score for each category.

209 "kind": "HttpDeclProperty",211 

210 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/obfuscation",212 - `"text"`

211 "deprecated": false,213 

212 "key": "obfuscation",214 - `"image"`

213 "docstring": "An obfuscation string added to normalize the size of streamed chunks as a\nmitigation to certain side-channel attacks. The field is included by\ndefault and omitted when `stream_options.include_obfuscation` is `false`.\n",215 

214 "type": {216 - `category_scores: map[number]`

215 "kind": "HttpTypeString"217 

216 },218 A dictionary of moderation categories to scores.

217 "optional": true,219 

218 "nullable": false,220 - `flagged: boolean`

219 "schemaType": "string",221 

220 "children": []222 A boolean indicating whether the content was flagged by any category.

221 },223 

222 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier": {224 - `model: string`

223 "kind": "HttpDeclProperty",225 

224 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/service_tier",226 The moderation model that produced this result.

225 "deprecated": false,227 

226 "key": "service_tier",228 - `type: "moderation_result"`

227 "docstring": "Specifies the processing type used for serving the request.\n - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.\n - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.\n - If set to '[flex](/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.\n - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.\n - When not set, the default behavior is 'auto'.\n\n When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.\n",229 

228 "type": {230 The object type, which was always `moderation_result` for successful moderation results.

229 "kind": "HttpTypeUnion",231 

230 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/service_tier",232 - `"moderation_result"`

231 "types": [233 

232 {234 - `type: "moderation_results"`

233 "kind": "HttpTypeLiteral",235 

234 "literal": "auto"236 The object type, which is always `moderation_results`.

235 },237 

236 {238 - `"moderation_results"`

237 "kind": "HttpTypeLiteral",239 

238 "literal": "default"240 - `Error object { code, message, type }`

239 },241 

240 {242 An error produced while attempting moderation.

241 "kind": "HttpTypeLiteral",243 

242 "literal": "flex"244 - `code: string`

243 },245 

244 {246 The error code.

245 "kind": "HttpTypeLiteral",247 

246 "literal": "scale"248 - `message: string`

247 },249 

248 {250 The error message.

249 "kind": "HttpTypeLiteral",251 

250 "literal": "priority"252 - `type: "error"`

251 },253 

252 {254 The object type, which is always `error`.

253 "kind": "HttpTypeLiteral",255 

254 "literal": "fast"256 - `"error"`

255 }257 

256 ]258 - `output: object { model, results, type } or object { code, message, type }`

257 },259 

258 "default": "auto",260 Moderation for the generated output.

259 "optional": true,261 

260 "nullable": true,262 - `ModerationResults object { model, results, type }`

261 "schemaType": "enum",263 

262 "childrenParentSchema": "enum",264 Successful moderation results for the request input or generated output.

263 "children": [265 

264 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier > (member) 0",266 - `model: string`

265 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier > (member) 1",267 

266 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier > (member) 2",268 The moderation model used to generate the results.

267 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier > (member) 3",269 

268 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier > (member) 4",270 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`

269 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier > (member) 5"271 

270 ]272 A list of moderation results.

271 },273 

272 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) system_fingerprint": {274 - `categories: map[boolean]`

273 "kind": "HttpDeclProperty",275 

274 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/system_fingerprint",276 A dictionary of moderation categories to booleans, True if the input is flagged under this category.

275 "deprecated": true,277 

276 "key": "system_fingerprint",278 - `category_applied_input_types: map[array of "text" or "image"]`

277 "docstring": "This fingerprint represents the backend configuration that the model runs with.\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n",279 

278 "type": {280 Which modalities of input are reflected by the score for each category.

279 "kind": "HttpTypeString"281 

280 },282 - `"text"`

281 "optional": true,283 

282 "nullable": false,284 - `"image"`

283 "schemaType": "string",285 

284 "children": []286 - `category_scores: map[number]`

285 },287 

286 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) usage": {288 A dictionary of moderation categories to scores.

287 "kind": "HttpDeclProperty",289 

288 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/usage",290 - `flagged: boolean`

289 "deprecated": false,291 

290 "key": "usage",292 A boolean indicating whether the content was flagged by any category.

291 "docstring": "An optional field that will only be present when you set\n`stream_options: {\"include_usage\": true}` in your request. When present, it\ncontains a null value **except for the last chunk** which contains the\ntoken usage statistics for the entire request.\n\n**NOTE:** If the stream is interrupted or cancelled, you may not\nreceive the final usage chunk which contains the total token usage for\nthe request.\n",293 

292 "type": {294 - `model: string`

293 "kind": "HttpTypeReference",295 

294 "ident": "CompletionUsage",296 The moderation model that produced this result.

295 "$ref": "(resource) completions > (model) completion_usage > (schema)"297 

296 },298 - `type: "moderation_result"`

297 "optional": true,299 

298 "nullable": true,300 The object type, which was always `moderation_result` for successful moderation results.

299 "modelImplicit": false,301 

300 "schemaType": "object",302 - `"moderation_result"`

301 "modelPath": "(resource) completions > (model) completion_usage",303 

302 "childrenParentSchema": "object",304 - `type: "moderation_results"`

303 "children": [305 

304 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens",306 The object type, which is always `moderation_results`.

305 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens",307 

306 "(resource) completions > (model) completion_usage > (schema) > (property) total_tokens",308 - `"moderation_results"`

307 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details",309 

308 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details"310 - `Error object { code, message, type }`

309 ]311 

310 },312 An error produced while attempting moderation.

311 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta": {313 

312 "kind": "HttpDeclProperty",314 - `code: string`

313 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/choices/items/properties/delta",315 

314 "deprecated": false,316 The error code.

315 "key": "delta",317 

316 "docstring": "A chat completion delta generated by streamed model responses.",318 - `message: string`

317 "type": {319 

318 "kind": "HttpTypeObject",320 The error message.

319 "members": [321 

320 {322 - `type: "error"`

321 "ident": "content"323 

322 },324 The object type, which is always `error`.

323 {325 

324 "ident": "function_call"326 - `"error"`

325 },327 

326 {328- `obfuscation: optional string`

327 "ident": "refusal"329 

328 },330 An obfuscation string added to normalize the size of streamed chunks as a

329 {331 mitigation to certain side-channel attacks. The field is included by

330 "ident": "role"332 default and omitted when `stream_options.include_obfuscation` is `false`.

331 },333 

332 {334- `service_tier: optional "auto" or "default" or "flex" or 3 more or null`

333 "ident": "tool_calls"335 

334 }336 Specifies the processing type used for serving the request.

335 ]337 

336 },338 - 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'.

337 "optional": false,339 - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.

338 "nullable": false,340 - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.

339 "schemaType": "object",341 - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.

340 "childrenParentSchema": "object",342 - When not set, the default behavior is 'auto'.

341 "children": [343 

342 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) content",344 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.

343 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) function_call",345 

344 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) refusal",346 - `"auto"`

345 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) role",347 

346 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls"348 - `"default"`

347 ]349 

348 },350 - `"flex"`

349 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) finish_reason": {351 

350 "kind": "HttpDeclProperty",352 - `"scale"`

351 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/choices/items/properties/finish_reason",353 

352 "deprecated": false,354 - `"priority"`

353 "key": "finish_reason",355 

354 "docstring": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n",356 - `"fast"`

355 "type": {357 

356 "kind": "HttpTypeUnion",358- `system_fingerprint: optional string`

357 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/choices/items/properties/finish_reason",359 

358 "types": [360 This fingerprint represents the backend configuration that the model runs with.

359 {361 Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.

360 "kind": "HttpTypeLiteral",362 

361 "literal": "stop"363- `usage: optional CompletionUsage or null`

362 },364 

363 {365 An optional field that will only be present when you set

364 "kind": "HttpTypeLiteral",366 `stream_options: {"include_usage": true}` in your request. When present, it

365 "literal": "length"367 contains a null value **except for the last chunk** which contains the

366 },368 token usage statistics for the entire request.

367 {369 

368 "kind": "HttpTypeLiteral",370 **NOTE:** If the stream is interrupted or cancelled, you may not

369 "literal": "tool_calls"371 receive the final usage chunk which contains the total token usage for

370 },372 the request.

371 {373 

372 "kind": "HttpTypeLiteral",374 - `completion_tokens: number`

373 "literal": "content_filter"375 

374 },376 Number of tokens in the generated completion.

375 {377 

376 "kind": "HttpTypeLiteral",378 - `prompt_tokens: number`

377 "literal": "function_call"379 

378 }380 Number of tokens in the prompt.

379 ]381 

380 },382 - `total_tokens: number`

381 "optional": false,383 

382 "nullable": true,384 Total number of tokens used in the request (prompt + completion).

383 "schemaType": "enum",385 

384 "childrenParentSchema": "enum",386 - `completion_tokens_details: optional object { accepted_prediction_tokens, audio_tokens, reasoning_tokens, 2 more }`

385 "children": [387 

386 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) finish_reason > (member) 0",388 Breakdown of tokens used in a completion.

387 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) finish_reason > (member) 1",389 

388 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) finish_reason > (member) 2",390 - `accepted_prediction_tokens: optional number`

389 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) finish_reason > (member) 3",391 

390 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) finish_reason > (member) 4"392 When using Predicted Outputs, the number of tokens in the

391 ]393 prediction that appeared in the completion.

392 },394 

393 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) index": {395 - `audio_tokens: optional number`

394 "kind": "HttpDeclProperty",396 

395 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/choices/items/properties/index",397 Audio input tokens generated by the model.

396 "deprecated": false,398 

397 "key": "index",399 - `reasoning_tokens: optional number`

398 "docstring": "The index of the choice in the list of choices.",400 

399 "type": {401 Tokens generated by the model for reasoning.

400 "kind": "HttpTypeNumber"402 

401 },403 - `rejected_prediction_tokens: optional number`

402 "optional": false,404 

403 "nullable": false,405 When using Predicted Outputs, the number of tokens in the

404 "schemaType": "integer",406 prediction that did not appear in the completion. However, like

405 "children": []407 reasoning tokens, these tokens are still counted in the total

406 },408 completion tokens for purposes of billing, output, and context window

407 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) logprobs": {409 limits.

408 "kind": "HttpDeclProperty",410 

409 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/choices/items/properties/logprobs",411 - `text_tokens: optional number`

410 "deprecated": false,412 

411 "key": "logprobs",413 Text output tokens generated by the model.

412 "docstring": "Log probability information for the choice.",414 

413 "type": {415 - `prompt_tokens_details: optional object { audio_tokens, cache_write_tokens, cached_tokens, 2 more }`

414 "kind": "HttpTypeObject",416 

415 "members": [417 Breakdown of tokens used in the prompt.

416 {418 

417 "ident": "content"419 - `audio_tokens: optional number`

418 },420 

419 {421 Audio input tokens present in the prompt.

420 "ident": "refusal"422 

421 }423 - `cache_write_tokens: optional number`

422 ]424 

423 },425 The unadjusted number of prompt tokens written to cache.

424 "optional": true,426 

425 "nullable": true,427 - `cached_tokens: optional number`

426 "schemaType": "object",428 

427 "childrenParentSchema": "object",429 Cached tokens present in the prompt.

428 "children": [430 

429 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) logprobs > (property) content",431 - `image_tokens: optional number`

430 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) logprobs > (property) refusal"432 

431 ]433 Image input tokens present in the prompt.

432 },434 

433 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) object > (member) 0": {435 - `text_tokens: optional number`

434 "kind": "HttpDeclReference",436 

435 "type": {437 Text input tokens present in the prompt.

436 "kind": "HttpTypeLiteral",

437 "literal": "chat.completion.chunk"

438 }

439 },

440 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input": {

441 "kind": "HttpDeclProperty",

442 "oasRef": "#/components/schemas/ChatCompletionModeration/properties/input",

443 "deprecated": false,

444 "key": "input",

445 "docstring": "Moderation for the request input.",

446 "type": {

447 "kind": "HttpTypeUnion",

448 "oasRef": "#/components/schemas/ChatCompletionModeration/properties/input",

449 "types": [

450 {

451 "kind": "HttpTypeObject",

452 "members": [

453 {

454 "ident": "model"

455 },

456 {

457 "ident": "results"

458 },

459 {

460 "ident": "type"

461 }

462 ]

463 },

464 {

465 "kind": "HttpTypeObject",

466 "members": [

467 {

468 "ident": "code"

469 },

470 {

471 "ident": "message"

472 },

473 {

474 "ident": "type"

475 }

476 ]

477 }

478 ]

479 },

480 "optional": false,

481 "nullable": false,

482 "schemaType": "union",

483 "childrenParentSchema": "union",

484 "children": [

485 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0",

486 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 1"

487 ]

488 },

489 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output": {

490 "kind": "HttpDeclProperty",

491 "oasRef": "#/components/schemas/ChatCompletionModeration/properties/output",

492 "deprecated": false,

493 "key": "output",

494 "docstring": "Moderation for the generated output.",

495 "type": {

496 "kind": "HttpTypeUnion",

497 "oasRef": "#/components/schemas/ChatCompletionModeration/properties/output",

498 "types": [

499 {

500 "kind": "HttpTypeObject",

501 "members": [

502 {

503 "ident": "model"

504 },

505 {

506 "ident": "results"

507 },

508 {

509 "ident": "type"

510 }

511 ]

512 },

513 {

514 "kind": "HttpTypeObject",

515 "members": [

516 {

517 "ident": "code"

518 },

519 {

520 "ident": "message"

521 },

522 {

523 "ident": "type"

524 }

525 ]

526 }

527 ]

528 },

529 "optional": false,

530 "nullable": false,

531 "schemaType": "union",

532 "childrenParentSchema": "union",

533 "children": [

534 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0",

535 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 1"

536 ]

537 },

538 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier > (member) 0": {

539 "kind": "HttpDeclReference",

540 "type": {

541 "kind": "HttpTypeLiteral",

542 "literal": "auto"

543 }

544 },

545 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier > (member) 1": {

546 "kind": "HttpDeclReference",

547 "type": {

548 "kind": "HttpTypeLiteral",

549 "literal": "default"

550 }

551 },

552 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier > (member) 2": {

553 "kind": "HttpDeclReference",

554 "type": {

555 "kind": "HttpTypeLiteral",

556 "literal": "flex"

557 }

558 },

559 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier > (member) 3": {

560 "kind": "HttpDeclReference",

561 "type": {

562 "kind": "HttpTypeLiteral",

563 "literal": "scale"

564 }

565 },

566 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier > (member) 4": {

567 "kind": "HttpDeclReference",

568 "type": {

569 "kind": "HttpTypeLiteral",

570 "literal": "priority"

571 }

572 },

573 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) service_tier > (member) 5": {

574 "kind": "HttpDeclReference",

575 "type": {

576 "kind": "HttpTypeLiteral",

577 "literal": "fast"

578 }

579 },

580 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens": {

581 "kind": "HttpDeclProperty",

582 "oasRef": "#/components/schemas/CompletionUsage/properties/completion_tokens",

583 "deprecated": false,

584 "key": "completion_tokens",

585 "docstring": "Number of tokens in the generated completion.",

586 "type": {

587 "kind": "HttpTypeNumber"

588 },

589 "default": 0,

590 "optional": false,

591 "nullable": false,

592 "schemaType": "integer",

593 "children": []

594 },

595 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens": {

596 "kind": "HttpDeclProperty",

597 "oasRef": "#/components/schemas/CompletionUsage/properties/prompt_tokens",

598 "deprecated": false,

599 "key": "prompt_tokens",

600 "docstring": "Number of tokens in the prompt.",

601 "type": {

602 "kind": "HttpTypeNumber"

603 },

604 "default": 0,

605 "optional": false,

606 "nullable": false,

607 "schemaType": "integer",

608 "children": []

609 },

610 "(resource) completions > (model) completion_usage > (schema) > (property) total_tokens": {

611 "kind": "HttpDeclProperty",

612 "oasRef": "#/components/schemas/CompletionUsage/properties/total_tokens",

613 "deprecated": false,

614 "key": "total_tokens",

615 "docstring": "Total number of tokens used in the request (prompt + completion).",

616 "type": {

617 "kind": "HttpTypeNumber"

618 },

619 "default": 0,

620 "optional": false,

621 "nullable": false,

622 "schemaType": "integer",

623 "children": []

624 },

625 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details": {

626 "kind": "HttpDeclProperty",

627 "oasRef": "#/components/schemas/CompletionUsage/properties/completion_tokens_details",

628 "deprecated": false,

629 "key": "completion_tokens_details",

630 "docstring": "Breakdown of tokens used in a completion.",

631 "type": {

632 "kind": "HttpTypeObject",

633 "members": [

634 {

635 "ident": "accepted_prediction_tokens"

636 },

637 {

638 "ident": "audio_tokens"

639 },

640 {

641 "ident": "reasoning_tokens"

642 },

643 {

644 "ident": "rejected_prediction_tokens"

645 },

646 {

647 "ident": "text_tokens"

648 }

649 ]

650 },

651 "optional": true,

652 "nullable": false,

653 "schemaType": "object",

654 "childrenParentSchema": "object",

655 "children": [

656 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details > (property) accepted_prediction_tokens",

657 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details > (property) audio_tokens",

658 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details > (property) reasoning_tokens",

659 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details > (property) rejected_prediction_tokens",

660 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details > (property) text_tokens"

661 ]

662 },

663 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details": {

664 "kind": "HttpDeclProperty",

665 "oasRef": "#/components/schemas/CompletionUsage/properties/prompt_tokens_details",

666 "deprecated": false,

667 "key": "prompt_tokens_details",

668 "docstring": "Breakdown of tokens used in the prompt.",

669 "type": {

670 "kind": "HttpTypeObject",

671 "members": [

672 {

673 "ident": "audio_tokens"

674 },

675 {

676 "ident": "cache_write_tokens"

677 },

678 {

679 "ident": "cached_tokens"

680 },

681 {

682 "ident": "image_tokens"

683 },

684 {

685 "ident": "text_tokens"

686 }

687 ]

688 },

689 "optional": true,

690 "nullable": false,

691 "schemaType": "object",

692 "childrenParentSchema": "object",

693 "children": [

694 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details > (property) audio_tokens",

695 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details > (property) cache_write_tokens",

696 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details > (property) cached_tokens",

697 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details > (property) image_tokens",

698 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details > (property) text_tokens"

699 ]

700 },

701 "(resource) completions > (model) completion_usage > (schema)": {

702 "kind": "HttpDeclTypeAlias",

703 "oasRef": "#/components/schemas/CompletionUsage",

704 "docstring": "Usage statistics for the completion request.",

705 "ident": "CompletionUsage",

706 "type": {

707 "kind": "HttpTypeObject",

708 "members": [

709 {

710 "ident": "completion_tokens"

711 },

712 {

713 "ident": "prompt_tokens"

714 },

715 {

716 "ident": "total_tokens"

717 },

718 {

719 "ident": "completion_tokens_details"

720 },

721 {

722 "ident": "prompt_tokens_details"

723 }

724 ]

725 },

726 "childrenParentSchema": "object",

727 "children": [

728 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens",

729 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens",

730 "(resource) completions > (model) completion_usage > (schema) > (property) total_tokens",

731 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details",

732 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details"

733 ]

734 },

735 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) content": {

736 "kind": "HttpDeclProperty",

737 "oasRef": "#/components/schemas/ChatCompletionStreamResponseDelta/properties/content",

738 "deprecated": false,

739 "key": "content",

740 "docstring": "The contents of the chunk message.",

741 "type": {

742 "kind": "HttpTypeString"

743 },

744 "optional": true,

745 "nullable": true,

746 "schemaType": "string",

747 "children": []

748 },

749 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) function_call": {

750 "kind": "HttpDeclProperty",

751 "oasRef": "#/components/schemas/ChatCompletionStreamResponseDelta/properties/function_call",

752 "deprecated": true,

753 "key": "function_call",

754 "docstring": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.",

755 "type": {

756 "kind": "HttpTypeObject",

757 "members": [

758 {

759 "ident": "arguments"

760 },

761 {

762 "ident": "name"

763 }

764 ]

765 },

766 "optional": true,

767 "nullable": false,

768 "schemaType": "object",

769 "childrenParentSchema": "object",

770 "children": [

771 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) function_call > (property) arguments",

772 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) function_call > (property) name"

773 ]

774 },

775 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) refusal": {

776 "kind": "HttpDeclProperty",

777 "oasRef": "#/components/schemas/ChatCompletionStreamResponseDelta/properties/refusal",

778 "deprecated": false,

779 "key": "refusal",

780 "docstring": "The refusal message generated by the model.",

781 "type": {

782 "kind": "HttpTypeString"

783 },

784 "optional": true,

785 "nullable": true,

786 "schemaType": "string",

787 "children": []

788 },

789 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) role": {

790 "kind": "HttpDeclProperty",

791 "oasRef": "#/components/schemas/ChatCompletionStreamResponseDelta/properties/role",

792 "deprecated": false,

793 "key": "role",

794 "docstring": "The role of the author of this message.",

795 "type": {

796 "kind": "HttpTypeUnion",

797 "oasRef": "#/components/schemas/ChatCompletionStreamResponseDelta/properties/role",

798 "types": [

799 {

800 "kind": "HttpTypeLiteral",

801 "literal": "developer"

802 },

803 {

804 "kind": "HttpTypeLiteral",

805 "literal": "system"

806 },

807 {

808 "kind": "HttpTypeLiteral",

809 "literal": "user"

810 },

811 {

812 "kind": "HttpTypeLiteral",

813 "literal": "assistant"

814 },

815 {

816 "kind": "HttpTypeLiteral",

817 "literal": "tool"

818 }

819 ]

820 },

821 "optional": true,

822 "nullable": false,

823 "schemaType": "enum",

824 "childrenParentSchema": "enum",

825 "children": [

826 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) role > (member) 0",

827 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) role > (member) 1",

828 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) role > (member) 2",

829 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) role > (member) 3",

830 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) role > (member) 4"

831 ]

832 },

833 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls": {

834 "kind": "HttpDeclProperty",

835 "oasRef": "#/components/schemas/ChatCompletionStreamResponseDelta/properties/tool_calls",

836 "deprecated": false,

837 "key": "tool_calls",

838 "type": {

839 "kind": "HttpTypeArray",

840 "oasRef": "#/components/schemas/ChatCompletionStreamResponseDelta/properties/tool_calls",

841 "elementType": {

842 "kind": "HttpTypeObject",

843 "members": [

844 {

845 "ident": "index"

846 },

847 {

848 "ident": "id"

849 },

850 {

851 "ident": "function"

852 },

853 {

854 "ident": "type"

855 }

856 ]

857 }

858 },

859 "optional": true,

860 "nullable": false,

861 "schemaType": "array",

862 "childrenParentSchema": "object",

863 "children": [

864 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) index",

865 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) id",

866 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) function",

867 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) type"

868 ]

869 },

870 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) finish_reason > (member) 0": {

871 "kind": "HttpDeclReference",

872 "type": {

873 "kind": "HttpTypeLiteral",

874 "literal": "stop"

875 }

876 },

877 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) finish_reason > (member) 1": {

878 "kind": "HttpDeclReference",

879 "type": {

880 "kind": "HttpTypeLiteral",

881 "literal": "length"

882 }

883 },

884 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) finish_reason > (member) 2": {

885 "kind": "HttpDeclReference",

886 "type": {

887 "kind": "HttpTypeLiteral",

888 "literal": "tool_calls"

889 }

890 },

891 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) finish_reason > (member) 3": {

892 "kind": "HttpDeclReference",

893 "type": {

894 "kind": "HttpTypeLiteral",

895 "literal": "content_filter"

896 }

897 },

898 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) finish_reason > (member) 4": {

899 "kind": "HttpDeclReference",

900 "type": {

901 "kind": "HttpTypeLiteral",

902 "literal": "function_call"

903 }

904 },

905 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) logprobs > (property) content": {

906 "kind": "HttpDeclProperty",

907 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/choices/items/properties/logprobs/properties/content",

908 "deprecated": false,

909 "key": "content",

910 "docstring": "A list of message content tokens with log probability information.",

911 "type": {

912 "kind": "HttpTypeArray",

913 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/choices/items/properties/logprobs/properties/content",

914 "elementType": {

915 "kind": "HttpTypeReference",

916 "ident": "ChatCompletionTokenLogprob",

917 "$ref": "(resource) chat.completions > (model) chat_completion_token_logprob > (schema)"

918 }

919 },

920 "optional": false,

921 "nullable": true,

922 "schemaType": "array",

923 "childrenParentSchema": "object",

924 "children": [

925 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) token",

926 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) bytes",

927 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) logprob",

928 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) top_logprobs"

929 ]

930 },

931 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) logprobs > (property) refusal": {

932 "kind": "HttpDeclProperty",

933 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/choices/items/properties/logprobs/properties/refusal",

934 "deprecated": false,

935 "key": "refusal",

936 "docstring": "A list of message refusal tokens with log probability information.",

937 "type": {

938 "kind": "HttpTypeArray",

939 "oasRef": "#/components/schemas/CreateChatCompletionStreamResponse/properties/choices/items/properties/logprobs/properties/refusal",

940 "elementType": {

941 "kind": "HttpTypeReference",

942 "ident": "ChatCompletionTokenLogprob",

943 "$ref": "(resource) chat.completions > (model) chat_completion_token_logprob > (schema)"

944 }

945 },

946 "optional": false,

947 "nullable": true,

948 "schemaType": "array",

949 "childrenParentSchema": "object",

950 "children": [

951 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) token",

952 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) bytes",

953 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) logprob",

954 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) top_logprobs"

955 ]

956 },

957 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0": {

958 "kind": "HttpDeclTypeAlias",

959 "oasRef": "#/components/schemas/ChatCompletionModeration/properties/input/oneOf/0",

960 "docstring": "Successful moderation results for the request input or generated output.",

961 "ident": "ModerationResults",

962 "type": {

963 "kind": "HttpTypeObject",

964 "members": [

965 {

966 "ident": "model"

967 },

968 {

969 "ident": "results"

970 },

971 {

972 "ident": "type"

973 }

974 ]

975 },

976 "childrenParentSchema": "object",

977 "children": [

978 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) model",

979 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results",

980 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) type"

981 ]

982 },

983 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 1": {

984 "kind": "HttpDeclTypeAlias",

985 "oasRef": "#/components/schemas/ChatCompletionModeration/properties/input/oneOf/1",

986 "docstring": "An error produced while attempting moderation.",

987 "ident": "Error",

988 "type": {

989 "kind": "HttpTypeObject",

990 "members": [

991 {

992 "ident": "code"

993 },

994 {

995 "ident": "message"

996 },

997 {

998 "ident": "type"

999 }

1000 ]

1001 },

1002 "childrenParentSchema": "object",

1003 "children": [

1004 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 1 > (property) code",

1005 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 1 > (property) message",

1006 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 1 > (property) type"

1007 ]

1008 },

1009 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0": {

1010 "kind": "HttpDeclTypeAlias",

1011 "oasRef": "#/components/schemas/ChatCompletionModeration/properties/output/oneOf/0",

1012 "docstring": "Successful moderation results for the request input or generated output.",

1013 "ident": "ModerationResults",

1014 "type": {

1015 "kind": "HttpTypeObject",

1016 "members": [

1017 {

1018 "ident": "model"

1019 },

1020 {

1021 "ident": "results"

1022 },

1023 {

1024 "ident": "type"

1025 }

1026 ]

1027 },

1028 "childrenParentSchema": "object",

1029 "children": [

1030 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) model",

1031 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results",

1032 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) type"

1033 ]

1034 },

1035 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 1": {

1036 "kind": "HttpDeclTypeAlias",

1037 "oasRef": "#/components/schemas/ChatCompletionModeration/properties/output/oneOf/1",

1038 "docstring": "An error produced while attempting moderation.",

1039 "ident": "Error",

1040 "type": {

1041 "kind": "HttpTypeObject",

1042 "members": [

1043 {

1044 "ident": "code"

1045 },

1046 {

1047 "ident": "message"

1048 },

1049 {

1050 "ident": "type"

1051 }

1052 ]

1053 },

1054 "childrenParentSchema": "object",

1055 "children": [

1056 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 1 > (property) code",

1057 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 1 > (property) message",

1058 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 1 > (property) type"

1059 ]

1060 },

1061 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details > (property) accepted_prediction_tokens": {

1062 "kind": "HttpDeclProperty",

1063 "oasRef": "#/components/schemas/CompletionUsage/properties/completion_tokens_details/properties/accepted_prediction_tokens",

1064 "deprecated": false,

1065 "key": "accepted_prediction_tokens",

1066 "docstring": "When using Predicted Outputs, the number of tokens in the\nprediction that appeared in the completion.\n",

1067 "type": {

1068 "kind": "HttpTypeNumber"

1069 },

1070 "default": 0,

1071 "optional": true,

1072 "nullable": false,

1073 "schemaType": "integer",

1074 "children": []

1075 },

1076 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details > (property) audio_tokens": {

1077 "kind": "HttpDeclProperty",

1078 "oasRef": "#/components/schemas/CompletionUsage/properties/completion_tokens_details/properties/audio_tokens",

1079 "deprecated": false,

1080 "key": "audio_tokens",

1081 "docstring": "Audio input tokens generated by the model.",

1082 "type": {

1083 "kind": "HttpTypeNumber"

1084 },

1085 "default": 0,

1086 "optional": true,

1087 "nullable": false,

1088 "schemaType": "integer",

1089 "children": []

1090 },

1091 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details > (property) reasoning_tokens": {

1092 "kind": "HttpDeclProperty",

1093 "oasRef": "#/components/schemas/CompletionUsage/properties/completion_tokens_details/properties/reasoning_tokens",

1094 "deprecated": false,

1095 "key": "reasoning_tokens",

1096 "docstring": "Tokens generated by the model for reasoning.",

1097 "type": {

1098 "kind": "HttpTypeNumber"

1099 },

1100 "default": 0,

1101 "optional": true,

1102 "nullable": false,

1103 "schemaType": "integer",

1104 "children": []

1105 },

1106 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details > (property) rejected_prediction_tokens": {

1107 "kind": "HttpDeclProperty",

1108 "oasRef": "#/components/schemas/CompletionUsage/properties/completion_tokens_details/properties/rejected_prediction_tokens",

1109 "deprecated": false,

1110 "key": "rejected_prediction_tokens",

1111 "docstring": "When using Predicted Outputs, the number of tokens in the\nprediction that did not appear in the completion. However, like\nreasoning tokens, these tokens are still counted in the total\ncompletion tokens for purposes of billing, output, and context window\nlimits.\n",

1112 "type": {

1113 "kind": "HttpTypeNumber"

1114 },

1115 "default": 0,

1116 "optional": true,

1117 "nullable": false,

1118 "schemaType": "integer",

1119 "children": []

1120 },

1121 "(resource) completions > (model) completion_usage > (schema) > (property) completion_tokens_details > (property) text_tokens": {

1122 "kind": "HttpDeclProperty",

1123 "oasRef": "#/components/schemas/CompletionUsage/properties/completion_tokens_details/properties/text_tokens",

1124 "deprecated": false,

1125 "key": "text_tokens",

1126 "docstring": "Text output tokens generated by the model.",

1127 "type": {

1128 "kind": "HttpTypeNumber"

1129 },

1130 "optional": true,

1131 "nullable": false,

1132 "schemaType": "integer",

1133 "children": []

1134 },

1135 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details > (property) audio_tokens": {

1136 "kind": "HttpDeclProperty",

1137 "oasRef": "#/components/schemas/CompletionUsage/properties/prompt_tokens_details/properties/audio_tokens",

1138 "deprecated": false,

1139 "key": "audio_tokens",

1140 "docstring": "Audio input tokens present in the prompt.",

1141 "type": {

1142 "kind": "HttpTypeNumber"

1143 },

1144 "default": 0,

1145 "optional": true,

1146 "nullable": false,

1147 "schemaType": "integer",

1148 "children": []

1149 },

1150 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details > (property) cache_write_tokens": {

1151 "kind": "HttpDeclProperty",

1152 "oasRef": "#/components/schemas/CompletionUsage/properties/prompt_tokens_details/properties/cache_write_tokens",

1153 "deprecated": false,

1154 "key": "cache_write_tokens",

1155 "docstring": "The unadjusted number of prompt tokens written to cache.",

1156 "type": {

1157 "kind": "HttpTypeNumber"

1158 },

1159 "default": 0,

1160 "optional": true,

1161 "nullable": false,

1162 "schemaType": "integer",

1163 "children": []

1164 },

1165 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details > (property) cached_tokens": {

1166 "kind": "HttpDeclProperty",

1167 "oasRef": "#/components/schemas/CompletionUsage/properties/prompt_tokens_details/properties/cached_tokens",

1168 "deprecated": false,

1169 "key": "cached_tokens",

1170 "docstring": "Cached tokens present in the prompt.",

1171 "type": {

1172 "kind": "HttpTypeNumber"

1173 },

1174 "default": 0,

1175 "optional": true,

1176 "nullable": false,

1177 "schemaType": "integer",

1178 "children": []

1179 },

1180 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details > (property) image_tokens": {

1181 "kind": "HttpDeclProperty",

1182 "oasRef": "#/components/schemas/CompletionUsage/properties/prompt_tokens_details/properties/image_tokens",

1183 "deprecated": false,

1184 "key": "image_tokens",

1185 "docstring": "Image input tokens present in the prompt.",

1186 "type": {

1187 "kind": "HttpTypeNumber"

1188 },

1189 "optional": true,

1190 "nullable": false,

1191 "schemaType": "integer",

1192 "children": []

1193 },

1194 "(resource) completions > (model) completion_usage > (schema) > (property) prompt_tokens_details > (property) text_tokens": {

1195 "kind": "HttpDeclProperty",

1196 "oasRef": "#/components/schemas/CompletionUsage/properties/prompt_tokens_details/properties/text_tokens",

1197 "deprecated": false,

1198 "key": "text_tokens",

1199 "docstring": "Text input tokens present in the prompt.",

1200 "type": {

1201 "kind": "HttpTypeNumber"

1202 },

1203 "optional": true,

1204 "nullable": false,

1205 "schemaType": "integer",

1206 "children": []

1207 },

1208 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) function_call > (property) arguments": {

1209 "kind": "HttpDeclProperty",

1210 "oasRef": "#/components/schemas/ChatCompletionStreamResponseDelta/properties/function_call/properties/arguments",

1211 "deprecated": false,

1212 "key": "arguments",

1213 "docstring": "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.",

1214 "type": {

1215 "kind": "HttpTypeString"

1216 },

1217 "optional": true,

1218 "nullable": false,

1219 "schemaType": "string",

1220 "children": []

1221 },

1222 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) function_call > (property) name": {

1223 "kind": "HttpDeclProperty",

1224 "oasRef": "#/components/schemas/ChatCompletionStreamResponseDelta/properties/function_call/properties/name",

1225 "deprecated": false,

1226 "key": "name",

1227 "docstring": "The name of the function to call.",

1228 "type": {

1229 "kind": "HttpTypeString"

1230 },

1231 "optional": true,

1232 "nullable": false,

1233 "schemaType": "string",

1234 "children": []

1235 },

1236 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) role > (member) 0": {

1237 "kind": "HttpDeclReference",

1238 "type": {

1239 "kind": "HttpTypeLiteral",

1240 "literal": "developer"

1241 }

1242 },

1243 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) role > (member) 1": {

1244 "kind": "HttpDeclReference",

1245 "type": {

1246 "kind": "HttpTypeLiteral",

1247 "literal": "system"

1248 }

1249 },

1250 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) role > (member) 2": {

1251 "kind": "HttpDeclReference",

1252 "type": {

1253 "kind": "HttpTypeLiteral",

1254 "literal": "user"

1255 }

1256 },

1257 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) role > (member) 3": {

1258 "kind": "HttpDeclReference",

1259 "type": {

1260 "kind": "HttpTypeLiteral",

1261 "literal": "assistant"

1262 }

1263 },

1264 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) role > (member) 4": {

1265 "kind": "HttpDeclReference",

1266 "type": {

1267 "kind": "HttpTypeLiteral",

1268 "literal": "tool"

1269 }

1270 },

1271 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) index": {

1272 "kind": "HttpDeclProperty",

1273 "oasRef": "#/components/schemas/ChatCompletionMessageToolCallChunk/properties/index",

1274 "deprecated": false,

1275 "key": "index",

1276 "type": {

1277 "kind": "HttpTypeNumber"

1278 },

1279 "optional": false,

1280 "nullable": false,

1281 "schemaType": "integer",

1282 "children": []

1283 },

1284 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) id": {

1285 "kind": "HttpDeclProperty",

1286 "oasRef": "#/components/schemas/ChatCompletionMessageToolCallChunk/properties/id",

1287 "deprecated": false,

1288 "key": "id",

1289 "docstring": "The ID of the tool call.",

1290 "type": {

1291 "kind": "HttpTypeString"

1292 },

1293 "optional": true,

1294 "nullable": false,

1295 "schemaType": "string",

1296 "children": []

1297 },

1298 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) function": {

1299 "kind": "HttpDeclProperty",

1300 "oasRef": "#/components/schemas/ChatCompletionMessageToolCallChunk/properties/function",

1301 "deprecated": false,

1302 "key": "function",

1303 "type": {

1304 "kind": "HttpTypeObject",

1305 "members": [

1306 {

1307 "ident": "arguments"

1308 },

1309 {

1310 "ident": "name"

1311 }

1312 ]

1313 },

1314 "optional": true,

1315 "nullable": false,

1316 "schemaType": "object",

1317 "childrenParentSchema": "object",

1318 "children": [

1319 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) function > (property) arguments",

1320 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) function > (property) name"

1321 ]

1322 },

1323 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) type": {

1324 "kind": "HttpDeclProperty",

1325 "oasRef": "#/components/schemas/ChatCompletionMessageToolCallChunk/properties/type",

1326 "deprecated": false,

1327 "key": "type",

1328 "docstring": "The type of the tool. Currently, only `function` is supported.",

1329 "type": {

1330 "kind": "HttpTypeUnion",

1331 "oasRef": "#/components/schemas/ChatCompletionMessageToolCallChunk/properties/type",

1332 "types": [

1333 {

1334 "kind": "HttpTypeLiteral",

1335 "literal": "function"

1336 }

1337 ]

1338 },

1339 "optional": true,

1340 "nullable": false,

1341 "schemaType": "enum",

1342 "childrenParentSchema": "enum",

1343 "children": [

1344 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) type > (member) 0"

1345 ]

1346 },

1347 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) token": {

1348 "kind": "HttpDeclProperty",

1349 "oasRef": "#/components/schemas/ChatCompletionTokenLogprob/properties/token",

1350 "deprecated": false,

1351 "key": "token",

1352 "docstring": "The token.",

1353 "type": {

1354 "kind": "HttpTypeString"

1355 },

1356 "optional": false,

1357 "nullable": false,

1358 "schemaType": "string",

1359 "children": []

1360 },

1361 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) bytes": {

1362 "kind": "HttpDeclProperty",

1363 "oasRef": "#/components/schemas/ChatCompletionTokenLogprob/properties/bytes",

1364 "deprecated": false,

1365 "key": "bytes",

1366 "docstring": "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.",

1367 "type": {

1368 "kind": "HttpTypeArray",

1369 "oasRef": "#/components/schemas/ChatCompletionTokenLogprob/properties/bytes",

1370 "elementType": {

1371 "kind": "HttpTypeNumber"

1372 }

1373 },

1374 "optional": false,

1375 "nullable": true,

1376 "schemaType": "array",

1377 "children": []

1378 },

1379 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) logprob": {

1380 "kind": "HttpDeclProperty",

1381 "oasRef": "#/components/schemas/ChatCompletionTokenLogprob/properties/logprob",

1382 "deprecated": false,

1383 "key": "logprob",

1384 "docstring": "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.",

1385 "type": {

1386 "kind": "HttpTypeNumber"

1387 },

1388 "optional": false,

1389 "nullable": false,

1390 "schemaType": "number",

1391 "children": []

1392 },

1393 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) top_logprobs": {

1394 "kind": "HttpDeclProperty",

1395 "oasRef": "#/components/schemas/ChatCompletionTokenLogprob/properties/top_logprobs",

1396 "deprecated": false,

1397 "key": "top_logprobs",

1398 "docstring": "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`.",

1399 "type": {

1400 "kind": "HttpTypeArray",

1401 "oasRef": "#/components/schemas/ChatCompletionTokenLogprob/properties/top_logprobs",

1402 "elementType": {

1403 "kind": "HttpTypeObject",

1404 "members": [

1405 {

1406 "ident": "token"

1407 },

1408 {

1409 "ident": "bytes"

1410 },

1411 {

1412 "ident": "logprob"

1413 }

1414 ]

1415 }

1416 },

1417 "optional": false,

1418 "nullable": false,

1419 "schemaType": "array",

1420 "childrenParentSchema": "object",

1421 "children": [

1422 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) top_logprobs > (items) > (property) token",

1423 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) top_logprobs > (items) > (property) bytes",

1424 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) top_logprobs > (items) > (property) logprob"

1425 ]

1426 },

1427 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema)": {

1428 "kind": "HttpDeclTypeAlias",

1429 "oasRef": "#/components/schemas/ChatCompletionTokenLogprob",

1430 "ident": "ChatCompletionTokenLogprob",

1431 "type": {

1432 "kind": "HttpTypeObject",

1433 "members": [

1434 {

1435 "ident": "token"

1436 },

1437 {

1438 "ident": "bytes"

1439 },

1440 {

1441 "ident": "logprob"

1442 },

1443 {

1444 "ident": "top_logprobs"

1445 }

1446 ]

1447 },

1448 "childrenParentSchema": "object",

1449 "children": [

1450 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) token",

1451 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) bytes",

1452 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) logprob",

1453 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) top_logprobs"

1454 ]

1455 },

1456 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) model": {

1457 "kind": "HttpDeclProperty",

1458 "oasRef": "#/components/schemas/ChatCompletionModerationResults/properties/model",

1459 "deprecated": false,

1460 "key": "model",

1461 "docstring": "The moderation model used to generate the results.",

1462 "type": {

1463 "kind": "HttpTypeString"

1464 },

1465 "optional": false,

1466 "nullable": false,

1467 "schemaType": "string",

1468 "children": []

1469 },

1470 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results": {

1471 "kind": "HttpDeclProperty",

1472 "oasRef": "#/components/schemas/ChatCompletionModerationResults/properties/results",

1473 "deprecated": false,

1474 "key": "results",

1475 "docstring": "A list of moderation results.",

1476 "type": {

1477 "kind": "HttpTypeArray",

1478 "oasRef": "#/components/schemas/ChatCompletionModerationResults/properties/results",

1479 "elementType": {

1480 "kind": "HttpTypeObject",

1481 "members": [

1482 {

1483 "ident": "categories"

1484 },

1485 {

1486 "ident": "category_applied_input_types"

1487 },

1488 {

1489 "ident": "category_scores"

1490 },

1491 {

1492 "ident": "flagged"

1493 },

1494 {

1495 "ident": "model"

1496 },

1497 {

1498 "ident": "type"

1499 }

1500 ]

1501 }

1502 },

1503 "optional": false,

1504 "nullable": false,

1505 "schemaType": "array",

1506 "childrenParentSchema": "object",

1507 "children": [

1508 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) categories",

1509 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) category_applied_input_types",

1510 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) category_scores",

1511 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) flagged",

1512 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) model",

1513 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) type"

1514 ]

1515 },

1516 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) type": {

1517 "kind": "HttpDeclProperty",

1518 "oasRef": "#/components/schemas/ChatCompletionModerationResults/properties/type",

1519 "deprecated": false,

1520 "key": "type",

1521 "docstring": "The object type, which is always `moderation_results`.",

1522 "type": {

1523 "kind": "HttpTypeUnion",

1524 "oasRef": "#/components/schemas/ChatCompletionModerationResults/properties/type",

1525 "types": [

1526 {

1527 "kind": "HttpTypeLiteral",

1528 "literal": "moderation_results"

1529 }

1530 ]

1531 },

1532 "optional": false,

1533 "nullable": false,

1534 "schemaType": "enum",

1535 "childrenParentSchema": "enum",

1536 "children": [

1537 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) type > (member) 0"

1538 ]

1539 },

1540 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 1 > (property) code": {

1541 "kind": "HttpDeclProperty",

1542 "oasRef": "#/components/schemas/ChatCompletionModerationError/properties/code",

1543 "deprecated": false,

1544 "key": "code",

1545 "docstring": "The error code.",

1546 "type": {

1547 "kind": "HttpTypeString"

1548 },

1549 "optional": false,

1550 "nullable": false,

1551 "schemaType": "string",

1552 "children": []

1553 },

1554 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 1 > (property) message": {

1555 "kind": "HttpDeclProperty",

1556 "oasRef": "#/components/schemas/ChatCompletionModerationError/properties/message",

1557 "deprecated": false,

1558 "key": "message",

1559 "docstring": "The error message.",

1560 "type": {

1561 "kind": "HttpTypeString"

1562 },

1563 "optional": false,

1564 "nullable": false,

1565 "schemaType": "string",

1566 "children": []

1567 },

1568 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 1 > (property) type": {

1569 "kind": "HttpDeclProperty",

1570 "oasRef": "#/components/schemas/ChatCompletionModerationError/properties/type",

1571 "deprecated": false,

1572 "key": "type",

1573 "docstring": "The object type, which is always `error`.",

1574 "type": {

1575 "kind": "HttpTypeUnion",

1576 "oasRef": "#/components/schemas/ChatCompletionModerationError/properties/type",

1577 "types": [

1578 {

1579 "kind": "HttpTypeLiteral",

1580 "literal": "error"

1581 }

1582 ]

1583 },

1584 "optional": false,

1585 "nullable": false,

1586 "schemaType": "enum",

1587 "childrenParentSchema": "enum",

1588 "children": [

1589 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 1 > (property) type > (member) 0"

1590 ]

1591 },

1592 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) model": {

1593 "kind": "HttpDeclProperty",

1594 "oasRef": "#/components/schemas/ChatCompletionModerationResults/properties/model",

1595 "deprecated": false,

1596 "key": "model",

1597 "docstring": "The moderation model used to generate the results.",

1598 "type": {

1599 "kind": "HttpTypeString"

1600 },

1601 "optional": false,

1602 "nullable": false,

1603 "schemaType": "string",

1604 "children": []

1605 },

1606 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results": {

1607 "kind": "HttpDeclProperty",

1608 "oasRef": "#/components/schemas/ChatCompletionModerationResults/properties/results",

1609 "deprecated": false,

1610 "key": "results",

1611 "docstring": "A list of moderation results.",

1612 "type": {

1613 "kind": "HttpTypeArray",

1614 "oasRef": "#/components/schemas/ChatCompletionModerationResults/properties/results",

1615 "elementType": {

1616 "kind": "HttpTypeObject",

1617 "members": [

1618 {

1619 "ident": "categories"

1620 },

1621 {

1622 "ident": "category_applied_input_types"

1623 },

1624 {

1625 "ident": "category_scores"

1626 },

1627 {

1628 "ident": "flagged"

1629 },

1630 {

1631 "ident": "model"

1632 },

1633 {

1634 "ident": "type"

1635 }

1636 ]

1637 }

1638 },

1639 "optional": false,

1640 "nullable": false,

1641 "schemaType": "array",

1642 "childrenParentSchema": "object",

1643 "children": [

1644 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) categories",

1645 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) category_applied_input_types",

1646 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) category_scores",

1647 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) flagged",

1648 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) model",

1649 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) type"

1650 ]

1651 },

1652 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) type": {

1653 "kind": "HttpDeclProperty",

1654 "oasRef": "#/components/schemas/ChatCompletionModerationResults/properties/type",

1655 "deprecated": false,

1656 "key": "type",

1657 "docstring": "The object type, which is always `moderation_results`.",

1658 "type": {

1659 "kind": "HttpTypeUnion",

1660 "oasRef": "#/components/schemas/ChatCompletionModerationResults/properties/type",

1661 "types": [

1662 {

1663 "kind": "HttpTypeLiteral",

1664 "literal": "moderation_results"

1665 }

1666 ]

1667 },

1668 "optional": false,

1669 "nullable": false,

1670 "schemaType": "enum",

1671 "childrenParentSchema": "enum",

1672 "children": [

1673 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) type > (member) 0"

1674 ]

1675 },

1676 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 1 > (property) code": {

1677 "kind": "HttpDeclProperty",

1678 "oasRef": "#/components/schemas/ChatCompletionModerationError/properties/code",

1679 "deprecated": false,

1680 "key": "code",

1681 "docstring": "The error code.",

1682 "type": {

1683 "kind": "HttpTypeString"

1684 },

1685 "optional": false,

1686 "nullable": false,

1687 "schemaType": "string",

1688 "children": []

1689 },

1690 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 1 > (property) message": {

1691 "kind": "HttpDeclProperty",

1692 "oasRef": "#/components/schemas/ChatCompletionModerationError/properties/message",

1693 "deprecated": false,

1694 "key": "message",

1695 "docstring": "The error message.",

1696 "type": {

1697 "kind": "HttpTypeString"

1698 },

1699 "optional": false,

1700 "nullable": false,

1701 "schemaType": "string",

1702 "children": []

1703 },

1704 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 1 > (property) type": {

1705 "kind": "HttpDeclProperty",

1706 "oasRef": "#/components/schemas/ChatCompletionModerationError/properties/type",

1707 "deprecated": false,

1708 "key": "type",

1709 "docstring": "The object type, which is always `error`.",

1710 "type": {

1711 "kind": "HttpTypeUnion",

1712 "oasRef": "#/components/schemas/ChatCompletionModerationError/properties/type",

1713 "types": [

1714 {

1715 "kind": "HttpTypeLiteral",

1716 "literal": "error"

1717 }

1718 ]

1719 },

1720 "optional": false,

1721 "nullable": false,

1722 "schemaType": "enum",

1723 "childrenParentSchema": "enum",

1724 "children": [

1725 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 1 > (property) type > (member) 0"

1726 ]

1727 },

1728 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) function > (property) arguments": {

1729 "kind": "HttpDeclProperty",

1730 "oasRef": "#/components/schemas/ChatCompletionMessageToolCallChunk/properties/function/properties/arguments",

1731 "deprecated": false,

1732 "key": "arguments",

1733 "docstring": "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.",

1734 "type": {

1735 "kind": "HttpTypeString"

1736 },

1737 "optional": true,

1738 "nullable": false,

1739 "schemaType": "string",

1740 "children": []

1741 },

1742 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) function > (property) name": {

1743 "kind": "HttpDeclProperty",

1744 "oasRef": "#/components/schemas/ChatCompletionMessageToolCallChunk/properties/function/properties/name",

1745 "deprecated": false,

1746 "key": "name",

1747 "docstring": "The name of the function to call.",

1748 "type": {

1749 "kind": "HttpTypeString"

1750 },

1751 "optional": true,

1752 "nullable": false,

1753 "schemaType": "string",

1754 "children": []

1755 },

1756 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) choices > (items) > (property) delta > (property) tool_calls > (items) > (property) type > (member) 0": {

1757 "kind": "HttpDeclReference",

1758 "type": {

1759 "kind": "HttpTypeLiteral",

1760 "literal": "function"

1761 }

1762 },

1763 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) top_logprobs > (items) > (property) token": {

1764 "kind": "HttpDeclProperty",

1765 "oasRef": "#/components/schemas/ChatCompletionTokenLogprob/properties/top_logprobs/items/properties/token",

1766 "deprecated": false,

1767 "key": "token",

1768 "docstring": "The token.",

1769 "type": {

1770 "kind": "HttpTypeString"

1771 },

1772 "optional": false,

1773 "nullable": false,

1774 "schemaType": "string",

1775 "children": []

1776 },

1777 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) top_logprobs > (items) > (property) bytes": {

1778 "kind": "HttpDeclProperty",

1779 "oasRef": "#/components/schemas/ChatCompletionTokenLogprob/properties/top_logprobs/items/properties/bytes",

1780 "deprecated": false,

1781 "key": "bytes",

1782 "docstring": "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.",

1783 "type": {

1784 "kind": "HttpTypeArray",

1785 "oasRef": "#/components/schemas/ChatCompletionTokenLogprob/properties/top_logprobs/items/properties/bytes",

1786 "elementType": {

1787 "kind": "HttpTypeNumber"

1788 }

1789 },

1790 "optional": false,

1791 "nullable": true,

1792 "schemaType": "array",

1793 "children": []

1794 },

1795 "(resource) chat.completions > (model) chat_completion_token_logprob > (schema) > (property) top_logprobs > (items) > (property) logprob": {

1796 "kind": "HttpDeclProperty",

1797 "oasRef": "#/components/schemas/ChatCompletionTokenLogprob/properties/top_logprobs/items/properties/logprob",

1798 "deprecated": false,

1799 "key": "logprob",

1800 "docstring": "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.",

1801 "type": {

1802 "kind": "HttpTypeNumber"

1803 },

1804 "optional": false,

1805 "nullable": false,

1806 "schemaType": "number",

1807 "children": []

1808 },

1809 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) categories": {

1810 "kind": "HttpDeclProperty",

1811 "oasRef": "#/components/schemas/ModerationResultBody/properties/categories",

1812 "deprecated": false,

1813 "key": "categories",

1814 "docstring": "A dictionary of moderation categories to booleans, True if the input is flagged under this category.",

1815 "type": {

1816 "kind": "HttpTypeReference",

1817 "oasRef": "#/components/schemas/ModerationResultBody/properties/categories",

1818 "ident": "Record",

1819 "typeParameters": [

1820 {

1821 "kind": "HttpTypeString"

1822 },

1823 {

1824 "kind": "HttpTypeBoolean"

1825 }

1826 ]

1827 },

1828 "optional": false,

1829 "nullable": false,

1830 "schemaType": "map",

1831 "children": []

1832 },

1833 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) category_applied_input_types": {

1834 "kind": "HttpDeclProperty",

1835 "oasRef": "#/components/schemas/ModerationResultBody/properties/category_applied_input_types",

1836 "deprecated": false,

1837 "key": "category_applied_input_types",

1838 "docstring": "Which modalities of input are reflected by the score for each category.",

1839 "type": {

1840 "kind": "HttpTypeReference",

1841 "oasRef": "#/components/schemas/ModerationResultBody/properties/category_applied_input_types",

1842 "ident": "Record",

1843 "typeParameters": [

1844 {

1845 "kind": "HttpTypeString"

1846 },

1847 {

1848 "kind": "HttpTypeArray",

1849 "oasRef": "#/components/schemas/ModerationResultBody/properties/category_applied_input_types/additionalProperties",

1850 "elementType": {

1851 "kind": "HttpTypeUnion",

1852 "oasRef": "#/components/schemas/ModerationResultBody/properties/category_applied_input_types/additionalProperties/items",

1853 "types": [

1854 {

1855 "kind": "HttpTypeLiteral",

1856 "literal": "text"

1857 },

1858 {

1859 "kind": "HttpTypeLiteral",

1860 "literal": "image"

1861 }

1862 ]

1863 }

1864 }

1865 ]

1866 },

1867 "optional": false,

1868 "nullable": false,

1869 "schemaType": "map",

1870 "childrenParentSchema": "enum",

1871 "children": [

1872 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) category_applied_input_types > (items) > (items) > (member) 0",

1873 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) category_applied_input_types > (items) > (items) > (member) 1"

1874 ]

1875 },

1876 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) category_scores": {

1877 "kind": "HttpDeclProperty",

1878 "oasRef": "#/components/schemas/ModerationResultBody/properties/category_scores",

1879 "deprecated": false,

1880 "key": "category_scores",

1881 "docstring": "A dictionary of moderation categories to scores.",

1882 "type": {

1883 "kind": "HttpTypeReference",

1884 "oasRef": "#/components/schemas/ModerationResultBody/properties/category_scores",

1885 "ident": "Record",

1886 "typeParameters": [

1887 {

1888 "kind": "HttpTypeString"

1889 },

1890 {

1891 "kind": "HttpTypeNumber"

1892 }

1893 ]

1894 },

1895 "optional": false,

1896 "nullable": false,

1897 "schemaType": "map",

1898 "children": []

1899 },

1900 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) flagged": {

1901 "kind": "HttpDeclProperty",

1902 "oasRef": "#/components/schemas/ModerationResultBody/properties/flagged",

1903 "deprecated": false,

1904 "key": "flagged",

1905 "docstring": "A boolean indicating whether the content was flagged by any category.",

1906 "type": {

1907 "kind": "HttpTypeBoolean"

1908 },

1909 "optional": false,

1910 "nullable": false,

1911 "schemaType": "boolean",

1912 "children": []

1913 },

1914 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) model": {

1915 "kind": "HttpDeclProperty",

1916 "oasRef": "#/components/schemas/ModerationResultBody/properties/model",

1917 "deprecated": false,

1918 "key": "model",

1919 "docstring": "The moderation model that produced this result.",

1920 "type": {

1921 "kind": "HttpTypeString"

1922 },

1923 "optional": false,

1924 "nullable": false,

1925 "schemaType": "string",

1926 "children": []

1927 },

1928 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) type": {

1929 "kind": "HttpDeclProperty",

1930 "oasRef": "#/components/schemas/ModerationResultBody/properties/type",

1931 "deprecated": false,

1932 "key": "type",

1933 "docstring": "The object type, which was always `moderation_result` for successful moderation results.",

1934 "type": {

1935 "kind": "HttpTypeUnion",

1936 "oasRef": "#/components/schemas/ModerationResultBody/properties/type",

1937 "types": [

1938 {

1939 "kind": "HttpTypeLiteral",

1940 "literal": "moderation_result"

1941 }

1942 ]

1943 },

1944 "default": "moderation_result",

1945 "optional": false,

1946 "nullable": false,

1947 "schemaType": "enum",

1948 "childrenParentSchema": "enum",

1949 "children": [

1950 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) type > (member) 0"

1951 ]

1952 },

1953 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) type > (member) 0": {

1954 "kind": "HttpDeclReference",

1955 "type": {

1956 "kind": "HttpTypeLiteral",

1957 "literal": "moderation_results"

1958 }

1959 },

1960 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 1 > (property) type > (member) 0": {

1961 "kind": "HttpDeclReference",

1962 "type": {

1963 "kind": "HttpTypeLiteral",

1964 "literal": "error"

1965 }

1966 },

1967 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) categories": {

1968 "kind": "HttpDeclProperty",

1969 "oasRef": "#/components/schemas/ModerationResultBody/properties/categories",

1970 "deprecated": false,

1971 "key": "categories",

1972 "docstring": "A dictionary of moderation categories to booleans, True if the input is flagged under this category.",

1973 "type": {

1974 "kind": "HttpTypeReference",

1975 "oasRef": "#/components/schemas/ModerationResultBody/properties/categories",

1976 "ident": "Record",

1977 "typeParameters": [

1978 {

1979 "kind": "HttpTypeString"

1980 },

1981 {

1982 "kind": "HttpTypeBoolean"

1983 }

1984 ]

1985 },

1986 "optional": false,

1987 "nullable": false,

1988 "schemaType": "map",

1989 "children": []

1990 },

1991 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) category_applied_input_types": {

1992 "kind": "HttpDeclProperty",

1993 "oasRef": "#/components/schemas/ModerationResultBody/properties/category_applied_input_types",

1994 "deprecated": false,

1995 "key": "category_applied_input_types",

1996 "docstring": "Which modalities of input are reflected by the score for each category.",

1997 "type": {

1998 "kind": "HttpTypeReference",

1999 "oasRef": "#/components/schemas/ModerationResultBody/properties/category_applied_input_types",

2000 "ident": "Record",

2001 "typeParameters": [

2002 {

2003 "kind": "HttpTypeString"

2004 },

2005 {

2006 "kind": "HttpTypeArray",

2007 "oasRef": "#/components/schemas/ModerationResultBody/properties/category_applied_input_types/additionalProperties",

2008 "elementType": {

2009 "kind": "HttpTypeUnion",

2010 "oasRef": "#/components/schemas/ModerationResultBody/properties/category_applied_input_types/additionalProperties/items",

2011 "types": [

2012 {

2013 "kind": "HttpTypeLiteral",

2014 "literal": "text"

2015 },

2016 {

2017 "kind": "HttpTypeLiteral",

2018 "literal": "image"

2019 }

2020 ]

2021 }

2022 }

2023 ]

2024 },

2025 "optional": false,

2026 "nullable": false,

2027 "schemaType": "map",

2028 "childrenParentSchema": "enum",

2029 "children": [

2030 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) category_applied_input_types > (items) > (items) > (member) 0",

2031 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) category_applied_input_types > (items) > (items) > (member) 1"

2032 ]

2033 },

2034 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) category_scores": {

2035 "kind": "HttpDeclProperty",

2036 "oasRef": "#/components/schemas/ModerationResultBody/properties/category_scores",

2037 "deprecated": false,

2038 "key": "category_scores",

2039 "docstring": "A dictionary of moderation categories to scores.",

2040 "type": {

2041 "kind": "HttpTypeReference",

2042 "oasRef": "#/components/schemas/ModerationResultBody/properties/category_scores",

2043 "ident": "Record",

2044 "typeParameters": [

2045 {

2046 "kind": "HttpTypeString"

2047 },

2048 {

2049 "kind": "HttpTypeNumber"

2050 }

2051 ]

2052 },

2053 "optional": false,

2054 "nullable": false,

2055 "schemaType": "map",

2056 "children": []

2057 },

2058 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) flagged": {

2059 "kind": "HttpDeclProperty",

2060 "oasRef": "#/components/schemas/ModerationResultBody/properties/flagged",

2061 "deprecated": false,

2062 "key": "flagged",

2063 "docstring": "A boolean indicating whether the content was flagged by any category.",

2064 "type": {

2065 "kind": "HttpTypeBoolean"

2066 },

2067 "optional": false,

2068 "nullable": false,

2069 "schemaType": "boolean",

2070 "children": []

2071 },

2072 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) model": {

2073 "kind": "HttpDeclProperty",

2074 "oasRef": "#/components/schemas/ModerationResultBody/properties/model",

2075 "deprecated": false,

2076 "key": "model",

2077 "docstring": "The moderation model that produced this result.",

2078 "type": {

2079 "kind": "HttpTypeString"

2080 },

2081 "optional": false,

2082 "nullable": false,

2083 "schemaType": "string",

2084 "children": []

2085 },

2086 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) type": {

2087 "kind": "HttpDeclProperty",

2088 "oasRef": "#/components/schemas/ModerationResultBody/properties/type",

2089 "deprecated": false,

2090 "key": "type",

2091 "docstring": "The object type, which was always `moderation_result` for successful moderation results.",

2092 "type": {

2093 "kind": "HttpTypeUnion",

2094 "oasRef": "#/components/schemas/ModerationResultBody/properties/type",

2095 "types": [

2096 {

2097 "kind": "HttpTypeLiteral",

2098 "literal": "moderation_result"

2099 }

2100 ]

2101 },

2102 "default": "moderation_result",

2103 "optional": false,

2104 "nullable": false,

2105 "schemaType": "enum",

2106 "childrenParentSchema": "enum",

2107 "children": [

2108 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) type > (member) 0"

2109 ]

2110 },

2111 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) type > (member) 0": {

2112 "kind": "HttpDeclReference",

2113 "type": {

2114 "kind": "HttpTypeLiteral",

2115 "literal": "moderation_results"

2116 }

2117 },

2118 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 1 > (property) type > (member) 0": {

2119 "kind": "HttpDeclReference",

2120 "type": {

2121 "kind": "HttpTypeLiteral",

2122 "literal": "error"

2123 }

2124 },

2125 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) category_applied_input_types > (items) > (items) > (member) 0": {

2126 "kind": "HttpDeclReference",

2127 "type": {

2128 "kind": "HttpTypeLiteral",

2129 "literal": "text"

2130 }

2131 },

2132 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) category_applied_input_types > (items) > (items) > (member) 1": {

2133 "kind": "HttpDeclReference",

2134 "type": {

2135 "kind": "HttpTypeLiteral",

2136 "literal": "image"

2137 }

2138 },

2139 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) input > (variant) 0 > (property) results > (items) > (property) type > (member) 0": {

2140 "kind": "HttpDeclReference",

2141 "type": {

2142 "kind": "HttpTypeLiteral",

2143 "literal": "moderation_result"

2144 }

2145 },

2146 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) category_applied_input_types > (items) > (items) > (member) 0": {

2147 "kind": "HttpDeclReference",

2148 "type": {

2149 "kind": "HttpTypeLiteral",

2150 "literal": "text"

2151 }

2152 },

2153 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) category_applied_input_types > (items) > (items) > (member) 1": {

2154 "kind": "HttpDeclReference",

2155 "type": {

2156 "kind": "HttpTypeLiteral",

2157 "literal": "image"

2158 }

2159 },

2160 "(resource) chat.completions > (model) chat_completion_chunk > (schema) > (property) moderation > (property) output > (variant) 0 > (property) results > (items) > (property) type > (member) 0": {

2161 "kind": "HttpDeclReference",

2162 "type": {

2163 "kind": "HttpTypeLiteral",

2164 "literal": "moderation_result"

2165 }

2166 }

2167}

2168```

2169 438 

2170### Example439### Example

2171 440 

Details

5Stream image generation and editing in real time with server-sent events.5Stream image generation and editing in real time with server-sent events.

6[Learn more about image streaming](https://developers.openai.com/api/docs/guides/image-generation).6[Learn more about image streaming](https://developers.openai.com/api/docs/guides/image-generation).

7 7 

8<a id="image_edit.partial_image"></a>

9 

8## image_edit.partial_image10## image_edit.partial_image

9 11 

10Emitted when a partial image is available during image editing streaming.12Emitted when a partial image is available during image editing streaming.


13 15 

14Schema name: `ImageEditPartialImageEvent`16Schema name: `ImageEditPartialImageEvent`

15 17 

16```json18- `b64_json: string`

17{19 

18 "(resource) images > (model) image_edit_partial_image_event > (schema)": {20 Base64-encoded partial image data, suitable for rendering as an image.

19 "kind": "HttpDeclTypeAlias",21 

20 "oasRef": "#/components/schemas/ImageEditPartialImageEvent",22- `background: "transparent" or "opaque" or "auto"`

21 "docstring": "Emitted when a partial image is available during image editing streaming.\n",23 

22 "ident": "ImageEditPartialImageEvent",24 The background setting for the requested edited image.

23 "type": {25 

24 "kind": "HttpTypeObject",26 - `"transparent"`

25 "members": [27 

26 {28 - `"opaque"`

27 "ident": "b64_json"29 

28 },30 - `"auto"`

29 {31 

30 "ident": "background"32- `created_at: number`

31 },33 

32 {34 The Unix timestamp when the event was created.

33 "ident": "created_at"35 

34 },36- `output_format: "png" or "webp" or "jpeg"`

35 {37 

36 "ident": "output_format"38 The output format for the requested edited image.

37 },39 

38 {40 - `"png"`

39 "ident": "partial_image_index"41 

40 },42 - `"webp"`

41 {43 

42 "ident": "quality"44 - `"jpeg"`

43 },45 

44 {46- `partial_image_index: number`

45 "ident": "size"47 

46 },48 0-based index for the partial image (streaming).

47 {49 

48 "ident": "type"50- `quality: "low" or "medium" or "high" or 3 more`

49 }51 

50 ]52 The quality setting for the requested edited image.

51 },53 

52 "childrenParentSchema": "object",54 - `"low"`

53 "children": [55 

54 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) b64_json",56 - `"medium"`

55 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) background",57 

56 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) created_at",58 - `"high"`

57 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) output_format",59 

58 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) partial_image_index",60 - `"xhigh"`

59 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality",61 

60 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size",62 - `"max"`

61 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) type"63 

62 ]64 - `"auto"`

63 },65 

64 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) b64_json": {66- `size: string or "1024x1024" or "1024x1536" or "1536x1024" or "auto"`

65 "kind": "HttpDeclProperty",67 

66 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/b64_json",68 The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

67 "deprecated": false,69 

68 "key": "b64_json",70 - `string`

69 "docstring": "Base64-encoded partial image data, suitable for rendering as an image.\n",71 

70 "type": {72 - `"1024x1024" or "1024x1536" or "1536x1024" or "auto"`

71 "kind": "HttpTypeString"73 

72 },74 The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

73 "optional": false,75 

74 "nullable": false,76 - `"1024x1024"`

75 "schemaType": "string",77 

76 "children": []78 - `"1024x1536"`

77 },79 

78 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) background": {80 - `"1536x1024"`

79 "kind": "HttpDeclProperty",81 

80 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/background",82 - `"auto"`

81 "deprecated": false,83 

82 "key": "background",84- `type: "image_edit.partial_image"`

83 "docstring": "The background setting for the requested edited image.\n",85 

84 "type": {86 The type of the event. Always `image_edit.partial_image`.

85 "kind": "HttpTypeUnion",87 

86 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/background",88 - `"image_edit.partial_image"`

87 "types": [

88 {

89 "kind": "HttpTypeLiteral",

90 "literal": "transparent"

91 },

92 {

93 "kind": "HttpTypeLiteral",

94 "literal": "opaque"

95 },

96 {

97 "kind": "HttpTypeLiteral",

98 "literal": "auto"

99 }

100 ]

101 },

102 "optional": false,

103 "nullable": false,

104 "schemaType": "enum",

105 "childrenParentSchema": "enum",

106 "children": [

107 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) background > (member) 0",

108 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) background > (member) 1",

109 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) background > (member) 2"

110 ]

111 },

112 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) created_at": {

113 "kind": "HttpDeclProperty",

114 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/created_at",

115 "deprecated": false,

116 "key": "created_at",

117 "docstring": "The Unix timestamp when the event was created.\n",

118 "type": {

119 "kind": "HttpTypeNumber"

120 },

121 "constraints": {

122 "format": "unixtime"

123 },

124 "optional": false,

125 "nullable": false,

126 "schemaType": "integer",

127 "children": []

128 },

129 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) output_format": {

130 "kind": "HttpDeclProperty",

131 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/output_format",

132 "deprecated": false,

133 "key": "output_format",

134 "docstring": "The output format for the requested edited image.\n",

135 "type": {

136 "kind": "HttpTypeUnion",

137 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/output_format",

138 "types": [

139 {

140 "kind": "HttpTypeLiteral",

141 "literal": "png"

142 },

143 {

144 "kind": "HttpTypeLiteral",

145 "literal": "webp"

146 },

147 {

148 "kind": "HttpTypeLiteral",

149 "literal": "jpeg"

150 }

151 ]

152 },

153 "optional": false,

154 "nullable": false,

155 "schemaType": "enum",

156 "childrenParentSchema": "enum",

157 "children": [

158 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) output_format > (member) 0",

159 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) output_format > (member) 1",

160 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) output_format > (member) 2"

161 ]

162 },

163 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) partial_image_index": {

164 "kind": "HttpDeclProperty",

165 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/partial_image_index",

166 "deprecated": false,

167 "key": "partial_image_index",

168 "docstring": "0-based index for the partial image (streaming).\n",

169 "type": {

170 "kind": "HttpTypeNumber"

171 },

172 "optional": false,

173 "nullable": false,

174 "schemaType": "integer",

175 "children": []

176 },

177 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality": {

178 "kind": "HttpDeclProperty",

179 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/quality",

180 "deprecated": false,

181 "key": "quality",

182 "docstring": "The quality setting for the requested edited image.\n",

183 "type": {

184 "kind": "HttpTypeUnion",

185 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/quality",

186 "types": [

187 {

188 "kind": "HttpTypeLiteral",

189 "literal": "low"

190 },

191 {

192 "kind": "HttpTypeLiteral",

193 "literal": "medium"

194 },

195 {

196 "kind": "HttpTypeLiteral",

197 "literal": "high"

198 },

199 {

200 "kind": "HttpTypeLiteral",

201 "literal": "xhigh"

202 },

203 {

204 "kind": "HttpTypeLiteral",

205 "literal": "max"

206 },

207 {

208 "kind": "HttpTypeLiteral",

209 "literal": "auto"

210 }

211 ]

212 },

213 "optional": false,

214 "nullable": false,

215 "schemaType": "enum",

216 "childrenParentSchema": "enum",

217 "children": [

218 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality > (member) 0",

219 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality > (member) 1",

220 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality > (member) 2",

221 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality > (member) 3",

222 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality > (member) 4",

223 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality > (member) 5"

224 ]

225 },

226 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size": {

227 "kind": "HttpDeclProperty",

228 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/size",

229 "deprecated": false,

230 "key": "size",

231 "docstring": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.",

232 "type": {

233 "kind": "HttpTypeUnion",

234 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/size",

235 "types": [

236 {

237 "kind": "HttpTypeString"

238 },

239 {

240 "kind": "HttpTypeUnion",

241 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/size/anyOf/1",

242 "types": [

243 {

244 "kind": "HttpTypeLiteral",

245 "literal": "1024x1024"

246 },

247 {

248 "kind": "HttpTypeLiteral",

249 "literal": "1024x1536"

250 },

251 {

252 "kind": "HttpTypeLiteral",

253 "literal": "1536x1024"

254 },

255 {

256 "kind": "HttpTypeLiteral",

257 "literal": "auto"

258 }

259 ]

260 }

261 ]

262 },

263 "optional": false,

264 "nullable": false,

265 "schemaType": "union",

266 "childrenParentSchema": "union",

267 "children": [

268 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size > (variant) 0",

269 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size > (variant) 1"

270 ]

271 },

272 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) type": {

273 "kind": "HttpDeclProperty",

274 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/type",

275 "deprecated": false,

276 "key": "type",

277 "docstring": "The type of the event. Always `image_edit.partial_image`.\n",

278 "type": {

279 "kind": "HttpTypeUnion",

280 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/type",

281 "types": [

282 {

283 "kind": "HttpTypeLiteral",

284 "literal": "image_edit.partial_image"

285 }

286 ]

287 },

288 "optional": false,

289 "nullable": false,

290 "schemaType": "enum",

291 "childrenParentSchema": "enum",

292 "children": [

293 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) type > (member) 0"

294 ]

295 },

296 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) background > (member) 0": {

297 "kind": "HttpDeclReference",

298 "type": {

299 "kind": "HttpTypeLiteral",

300 "literal": "transparent"

301 }

302 },

303 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) background > (member) 1": {

304 "kind": "HttpDeclReference",

305 "type": {

306 "kind": "HttpTypeLiteral",

307 "literal": "opaque"

308 }

309 },

310 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) background > (member) 2": {

311 "kind": "HttpDeclReference",

312 "type": {

313 "kind": "HttpTypeLiteral",

314 "literal": "auto"

315 }

316 },

317 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) output_format > (member) 0": {

318 "kind": "HttpDeclReference",

319 "type": {

320 "kind": "HttpTypeLiteral",

321 "literal": "png"

322 }

323 },

324 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) output_format > (member) 1": {

325 "kind": "HttpDeclReference",

326 "type": {

327 "kind": "HttpTypeLiteral",

328 "literal": "webp"

329 }

330 },

331 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) output_format > (member) 2": {

332 "kind": "HttpDeclReference",

333 "type": {

334 "kind": "HttpTypeLiteral",

335 "literal": "jpeg"

336 }

337 },

338 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality > (member) 0": {

339 "kind": "HttpDeclReference",

340 "type": {

341 "kind": "HttpTypeLiteral",

342 "literal": "low"

343 }

344 },

345 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality > (member) 1": {

346 "kind": "HttpDeclReference",

347 "type": {

348 "kind": "HttpTypeLiteral",

349 "literal": "medium"

350 }

351 },

352 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality > (member) 2": {

353 "kind": "HttpDeclReference",

354 "type": {

355 "kind": "HttpTypeLiteral",

356 "literal": "high"

357 }

358 },

359 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality > (member) 3": {

360 "kind": "HttpDeclReference",

361 "type": {

362 "kind": "HttpTypeLiteral",

363 "literal": "xhigh"

364 }

365 },

366 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality > (member) 4": {

367 "kind": "HttpDeclReference",

368 "type": {

369 "kind": "HttpTypeLiteral",

370 "literal": "max"

371 }

372 },

373 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) quality > (member) 5": {

374 "kind": "HttpDeclReference",

375 "type": {

376 "kind": "HttpTypeLiteral",

377 "literal": "auto"

378 }

379 },

380 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size > (variant) 0": {

381 "kind": "HttpDeclTypeAlias",

382 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/size/anyOf/0",

383 "ident": "UnionMember0",

384 "type": {

385 "kind": "HttpTypeString"

386 },

387 "children": []

388 },

389 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size > (variant) 1": {

390 "kind": "HttpDeclTypeAlias",

391 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/size/anyOf/1",

392 "docstring": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.",

393 "ident": "UnionMember1",

394 "type": {

395 "kind": "HttpTypeUnion",

396 "oasRef": "#/components/schemas/ImageEditPartialImageEvent/properties/size/anyOf/1",

397 "types": [

398 {

399 "kind": "HttpTypeLiteral",

400 "literal": "1024x1024"

401 },

402 {

403 "kind": "HttpTypeLiteral",

404 "literal": "1024x1536"

405 },

406 {

407 "kind": "HttpTypeLiteral",

408 "literal": "1536x1024"

409 },

410 {

411 "kind": "HttpTypeLiteral",

412 "literal": "auto"

413 }

414 ]

415 },

416 "childrenParentSchema": "enum",

417 "children": [

418 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 0",

419 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 1",

420 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 2",

421 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 3"

422 ]

423 },

424 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) type > (member) 0": {

425 "kind": "HttpDeclReference",

426 "type": {

427 "kind": "HttpTypeLiteral",

428 "literal": "image_edit.partial_image"

429 }

430 },

431 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 0": {

432 "kind": "HttpDeclReference",

433 "type": {

434 "kind": "HttpTypeLiteral",

435 "literal": "1024x1024"

436 }

437 },

438 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 1": {

439 "kind": "HttpDeclReference",

440 "type": {

441 "kind": "HttpTypeLiteral",

442 "literal": "1024x1536"

443 }

444 },

445 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 2": {

446 "kind": "HttpDeclReference",

447 "type": {

448 "kind": "HttpTypeLiteral",

449 "literal": "1536x1024"

450 }

451 },

452 "(resource) images > (model) image_edit_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 3": {

453 "kind": "HttpDeclReference",

454 "type": {

455 "kind": "HttpTypeLiteral",

456 "literal": "auto"

457 }

458 }

459}

460```

461 89 

462### Example90### Example

463 91 


474}102}

475```103```

476 104 

105<a id="image_edit.completed"></a>

106 

477## image_edit.completed107## image_edit.completed

478 108 

479Emitted when image editing has completed and the final image is available.109Emitted when image editing has completed and the final image is available.


482 112 

483Schema name: `ImageEditCompletedEvent`113Schema name: `ImageEditCompletedEvent`

484 114 

485```json115- `b64_json: string`

486{116 

487 "(resource) images > (model) image_edit_completed_event > (schema)": {117 Base64-encoded final edited image data, suitable for rendering as an image.

488 "kind": "HttpDeclTypeAlias",118 

489 "oasRef": "#/components/schemas/ImageEditCompletedEvent",119- `background: "transparent" or "opaque" or "auto"`

490 "docstring": "Emitted when image editing has completed and the final image is available.\n",120 

491 "ident": "ImageEditCompletedEvent",121 The background setting for the edited image.

492 "type": {122 

493 "kind": "HttpTypeObject",123 - `"transparent"`

494 "members": [124 

495 {125 - `"opaque"`

496 "ident": "b64_json"126 

497 },127 - `"auto"`

498 {128 

499 "ident": "background"129- `created_at: number`

500 },130 

501 {131 The Unix timestamp when the event was created.

502 "ident": "created_at"132 

503 },133- `output_format: "png" or "webp" or "jpeg"`

504 {134 

505 "ident": "output_format"135 The output format for the edited image.

506 },136 

507 {137 - `"png"`

508 "ident": "quality"138 

509 },139 - `"webp"`

510 {140 

511 "ident": "size"141 - `"jpeg"`

512 },142 

513 {143- `quality: "low" or "medium" or "high" or 3 more`

514 "ident": "type"144 

515 },145 The quality setting for the edited image.

516 {146 

517 "ident": "usage"147 - `"low"`

518 }148 

519 ]149 - `"medium"`

520 },150 

521 "childrenParentSchema": "object",151 - `"high"`

522 "children": [152 

523 "(resource) images > (model) image_edit_completed_event > (schema) > (property) b64_json",153 - `"xhigh"`

524 "(resource) images > (model) image_edit_completed_event > (schema) > (property) background",154 

525 "(resource) images > (model) image_edit_completed_event > (schema) > (property) created_at",155 - `"max"`

526 "(resource) images > (model) image_edit_completed_event > (schema) > (property) output_format",156 

527 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality",157 - `"auto"`

528 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size",158 

529 "(resource) images > (model) image_edit_completed_event > (schema) > (property) type",159- `size: string or "1024x1024" or "1024x1536" or "1536x1024" or "auto"`

530 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage"160 

531 ]161 The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

532 },162 

533 "(resource) images > (model) image_edit_completed_event > (schema) > (property) b64_json": {163 - `string`

534 "kind": "HttpDeclProperty",164 

535 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/b64_json",165 - `"1024x1024" or "1024x1536" or "1536x1024" or "auto"`

536 "deprecated": false,166 

537 "key": "b64_json",167 The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

538 "docstring": "Base64-encoded final edited image data, suitable for rendering as an image.\n",168 

539 "type": {169 - `"1024x1024"`

540 "kind": "HttpTypeString"170 

541 },171 - `"1024x1536"`

542 "optional": false,172 

543 "nullable": false,173 - `"1536x1024"`

544 "schemaType": "string",174 

545 "children": []175 - `"auto"`

546 },176 

547 "(resource) images > (model) image_edit_completed_event > (schema) > (property) background": {177- `type: "image_edit.completed"`

548 "kind": "HttpDeclProperty",178 

549 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/background",179 The type of the event. Always `image_edit.completed`.

550 "deprecated": false,180 

551 "key": "background",181 - `"image_edit.completed"`

552 "docstring": "The background setting for the edited image.\n",182 

553 "type": {183- `usage: object { input_tokens, input_tokens_details, output_tokens, total_tokens }`

554 "kind": "HttpTypeUnion",184 

555 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/background",185 For the GPT image models only, the token usage information for the image generation.

556 "types": [186 

557 {187 - `input_tokens: number`

558 "kind": "HttpTypeLiteral",188 

559 "literal": "transparent"189 The number of tokens (images and text) in the input prompt.

560 },190 

561 {191 - `input_tokens_details: object { image_tokens, text_tokens }`

562 "kind": "HttpTypeLiteral",192 

563 "literal": "opaque"193 The input tokens detailed information for the image generation.

564 },194 

565 {195 - `image_tokens: number`

566 "kind": "HttpTypeLiteral",196 

567 "literal": "auto"197 The number of image tokens in the input prompt.

568 }198 

569 ]199 - `text_tokens: number`

570 },200 

571 "optional": false,201 The number of text tokens in the input prompt.

572 "nullable": false,202 

573 "schemaType": "enum",203 - `output_tokens: number`

574 "childrenParentSchema": "enum",204 

575 "children": [205 The number of image tokens in the output image.

576 "(resource) images > (model) image_edit_completed_event > (schema) > (property) background > (member) 0",206 

577 "(resource) images > (model) image_edit_completed_event > (schema) > (property) background > (member) 1",207 - `total_tokens: number`

578 "(resource) images > (model) image_edit_completed_event > (schema) > (property) background > (member) 2"208 

579 ]209 The total number of tokens (images and text) used for the image generation.

580 },

581 "(resource) images > (model) image_edit_completed_event > (schema) > (property) created_at": {

582 "kind": "HttpDeclProperty",

583 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/created_at",

584 "deprecated": false,

585 "key": "created_at",

586 "docstring": "The Unix timestamp when the event was created.\n",

587 "type": {

588 "kind": "HttpTypeNumber"

589 },

590 "constraints": {

591 "format": "unixtime"

592 },

593 "optional": false,

594 "nullable": false,

595 "schemaType": "integer",

596 "children": []

597 },

598 "(resource) images > (model) image_edit_completed_event > (schema) > (property) output_format": {

599 "kind": "HttpDeclProperty",

600 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/output_format",

601 "deprecated": false,

602 "key": "output_format",

603 "docstring": "The output format for the edited image.\n",

604 "type": {

605 "kind": "HttpTypeUnion",

606 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/output_format",

607 "types": [

608 {

609 "kind": "HttpTypeLiteral",

610 "literal": "png"

611 },

612 {

613 "kind": "HttpTypeLiteral",

614 "literal": "webp"

615 },

616 {

617 "kind": "HttpTypeLiteral",

618 "literal": "jpeg"

619 }

620 ]

621 },

622 "optional": false,

623 "nullable": false,

624 "schemaType": "enum",

625 "childrenParentSchema": "enum",

626 "children": [

627 "(resource) images > (model) image_edit_completed_event > (schema) > (property) output_format > (member) 0",

628 "(resource) images > (model) image_edit_completed_event > (schema) > (property) output_format > (member) 1",

629 "(resource) images > (model) image_edit_completed_event > (schema) > (property) output_format > (member) 2"

630 ]

631 },

632 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality": {

633 "kind": "HttpDeclProperty",

634 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/quality",

635 "deprecated": false,

636 "key": "quality",

637 "docstring": "The quality setting for the edited image.\n",

638 "type": {

639 "kind": "HttpTypeUnion",

640 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/quality",

641 "types": [

642 {

643 "kind": "HttpTypeLiteral",

644 "literal": "low"

645 },

646 {

647 "kind": "HttpTypeLiteral",

648 "literal": "medium"

649 },

650 {

651 "kind": "HttpTypeLiteral",

652 "literal": "high"

653 },

654 {

655 "kind": "HttpTypeLiteral",

656 "literal": "xhigh"

657 },

658 {

659 "kind": "HttpTypeLiteral",

660 "literal": "max"

661 },

662 {

663 "kind": "HttpTypeLiteral",

664 "literal": "auto"

665 }

666 ]

667 },

668 "optional": false,

669 "nullable": false,

670 "schemaType": "enum",

671 "childrenParentSchema": "enum",

672 "children": [

673 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality > (member) 0",

674 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality > (member) 1",

675 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality > (member) 2",

676 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality > (member) 3",

677 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality > (member) 4",

678 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality > (member) 5"

679 ]

680 },

681 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size": {

682 "kind": "HttpDeclProperty",

683 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/size",

684 "deprecated": false,

685 "key": "size",

686 "docstring": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.",

687 "type": {

688 "kind": "HttpTypeUnion",

689 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/size",

690 "types": [

691 {

692 "kind": "HttpTypeString"

693 },

694 {

695 "kind": "HttpTypeUnion",

696 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/size/anyOf/1",

697 "types": [

698 {

699 "kind": "HttpTypeLiteral",

700 "literal": "1024x1024"

701 },

702 {

703 "kind": "HttpTypeLiteral",

704 "literal": "1024x1536"

705 },

706 {

707 "kind": "HttpTypeLiteral",

708 "literal": "1536x1024"

709 },

710 {

711 "kind": "HttpTypeLiteral",

712 "literal": "auto"

713 }

714 ]

715 }

716 ]

717 },

718 "optional": false,

719 "nullable": false,

720 "schemaType": "union",

721 "childrenParentSchema": "union",

722 "children": [

723 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size > (variant) 0",

724 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size > (variant) 1"

725 ]

726 },

727 "(resource) images > (model) image_edit_completed_event > (schema) > (property) type": {

728 "kind": "HttpDeclProperty",

729 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/type",

730 "deprecated": false,

731 "key": "type",

732 "docstring": "The type of the event. Always `image_edit.completed`.\n",

733 "type": {

734 "kind": "HttpTypeUnion",

735 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/type",

736 "types": [

737 {

738 "kind": "HttpTypeLiteral",

739 "literal": "image_edit.completed"

740 }

741 ]

742 },

743 "optional": false,

744 "nullable": false,

745 "schemaType": "enum",

746 "childrenParentSchema": "enum",

747 "children": [

748 "(resource) images > (model) image_edit_completed_event > (schema) > (property) type > (member) 0"

749 ]

750 },

751 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage": {

752 "kind": "HttpDeclProperty",

753 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/usage",

754 "deprecated": false,

755 "key": "usage",

756 "docstring": "For the GPT image models only, the token usage information for the image generation.\n",

757 "type": {

758 "kind": "HttpTypeObject",

759 "members": [

760 {

761 "ident": "input_tokens"

762 },

763 {

764 "ident": "input_tokens_details"

765 },

766 {

767 "ident": "output_tokens"

768 },

769 {

770 "ident": "total_tokens"

771 }

772 ]

773 },

774 "optional": false,

775 "nullable": false,

776 "schemaType": "object",

777 "childrenParentSchema": "object",

778 "children": [

779 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage > (property) input_tokens",

780 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage > (property) input_tokens_details",

781 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage > (property) output_tokens",

782 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage > (property) total_tokens"

783 ]

784 },

785 "(resource) images > (model) image_edit_completed_event > (schema) > (property) background > (member) 0": {

786 "kind": "HttpDeclReference",

787 "type": {

788 "kind": "HttpTypeLiteral",

789 "literal": "transparent"

790 }

791 },

792 "(resource) images > (model) image_edit_completed_event > (schema) > (property) background > (member) 1": {

793 "kind": "HttpDeclReference",

794 "type": {

795 "kind": "HttpTypeLiteral",

796 "literal": "opaque"

797 }

798 },

799 "(resource) images > (model) image_edit_completed_event > (schema) > (property) background > (member) 2": {

800 "kind": "HttpDeclReference",

801 "type": {

802 "kind": "HttpTypeLiteral",

803 "literal": "auto"

804 }

805 },

806 "(resource) images > (model) image_edit_completed_event > (schema) > (property) output_format > (member) 0": {

807 "kind": "HttpDeclReference",

808 "type": {

809 "kind": "HttpTypeLiteral",

810 "literal": "png"

811 }

812 },

813 "(resource) images > (model) image_edit_completed_event > (schema) > (property) output_format > (member) 1": {

814 "kind": "HttpDeclReference",

815 "type": {

816 "kind": "HttpTypeLiteral",

817 "literal": "webp"

818 }

819 },

820 "(resource) images > (model) image_edit_completed_event > (schema) > (property) output_format > (member) 2": {

821 "kind": "HttpDeclReference",

822 "type": {

823 "kind": "HttpTypeLiteral",

824 "literal": "jpeg"

825 }

826 },

827 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality > (member) 0": {

828 "kind": "HttpDeclReference",

829 "type": {

830 "kind": "HttpTypeLiteral",

831 "literal": "low"

832 }

833 },

834 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality > (member) 1": {

835 "kind": "HttpDeclReference",

836 "type": {

837 "kind": "HttpTypeLiteral",

838 "literal": "medium"

839 }

840 },

841 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality > (member) 2": {

842 "kind": "HttpDeclReference",

843 "type": {

844 "kind": "HttpTypeLiteral",

845 "literal": "high"

846 }

847 },

848 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality > (member) 3": {

849 "kind": "HttpDeclReference",

850 "type": {

851 "kind": "HttpTypeLiteral",

852 "literal": "xhigh"

853 }

854 },

855 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality > (member) 4": {

856 "kind": "HttpDeclReference",

857 "type": {

858 "kind": "HttpTypeLiteral",

859 "literal": "max"

860 }

861 },

862 "(resource) images > (model) image_edit_completed_event > (schema) > (property) quality > (member) 5": {

863 "kind": "HttpDeclReference",

864 "type": {

865 "kind": "HttpTypeLiteral",

866 "literal": "auto"

867 }

868 },

869 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size > (variant) 0": {

870 "kind": "HttpDeclTypeAlias",

871 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/size/anyOf/0",

872 "ident": "UnionMember0",

873 "type": {

874 "kind": "HttpTypeString"

875 },

876 "children": []

877 },

878 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size > (variant) 1": {

879 "kind": "HttpDeclTypeAlias",

880 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/size/anyOf/1",

881 "docstring": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.",

882 "ident": "UnionMember1",

883 "type": {

884 "kind": "HttpTypeUnion",

885 "oasRef": "#/components/schemas/ImageEditCompletedEvent/properties/size/anyOf/1",

886 "types": [

887 {

888 "kind": "HttpTypeLiteral",

889 "literal": "1024x1024"

890 },

891 {

892 "kind": "HttpTypeLiteral",

893 "literal": "1024x1536"

894 },

895 {

896 "kind": "HttpTypeLiteral",

897 "literal": "1536x1024"

898 },

899 {

900 "kind": "HttpTypeLiteral",

901 "literal": "auto"

902 }

903 ]

904 },

905 "childrenParentSchema": "enum",

906 "children": [

907 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size > (variant) 1 > (member) 0",

908 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size > (variant) 1 > (member) 1",

909 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size > (variant) 1 > (member) 2",

910 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size > (variant) 1 > (member) 3"

911 ]

912 },

913 "(resource) images > (model) image_edit_completed_event > (schema) > (property) type > (member) 0": {

914 "kind": "HttpDeclReference",

915 "type": {

916 "kind": "HttpTypeLiteral",

917 "literal": "image_edit.completed"

918 }

919 },

920 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage > (property) input_tokens": {

921 "kind": "HttpDeclProperty",

922 "oasRef": "#/components/schemas/ImagesUsage/properties/input_tokens",

923 "deprecated": false,

924 "key": "input_tokens",

925 "docstring": "The number of tokens (images and text) in the input prompt.",

926 "type": {

927 "kind": "HttpTypeNumber"

928 },

929 "optional": false,

930 "nullable": false,

931 "schemaType": "integer",

932 "children": []

933 },

934 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage > (property) input_tokens_details": {

935 "kind": "HttpDeclProperty",

936 "oasRef": "#/components/schemas/ImagesUsage/properties/input_tokens_details",

937 "deprecated": false,

938 "key": "input_tokens_details",

939 "docstring": "The input tokens detailed information for the image generation.",

940 "type": {

941 "kind": "HttpTypeObject",

942 "members": [

943 {

944 "ident": "image_tokens"

945 },

946 {

947 "ident": "text_tokens"

948 }

949 ]

950 },

951 "optional": false,

952 "nullable": false,

953 "schemaType": "object",

954 "childrenParentSchema": "object",

955 "children": [

956 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage > (property) input_tokens_details > (property) image_tokens",

957 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage > (property) input_tokens_details > (property) text_tokens"

958 ]

959 },

960 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage > (property) output_tokens": {

961 "kind": "HttpDeclProperty",

962 "oasRef": "#/components/schemas/ImagesUsage/properties/output_tokens",

963 "deprecated": false,

964 "key": "output_tokens",

965 "docstring": "The number of image tokens in the output image.",

966 "type": {

967 "kind": "HttpTypeNumber"

968 },

969 "optional": false,

970 "nullable": false,

971 "schemaType": "integer",

972 "children": []

973 },

974 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage > (property) total_tokens": {

975 "kind": "HttpDeclProperty",

976 "oasRef": "#/components/schemas/ImagesUsage/properties/total_tokens",

977 "deprecated": false,

978 "key": "total_tokens",

979 "docstring": "The total number of tokens (images and text) used for the image generation.\n",

980 "type": {

981 "kind": "HttpTypeNumber"

982 },

983 "optional": false,

984 "nullable": false,

985 "schemaType": "integer",

986 "children": []

987 },

988 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size > (variant) 1 > (member) 0": {

989 "kind": "HttpDeclReference",

990 "type": {

991 "kind": "HttpTypeLiteral",

992 "literal": "1024x1024"

993 }

994 },

995 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size > (variant) 1 > (member) 1": {

996 "kind": "HttpDeclReference",

997 "type": {

998 "kind": "HttpTypeLiteral",

999 "literal": "1024x1536"

1000 }

1001 },

1002 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size > (variant) 1 > (member) 2": {

1003 "kind": "HttpDeclReference",

1004 "type": {

1005 "kind": "HttpTypeLiteral",

1006 "literal": "1536x1024"

1007 }

1008 },

1009 "(resource) images > (model) image_edit_completed_event > (schema) > (property) size > (variant) 1 > (member) 3": {

1010 "kind": "HttpDeclReference",

1011 "type": {

1012 "kind": "HttpTypeLiteral",

1013 "literal": "auto"

1014 }

1015 },

1016 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage > (property) input_tokens_details > (property) image_tokens": {

1017 "kind": "HttpDeclProperty",

1018 "oasRef": "#/components/schemas/ImagesUsage/properties/input_tokens_details/properties/image_tokens",

1019 "deprecated": false,

1020 "key": "image_tokens",

1021 "docstring": "The number of image tokens in the input prompt.",

1022 "type": {

1023 "kind": "HttpTypeNumber"

1024 },

1025 "optional": false,

1026 "nullable": false,

1027 "schemaType": "integer",

1028 "children": []

1029 },

1030 "(resource) images > (model) image_edit_completed_event > (schema) > (property) usage > (property) input_tokens_details > (property) text_tokens": {

1031 "kind": "HttpDeclProperty",

1032 "oasRef": "#/components/schemas/ImagesUsage/properties/input_tokens_details/properties/text_tokens",

1033 "deprecated": false,

1034 "key": "text_tokens",

1035 "docstring": "The number of text tokens in the input prompt.",

1036 "type": {

1037 "kind": "HttpTypeNumber"

1038 },

1039 "optional": false,

1040 "nullable": false,

1041 "schemaType": "integer",

1042 "children": []

1043 }

1044}

1045```

1046 210 

1047### Example211### Example

1048 212 

Details

5Stream image generation and editing in real time with server-sent events.5Stream image generation and editing in real time with server-sent events.

6[Learn more about image streaming](https://developers.openai.com/api/docs/guides/image-generation).6[Learn more about image streaming](https://developers.openai.com/api/docs/guides/image-generation).

7 7 

8<a id="image_generation.partial_image"></a>

9 

8## image_generation.partial_image10## image_generation.partial_image

9 11 

10Emitted when a partial image is available during image generation streaming.12Emitted when a partial image is available during image generation streaming.


13 15 

14Schema name: `ImageGenPartialImageEvent`16Schema name: `ImageGenPartialImageEvent`

15 17 

16```json18- `b64_json: string`

17{19 

18 "(resource) images > (model) image_gen_partial_image_event > (schema)": {20 Base64-encoded partial image data, suitable for rendering as an image.

19 "kind": "HttpDeclTypeAlias",21 

20 "oasRef": "#/components/schemas/ImageGenPartialImageEvent",22- `background: "transparent" or "opaque" or "auto"`

21 "docstring": "Emitted when a partial image is available during image generation streaming.\n",23 

22 "ident": "ImageGenPartialImageEvent",24 The background setting for the requested image.

23 "type": {25 

24 "kind": "HttpTypeObject",26 - `"transparent"`

25 "members": [27 

26 {28 - `"opaque"`

27 "ident": "b64_json"29 

28 },30 - `"auto"`

29 {31 

30 "ident": "background"32- `created_at: number`

31 },33 

32 {34 The Unix timestamp when the event was created.

33 "ident": "created_at"35 

34 },36- `output_format: "png" or "webp" or "jpeg"`

35 {37 

36 "ident": "output_format"38 The output format for the requested image.

37 },39 

38 {40 - `"png"`

39 "ident": "partial_image_index"41 

40 },42 - `"webp"`

41 {43 

42 "ident": "quality"44 - `"jpeg"`

43 },45 

44 {46- `partial_image_index: number`

45 "ident": "size"47 

46 },48 0-based index for the partial image (streaming).

47 {49 

48 "ident": "type"50- `quality: "low" or "medium" or "high" or 3 more`

49 }51 

50 ]52 The quality setting for the requested image.

51 },53 

52 "childrenParentSchema": "object",54 - `"low"`

53 "children": [55 

54 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) b64_json",56 - `"medium"`

55 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background",57 

56 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) created_at",58 - `"high"`

57 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format",59 

58 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) partial_image_index",60 - `"xhigh"`

59 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality",61 

60 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size",62 - `"max"`

61 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) type"63 

62 ]64 - `"auto"`

63 },65 

64 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) b64_json": {66- `size: string or "1024x1024" or "1024x1536" or "1536x1024" or "auto"`

65 "kind": "HttpDeclProperty",67 

66 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/b64_json",68 The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

67 "deprecated": false,69 

68 "key": "b64_json",70 - `string`

69 "docstring": "Base64-encoded partial image data, suitable for rendering as an image.\n",71 

70 "type": {72 - `"1024x1024" or "1024x1536" or "1536x1024" or "auto"`

71 "kind": "HttpTypeString"73 

72 },74 The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

73 "optional": false,75 

74 "nullable": false,76 - `"1024x1024"`

75 "schemaType": "string",77 

76 "children": []78 - `"1024x1536"`

77 },79 

78 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background": {80 - `"1536x1024"`

79 "kind": "HttpDeclProperty",81 

80 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/background",82 - `"auto"`

81 "deprecated": false,83 

82 "key": "background",84- `type: "image_generation.partial_image"`

83 "docstring": "The background setting for the requested image.\n",85 

84 "type": {86 The type of the event. Always `image_generation.partial_image`.

85 "kind": "HttpTypeUnion",87 

86 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/background",88 - `"image_generation.partial_image"`

87 "types": [

88 {

89 "kind": "HttpTypeLiteral",

90 "literal": "transparent"

91 },

92 {

93 "kind": "HttpTypeLiteral",

94 "literal": "opaque"

95 },

96 {

97 "kind": "HttpTypeLiteral",

98 "literal": "auto"

99 }

100 ]

101 },

102 "optional": false,

103 "nullable": false,

104 "schemaType": "enum",

105 "childrenParentSchema": "enum",

106 "children": [

107 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background > (member) 0",

108 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background > (member) 1",

109 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background > (member) 2"

110 ]

111 },

112 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) created_at": {

113 "kind": "HttpDeclProperty",

114 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/created_at",

115 "deprecated": false,

116 "key": "created_at",

117 "docstring": "The Unix timestamp when the event was created.\n",

118 "type": {

119 "kind": "HttpTypeNumber"

120 },

121 "constraints": {

122 "format": "unixtime"

123 },

124 "optional": false,

125 "nullable": false,

126 "schemaType": "integer",

127 "children": []

128 },

129 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format": {

130 "kind": "HttpDeclProperty",

131 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/output_format",

132 "deprecated": false,

133 "key": "output_format",

134 "docstring": "The output format for the requested image.\n",

135 "type": {

136 "kind": "HttpTypeUnion",

137 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/output_format",

138 "types": [

139 {

140 "kind": "HttpTypeLiteral",

141 "literal": "png"

142 },

143 {

144 "kind": "HttpTypeLiteral",

145 "literal": "webp"

146 },

147 {

148 "kind": "HttpTypeLiteral",

149 "literal": "jpeg"

150 }

151 ]

152 },

153 "optional": false,

154 "nullable": false,

155 "schemaType": "enum",

156 "childrenParentSchema": "enum",

157 "children": [

158 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format > (member) 0",

159 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format > (member) 1",

160 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format > (member) 2"

161 ]

162 },

163 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) partial_image_index": {

164 "kind": "HttpDeclProperty",

165 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/partial_image_index",

166 "deprecated": false,

167 "key": "partial_image_index",

168 "docstring": "0-based index for the partial image (streaming).\n",

169 "type": {

170 "kind": "HttpTypeNumber"

171 },

172 "optional": false,

173 "nullable": false,

174 "schemaType": "integer",

175 "children": []

176 },

177 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality": {

178 "kind": "HttpDeclProperty",

179 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/quality",

180 "deprecated": false,

181 "key": "quality",

182 "docstring": "The quality setting for the requested image.\n",

183 "type": {

184 "kind": "HttpTypeUnion",

185 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/quality",

186 "types": [

187 {

188 "kind": "HttpTypeLiteral",

189 "literal": "low"

190 },

191 {

192 "kind": "HttpTypeLiteral",

193 "literal": "medium"

194 },

195 {

196 "kind": "HttpTypeLiteral",

197 "literal": "high"

198 },

199 {

200 "kind": "HttpTypeLiteral",

201 "literal": "xhigh"

202 },

203 {

204 "kind": "HttpTypeLiteral",

205 "literal": "max"

206 },

207 {

208 "kind": "HttpTypeLiteral",

209 "literal": "auto"

210 }

211 ]

212 },

213 "optional": false,

214 "nullable": false,

215 "schemaType": "enum",

216 "childrenParentSchema": "enum",

217 "children": [

218 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 0",

219 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 1",

220 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 2",

221 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 3",

222 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 4",

223 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 5"

224 ]

225 },

226 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size": {

227 "kind": "HttpDeclProperty",

228 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/size",

229 "deprecated": false,

230 "key": "size",

231 "docstring": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.",

232 "type": {

233 "kind": "HttpTypeUnion",

234 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/size",

235 "types": [

236 {

237 "kind": "HttpTypeString"

238 },

239 {

240 "kind": "HttpTypeUnion",

241 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/size/anyOf/1",

242 "types": [

243 {

244 "kind": "HttpTypeLiteral",

245 "literal": "1024x1024"

246 },

247 {

248 "kind": "HttpTypeLiteral",

249 "literal": "1024x1536"

250 },

251 {

252 "kind": "HttpTypeLiteral",

253 "literal": "1536x1024"

254 },

255 {

256 "kind": "HttpTypeLiteral",

257 "literal": "auto"

258 }

259 ]

260 }

261 ]

262 },

263 "optional": false,

264 "nullable": false,

265 "schemaType": "union",

266 "childrenParentSchema": "union",

267 "children": [

268 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 0",

269 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1"

270 ]

271 },

272 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) type": {

273 "kind": "HttpDeclProperty",

274 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/type",

275 "deprecated": false,

276 "key": "type",

277 "docstring": "The type of the event. Always `image_generation.partial_image`.\n",

278 "type": {

279 "kind": "HttpTypeUnion",

280 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/type",

281 "types": [

282 {

283 "kind": "HttpTypeLiteral",

284 "literal": "image_generation.partial_image"

285 }

286 ]

287 },

288 "optional": false,

289 "nullable": false,

290 "schemaType": "enum",

291 "childrenParentSchema": "enum",

292 "children": [

293 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) type > (member) 0"

294 ]

295 },

296 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background > (member) 0": {

297 "kind": "HttpDeclReference",

298 "type": {

299 "kind": "HttpTypeLiteral",

300 "literal": "transparent"

301 }

302 },

303 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background > (member) 1": {

304 "kind": "HttpDeclReference",

305 "type": {

306 "kind": "HttpTypeLiteral",

307 "literal": "opaque"

308 }

309 },

310 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) background > (member) 2": {

311 "kind": "HttpDeclReference",

312 "type": {

313 "kind": "HttpTypeLiteral",

314 "literal": "auto"

315 }

316 },

317 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format > (member) 0": {

318 "kind": "HttpDeclReference",

319 "type": {

320 "kind": "HttpTypeLiteral",

321 "literal": "png"

322 }

323 },

324 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format > (member) 1": {

325 "kind": "HttpDeclReference",

326 "type": {

327 "kind": "HttpTypeLiteral",

328 "literal": "webp"

329 }

330 },

331 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) output_format > (member) 2": {

332 "kind": "HttpDeclReference",

333 "type": {

334 "kind": "HttpTypeLiteral",

335 "literal": "jpeg"

336 }

337 },

338 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 0": {

339 "kind": "HttpDeclReference",

340 "type": {

341 "kind": "HttpTypeLiteral",

342 "literal": "low"

343 }

344 },

345 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 1": {

346 "kind": "HttpDeclReference",

347 "type": {

348 "kind": "HttpTypeLiteral",

349 "literal": "medium"

350 }

351 },

352 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 2": {

353 "kind": "HttpDeclReference",

354 "type": {

355 "kind": "HttpTypeLiteral",

356 "literal": "high"

357 }

358 },

359 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 3": {

360 "kind": "HttpDeclReference",

361 "type": {

362 "kind": "HttpTypeLiteral",

363 "literal": "xhigh"

364 }

365 },

366 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 4": {

367 "kind": "HttpDeclReference",

368 "type": {

369 "kind": "HttpTypeLiteral",

370 "literal": "max"

371 }

372 },

373 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) quality > (member) 5": {

374 "kind": "HttpDeclReference",

375 "type": {

376 "kind": "HttpTypeLiteral",

377 "literal": "auto"

378 }

379 },

380 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 0": {

381 "kind": "HttpDeclTypeAlias",

382 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/size/anyOf/0",

383 "ident": "UnionMember0",

384 "type": {

385 "kind": "HttpTypeString"

386 },

387 "children": []

388 },

389 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1": {

390 "kind": "HttpDeclTypeAlias",

391 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/size/anyOf/1",

392 "docstring": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.",

393 "ident": "UnionMember1",

394 "type": {

395 "kind": "HttpTypeUnion",

396 "oasRef": "#/components/schemas/ImageGenPartialImageEvent/properties/size/anyOf/1",

397 "types": [

398 {

399 "kind": "HttpTypeLiteral",

400 "literal": "1024x1024"

401 },

402 {

403 "kind": "HttpTypeLiteral",

404 "literal": "1024x1536"

405 },

406 {

407 "kind": "HttpTypeLiteral",

408 "literal": "1536x1024"

409 },

410 {

411 "kind": "HttpTypeLiteral",

412 "literal": "auto"

413 }

414 ]

415 },

416 "childrenParentSchema": "enum",

417 "children": [

418 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 0",

419 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 1",

420 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 2",

421 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 3"

422 ]

423 },

424 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) type > (member) 0": {

425 "kind": "HttpDeclReference",

426 "type": {

427 "kind": "HttpTypeLiteral",

428 "literal": "image_generation.partial_image"

429 }

430 },

431 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 0": {

432 "kind": "HttpDeclReference",

433 "type": {

434 "kind": "HttpTypeLiteral",

435 "literal": "1024x1024"

436 }

437 },

438 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 1": {

439 "kind": "HttpDeclReference",

440 "type": {

441 "kind": "HttpTypeLiteral",

442 "literal": "1024x1536"

443 }

444 },

445 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 2": {

446 "kind": "HttpDeclReference",

447 "type": {

448 "kind": "HttpTypeLiteral",

449 "literal": "1536x1024"

450 }

451 },

452 "(resource) images > (model) image_gen_partial_image_event > (schema) > (property) size > (variant) 1 > (member) 3": {

453 "kind": "HttpDeclReference",

454 "type": {

455 "kind": "HttpTypeLiteral",

456 "literal": "auto"

457 }

458 }

459}

460```

461 89 

462### Example90### Example

463 91 


474}102}

475```103```

476 104 

105<a id="image_generation.completed"></a>

106 

477## image_generation.completed107## image_generation.completed

478 108 

479Emitted when image generation has completed and the final image is available.109Emitted when image generation has completed and the final image is available.


482 112 

483Schema name: `ImageGenCompletedEvent`113Schema name: `ImageGenCompletedEvent`

484 114 

485```json115- `b64_json: string`

486{116 

487 "(resource) images > (model) image_gen_completed_event > (schema)": {117 Base64-encoded image data, suitable for rendering as an image.

488 "kind": "HttpDeclTypeAlias",118 

489 "oasRef": "#/components/schemas/ImageGenCompletedEvent",119- `background: "transparent" or "opaque" or "auto"`

490 "docstring": "Emitted when image generation has completed and the final image is available.\n",120 

491 "ident": "ImageGenCompletedEvent",121 The background setting for the generated image.

492 "type": {122 

493 "kind": "HttpTypeObject",123 - `"transparent"`

494 "members": [124 

495 {125 - `"opaque"`

496 "ident": "b64_json"126 

497 },127 - `"auto"`

498 {128 

499 "ident": "background"129- `created_at: number`

500 },130 

501 {131 The Unix timestamp when the event was created.

502 "ident": "created_at"132 

503 },133- `output_format: "png" or "webp" or "jpeg"`

504 {134 

505 "ident": "output_format"135 The output format for the generated image.

506 },136 

507 {137 - `"png"`

508 "ident": "quality"138 

509 },139 - `"webp"`

510 {140 

511 "ident": "size"141 - `"jpeg"`

512 },142 

513 {143- `quality: "low" or "medium" or "high" or 3 more`

514 "ident": "type"144 

515 },145 The quality setting for the generated image.

516 {146 

517 "ident": "usage"147 - `"low"`

518 }148 

519 ]149 - `"medium"`

520 },150 

521 "childrenParentSchema": "object",151 - `"high"`

522 "children": [152 

523 "(resource) images > (model) image_gen_completed_event > (schema) > (property) b64_json",153 - `"xhigh"`

524 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background",154 

525 "(resource) images > (model) image_gen_completed_event > (schema) > (property) created_at",155 - `"max"`

526 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format",156 

527 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality",157 - `"auto"`

528 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size",158 

529 "(resource) images > (model) image_gen_completed_event > (schema) > (property) type",159- `size: string or "1024x1024" or "1024x1536" or "1536x1024" or "auto"`

530 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage"160 

531 ]161 The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

532 },162 

533 "(resource) images > (model) image_gen_completed_event > (schema) > (property) b64_json": {163 - `string`

534 "kind": "HttpDeclProperty",164 

535 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/b64_json",165 - `"1024x1024" or "1024x1536" or "1536x1024" or "auto"`

536 "deprecated": false,166 

537 "key": "b64_json",167 The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

538 "docstring": "Base64-encoded image data, suitable for rendering as an image.\n",168 

539 "type": {169 - `"1024x1024"`

540 "kind": "HttpTypeString"170 

541 },171 - `"1024x1536"`

542 "optional": false,172 

543 "nullable": false,173 - `"1536x1024"`

544 "schemaType": "string",174 

545 "children": []175 - `"auto"`

546 },176 

547 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background": {177- `type: "image_generation.completed"`

548 "kind": "HttpDeclProperty",178 

549 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/background",179 The type of the event. Always `image_generation.completed`.

550 "deprecated": false,180 

551 "key": "background",181 - `"image_generation.completed"`

552 "docstring": "The background setting for the generated image.\n",182 

553 "type": {183- `usage: object { input_tokens, input_tokens_details, output_tokens, total_tokens }`

554 "kind": "HttpTypeUnion",184 

555 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/background",185 For the GPT image models only, the token usage information for the image generation.

556 "types": [186 

557 {187 - `input_tokens: number`

558 "kind": "HttpTypeLiteral",188 

559 "literal": "transparent"189 The number of tokens (images and text) in the input prompt.

560 },190 

561 {191 - `input_tokens_details: object { image_tokens, text_tokens }`

562 "kind": "HttpTypeLiteral",192 

563 "literal": "opaque"193 The input tokens detailed information for the image generation.

564 },194 

565 {195 - `image_tokens: number`

566 "kind": "HttpTypeLiteral",196 

567 "literal": "auto"197 The number of image tokens in the input prompt.

568 }198 

569 ]199 - `text_tokens: number`

570 },200 

571 "optional": false,201 The number of text tokens in the input prompt.

572 "nullable": false,202 

573 "schemaType": "enum",203 - `output_tokens: number`

574 "childrenParentSchema": "enum",204 

575 "children": [205 The number of image tokens in the output image.

576 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background > (member) 0",206 

577 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background > (member) 1",207 - `total_tokens: number`

578 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background > (member) 2"208 

579 ]209 The total number of tokens (images and text) used for the image generation.

580 },

581 "(resource) images > (model) image_gen_completed_event > (schema) > (property) created_at": {

582 "kind": "HttpDeclProperty",

583 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/created_at",

584 "deprecated": false,

585 "key": "created_at",

586 "docstring": "The Unix timestamp when the event was created.\n",

587 "type": {

588 "kind": "HttpTypeNumber"

589 },

590 "constraints": {

591 "format": "unixtime"

592 },

593 "optional": false,

594 "nullable": false,

595 "schemaType": "integer",

596 "children": []

597 },

598 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format": {

599 "kind": "HttpDeclProperty",

600 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/output_format",

601 "deprecated": false,

602 "key": "output_format",

603 "docstring": "The output format for the generated image.\n",

604 "type": {

605 "kind": "HttpTypeUnion",

606 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/output_format",

607 "types": [

608 {

609 "kind": "HttpTypeLiteral",

610 "literal": "png"

611 },

612 {

613 "kind": "HttpTypeLiteral",

614 "literal": "webp"

615 },

616 {

617 "kind": "HttpTypeLiteral",

618 "literal": "jpeg"

619 }

620 ]

621 },

622 "optional": false,

623 "nullable": false,

624 "schemaType": "enum",

625 "childrenParentSchema": "enum",

626 "children": [

627 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format > (member) 0",

628 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format > (member) 1",

629 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format > (member) 2"

630 ]

631 },

632 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality": {

633 "kind": "HttpDeclProperty",

634 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/quality",

635 "deprecated": false,

636 "key": "quality",

637 "docstring": "The quality setting for the generated image.\n",

638 "type": {

639 "kind": "HttpTypeUnion",

640 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/quality",

641 "types": [

642 {

643 "kind": "HttpTypeLiteral",

644 "literal": "low"

645 },

646 {

647 "kind": "HttpTypeLiteral",

648 "literal": "medium"

649 },

650 {

651 "kind": "HttpTypeLiteral",

652 "literal": "high"

653 },

654 {

655 "kind": "HttpTypeLiteral",

656 "literal": "xhigh"

657 },

658 {

659 "kind": "HttpTypeLiteral",

660 "literal": "max"

661 },

662 {

663 "kind": "HttpTypeLiteral",

664 "literal": "auto"

665 }

666 ]

667 },

668 "optional": false,

669 "nullable": false,

670 "schemaType": "enum",

671 "childrenParentSchema": "enum",

672 "children": [

673 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 0",

674 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 1",

675 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 2",

676 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 3",

677 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 4",

678 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 5"

679 ]

680 },

681 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size": {

682 "kind": "HttpDeclProperty",

683 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/size",

684 "deprecated": false,

685 "key": "size",

686 "docstring": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.",

687 "type": {

688 "kind": "HttpTypeUnion",

689 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/size",

690 "types": [

691 {

692 "kind": "HttpTypeString"

693 },

694 {

695 "kind": "HttpTypeUnion",

696 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/size/anyOf/1",

697 "types": [

698 {

699 "kind": "HttpTypeLiteral",

700 "literal": "1024x1024"

701 },

702 {

703 "kind": "HttpTypeLiteral",

704 "literal": "1024x1536"

705 },

706 {

707 "kind": "HttpTypeLiteral",

708 "literal": "1536x1024"

709 },

710 {

711 "kind": "HttpTypeLiteral",

712 "literal": "auto"

713 }

714 ]

715 }

716 ]

717 },

718 "optional": false,

719 "nullable": false,

720 "schemaType": "union",

721 "childrenParentSchema": "union",

722 "children": [

723 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 0",

724 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1"

725 ]

726 },

727 "(resource) images > (model) image_gen_completed_event > (schema) > (property) type": {

728 "kind": "HttpDeclProperty",

729 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/type",

730 "deprecated": false,

731 "key": "type",

732 "docstring": "The type of the event. Always `image_generation.completed`.\n",

733 "type": {

734 "kind": "HttpTypeUnion",

735 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/type",

736 "types": [

737 {

738 "kind": "HttpTypeLiteral",

739 "literal": "image_generation.completed"

740 }

741 ]

742 },

743 "optional": false,

744 "nullable": false,

745 "schemaType": "enum",

746 "childrenParentSchema": "enum",

747 "children": [

748 "(resource) images > (model) image_gen_completed_event > (schema) > (property) type > (member) 0"

749 ]

750 },

751 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage": {

752 "kind": "HttpDeclProperty",

753 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/usage",

754 "deprecated": false,

755 "key": "usage",

756 "docstring": "For the GPT image models only, the token usage information for the image generation.\n",

757 "type": {

758 "kind": "HttpTypeObject",

759 "members": [

760 {

761 "ident": "input_tokens"

762 },

763 {

764 "ident": "input_tokens_details"

765 },

766 {

767 "ident": "output_tokens"

768 },

769 {

770 "ident": "total_tokens"

771 }

772 ]

773 },

774 "optional": false,

775 "nullable": false,

776 "schemaType": "object",

777 "childrenParentSchema": "object",

778 "children": [

779 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens",

780 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens_details",

781 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) output_tokens",

782 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) total_tokens"

783 ]

784 },

785 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background > (member) 0": {

786 "kind": "HttpDeclReference",

787 "type": {

788 "kind": "HttpTypeLiteral",

789 "literal": "transparent"

790 }

791 },

792 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background > (member) 1": {

793 "kind": "HttpDeclReference",

794 "type": {

795 "kind": "HttpTypeLiteral",

796 "literal": "opaque"

797 }

798 },

799 "(resource) images > (model) image_gen_completed_event > (schema) > (property) background > (member) 2": {

800 "kind": "HttpDeclReference",

801 "type": {

802 "kind": "HttpTypeLiteral",

803 "literal": "auto"

804 }

805 },

806 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format > (member) 0": {

807 "kind": "HttpDeclReference",

808 "type": {

809 "kind": "HttpTypeLiteral",

810 "literal": "png"

811 }

812 },

813 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format > (member) 1": {

814 "kind": "HttpDeclReference",

815 "type": {

816 "kind": "HttpTypeLiteral",

817 "literal": "webp"

818 }

819 },

820 "(resource) images > (model) image_gen_completed_event > (schema) > (property) output_format > (member) 2": {

821 "kind": "HttpDeclReference",

822 "type": {

823 "kind": "HttpTypeLiteral",

824 "literal": "jpeg"

825 }

826 },

827 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 0": {

828 "kind": "HttpDeclReference",

829 "type": {

830 "kind": "HttpTypeLiteral",

831 "literal": "low"

832 }

833 },

834 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 1": {

835 "kind": "HttpDeclReference",

836 "type": {

837 "kind": "HttpTypeLiteral",

838 "literal": "medium"

839 }

840 },

841 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 2": {

842 "kind": "HttpDeclReference",

843 "type": {

844 "kind": "HttpTypeLiteral",

845 "literal": "high"

846 }

847 },

848 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 3": {

849 "kind": "HttpDeclReference",

850 "type": {

851 "kind": "HttpTypeLiteral",

852 "literal": "xhigh"

853 }

854 },

855 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 4": {

856 "kind": "HttpDeclReference",

857 "type": {

858 "kind": "HttpTypeLiteral",

859 "literal": "max"

860 }

861 },

862 "(resource) images > (model) image_gen_completed_event > (schema) > (property) quality > (member) 5": {

863 "kind": "HttpDeclReference",

864 "type": {

865 "kind": "HttpTypeLiteral",

866 "literal": "auto"

867 }

868 },

869 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 0": {

870 "kind": "HttpDeclTypeAlias",

871 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/size/anyOf/0",

872 "ident": "UnionMember0",

873 "type": {

874 "kind": "HttpTypeString"

875 },

876 "children": []

877 },

878 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1": {

879 "kind": "HttpDeclTypeAlias",

880 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/size/anyOf/1",

881 "docstring": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.",

882 "ident": "UnionMember1",

883 "type": {

884 "kind": "HttpTypeUnion",

885 "oasRef": "#/components/schemas/ImageGenCompletedEvent/properties/size/anyOf/1",

886 "types": [

887 {

888 "kind": "HttpTypeLiteral",

889 "literal": "1024x1024"

890 },

891 {

892 "kind": "HttpTypeLiteral",

893 "literal": "1024x1536"

894 },

895 {

896 "kind": "HttpTypeLiteral",

897 "literal": "1536x1024"

898 },

899 {

900 "kind": "HttpTypeLiteral",

901 "literal": "auto"

902 }

903 ]

904 },

905 "childrenParentSchema": "enum",

906 "children": [

907 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 0",

908 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 1",

909 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 2",

910 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 3"

911 ]

912 },

913 "(resource) images > (model) image_gen_completed_event > (schema) > (property) type > (member) 0": {

914 "kind": "HttpDeclReference",

915 "type": {

916 "kind": "HttpTypeLiteral",

917 "literal": "image_generation.completed"

918 }

919 },

920 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens": {

921 "kind": "HttpDeclProperty",

922 "oasRef": "#/components/schemas/ImagesUsage/properties/input_tokens",

923 "deprecated": false,

924 "key": "input_tokens",

925 "docstring": "The number of tokens (images and text) in the input prompt.",

926 "type": {

927 "kind": "HttpTypeNumber"

928 },

929 "optional": false,

930 "nullable": false,

931 "schemaType": "integer",

932 "children": []

933 },

934 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens_details": {

935 "kind": "HttpDeclProperty",

936 "oasRef": "#/components/schemas/ImagesUsage/properties/input_tokens_details",

937 "deprecated": false,

938 "key": "input_tokens_details",

939 "docstring": "The input tokens detailed information for the image generation.",

940 "type": {

941 "kind": "HttpTypeObject",

942 "members": [

943 {

944 "ident": "image_tokens"

945 },

946 {

947 "ident": "text_tokens"

948 }

949 ]

950 },

951 "optional": false,

952 "nullable": false,

953 "schemaType": "object",

954 "childrenParentSchema": "object",

955 "children": [

956 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens_details > (property) image_tokens",

957 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens_details > (property) text_tokens"

958 ]

959 },

960 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) output_tokens": {

961 "kind": "HttpDeclProperty",

962 "oasRef": "#/components/schemas/ImagesUsage/properties/output_tokens",

963 "deprecated": false,

964 "key": "output_tokens",

965 "docstring": "The number of image tokens in the output image.",

966 "type": {

967 "kind": "HttpTypeNumber"

968 },

969 "optional": false,

970 "nullable": false,

971 "schemaType": "integer",

972 "children": []

973 },

974 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) total_tokens": {

975 "kind": "HttpDeclProperty",

976 "oasRef": "#/components/schemas/ImagesUsage/properties/total_tokens",

977 "deprecated": false,

978 "key": "total_tokens",

979 "docstring": "The total number of tokens (images and text) used for the image generation.\n",

980 "type": {

981 "kind": "HttpTypeNumber"

982 },

983 "optional": false,

984 "nullable": false,

985 "schemaType": "integer",

986 "children": []

987 },

988 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 0": {

989 "kind": "HttpDeclReference",

990 "type": {

991 "kind": "HttpTypeLiteral",

992 "literal": "1024x1024"

993 }

994 },

995 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 1": {

996 "kind": "HttpDeclReference",

997 "type": {

998 "kind": "HttpTypeLiteral",

999 "literal": "1024x1536"

1000 }

1001 },

1002 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 2": {

1003 "kind": "HttpDeclReference",

1004 "type": {

1005 "kind": "HttpTypeLiteral",

1006 "literal": "1536x1024"

1007 }

1008 },

1009 "(resource) images > (model) image_gen_completed_event > (schema) > (property) size > (variant) 1 > (member) 3": {

1010 "kind": "HttpDeclReference",

1011 "type": {

1012 "kind": "HttpTypeLiteral",

1013 "literal": "auto"

1014 }

1015 },

1016 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens_details > (property) image_tokens": {

1017 "kind": "HttpDeclProperty",

1018 "oasRef": "#/components/schemas/ImagesUsage/properties/input_tokens_details/properties/image_tokens",

1019 "deprecated": false,

1020 "key": "image_tokens",

1021 "docstring": "The number of image tokens in the input prompt.",

1022 "type": {

1023 "kind": "HttpTypeNumber"

1024 },

1025 "optional": false,

1026 "nullable": false,

1027 "schemaType": "integer",

1028 "children": []

1029 },

1030 "(resource) images > (model) image_gen_completed_event > (schema) > (property) usage > (property) input_tokens_details > (property) text_tokens": {

1031 "kind": "HttpDeclProperty",

1032 "oasRef": "#/components/schemas/ImagesUsage/properties/input_tokens_details/properties/text_tokens",

1033 "deprecated": false,

1034 "key": "text_tokens",

1035 "docstring": "The number of text tokens in the input prompt.",

1036 "type": {

1037 "kind": "HttpTypeNumber"

1038 },

1039 "optional": false,

1040 "nullable": false,

1041 "schemaType": "integer",

1042 "children": []

1043 }

1044}

1045```

1046 210 

1047### Example211### Example

1048 212 

Details

2 2 

3**post** `/live/sessions/{session_id}/accept`3**post** `/live/sessions/{session_id}/accept`

4 4 

5Accept an incoming SIP call with Live startup configuration.5Accept an incoming SIP call. Supply session with type live, the model, and startup configuration. Before accepting calls, follow the [Live prompting guide](/api/docs/guides/live-prompting) to write frontend conversation instructions and a separate backend prompt. SIP media format is negotiated; omit audio.format.

6 6 

7### Path Parameters7### Path Parameters

8 8 

Details

2 2 

3**post** `/live/sessions/{session_id}/refer`3**post** `/live/sessions/{session_id}/refer`

4 4 

5Transfer a Live SIP call to another destination.5Transfer a SIP call to another destination. Supply a nonblank target_uri for the SIP Refer-To header.

6 6 

7### Path Parameters7### Path Parameters

8 8 

Details

2 2 

3**post** `/live/sessions/{session_id}/reject`3**post** `/live/sessions/{session_id}/reject`

4 4 

5Reject an incoming SIP call.5Reject an incoming SIP call. Send a required SIP rejection status_code between 300 and 699.

6 6 

7### Path Parameters7### Path Parameters

8 8 

Details

4 4 

5These are events that the OpenAI Realtime Translation WebSocket server will accept from the client.5These are events that the OpenAI Realtime Translation WebSocket server will accept from the client.

6 6 

7<a id="session.update"></a>

8 

7## session.update9## session.update

8 10 

9Send this event to update the translation session configuration. Translation11Send this event to update the translation session configuration. Translation


14 16 

15Schema name: `RealtimeTranslationClientEventSessionUpdate`17Schema name: `RealtimeTranslationClientEventSessionUpdate`

16 18 

17```json19- `session: RealtimeTranslationSessionUpdateRequest`

18{20 

19 "(resource) realtime > (model) realtime_translation_session_update_event > (schema)": {21 Translation session fields to update. The session `type` and `model` are set

20 "kind": "HttpDeclTypeAlias",22 at creation and cannot be changed with `session.update`.

21 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionUpdate",23 

22 "docstring": "Send this event to update the translation session configuration. Translation\nsessions support updates to `audio.output.language`, `audio.input.transcription`,\nand `audio.input.noise_reduction`.\n",24 - `audio: optional object { input, output }`

23 "ident": "RealtimeTranslationSessionUpdateEvent",25 

24 "type": {26 Configuration for translation input and output audio.

25 "kind": "HttpTypeObject",27 

26 "members": [28 - `input: optional object { noise_reduction, transcription }`

27 {29 

28 "ident": "session"30 - `noise_reduction: optional object { type } or null`

29 },31 

30 {32 Optional input noise reduction. Set to `null` to disable it.

31 "ident": "type"33 

32 },34 - `type: NoiseReductionType`

33 {35 

34 "ident": "event_id"36 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.

35 }37 

36 ]38 - `"near_field"`

37 },39 

38 "childrenParentSchema": "object",40 - `"far_field"`

39 "children": [41 

40 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) session",42 - `transcription: optional object { model } or null`

41 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) type",43 

42 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) event_id"44 Optional source-language transcription. When configured, the server emits

43 ]45 `session.input_transcript.delta` events. Translation itself still runs from

44 },46 the input audio stream.

45 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) session": {47 

46 "kind": "HttpDeclProperty",48 - `model: string`

47 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionUpdate/properties/session",49 

48 "deprecated": false,50 The transcription model to use for source transcript deltas.

49 "key": "session",51 

50 "docstring": "Translation session fields to update. The session `type` and `model` are set\nat creation and cannot be changed with `session.update`.\n",52 - `output: optional object { language }`

51 "title": "Realtime translation session update",53 

52 "type": {54 - `language: optional string`

53 "kind": "HttpTypeReference",55 

54 "ident": "RealtimeTranslationSessionUpdateRequest",56 Target language for translated output audio and transcript deltas.

55 "$ref": "(resource) realtime > (model) realtime_translation_session_update_request > (schema)"57 

56 },58- `type: "session.update"`

57 "optional": false,59 

58 "nullable": false,60 The event type, must be `session.update`.

59 "modelImplicit": false,61 

60 "schemaType": "object",62 - `"session.update"`

61 "modelPath": "(resource) realtime > (model) realtime_translation_session_update_request",63 

62 "childrenParentSchema": "object",64- `event_id: optional string`

63 "children": [65 

64 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio"66 Optional client-generated ID used to identify this event.

65 ]

66 },

67 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) type": {

68 "kind": "HttpDeclProperty",

69 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionUpdate/properties/type",

70 "deprecated": false,

71 "key": "type",

72 "docstring": "The event type, must be `session.update`.",

73 "type": {

74 "kind": "HttpTypeUnion",

75 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionUpdate/properties/type",

76 "types": [

77 {

78 "kind": "HttpTypeLiteral",

79 "literal": "session.update"

80 }

81 ]

82 },

83 "optional": false,

84 "nullable": false,

85 "schemaType": "enum",

86 "childrenParentSchema": "enum",

87 "children": [

88 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) type > (member) 0"

89 ]

90 },

91 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) event_id": {

92 "kind": "HttpDeclProperty",

93 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionUpdate/properties/event_id",

94 "deprecated": false,

95 "key": "event_id",

96 "docstring": "Optional client-generated ID used to identify this event.",

97 "type": {

98 "kind": "HttpTypeString"

99 },

100 "constraints": {

101 "maxLength": 512

102 },

103 "optional": true,

104 "nullable": false,

105 "schemaType": "string",

106 "children": []

107 },

108 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio": {

109 "kind": "HttpDeclProperty",

110 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio",

111 "deprecated": false,

112 "key": "audio",

113 "docstring": "Configuration for translation input and output audio.\n",

114 "type": {

115 "kind": "HttpTypeObject",

116 "members": [

117 {

118 "ident": "input"

119 },

120 {

121 "ident": "output"

122 }

123 ]

124 },

125 "optional": true,

126 "nullable": false,

127 "schemaType": "object",

128 "childrenParentSchema": "object",

129 "children": [

130 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input",

131 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) output"

132 ]

133 },

134 "(resource) realtime > (model) realtime_translation_session_update_request > (schema)": {

135 "kind": "HttpDeclTypeAlias",

136 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest",

137 "docstring": "Realtime translation session fields that can be updated with `session.update`.\n",

138 "ident": "RealtimeTranslationSessionUpdateRequest",

139 "type": {

140 "kind": "HttpTypeObject",

141 "members": [

142 {

143 "ident": "audio"

144 }

145 ]

146 },

147 "childrenParentSchema": "object",

148 "children": [

149 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio"

150 ]

151 },

152 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) type > (member) 0": {

153 "kind": "HttpDeclReference",

154 "type": {

155 "kind": "HttpTypeLiteral",

156 "literal": "session.update"

157 }

158 },

159 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input": {

160 "kind": "HttpDeclProperty",

161 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/input",

162 "deprecated": false,

163 "key": "input",

164 "type": {

165 "kind": "HttpTypeObject",

166 "members": [

167 {

168 "ident": "noise_reduction"

169 },

170 {

171 "ident": "transcription"

172 }

173 ]

174 },

175 "optional": true,

176 "nullable": false,

177 "schemaType": "object",

178 "childrenParentSchema": "object",

179 "children": [

180 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) noise_reduction",

181 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) transcription"

182 ]

183 },

184 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) output": {

185 "kind": "HttpDeclProperty",

186 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/output",

187 "deprecated": false,

188 "key": "output",

189 "type": {

190 "kind": "HttpTypeObject",

191 "members": [

192 {

193 "ident": "language"

194 }

195 ]

196 },

197 "optional": true,

198 "nullable": false,

199 "schemaType": "object",

200 "childrenParentSchema": "object",

201 "children": [

202 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) output > (property) language"

203 ]

204 },

205 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) noise_reduction": {

206 "kind": "HttpDeclProperty",

207 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/input/properties/noise_reduction",

208 "deprecated": false,

209 "key": "noise_reduction",

210 "docstring": "Optional input noise reduction. Set to `null` to disable it.\n",

211 "type": {

212 "kind": "HttpTypeObject",

213 "members": [

214 {

215 "ident": "type"

216 }

217 ]

218 },

219 "optional": true,

220 "nullable": true,

221 "schemaType": "object",

222 "childrenParentSchema": "object",

223 "children": [

224 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) noise_reduction > (property) type"

225 ]

226 },

227 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) transcription": {

228 "kind": "HttpDeclProperty",

229 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/input/properties/transcription",

230 "deprecated": false,

231 "key": "transcription",

232 "docstring": "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n",

233 "type": {

234 "kind": "HttpTypeObject",

235 "members": [

236 {

237 "ident": "model"

238 }

239 ]

240 },

241 "optional": true,

242 "nullable": true,

243 "schemaType": "object",

244 "childrenParentSchema": "object",

245 "children": [

246 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) transcription > (property) model"

247 ]

248 },

249 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) output > (property) language": {

250 "kind": "HttpDeclProperty",

251 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/output/properties/language",

252 "deprecated": false,

253 "key": "language",

254 "docstring": "Target language for translated output audio and transcript deltas.\n",

255 "type": {

256 "kind": "HttpTypeString"

257 },

258 "optional": true,

259 "nullable": false,

260 "schemaType": "string",

261 "children": []

262 },

263 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) noise_reduction > (property) type": {

264 "kind": "HttpDeclProperty",

265 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/input/properties/noise_reduction/anyOf/0/properties/type",

266 "deprecated": false,

267 "key": "type",

268 "docstring": "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n",

269 "type": {

270 "kind": "HttpTypeReference",

271 "ident": "NoiseReductionType",

272 "$ref": "(resource) realtime > (model) noise_reduction_type > (schema)"

273 },

274 "optional": false,

275 "nullable": false,

276 "modelImplicit": false,

277 "schemaType": "enum",

278 "modelPath": "(resource) realtime > (model) noise_reduction_type",

279 "childrenParentSchema": "enum",

280 "children": [

281 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 0",

282 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 1"

283 ]

284 },

285 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) transcription > (property) model": {

286 "kind": "HttpDeclProperty",

287 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/input/properties/transcription/anyOf/0/properties/model",

288 "deprecated": false,

289 "key": "model",

290 "docstring": "The transcription model to use for source transcript deltas.",

291 "type": {

292 "kind": "HttpTypeString"

293 },

294 "optional": false,

295 "nullable": false,

296 "schemaType": "string",

297 "children": []

298 },

299 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 0": {

300 "kind": "HttpDeclReference",

301 "type": {

302 "kind": "HttpTypeLiteral",

303 "literal": "near_field"

304 }

305 },

306 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 1": {

307 "kind": "HttpDeclReference",

308 "type": {

309 "kind": "HttpTypeLiteral",

310 "literal": "far_field"

311 }

312 },

313 "(resource) realtime > (model) noise_reduction_type > (schema)": {

314 "kind": "HttpDeclTypeAlias",

315 "oasRef": "#/components/schemas/NoiseReductionType",

316 "docstring": "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n",

317 "ident": "NoiseReductionType",

318 "type": {

319 "kind": "HttpTypeUnion",

320 "oasRef": "#/components/schemas/NoiseReductionType",

321 "types": [

322 {

323 "kind": "HttpTypeLiteral",

324 "literal": "near_field"

325 },

326 {

327 "kind": "HttpTypeLiteral",

328 "literal": "far_field"

329 }

330 ]

331 },

332 "childrenParentSchema": "enum",

333 "children": [

334 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 0",

335 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 1"

336 ]

337 }

338}

339```

340 67 

341### Example68### Example

342 69 


359}86}

360```87```

361 88 

89<a id="session.input_audio_buffer.append"></a>

90 

362## session.input_audio_buffer.append91## session.input_audio_buffer.append

363 92 

364Send this event to append audio bytes to the translation session input audio buffer.93Send this event to append audio bytes to the translation session input audio buffer.


381 110 

382Schema name: `RealtimeTranslationClientEventInputAudioBufferAppend`111Schema name: `RealtimeTranslationClientEventInputAudioBufferAppend`

383 112 

384```json113- `audio: string`

385{114 

386 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema)": {115 Base64-encoded 24 kHz PCM16 mono audio bytes.

387 "kind": "HttpDeclTypeAlias",116 

388 "oasRef": "#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend",117- `type: "session.input_audio_buffer.append"`

389 "docstring": "Send this event to append audio bytes to the translation session input audio buffer.\n\nWebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono\nlittle-endian raw audio bytes. Unsupported websocket audio formats return a\nvalidation error because lower-quality audio materially degrades translation\nquality.\n\nTranslation consumes 200 ms engine frames. For best realtime behavior, append\naudio in 200 ms chunks. If a chunk is shorter, the server buffers it until it\nhas enough audio for one frame. If a chunk is longer, the server splits it into\n200 ms frames and enqueues them back-to-back.\n\nKeep appending silence while the session is active. If a client stops sending\naudio and later resumes, model time treats the resumed audio as contiguous with\nthe previous audio rather than as a real-world pause.\n",118 

390 "ident": "RealtimeTranslationInputAudioBufferAppendEvent",119 The event type, must be `session.input_audio_buffer.append`.

391 "type": {120 

392 "kind": "HttpTypeObject",121 - `"session.input_audio_buffer.append"`

393 "members": [122 

394 {123- `event_id: optional string`

395 "ident": "audio"124 

396 },125 Optional client-generated ID used to identify this event.

397 {

398 "ident": "type"

399 },

400 {

401 "ident": "event_id"

402 }

403 ]

404 },

405 "childrenParentSchema": "object",

406 "children": [

407 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) audio",

408 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) type",

409 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) event_id"

410 ]

411 },

412 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) audio": {

413 "kind": "HttpDeclProperty",

414 "oasRef": "#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend/properties/audio",

415 "deprecated": false,

416 "key": "audio",

417 "docstring": "Base64-encoded 24 kHz PCM16 mono audio bytes.",

418 "type": {

419 "kind": "HttpTypeString"

420 },

421 "optional": false,

422 "nullable": false,

423 "schemaType": "string",

424 "children": []

425 },

426 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) type": {

427 "kind": "HttpDeclProperty",

428 "oasRef": "#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend/properties/type",

429 "deprecated": false,

430 "key": "type",

431 "docstring": "The event type, must be `session.input_audio_buffer.append`.",

432 "type": {

433 "kind": "HttpTypeUnion",

434 "oasRef": "#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend/properties/type",

435 "types": [

436 {

437 "kind": "HttpTypeLiteral",

438 "literal": "session.input_audio_buffer.append"

439 }

440 ]

441 },

442 "optional": false,

443 "nullable": false,

444 "schemaType": "enum",

445 "childrenParentSchema": "enum",

446 "children": [

447 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) type > (member) 0"

448 ]

449 },

450 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) event_id": {

451 "kind": "HttpDeclProperty",

452 "oasRef": "#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend/properties/event_id",

453 "deprecated": false,

454 "key": "event_id",

455 "docstring": "Optional client-generated ID used to identify this event.",

456 "type": {

457 "kind": "HttpTypeString"

458 },

459 "constraints": {

460 "maxLength": 512

461 },

462 "optional": true,

463 "nullable": false,

464 "schemaType": "string",

465 "children": []

466 },

467 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) type > (member) 0": {

468 "kind": "HttpDeclReference",

469 "type": {

470 "kind": "HttpTypeLiteral",

471 "literal": "session.input_audio_buffer.append"

472 }

473 }

474}

475```

476 126 

477### Example127### Example

478 128 


484}134}

485```135```

486 136 

137<a id="session.close"></a>

138 

487## session.close139## session.close

488 140 

489Gracefully close the realtime translation session. The server flushes pending141Gracefully close the realtime translation session. The server flushes pending


494 146 

495Schema name: `RealtimeTranslationClientEventSessionClose`147Schema name: `RealtimeTranslationClientEventSessionClose`

496 148 

497```json149- `type: "session.close"`

498{150 

499 "(resource) realtime > (model) realtime_translation_session_close_event > (schema)": {151 The event type, must be `session.close`.

500 "kind": "HttpDeclTypeAlias",152 

501 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionClose",153 - `"session.close"`

502 "docstring": "Gracefully close the realtime translation session. The server flushes pending\ninput audio and emits any remaining translated output before closing the\nsession.\n",154 

503 "ident": "RealtimeTranslationSessionCloseEvent",155- `event_id: optional string`

504 "type": {156 

505 "kind": "HttpTypeObject",157 Optional client-generated ID used to identify this event.

506 "members": [

507 {

508 "ident": "type"

509 },

510 {

511 "ident": "event_id"

512 }

513 ]

514 },

515 "childrenParentSchema": "object",

516 "children": [

517 "(resource) realtime > (model) realtime_translation_session_close_event > (schema) > (property) type",

518 "(resource) realtime > (model) realtime_translation_session_close_event > (schema) > (property) event_id"

519 ]

520 },

521 "(resource) realtime > (model) realtime_translation_session_close_event > (schema) > (property) type": {

522 "kind": "HttpDeclProperty",

523 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionClose/properties/type",

524 "deprecated": false,

525 "key": "type",

526 "docstring": "The event type, must be `session.close`.",

527 "type": {

528 "kind": "HttpTypeUnion",

529 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionClose/properties/type",

530 "types": [

531 {

532 "kind": "HttpTypeLiteral",

533 "literal": "session.close"

534 }

535 ]

536 },

537 "optional": false,

538 "nullable": false,

539 "schemaType": "enum",

540 "childrenParentSchema": "enum",

541 "children": [

542 "(resource) realtime > (model) realtime_translation_session_close_event > (schema) > (property) type > (member) 0"

543 ]

544 },

545 "(resource) realtime > (model) realtime_translation_session_close_event > (schema) > (property) event_id": {

546 "kind": "HttpDeclProperty",

547 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionClose/properties/event_id",

548 "deprecated": false,

549 "key": "event_id",

550 "docstring": "Optional client-generated ID used to identify this event.",

551 "type": {

552 "kind": "HttpTypeString"

553 },

554 "constraints": {

555 "maxLength": 512

556 },

557 "optional": true,

558 "nullable": false,

559 "schemaType": "string",

560 "children": []

561 },

562 "(resource) realtime > (model) realtime_translation_session_close_event > (schema) > (property) type > (member) 0": {

563 "kind": "HttpDeclReference",

564 "type": {

565 "kind": "HttpTypeLiteral",

566 "literal": "session.close"

567 }

568 }

569}

570```

571 158 

572### Example159### Example

573 160 

Details

4 4 

5These are events emitted from the OpenAI Realtime Translation WebSocket server to the client.5These are events emitted from the OpenAI Realtime Translation WebSocket server to the client.

6 6 

7<a id="error"></a>

8 

7## error9## error

8 10 

9Returned when an error occurs, which could be a client problem or a server11Returned when an error occurs, which could be a client problem or a server


14 16 

15Schema name: `RealtimeServerEventError`17Schema name: `RealtimeServerEventError`

16 18 

17```json19- `error: RealtimeError`

18{20 

19 "(resource) realtime > (model) realtime_error_event > (schema)": {21 Details of the error.

20 "kind": "HttpDeclTypeAlias",22 

21 "oasRef": "#/components/schemas/RealtimeServerEventError",23 - `message: string`

22 "docstring": "Returned when an error occurs, which could be a client problem or a server\nproblem. Most errors are recoverable and the session will stay open, we\nrecommend to implementors to monitor and log error messages by default.\n",24 

23 "ident": "RealtimeErrorEvent",25 A human-readable error message.

24 "type": {26 

25 "kind": "HttpTypeObject",27 - `type: string`

26 "members": [28 

27 {29 The type of error (e.g., "invalid_request_error", "server_error").

28 "ident": "error"30 

29 },31 - `code: optional string or null`

30 {32 

31 "ident": "event_id"33 Error code, if any.

32 },34 

33 {35 - `event_id: optional string or null`

34 "ident": "type"36 

35 }37 The event_id of the client event that caused the error, if applicable.

36 ]38 

37 },39 - `param: optional string or null`

38 "childrenParentSchema": "object",40 

39 "children": [41 Parameter related to the error, if any.

40 "(resource) realtime > (model) realtime_error_event > (schema) > (property) error",42 

41 "(resource) realtime > (model) realtime_error_event > (schema) > (property) event_id",43- `event_id: string`

42 "(resource) realtime > (model) realtime_error_event > (schema) > (property) type"44 

43 ]45 The unique ID of the server event.

44 },46 

45 "(resource) realtime > (model) realtime_error_event > (schema) > (property) error": {47- `type: "error"`

46 "kind": "HttpDeclProperty",48 

47 "oasRef": "#/components/schemas/RealtimeServerEventError/properties/error",49 The event type, must be `error`.

48 "deprecated": false,50 

49 "key": "error",51 - `"error"`

50 "docstring": "Details of the error.",

51 "type": {

52 "kind": "HttpTypeReference",

53 "ident": "RealtimeError",

54 "$ref": "(resource) realtime > (model) realtime_error > (schema)"

55 },

56 "optional": false,

57 "nullable": false,

58 "modelImplicit": false,

59 "schemaType": "object",

60 "modelPath": "(resource) realtime > (model) realtime_error",

61 "childrenParentSchema": "object",

62 "children": [

63 "(resource) realtime > (model) realtime_error > (schema) > (property) message",

64 "(resource) realtime > (model) realtime_error > (schema) > (property) type",

65 "(resource) realtime > (model) realtime_error > (schema) > (property) code",

66 "(resource) realtime > (model) realtime_error > (schema) > (property) event_id",

67 "(resource) realtime > (model) realtime_error > (schema) > (property) param"

68 ]

69 },

70 "(resource) realtime > (model) realtime_error_event > (schema) > (property) event_id": {

71 "kind": "HttpDeclProperty",

72 "oasRef": "#/components/schemas/RealtimeServerEventError/properties/event_id",

73 "deprecated": false,

74 "key": "event_id",

75 "docstring": "The unique ID of the server event.",

76 "type": {

77 "kind": "HttpTypeString"

78 },

79 "optional": false,

80 "nullable": false,

81 "schemaType": "string",

82 "children": []

83 },

84 "(resource) realtime > (model) realtime_error_event > (schema) > (property) type": {

85 "kind": "HttpDeclProperty",

86 "oasRef": "#/components/schemas/RealtimeServerEventError/properties/type",

87 "deprecated": false,

88 "key": "type",

89 "docstring": "The event type, must be `error`.",

90 "type": {

91 "kind": "HttpTypeUnion",

92 "oasRef": "#/components/schemas/RealtimeServerEventError/properties/type",

93 "types": [

94 {

95 "kind": "HttpTypeLiteral",

96 "literal": "error"

97 }

98 ]

99 },

100 "optional": false,

101 "nullable": false,

102 "schemaType": "enum",

103 "childrenParentSchema": "enum",

104 "children": [

105 "(resource) realtime > (model) realtime_error_event > (schema) > (property) type > (member) 0"

106 ]

107 },

108 "(resource) realtime > (model) realtime_error > (schema) > (property) message": {

109 "kind": "HttpDeclProperty",

110 "oasRef": "#/components/schemas/RealtimeServerEventError/properties/error/properties/message",

111 "deprecated": false,

112 "key": "message",

113 "docstring": "A human-readable error message.",

114 "type": {

115 "kind": "HttpTypeString"

116 },

117 "optional": false,

118 "nullable": false,

119 "schemaType": "string",

120 "children": []

121 },

122 "(resource) realtime > (model) realtime_error > (schema) > (property) type": {

123 "kind": "HttpDeclProperty",

124 "oasRef": "#/components/schemas/RealtimeServerEventError/properties/error/properties/type",

125 "deprecated": false,

126 "key": "type",

127 "docstring": "The type of error (e.g., \"invalid_request_error\", \"server_error\").\n",

128 "type": {

129 "kind": "HttpTypeString"

130 },

131 "optional": false,

132 "nullable": false,

133 "schemaType": "string",

134 "children": []

135 },

136 "(resource) realtime > (model) realtime_error > (schema) > (property) code": {

137 "kind": "HttpDeclProperty",

138 "oasRef": "#/components/schemas/RealtimeServerEventError/properties/error/properties/code",

139 "deprecated": false,

140 "key": "code",

141 "docstring": "Error code, if any.",

142 "type": {

143 "kind": "HttpTypeString"

144 },

145 "optional": true,

146 "nullable": true,

147 "schemaType": "string",

148 "children": []

149 },

150 "(resource) realtime > (model) realtime_error > (schema) > (property) event_id": {

151 "kind": "HttpDeclProperty",

152 "oasRef": "#/components/schemas/RealtimeServerEventError/properties/error/properties/event_id",

153 "deprecated": false,

154 "key": "event_id",

155 "docstring": "The event_id of the client event that caused the error, if applicable.\n",

156 "type": {

157 "kind": "HttpTypeString"

158 },

159 "optional": true,

160 "nullable": true,

161 "schemaType": "string",

162 "children": []

163 },

164 "(resource) realtime > (model) realtime_error > (schema) > (property) param": {

165 "kind": "HttpDeclProperty",

166 "oasRef": "#/components/schemas/RealtimeServerEventError/properties/error/properties/param",

167 "deprecated": false,

168 "key": "param",

169 "docstring": "Parameter related to the error, if any.",

170 "type": {

171 "kind": "HttpTypeString"

172 },

173 "optional": true,

174 "nullable": true,

175 "schemaType": "string",

176 "children": []

177 },

178 "(resource) realtime > (model) realtime_error > (schema)": {

179 "kind": "HttpDeclTypeAlias",

180 "oasRef": "#/components/schemas/RealtimeServerEventError/properties/error",

181 "docstring": "Details of the error.",

182 "ident": "RealtimeError",

183 "type": {

184 "kind": "HttpTypeObject",

185 "members": [

186 {

187 "ident": "message"

188 },

189 {

190 "ident": "type"

191 },

192 {

193 "ident": "code"

194 },

195 {

196 "ident": "event_id"

197 },

198 {

199 "ident": "param"

200 }

201 ]

202 },

203 "childrenParentSchema": "object",

204 "children": [

205 "(resource) realtime > (model) realtime_error > (schema) > (property) message",

206 "(resource) realtime > (model) realtime_error > (schema) > (property) type",

207 "(resource) realtime > (model) realtime_error > (schema) > (property) code",

208 "(resource) realtime > (model) realtime_error > (schema) > (property) event_id",

209 "(resource) realtime > (model) realtime_error > (schema) > (property) param"

210 ]

211 },

212 "(resource) realtime > (model) realtime_error_event > (schema) > (property) type > (member) 0": {

213 "kind": "HttpDeclReference",

214 "type": {

215 "kind": "HttpTypeLiteral",

216 "literal": "error"

217 }

218 }

219}

220```

221 52 

222### Example53### Example

223 54 


235}66}

236```67```

237 68 

69<a id="session.created"></a>

70 

238## session.created71## session.created

239 72 

240Returned when a translation session is created. Emitted automatically when a73Returned when a translation session is created. Emitted automatically when a


245 78 

246Schema name: `RealtimeTranslationServerEventSessionCreated`79Schema name: `RealtimeTranslationServerEventSessionCreated`

247 80 

248```json81- `event_id: string`

249{82 

250 "(resource) realtime > (model) realtime_translation_session_created_event > (schema)": {83 The unique ID of the server event.

251 "kind": "HttpDeclTypeAlias",84 

252 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionCreated",85- `session: RealtimeTranslationSession`

253 "docstring": "Returned when a translation session is created. Emitted automatically when a\nnew connection is established as the first server event. This event contains\nthe default translation session configuration.\n",86 

254 "ident": "RealtimeTranslationSessionCreatedEvent",87 The translation session configuration.

255 "type": {88 

256 "kind": "HttpTypeObject",89 - `id: string`

257 "members": [90 

258 {91 Unique identifier for the session that looks like `sess_1234567890abcdef`.

259 "ident": "event_id"92 

260 },93 - `audio: object { input, output }`

261 {94 

262 "ident": "session"95 Configuration for translation input and output audio.

263 },96 

264 {97 - `input: optional object { noise_reduction, transcription }`

265 "ident": "type"98 

266 }99 - `noise_reduction: optional object { type } or null`

267 ]100 

268 },101 Optional input noise reduction.

269 "childrenParentSchema": "object",102 

270 "children": [103 - `type: NoiseReductionType`

271 "(resource) realtime > (model) realtime_translation_session_created_event > (schema) > (property) event_id",104 

272 "(resource) realtime > (model) realtime_translation_session_created_event > (schema) > (property) session",105 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.

273 "(resource) realtime > (model) realtime_translation_session_created_event > (schema) > (property) type"106 

274 ]107 - `"near_field"`

275 },108 

276 "(resource) realtime > (model) realtime_translation_session_created_event > (schema) > (property) event_id": {109 - `"far_field"`

277 "kind": "HttpDeclProperty",110 

278 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionCreated/properties/event_id",111 - `transcription: optional object { model } or null`

279 "deprecated": false,112 

280 "key": "event_id",113 Optional source-language transcription. When configured, the server emits

281 "docstring": "The unique ID of the server event.",114 `session.input_transcript.delta` events. Translation itself still runs from

282 "type": {115 the input audio stream.

283 "kind": "HttpTypeString"116 

284 },117 - `model: string`

285 "optional": false,118 

286 "nullable": false,119 The transcription model used for source transcript deltas.

287 "schemaType": "string",120 

288 "children": []121 - `output: optional object { language }`

289 },122 

290 "(resource) realtime > (model) realtime_translation_session_created_event > (schema) > (property) session": {123 - `language: optional string`

291 "kind": "HttpDeclProperty",124 

292 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionCreated/properties/session",125 Target language for translated output audio and transcript deltas.

293 "deprecated": false,126 

294 "key": "session",127 - `expires_at: number`

295 "docstring": "The translation session configuration.",128 

296 "title": "Realtime translation session",129 Expiration timestamp for the session, in seconds since epoch.

297 "type": {130 

298 "kind": "HttpTypeReference",131 - `model: string`

299 "ident": "RealtimeTranslationSession",132 

300 "$ref": "(resource) realtime > (model) realtime_translation_session > (schema)"133 The Realtime translation model used for this session. This field is set at

301 },134 session creation and cannot be changed with `session.update`.

302 "optional": false,135 

303 "nullable": false,136 - `type: "translation"`

304 "modelImplicit": false,137 

305 "schemaType": "object",138 The session type. Always `translation` for Realtime translation sessions.

306 "modelPath": "(resource) realtime > (model) realtime_translation_session",139 

307 "childrenParentSchema": "object",140 - `"translation"`

308 "children": [141 

309 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) id",142- `type: "session.created"`

310 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio",143 

311 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) expires_at",144 The event type, must be `session.created`.

312 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) model",145 

313 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) type"146 - `"session.created"`

314 ]

315 },

316 "(resource) realtime > (model) realtime_translation_session_created_event > (schema) > (property) type": {

317 "kind": "HttpDeclProperty",

318 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionCreated/properties/type",

319 "deprecated": false,

320 "key": "type",

321 "docstring": "The event type, must be `session.created`.",

322 "type": {

323 "kind": "HttpTypeUnion",

324 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionCreated/properties/type",

325 "types": [

326 {

327 "kind": "HttpTypeLiteral",

328 "literal": "session.created"

329 }

330 ]

331 },

332 "optional": false,

333 "nullable": false,

334 "schemaType": "enum",

335 "childrenParentSchema": "enum",

336 "children": [

337 "(resource) realtime > (model) realtime_translation_session_created_event > (schema) > (property) type > (member) 0"

338 ]

339 },

340 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) id": {

341 "kind": "HttpDeclProperty",

342 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/id",

343 "deprecated": false,

344 "key": "id",

345 "docstring": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n",

346 "type": {

347 "kind": "HttpTypeString"

348 },

349 "optional": false,

350 "nullable": false,

351 "schemaType": "string",

352 "children": []

353 },

354 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio": {

355 "kind": "HttpDeclProperty",

356 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio",

357 "deprecated": false,

358 "key": "audio",

359 "docstring": "Configuration for translation input and output audio.\n",

360 "type": {

361 "kind": "HttpTypeObject",

362 "members": [

363 {

364 "ident": "input"

365 },

366 {

367 "ident": "output"

368 }

369 ]

370 },

371 "optional": false,

372 "nullable": false,

373 "schemaType": "object",

374 "childrenParentSchema": "object",

375 "children": [

376 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input",

377 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) output"

378 ]

379 },

380 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) expires_at": {

381 "kind": "HttpDeclProperty",

382 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/expires_at",

383 "deprecated": false,

384 "key": "expires_at",

385 "docstring": "Expiration timestamp for the session, in seconds since epoch.",

386 "type": {

387 "kind": "HttpTypeNumber"

388 },

389 "constraints": {

390 "format": "unixtime"

391 },

392 "optional": false,

393 "nullable": false,

394 "schemaType": "integer",

395 "children": []

396 },

397 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) model": {

398 "kind": "HttpDeclProperty",

399 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/model",

400 "deprecated": false,

401 "key": "model",

402 "docstring": "The Realtime translation model used for this session. This field is set at\nsession creation and cannot be changed with `session.update`.\n",

403 "type": {

404 "kind": "HttpTypeString"

405 },

406 "optional": false,

407 "nullable": false,

408 "schemaType": "string",

409 "children": []

410 },

411 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) type": {

412 "kind": "HttpDeclProperty",

413 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/type",

414 "deprecated": false,

415 "key": "type",

416 "docstring": "The session type. Always `translation` for Realtime translation sessions.\n",

417 "type": {

418 "kind": "HttpTypeUnion",

419 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/type",

420 "types": [

421 {

422 "kind": "HttpTypeLiteral",

423 "literal": "translation"

424 }

425 ]

426 },

427 "optional": false,

428 "nullable": false,

429 "schemaType": "enum",

430 "childrenParentSchema": "enum",

431 "children": [

432 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) type > (member) 0"

433 ]

434 },

435 "(resource) realtime > (model) realtime_translation_session > (schema)": {

436 "kind": "HttpDeclTypeAlias",

437 "oasRef": "#/components/schemas/RealtimeTranslationSession",

438 "docstring": "A Realtime translation session. Translation sessions continuously translate input\naudio into the configured output language.\n",

439 "ident": "RealtimeTranslationSession",

440 "type": {

441 "kind": "HttpTypeObject",

442 "members": [

443 {

444 "ident": "id"

445 },

446 {

447 "ident": "audio"

448 },

449 {

450 "ident": "expires_at"

451 },

452 {

453 "ident": "model"

454 },

455 {

456 "ident": "type"

457 }

458 ]

459 },

460 "childrenParentSchema": "object",

461 "children": [

462 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) id",

463 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio",

464 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) expires_at",

465 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) model",

466 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) type"

467 ]

468 },

469 "(resource) realtime > (model) realtime_translation_session_created_event > (schema) > (property) type > (member) 0": {

470 "kind": "HttpDeclReference",

471 "type": {

472 "kind": "HttpTypeLiteral",

473 "literal": "session.created"

474 }

475 },

476 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input": {

477 "kind": "HttpDeclProperty",

478 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/input",

479 "deprecated": false,

480 "key": "input",

481 "type": {

482 "kind": "HttpTypeObject",

483 "members": [

484 {

485 "ident": "noise_reduction"

486 },

487 {

488 "ident": "transcription"

489 }

490 ]

491 },

492 "optional": true,

493 "nullable": false,

494 "schemaType": "object",

495 "childrenParentSchema": "object",

496 "children": [

497 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) noise_reduction",

498 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) transcription"

499 ]

500 },

501 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) output": {

502 "kind": "HttpDeclProperty",

503 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/output",

504 "deprecated": false,

505 "key": "output",

506 "type": {

507 "kind": "HttpTypeObject",

508 "members": [

509 {

510 "ident": "language"

511 }

512 ]

513 },

514 "optional": true,

515 "nullable": false,

516 "schemaType": "object",

517 "childrenParentSchema": "object",

518 "children": [

519 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) output > (property) language"

520 ]

521 },

522 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) type > (member) 0": {

523 "kind": "HttpDeclReference",

524 "type": {

525 "kind": "HttpTypeLiteral",

526 "literal": "translation"

527 }

528 },

529 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) noise_reduction": {

530 "kind": "HttpDeclProperty",

531 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/input/properties/noise_reduction",

532 "deprecated": false,

533 "key": "noise_reduction",

534 "docstring": "Optional input noise reduction.\n",

535 "type": {

536 "kind": "HttpTypeObject",

537 "members": [

538 {

539 "ident": "type"

540 }

541 ]

542 },

543 "optional": true,

544 "nullable": true,

545 "schemaType": "object",

546 "childrenParentSchema": "object",

547 "children": [

548 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) noise_reduction > (property) type"

549 ]

550 },

551 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) transcription": {

552 "kind": "HttpDeclProperty",

553 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/input/properties/transcription",

554 "deprecated": false,

555 "key": "transcription",

556 "docstring": "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n",

557 "type": {

558 "kind": "HttpTypeObject",

559 "members": [

560 {

561 "ident": "model"

562 }

563 ]

564 },

565 "optional": true,

566 "nullable": true,

567 "schemaType": "object",

568 "childrenParentSchema": "object",

569 "children": [

570 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) transcription > (property) model"

571 ]

572 },

573 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) output > (property) language": {

574 "kind": "HttpDeclProperty",

575 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/output/properties/language",

576 "deprecated": false,

577 "key": "language",

578 "docstring": "Target language for translated output audio and transcript deltas.\n",

579 "type": {

580 "kind": "HttpTypeString"

581 },

582 "optional": true,

583 "nullable": false,

584 "schemaType": "string",

585 "children": []

586 },

587 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) noise_reduction > (property) type": {

588 "kind": "HttpDeclProperty",

589 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/input/properties/noise_reduction/anyOf/0/properties/type",

590 "deprecated": false,

591 "key": "type",

592 "docstring": "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n",

593 "type": {

594 "kind": "HttpTypeReference",

595 "ident": "NoiseReductionType",

596 "$ref": "(resource) realtime > (model) noise_reduction_type > (schema)"

597 },

598 "optional": false,

599 "nullable": false,

600 "modelImplicit": false,

601 "schemaType": "enum",

602 "modelPath": "(resource) realtime > (model) noise_reduction_type",

603 "childrenParentSchema": "enum",

604 "children": [

605 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 0",

606 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 1"

607 ]

608 },

609 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) transcription > (property) model": {

610 "kind": "HttpDeclProperty",

611 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/input/properties/transcription/anyOf/0/properties/model",

612 "deprecated": false,

613 "key": "model",

614 "docstring": "The transcription model used for source transcript deltas.",

615 "type": {

616 "kind": "HttpTypeString"

617 },

618 "optional": false,

619 "nullable": false,

620 "schemaType": "string",

621 "children": []

622 },

623 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 0": {

624 "kind": "HttpDeclReference",

625 "type": {

626 "kind": "HttpTypeLiteral",

627 "literal": "near_field"

628 }

629 },

630 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 1": {

631 "kind": "HttpDeclReference",

632 "type": {

633 "kind": "HttpTypeLiteral",

634 "literal": "far_field"

635 }

636 },

637 "(resource) realtime > (model) noise_reduction_type > (schema)": {

638 "kind": "HttpDeclTypeAlias",

639 "oasRef": "#/components/schemas/NoiseReductionType",

640 "docstring": "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n",

641 "ident": "NoiseReductionType",

642 "type": {

643 "kind": "HttpTypeUnion",

644 "oasRef": "#/components/schemas/NoiseReductionType",

645 "types": [

646 {

647 "kind": "HttpTypeLiteral",

648 "literal": "near_field"

649 },

650 {

651 "kind": "HttpTypeLiteral",

652 "literal": "far_field"

653 }

654 ]

655 },

656 "childrenParentSchema": "enum",

657 "children": [

658 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 0",

659 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 1"

660 ]

661 }

662}

663```

664 147 

665### Example148### Example

666 149 


691}174}

692```175```

693 176 

177<a id="session.updated"></a>

178 

694## session.updated179## session.updated

695 180 

696Returned when a translation session is updated with a `session.update` event,181Returned when a translation session is updated with a `session.update` event,


700 185 

701Schema name: `RealtimeTranslationServerEventSessionUpdated`186Schema name: `RealtimeTranslationServerEventSessionUpdated`

702 187 

703```json188- `event_id: string`

704{189 

705 "(resource) realtime > (model) realtime_translation_session_updated_event > (schema)": {190 The unique ID of the server event.

706 "kind": "HttpDeclTypeAlias",191 

707 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionUpdated",192- `session: RealtimeTranslationSession`

708 "docstring": "Returned when a translation session is updated with a `session.update` event,\nunless there is an error.\n",193 

709 "ident": "RealtimeTranslationSessionUpdatedEvent",194 The translation session configuration.

710 "type": {195 

711 "kind": "HttpTypeObject",196 - `id: string`

712 "members": [197 

713 {198 Unique identifier for the session that looks like `sess_1234567890abcdef`.

714 "ident": "event_id"199 

715 },200 - `audio: object { input, output }`

716 {201 

717 "ident": "session"202 Configuration for translation input and output audio.

718 },203 

719 {204 - `input: optional object { noise_reduction, transcription }`

720 "ident": "type"205 

721 }206 - `noise_reduction: optional object { type } or null`

722 ]207 

723 },208 Optional input noise reduction.

724 "childrenParentSchema": "object",209 

725 "children": [210 - `type: NoiseReductionType`

726 "(resource) realtime > (model) realtime_translation_session_updated_event > (schema) > (property) event_id",211 

727 "(resource) realtime > (model) realtime_translation_session_updated_event > (schema) > (property) session",212 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.

728 "(resource) realtime > (model) realtime_translation_session_updated_event > (schema) > (property) type"213 

729 ]214 - `"near_field"`

730 },215 

731 "(resource) realtime > (model) realtime_translation_session_updated_event > (schema) > (property) event_id": {216 - `"far_field"`

732 "kind": "HttpDeclProperty",217 

733 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionUpdated/properties/event_id",218 - `transcription: optional object { model } or null`

734 "deprecated": false,219 

735 "key": "event_id",220 Optional source-language transcription. When configured, the server emits

736 "docstring": "The unique ID of the server event.",221 `session.input_transcript.delta` events. Translation itself still runs from

737 "type": {222 the input audio stream.

738 "kind": "HttpTypeString"223 

739 },224 - `model: string`

740 "optional": false,225 

741 "nullable": false,226 The transcription model used for source transcript deltas.

742 "schemaType": "string",227 

743 "children": []228 - `output: optional object { language }`

744 },229 

745 "(resource) realtime > (model) realtime_translation_session_updated_event > (schema) > (property) session": {230 - `language: optional string`

746 "kind": "HttpDeclProperty",231 

747 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionUpdated/properties/session",232 Target language for translated output audio and transcript deltas.

748 "deprecated": false,233 

749 "key": "session",234 - `expires_at: number`

750 "docstring": "The translation session configuration.",235 

751 "title": "Realtime translation session",236 Expiration timestamp for the session, in seconds since epoch.

752 "type": {237 

753 "kind": "HttpTypeReference",238 - `model: string`

754 "ident": "RealtimeTranslationSession",239 

755 "$ref": "(resource) realtime > (model) realtime_translation_session > (schema)"240 The Realtime translation model used for this session. This field is set at

756 },241 session creation and cannot be changed with `session.update`.

757 "optional": false,242 

758 "nullable": false,243 - `type: "translation"`

759 "modelImplicit": false,244 

760 "schemaType": "object",245 The session type. Always `translation` for Realtime translation sessions.

761 "modelPath": "(resource) realtime > (model) realtime_translation_session",246 

762 "childrenParentSchema": "object",247 - `"translation"`

763 "children": [248 

764 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) id",249- `type: "session.updated"`

765 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio",250 

766 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) expires_at",251 The event type, must be `session.updated`.

767 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) model",252 

768 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) type"253 - `"session.updated"`

769 ]

770 },

771 "(resource) realtime > (model) realtime_translation_session_updated_event > (schema) > (property) type": {

772 "kind": "HttpDeclProperty",

773 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionUpdated/properties/type",

774 "deprecated": false,

775 "key": "type",

776 "docstring": "The event type, must be `session.updated`.",

777 "type": {

778 "kind": "HttpTypeUnion",

779 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionUpdated/properties/type",

780 "types": [

781 {

782 "kind": "HttpTypeLiteral",

783 "literal": "session.updated"

784 }

785 ]

786 },

787 "optional": false,

788 "nullable": false,

789 "schemaType": "enum",

790 "childrenParentSchema": "enum",

791 "children": [

792 "(resource) realtime > (model) realtime_translation_session_updated_event > (schema) > (property) type > (member) 0"

793 ]

794 },

795 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) id": {

796 "kind": "HttpDeclProperty",

797 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/id",

798 "deprecated": false,

799 "key": "id",

800 "docstring": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n",

801 "type": {

802 "kind": "HttpTypeString"

803 },

804 "optional": false,

805 "nullable": false,

806 "schemaType": "string",

807 "children": []

808 },

809 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio": {

810 "kind": "HttpDeclProperty",

811 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio",

812 "deprecated": false,

813 "key": "audio",

814 "docstring": "Configuration for translation input and output audio.\n",

815 "type": {

816 "kind": "HttpTypeObject",

817 "members": [

818 {

819 "ident": "input"

820 },

821 {

822 "ident": "output"

823 }

824 ]

825 },

826 "optional": false,

827 "nullable": false,

828 "schemaType": "object",

829 "childrenParentSchema": "object",

830 "children": [

831 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input",

832 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) output"

833 ]

834 },

835 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) expires_at": {

836 "kind": "HttpDeclProperty",

837 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/expires_at",

838 "deprecated": false,

839 "key": "expires_at",

840 "docstring": "Expiration timestamp for the session, in seconds since epoch.",

841 "type": {

842 "kind": "HttpTypeNumber"

843 },

844 "constraints": {

845 "format": "unixtime"

846 },

847 "optional": false,

848 "nullable": false,

849 "schemaType": "integer",

850 "children": []

851 },

852 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) model": {

853 "kind": "HttpDeclProperty",

854 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/model",

855 "deprecated": false,

856 "key": "model",

857 "docstring": "The Realtime translation model used for this session. This field is set at\nsession creation and cannot be changed with `session.update`.\n",

858 "type": {

859 "kind": "HttpTypeString"

860 },

861 "optional": false,

862 "nullable": false,

863 "schemaType": "string",

864 "children": []

865 },

866 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) type": {

867 "kind": "HttpDeclProperty",

868 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/type",

869 "deprecated": false,

870 "key": "type",

871 "docstring": "The session type. Always `translation` for Realtime translation sessions.\n",

872 "type": {

873 "kind": "HttpTypeUnion",

874 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/type",

875 "types": [

876 {

877 "kind": "HttpTypeLiteral",

878 "literal": "translation"

879 }

880 ]

881 },

882 "optional": false,

883 "nullable": false,

884 "schemaType": "enum",

885 "childrenParentSchema": "enum",

886 "children": [

887 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) type > (member) 0"

888 ]

889 },

890 "(resource) realtime > (model) realtime_translation_session > (schema)": {

891 "kind": "HttpDeclTypeAlias",

892 "oasRef": "#/components/schemas/RealtimeTranslationSession",

893 "docstring": "A Realtime translation session. Translation sessions continuously translate input\naudio into the configured output language.\n",

894 "ident": "RealtimeTranslationSession",

895 "type": {

896 "kind": "HttpTypeObject",

897 "members": [

898 {

899 "ident": "id"

900 },

901 {

902 "ident": "audio"

903 },

904 {

905 "ident": "expires_at"

906 },

907 {

908 "ident": "model"

909 },

910 {

911 "ident": "type"

912 }

913 ]

914 },

915 "childrenParentSchema": "object",

916 "children": [

917 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) id",

918 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio",

919 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) expires_at",

920 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) model",

921 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) type"

922 ]

923 },

924 "(resource) realtime > (model) realtime_translation_session_updated_event > (schema) > (property) type > (member) 0": {

925 "kind": "HttpDeclReference",

926 "type": {

927 "kind": "HttpTypeLiteral",

928 "literal": "session.updated"

929 }

930 },

931 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input": {

932 "kind": "HttpDeclProperty",

933 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/input",

934 "deprecated": false,

935 "key": "input",

936 "type": {

937 "kind": "HttpTypeObject",

938 "members": [

939 {

940 "ident": "noise_reduction"

941 },

942 {

943 "ident": "transcription"

944 }

945 ]

946 },

947 "optional": true,

948 "nullable": false,

949 "schemaType": "object",

950 "childrenParentSchema": "object",

951 "children": [

952 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) noise_reduction",

953 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) transcription"

954 ]

955 },

956 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) output": {

957 "kind": "HttpDeclProperty",

958 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/output",

959 "deprecated": false,

960 "key": "output",

961 "type": {

962 "kind": "HttpTypeObject",

963 "members": [

964 {

965 "ident": "language"

966 }

967 ]

968 },

969 "optional": true,

970 "nullable": false,

971 "schemaType": "object",

972 "childrenParentSchema": "object",

973 "children": [

974 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) output > (property) language"

975 ]

976 },

977 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) type > (member) 0": {

978 "kind": "HttpDeclReference",

979 "type": {

980 "kind": "HttpTypeLiteral",

981 "literal": "translation"

982 }

983 },

984 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) noise_reduction": {

985 "kind": "HttpDeclProperty",

986 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/input/properties/noise_reduction",

987 "deprecated": false,

988 "key": "noise_reduction",

989 "docstring": "Optional input noise reduction.\n",

990 "type": {

991 "kind": "HttpTypeObject",

992 "members": [

993 {

994 "ident": "type"

995 }

996 ]

997 },

998 "optional": true,

999 "nullable": true,

1000 "schemaType": "object",

1001 "childrenParentSchema": "object",

1002 "children": [

1003 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) noise_reduction > (property) type"

1004 ]

1005 },

1006 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) transcription": {

1007 "kind": "HttpDeclProperty",

1008 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/input/properties/transcription",

1009 "deprecated": false,

1010 "key": "transcription",

1011 "docstring": "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n",

1012 "type": {

1013 "kind": "HttpTypeObject",

1014 "members": [

1015 {

1016 "ident": "model"

1017 }

1018 ]

1019 },

1020 "optional": true,

1021 "nullable": true,

1022 "schemaType": "object",

1023 "childrenParentSchema": "object",

1024 "children": [

1025 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) transcription > (property) model"

1026 ]

1027 },

1028 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) output > (property) language": {

1029 "kind": "HttpDeclProperty",

1030 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/output/properties/language",

1031 "deprecated": false,

1032 "key": "language",

1033 "docstring": "Target language for translated output audio and transcript deltas.\n",

1034 "type": {

1035 "kind": "HttpTypeString"

1036 },

1037 "optional": true,

1038 "nullable": false,

1039 "schemaType": "string",

1040 "children": []

1041 },

1042 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) noise_reduction > (property) type": {

1043 "kind": "HttpDeclProperty",

1044 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/input/properties/noise_reduction/anyOf/0/properties/type",

1045 "deprecated": false,

1046 "key": "type",

1047 "docstring": "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n",

1048 "type": {

1049 "kind": "HttpTypeReference",

1050 "ident": "NoiseReductionType",

1051 "$ref": "(resource) realtime > (model) noise_reduction_type > (schema)"

1052 },

1053 "optional": false,

1054 "nullable": false,

1055 "modelImplicit": false,

1056 "schemaType": "enum",

1057 "modelPath": "(resource) realtime > (model) noise_reduction_type",

1058 "childrenParentSchema": "enum",

1059 "children": [

1060 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 0",

1061 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 1"

1062 ]

1063 },

1064 "(resource) realtime > (model) realtime_translation_session > (schema) > (property) audio > (property) input > (property) transcription > (property) model": {

1065 "kind": "HttpDeclProperty",

1066 "oasRef": "#/components/schemas/RealtimeTranslationSession/properties/audio/properties/input/properties/transcription/anyOf/0/properties/model",

1067 "deprecated": false,

1068 "key": "model",

1069 "docstring": "The transcription model used for source transcript deltas.",

1070 "type": {

1071 "kind": "HttpTypeString"

1072 },

1073 "optional": false,

1074 "nullable": false,

1075 "schemaType": "string",

1076 "children": []

1077 },

1078 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 0": {

1079 "kind": "HttpDeclReference",

1080 "type": {

1081 "kind": "HttpTypeLiteral",

1082 "literal": "near_field"

1083 }

1084 },

1085 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 1": {

1086 "kind": "HttpDeclReference",

1087 "type": {

1088 "kind": "HttpTypeLiteral",

1089 "literal": "far_field"

1090 }

1091 },

1092 "(resource) realtime > (model) noise_reduction_type > (schema)": {

1093 "kind": "HttpDeclTypeAlias",

1094 "oasRef": "#/components/schemas/NoiseReductionType",

1095 "docstring": "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n",

1096 "ident": "NoiseReductionType",

1097 "type": {

1098 "kind": "HttpTypeUnion",

1099 "oasRef": "#/components/schemas/NoiseReductionType",

1100 "types": [

1101 {

1102 "kind": "HttpTypeLiteral",

1103 "literal": "near_field"

1104 },

1105 {

1106 "kind": "HttpTypeLiteral",

1107 "literal": "far_field"

1108 }

1109 ]

1110 },

1111 "childrenParentSchema": "enum",

1112 "children": [

1113 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 0",

1114 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 1"

1115 ]

1116 }

1117}

1118```

1119 254 

1120### Example255### Example

1121 256 


1146}281}

1147```282```

1148 283 

284<a id="session.closed"></a>

285 

1149## session.closed286## session.closed

1150 287 

1151Returned when a realtime translation session is closed.288Returned when a realtime translation session is closed.


1154 291 

1155Schema name: `RealtimeTranslationServerEventSessionClosed`292Schema name: `RealtimeTranslationServerEventSessionClosed`

1156 293 

1157```json294- `event_id: string`

1158{295 

1159 "(resource) realtime > (model) realtime_translation_session_closed_event > (schema)": {296 The unique ID of the server event.

1160 "kind": "HttpDeclTypeAlias",297 

1161 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionClosed",298- `type: "session.closed"`

1162 "docstring": "Returned when a realtime translation session is closed.\n",299 

1163 "ident": "RealtimeTranslationSessionClosedEvent",300 The event type, must be `session.closed`.

1164 "type": {301 

1165 "kind": "HttpTypeObject",302 - `"session.closed"`

1166 "members": [

1167 {

1168 "ident": "event_id"

1169 },

1170 {

1171 "ident": "type"

1172 }

1173 ]

1174 },

1175 "childrenParentSchema": "object",

1176 "children": [

1177 "(resource) realtime > (model) realtime_translation_session_closed_event > (schema) > (property) event_id",

1178 "(resource) realtime > (model) realtime_translation_session_closed_event > (schema) > (property) type"

1179 ]

1180 },

1181 "(resource) realtime > (model) realtime_translation_session_closed_event > (schema) > (property) event_id": {

1182 "kind": "HttpDeclProperty",

1183 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionClosed/properties/event_id",

1184 "deprecated": false,

1185 "key": "event_id",

1186 "docstring": "The unique ID of the server event.",

1187 "type": {

1188 "kind": "HttpTypeString"

1189 },

1190 "optional": false,

1191 "nullable": false,

1192 "schemaType": "string",

1193 "children": []

1194 },

1195 "(resource) realtime > (model) realtime_translation_session_closed_event > (schema) > (property) type": {

1196 "kind": "HttpDeclProperty",

1197 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionClosed/properties/type",

1198 "deprecated": false,

1199 "key": "type",

1200 "docstring": "The event type, must be `session.closed`.",

1201 "type": {

1202 "kind": "HttpTypeUnion",

1203 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionClosed/properties/type",

1204 "types": [

1205 {

1206 "kind": "HttpTypeLiteral",

1207 "literal": "session.closed"

1208 }

1209 ]

1210 },

1211 "optional": false,

1212 "nullable": false,

1213 "schemaType": "enum",

1214 "childrenParentSchema": "enum",

1215 "children": [

1216 "(resource) realtime > (model) realtime_translation_session_closed_event > (schema) > (property) type > (member) 0"

1217 ]

1218 },

1219 "(resource) realtime > (model) realtime_translation_session_closed_event > (schema) > (property) type > (member) 0": {

1220 "kind": "HttpDeclReference",

1221 "type": {

1222 "kind": "HttpTypeLiteral",

1223 "literal": "session.closed"

1224 }

1225 }

1226}

1227```

1228 303 

1229### Example304### Example

1230 305 


1235}310}

1236```311```

1237 312 

313<a id="session.input_transcript.delta"></a>

314 

1238## session.input_transcript.delta315## session.input_transcript.delta

1239 316 

1240Returned when optional source-language transcript text is available. This event317Returned when optional source-language transcript text is available. This event


1247 324 

1248Schema name: `RealtimeTranslationServerEventSessionInputTranscriptDelta`325Schema name: `RealtimeTranslationServerEventSessionInputTranscriptDelta`

1249 326 

1250```json327- `delta: string`

1251{328 

1252 "(resource) realtime > (model) realtime_translation_input_transcript_delta_event > (schema)": {329 Append-only source-language transcript text.

1253 "kind": "HttpDeclTypeAlias",330 

1254 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta",331- `event_id: string`

1255 "docstring": "Returned when optional source-language transcript text is available. This event\nis emitted only when `audio.input.transcription` is configured.\n\nTranscript deltas are append-only text fragments. Clients should not insert\nunconditional spaces between deltas.\n",332 

1256 "ident": "RealtimeTranslationInputTranscriptDeltaEvent",333 The unique ID of the server event.

1257 "type": {334 

1258 "kind": "HttpTypeObject",335- `type: "session.input_transcript.delta"`

1259 "members": [336 

1260 {337 The event type, must be `session.input_transcript.delta`.

1261 "ident": "delta"338 

1262 },339 - `"session.input_transcript.delta"`

1263 {340 

1264 "ident": "event_id"341- `elapsed_ms: optional number or null`

1265 },342 

1266 {343 Timing metadata for stream alignment, derived from the translation frame

1267 "ident": "type"344 when available. It advances in 200 ms increments, but multiple transcript

1268 },345 deltas may share the same `elapsed_ms`. Treat it as alignment metadata,

1269 {346 not a unique transcript-delta identifier.

1270 "ident": "elapsed_ms"

1271 }

1272 ]

1273 },

1274 "childrenParentSchema": "object",

1275 "children": [

1276 "(resource) realtime > (model) realtime_translation_input_transcript_delta_event > (schema) > (property) delta",

1277 "(resource) realtime > (model) realtime_translation_input_transcript_delta_event > (schema) > (property) event_id",

1278 "(resource) realtime > (model) realtime_translation_input_transcript_delta_event > (schema) > (property) type",

1279 "(resource) realtime > (model) realtime_translation_input_transcript_delta_event > (schema) > (property) elapsed_ms"

1280 ]

1281 },

1282 "(resource) realtime > (model) realtime_translation_input_transcript_delta_event > (schema) > (property) delta": {

1283 "kind": "HttpDeclProperty",

1284 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta/properties/delta",

1285 "deprecated": false,

1286 "key": "delta",

1287 "docstring": "Append-only source-language transcript text.",

1288 "type": {

1289 "kind": "HttpTypeString"

1290 },

1291 "optional": false,

1292 "nullable": false,

1293 "schemaType": "string",

1294 "children": []

1295 },

1296 "(resource) realtime > (model) realtime_translation_input_transcript_delta_event > (schema) > (property) event_id": {

1297 "kind": "HttpDeclProperty",

1298 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta/properties/event_id",

1299 "deprecated": false,

1300 "key": "event_id",

1301 "docstring": "The unique ID of the server event.",

1302 "type": {

1303 "kind": "HttpTypeString"

1304 },

1305 "optional": false,

1306 "nullable": false,

1307 "schemaType": "string",

1308 "children": []

1309 },

1310 "(resource) realtime > (model) realtime_translation_input_transcript_delta_event > (schema) > (property) type": {

1311 "kind": "HttpDeclProperty",

1312 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta/properties/type",

1313 "deprecated": false,

1314 "key": "type",

1315 "docstring": "The event type, must be `session.input_transcript.delta`.",

1316 "type": {

1317 "kind": "HttpTypeUnion",

1318 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta/properties/type",

1319 "types": [

1320 {

1321 "kind": "HttpTypeLiteral",

1322 "literal": "session.input_transcript.delta"

1323 }

1324 ]

1325 },

1326 "optional": false,

1327 "nullable": false,

1328 "schemaType": "enum",

1329 "childrenParentSchema": "enum",

1330 "children": [

1331 "(resource) realtime > (model) realtime_translation_input_transcript_delta_event > (schema) > (property) type > (member) 0"

1332 ]

1333 },

1334 "(resource) realtime > (model) realtime_translation_input_transcript_delta_event > (schema) > (property) elapsed_ms": {

1335 "kind": "HttpDeclProperty",

1336 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta/properties/elapsed_ms",

1337 "deprecated": false,

1338 "key": "elapsed_ms",

1339 "docstring": "Timing metadata for stream alignment, derived from the translation frame\nwhen available. It advances in 200 ms increments, but multiple transcript\ndeltas may share the same `elapsed_ms`. Treat it as alignment metadata,\nnot a unique transcript-delta identifier.\n",

1340 "type": {

1341 "kind": "HttpTypeNumber"

1342 },

1343 "optional": true,

1344 "nullable": true,

1345 "schemaType": "integer",

1346 "children": []

1347 },

1348 "(resource) realtime > (model) realtime_translation_input_transcript_delta_event > (schema) > (property) type > (member) 0": {

1349 "kind": "HttpDeclReference",

1350 "type": {

1351 "kind": "HttpTypeLiteral",

1352 "literal": "session.input_transcript.delta"

1353 }

1354 }

1355}

1356```

1357 347 

1358### Example348### Example

1359 349 


1366}356}

1367```357```

1368 358 

359<a id="session.output_transcript.delta"></a>

360 

1369## session.output_transcript.delta361## session.output_transcript.delta

1370 362 

1371Returned when translated transcript text is available.363Returned when translated transcript text is available.


1377 369 

1378Schema name: `RealtimeTranslationServerEventSessionOutputTranscriptDelta`370Schema name: `RealtimeTranslationServerEventSessionOutputTranscriptDelta`

1379 371 

1380```json372- `delta: string`

1381{373 

1382 "(resource) realtime > (model) realtime_translation_output_transcript_delta_event > (schema)": {374 Append-only transcript text for the translated output audio.

1383 "kind": "HttpDeclTypeAlias",375 

1384 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta",376- `event_id: string`

1385 "docstring": "Returned when translated transcript text is available.\n\nTranscript deltas are append-only text fragments. Clients should not insert\nunconditional spaces between deltas.\n",377 

1386 "ident": "RealtimeTranslationOutputTranscriptDeltaEvent",378 The unique ID of the server event.

1387 "type": {379 

1388 "kind": "HttpTypeObject",380- `type: "session.output_transcript.delta"`

1389 "members": [381 

1390 {382 The event type, must be `session.output_transcript.delta`.

1391 "ident": "delta"383 

1392 },384 - `"session.output_transcript.delta"`

1393 {385 

1394 "ident": "event_id"386- `elapsed_ms: optional number or null`

1395 },387 

1396 {388 Timing metadata for stream alignment, derived from the translation frame

1397 "ident": "type"389 when available. It advances in 200 ms increments, but multiple transcript

1398 },390 deltas may share the same `elapsed_ms`. Treat it as alignment metadata,

1399 {391 not a unique transcript-delta identifier.

1400 "ident": "elapsed_ms"

1401 }

1402 ]

1403 },

1404 "childrenParentSchema": "object",

1405 "children": [

1406 "(resource) realtime > (model) realtime_translation_output_transcript_delta_event > (schema) > (property) delta",

1407 "(resource) realtime > (model) realtime_translation_output_transcript_delta_event > (schema) > (property) event_id",

1408 "(resource) realtime > (model) realtime_translation_output_transcript_delta_event > (schema) > (property) type",

1409 "(resource) realtime > (model) realtime_translation_output_transcript_delta_event > (schema) > (property) elapsed_ms"

1410 ]

1411 },

1412 "(resource) realtime > (model) realtime_translation_output_transcript_delta_event > (schema) > (property) delta": {

1413 "kind": "HttpDeclProperty",

1414 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta/properties/delta",

1415 "deprecated": false,

1416 "key": "delta",

1417 "docstring": "Append-only transcript text for the translated output audio.",

1418 "type": {

1419 "kind": "HttpTypeString"

1420 },

1421 "optional": false,

1422 "nullable": false,

1423 "schemaType": "string",

1424 "children": []

1425 },

1426 "(resource) realtime > (model) realtime_translation_output_transcript_delta_event > (schema) > (property) event_id": {

1427 "kind": "HttpDeclProperty",

1428 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta/properties/event_id",

1429 "deprecated": false,

1430 "key": "event_id",

1431 "docstring": "The unique ID of the server event.",

1432 "type": {

1433 "kind": "HttpTypeString"

1434 },

1435 "optional": false,

1436 "nullable": false,

1437 "schemaType": "string",

1438 "children": []

1439 },

1440 "(resource) realtime > (model) realtime_translation_output_transcript_delta_event > (schema) > (property) type": {

1441 "kind": "HttpDeclProperty",

1442 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta/properties/type",

1443 "deprecated": false,

1444 "key": "type",

1445 "docstring": "The event type, must be `session.output_transcript.delta`.",

1446 "type": {

1447 "kind": "HttpTypeUnion",

1448 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta/properties/type",

1449 "types": [

1450 {

1451 "kind": "HttpTypeLiteral",

1452 "literal": "session.output_transcript.delta"

1453 }

1454 ]

1455 },

1456 "optional": false,

1457 "nullable": false,

1458 "schemaType": "enum",

1459 "childrenParentSchema": "enum",

1460 "children": [

1461 "(resource) realtime > (model) realtime_translation_output_transcript_delta_event > (schema) > (property) type > (member) 0"

1462 ]

1463 },

1464 "(resource) realtime > (model) realtime_translation_output_transcript_delta_event > (schema) > (property) elapsed_ms": {

1465 "kind": "HttpDeclProperty",

1466 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta/properties/elapsed_ms",

1467 "deprecated": false,

1468 "key": "elapsed_ms",

1469 "docstring": "Timing metadata for stream alignment, derived from the translation frame\nwhen available. It advances in 200 ms increments, but multiple transcript\ndeltas may share the same `elapsed_ms`. Treat it as alignment metadata,\nnot a unique transcript-delta identifier.\n",

1470 "type": {

1471 "kind": "HttpTypeNumber"

1472 },

1473 "optional": true,

1474 "nullable": true,

1475 "schemaType": "integer",

1476 "children": []

1477 },

1478 "(resource) realtime > (model) realtime_translation_output_transcript_delta_event > (schema) > (property) type > (member) 0": {

1479 "kind": "HttpDeclReference",

1480 "type": {

1481 "kind": "HttpTypeLiteral",

1482 "literal": "session.output_transcript.delta"

1483 }

1484 }

1485}

1486```

1487 392 

1488### Example393### Example

1489 394 


1496}401}

1497```402```

1498 403 

404<a id="session.output_audio.delta"></a>

405 

1499## session.output_audio.delta406## session.output_audio.delta

1500 407 

1501Returned when translated output audio is available. The `delta` contains a408Returned when translated output audio is available. The `delta` contains a


1506 413 

1507Schema name: `RealtimeTranslationServerEventSessionOutputAudioDelta`414Schema name: `RealtimeTranslationServerEventSessionOutputAudioDelta`

1508 415 

1509```json416- `delta: string`

1510{417 

1511 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema)": {418 Base64-encoded translated audio data.

1512 "kind": "HttpDeclTypeAlias",419 

1513 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta",420- `event_id: string`

1514 "docstring": "Returned when translated output audio is available. The `delta` contains a\nPCM16 audio chunk whose length can vary. Clients should decode and queue the\ncomplete delta instead of assuming a fixed byte or sample count.\n",421 

1515 "ident": "RealtimeTranslationOutputAudioDeltaEvent",422 The unique ID of the server event.

1516 "type": {423 

1517 "kind": "HttpTypeObject",424- `type: "session.output_audio.delta"`

1518 "members": [425 

1519 {426 The event type, must be `session.output_audio.delta`.

1520 "ident": "delta"427 

1521 },428 - `"session.output_audio.delta"`

1522 {429 

1523 "ident": "event_id"430- `channels: optional number`

1524 },431 

1525 {432 Number of audio channels.

1526 "ident": "type"433 

1527 },434- `elapsed_ms: optional number or null`

1528 {435 

1529 "ident": "channels"436 Timing metadata for stream alignment, derived from the translation frame

1530 },437 when available. Treat `elapsed_ms` as alignment metadata, not a unique

1531 {438 event identifier.

1532 "ident": "elapsed_ms"439 

1533 },440- `format: optional "pcm16"`

1534 {441 

1535 "ident": "format"442 Audio encoding for `delta`.

1536 },443 

1537 {444 - `"pcm16"`

1538 "ident": "sample_rate"445 

1539 }446- `sample_rate: optional number`

1540 ]447 

1541 },448 Sample rate of the audio delta.

1542 "childrenParentSchema": "object",

1543 "children": [

1544 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) delta",

1545 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) event_id",

1546 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) type",

1547 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) channels",

1548 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) elapsed_ms",

1549 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) format",

1550 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) sample_rate"

1551 ]

1552 },

1553 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) delta": {

1554 "kind": "HttpDeclProperty",

1555 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta/properties/delta",

1556 "deprecated": false,

1557 "key": "delta",

1558 "docstring": "Base64-encoded translated audio data.",

1559 "type": {

1560 "kind": "HttpTypeString"

1561 },

1562 "optional": false,

1563 "nullable": false,

1564 "schemaType": "string",

1565 "children": []

1566 },

1567 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) event_id": {

1568 "kind": "HttpDeclProperty",

1569 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta/properties/event_id",

1570 "deprecated": false,

1571 "key": "event_id",

1572 "docstring": "The unique ID of the server event.",

1573 "type": {

1574 "kind": "HttpTypeString"

1575 },

1576 "optional": false,

1577 "nullable": false,

1578 "schemaType": "string",

1579 "children": []

1580 },

1581 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) type": {

1582 "kind": "HttpDeclProperty",

1583 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta/properties/type",

1584 "deprecated": false,

1585 "key": "type",

1586 "docstring": "The event type, must be `session.output_audio.delta`.",

1587 "type": {

1588 "kind": "HttpTypeUnion",

1589 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta/properties/type",

1590 "types": [

1591 {

1592 "kind": "HttpTypeLiteral",

1593 "literal": "session.output_audio.delta"

1594 }

1595 ]

1596 },

1597 "optional": false,

1598 "nullable": false,

1599 "schemaType": "enum",

1600 "childrenParentSchema": "enum",

1601 "children": [

1602 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) type > (member) 0"

1603 ]

1604 },

1605 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) channels": {

1606 "kind": "HttpDeclProperty",

1607 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta/properties/channels",

1608 "deprecated": false,

1609 "key": "channels",

1610 "docstring": "Number of audio channels.",

1611 "type": {

1612 "kind": "HttpTypeNumber"

1613 },

1614 "default": 1,

1615 "optional": true,

1616 "nullable": false,

1617 "schemaType": "integer",

1618 "children": []

1619 },

1620 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) elapsed_ms": {

1621 "kind": "HttpDeclProperty",

1622 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta/properties/elapsed_ms",

1623 "deprecated": false,

1624 "key": "elapsed_ms",

1625 "docstring": "Timing metadata for stream alignment, derived from the translation frame\nwhen available. Treat `elapsed_ms` as alignment metadata, not a unique\nevent identifier.\n",

1626 "type": {

1627 "kind": "HttpTypeNumber"

1628 },

1629 "optional": true,

1630 "nullable": true,

1631 "schemaType": "integer",

1632 "children": []

1633 },

1634 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) format": {

1635 "kind": "HttpDeclProperty",

1636 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta/properties/format",

1637 "deprecated": false,

1638 "key": "format",

1639 "docstring": "Audio encoding for `delta`.",

1640 "type": {

1641 "kind": "HttpTypeUnion",

1642 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta/properties/format",

1643 "types": [

1644 {

1645 "kind": "HttpTypeLiteral",

1646 "literal": "pcm16"

1647 }

1648 ]

1649 },

1650 "optional": true,

1651 "nullable": false,

1652 "schemaType": "enum",

1653 "childrenParentSchema": "enum",

1654 "children": [

1655 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) format > (member) 0"

1656 ]

1657 },

1658 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) sample_rate": {

1659 "kind": "HttpDeclProperty",

1660 "oasRef": "#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta/properties/sample_rate",

1661 "deprecated": false,

1662 "key": "sample_rate",

1663 "docstring": "Sample rate of the audio delta.",

1664 "type": {

1665 "kind": "HttpTypeNumber"

1666 },

1667 "default": 24000,

1668 "optional": true,

1669 "nullable": false,

1670 "schemaType": "integer",

1671 "children": []

1672 },

1673 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) type > (member) 0": {

1674 "kind": "HttpDeclReference",

1675 "type": {

1676 "kind": "HttpTypeLiteral",

1677 "literal": "session.output_audio.delta"

1678 }

1679 },

1680 "(resource) realtime > (model) realtime_translation_output_audio_delta_event > (schema) > (property) format > (member) 0": {

1681 "kind": "HttpDeclReference",

1682 "type": {

1683 "kind": "HttpTypeLiteral",

1684 "literal": "pcm16"

1685 }

1686 }

1687}

1688```

1689 449 

1690### Example450### Example

1691 451 

Details

1## Update Skill Default Version

2 

3**post** `/skills/{skill_id}`

4 

5Update the default version pointer for a skill.

6 

7### Path Parameters

8 

9- `skill_id: string`

10 

11### Body Parameters

12 

13- `default_version: string`

14 

15 The skill version number to set as default.

16 

17### Returns

18 

19- `Skill object { id, created_at, default_version, 4 more }`

20 

21 - `id: string`

22 

23 Unique identifier for the skill.

24 

25 - `created_at: number`

26 

27 Unix timestamp (seconds) for when the skill was created.

28 

29 - `default_version: string`

30 

31 Default version for the skill.

32 

33 - `description: string`

34 

35 Description of the skill.

36 

37 - `latest_version: string`

38 

39 Latest version for the skill.

40 

41 - `name: string`

42 

43 Name of the skill.

44 

45 - `object: "skill"`

46 

47 The object type, which is `skill`.

48 

49 - `"skill"`

50 

51### Example

52 

53```http

54curl https://api.openai.com/v1/skills/$SKILL_ID \

55 -H 'Content-Type: application/json' \

56 -H "Authorization: Bearer $OPENAI_API_KEY" \

57 -d '{

58 "default_version": "default_version"

59 }'

60```

61 

62#### Response

63 

64```json

65{

66 "id": "id",

67 "created_at": 0,

68 "default_version": "default_version",

69 "description": "description",

70 "latest_version": "latest_version",

71 "name": "name",

72 "object": "skill"

73}

74```

Details

1## Get Skill Version

2 

3**get** `/skills/{skill_id}/versions/{version}`

4 

5Get a specific skill version.

6 

7### Path Parameters

8 

9- `skill_id: string`

10 

11- `version: string`

12 

13 The version number to retrieve.

14 

15### Returns

16 

17- `SkillVersion object { id, created_at, description, 4 more }`

18 

19 - `id: string`

20 

21 Unique identifier for the skill version.

22 

23 - `created_at: number`

24 

25 Unix timestamp (seconds) for when the version was created.

26 

27 - `description: string`

28 

29 Description of the skill version.

30 

31 - `name: string`

32 

33 Name of the skill version.

34 

35 - `object: "skill.version"`

36 

37 The object type, which is `skill.version`.

38 

39 - `"skill.version"`

40 

41 - `skill_id: string`

42 

43 Identifier of the skill for this version.

44 

45 - `version: string`

46 

47 Version number for this skill.

48 

49### Example

50 

51```http

52curl https://api.openai.com/v1/skills/$SKILL_ID/versions/$VERSION \

53 -H "Authorization: Bearer $OPENAI_API_KEY"

54```

55 

56#### Response

57 

58```json

59{

60 "id": "id",

61 "created_at": 0,

62 "description": "description",

63 "name": "name",

64 "object": "skill.version",

65 "skill_id": "skill_id",

66 "version": "version"

67}

68```

Details

98 "issued_token_type": "urn:ietf:params:oauth:token-type:access_token",98 "issued_token_type": "urn:ietf:params:oauth:token-type:access_token",

99 "token_type": "Bearer",99 "token_type": "Bearer",

100 "expires_in": 3600,100 "expires_in": 3600,

101 "expires_at": 1789045200,

101 "scope": "api.model.read api.model.request"102 "scope": "api.model.read api.model.request"

102}103}

103```104```

104 105 

106The response includes these expiration fields for both JWT and X.509 exchanges:

107 

108| Field | Type | Description |

109| ------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |

110| `expires_in` | Integer | Access-token lifetime in seconds, measured from issuance (`iat`). Time spent processing or delivering the response consumes part of this lifetime. |

111| `expires_at` | Integer | Absolute expiration as a Unix timestamp in seconds since January 1, 1970, at 00:00:00 UTC. Equals the issued access token's `exp` claim. |

112 

105The `scope` property is returned only when the resolved mapping has permissions. Access tokens expire after at most one hour. A JWT exchange token never outlives its external subject token, and an X.509 exchange token never outlives the verified client certificate. Token exchange doesn't return a refresh token.113The `scope` property is returned only when the resolved mapping has permissions. Access tokens expire after at most one hour. A JWT exchange token never outlives its external subject token, and an X.509 exchange token never outlives the verified client certificate. Token exchange doesn't return a refresh token.

106 114 

107The `expires_in` value of `3600` in the example is illustrative. The returned lifetime can be shorter when the verified client certificate expires sooner.115The expiration values in the example are illustrative. The returned lifetime can be shorter when the external subject token or verified client certificate expires sooner. For scheduling another exchange, see [token renewal guidance](https://developers.openai.com/api/docs/guides/workload-identity-federation#renew-the-access-token).

108 116 

109## Token exchange errors117## Token exchange errors

110 118