llama-stack-client 0.7.0 → 0.7.2

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 (332) hide show
  1. package/.github/workflows/ci.yml +16 -10
  2. package/.gitignore +1 -0
  3. package/.release-please-manifest.json +1 -1
  4. package/.stats.yml +4 -4
  5. package/CHANGELOG.md +80 -0
  6. package/CONTRIBUTING.md +2 -2
  7. package/README.md +22 -0
  8. package/api.md +1 -71
  9. package/dist/CHANGELOG.md +80 -0
  10. package/dist/README.md +22 -0
  11. package/dist/core.d.ts +1 -1
  12. package/dist/core.d.ts.map +1 -1
  13. package/dist/core.js +8 -17
  14. package/dist/core.js.map +1 -1
  15. package/dist/core.mjs +8 -17
  16. package/dist/core.mjs.map +1 -1
  17. package/dist/index.d.mts +51 -12
  18. package/dist/index.d.ts +51 -12
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +50 -11
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +50 -11
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/internal/utils/query.d.ts +2 -0
  25. package/dist/internal/utils/query.d.ts.map +1 -0
  26. package/dist/{resources/alpha/post-training/post-training.js → internal/utils/query.js} +6 -24
  27. package/dist/internal/utils/query.js.map +1 -0
  28. package/dist/{resources/alpha/post-training.mjs → internal/utils/query.mjs} +5 -2
  29. package/dist/internal/utils/query.mjs.map +1 -0
  30. package/dist/package.json +1 -1
  31. package/dist/resources/alpha/alpha.d.ts +0 -4
  32. package/dist/resources/alpha/alpha.d.ts.map +1 -1
  33. package/dist/resources/alpha/alpha.js +0 -4
  34. package/dist/resources/alpha/alpha.js.map +1 -1
  35. package/dist/resources/alpha/alpha.mjs +0 -4
  36. package/dist/resources/alpha/alpha.mjs.map +1 -1
  37. package/dist/resources/alpha/eval/eval.d.ts +3 -0
  38. package/dist/resources/alpha/eval/eval.d.ts.map +1 -1
  39. package/dist/resources/alpha/eval/eval.js +3 -0
  40. package/dist/resources/alpha/eval/eval.js.map +1 -1
  41. package/dist/resources/alpha/eval/eval.mjs +3 -0
  42. package/dist/resources/alpha/eval/eval.mjs.map +1 -1
  43. package/dist/resources/alpha/eval/jobs.d.ts +3 -0
  44. package/dist/resources/alpha/eval/jobs.d.ts.map +1 -1
  45. package/dist/resources/alpha/eval/jobs.js +3 -0
  46. package/dist/resources/alpha/eval/jobs.js.map +1 -1
  47. package/dist/resources/alpha/eval/jobs.mjs +3 -0
  48. package/dist/resources/alpha/eval/jobs.mjs.map +1 -1
  49. package/dist/resources/alpha/index.d.ts +0 -1
  50. package/dist/resources/alpha/index.d.ts.map +1 -1
  51. package/dist/resources/alpha/index.js +1 -3
  52. package/dist/resources/alpha/index.js.map +1 -1
  53. package/dist/resources/alpha/index.mjs +0 -1
  54. package/dist/resources/alpha/index.mjs.map +1 -1
  55. package/dist/resources/alpha/inference.d.ts +8 -0
  56. package/dist/resources/alpha/inference.d.ts.map +1 -1
  57. package/dist/resources/alpha/inference.js +8 -0
  58. package/dist/resources/alpha/inference.js.map +1 -1
  59. package/dist/resources/alpha/inference.mjs +8 -0
  60. package/dist/resources/alpha/inference.mjs.map +1 -1
  61. package/dist/resources/batches.d.ts +8 -0
  62. package/dist/resources/batches.d.ts.map +1 -1
  63. package/dist/resources/batches.js +8 -0
  64. package/dist/resources/batches.js.map +1 -1
  65. package/dist/resources/batches.mjs +8 -0
  66. package/dist/resources/batches.mjs.map +1 -1
  67. package/dist/resources/beta/datasets.d.ts +4 -8
  68. package/dist/resources/beta/datasets.d.ts.map +1 -1
  69. package/dist/resources/chat/chat.d.ts +34 -32
  70. package/dist/resources/chat/chat.d.ts.map +1 -1
  71. package/dist/resources/chat/chat.js.map +1 -1
  72. package/dist/resources/chat/chat.mjs.map +1 -1
  73. package/dist/resources/chat/completions.d.ts +321 -713
  74. package/dist/resources/chat/completions.d.ts.map +1 -1
  75. package/dist/resources/chat/completions.js +8 -0
  76. package/dist/resources/chat/completions.js.map +1 -1
  77. package/dist/resources/chat/completions.mjs +8 -0
  78. package/dist/resources/chat/completions.mjs.map +1 -1
  79. package/dist/resources/completions.d.ts +10 -4
  80. package/dist/resources/completions.d.ts.map +1 -1
  81. package/dist/resources/completions.js +8 -0
  82. package/dist/resources/completions.js.map +1 -1
  83. package/dist/resources/completions.mjs +8 -0
  84. package/dist/resources/completions.mjs.map +1 -1
  85. package/dist/resources/conversations/conversations.d.ts +95 -2
  86. package/dist/resources/conversations/conversations.d.ts.map +1 -1
  87. package/dist/resources/conversations/conversations.js +3 -0
  88. package/dist/resources/conversations/conversations.js.map +1 -1
  89. package/dist/resources/conversations/conversations.mjs +3 -0
  90. package/dist/resources/conversations/conversations.mjs.map +1 -1
  91. package/dist/resources/conversations/items.d.ts +371 -8
  92. package/dist/resources/conversations/items.d.ts.map +1 -1
  93. package/dist/resources/conversations/items.js +3 -0
  94. package/dist/resources/conversations/items.js.map +1 -1
  95. package/dist/resources/conversations/items.mjs +3 -0
  96. package/dist/resources/conversations/items.mjs.map +1 -1
  97. package/dist/resources/embeddings.d.ts +8 -0
  98. package/dist/resources/embeddings.d.ts.map +1 -1
  99. package/dist/resources/embeddings.js +8 -0
  100. package/dist/resources/embeddings.js.map +1 -1
  101. package/dist/resources/embeddings.mjs +8 -0
  102. package/dist/resources/embeddings.mjs.map +1 -1
  103. package/dist/resources/files.d.ts +11 -8
  104. package/dist/resources/files.d.ts.map +1 -1
  105. package/dist/resources/files.js +3 -0
  106. package/dist/resources/files.js.map +1 -1
  107. package/dist/resources/files.mjs +3 -0
  108. package/dist/resources/files.mjs.map +1 -1
  109. package/dist/resources/index.d.ts +1 -4
  110. package/dist/resources/index.d.ts.map +1 -1
  111. package/dist/resources/index.js +1 -7
  112. package/dist/resources/index.js.map +1 -1
  113. package/dist/resources/index.mjs +0 -3
  114. package/dist/resources/index.mjs.map +1 -1
  115. package/dist/resources/inspect.d.ts +3 -0
  116. package/dist/resources/inspect.d.ts.map +1 -1
  117. package/dist/resources/inspect.js +3 -0
  118. package/dist/resources/inspect.js.map +1 -1
  119. package/dist/resources/inspect.mjs +3 -0
  120. package/dist/resources/inspect.mjs.map +1 -1
  121. package/dist/resources/models/index.d.ts +1 -1
  122. package/dist/resources/models/index.d.ts.map +1 -1
  123. package/dist/resources/models/index.js.map +1 -1
  124. package/dist/resources/models/index.mjs.map +1 -1
  125. package/dist/resources/models/models.d.ts +7 -65
  126. package/dist/resources/models/models.d.ts.map +1 -1
  127. package/dist/resources/models/models.js +0 -19
  128. package/dist/resources/models/models.js.map +1 -1
  129. package/dist/resources/models/models.mjs +0 -19
  130. package/dist/resources/models/models.mjs.map +1 -1
  131. package/dist/resources/moderations.d.ts +3 -0
  132. package/dist/resources/moderations.d.ts.map +1 -1
  133. package/dist/resources/moderations.js +3 -0
  134. package/dist/resources/moderations.js.map +1 -1
  135. package/dist/resources/moderations.mjs +3 -0
  136. package/dist/resources/moderations.mjs.map +1 -1
  137. package/dist/resources/prompts/prompts.d.ts +3 -0
  138. package/dist/resources/prompts/prompts.d.ts.map +1 -1
  139. package/dist/resources/prompts/prompts.js +3 -0
  140. package/dist/resources/prompts/prompts.js.map +1 -1
  141. package/dist/resources/prompts/prompts.mjs +3 -0
  142. package/dist/resources/prompts/prompts.mjs.map +1 -1
  143. package/dist/resources/prompts/versions.d.ts +3 -0
  144. package/dist/resources/prompts/versions.d.ts.map +1 -1
  145. package/dist/resources/prompts/versions.js +3 -0
  146. package/dist/resources/prompts/versions.js.map +1 -1
  147. package/dist/resources/prompts/versions.mjs +3 -0
  148. package/dist/resources/prompts/versions.mjs.map +1 -1
  149. package/dist/resources/providers.d.ts +3 -0
  150. package/dist/resources/providers.d.ts.map +1 -1
  151. package/dist/resources/providers.js +3 -0
  152. package/dist/resources/providers.js.map +1 -1
  153. package/dist/resources/providers.mjs +3 -0
  154. package/dist/resources/providers.mjs.map +1 -1
  155. package/dist/resources/responses/input-items.d.ts +102 -3
  156. package/dist/resources/responses/input-items.d.ts.map +1 -1
  157. package/dist/resources/responses/responses.d.ts +582 -11
  158. package/dist/resources/responses/responses.d.ts.map +1 -1
  159. package/dist/resources/responses/responses.js.map +1 -1
  160. package/dist/resources/responses/responses.mjs.map +1 -1
  161. package/dist/resources/routes.d.ts +3 -0
  162. package/dist/resources/routes.d.ts.map +1 -1
  163. package/dist/resources/routes.js +3 -0
  164. package/dist/resources/routes.js.map +1 -1
  165. package/dist/resources/routes.mjs +3 -0
  166. package/dist/resources/routes.mjs.map +1 -1
  167. package/dist/resources/safety.d.ts +14 -11
  168. package/dist/resources/safety.d.ts.map +1 -1
  169. package/dist/resources/safety.js +3 -0
  170. package/dist/resources/safety.js.map +1 -1
  171. package/dist/resources/safety.mjs +3 -0
  172. package/dist/resources/safety.mjs.map +1 -1
  173. package/dist/resources/vector-io.d.ts +4 -4
  174. package/dist/resources/vector-stores/file-batches.d.ts +49 -1
  175. package/dist/resources/vector-stores/file-batches.d.ts.map +1 -1
  176. package/dist/resources/vector-stores/file-batches.js.map +1 -1
  177. package/dist/resources/vector-stores/file-batches.mjs.map +1 -1
  178. package/dist/resources/vector-stores/files.d.ts +100 -4
  179. package/dist/resources/vector-stores/files.d.ts.map +1 -1
  180. package/dist/resources/vector-stores/files.js.map +1 -1
  181. package/dist/resources/vector-stores/files.mjs.map +1 -1
  182. package/dist/resources/vector-stores/vector-stores.d.ts +51 -3
  183. package/dist/resources/vector-stores/vector-stores.d.ts.map +1 -1
  184. package/dist/resources/vector-stores/vector-stores.js.map +1 -1
  185. package/dist/resources/vector-stores/vector-stores.mjs.map +1 -1
  186. package/dist/src/core.ts +10 -21
  187. package/dist/src/index.ts +51 -48
  188. package/{src/resources/alpha/post-training.ts → dist/src/internal/utils/query.ts} +5 -1
  189. package/dist/src/resources/alpha/alpha.ts +0 -20
  190. package/dist/src/resources/alpha/eval/eval.ts +3 -0
  191. package/dist/src/resources/alpha/eval/jobs.ts +3 -0
  192. package/dist/src/resources/alpha/index.ts +0 -8
  193. package/dist/src/resources/alpha/inference.ts +8 -0
  194. package/dist/src/resources/batches.ts +8 -0
  195. package/dist/src/resources/beta/datasets.ts +4 -9
  196. package/dist/src/resources/chat/chat.ts +36 -33
  197. package/dist/src/resources/chat/completions.ts +307 -811
  198. package/dist/src/resources/completions.ts +10 -4
  199. package/dist/src/resources/conversations/conversations.ts +121 -1
  200. package/dist/src/resources/conversations/items.ts +477 -6
  201. package/dist/src/resources/embeddings.ts +8 -0
  202. package/dist/src/resources/files.ts +12 -9
  203. package/dist/src/resources/index.ts +0 -18
  204. package/dist/src/resources/inspect.ts +3 -0
  205. package/dist/src/resources/models/index.ts +0 -2
  206. package/dist/src/resources/models/models.ts +7 -82
  207. package/dist/src/resources/moderations.ts +3 -0
  208. package/dist/src/resources/prompts/prompts.ts +3 -0
  209. package/dist/src/resources/prompts/versions.ts +3 -0
  210. package/dist/src/resources/providers.ts +3 -0
  211. package/dist/src/resources/responses/input-items.ts +128 -2
  212. package/dist/src/resources/responses/responses.ts +706 -7
  213. package/dist/src/resources/routes.ts +3 -0
  214. package/dist/src/resources/safety.ts +15 -12
  215. package/dist/src/resources/vector-io.ts +4 -4
  216. package/dist/src/resources/vector-stores/file-batches.ts +57 -0
  217. package/dist/src/resources/vector-stores/files.ts +117 -3
  218. package/dist/src/resources/vector-stores/vector-stores.ts +59 -2
  219. package/dist/src/streaming.ts +24 -6
  220. package/dist/src/version.ts +1 -1
  221. package/dist/streaming.d.ts.map +1 -1
  222. package/dist/streaming.js +21 -6
  223. package/dist/streaming.js.map +1 -1
  224. package/dist/streaming.mjs +21 -6
  225. package/dist/streaming.mjs.map +1 -1
  226. package/dist/version.d.ts +1 -1
  227. package/dist/version.js +1 -1
  228. package/dist/version.mjs +1 -1
  229. package/package.json +1 -1
  230. package/scripts/mock +21 -10
  231. package/scripts/test +8 -8
  232. package/src/core.ts +10 -21
  233. package/src/index.ts +51 -48
  234. package/{dist/src/resources/alpha/post-training.ts → src/internal/utils/query.ts} +5 -1
  235. package/src/resources/alpha/alpha.ts +0 -20
  236. package/src/resources/alpha/eval/eval.ts +3 -0
  237. package/src/resources/alpha/eval/jobs.ts +3 -0
  238. package/src/resources/alpha/index.ts +0 -8
  239. package/src/resources/alpha/inference.ts +8 -0
  240. package/src/resources/batches.ts +8 -0
  241. package/src/resources/beta/datasets.ts +4 -9
  242. package/src/resources/chat/chat.ts +36 -33
  243. package/src/resources/chat/completions.ts +307 -811
  244. package/src/resources/completions.ts +10 -4
  245. package/src/resources/conversations/conversations.ts +121 -1
  246. package/src/resources/conversations/items.ts +477 -6
  247. package/src/resources/embeddings.ts +8 -0
  248. package/src/resources/files.ts +12 -9
  249. package/src/resources/index.ts +0 -18
  250. package/src/resources/inspect.ts +3 -0
  251. package/src/resources/models/index.ts +0 -2
  252. package/src/resources/models/models.ts +7 -82
  253. package/src/resources/moderations.ts +3 -0
  254. package/src/resources/prompts/prompts.ts +3 -0
  255. package/src/resources/prompts/versions.ts +3 -0
  256. package/src/resources/providers.ts +3 -0
  257. package/src/resources/responses/input-items.ts +128 -2
  258. package/src/resources/responses/responses.ts +706 -7
  259. package/src/resources/routes.ts +3 -0
  260. package/src/resources/safety.ts +15 -12
  261. package/src/resources/vector-io.ts +4 -4
  262. package/src/resources/vector-stores/file-batches.ts +57 -0
  263. package/src/resources/vector-stores/files.ts +117 -3
  264. package/src/resources/vector-stores/vector-stores.ts +59 -2
  265. package/src/streaming.ts +24 -6
  266. package/src/version.ts +1 -1
  267. package/tests/api-resources/beta/datasets.test.ts +4 -10
  268. package/tests/api-resources/chat/completions.test.ts +2 -0
  269. package/tests/api-resources/files.test.ts +2 -2
  270. package/tests/api-resources/models/models.test.ts +0 -39
  271. package/tests/api-resources/responses/responses.test.ts +10 -1
  272. package/tests/api-resources/vector-stores/file-batches.test.ts +1 -1
  273. package/tests/api-resources/vector-stores/files.test.ts +1 -1
  274. package/tests/api-resources/vector-stores/vector-stores.test.ts +1 -1
  275. package/tests/stringifyQuery.test.ts +2 -4
  276. package/dist/resources/alpha/post-training/index.d.ts +0 -3
  277. package/dist/resources/alpha/post-training/index.d.ts.map +0 -1
  278. package/dist/resources/alpha/post-training/index.js +0 -15
  279. package/dist/resources/alpha/post-training/index.js.map +0 -1
  280. package/dist/resources/alpha/post-training/index.mjs +0 -10
  281. package/dist/resources/alpha/post-training/index.mjs.map +0 -1
  282. package/dist/resources/alpha/post-training/job.d.ts +0 -104
  283. package/dist/resources/alpha/post-training/job.d.ts.map +0 -1
  284. package/dist/resources/alpha/post-training/job.js +0 -42
  285. package/dist/resources/alpha/post-training/job.js.map +0 -1
  286. package/dist/resources/alpha/post-training/job.mjs +0 -38
  287. package/dist/resources/alpha/post-training/job.mjs.map +0 -1
  288. package/dist/resources/alpha/post-training/post-training.d.ts +0 -269
  289. package/dist/resources/alpha/post-training/post-training.d.ts.map +0 -1
  290. package/dist/resources/alpha/post-training/post-training.js.map +0 -1
  291. package/dist/resources/alpha/post-training/post-training.mjs +0 -30
  292. package/dist/resources/alpha/post-training/post-training.mjs.map +0 -1
  293. package/dist/resources/alpha/post-training.d.ts +0 -2
  294. package/dist/resources/alpha/post-training.d.ts.map +0 -1
  295. package/dist/resources/alpha/post-training.js +0 -25
  296. package/dist/resources/alpha/post-training.js.map +0 -1
  297. package/dist/resources/alpha/post-training.mjs.map +0 -1
  298. package/dist/resources/tool-runtime.d.ts +0 -152
  299. package/dist/resources/tool-runtime.d.ts.map +0 -1
  300. package/dist/resources/tool-runtime.js +0 -30
  301. package/dist/resources/tool-runtime.js.map +0 -1
  302. package/dist/resources/tool-runtime.mjs +0 -26
  303. package/dist/resources/tool-runtime.mjs.map +0 -1
  304. package/dist/resources/toolgroups.d.ts +0 -91
  305. package/dist/resources/toolgroups.d.ts.map +0 -1
  306. package/dist/resources/toolgroups.js +0 -54
  307. package/dist/resources/toolgroups.js.map +0 -1
  308. package/dist/resources/toolgroups.mjs +0 -50
  309. package/dist/resources/toolgroups.mjs.map +0 -1
  310. package/dist/resources/tools.d.ts +0 -26
  311. package/dist/resources/tools.d.ts.map +0 -1
  312. package/dist/resources/tools.js +0 -30
  313. package/dist/resources/tools.js.map +0 -1
  314. package/dist/resources/tools.mjs +0 -26
  315. package/dist/resources/tools.mjs.map +0 -1
  316. package/dist/src/resources/alpha/post-training/index.ts +0 -17
  317. package/dist/src/resources/alpha/post-training/job.ts +0 -161
  318. package/dist/src/resources/alpha/post-training/post-training.ts +0 -385
  319. package/dist/src/resources/tool-runtime.ts +0 -217
  320. package/dist/src/resources/toolgroups.ts +0 -135
  321. package/dist/src/resources/tools.ts +0 -52
  322. package/src/resources/alpha/post-training/index.ts +0 -17
  323. package/src/resources/alpha/post-training/job.ts +0 -161
  324. package/src/resources/alpha/post-training/post-training.ts +0 -385
  325. package/src/resources/tool-runtime.ts +0 -217
  326. package/src/resources/toolgroups.ts +0 -135
  327. package/src/resources/tools.ts +0 -52
  328. package/tests/api-resources/alpha/post-training/job.test.ts +0 -86
  329. package/tests/api-resources/alpha/post-training/post-training.test.ts +0 -134
  330. package/tests/api-resources/tool-runtime.test.ts +0 -68
  331. package/tests/api-resources/toolgroups.test.ts +0 -91
  332. package/tests/api-resources/tools.test.ts +0 -57
