ogx-client 0.8.0 → 1.0.1

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
@@ -7,25 +7,81 @@
7
7
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8
8
 
9
9
  import { APIResource } from '../../resource';
10
+ import { isRequestOptions } from '../../core';
10
11
  import * as Core from '../../core';
11
12
  import * as OpenAIAPI from './openai';
12
- import { OpenAI } from './openai';
13
+ import { OpenAI, OpenAIListParams, OpenAIListResponse } from './openai';
13
14
 
14
15
  export class Models extends APIResource {
15
16
  openai: OpenAIAPI.OpenAI = new OpenAIAPI.OpenAI(this._client);
16
17
 
17
18
  /**
18
- * Get a model by its identifier.
19
+ * Get a model by its identifier. Returns OpenAI, Anthropic, or Google response
20
+ * format based on SDK detection headers.
19
21
  */
20
- retrieve(modelId: string, options?: Core.RequestOptions): Core.APIPromise<ModelRetrieveResponse> {
21
- return this._client.get(`/v1/models/${modelId}`, options);
22
+ retrieve(
23
+ modelId: string,
24
+ params?: ModelRetrieveParams,
25
+ options?: Core.RequestOptions,
26
+ ): Core.APIPromise<ModelRetrieveResponse>;
27
+ retrieve(modelId: string, options?: Core.RequestOptions): Core.APIPromise<ModelRetrieveResponse>;
28
+ retrieve(
29
+ modelId: string,
30
+ params: ModelRetrieveParams | Core.RequestOptions = {},
31
+ options?: Core.RequestOptions,
32
+ ): Core.APIPromise<ModelRetrieveResponse> {
33
+ if (isRequestOptions(params)) {
34
+ return this.retrieve(modelId, {}, params);
35
+ }
36
+ const {
37
+ 'anthropic-version': anthropicVersion,
38
+ 'x-goog-api-client': xGoogAPIClient,
39
+ 'x-goog-api-key': xGoogAPIKey,
40
+ 'x-goog-user-project': xGoogUserProject,
41
+ } = params;
42
+ return this._client.get(`/v1/models/${modelId}`, {
43
+ ...options,
44
+ headers: {
45
+ ...(anthropicVersion != null ? { 'anthropic-version': anthropicVersion } : undefined),
46
+ ...(xGoogAPIClient != null ? { 'x-goog-api-client': xGoogAPIClient } : undefined),
47
+ ...(xGoogAPIKey != null ? { 'x-goog-api-key': xGoogAPIKey } : undefined),
48
+ ...(xGoogUserProject != null ? { 'x-goog-user-project': xGoogUserProject } : undefined),
49
+ ...options?.headers,
50
+ },
51
+ });
22
52
  }
23
53
 
24
54
  /**
25
- * List models using the OpenAI API.
55
+ * List models. Returns OpenAI, Anthropic, or Google response format based on SDK
56
+ * detection headers.
26
57
  */
27
- list(options?: Core.RequestOptions): Core.APIPromise<ListModelsResponse> {
28
- return this._client.get('/v1/models', options);
58
+ list(params?: ModelListParams, options?: Core.RequestOptions): Core.APIPromise<ModelListResponse>;
59
+ list(options?: Core.RequestOptions): Core.APIPromise<ModelListResponse>;
60
+ list(
61
+ params: ModelListParams | Core.RequestOptions = {},
62
+ options?: Core.RequestOptions,
63
+ ): Core.APIPromise<ModelListResponse> {
64
+ if (isRequestOptions(params)) {
65
+ return this.list({}, params);
66
+ }
67
+ const {
68
+ 'anthropic-version': anthropicVersion,
69
+ 'x-goog-api-client': xGoogAPIClient,
70
+ 'x-goog-api-key': xGoogAPIKey,
71
+ 'x-goog-user-project': xGoogUserProject,
72
+ ...query
73
+ } = params;
74
+ return this._client.get('/v1/models', {
75
+ query,
76
+ ...options,
77
+ headers: {
78
+ ...(anthropicVersion != null ? { 'anthropic-version': anthropicVersion } : undefined),
79
+ ...(xGoogAPIClient != null ? { 'x-goog-api-client': xGoogAPIClient } : undefined),
80
+ ...(xGoogAPIKey != null ? { 'x-goog-api-key': xGoogAPIKey } : undefined),
81
+ ...(xGoogUserProject != null ? { 'x-goog-user-project': xGoogUserProject } : undefined),
82
+ ...options?.headers,
83
+ },
84
+ });
29
85
  }
30
86
  }
31
87
 
@@ -64,60 +120,286 @@ export interface Model {
64
120
  /**
65
121
  * A model resource representing an AI model registered in OGX.
66
122
  */
67
- export interface ModelRetrieveResponse {
123
+ export type ModelRetrieveResponse =
124
+ | ModelRetrieveResponse.Model
125
+ | ModelRetrieveResponse.AnthropicModelInfo
126
+ | ModelRetrieveResponse.GoogleModelInfo;
127
+
128
+ export namespace ModelRetrieveResponse {
68
129
  /**
69
- * The model identifier (OpenAI-compatible alias for identifier).
130
+ * A model resource representing an AI model registered in OGX.
70
131
  */
71
- id: string;
132
+ export interface Model {
133
+ /**
134
+ * The model identifier (OpenAI-compatible alias for identifier).
135
+ */
136
+ id: string;
137
+
138
+ /**
139
+ * Unique identifier for this resource in ogx
140
+ */
141
+ identifier: string;
142
+
143
+ /**
144
+ * The object type, always 'model'.
145
+ */
146
+ object: 'model';
147
+
148
+ /**
149
+ * ID of the provider that owns this resource
150
+ */
151
+ provider_id: string;
152
+
153
+ /**
154
+ * The Unix timestamp in seconds when the model was created.
155
+ */
156
+ created?: number;
157
+
158
+ /**
159
+ * Any additional metadata for this model
160
+ */
161
+ metadata?: { [key: string]: unknown };
162
+
163
+ /**
164
+ * Enumeration of supported model types in OGX.
165
+ */
166
+ model_type?: 'llm' | 'embedding' | 'rerank';
167
+
168
+ /**
169
+ * Enable model availability check during registration. When false (default),
170
+ * validation is deferred to runtime and model is preserved during provider
171
+ * refresh.
172
+ */
173
+ model_validation?: boolean | null;
174
+
175
+ /**
176
+ * The owner of the model.
177
+ */
178
+ owned_by?: string;
179
+
180
+ /**
181
+ * Unique identifier for this resource in the provider
182
+ */
183
+ provider_resource_id?: string | null;
184
+
185
+ type?: 'model';
186
+ }
187
+
188
+ /**
189
+ * Anthropic model info response object.
190
+ *
191
+ * :id: Unique model identifier
192
+ */
193
+ export interface AnthropicModelInfo {
194
+ /**
195
+ * Unique model identifier.
196
+ */
197
+ id: string;
198
+
199
+ /**
200
+ * RFC 3339 datetime string representing when the model was released.
201
+ */
202
+ created_at: string;
203
+
204
+ /**
205
+ * A human-readable name for the model.
206
+ */
207
+ display_name: string;
208
+
209
+ /**
210
+ * Maximum input context window size in tokens.
211
+ */
212
+ max_input_tokens?: number | null;
213
+
214
+ /**
215
+ * Maximum value for the max_tokens parameter when using this model.
216
+ */
217
+ max_tokens?: number | null;
218
+
219
+ /**
220
+ * Object type, always 'model'.
221
+ */
222
+ type?: 'model';
223
+ }
72
224
 
73
225
  /**
74
- * Unique identifier for this resource in ogx
226
+ * Google model info response object.
227
+ *
228
+ * :name: Model resource name, e.g. 'models/gemini-pro' :display_name: A
229
+ * human-readable name for the model :description: A description of the model
75
230
  */
76
- identifier: string;
231
+ export interface GoogleModelInfo {
232
+ /**
233
+ * A human-readable name for the model.
234
+ */
235
+ display_name: string;
236
+
237
+ /**
238
+ * Model resource name, e.g. 'models/gemini-pro'.
239
+ */
240
+ name: string;
241
+
242
+ /**
243
+ * A description of the model.
244
+ */
245
+ description?: string;
246
+ }
247
+ }
248
+
249
+ /**
250
+ * Response containing a list of OpenAI model objects.
251
+ */
252
+ export type ModelListResponse =
253
+ | ListModelsResponse
254
+ | ModelListResponse.AnthropicListModelsResponse
255
+ | ModelListResponse.GoogleListModelsResponse;
77
256
 
257
+ export namespace ModelListResponse {
78
258
  /**
79
- * The object type, always 'model'.
259
+ * Response containing a list of Anthropic model objects.
80
260
  */
81
- object: 'model';
261
+ export interface AnthropicListModelsResponse {
262
+ /**
263
+ * List of Anthropic model objects.
264
+ */
265
+ data: Array<AnthropicListModelsResponse.Data>;
266
+
267
+ /**
268
+ * First ID in the data list, usable as before_id for the previous page.
269
+ */
270
+ first_id?: string | null;
271
+
272
+ /**
273
+ * Whether there are more results in the requested page direction.
274
+ */
275
+ has_more?: boolean;
276
+
277
+ /**
278
+ * Last ID in the data list, usable as after_id for the next page.
279
+ */
280
+ last_id?: string | null;
281
+ }
282
+
283
+ export namespace AnthropicListModelsResponse {
284
+ /**
285
+ * Anthropic model info response object.
286
+ *
287
+ * :id: Unique model identifier
288
+ */
289
+ export interface Data {
290
+ /**
291
+ * Unique model identifier.
292
+ */
293
+ id: string;
294
+
295
+ /**
296
+ * RFC 3339 datetime string representing when the model was released.
297
+ */
298
+ created_at: string;
299
+
300
+ /**
301
+ * A human-readable name for the model.
302
+ */
303
+ display_name: string;
304
+
305
+ /**
306
+ * Maximum input context window size in tokens.
307
+ */
308
+ max_input_tokens?: number | null;
309
+
310
+ /**
311
+ * Maximum value for the max_tokens parameter when using this model.
312
+ */
313
+ max_tokens?: number | null;
314
+
315
+ /**
316
+ * Object type, always 'model'.
317
+ */
318
+ type?: 'model';
319
+ }
320
+ }
82
321
 
83
322
  /**
84
- * ID of the provider that owns this resource
323
+ * Response containing a list of Google model objects.
85
324
  */
86
- provider_id: string;
325
+ export interface GoogleListModelsResponse {
326
+ /**
327
+ * List of Google model objects.
328
+ */
329
+ models: Array<GoogleListModelsResponse.Model>;
330
+ }
87
331
 
332
+ export namespace GoogleListModelsResponse {
333
+ /**
334
+ * Google model info response object.
335
+ *
336
+ * :name: Model resource name, e.g. 'models/gemini-pro' :display_name: A
337
+ * human-readable name for the model :description: A description of the model
338
+ */
339
+ export interface Model {
340
+ /**
341
+ * A human-readable name for the model.
342
+ */
343
+ display_name: string;
344
+
345
+ /**
346
+ * Model resource name, e.g. 'models/gemini-pro'.
347
+ */
348
+ name: string;
349
+
350
+ /**
351
+ * A description of the model.
352
+ */
353
+ description?: string;
354
+ }
355
+ }
356
+ }
357
+
358
+ export interface ModelRetrieveParams {
359
+ 'anthropic-version'?: string;
360
+
361
+ 'x-goog-api-client'?: string;
362
+
363
+ 'x-goog-api-key'?: string;
364
+
365
+ 'x-goog-user-project'?: string;
366
+ }
367
+
368
+ export interface ModelListParams {
88
369
  /**
89
- * The Unix timestamp in seconds when the model was created.
370
+ * Query param: Return models after this model ID (Anthropic SDK format only).
90
371
  */
91
- created?: number;
372
+ after_id?: string | null;
92
373
 
93
374
  /**
94
- * Any additional metadata for this model
375
+ * Query param: Return models before this model ID (Anthropic SDK format only).
95
376
  */
96
- metadata?: { [key: string]: unknown };
377
+ before_id?: string | null;
97
378
 
98
379
  /**
99
- * Enumeration of supported model types in OGX.
380
+ * Query param: Maximum number of models to return (Anthropic SDK format only).
100
381
  */
101
- model_type?: 'llm' | 'embedding' | 'rerank';
382
+ limit?: number | null;
102
383
 
103
384
  /**
104
- * Enable model availability check during registration. When false (default),
105
- * validation is deferred to runtime and model is preserved during provider
106
- * refresh.
385
+ * Header param
107
386
  */
108
- model_validation?: boolean | null;
387
+ 'anthropic-version'?: string;
109
388
 
110
389
  /**
111
- * The owner of the model.
390
+ * Header param
112
391
  */
113
- owned_by?: string;
392
+ 'x-goog-api-client'?: string;
114
393
 
115
394
  /**
116
- * Unique identifier for this resource in the provider
395
+ * Header param
117
396
  */
118
- provider_resource_id?: string | null;
397
+ 'x-goog-api-key'?: string;
119
398
 
120
- type?: 'model';
399
+ /**
400
+ * Header param
401
+ */
402
+ 'x-goog-user-project'?: string;
121
403
  }
122
404
 
123
405
  Models.OpenAI = OpenAI;
@@ -127,7 +409,14 @@ export declare namespace Models {
127
409
  type ListModelsResponse as ListModelsResponse,
128
410
  type Model as Model,
129
411
  type ModelRetrieveResponse as ModelRetrieveResponse,
412
+ type ModelListResponse as ModelListResponse,
413
+ type ModelRetrieveParams as ModelRetrieveParams,
414
+ type ModelListParams as ModelListParams,
130
415
  };
131
416
 
132
- export { OpenAI as OpenAI };
417
+ export {
418
+ OpenAI as OpenAI,
419
+ type OpenAIListResponse as OpenAIListResponse,
420
+ type OpenAIListParams as OpenAIListParams,
421
+ };
133
422
  }
@@ -7,14 +7,191 @@
7
7
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8
8
 
9
9
  import { APIResource } from '../../resource';
10
+ import { isRequestOptions } from '../../core';
10
11
  import * as Core from '../../core';
11
12
  import * as ModelsAPI from './models';
12
13
 
13
14
  export class OpenAI extends APIResource {
14
15
  /**
15
- * List models using the OpenAI API.
16
+ * List models. Returns OpenAI, Anthropic, or Google response format based on SDK
17
+ * detection headers.
16
18
  */
17
- list(options?: Core.RequestOptions): Core.APIPromise<ModelsAPI.ListModelsResponse> {
18
- return this._client.get('/v1/models', options);
19
+ list(params?: OpenAIListParams, options?: Core.RequestOptions): Core.APIPromise<OpenAIListResponse>;
20
+ list(options?: Core.RequestOptions): Core.APIPromise<OpenAIListResponse>;
21
+ list(
22
+ params: OpenAIListParams | Core.RequestOptions = {},
23
+ options?: Core.RequestOptions,
24
+ ): Core.APIPromise<OpenAIListResponse> {
25
+ if (isRequestOptions(params)) {
26
+ return this.list({}, params);
27
+ }
28
+ const {
29
+ 'anthropic-version': anthropicVersion,
30
+ 'x-goog-api-client': xGoogAPIClient,
31
+ 'x-goog-api-key': xGoogAPIKey,
32
+ 'x-goog-user-project': xGoogUserProject,
33
+ ...query
34
+ } = params;
35
+ return this._client.get('/v1/models', {
36
+ query,
37
+ ...options,
38
+ headers: {
39
+ ...(anthropicVersion != null ? { 'anthropic-version': anthropicVersion } : undefined),
40
+ ...(xGoogAPIClient != null ? { 'x-goog-api-client': xGoogAPIClient } : undefined),
41
+ ...(xGoogAPIKey != null ? { 'x-goog-api-key': xGoogAPIKey } : undefined),
42
+ ...(xGoogUserProject != null ? { 'x-goog-user-project': xGoogUserProject } : undefined),
43
+ ...options?.headers,
44
+ },
45
+ });
19
46
  }
20
47
  }
48
+
49
+ /**
50
+ * Response containing a list of OpenAI model objects.
51
+ */
52
+ export type OpenAIListResponse =
53
+ | ModelsAPI.ListModelsResponse
54
+ | OpenAIListResponse.AnthropicListModelsResponse
55
+ | OpenAIListResponse.GoogleListModelsResponse;
56
+
57
+ export namespace OpenAIListResponse {
58
+ /**
59
+ * Response containing a list of Anthropic model objects.
60
+ */
61
+ export interface AnthropicListModelsResponse {
62
+ /**
63
+ * List of Anthropic model objects.
64
+ */
65
+ data: Array<AnthropicListModelsResponse.Data>;
66
+
67
+ /**
68
+ * First ID in the data list, usable as before_id for the previous page.
69
+ */
70
+ first_id?: string | null;
71
+
72
+ /**
73
+ * Whether there are more results in the requested page direction.
74
+ */
75
+ has_more?: boolean;
76
+
77
+ /**
78
+ * Last ID in the data list, usable as after_id for the next page.
79
+ */
80
+ last_id?: string | null;
81
+ }
82
+
83
+ export namespace AnthropicListModelsResponse {
84
+ /**
85
+ * Anthropic model info response object.
86
+ *
87
+ * :id: Unique model identifier
88
+ */
89
+ export interface Data {
90
+ /**
91
+ * Unique model identifier.
92
+ */
93
+ id: string;
94
+
95
+ /**
96
+ * RFC 3339 datetime string representing when the model was released.
97
+ */
98
+ created_at: string;
99
+
100
+ /**
101
+ * A human-readable name for the model.
102
+ */
103
+ display_name: string;
104
+
105
+ /**
106
+ * Maximum input context window size in tokens.
107
+ */
108
+ max_input_tokens?: number | null;
109
+
110
+ /**
111
+ * Maximum value for the max_tokens parameter when using this model.
112
+ */
113
+ max_tokens?: number | null;
114
+
115
+ /**
116
+ * Object type, always 'model'.
117
+ */
118
+ type?: 'model';
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Response containing a list of Google model objects.
124
+ */
125
+ export interface GoogleListModelsResponse {
126
+ /**
127
+ * List of Google model objects.
128
+ */
129
+ models: Array<GoogleListModelsResponse.Model>;
130
+ }
131
+
132
+ export namespace GoogleListModelsResponse {
133
+ /**
134
+ * Google model info response object.
135
+ *
136
+ * :name: Model resource name, e.g. 'models/gemini-pro' :display_name: A
137
+ * human-readable name for the model :description: A description of the model
138
+ */
139
+ export interface Model {
140
+ /**
141
+ * A human-readable name for the model.
142
+ */
143
+ display_name: string;
144
+
145
+ /**
146
+ * Model resource name, e.g. 'models/gemini-pro'.
147
+ */
148
+ name: string;
149
+
150
+ /**
151
+ * A description of the model.
152
+ */
153
+ description?: string;
154
+ }
155
+ }
156
+ }
157
+
158
+ export interface OpenAIListParams {
159
+ /**
160
+ * Query param: Return models after this model ID (Anthropic SDK format only).
161
+ */
162
+ after_id?: string | null;
163
+
164
+ /**
165
+ * Query param: Return models before this model ID (Anthropic SDK format only).
166
+ */
167
+ before_id?: string | null;
168
+
169
+ /**
170
+ * Query param: Maximum number of models to return (Anthropic SDK format only).
171
+ */
172
+ limit?: number | null;
173
+
174
+ /**
175
+ * Header param
176
+ */
177
+ 'anthropic-version'?: string;
178
+
179
+ /**
180
+ * Header param
181
+ */
182
+ 'x-goog-api-client'?: string;
183
+
184
+ /**
185
+ * Header param
186
+ */
187
+ 'x-goog-api-key'?: string;
188
+
189
+ /**
190
+ * Header param
191
+ */
192
+ 'x-goog-user-project'?: string;
193
+ }
194
+
195
+ export declare namespace OpenAI {
196
+ export { type OpenAIListResponse as OpenAIListResponse, type OpenAIListParams as OpenAIListParams };
197
+ }
@@ -1190,8 +1190,6 @@ export interface ResponseObject {
1190
1190
  */
1191
1191
  reasoning?: ResponseObject.Reasoning | null;
1192
1192
 
1193
- safety_identifier?: string | null;
1194
-
1195
1193
  service_tier?: string;
1196
1194
 
1197
1195
  temperature?: number;
@@ -3664,8 +3662,6 @@ export interface ResponseListResponse {
3664
3662
  */
3665
3663
  reasoning?: ResponseListResponse.Reasoning | null;
3666
3664
 
3667
- safety_identifier?: string | null;
3668
-
3669
3665
  service_tier?: string;
3670
3666
 
3671
3667
  temperature?: number;
@@ -4956,11 +4952,6 @@ export interface ResponseCreateParamsBase {
4956
4952
  */
4957
4953
  frequency_penalty?: number | null;
4958
4954
 
4959
- /**
4960
- * List of guardrails to apply during response generation.
4961
- */
4962
- guardrails?: Array<string | ResponseCreateParams.ResponseGuardrailSpec> | null;
4963
-
4964
4955
  /**
4965
4956
  * Additional fields to include in the response.
4966
4957
  */
@@ -5031,11 +5022,6 @@ export interface ResponseCreateParamsBase {
5031
5022
  */
5032
5023
  reasoning?: ResponseCreateParams.Reasoning | null;
5033
5024
 
5034
- /**
5035
- * A stable identifier used for safety monitoring and abuse detection.
5036
- */
5037
- safety_identifier?: string | null;
5038
-
5039
5025
  /**
5040
5026
  * The service tier for the request.
5041
5027
  */
@@ -5597,13 +5583,6 @@ export namespace ResponseCreateParams {
5597
5583
  compact_threshold?: number | null;
5598
5584
  }
5599
5585
 
5600
- /**
5601
- * Specification for a guardrail to apply during response generation.
5602
- */
5603
- export interface ResponseGuardrailSpec {
5604
- type: string;
5605
- }
5606
-
5607
5586
  /**
5608
5587
  * OpenAI compatible Prompt object that is used in OpenAI responses.
5609
5588
  */
@@ -322,26 +322,6 @@ export interface RouteInfo {
322
322
  route: string;
323
323
  }
324
324
 
325
- /**
326
- * Details of a safety violation detected by content moderation.
327
- */
328
- export interface SafetyViolation {
329
- /**
330
- * Severity level of the violation
331
- */
332
- violation_level: 'info' | 'warn' | 'error';
333
-
334
- /**
335
- * Additional metadata including specific violation codes
336
- */
337
- metadata?: { [key: string]: unknown };
338
-
339
- /**
340
- * Message to convey to the user about the violation
341
- */
342
- user_message?: string | null;
343
- }
344
-
345
325
  /**
346
326
  * Sampling parameters for text generation.
347
327
  */
package/src/version.ts CHANGED
@@ -4,4 +4,4 @@
4
4
  // This source code is licensed under the terms described in the LICENSE file in
5
5
  // the root directory of this source tree.
6
6
 
7
- export const VERSION = '0.8.0'; // x-release-please-version
7
+ export const VERSION = '1.0.1'; // x-release-please-version
@@ -49,7 +49,6 @@ describe('resource completions', () => {
49
49
  prompt_cache_key: 'prompt_cache_key',
50
50
  reasoning_effort: 'none',
51
51
  response_format: { type: 'text' },
52
- safety_identifier: 'safety_identifier',
53
52
  seed: 0,
54
53
  service_tier: 'auto',
55
54
  stop: 'string',