ogx-client 0.8.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/.github/workflows/release-doctor.yml +0 -2
  2. package/.release-please-manifest.json +1 -1
  3. package/.stats.yml +4 -4
  4. package/CHANGELOG.md +27 -0
  5. package/CONTRIBUTING.md +0 -14
  6. package/README.md +5 -4
  7. package/api.md +26 -48
  8. package/bin/check-release-environment +0 -4
  9. package/dist/CHANGELOG.md +27 -0
  10. package/dist/README.md +5 -4
  11. package/dist/index.d.mts +2 -18
  12. package/dist/index.d.ts +2 -18
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +0 -15
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +1 -16
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/package.json +1 -1
  19. package/dist/resources/chat/chat.d.ts +2 -2
  20. package/dist/resources/chat/chat.d.ts.map +1 -1
  21. package/dist/resources/chat/chat.js +2 -2
  22. package/dist/resources/chat/chat.js.map +1 -1
  23. package/dist/resources/chat/chat.mjs +2 -2
  24. package/dist/resources/chat/completions/completions.d.ts +2021 -0
  25. package/dist/resources/chat/completions/completions.d.ts.map +1 -0
  26. package/dist/resources/chat/completions/completions.js +70 -0
  27. package/dist/resources/chat/completions/completions.js.map +1 -0
  28. package/dist/resources/chat/completions/completions.mjs +43 -0
  29. package/dist/resources/chat/completions/completions.mjs.map +1 -0
  30. package/dist/resources/chat/completions/index.d.ts +3 -0
  31. package/dist/resources/chat/completions/index.d.ts.map +1 -0
  32. package/dist/resources/chat/completions/index.js +16 -0
  33. package/dist/resources/chat/completions/index.js.map +1 -0
  34. package/dist/resources/chat/completions/index.mjs +10 -0
  35. package/dist/resources/chat/completions/index.mjs.map +1 -0
  36. package/dist/resources/chat/completions/messages.d.ts +204 -0
  37. package/dist/resources/chat/completions/messages.d.ts.map +1 -0
  38. package/dist/resources/chat/completions/messages.js +35 -0
  39. package/dist/resources/chat/completions/messages.js.map +1 -0
  40. package/dist/resources/chat/completions/messages.mjs +30 -0
  41. package/dist/resources/chat/completions/messages.mjs.map +1 -0
  42. package/dist/resources/chat/completions.d.ts +1 -2020
  43. package/dist/resources/chat/completions.d.ts.map +1 -1
  44. package/dist/resources/chat/completions.js +15 -29
  45. package/dist/resources/chat/completions.js.map +1 -1
  46. package/dist/resources/chat/completions.mjs +1 -27
  47. package/dist/resources/chat/completions.mjs.map +1 -1
  48. package/dist/resources/chat/index.d.ts +1 -1
  49. package/dist/resources/chat/index.d.ts.map +1 -1
  50. package/dist/resources/chat/index.js +2 -2
  51. package/dist/resources/chat/index.js.map +1 -1
  52. package/dist/resources/chat/index.mjs +1 -1
  53. package/dist/resources/completions.d.ts +2 -2
  54. package/dist/resources/completions.d.ts.map +1 -1
  55. package/dist/resources/conversations/conversations.d.ts +12 -11
  56. package/dist/resources/conversations/conversations.d.ts.map +1 -1
  57. package/dist/resources/conversations/conversations.js.map +1 -1
  58. package/dist/resources/conversations/conversations.mjs.map +1 -1
  59. package/dist/resources/conversations/index.d.ts +1 -1
  60. package/dist/resources/conversations/index.d.ts.map +1 -1
  61. package/dist/resources/conversations/items.d.ts +49 -29
  62. package/dist/resources/conversations/items.d.ts.map +1 -1
  63. package/dist/resources/conversations/items.js +5 -5
  64. package/dist/resources/conversations/items.js.map +1 -1
  65. package/dist/resources/conversations/items.mjs +5 -5
  66. package/dist/resources/conversations/items.mjs.map +1 -1
  67. package/dist/resources/files.d.ts +10 -10
  68. package/dist/resources/files.d.ts.map +1 -1
  69. package/dist/resources/files.js.map +1 -1
  70. package/dist/resources/files.mjs.map +1 -1
  71. package/dist/resources/index.d.ts +1 -4
  72. package/dist/resources/index.d.ts.map +1 -1
  73. package/dist/resources/index.js +1 -7
  74. package/dist/resources/index.js.map +1 -1
  75. package/dist/resources/index.mjs +1 -4
  76. package/dist/resources/index.mjs.map +1 -1
  77. package/dist/resources/models/index.d.ts +2 -2
  78. package/dist/resources/models/index.d.ts.map +1 -1
  79. package/dist/resources/models/index.js.map +1 -1
  80. package/dist/resources/models/index.mjs +1 -1
  81. package/dist/resources/models/index.mjs.map +1 -1
  82. package/dist/resources/models/models.d.ts +220 -32
  83. package/dist/resources/models/models.d.ts.map +1 -1
  84. package/dist/resources/models/models.js +32 -10
  85. package/dist/resources/models/models.js.map +1 -1
  86. package/dist/resources/models/models.mjs +32 -10
  87. package/dist/resources/models/models.mjs.map +1 -1
  88. package/dist/resources/models/openai.d.ts +128 -2
  89. package/dist/resources/models/openai.d.ts.map +1 -1
  90. package/dist/resources/models/openai.js +17 -5
  91. package/dist/resources/models/openai.js.map +1 -1
  92. package/dist/resources/models/openai.mjs +17 -5
  93. package/dist/resources/models/openai.mjs.map +1 -1
  94. package/dist/resources/responses/responses.d.ts +0 -16
  95. package/dist/resources/responses/responses.d.ts.map +1 -1
  96. package/dist/resources/responses/responses.js.map +1 -1
  97. package/dist/resources/responses/responses.mjs.map +1 -1
  98. package/dist/resources/shared.d.ts +0 -19
  99. package/dist/resources/shared.d.ts.map +1 -1
  100. package/dist/src/index.ts +12 -43
  101. package/dist/src/resources/chat/chat.ts +2 -2
  102. package/dist/src/resources/chat/completions/completions.ts +2444 -0
  103. package/dist/src/resources/chat/completions/index.ts +24 -0
  104. package/dist/src/resources/chat/completions/messages.ts +273 -0
  105. package/dist/src/resources/chat/completions.ts +1 -2422
  106. package/dist/src/resources/chat/index.ts +1 -1
  107. package/dist/src/resources/completions.ts +2 -2
  108. package/dist/src/resources/conversations/conversations.ts +15 -9
  109. package/dist/src/resources/conversations/index.ts +1 -1
  110. package/dist/src/resources/conversations/items.ts +84 -28
  111. package/dist/src/resources/files.ts +29 -10
  112. package/dist/src/resources/index.ts +9 -10
  113. package/dist/src/resources/models/index.ts +10 -2
  114. package/dist/src/resources/models/models.ts +321 -32
  115. package/dist/src/resources/models/openai.ts +180 -3
  116. package/dist/src/resources/responses/responses.ts +0 -21
  117. package/dist/src/resources/shared.ts +0 -20
  118. package/dist/src/version.ts +1 -1
  119. package/dist/version.d.ts +1 -1
  120. package/dist/version.js +1 -1
  121. package/dist/version.mjs +1 -1
  122. package/package.json +1 -1
  123. package/src/index.ts +12 -43
  124. package/src/resources/chat/chat.ts +2 -2
  125. package/src/resources/chat/completions/completions.ts +2444 -0
  126. package/src/resources/chat/completions/index.ts +24 -0
  127. package/src/resources/chat/completions/messages.ts +273 -0
  128. package/src/resources/chat/completions.ts +1 -2422
  129. package/src/resources/chat/index.ts +1 -1
  130. package/src/resources/completions.ts +2 -2
  131. package/src/resources/conversations/conversations.ts +15 -9
  132. package/src/resources/conversations/index.ts +1 -1
  133. package/src/resources/conversations/items.ts +84 -28
  134. package/src/resources/files.ts +29 -10
  135. package/src/resources/index.ts +9 -10
  136. package/src/resources/models/index.ts +10 -2
  137. package/src/resources/models/models.ts +321 -32
  138. package/src/resources/models/openai.ts +180 -3
  139. package/src/resources/responses/responses.ts +0 -21
  140. package/src/resources/shared.ts +0 -20
  141. package/src/version.ts +1 -1
  142. package/tests/api-resources/chat/{completions.test.ts → completions/completions.test.ts} +0 -1
  143. package/tests/api-resources/chat/completions/messages.test.ts +47 -0
  144. package/tests/api-resources/completions.test.ts +1 -1
  145. package/tests/api-resources/conversations/items.test.ts +12 -0
  146. package/tests/api-resources/models/models.test.ts +34 -0
  147. package/tests/api-resources/models/openai.test.ts +18 -0
  148. package/tests/api-resources/responses/responses.test.ts +0 -2
  149. package/.github/workflows/publish-npm.yml +0 -32
  150. package/dist/resources/moderations.d.ts +0 -83
  151. package/dist/resources/moderations.d.ts.map +0 -1
  152. package/dist/resources/moderations.js +0 -24
  153. package/dist/resources/moderations.js.map +0 -1
  154. package/dist/resources/moderations.mjs +0 -20
  155. package/dist/resources/moderations.mjs.map +0 -1
  156. package/dist/resources/safety.d.ts +0 -297
  157. package/dist/resources/safety.d.ts.map +0 -1
  158. package/dist/resources/safety.js +0 -24
  159. package/dist/resources/safety.js.map +0 -1
  160. package/dist/resources/safety.mjs +0 -20
  161. package/dist/resources/safety.mjs.map +0 -1
  162. package/dist/resources/shields.d.ts +0 -82
  163. package/dist/resources/shields.d.ts.map +0 -1
  164. package/dist/resources/shields.js +0 -46
  165. package/dist/resources/shields.js.map +0 -1
  166. package/dist/resources/shields.mjs +0 -42
  167. package/dist/resources/shields.mjs.map +0 -1
  168. package/dist/src/resources/moderations.ts +0 -97
  169. package/dist/src/resources/safety.ts +0 -367
  170. package/dist/src/resources/shields.ts +0 -119
  171. package/src/resources/moderations.ts +0 -97
  172. package/src/resources/safety.ts +0 -367
  173. package/src/resources/shields.ts +0 -119
  174. package/tests/api-resources/moderations.test.ts +0 -29
  175. package/tests/api-resources/safety.test.ts +0 -41
  176. package/tests/api-resources/shields.test.ts +0 -88