@@ -4,6 +4,14 @@ import * as Core from "../../core.js";
4
4
  import * as CompletionsAPI from "./completions.js";
5
5
  import * as ChatAPI from "./chat.js";
6
6
  import { Stream } from "../../streaming.js";
7
+ /**
8
+ * Llama Stack 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
+ */
7
15
  export declare class Completions extends APIResource {
8
16
  /**
9
17
  * Generate an OpenAI-compatible chat completion for the given messages using the
@@ -47,7 +55,15 @@ export interface CompletionCreateResponse {
47
55
  */
48
56
  object?: 'chat.completion';
49
57
  /**
50
- * Usage information for OpenAI chat completion.
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.
51
67
  */
52
68
  usage?: CompletionCreateResponse.Usage | null;
53
69
  }
@@ -67,277 +83,131 @@ export declare namespace CompletionCreateResponse {
67
83
  /**
68
84
  * The message from the model.
69
85
  */
70
- message: Choice.OpenAIUserMessageParamOutput | Choice.OpenAISystemMessageParam | Choice.OpenAIAssistantMessageParamOutput | Choice.OpenAIToolMessageParam | Choice.OpenAIDeveloperMessageParam;
86
+ message: Choice.Message;
71
87
  /**
72
- * The log probabilities for the tokens in the message from an OpenAI-compatible
73
- * chat completion response.
88
+ * The log probabilities for the tokens in the message.
74
89
  */
75
90
  logprobs?: Choice.Logprobs | null;
76
91
  }
77
92
  namespace Choice {
78
93
  /**
79
- * A message from the user in an OpenAI-compatible chat completion request.
80
- */
81
- interface OpenAIUserMessageParamOutput {
82
- /**
83
- * The content of the message, which can include text and other media.
84
- */
85
- content: string | Array<OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartTextParam | OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartImageParam | OpenAIUserMessageParamOutput.OpenAIFile>;
86
- /**
87
- * The name of the user message participant.
88
- */
89
- name?: string | null;
90
- /**
91
- * Must be 'user' to identify this as a user message.
92
- */
93
- role?: 'user';
94
- }
95
- namespace OpenAIUserMessageParamOutput {
96
- /**
97
- * Text content part for OpenAI-compatible chat completion messages.
98
- */
99
- interface OpenAIChatCompletionContentPartTextParam {
100
- /**
101
- * The text content of the message.
102
- */
103
- text: string;
104
- /**
105
- * Must be 'text' to identify this as text content.
106
- */
107
- type?: 'text';
108
- }
109
- /**
110
- * Image content part for OpenAI-compatible chat completion messages.
111
- */
112
- interface OpenAIChatCompletionContentPartImageParam {
113
- /**
114
- * Image URL specification and processing details.
115
- */
116
- image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
117
- /**
118
- * Must be 'image_url' to identify this as image content.
119
- */
120
- type?: 'image_url';
121
- }
122
- namespace OpenAIChatCompletionContentPartImageParam {
123
- /**
124
- * Image URL specification and processing details.
125
- */
126
- interface ImageURL {
127
- /**
128
- * URL of the image to include in the message.
129
- */
130
- url: string;
131
- /**
132
- * Level of detail for image processing. Can be 'low', 'high', or 'auto'.
133
- */
134
- detail?: 'low' | 'high' | 'auto' | null;
135
- }
136
- }
137
- interface OpenAIFile {
138
- /**
139
- * File specification.
140
- */
141
- file: OpenAIFile.File;
142
- /**
143
- * Must be 'file' to identify this as file content.
144
- */
145
- type?: 'file';
146
- }
147
- namespace OpenAIFile {
148
- /**
149
- * File specification.
150
- */
151
- interface File {
152
- /**
153
- * Base64-encoded file data.
154
- */
155
- file_data?: string | null;
156
- /**
157
- * ID of an uploaded file.
158
- */
159
- file_id?: string | null;
160
- /**
161
- * Name of the file.
162
- */
163
- filename?: string | null;
164
- }
165
- }
166
- }
167
- /**
168
- * A system message providing instructions or context to the model.
94
+ * The message from the model.
169
95
  */
170
- interface OpenAISystemMessageParam {
96
+ interface Message {
171
97
  /**
172
- * The content of the 'system prompt'. If multiple system messages are provided,
173
- * they are concatenated.
98
+ * Annotations for the message, when applicable.
174
99
  */
175
- content: string | Array<OpenAISystemMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
100
+ annotations?: Array<{
101
+ [key: string]: unknown;
102
+ }>;
176
103
  /**
177
- * The name of the system message participant.
104
+ * Audio response data when using audio output modality.
178
105
  */
179
- name?: string | null;
106
+ audio?: {
107
+ [key: string]: unknown;
108
+ } | null;
180
109
  /**
181
- * Must be 'system' to identify this as a system message.
110
+ * The content of the message.
182
111
  */
183
- role?: 'system';
184
- }
185
- namespace OpenAISystemMessageParam {
112
+ content?: string | null;
186
113
  /**
187
- * Text content part for OpenAI-compatible chat completion messages.
114
+ * Deprecated: the name and arguments of a function that should be called.
188
115
  */
189
- interface ListOpenAIChatCompletionContentPartTextParam {
190
- /**
191
- * The text content of the message.
192
- */
193
- text: string;
194
- /**
195
- * Must be 'text' to identify this as text content.
196
- */
197
- type?: 'text';
198
- }
199
- }
200
- /**
201
- * A message containing the model's (assistant) response in an OpenAI-compatible
202
- * chat completion request.
203
- */
204
- interface OpenAIAssistantMessageParamOutput {
205
- /**
206
- * The content of the model's response.
207
- */
208
- content?: string | Array<OpenAIAssistantMessageParamOutput.ListOpenAIChatCompletionContentPartTextParam> | null;
116
+ function_call?: Message.FunctionCall;
209
117
  /**
210
- * The name of the assistant message participant.
118
+ * The refusal message generated by the model.
211
119
  */
212
- name?: string | null;
120
+ refusal?: string | null;
213
121
  /**
214
- * Must be 'assistant' to identify this as the model's response.
122
+ * The role of the message author, always 'assistant' in responses.
215
123
  */
216
124
  role?: 'assistant';
217
125
  /**
218
- * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
126
+ * The tool calls generated by the model.
219
127
  */
220
- tool_calls?: Array<OpenAIAssistantMessageParamOutput.ToolCall> | null;
128
+ tool_calls?: Array<Message.Function | Message.Custom>;
221
129
  }
222
- namespace OpenAIAssistantMessageParamOutput {
130
+ namespace Message {
223
131
  /**
224
- * Text content part for OpenAI-compatible chat completion messages.
132
+ * Deprecated: the name and arguments of a function that should be called.
225
133
  */
226
- interface ListOpenAIChatCompletionContentPartTextParam {
134
+ interface FunctionCall {
227
135
  /**
228
- * The text content of the message.
136
+ * Arguments to pass to the function as a JSON string.
229
137
  */
230
- text: string;
138
+ arguments: string;
231
139
  /**
232
- * Must be 'text' to identify this as text content.
140
+ * Name of the function to call.
233
141
  */
234
- type?: 'text';
142
+ name: string;
235
143
  }
236
144
  /**
237
145
  * Tool call specification for OpenAI-compatible chat completion responses.
238
146
  */
239
- interface ToolCall {
147
+ interface Function {
240
148
  /**
241
149
  * Unique identifier for the tool call.
242
150
  */
243
- id?: string | null;
244
- /**
245
- * Function call details for OpenAI-compatible tool calls.
246
- */
247
- function?: ToolCall.Function | null;
151
+ id: string;
248
152
  /**
249
- * Index of the tool call in the list.
153
+ * Function call details.
250
154
  */
251
- index?: number | null;
155
+ function: Function.Function;
252
156
  /**
253
157
  * Must be 'function' to identify this as a function call.
254
158
  */
255
- type?: 'function';
159
+ type: 'function';
256
160
  }
257
- namespace ToolCall {
161
+ namespace Function {
258
162
  /**
259
- * Function call details for OpenAI-compatible tool calls.
163
+ * Function call details.
260
164
  */
261
165
  interface Function {
262
166
  /**
263
167
  * Arguments to pass to the function as a JSON string.
264
168
  */
265
- arguments?: string | null;
169
+ arguments: string;
266
170
  /**
267
171
  * Name of the function to call.
268
172
  */
269
- name?: string | null;
173
+ name: string;
270
174
  }
271
175
  }
272
- }
273
- /**
274
- * A message representing the result of a tool invocation in an OpenAI-compatible
275
- * chat completion request.
276
- */
277
- interface OpenAIToolMessageParam {
278
- /**
279
- * The response content from the tool.
280
- */
281
- content: string | Array<OpenAIToolMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
282
176
  /**
283
- * Unique identifier for the tool call this response is for.
177
+ * A call to a custom tool created by the model.
284
178
  */
285
- tool_call_id: string;
286
- /**
287
- * Must be 'tool' to identify this as a tool response.
288
- */
289
- role?: 'tool';
290
- }
291
- namespace OpenAIToolMessageParam {
292
- /**
293
- * Text content part for OpenAI-compatible chat completion messages.
294
- */
295
- interface ListOpenAIChatCompletionContentPartTextParam {
179
+ interface Custom {
296
180
  /**
297
- * The text content of the message.
181
+ * The ID of the tool call.
298
182
  */
299
- text: string;
183
+ id: string;
300
184
  /**
301
- * Must be 'text' to identify this as text content.
185
+ * The custom tool that the model called.
302
186
  */
303
- type?: 'text';
304
- }
305
- }
306
- /**
307
- * A message from the developer in an OpenAI-compatible chat completion request.
308
- */
309
- interface OpenAIDeveloperMessageParam {
310
- /**
311
- * The content of the developer message.
312
- */
313
- content: string | Array<OpenAIDeveloperMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
314
- /**
315
- * The name of the developer message participant.
316
- */
317
- name?: string | null;
318
- /**
319
- * Must be 'developer' to identify this as a developer message.
320
- */
321
- role?: 'developer';
322
- }
323
- namespace OpenAIDeveloperMessageParam {
324
- /**
325
- * Text content part for OpenAI-compatible chat completion messages.
326
- */
327
- interface ListOpenAIChatCompletionContentPartTextParam {
187
+ custom: Custom.Custom;
328
188
  /**
329
- * The text content of the message.
189
+ * The type of the tool. Always 'custom'.
330
190
  */
331
- text: string;
191
+ type: 'custom';
192
+ }
193
+ namespace Custom {
332
194
  /**
333
- * Must be 'text' to identify this as text content.
195
+ * The custom tool that the model called.
334
196
  */
335
- type?: 'text';
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
+ }
336
207
  }
337
208
  }
338
209
  /**
339
- * The log probabilities for the tokens in the message from an OpenAI-compatible
340
- * chat completion response.
210
+ * The log probabilities for the tokens in the message.
341
211
  */
342
212
  interface Logprobs {
343
213
  /**
@@ -437,51 +307,54 @@ export declare namespace CompletionCreateResponse {
437
307
  }
438
308
  }
439
309
  /**
440
- * Usage information for OpenAI chat completion.
310
+ * Token usage information for the completion.
441
311
  */
442
312
  interface Usage {
443
313
  /**
444
314
  * Number of tokens in the completion.
445
315
  */
446
- completion_tokens: number;
316
+ completion_tokens?: number;
447
317
  /**
448
- * Number of tokens in the prompt.
318
+ * Detailed breakdown of output token usage.
449
319
  */
450
- prompt_tokens: number;
320
+ completion_tokens_details?: Usage.CompletionTokensDetails;
451
321
  /**
452
- * Total tokens used (prompt + completion).
322
+ * Number of tokens in the prompt.
453
323
  */
454
- total_tokens: number;
324
+ prompt_tokens?: number;
455
325
  /**
456
- * Token details for output tokens in OpenAI chat completion usage.
326
+ * Detailed breakdown of input token usage.
457
327
  */
458
- completion_tokens_details?: Usage.CompletionTokensDetails | null;
328
+ prompt_tokens_details?: Usage.PromptTokensDetails;
459
329
  /**
460
- * Token details for prompt tokens in OpenAI chat completion usage.
330
+ * Total tokens used (prompt + completion).
461
331
  */
462
- prompt_tokens_details?: Usage.PromptTokensDetails | null;
332
+ total_tokens?: number;
463
333
  }
464
334
  namespace Usage {
465
335
  /**
466
- * Token details for output tokens in OpenAI chat completion usage.
336
+ * Detailed breakdown of output token usage.
467
337
  */
468
338
  interface CompletionTokensDetails {
469
339
  /**
470
340
  * Number of tokens used for reasoning (o1/o3 models).
471
341
  */
472
- reasoning_tokens?: number | null;
342
+ reasoning_tokens?: number;
473
343
  }
474
344
  /**
475
- * Token details for prompt tokens in OpenAI chat completion usage.
345
+ * Detailed breakdown of input token usage.
476
346
  */
477
347
  interface PromptTokensDetails {
478
348
  /**
479
349
  * Number of tokens retrieved from cache.
480
350
  */
481
- cached_tokens?: number | null;
351
+ cached_tokens?: number;
482
352
  }
483
353
  }
484
354
  }
355
+ /**
356
+ * Chat completion response extended with the original input messages.
357
+ */
485
358
  export interface CompletionRetrieveResponse {
486
359
  /**
487
360
  * The ID of the chat completion.
@@ -508,9 +381,17 @@ export interface CompletionRetrieveResponse {
508
381
  */
509
382
  object?: 'chat.completion';
510
383
  /**
511
- * Usage information for OpenAI chat completion.
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.
512
393
  */
513
- usage?: CompletionRetrieveResponse.Usage | null;
394
+ usage?: CompletionRetrieveResponse.Usage;
514
395
  }
515
396
  export declare namespace CompletionRetrieveResponse {
516
397
  /**
@@ -518,287 +399,141 @@ export declare namespace CompletionRetrieveResponse {
518
399
  */
519
400
  interface Choice {
520
401
  /**
521
- * The reason the model stopped generating.
522
- */
523
- finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call';
524
- /**
525
- * The index of the choice.
526
- */
527
- index: number;
528
- /**
529
- * The message from the model.
530
- */
531
- message: Choice.OpenAIUserMessageParamOutput | Choice.OpenAISystemMessageParam | Choice.OpenAIAssistantMessageParamOutput | Choice.OpenAIToolMessageParam | Choice.OpenAIDeveloperMessageParam;
532
- /**
533
- * The log probabilities for the tokens in the message from an OpenAI-compatible
534
- * chat completion response.
535
- */
536
- logprobs?: Choice.Logprobs | null;
537
- }
538
- namespace Choice {
539
- /**
540
- * A message from the user in an OpenAI-compatible chat completion request.
541
- */
542
- interface OpenAIUserMessageParamOutput {
543
- /**
544
- * The content of the message, which can include text and other media.
545
- */
546
- content: string | Array<OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartTextParam | OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartImageParam | OpenAIUserMessageParamOutput.OpenAIFile>;
547
- /**
548
- * The name of the user message participant.
549
- */
550
- name?: string | null;
551
- /**
552
- * Must be 'user' to identify this as a user message.
553
- */
554
- role?: 'user';
555
- }
556
- namespace OpenAIUserMessageParamOutput {
557
- /**
558
- * Text content part for OpenAI-compatible chat completion messages.
559
- */
560
- interface OpenAIChatCompletionContentPartTextParam {
561
- /**
562
- * The text content of the message.
563
- */
564
- text: string;
565
- /**
566
- * Must be 'text' to identify this as text content.
567
- */
568
- type?: 'text';
569
- }
570
- /**
571
- * Image content part for OpenAI-compatible chat completion messages.
572
- */
573
- interface OpenAIChatCompletionContentPartImageParam {
574
- /**
575
- * Image URL specification and processing details.
576
- */
577
- image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
578
- /**
579
- * Must be 'image_url' to identify this as image content.
580
- */
581
- type?: 'image_url';
582
- }
583
- namespace OpenAIChatCompletionContentPartImageParam {
584
- /**
585
- * Image URL specification and processing details.
586
- */
587
- interface ImageURL {
588
- /**
589
- * URL of the image to include in the message.
590
- */
591
- url: string;
592
- /**
593
- * Level of detail for image processing. Can be 'low', 'high', or 'auto'.
594
- */
595
- detail?: 'low' | 'high' | 'auto' | null;
596
- }
597
- }
598
- interface OpenAIFile {
599
- /**
600
- * File specification.
601
- */
602
- file: OpenAIFile.File;
603
- /**
604
- * Must be 'file' to identify this as file content.
605
- */
606
- type?: 'file';
607
- }
608
- namespace OpenAIFile {
609
- /**
610
- * File specification.
611
- */
612
- interface File {
613
- /**
614
- * Base64-encoded file data.
615
- */
616
- file_data?: string | null;
617
- /**
618
- * ID of an uploaded file.
619
- */
620
- file_id?: string | null;
621
- /**
622
- * Name of the file.
623
- */
624
- filename?: string | null;
625
- }
626
- }
627
- }
628
- /**
629
- * A system message providing instructions or context to the model.
402
+ * The reason the model stopped generating.
630
403
  */
631
- interface OpenAISystemMessageParam {
632
- /**
633
- * The content of the 'system prompt'. If multiple system messages are provided,
634
- * they are concatenated.
635
- */
636
- content: string | Array<OpenAISystemMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
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 {
637
423
  /**
638
- * The name of the system message participant.
424
+ * Annotations for the message, when applicable.
639
425
  */
640
- name?: string | null;
426
+ annotations?: Array<{
427
+ [key: string]: unknown;
428
+ }>;
641
429
  /**
642
- * Must be 'system' to identify this as a system message.
430
+ * Audio response data when using audio output modality.
643
431
  */
644
- role?: 'system';
645
- }
646
- namespace OpenAISystemMessageParam {
432
+ audio?: {
433
+ [key: string]: unknown;
434
+ } | null;
647
435
  /**
648
- * Text content part for OpenAI-compatible chat completion messages.
436
+ * The content of the message.
649
437
  */
650
- interface ListOpenAIChatCompletionContentPartTextParam {
651
- /**
652
- * The text content of the message.
653
- */
654
- text: string;
655
- /**
656
- * Must be 'text' to identify this as text content.
657
- */
658
- type?: 'text';
659
- }
660
- }
661
- /**
662
- * A message containing the model's (assistant) response in an OpenAI-compatible
663
- * chat completion request.
664
- */
665
- interface OpenAIAssistantMessageParamOutput {
438
+ content?: string | null;
666
439
  /**
667
- * The content of the model's response.
440
+ * Deprecated: the name and arguments of a function that should be called.
668
441
  */
669
- content?: string | Array<OpenAIAssistantMessageParamOutput.ListOpenAIChatCompletionContentPartTextParam> | null;
442
+ function_call?: Message.FunctionCall;
670
443
  /**
671
- * The name of the assistant message participant.
444
+ * The refusal message generated by the model.
672
445
  */
673
- name?: string | null;
446
+ refusal?: string | null;
674
447
  /**
675
- * Must be 'assistant' to identify this as the model's response.
448
+ * The role of the message author, always 'assistant' in responses.
676
449
  */
677
450
  role?: 'assistant';
678
451
  /**
679
- * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
452
+ * The tool calls generated by the model.
680
453
  */
681
- tool_calls?: Array<OpenAIAssistantMessageParamOutput.ToolCall> | null;
454
+ tool_calls?: Array<Message.Function | Message.Custom>;
682
455
  }
683
- namespace OpenAIAssistantMessageParamOutput {
456
+ namespace Message {
684
457
  /**
685
- * Text content part for OpenAI-compatible chat completion messages.
458
+ * Deprecated: the name and arguments of a function that should be called.
686
459
  */
687
- interface ListOpenAIChatCompletionContentPartTextParam {
460
+ interface FunctionCall {
688
461
  /**
689
- * The text content of the message.
462
+ * Arguments to pass to the function as a JSON string.
690
463
  */
691
- text: string;
464
+ arguments: string;
692
465
  /**
693
- * Must be 'text' to identify this as text content.
466
+ * Name of the function to call.
694
467
  */
695
- type?: 'text';
468
+ name: string;
696
469
  }
697
470
  /**
698
471
  * Tool call specification for OpenAI-compatible chat completion responses.
699
472
  */
700
- interface ToolCall {
473
+ interface Function {
701
474
  /**
702
475
  * Unique identifier for the tool call.
703
476
  */
704
- id?: string | null;
477
+ id: string;
705
478
  /**
706
- * Function call details for OpenAI-compatible tool calls.
479
+ * Function call details.
707
480
  */
708
- function?: ToolCall.Function | null;
709
- /**
710
- * Index of the tool call in the list.
711
- */
712
- index?: number | null;
481
+ function: Function.Function;
713
482
  /**
714
483
  * Must be 'function' to identify this as a function call.
715
484
  */
716
- type?: 'function';
485
+ type: 'function';
717
486
  }
718
- namespace ToolCall {
487
+ namespace Function {
719
488
  /**
720
- * Function call details for OpenAI-compatible tool calls.
489
+ * Function call details.
721
490
  */
722
491
  interface Function {
723
492
  /**
724
493
  * Arguments to pass to the function as a JSON string.
725
494
  */
726
- arguments?: string | null;
495
+ arguments: string;
727
496
  /**
728
497
  * Name of the function to call.
729
498
  */
730
- name?: string | null;
499
+ name: string;
731
500
  }
732
501
  }
733
- }
734
- /**
735
- * A message representing the result of a tool invocation in an OpenAI-compatible
736
- * chat completion request.
737
- */
738
- interface OpenAIToolMessageParam {
739
- /**
740
- * The response content from the tool.
741
- */
742
- content: string | Array<OpenAIToolMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
743
- /**
744
- * Unique identifier for the tool call this response is for.
745
- */
746
- tool_call_id: string;
747
- /**
748
- * Must be 'tool' to identify this as a tool response.
749
- */
750
- role?: 'tool';
751
- }
752
- namespace OpenAIToolMessageParam {
753
502
  /**
754
- * Text content part for OpenAI-compatible chat completion messages.
503
+ * A call to a custom tool created by the model.
755
504
  */
756
- interface ListOpenAIChatCompletionContentPartTextParam {
505
+ interface Custom {
757
506
  /**
758
- * The text content of the message.
507
+ * The ID of the tool call.
759
508
  */
760
- text: string;
509
+ id: string;
761
510
  /**
762
- * Must be 'text' to identify this as text content.
511
+ * The custom tool that the model called.
763
512
  */
764
- type?: 'text';
765
- }
766
- }
767
- /**
768
- * A message from the developer in an OpenAI-compatible chat completion request.
769
- */
770
- interface OpenAIDeveloperMessageParam {
771
- /**
772
- * The content of the developer message.
773
- */
774
- content: string | Array<OpenAIDeveloperMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
775
- /**
776
- * The name of the developer message participant.
777
- */
778
- name?: string | null;
779
- /**
780
- * Must be 'developer' to identify this as a developer message.
781
- */
782
- role?: 'developer';
783
- }
784
- namespace OpenAIDeveloperMessageParam {
785
- /**
786
- * Text content part for OpenAI-compatible chat completion messages.
787
- */
788
- interface ListOpenAIChatCompletionContentPartTextParam {
513
+ custom: Custom.Custom;
789
514
  /**
790
- * The text content of the message.
515
+ * The type of the tool. Always 'custom'.
791
516
  */
792
- text: string;
517
+ type: 'custom';
518
+ }
519
+ namespace Custom {
793
520
  /**
794
- * Must be 'text' to identify this as text content.
521
+ * The custom tool that the model called.
795
522
  */
796
- type?: 'text';
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
+ }
797
533
  }
798
534
  }
799
535
  /**
800
- * The log probabilities for the tokens in the message from an OpenAI-compatible
801
- * chat completion response.
536
+ * The log probabilities for the tokens in the message.
802
537
  */
803
538
  interface Logprobs {
804
539
  /**
@@ -956,6 +691,9 @@ export declare namespace CompletionRetrieveResponse {
956
691
  detail?: 'low' | 'high' | 'auto' | null;
957
692
  }
958
693
  }
694
+ /**
695
+ * File content part for OpenAI-compatible chat completion messages.
696
+ */
959
697
  interface OpenAIFile {
960
698
  /**
961
699
  * File specification.
@@ -1040,6 +778,7 @@ export declare namespace CompletionRetrieveResponse {
1040
778
  * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
1041
779
  */
1042
780
  tool_calls?: Array<OpenAIAssistantMessageParamOutput.ToolCall> | null;
781
+ [k: string]: unknown;
1043
782
  }
1044
783
  namespace OpenAIAssistantMessageParamOutput {
1045
784
  /**
@@ -1062,33 +801,29 @@ export declare namespace CompletionRetrieveResponse {
1062
801
  /**
1063
802
  * Unique identifier for the tool call.
1064
803
  */
1065
- id?: string | null;
1066
- /**
1067
- * Function call details for OpenAI-compatible tool calls.
1068
- */
1069
- function?: ToolCall.Function | null;
804
+ id: string;
1070
805
  /**
1071
- * Index of the tool call in the list.
806
+ * Function call details.
1072
807
  */
1073
- index?: number | null;
808
+ function: ToolCall.Function;
1074
809
  /**
1075
810
  * Must be 'function' to identify this as a function call.
1076
811
  */
1077
- type?: 'function';
812
+ type: 'function';
1078
813
  }
1079
814
  namespace ToolCall {
1080
815
  /**
1081
- * Function call details for OpenAI-compatible tool calls.
816
+ * Function call details.
1082
817
  */
1083
818
  interface Function {
1084
819
  /**
1085
820
  * Arguments to pass to the function as a JSON string.
1086
821
  */
1087
- arguments?: string | null;
822
+ arguments: string;
1088
823
  /**
1089
824
  * Name of the function to call.
1090
825
  */
1091
- name?: string | null;
826
+ name: string;
1092
827
  }
1093
828
  }
1094
829
  }
@@ -1158,48 +893,48 @@ export declare namespace CompletionRetrieveResponse {
1158
893
  }
1159
894
  }
1160
895
  /**
1161
- * Usage information for OpenAI chat completion.
896
+ * Token usage information for the completion.
1162
897
  */
1163
898
  interface Usage {
1164
899
  /**
1165
900
  * Number of tokens in the completion.
1166
901
  */
1167
- completion_tokens: number;
902
+ completion_tokens?: number;
1168
903
  /**
1169
- * Number of tokens in the prompt.
904
+ * Detailed breakdown of output token usage.
1170
905
  */
1171
- prompt_tokens: number;
906
+ completion_tokens_details?: Usage.CompletionTokensDetails;
1172
907
  /**
1173
- * Total tokens used (prompt + completion).
908
+ * Number of tokens in the prompt.
1174
909
  */
1175
- total_tokens: number;
910
+ prompt_tokens?: number;
1176
911
  /**
1177
- * Token details for output tokens in OpenAI chat completion usage.
912
+ * Detailed breakdown of input token usage.
1178
913
  */
1179
- completion_tokens_details?: Usage.CompletionTokensDetails | null;
914
+ prompt_tokens_details?: Usage.PromptTokensDetails;
1180
915
  /**
1181
- * Token details for prompt tokens in OpenAI chat completion usage.
916
+ * Total tokens used (prompt + completion).
1182
917
  */
1183
- prompt_tokens_details?: Usage.PromptTokensDetails | null;
918
+ total_tokens?: number;
1184
919
  }
1185
920
  namespace Usage {
1186
921
  /**
1187
- * Token details for output tokens in OpenAI chat completion usage.
922
+ * Detailed breakdown of output token usage.
1188
923
  */
1189
924
  interface CompletionTokensDetails {
1190
925
  /**
1191
926
  * Number of tokens used for reasoning (o1/o3 models).
1192
927
  */
1193
- reasoning_tokens?: number | null;
928
+ reasoning_tokens?: number;
1194
929
  }
1195
930
  /**
1196
- * Token details for prompt tokens in OpenAI chat completion usage.
931
+ * Detailed breakdown of input token usage.
1197
932
  */
1198
933
  interface PromptTokensDetails {
1199
934
  /**
1200
935
  * Number of tokens retrieved from cache.
1201
936
  */
1202
- cached_tokens?: number | null;
937
+ cached_tokens?: number;
1203
938
  }
1204
939
  }
1205
940
  }
@@ -1229,6 +964,9 @@ export interface CompletionListResponse {
1229
964
  object?: 'list';
1230
965
  }
1231
966
  export declare namespace CompletionListResponse {
967
+ /**
968
+ * Chat completion response extended with the original input messages.
969
+ */
1232
970
  interface Data {
1233
971
  /**
1234
972
  * The ID of the chat completion.
@@ -1255,9 +993,17 @@ export declare namespace CompletionListResponse {
1255
993
  */
1256
994
  object?: 'chat.completion';
1257
995
  /**
1258
- * Usage information for OpenAI chat completion.
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.
1259
1005
  */
1260
- usage?: Data.Usage | null;
1006
+ usage?: Data.Usage;
1261
1007
  }
1262
1008
  namespace Data {
1263
1009
  /**
@@ -1275,277 +1021,131 @@ export declare namespace CompletionListResponse {
1275
1021
  /**
1276
1022
  * The message from the model.
1277
1023
  */
1278
- message: Choice.OpenAIUserMessageParamOutput | Choice.OpenAISystemMessageParam | Choice.OpenAIAssistantMessageParamOutput | Choice.OpenAIToolMessageParam | Choice.OpenAIDeveloperMessageParam;
1024
+ message: Choice.Message;
1279
1025
  /**
1280
- * The log probabilities for the tokens in the message from an OpenAI-compatible
1281
- * chat completion response.
1026
+ * The log probabilities for the tokens in the message.
1282
1027
  */
1283
1028
  logprobs?: Choice.Logprobs | null;
1284
1029
  }
1285
1030
  namespace Choice {
1286
1031
  /**
1287
- * A message from the user in an OpenAI-compatible chat completion request.
1288
- */
1289
- interface OpenAIUserMessageParamOutput {
1290
- /**
1291
- * The content of the message, which can include text and other media.
1292
- */
1293
- content: string | Array<OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartTextParam | OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartImageParam | OpenAIUserMessageParamOutput.OpenAIFile>;
1294
- /**
1295
- * The name of the user message participant.
1296
- */
1297
- name?: string | null;
1298
- /**
1299
- * Must be 'user' to identify this as a user message.
1300
- */
1301
- role?: 'user';
1302
- }
1303
- namespace OpenAIUserMessageParamOutput {
1304
- /**
1305
- * Text content part for OpenAI-compatible chat completion messages.
1306
- */
1307
- interface OpenAIChatCompletionContentPartTextParam {
1308
- /**
1309
- * The text content of the message.
1310
- */
1311
- text: string;
1312
- /**
1313
- * Must be 'text' to identify this as text content.
1314
- */
1315
- type?: 'text';
1316
- }
1317
- /**
1318
- * Image content part for OpenAI-compatible chat completion messages.
1319
- */
1320
- interface OpenAIChatCompletionContentPartImageParam {
1321
- /**
1322
- * Image URL specification and processing details.
1323
- */
1324
- image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
1325
- /**
1326
- * Must be 'image_url' to identify this as image content.
1327
- */
1328
- type?: 'image_url';
1329
- }
1330
- namespace OpenAIChatCompletionContentPartImageParam {
1331
- /**
1332
- * Image URL specification and processing details.
1333
- */
1334
- interface ImageURL {
1335
- /**
1336
- * URL of the image to include in the message.
1337
- */
1338
- url: string;
1339
- /**
1340
- * Level of detail for image processing. Can be 'low', 'high', or 'auto'.
1341
- */
1342
- detail?: 'low' | 'high' | 'auto' | null;
1343
- }
1344
- }
1345
- interface OpenAIFile {
1346
- /**
1347
- * File specification.
1348
- */
1349
- file: OpenAIFile.File;
1350
- /**
1351
- * Must be 'file' to identify this as file content.
1352
- */
1353
- type?: 'file';
1354
- }
1355
- namespace OpenAIFile {
1356
- /**
1357
- * File specification.
1358
- */
1359
- interface File {
1360
- /**
1361
- * Base64-encoded file data.
1362
- */
1363
- file_data?: string | null;
1364
- /**
1365
- * ID of an uploaded file.
1366
- */
1367
- file_id?: string | null;
1368
- /**
1369
- * Name of the file.
1370
- */
1371
- filename?: string | null;
1372
- }
1373
- }
1374
- }
1375
- /**
1376
- * A system message providing instructions or context to the model.
1032
+ * The message from the model.
1377
1033
  */
1378
- interface OpenAISystemMessageParam {
1379
- /**
1380
- * The content of the 'system prompt'. If multiple system messages are provided,
1381
- * they are concatenated.
1382
- */
1383
- content: string | Array<OpenAISystemMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
1034
+ interface Message {
1384
1035
  /**
1385
- * The name of the system message participant.
1036
+ * Annotations for the message, when applicable.
1386
1037
  */
1387
- name?: string | null;
1038
+ annotations?: Array<{
1039
+ [key: string]: unknown;
1040
+ }>;
1388
1041
  /**
1389
- * Must be 'system' to identify this as a system message.
1042
+ * Audio response data when using audio output modality.
1390
1043
  */
1391
- role?: 'system';
1392
- }
1393
- namespace OpenAISystemMessageParam {
1044
+ audio?: {
1045
+ [key: string]: unknown;
1046
+ } | null;
1394
1047
  /**
1395
- * Text content part for OpenAI-compatible chat completion messages.
1048
+ * The content of the message.
1396
1049
  */
1397
- interface ListOpenAIChatCompletionContentPartTextParam {
1398
- /**
1399
- * The text content of the message.
1400
- */
1401
- text: string;
1402
- /**
1403
- * Must be 'text' to identify this as text content.
1404
- */
1405
- type?: 'text';
1406
- }
1407
- }
1408
- /**
1409
- * A message containing the model's (assistant) response in an OpenAI-compatible
1410
- * chat completion request.
1411
- */
1412
- interface OpenAIAssistantMessageParamOutput {
1050
+ content?: string | null;
1413
1051
  /**
1414
- * The content of the model's response.
1052
+ * Deprecated: the name and arguments of a function that should be called.
1415
1053
  */
1416
- content?: string | Array<OpenAIAssistantMessageParamOutput.ListOpenAIChatCompletionContentPartTextParam> | null;
1054
+ function_call?: Message.FunctionCall;
1417
1055
  /**
1418
- * The name of the assistant message participant.
1056
+ * The refusal message generated by the model.
1419
1057
  */
1420
- name?: string | null;
1058
+ refusal?: string | null;
1421
1059
  /**
1422
- * Must be 'assistant' to identify this as the model's response.
1060
+ * The role of the message author, always 'assistant' in responses.
1423
1061
  */
1424
1062
  role?: 'assistant';
1425
1063
  /**
1426
- * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
1064
+ * The tool calls generated by the model.
1427
1065
  */
1428
- tool_calls?: Array<OpenAIAssistantMessageParamOutput.ToolCall> | null;
1066
+ tool_calls?: Array<Message.Function | Message.Custom>;
1429
1067
  }
1430
- namespace OpenAIAssistantMessageParamOutput {
1068
+ namespace Message {
1431
1069
  /**
1432
- * Text content part for OpenAI-compatible chat completion messages.
1070
+ * Deprecated: the name and arguments of a function that should be called.
1433
1071
  */
1434
- interface ListOpenAIChatCompletionContentPartTextParam {
1072
+ interface FunctionCall {
1435
1073
  /**
1436
- * The text content of the message.
1074
+ * Arguments to pass to the function as a JSON string.
1437
1075
  */
1438
- text: string;
1076
+ arguments: string;
1439
1077
  /**
1440
- * Must be 'text' to identify this as text content.
1078
+ * Name of the function to call.
1441
1079
  */
1442
- type?: 'text';
1080
+ name: string;
1443
1081
  }
1444
1082
  /**
1445
1083
  * Tool call specification for OpenAI-compatible chat completion responses.
1446
1084
  */
1447
- interface ToolCall {
1085
+ interface Function {
1448
1086
  /**
1449
1087
  * Unique identifier for the tool call.
1450
1088
  */
1451
- id?: string | null;
1089
+ id: string;
1452
1090
  /**
1453
- * Function call details for OpenAI-compatible tool calls.
1091
+ * Function call details.
1454
1092
  */
1455
- function?: ToolCall.Function | null;
1456
- /**
1457
- * Index of the tool call in the list.
1458
- */
1459
- index?: number | null;
1093
+ function: Function.Function;
1460
1094
  /**
1461
1095
  * Must be 'function' to identify this as a function call.
1462
1096
  */
1463
- type?: 'function';
1097
+ type: 'function';
1464
1098
  }
1465
- namespace ToolCall {
1099
+ namespace Function {
1466
1100
  /**
1467
- * Function call details for OpenAI-compatible tool calls.
1101
+ * Function call details.
1468
1102
  */
1469
1103
  interface Function {
1470
1104
  /**
1471
1105
  * Arguments to pass to the function as a JSON string.
1472
1106
  */
1473
- arguments?: string | null;
1107
+ arguments: string;
1474
1108
  /**
1475
1109
  * Name of the function to call.
1476
1110
  */
1477
- name?: string | null;
1111
+ name: string;
1478
1112
  }
1479
1113
  }
1480
- }
1481
- /**
1482
- * A message representing the result of a tool invocation in an OpenAI-compatible
1483
- * chat completion request.
1484
- */
1485
- interface OpenAIToolMessageParam {
1486
- /**
1487
- * The response content from the tool.
1488
- */
1489
- content: string | Array<OpenAIToolMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
1490
- /**
1491
- * Unique identifier for the tool call this response is for.
1492
- */
1493
- tool_call_id: string;
1494
- /**
1495
- * Must be 'tool' to identify this as a tool response.
1496
- */
1497
- role?: 'tool';
1498
- }
1499
- namespace OpenAIToolMessageParam {
1500
1114
  /**
1501
- * Text content part for OpenAI-compatible chat completion messages.
1115
+ * A call to a custom tool created by the model.
1502
1116
  */
1503
- interface ListOpenAIChatCompletionContentPartTextParam {
1117
+ interface Custom {
1504
1118
  /**
1505
- * The text content of the message.
1119
+ * The ID of the tool call.
1506
1120
  */
1507
- text: string;
1121
+ id: string;
1508
1122
  /**
1509
- * Must be 'text' to identify this as text content.
1123
+ * The custom tool that the model called.
1510
1124
  */
1511
- type?: 'text';
1512
- }
1513
- }
1514
- /**
1515
- * A message from the developer in an OpenAI-compatible chat completion request.
1516
- */
1517
- interface OpenAIDeveloperMessageParam {
1518
- /**
1519
- * The content of the developer message.
1520
- */
1521
- content: string | Array<OpenAIDeveloperMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
1522
- /**
1523
- * The name of the developer message participant.
1524
- */
1525
- name?: string | null;
1526
- /**
1527
- * Must be 'developer' to identify this as a developer message.
1528
- */
1529
- role?: 'developer';
1530
- }
1531
- namespace OpenAIDeveloperMessageParam {
1532
- /**
1533
- * Text content part for OpenAI-compatible chat completion messages.
1534
- */
1535
- interface ListOpenAIChatCompletionContentPartTextParam {
1125
+ custom: Custom.Custom;
1536
1126
  /**
1537
- * The text content of the message.
1127
+ * The type of the tool. Always 'custom'.
1538
1128
  */
1539
- text: string;
1129
+ type: 'custom';
1130
+ }
1131
+ namespace Custom {
1540
1132
  /**
1541
- * Must be 'text' to identify this as text content.
1133
+ * The custom tool that the model called.
1542
1134
  */
1543
- type?: 'text';
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
+ }
1544
1145
  }
1545
1146
  }
1546
1147
  /**
1547
- * The log probabilities for the tokens in the message from an OpenAI-compatible
1548
- * chat completion response.
1148
+ * The log probabilities for the tokens in the message.
1549
1149
  */
1550
1150
  interface Logprobs {
1551
1151
  /**
@@ -1703,6 +1303,9 @@ export declare namespace CompletionListResponse {
1703
1303
  detail?: 'low' | 'high' | 'auto' | null;
1704
1304
  }
1705
1305
  }
1306
+ /**
1307
+ * File content part for OpenAI-compatible chat completion messages.
1308
+ */
1706
1309
  interface OpenAIFile {
1707
1310
  /**
1708
1311
  * File specification.
@@ -1787,6 +1390,7 @@ export declare namespace CompletionListResponse {
1787
1390
  * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
1788
1391
  */
1789
1392
  tool_calls?: Array<OpenAIAssistantMessageParamOutput.ToolCall> | null;
1393
+ [k: string]: unknown;
1790
1394
  }
1791
1395
  namespace OpenAIAssistantMessageParamOutput {
1792
1396
  /**
@@ -1809,33 +1413,29 @@ export declare namespace CompletionListResponse {
1809
1413
  /**
1810
1414
  * Unique identifier for the tool call.
1811
1415
  */
1812
- id?: string | null;
1813
- /**
1814
- * Function call details for OpenAI-compatible tool calls.
1815
- */
1816
- function?: ToolCall.Function | null;
1416
+ id: string;
1817
1417
  /**
1818
- * Index of the tool call in the list.
1418
+ * Function call details.
1819
1419
  */
1820
- index?: number | null;
1420
+ function: ToolCall.Function;
1821
1421
  /**
1822
1422
  * Must be 'function' to identify this as a function call.
1823
1423
  */
1824
- type?: 'function';
1424
+ type: 'function';
1825
1425
  }
1826
1426
  namespace ToolCall {
1827
1427
  /**
1828
- * Function call details for OpenAI-compatible tool calls.
1428
+ * Function call details.
1829
1429
  */
1830
1430
  interface Function {
1831
1431
  /**
1832
1432
  * Arguments to pass to the function as a JSON string.
1833
1433
  */
1834
- arguments?: string | null;
1434
+ arguments: string;
1835
1435
  /**
1836
1436
  * Name of the function to call.
1837
1437
  */
1838
- name?: string | null;
1438
+ name: string;
1839
1439
  }
1840
1440
  }
1841
1441
  }
@@ -1905,48 +1505,48 @@ export declare namespace CompletionListResponse {
1905
1505
  }
1906
1506
  }
1907
1507
  /**
1908
- * Usage information for OpenAI chat completion.
1508
+ * Token usage information for the completion.
1909
1509
  */
1910
1510
  interface Usage {
1911
1511
  /**
1912
1512
  * Number of tokens in the completion.
1913
1513
  */
1914
- completion_tokens: number;
1514
+ completion_tokens?: number;
1915
1515
  /**
1916
- * Number of tokens in the prompt.
1516
+ * Detailed breakdown of output token usage.
1917
1517
  */
1918
- prompt_tokens: number;
1518
+ completion_tokens_details?: Usage.CompletionTokensDetails;
1919
1519
  /**
1920
- * Total tokens used (prompt + completion).
1520
+ * Number of tokens in the prompt.
1921
1521
  */
1922
- total_tokens: number;
1522
+ prompt_tokens?: number;
1923
1523
  /**
1924
- * Token details for output tokens in OpenAI chat completion usage.
1524
+ * Detailed breakdown of input token usage.
1925
1525
  */
1926
- completion_tokens_details?: Usage.CompletionTokensDetails | null;
1526
+ prompt_tokens_details?: Usage.PromptTokensDetails;
1927
1527
  /**
1928
- * Token details for prompt tokens in OpenAI chat completion usage.
1528
+ * Total tokens used (prompt + completion).
1929
1529
  */
1930
- prompt_tokens_details?: Usage.PromptTokensDetails | null;
1530
+ total_tokens?: number;
1931
1531
  }
1932
1532
  namespace Usage {
1933
1533
  /**
1934
- * Token details for output tokens in OpenAI chat completion usage.
1534
+ * Detailed breakdown of output token usage.
1935
1535
  */
1936
1536
  interface CompletionTokensDetails {
1937
1537
  /**
1938
1538
  * Number of tokens used for reasoning (o1/o3 models).
1939
1539
  */
1940
- reasoning_tokens?: number | null;
1540
+ reasoning_tokens?: number;
1941
1541
  }
1942
1542
  /**
1943
- * Token details for prompt tokens in OpenAI chat completion usage.
1543
+ * Detailed breakdown of input token usage.
1944
1544
  */
1945
1545
  interface PromptTokensDetails {
1946
1546
  /**
1947
1547
  * Number of tokens retrieved from cache.
1948
1548
  */
1949
- cached_tokens?: number | null;
1549
+ cached_tokens?: number;
1950
1550
  }
1951
1551
  }
1952
1552
  }
@@ -2007,6 +1607,10 @@ export interface CompletionCreateParamsBase {
2007
1607
  * The penalty for repeated tokens.
2008
1608
  */
2009
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;
2010
1614
  /**
2011
1615
  * The effort level for reasoning models.
2012
1616
  */
@@ -2023,6 +1627,10 @@ export interface CompletionCreateParamsBase {
2023
1627
  * The seed to use.
2024
1628
  */
2025
1629
  seed?: number | null;
1630
+ /**
1631
+ * The service tier for the request.
1632
+ */
1633
+ service_tier?: 'auto' | 'default' | 'flex' | 'priority' | null;
2026
1634
  /**
2027
1635
  * The stop tokens to use.
2028
1636
  */
@@ -2054,7 +1662,7 @@ export interface CompletionCreateParamsBase {
2054
1662
  [key: string]: unknown;
2055
1663
  }> | null;
2056
1664
  /**
2057
- * The top log probabilities to use.
1665
+ * The number of most likely tokens to return at each position.
2058
1666
  */
2059
1667
  top_logprobs?: number | null;
2060
1668
  /**
@@ -2127,6 +1735,9 @@ export declare namespace CompletionCreateParams {
2127
1735
  detail?: 'low' | 'high' | 'auto' | null;
2128
1736
  }
2129
1737
  }
1738
+ /**
1739
+ * File content part for OpenAI-compatible chat completion messages.
1740
+ */
2130
1741
  interface OpenAIFile {
2131
1742
  /**
2132
1743
  * File specification.
@@ -2211,6 +1822,7 @@ export declare namespace CompletionCreateParams {
2211
1822
  * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
2212
1823
  */
2213
1824
  tool_calls?: Array<OpenAIAssistantMessageParamInput.ToolCall> | null;
1825
+ [k: string]: unknown;
2214
1826
  }
2215
1827
  namespace OpenAIAssistantMessageParamInput {
2216
1828
  /**
@@ -2233,33 +1845,29 @@ export declare namespace CompletionCreateParams {
2233
1845
  /**
2234
1846
  * Unique identifier for the tool call.
2235
1847
  */
2236
- id?: string | null;
2237
- /**
2238
- * Function call details for OpenAI-compatible tool calls.
2239
- */
2240
- function?: ToolCall.Function | null;
1848
+ id: string;
2241
1849
  /**
2242
- * Index of the tool call in the list.
1850
+ * Function call details.
2243
1851
  */
2244
- index?: number | null;
1852
+ function: ToolCall.Function;
2245
1853
  /**
2246
1854
  * Must be 'function' to identify this as a function call.
2247
1855
  */
2248
- type?: 'function';
1856
+ type: 'function';
2249
1857
  }
2250
1858
  namespace ToolCall {
2251
1859
  /**
2252
- * Function call details for OpenAI-compatible tool calls.
1860
+ * Function call details.
2253
1861
  */
2254
1862
  interface Function {
2255
1863
  /**
2256
1864
  * Arguments to pass to the function as a JSON string.
2257
1865
  */
2258
- arguments?: string | null;
1866
+ arguments: string;
2259
1867
  /**
2260
1868
  * Name of the function to call.
2261
1869
  */
2262
- name?: string | null;
1870
+ name: string;
2263
1871
  }
2264
1872
  }
2265
1873
  }
@@ -2403,7 +2011,7 @@ export interface CompletionListParams {
2403
2011
  */
2404
2012
  model?: string | null;
2405
2013
  /**
2406
- * Sort order for paginated responses.
2014
+ * The order to sort the chat completions by: "asc" or "desc". Defaults to "desc".
2407
2015
  */
2408
2016
  order?: 'asc' | 'desc' | null;
2409
2017
  }