@@ -1,2021 +1,2 @@
1
- import { APIResource } from "../../resource.js";
2
- import { APIPromise } from "../../core.js";
3
- import * as Core from "../../core.js";
4
- import * as CompletionsAPI from "./completions.js";
5
- import * as ChatAPI from "./chat.js";
6
- import { Stream } from "../../streaming.js";
7
- /**
8
- * OGX Inference API for generating completions, chat completions, and embeddings.
9
- *
10
- * This API provides the raw interface to the underlying models. Three kinds of models are supported:
11
- * - LLM models: these models generate "raw" and "chat" (conversational) completions.
12
- * - Embedding models: these models generate embeddings to be used for semantic search.
13
- * - Rerank models: these models reorder the documents based on their relevance to a query.
14
- */
15
- export declare class Completions extends APIResource {
16
- /**
17
- * Generate an OpenAI-compatible chat completion for the given messages using the
18
- * specified model.
19
- */
20
- create(body: CompletionCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<CompletionCreateResponse>;
21
- create(body: CompletionCreateParamsStreaming, options?: Core.RequestOptions): APIPromise<Stream<ChatAPI.ChatCompletionChunk>>;
22
- create(body: CompletionCreateParamsBase, options?: Core.RequestOptions): APIPromise<Stream<ChatAPI.ChatCompletionChunk> | CompletionCreateResponse>;
23
- /**
24
- * Describe a chat completion by its ID.
25
- */
26
- retrieve(completionId: string, options?: Core.RequestOptions): Core.APIPromise<CompletionRetrieveResponse>;
27
- /**
28
- * List chat completions.
29
- */
30
- list(query?: CompletionListParams, options?: Core.RequestOptions): Core.APIPromise<CompletionListResponse>;
31
- list(options?: Core.RequestOptions): Core.APIPromise<CompletionListResponse>;
32
- }
33
- /**
34
- * Response from an OpenAI-compatible chat completion request.
35
- */
36
- export interface CompletionCreateResponse {
37
- /**
38
- * The ID of the chat completion.
39
- */
40
- id: string;
41
- /**
42
- * List of choices.
43
- */
44
- choices: Array<CompletionCreateResponse.Choice>;
45
- /**
46
- * The Unix timestamp in seconds when the chat completion was created.
47
- */
48
- created: number;
49
- /**
50
- * The model that was used to generate the chat completion.
51
- */
52
- model: string;
53
- /**
54
- * The object type.
55
- */
56
- object?: 'chat.completion';
57
- /**
58
- * The service tier that was used for this response.
59
- */
60
- service_tier?: string | null;
61
- /**
62
- * System fingerprint for this completion.
63
- */
64
- system_fingerprint?: string | null;
65
- /**
66
- * Token usage information for the completion.
67
- */
68
- usage?: CompletionCreateResponse.Usage | null;
69
- }
70
- export declare namespace CompletionCreateResponse {
71
- /**
72
- * A choice from an OpenAI-compatible chat completion response.
73
- */
74
- interface Choice {
75
- /**
76
- * The reason the model stopped generating.
77
- */
78
- finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call';
79
- /**
80
- * The index of the choice.
81
- */
82
- index: number;
83
- /**
84
- * The message from the model.
85
- */
86
- message: Choice.Message;
87
- /**
88
- * The log probabilities for the tokens in the message.
89
- */
90
- logprobs?: Choice.Logprobs | null;
91
- }
92
- namespace Choice {
93
- /**
94
- * The message from the model.
95
- */
96
- interface Message {
97
- /**
98
- * Annotations for the message, when applicable.
99
- */
100
- annotations?: Array<{
101
- [key: string]: unknown;
102
- }>;
103
- /**
104
- * Audio response data when using audio output modality.
105
- */
106
- audio?: {
107
- [key: string]: unknown;
108
- } | null;
109
- /**
110
- * The content of the message.
111
- */
112
- content?: string | null;
113
- /**
114
- * Deprecated: the name and arguments of a function that should be called.
115
- */
116
- function_call?: Message.FunctionCall;
117
- /**
118
- * The refusal message generated by the model.
119
- */
120
- refusal?: string | null;
121
- /**
122
- * The role of the message author, always 'assistant' in responses.
123
- */
124
- role?: 'assistant';
125
- /**
126
- * The tool calls generated by the model.
127
- */
128
- tool_calls?: Array<Message.Function | Message.Custom>;
129
- }
130
- namespace Message {
131
- /**
132
- * Deprecated: the name and arguments of a function that should be called.
133
- */
134
- interface FunctionCall {
135
- /**
136
- * Arguments to pass to the function as a JSON string.
137
- */
138
- arguments: string;
139
- /**
140
- * Name of the function to call.
141
- */
142
- name: string;
143
- }
144
- /**
145
- * Tool call specification for OpenAI-compatible chat completion responses.
146
- */
147
- interface Function {
148
- /**
149
- * Unique identifier for the tool call.
150
- */
151
- id: string;
152
- /**
153
- * Function call details.
154
- */
155
- function: Function.Function;
156
- /**
157
- * Must be 'function' to identify this as a function call.
158
- */
159
- type: 'function';
160
- }
161
- namespace Function {
162
- /**
163
- * Function call details.
164
- */
165
- interface Function {
166
- /**
167
- * Arguments to pass to the function as a JSON string.
168
- */
169
- arguments: string;
170
- /**
171
- * Name of the function to call.
172
- */
173
- name: string;
174
- }
175
- }
176
- /**
177
- * A call to a custom tool created by the model.
178
- */
179
- interface Custom {
180
- /**
181
- * The ID of the tool call.
182
- */
183
- id: string;
184
- /**
185
- * The custom tool that the model called.
186
- */
187
- custom: Custom.Custom;
188
- /**
189
- * The type of the tool. Always 'custom'.
190
- */
191
- type: 'custom';
192
- }
193
- namespace Custom {
194
- /**
195
- * The custom tool that the model called.
196
- */
197
- interface Custom {
198
- /**
199
- * The input for the custom tool call generated by the model.
200
- */
201
- input: string;
202
- /**
203
- * The name of the custom tool to call.
204
- */
205
- name: string;
206
- }
207
- }
208
- }
209
- /**
210
- * The log probabilities for the tokens in the message.
211
- */
212
- interface Logprobs {
213
- /**
214
- * The log probabilities for the tokens in the message.
215
- */
216
- content?: Array<Logprobs.Content> | null;
217
- /**
218
- * The log probabilities for the refusal tokens.
219
- */
220
- refusal?: Array<Logprobs.Refusal> | null;
221
- }
222
- namespace Logprobs {
223
- /**
224
- * The log probability for a token from an OpenAI-compatible chat completion
225
- * response.
226
- */
227
- interface Content {
228
- /**
229
- * The token.
230
- */
231
- token: string;
232
- /**
233
- * The log probability of the token.
234
- */
235
- logprob: number;
236
- /**
237
- * The bytes for the token.
238
- */
239
- bytes?: Array<number> | null;
240
- /**
241
- * The top log probabilities for the token.
242
- */
243
- top_logprobs?: Array<Content.TopLogprob> | null;
244
- }
245
- namespace Content {
246
- /**
247
- * The top log probability for a token from an OpenAI-compatible chat completion
248
- * response.
249
- */
250
- interface TopLogprob {
251
- /**
252
- * The token.
253
- */
254
- token: string;
255
- /**
256
- * The log probability of the token.
257
- */
258
- logprob: number;
259
- /**
260
- * The bytes for the token.
261
- */
262
- bytes?: Array<number> | null;
263
- }
264
- }
265
- /**
266
- * The log probability for a token from an OpenAI-compatible chat completion
267
- * response.
268
- */
269
- interface Refusal {
270
- /**
271
- * The token.
272
- */
273
- token: string;
274
- /**
275
- * The log probability of the token.
276
- */
277
- logprob: number;
278
- /**
279
- * The bytes for the token.
280
- */
281
- bytes?: Array<number> | null;
282
- /**
283
- * The top log probabilities for the token.
284
- */
285
- top_logprobs?: Array<Refusal.TopLogprob> | null;
286
- }
287
- namespace Refusal {
288
- /**
289
- * The top log probability for a token from an OpenAI-compatible chat completion
290
- * response.
291
- */
292
- interface TopLogprob {
293
- /**
294
- * The token.
295
- */
296
- token: string;
297
- /**
298
- * The log probability of the token.
299
- */
300
- logprob: number;
301
- /**
302
- * The bytes for the token.
303
- */
304
- bytes?: Array<number> | null;
305
- }
306
- }
307
- }
308
- }
309
- /**
310
- * Token usage information for the completion.
311
- */
312
- interface Usage {
313
- /**
314
- * Number of tokens in the completion.
315
- */
316
- completion_tokens?: number;
317
- /**
318
- * Detailed breakdown of output token usage.
319
- */
320
- completion_tokens_details?: Usage.CompletionTokensDetails;
321
- /**
322
- * Number of tokens in the prompt.
323
- */
324
- prompt_tokens?: number;
325
- /**
326
- * Detailed breakdown of input token usage.
327
- */
328
- prompt_tokens_details?: Usage.PromptTokensDetails;
329
- /**
330
- * Total tokens used (prompt + completion).
331
- */
332
- total_tokens?: number;
333
- }
334
- namespace Usage {
335
- /**
336
- * Detailed breakdown of output token usage.
337
- */
338
- interface CompletionTokensDetails {
339
- /**
340
- * Number of tokens used for reasoning (o1/o3 models).
341
- */
342
- reasoning_tokens?: number;
343
- }
344
- /**
345
- * Detailed breakdown of input token usage.
346
- */
347
- interface PromptTokensDetails {
348
- /**
349
- * Number of tokens retrieved from cache.
350
- */
351
- cached_tokens?: number;
352
- }
353
- }
354
- }
355
- /**
356
- * Chat completion response extended with the original input messages.
357
- */
358
- export interface CompletionRetrieveResponse {
359
- /**
360
- * The ID of the chat completion.
361
- */
362
- id: string;
363
- /**
364
- * List of choices.
365
- */
366
- choices: Array<CompletionRetrieveResponse.Choice>;
367
- /**
368
- * The Unix timestamp in seconds when the chat completion was created.
369
- */
370
- created: number;
371
- /**
372
- * The input messages used to generate this completion.
373
- */
374
- input_messages: Array<CompletionRetrieveResponse.OpenAIUserMessageParamOutput | CompletionRetrieveResponse.OpenAISystemMessageParam | CompletionRetrieveResponse.OpenAIAssistantMessageParamOutput | CompletionRetrieveResponse.OpenAIToolMessageParam | CompletionRetrieveResponse.OpenAIDeveloperMessageParam>;
375
- /**
376
- * The model that was used to generate the chat completion.
377
- */
378
- model: string;
379
- /**
380
- * The object type.
381
- */
382
- object?: 'chat.completion';
383
- /**
384
- * The service tier that was used for this response.
385
- */
386
- service_tier?: string | null;
387
- /**
388
- * System fingerprint for this completion.
389
- */
390
- system_fingerprint?: string;
391
- /**
392
- * Token usage information for the completion.
393
- */
394
- usage?: CompletionRetrieveResponse.Usage;
395
- }
396
- export declare namespace CompletionRetrieveResponse {
397
- /**
398
- * A choice from an OpenAI-compatible chat completion response.
399
- */
400
- interface Choice {
401
- /**
402
- * The reason the model stopped generating.
403
- */
404
- finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call';
405
- /**
406
- * The index of the choice.
407
- */
408
- index: number;
409
- /**
410
- * The message from the model.
411
- */
412
- message: Choice.Message;
413
- /**
414
- * The log probabilities for the tokens in the message.
415
- */
416
- logprobs?: Choice.Logprobs | null;
417
- }
418
- namespace Choice {
419
- /**
420
- * The message from the model.
421
- */
422
- interface Message {
423
- /**
424
- * Annotations for the message, when applicable.
425
- */
426
- annotations?: Array<{
427
- [key: string]: unknown;
428
- }>;
429
- /**
430
- * Audio response data when using audio output modality.
431
- */
432
- audio?: {
433
- [key: string]: unknown;
434
- } | null;
435
- /**
436
- * The content of the message.
437
- */
438
- content?: string | null;
439
- /**
440
- * Deprecated: the name and arguments of a function that should be called.
441
- */
442
- function_call?: Message.FunctionCall;
443
- /**
444
- * The refusal message generated by the model.
445
- */
446
- refusal?: string | null;
447
- /**
448
- * The role of the message author, always 'assistant' in responses.
449
- */
450
- role?: 'assistant';
451
- /**
452
- * The tool calls generated by the model.
453
- */
454
- tool_calls?: Array<Message.Function | Message.Custom>;
455
- }
456
- namespace Message {
457
- /**
458
- * Deprecated: the name and arguments of a function that should be called.
459
- */
460
- interface FunctionCall {
461
- /**
462
- * Arguments to pass to the function as a JSON string.
463
- */
464
- arguments: string;
465
- /**
466
- * Name of the function to call.
467
- */
468
- name: string;
469
- }
470
- /**
471
- * Tool call specification for OpenAI-compatible chat completion responses.
472
- */
473
- interface Function {
474
- /**
475
- * Unique identifier for the tool call.
476
- */
477
- id: string;
478
- /**
479
- * Function call details.
480
- */
481
- function: Function.Function;
482
- /**
483
- * Must be 'function' to identify this as a function call.
484
- */
485
- type: 'function';
486
- }
487
- namespace Function {
488
- /**
489
- * Function call details.
490
- */
491
- interface Function {
492
- /**
493
- * Arguments to pass to the function as a JSON string.
494
- */
495
- arguments: string;
496
- /**
497
- * Name of the function to call.
498
- */
499
- name: string;
500
- }
501
- }
502
- /**
503
- * A call to a custom tool created by the model.
504
- */
505
- interface Custom {
506
- /**
507
- * The ID of the tool call.
508
- */
509
- id: string;
510
- /**
511
- * The custom tool that the model called.
512
- */
513
- custom: Custom.Custom;
514
- /**
515
- * The type of the tool. Always 'custom'.
516
- */
517
- type: 'custom';
518
- }
519
- namespace Custom {
520
- /**
521
- * The custom tool that the model called.
522
- */
523
- interface Custom {
524
- /**
525
- * The input for the custom tool call generated by the model.
526
- */
527
- input: string;
528
- /**
529
- * The name of the custom tool to call.
530
- */
531
- name: string;
532
- }
533
- }
534
- }
535
- /**
536
- * The log probabilities for the tokens in the message.
537
- */
538
- interface Logprobs {
539
- /**
540
- * The log probabilities for the tokens in the message.
541
- */
542
- content?: Array<Logprobs.Content> | null;
543
- /**
544
- * The log probabilities for the refusal tokens.
545
- */
546
- refusal?: Array<Logprobs.Refusal> | null;
547
- }
548
- namespace Logprobs {
549
- /**
550
- * The log probability for a token from an OpenAI-compatible chat completion
551
- * response.
552
- */
553
- interface Content {
554
- /**
555
- * The token.
556
- */
557
- token: string;
558
- /**
559
- * The log probability of the token.
560
- */
561
- logprob: number;
562
- /**
563
- * The bytes for the token.
564
- */
565
- bytes?: Array<number> | null;
566
- /**
567
- * The top log probabilities for the token.
568
- */
569
- top_logprobs?: Array<Content.TopLogprob> | null;
570
- }
571
- namespace Content {
572
- /**
573
- * The top log probability for a token from an OpenAI-compatible chat completion
574
- * response.
575
- */
576
- interface TopLogprob {
577
- /**
578
- * The token.
579
- */
580
- token: string;
581
- /**
582
- * The log probability of the token.
583
- */
584
- logprob: number;
585
- /**
586
- * The bytes for the token.
587
- */
588
- bytes?: Array<number> | null;
589
- }
590
- }
591
- /**
592
- * The log probability for a token from an OpenAI-compatible chat completion
593
- * response.
594
- */
595
- interface Refusal {
596
- /**
597
- * The token.
598
- */
599
- token: string;
600
- /**
601
- * The log probability of the token.
602
- */
603
- logprob: number;
604
- /**
605
- * The bytes for the token.
606
- */
607
- bytes?: Array<number> | null;
608
- /**
609
- * The top log probabilities for the token.
610
- */
611
- top_logprobs?: Array<Refusal.TopLogprob> | null;
612
- }
613
- namespace Refusal {
614
- /**
615
- * The top log probability for a token from an OpenAI-compatible chat completion
616
- * response.
617
- */
618
- interface TopLogprob {
619
- /**
620
- * The token.
621
- */
622
- token: string;
623
- /**
624
- * The log probability of the token.
625
- */
626
- logprob: number;
627
- /**
628
- * The bytes for the token.
629
- */
630
- bytes?: Array<number> | null;
631
- }
632
- }
633
- }
634
- }
635
- /**
636
- * A message from the user in an OpenAI-compatible chat completion request.
637
- */
638
- interface OpenAIUserMessageParamOutput {
639
- /**
640
- * The content of the message, which can include text and other media.
641
- */
642
- content: string | Array<OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartTextParam | OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartImageParam | OpenAIUserMessageParamOutput.OpenAIFile>;
643
- /**
644
- * The name of the user message participant.
645
- */
646
- name?: string | null;
647
- /**
648
- * Must be 'user' to identify this as a user message.
649
- */
650
- role?: 'user';
651
- }
652
- namespace OpenAIUserMessageParamOutput {
653
- /**
654
- * Text content part for OpenAI-compatible chat completion messages.
655
- */
656
- interface OpenAIChatCompletionContentPartTextParam {
657
- /**
658
- * The text content of the message.
659
- */
660
- text: string;
661
- /**
662
- * Must be 'text' to identify this as text content.
663
- */
664
- type?: 'text';
665
- }
666
- /**
667
- * Image content part for OpenAI-compatible chat completion messages.
668
- */
669
- interface OpenAIChatCompletionContentPartImageParam {
670
- /**
671
- * Image URL specification and processing details.
672
- */
673
- image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
674
- /**
675
- * Must be 'image_url' to identify this as image content.
676
- */
677
- type?: 'image_url';
678
- }
679
- namespace OpenAIChatCompletionContentPartImageParam {
680
- /**
681
- * Image URL specification and processing details.
682
- */
683
- interface ImageURL {
684
- /**
685
- * URL of the image to include in the message.
686
- */
687
- url: string;
688
- /**
689
- * Level of detail for image processing. Can be 'low', 'high', or 'auto'.
690
- */
691
- detail?: 'low' | 'high' | 'auto' | null;
692
- }
693
- }
694
- /**
695
- * File content part for OpenAI-compatible chat completion messages.
696
- */
697
- interface OpenAIFile {
698
- /**
699
- * File specification.
700
- */
701
- file: OpenAIFile.File;
702
- /**
703
- * Must be 'file' to identify this as file content.
704
- */
705
- type?: 'file';
706
- }
707
- namespace OpenAIFile {
708
- /**
709
- * File specification.
710
- */
711
- interface File {
712
- /**
713
- * Base64-encoded file data.
714
- */
715
- file_data?: string | null;
716
- /**
717
- * ID of an uploaded file.
718
- */
719
- file_id?: string | null;
720
- /**
721
- * Name of the file.
722
- */
723
- filename?: string | null;
724
- }
725
- }
726
- }
727
- /**
728
- * A system message providing instructions or context to the model.
729
- */
730
- interface OpenAISystemMessageParam {
731
- /**
732
- * The content of the 'system prompt'. If multiple system messages are provided,
733
- * they are concatenated.
734
- */
735
- content: string | Array<OpenAISystemMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
736
- /**
737
- * The name of the system message participant.
738
- */
739
- name?: string | null;
740
- /**
741
- * Must be 'system' to identify this as a system message.
742
- */
743
- role?: 'system';
744
- }
745
- namespace OpenAISystemMessageParam {
746
- /**
747
- * Text content part for OpenAI-compatible chat completion messages.
748
- */
749
- interface ListOpenAIChatCompletionContentPartTextParam {
750
- /**
751
- * The text content of the message.
752
- */
753
- text: string;
754
- /**
755
- * Must be 'text' to identify this as text content.
756
- */
757
- type?: 'text';
758
- }
759
- }
760
- /**
761
- * A message containing the model's (assistant) response in an OpenAI-compatible
762
- * chat completion request.
763
- */
764
- interface OpenAIAssistantMessageParamOutput {
765
- /**
766
- * The content of the model's response.
767
- */
768
- content?: string | Array<OpenAIAssistantMessageParamOutput.ListOpenAIChatCompletionContentPartTextParam> | null;
769
- /**
770
- * The name of the assistant message participant.
771
- */
772
- name?: string | null;
773
- /**
774
- * Must be 'assistant' to identify this as the model's response.
775
- */
776
- role?: 'assistant';
777
- /**
778
- * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
779
- */
780
- tool_calls?: Array<OpenAIAssistantMessageParamOutput.ToolCall> | null;
781
- [k: string]: unknown;
782
- }
783
- namespace OpenAIAssistantMessageParamOutput {
784
- /**
785
- * Text content part for OpenAI-compatible chat completion messages.
786
- */
787
- interface ListOpenAIChatCompletionContentPartTextParam {
788
- /**
789
- * The text content of the message.
790
- */
791
- text: string;
792
- /**
793
- * Must be 'text' to identify this as text content.
794
- */
795
- type?: 'text';
796
- }
797
- /**
798
- * Tool call specification for OpenAI-compatible chat completion responses.
799
- */
800
- interface ToolCall {
801
- /**
802
- * Unique identifier for the tool call.
803
- */
804
- id: string;
805
- /**
806
- * Function call details.
807
- */
808
- function: ToolCall.Function;
809
- /**
810
- * Must be 'function' to identify this as a function call.
811
- */
812
- type: 'function';
813
- }
814
- namespace ToolCall {
815
- /**
816
- * Function call details.
817
- */
818
- interface Function {
819
- /**
820
- * Arguments to pass to the function as a JSON string.
821
- */
822
- arguments: string;
823
- /**
824
- * Name of the function to call.
825
- */
826
- name: string;
827
- }
828
- }
829
- }
830
- /**
831
- * A message representing the result of a tool invocation in an OpenAI-compatible
832
- * chat completion request.
833
- */
834
- interface OpenAIToolMessageParam {
835
- /**
836
- * The response content from the tool.
837
- */
838
- content: string | Array<OpenAIToolMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
839
- /**
840
- * Unique identifier for the tool call this response is for.
841
- */
842
- tool_call_id: string;
843
- /**
844
- * Must be 'tool' to identify this as a tool response.
845
- */
846
- role?: 'tool';
847
- }
848
- namespace OpenAIToolMessageParam {
849
- /**
850
- * Text content part for OpenAI-compatible chat completion messages.
851
- */
852
- interface ListOpenAIChatCompletionContentPartTextParam {
853
- /**
854
- * The text content of the message.
855
- */
856
- text: string;
857
- /**
858
- * Must be 'text' to identify this as text content.
859
- */
860
- type?: 'text';
861
- }
862
- }
863
- /**
864
- * A message from the developer in an OpenAI-compatible chat completion request.
865
- */
866
- interface OpenAIDeveloperMessageParam {
867
- /**
868
- * The content of the developer message.
869
- */
870
- content: string | Array<OpenAIDeveloperMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
871
- /**
872
- * The name of the developer message participant.
873
- */
874
- name?: string | null;
875
- /**
876
- * Must be 'developer' to identify this as a developer message.
877
- */
878
- role?: 'developer';
879
- }
880
- namespace OpenAIDeveloperMessageParam {
881
- /**
882
- * Text content part for OpenAI-compatible chat completion messages.
883
- */
884
- interface ListOpenAIChatCompletionContentPartTextParam {
885
- /**
886
- * The text content of the message.
887
- */
888
- text: string;
889
- /**
890
- * Must be 'text' to identify this as text content.
891
- */
892
- type?: 'text';
893
- }
894
- }
895
- /**
896
- * Token usage information for the completion.
897
- */
898
- interface Usage {
899
- /**
900
- * Number of tokens in the completion.
901
- */
902
- completion_tokens?: number;
903
- /**
904
- * Detailed breakdown of output token usage.
905
- */
906
- completion_tokens_details?: Usage.CompletionTokensDetails;
907
- /**
908
- * Number of tokens in the prompt.
909
- */
910
- prompt_tokens?: number;
911
- /**
912
- * Detailed breakdown of input token usage.
913
- */
914
- prompt_tokens_details?: Usage.PromptTokensDetails;
915
- /**
916
- * Total tokens used (prompt + completion).
917
- */
918
- total_tokens?: number;
919
- }
920
- namespace Usage {
921
- /**
922
- * Detailed breakdown of output token usage.
923
- */
924
- interface CompletionTokensDetails {
925
- /**
926
- * Number of tokens used for reasoning (o1/o3 models).
927
- */
928
- reasoning_tokens?: number;
929
- }
930
- /**
931
- * Detailed breakdown of input token usage.
932
- */
933
- interface PromptTokensDetails {
934
- /**
935
- * Number of tokens retrieved from cache.
936
- */
937
- cached_tokens?: number;
938
- }
939
- }
940
- }
941
- /**
942
- * Response from listing OpenAI-compatible chat completions.
943
- */
944
- export interface CompletionListResponse {
945
- /**
946
- * List of chat completion objects with their input messages.
947
- */
948
- data: Array<CompletionListResponse.Data>;
949
- /**
950
- * ID of the first completion in this list.
951
- */
952
- first_id: string;
953
- /**
954
- * Whether there are more completions available beyond this list.
955
- */
956
- has_more: boolean;
957
- /**
958
- * ID of the last completion in this list.
959
- */
960
- last_id: string;
961
- /**
962
- * Must be 'list' to identify this as a list response.
963
- */
964
- object?: 'list';
965
- }
966
- export declare namespace CompletionListResponse {
967
- /**
968
- * Chat completion response extended with the original input messages.
969
- */
970
- interface Data {
971
- /**
972
- * The ID of the chat completion.
973
- */
974
- id: string;
975
- /**
976
- * List of choices.
977
- */
978
- choices: Array<Data.Choice>;
979
- /**
980
- * The Unix timestamp in seconds when the chat completion was created.
981
- */
982
- created: number;
983
- /**
984
- * The input messages used to generate this completion.
985
- */
986
- input_messages: Array<Data.OpenAIUserMessageParamOutput | Data.OpenAISystemMessageParam | Data.OpenAIAssistantMessageParamOutput | Data.OpenAIToolMessageParam | Data.OpenAIDeveloperMessageParam>;
987
- /**
988
- * The model that was used to generate the chat completion.
989
- */
990
- model: string;
991
- /**
992
- * The object type.
993
- */
994
- object?: 'chat.completion';
995
- /**
996
- * The service tier that was used for this response.
997
- */
998
- service_tier?: string | null;
999
- /**
1000
- * System fingerprint for this completion.
1001
- */
1002
- system_fingerprint?: string;
1003
- /**
1004
- * Token usage information for the completion.
1005
- */
1006
- usage?: Data.Usage;
1007
- }
1008
- namespace Data {
1009
- /**
1010
- * A choice from an OpenAI-compatible chat completion response.
1011
- */
1012
- interface Choice {
1013
- /**
1014
- * The reason the model stopped generating.
1015
- */
1016
- finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call';
1017
- /**
1018
- * The index of the choice.
1019
- */
1020
- index: number;
1021
- /**
1022
- * The message from the model.
1023
- */
1024
- message: Choice.Message;
1025
- /**
1026
- * The log probabilities for the tokens in the message.
1027
- */
1028
- logprobs?: Choice.Logprobs | null;
1029
- }
1030
- namespace Choice {
1031
- /**
1032
- * The message from the model.
1033
- */
1034
- interface Message {
1035
- /**
1036
- * Annotations for the message, when applicable.
1037
- */
1038
- annotations?: Array<{
1039
- [key: string]: unknown;
1040
- }>;
1041
- /**
1042
- * Audio response data when using audio output modality.
1043
- */
1044
- audio?: {
1045
- [key: string]: unknown;
1046
- } | null;
1047
- /**
1048
- * The content of the message.
1049
- */
1050
- content?: string | null;
1051
- /**
1052
- * Deprecated: the name and arguments of a function that should be called.
1053
- */
1054
- function_call?: Message.FunctionCall;
1055
- /**
1056
- * The refusal message generated by the model.
1057
- */
1058
- refusal?: string | null;
1059
- /**
1060
- * The role of the message author, always 'assistant' in responses.
1061
- */
1062
- role?: 'assistant';
1063
- /**
1064
- * The tool calls generated by the model.
1065
- */
1066
- tool_calls?: Array<Message.Function | Message.Custom>;
1067
- }
1068
- namespace Message {
1069
- /**
1070
- * Deprecated: the name and arguments of a function that should be called.
1071
- */
1072
- interface FunctionCall {
1073
- /**
1074
- * Arguments to pass to the function as a JSON string.
1075
- */
1076
- arguments: string;
1077
- /**
1078
- * Name of the function to call.
1079
- */
1080
- name: string;
1081
- }
1082
- /**
1083
- * Tool call specification for OpenAI-compatible chat completion responses.
1084
- */
1085
- interface Function {
1086
- /**
1087
- * Unique identifier for the tool call.
1088
- */
1089
- id: string;
1090
- /**
1091
- * Function call details.
1092
- */
1093
- function: Function.Function;
1094
- /**
1095
- * Must be 'function' to identify this as a function call.
1096
- */
1097
- type: 'function';
1098
- }
1099
- namespace Function {
1100
- /**
1101
- * Function call details.
1102
- */
1103
- interface Function {
1104
- /**
1105
- * Arguments to pass to the function as a JSON string.
1106
- */
1107
- arguments: string;
1108
- /**
1109
- * Name of the function to call.
1110
- */
1111
- name: string;
1112
- }
1113
- }
1114
- /**
1115
- * A call to a custom tool created by the model.
1116
- */
1117
- interface Custom {
1118
- /**
1119
- * The ID of the tool call.
1120
- */
1121
- id: string;
1122
- /**
1123
- * The custom tool that the model called.
1124
- */
1125
- custom: Custom.Custom;
1126
- /**
1127
- * The type of the tool. Always 'custom'.
1128
- */
1129
- type: 'custom';
1130
- }
1131
- namespace Custom {
1132
- /**
1133
- * The custom tool that the model called.
1134
- */
1135
- interface Custom {
1136
- /**
1137
- * The input for the custom tool call generated by the model.
1138
- */
1139
- input: string;
1140
- /**
1141
- * The name of the custom tool to call.
1142
- */
1143
- name: string;
1144
- }
1145
- }
1146
- }
1147
- /**
1148
- * The log probabilities for the tokens in the message.
1149
- */
1150
- interface Logprobs {
1151
- /**
1152
- * The log probabilities for the tokens in the message.
1153
- */
1154
- content?: Array<Logprobs.Content> | null;
1155
- /**
1156
- * The log probabilities for the refusal tokens.
1157
- */
1158
- refusal?: Array<Logprobs.Refusal> | null;
1159
- }
1160
- namespace Logprobs {
1161
- /**
1162
- * The log probability for a token from an OpenAI-compatible chat completion
1163
- * response.
1164
- */
1165
- interface Content {
1166
- /**
1167
- * The token.
1168
- */
1169
- token: string;
1170
- /**
1171
- * The log probability of the token.
1172
- */
1173
- logprob: number;
1174
- /**
1175
- * The bytes for the token.
1176
- */
1177
- bytes?: Array<number> | null;
1178
- /**
1179
- * The top log probabilities for the token.
1180
- */
1181
- top_logprobs?: Array<Content.TopLogprob> | null;
1182
- }
1183
- namespace Content {
1184
- /**
1185
- * The top log probability for a token from an OpenAI-compatible chat completion
1186
- * response.
1187
- */
1188
- interface TopLogprob {
1189
- /**
1190
- * The token.
1191
- */
1192
- token: string;
1193
- /**
1194
- * The log probability of the token.
1195
- */
1196
- logprob: number;
1197
- /**
1198
- * The bytes for the token.
1199
- */
1200
- bytes?: Array<number> | null;
1201
- }
1202
- }
1203
- /**
1204
- * The log probability for a token from an OpenAI-compatible chat completion
1205
- * response.
1206
- */
1207
- interface Refusal {
1208
- /**
1209
- * The token.
1210
- */
1211
- token: string;
1212
- /**
1213
- * The log probability of the token.
1214
- */
1215
- logprob: number;
1216
- /**
1217
- * The bytes for the token.
1218
- */
1219
- bytes?: Array<number> | null;
1220
- /**
1221
- * The top log probabilities for the token.
1222
- */
1223
- top_logprobs?: Array<Refusal.TopLogprob> | null;
1224
- }
1225
- namespace Refusal {
1226
- /**
1227
- * The top log probability for a token from an OpenAI-compatible chat completion
1228
- * response.
1229
- */
1230
- interface TopLogprob {
1231
- /**
1232
- * The token.
1233
- */
1234
- token: string;
1235
- /**
1236
- * The log probability of the token.
1237
- */
1238
- logprob: number;
1239
- /**
1240
- * The bytes for the token.
1241
- */
1242
- bytes?: Array<number> | null;
1243
- }
1244
- }
1245
- }
1246
- }
1247
- /**
1248
- * A message from the user in an OpenAI-compatible chat completion request.
1249
- */
1250
- interface OpenAIUserMessageParamOutput {
1251
- /**
1252
- * The content of the message, which can include text and other media.
1253
- */
1254
- content: string | Array<OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartTextParam | OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartImageParam | OpenAIUserMessageParamOutput.OpenAIFile>;
1255
- /**
1256
- * The name of the user message participant.
1257
- */
1258
- name?: string | null;
1259
- /**
1260
- * Must be 'user' to identify this as a user message.
1261
- */
1262
- role?: 'user';
1263
- }
1264
- namespace OpenAIUserMessageParamOutput {
1265
- /**
1266
- * Text content part for OpenAI-compatible chat completion messages.
1267
- */
1268
- interface OpenAIChatCompletionContentPartTextParam {
1269
- /**
1270
- * The text content of the message.
1271
- */
1272
- text: string;
1273
- /**
1274
- * Must be 'text' to identify this as text content.
1275
- */
1276
- type?: 'text';
1277
- }
1278
- /**
1279
- * Image content part for OpenAI-compatible chat completion messages.
1280
- */
1281
- interface OpenAIChatCompletionContentPartImageParam {
1282
- /**
1283
- * Image URL specification and processing details.
1284
- */
1285
- image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
1286
- /**
1287
- * Must be 'image_url' to identify this as image content.
1288
- */
1289
- type?: 'image_url';
1290
- }
1291
- namespace OpenAIChatCompletionContentPartImageParam {
1292
- /**
1293
- * Image URL specification and processing details.
1294
- */
1295
- interface ImageURL {
1296
- /**
1297
- * URL of the image to include in the message.
1298
- */
1299
- url: string;
1300
- /**
1301
- * Level of detail for image processing. Can be 'low', 'high', or 'auto'.
1302
- */
1303
- detail?: 'low' | 'high' | 'auto' | null;
1304
- }
1305
- }
1306
- /**
1307
- * File content part for OpenAI-compatible chat completion messages.
1308
- */
1309
- interface OpenAIFile {
1310
- /**
1311
- * File specification.
1312
- */
1313
- file: OpenAIFile.File;
1314
- /**
1315
- * Must be 'file' to identify this as file content.
1316
- */
1317
- type?: 'file';
1318
- }
1319
- namespace OpenAIFile {
1320
- /**
1321
- * File specification.
1322
- */
1323
- interface File {
1324
- /**
1325
- * Base64-encoded file data.
1326
- */
1327
- file_data?: string | null;
1328
- /**
1329
- * ID of an uploaded file.
1330
- */
1331
- file_id?: string | null;
1332
- /**
1333
- * Name of the file.
1334
- */
1335
- filename?: string | null;
1336
- }
1337
- }
1338
- }
1339
- /**
1340
- * A system message providing instructions or context to the model.
1341
- */
1342
- interface OpenAISystemMessageParam {
1343
- /**
1344
- * The content of the 'system prompt'. If multiple system messages are provided,
1345
- * they are concatenated.
1346
- */
1347
- content: string | Array<OpenAISystemMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
1348
- /**
1349
- * The name of the system message participant.
1350
- */
1351
- name?: string | null;
1352
- /**
1353
- * Must be 'system' to identify this as a system message.
1354
- */
1355
- role?: 'system';
1356
- }
1357
- namespace OpenAISystemMessageParam {
1358
- /**
1359
- * Text content part for OpenAI-compatible chat completion messages.
1360
- */
1361
- interface ListOpenAIChatCompletionContentPartTextParam {
1362
- /**
1363
- * The text content of the message.
1364
- */
1365
- text: string;
1366
- /**
1367
- * Must be 'text' to identify this as text content.
1368
- */
1369
- type?: 'text';
1370
- }
1371
- }
1372
- /**
1373
- * A message containing the model's (assistant) response in an OpenAI-compatible
1374
- * chat completion request.
1375
- */
1376
- interface OpenAIAssistantMessageParamOutput {
1377
- /**
1378
- * The content of the model's response.
1379
- */
1380
- content?: string | Array<OpenAIAssistantMessageParamOutput.ListOpenAIChatCompletionContentPartTextParam> | null;
1381
- /**
1382
- * The name of the assistant message participant.
1383
- */
1384
- name?: string | null;
1385
- /**
1386
- * Must be 'assistant' to identify this as the model's response.
1387
- */
1388
- role?: 'assistant';
1389
- /**
1390
- * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
1391
- */
1392
- tool_calls?: Array<OpenAIAssistantMessageParamOutput.ToolCall> | null;
1393
- [k: string]: unknown;
1394
- }
1395
- namespace OpenAIAssistantMessageParamOutput {
1396
- /**
1397
- * Text content part for OpenAI-compatible chat completion messages.
1398
- */
1399
- interface ListOpenAIChatCompletionContentPartTextParam {
1400
- /**
1401
- * The text content of the message.
1402
- */
1403
- text: string;
1404
- /**
1405
- * Must be 'text' to identify this as text content.
1406
- */
1407
- type?: 'text';
1408
- }
1409
- /**
1410
- * Tool call specification for OpenAI-compatible chat completion responses.
1411
- */
1412
- interface ToolCall {
1413
- /**
1414
- * Unique identifier for the tool call.
1415
- */
1416
- id: string;
1417
- /**
1418
- * Function call details.
1419
- */
1420
- function: ToolCall.Function;
1421
- /**
1422
- * Must be 'function' to identify this as a function call.
1423
- */
1424
- type: 'function';
1425
- }
1426
- namespace ToolCall {
1427
- /**
1428
- * Function call details.
1429
- */
1430
- interface Function {
1431
- /**
1432
- * Arguments to pass to the function as a JSON string.
1433
- */
1434
- arguments: string;
1435
- /**
1436
- * Name of the function to call.
1437
- */
1438
- name: string;
1439
- }
1440
- }
1441
- }
1442
- /**
1443
- * A message representing the result of a tool invocation in an OpenAI-compatible
1444
- * chat completion request.
1445
- */
1446
- interface OpenAIToolMessageParam {
1447
- /**
1448
- * The response content from the tool.
1449
- */
1450
- content: string | Array<OpenAIToolMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
1451
- /**
1452
- * Unique identifier for the tool call this response is for.
1453
- */
1454
- tool_call_id: string;
1455
- /**
1456
- * Must be 'tool' to identify this as a tool response.
1457
- */
1458
- role?: 'tool';
1459
- }
1460
- namespace OpenAIToolMessageParam {
1461
- /**
1462
- * Text content part for OpenAI-compatible chat completion messages.
1463
- */
1464
- interface ListOpenAIChatCompletionContentPartTextParam {
1465
- /**
1466
- * The text content of the message.
1467
- */
1468
- text: string;
1469
- /**
1470
- * Must be 'text' to identify this as text content.
1471
- */
1472
- type?: 'text';
1473
- }
1474
- }
1475
- /**
1476
- * A message from the developer in an OpenAI-compatible chat completion request.
1477
- */
1478
- interface OpenAIDeveloperMessageParam {
1479
- /**
1480
- * The content of the developer message.
1481
- */
1482
- content: string | Array<OpenAIDeveloperMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
1483
- /**
1484
- * The name of the developer message participant.
1485
- */
1486
- name?: string | null;
1487
- /**
1488
- * Must be 'developer' to identify this as a developer message.
1489
- */
1490
- role?: 'developer';
1491
- }
1492
- namespace OpenAIDeveloperMessageParam {
1493
- /**
1494
- * Text content part for OpenAI-compatible chat completion messages.
1495
- */
1496
- interface ListOpenAIChatCompletionContentPartTextParam {
1497
- /**
1498
- * The text content of the message.
1499
- */
1500
- text: string;
1501
- /**
1502
- * Must be 'text' to identify this as text content.
1503
- */
1504
- type?: 'text';
1505
- }
1506
- }
1507
- /**
1508
- * Token usage information for the completion.
1509
- */
1510
- interface Usage {
1511
- /**
1512
- * Number of tokens in the completion.
1513
- */
1514
- completion_tokens?: number;
1515
- /**
1516
- * Detailed breakdown of output token usage.
1517
- */
1518
- completion_tokens_details?: Usage.CompletionTokensDetails;
1519
- /**
1520
- * Number of tokens in the prompt.
1521
- */
1522
- prompt_tokens?: number;
1523
- /**
1524
- * Detailed breakdown of input token usage.
1525
- */
1526
- prompt_tokens_details?: Usage.PromptTokensDetails;
1527
- /**
1528
- * Total tokens used (prompt + completion).
1529
- */
1530
- total_tokens?: number;
1531
- }
1532
- namespace Usage {
1533
- /**
1534
- * Detailed breakdown of output token usage.
1535
- */
1536
- interface CompletionTokensDetails {
1537
- /**
1538
- * Number of tokens used for reasoning (o1/o3 models).
1539
- */
1540
- reasoning_tokens?: number;
1541
- }
1542
- /**
1543
- * Detailed breakdown of input token usage.
1544
- */
1545
- interface PromptTokensDetails {
1546
- /**
1547
- * Number of tokens retrieved from cache.
1548
- */
1549
- cached_tokens?: number;
1550
- }
1551
- }
1552
- }
1553
- }
1554
- export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
1555
- export interface CompletionCreateParamsBase {
1556
- /**
1557
- * List of messages in the conversation.
1558
- */
1559
- messages: Array<CompletionCreateParams.OpenAIUserMessageParamInput | CompletionCreateParams.OpenAISystemMessageParam | CompletionCreateParams.OpenAIAssistantMessageParamInput | CompletionCreateParams.OpenAIToolMessageParam | CompletionCreateParams.OpenAIDeveloperMessageParam>;
1560
- /**
1561
- * The identifier of the model to use.
1562
- */
1563
- model: string;
1564
- /**
1565
- * The penalty for repeated tokens.
1566
- */
1567
- frequency_penalty?: number | null;
1568
- /**
1569
- * The function call to use.
1570
- */
1571
- function_call?: string | {
1572
- [key: string]: unknown;
1573
- } | null;
1574
- /**
1575
- * List of functions to use.
1576
- */
1577
- functions?: Array<{
1578
- [key: string]: unknown;
1579
- }> | null;
1580
- /**
1581
- * The logit bias to use.
1582
- */
1583
- logit_bias?: {
1584
- [key: string]: number;
1585
- } | null;
1586
- /**
1587
- * The log probabilities to use.
1588
- */
1589
- logprobs?: boolean | null;
1590
- /**
1591
- * The maximum number of tokens to generate.
1592
- */
1593
- max_completion_tokens?: number | null;
1594
- /**
1595
- * The maximum number of tokens to generate.
1596
- */
1597
- max_tokens?: number | null;
1598
- /**
1599
- * The number of completions to generate.
1600
- */
1601
- n?: number | null;
1602
- /**
1603
- * Whether to parallelize tool calls.
1604
- */
1605
- parallel_tool_calls?: boolean | null;
1606
- /**
1607
- * The penalty for repeated tokens.
1608
- */
1609
- presence_penalty?: number | null;
1610
- /**
1611
- * A key to use when reading from or writing to the prompt cache.
1612
- */
1613
- prompt_cache_key?: string | null;
1614
- /**
1615
- * The effort level for reasoning models.
1616
- */
1617
- reasoning_effort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | null;
1618
- /**
1619
- * The response format to use.
1620
- */
1621
- response_format?: CompletionCreateParams.OpenAIResponseFormatText | CompletionCreateParams.OpenAIResponseFormatJsonSchema | CompletionCreateParams.OpenAIResponseFormatJsonObject | null;
1622
- /**
1623
- * A stable identifier used for safety monitoring and abuse detection.
1624
- */
1625
- safety_identifier?: string | null;
1626
- /**
1627
- * The seed to use.
1628
- */
1629
- seed?: number | null;
1630
- /**
1631
- * The service tier for the request.
1632
- */
1633
- service_tier?: 'auto' | 'default' | 'flex' | 'priority' | null;
1634
- /**
1635
- * The stop tokens to use.
1636
- */
1637
- stop?: string | Array<string> | null;
1638
- /**
1639
- * Whether to stream the response.
1640
- */
1641
- stream?: boolean | null;
1642
- /**
1643
- * The stream options to use.
1644
- */
1645
- stream_options?: {
1646
- [key: string]: unknown;
1647
- } | null;
1648
- /**
1649
- * The temperature to use.
1650
- */
1651
- temperature?: number | null;
1652
- /**
1653
- * The tool choice to use.
1654
- */
1655
- tool_choice?: string | {
1656
- [key: string]: unknown;
1657
- } | null;
1658
- /**
1659
- * The tools to use.
1660
- */
1661
- tools?: Array<{
1662
- [key: string]: unknown;
1663
- }> | null;
1664
- /**
1665
- * The number of most likely tokens to return at each position.
1666
- */
1667
- top_logprobs?: number | null;
1668
- /**
1669
- * The top p to use.
1670
- */
1671
- top_p?: number | null;
1672
- /**
1673
- * The user to use.
1674
- */
1675
- user?: string | null;
1676
- [k: string]: unknown;
1677
- }
1678
- export declare namespace CompletionCreateParams {
1679
- /**
1680
- * A message from the user in an OpenAI-compatible chat completion request.
1681
- */
1682
- interface OpenAIUserMessageParamInput {
1683
- /**
1684
- * The content of the message, which can include text and other media.
1685
- */
1686
- content: string | Array<OpenAIUserMessageParamInput.OpenAIChatCompletionContentPartTextParam | OpenAIUserMessageParamInput.OpenAIChatCompletionContentPartImageParam | OpenAIUserMessageParamInput.OpenAIFile>;
1687
- /**
1688
- * The name of the user message participant.
1689
- */
1690
- name?: string | null;
1691
- /**
1692
- * Must be 'user' to identify this as a user message.
1693
- */
1694
- role?: 'user';
1695
- }
1696
- namespace OpenAIUserMessageParamInput {
1697
- /**
1698
- * Text content part for OpenAI-compatible chat completion messages.
1699
- */
1700
- interface OpenAIChatCompletionContentPartTextParam {
1701
- /**
1702
- * The text content of the message.
1703
- */
1704
- text: string;
1705
- /**
1706
- * Must be 'text' to identify this as text content.
1707
- */
1708
- type?: 'text';
1709
- }
1710
- /**
1711
- * Image content part for OpenAI-compatible chat completion messages.
1712
- */
1713
- interface OpenAIChatCompletionContentPartImageParam {
1714
- /**
1715
- * Image URL specification and processing details.
1716
- */
1717
- image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
1718
- /**
1719
- * Must be 'image_url' to identify this as image content.
1720
- */
1721
- type?: 'image_url';
1722
- }
1723
- namespace OpenAIChatCompletionContentPartImageParam {
1724
- /**
1725
- * Image URL specification and processing details.
1726
- */
1727
- interface ImageURL {
1728
- /**
1729
- * URL of the image to include in the message.
1730
- */
1731
- url: string;
1732
- /**
1733
- * Level of detail for image processing. Can be 'low', 'high', or 'auto'.
1734
- */
1735
- detail?: 'low' | 'high' | 'auto' | null;
1736
- }
1737
- }
1738
- /**
1739
- * File content part for OpenAI-compatible chat completion messages.
1740
- */
1741
- interface OpenAIFile {
1742
- /**
1743
- * File specification.
1744
- */
1745
- file: OpenAIFile.File;
1746
- /**
1747
- * Must be 'file' to identify this as file content.
1748
- */
1749
- type?: 'file';
1750
- }
1751
- namespace OpenAIFile {
1752
- /**
1753
- * File specification.
1754
- */
1755
- interface File {
1756
- /**
1757
- * Base64-encoded file data.
1758
- */
1759
- file_data?: string | null;
1760
- /**
1761
- * ID of an uploaded file.
1762
- */
1763
- file_id?: string | null;
1764
- /**
1765
- * Name of the file.
1766
- */
1767
- filename?: string | null;
1768
- }
1769
- }
1770
- }
1771
- /**
1772
- * A system message providing instructions or context to the model.
1773
- */
1774
- interface OpenAISystemMessageParam {
1775
- /**
1776
- * The content of the 'system prompt'. If multiple system messages are provided,
1777
- * they are concatenated.
1778
- */
1779
- content: string | Array<OpenAISystemMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
1780
- /**
1781
- * The name of the system message participant.
1782
- */
1783
- name?: string | null;
1784
- /**
1785
- * Must be 'system' to identify this as a system message.
1786
- */
1787
- role?: 'system';
1788
- }
1789
- namespace OpenAISystemMessageParam {
1790
- /**
1791
- * Text content part for OpenAI-compatible chat completion messages.
1792
- */
1793
- interface ListOpenAIChatCompletionContentPartTextParam {
1794
- /**
1795
- * The text content of the message.
1796
- */
1797
- text: string;
1798
- /**
1799
- * Must be 'text' to identify this as text content.
1800
- */
1801
- type?: 'text';
1802
- }
1803
- }
1804
- /**
1805
- * A message containing the model's (assistant) response in an OpenAI-compatible
1806
- * chat completion request.
1807
- */
1808
- interface OpenAIAssistantMessageParamInput {
1809
- /**
1810
- * The content of the model's response.
1811
- */
1812
- content?: string | Array<OpenAIAssistantMessageParamInput.ListOpenAIChatCompletionContentPartTextParam> | null;
1813
- /**
1814
- * The name of the assistant message participant.
1815
- */
1816
- name?: string | null;
1817
- /**
1818
- * Must be 'assistant' to identify this as the model's response.
1819
- */
1820
- role?: 'assistant';
1821
- /**
1822
- * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
1823
- */
1824
- tool_calls?: Array<OpenAIAssistantMessageParamInput.ToolCall> | null;
1825
- [k: string]: unknown;
1826
- }
1827
- namespace OpenAIAssistantMessageParamInput {
1828
- /**
1829
- * Text content part for OpenAI-compatible chat completion messages.
1830
- */
1831
- interface ListOpenAIChatCompletionContentPartTextParam {
1832
- /**
1833
- * The text content of the message.
1834
- */
1835
- text: string;
1836
- /**
1837
- * Must be 'text' to identify this as text content.
1838
- */
1839
- type?: 'text';
1840
- }
1841
- /**
1842
- * Tool call specification for OpenAI-compatible chat completion responses.
1843
- */
1844
- interface ToolCall {
1845
- /**
1846
- * Unique identifier for the tool call.
1847
- */
1848
- id: string;
1849
- /**
1850
- * Function call details.
1851
- */
1852
- function: ToolCall.Function;
1853
- /**
1854
- * Must be 'function' to identify this as a function call.
1855
- */
1856
- type: 'function';
1857
- }
1858
- namespace ToolCall {
1859
- /**
1860
- * Function call details.
1861
- */
1862
- interface Function {
1863
- /**
1864
- * Arguments to pass to the function as a JSON string.
1865
- */
1866
- arguments: string;
1867
- /**
1868
- * Name of the function to call.
1869
- */
1870
- name: string;
1871
- }
1872
- }
1873
- }
1874
- /**
1875
- * A message representing the result of a tool invocation in an OpenAI-compatible
1876
- * chat completion request.
1877
- */
1878
- interface OpenAIToolMessageParam {
1879
- /**
1880
- * The response content from the tool.
1881
- */
1882
- content: string | Array<OpenAIToolMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
1883
- /**
1884
- * Unique identifier for the tool call this response is for.
1885
- */
1886
- tool_call_id: string;
1887
- /**
1888
- * Must be 'tool' to identify this as a tool response.
1889
- */
1890
- role?: 'tool';
1891
- }
1892
- namespace OpenAIToolMessageParam {
1893
- /**
1894
- * Text content part for OpenAI-compatible chat completion messages.
1895
- */
1896
- interface ListOpenAIChatCompletionContentPartTextParam {
1897
- /**
1898
- * The text content of the message.
1899
- */
1900
- text: string;
1901
- /**
1902
- * Must be 'text' to identify this as text content.
1903
- */
1904
- type?: 'text';
1905
- }
1906
- }
1907
- /**
1908
- * A message from the developer in an OpenAI-compatible chat completion request.
1909
- */
1910
- interface OpenAIDeveloperMessageParam {
1911
- /**
1912
- * The content of the developer message.
1913
- */
1914
- content: string | Array<OpenAIDeveloperMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
1915
- /**
1916
- * The name of the developer message participant.
1917
- */
1918
- name?: string | null;
1919
- /**
1920
- * Must be 'developer' to identify this as a developer message.
1921
- */
1922
- role?: 'developer';
1923
- }
1924
- namespace OpenAIDeveloperMessageParam {
1925
- /**
1926
- * Text content part for OpenAI-compatible chat completion messages.
1927
- */
1928
- interface ListOpenAIChatCompletionContentPartTextParam {
1929
- /**
1930
- * The text content of the message.
1931
- */
1932
- text: string;
1933
- /**
1934
- * Must be 'text' to identify this as text content.
1935
- */
1936
- type?: 'text';
1937
- }
1938
- }
1939
- /**
1940
- * Text response format for OpenAI-compatible chat completion requests.
1941
- */
1942
- interface OpenAIResponseFormatText {
1943
- /**
1944
- * Must be 'text' to indicate plain text response format.
1945
- */
1946
- type?: 'text';
1947
- }
1948
- /**
1949
- * JSON schema response format for OpenAI-compatible chat completion requests.
1950
- */
1951
- interface OpenAIResponseFormatJsonSchema {
1952
- /**
1953
- * The JSON schema specification for the response.
1954
- */
1955
- json_schema: OpenAIResponseFormatJsonSchema.JsonSchema;
1956
- /**
1957
- * Must be 'json_schema' to indicate structured JSON response format.
1958
- */
1959
- type?: 'json_schema';
1960
- }
1961
- namespace OpenAIResponseFormatJsonSchema {
1962
- /**
1963
- * The JSON schema specification for the response.
1964
- */
1965
- interface JsonSchema {
1966
- description?: string | null;
1967
- name?: string;
1968
- schema?: {
1969
- [key: string]: unknown;
1970
- } | null;
1971
- strict?: boolean | null;
1972
- }
1973
- }
1974
- /**
1975
- * JSON object response format for OpenAI-compatible chat completion requests.
1976
- */
1977
- interface OpenAIResponseFormatJsonObject {
1978
- /**
1979
- * Must be 'json_object' to indicate generic JSON object response format.
1980
- */
1981
- type?: 'json_object';
1982
- }
1983
- type CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming;
1984
- type CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming;
1985
- }
1986
- export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
1987
- /**
1988
- * Whether to stream the response.
1989
- */
1990
- stream?: false | null;
1991
- [k: string]: unknown;
1992
- }
1993
- export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
1994
- /**
1995
- * Whether to stream the response.
1996
- */
1997
- stream: true;
1998
- [k: string]: unknown;
1999
- }
2000
- export interface CompletionListParams {
2001
- /**
2002
- * The ID of the last chat completion to return.
2003
- */
2004
- after?: string | null;
2005
- /**
2006
- * The maximum number of chat completions to return.
2007
- */
2008
- limit?: number | null;
2009
- /**
2010
- * The model to filter by.
2011
- */
2012
- model?: string | null;
2013
- /**
2014
- * The order to sort the chat completions by: "asc" or "desc". Defaults to "desc".
2015
- */
2016
- order?: 'asc' | 'desc' | null;
2017
- }
2018
- export declare namespace Completions {
2019
- export { type CompletionCreateResponse as CompletionCreateResponse, type CompletionRetrieveResponse as CompletionRetrieveResponse, type CompletionListResponse as CompletionListResponse, type CompletionCreateParams as CompletionCreateParams, type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, type CompletionListParams as CompletionListParams, };
2020
- }
1
+ export * from "./completions/index.js";
2021
2
  //# sourceMappingURL=completions.d.ts.map