@openrouter/sdk 0.3.16 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,10 @@ import * as operations from "../models/operations/index.js";
10
10
  import { APIPromise } from "../types/async.js";
11
11
  import { Result } from "../types/fp.js";
12
12
  /**
13
- * List models filtered by user provider preferences
13
+ * List models filtered by user provider preferences, privacy settings, and guardrails
14
+ *
15
+ * @remarks
16
+ * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing).
14
17
  */
15
- export declare function modelsListForUser(client: OpenRouterCore, security: operations.ListModelsUserSecurity, options?: RequestOptions): APIPromise<Result<models.ModelsListResponse, errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
+ export declare function modelsListForUser(client: OpenRouterCore, security: operations.ListModelsUserSecurity, options?: RequestOptions): APIPromise<Result<models.ModelsListResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
16
19
  //# sourceMappingURL=modelsListForUser.d.ts.map
@@ -10,7 +10,10 @@ import * as errors from "../models/errors/index.js";
10
10
  import * as models from "../models/index.js";
11
11
  import { APIPromise } from "../types/async.js";
12
12
  /**
13
- * List models filtered by user provider preferences
13
+ * List models filtered by user provider preferences, privacy settings, and guardrails
14
+ *
15
+ * @remarks
16
+ * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing).
14
17
  */
15
18
  export function modelsListForUser(client, security, options) {
16
19
  return new APIPromise($do(client, security, options));
@@ -54,7 +57,7 @@ async function $do(client, security, options) {
54
57
  const req = requestRes.value;
55
58
  const doResult = await client._do(req, {
56
59
  context,
57
- errorCodes: ["401", "4XX", "500", "5XX"],
60
+ errorCodes: ["401", "404", "4XX", "500", "5XX"],
58
61
  retryConfig: context.retryConfig,
59
62
  retryCodes: context.retryCodes,
60
63
  });
@@ -65,7 +68,7 @@ async function $do(client, security, options) {
65
68
  const responseFields = {
66
69
  HttpMeta: { Response: response, Request: req },
67
70
  };
68
- const [result] = await M.match(M.json(200, models.ModelsListResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
71
+ const [result] = await M.match(M.json(200, models.ModelsListResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
69
72
  if (!result.ok) {
70
73
  return [result, { status: "complete", request: req, response }];
71
74
  }
package/esm/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export { HTTPClient } from './lib/http.js';
14
14
  export { applyNextTurnParamsToRequest, buildNextTurnParamsContext, executeNextTurnParamsFunctions, } from './lib/next-turn-params.js';
15
15
  export { finishReasonIs, hasToolCall, isStopConditionMet, maxCost, maxTokensUsed, stepCountIs, } from './lib/stop-conditions.js';
16
16
  export { extractUnsupportedContent, getUnsupportedContentSummary, hasUnsupportedContent, } from './lib/stream-transformers.js';
17
+ export type { StreamableOutputItem } from './lib/stream-transformers.js';
17
18
  export { tool } from './lib/tool.js';
18
19
  export { hasApprovalRequiredTools, hasExecuteFunction, isGeneratorTool, isRegularExecuteTool, isToolPreliminaryResultEvent, isToolResultEvent, toolHasApprovalConfigured, ToolType, } from './lib/tool-types.js';
19
20
  export { buildTurnContext, normalizeInputToArray } from './lib/turn-context.js';
@@ -45,8 +45,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
45
45
  export declare const SDK_METADATA: {
46
46
  readonly language: "typescript";
47
47
  readonly openapiDocVersion: "1.0.0";
48
- readonly sdkVersion: "0.3.16";
48
+ readonly sdkVersion: "0.4.0";
49
49
  readonly genVersion: "2.788.4";
50
- readonly userAgent: "speakeasy-sdk/typescript 0.3.16 2.788.4 1.0.0 @openrouter/sdk";
50
+ readonly userAgent: "speakeasy-sdk/typescript 0.4.0 2.788.4 1.0.0 @openrouter/sdk";
51
51
  };
52
52
  //# sourceMappingURL=config.d.ts.map
package/esm/lib/config.js CHANGED
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
26
26
  export const SDK_METADATA = {
27
27
  language: "typescript",
28
28
  openapiDocVersion: "1.0.0",
29
- sdkVersion: "0.3.16",
29
+ sdkVersion: "0.4.0",
30
30
  genVersion: "2.788.4",
31
- userAgent: "speakeasy-sdk/typescript 0.3.16 2.788.4 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.4.0 2.788.4 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -3,6 +3,7 @@ import type * as models from '../models/index.js';
3
3
  import type { CallModelInput } from './async-params.js';
4
4
  import type { RequestOptions } from './sdks.js';
5
5
  import type { ConversationState, ResponseStreamEvent, InferToolEventsUnion, InferToolOutputsUnion, ParsedToolCall, StateAccessor, StopWhen, Tool, ToolStreamEvent, TurnContext } from './tool-types.js';
6
+ import { type StreamableOutputItem } from './stream-transformers.js';
6
7
  export interface GetResponseOptions<TTools extends readonly Tool[]> {
7
8
  request: CallModelInput<TTools>;
8
9
  client: OpenRouterCore;
@@ -245,6 +246,25 @@ export declare class ModelResult<TTools extends readonly Tool[]> {
245
246
  */
246
247
  getTextStream(): AsyncIterableIterator<string>;
247
248
  /**
249
+ * Stream all output items cumulatively as they arrive.
250
+ * Items are emitted with the same ID but progressively updated content as streaming progresses.
251
+ * Also yields tool results (function_call_output) after tool execution completes.
252
+ *
253
+ * Item types include:
254
+ * - message: Assistant text responses (emitted cumulatively as text streams)
255
+ * - function_call: Tool calls (emitted cumulatively as arguments stream)
256
+ * - reasoning: Model reasoning (emitted cumulatively as thinking streams)
257
+ * - web_search_call: Web search operations
258
+ * - file_search_call: File search operations
259
+ * - image_generation_call: Image generation operations
260
+ * - function_call_output: Results from executed tools
261
+ */
262
+ getItemsStream(): AsyncIterableIterator<StreamableOutputItem>;
263
+ /**
264
+ * @deprecated Use `getItemsStream()` instead. This method only streams messages,
265
+ * while `getItemsStream()` streams all output item types (messages, function_calls,
266
+ * reasoning, etc.) with cumulative updates.
267
+ *
248
268
  * Stream incremental message updates as content is added in responses format.
249
269
  * Each iteration yields an updated version of the message with new content.
250
270
  * Also yields OpenResponsesFunctionCallOutput after tool execution completes.
@@ -3,11 +3,12 @@ import { betaResponsesSend } from '../funcs/betaResponsesSend.js';
3
3
  import { hasAsyncFunctions, resolveAsyncFunctions, } from './async-params.js';
4
4
  import { appendToMessages, createInitialState, createRejectedResult, createUnsentResult, extractTextFromResponse as extractTextFromResponseState, partitionToolCalls, unsentResultsToAPIFormat, updateState, } from './conversation-state.js';
5
5
  import { ReusableReadableStream } from './reusable-stream.js';
6
- import { buildResponsesMessageStream, buildToolCallStream, consumeStreamForCompletion, extractReasoningDeltas, extractResponsesMessageFromResponse, extractTextDeltas, extractTextFromResponse, extractToolCallsFromResponse, extractToolDeltas, } from './stream-transformers.js';
6
+ import { buildItemsStream, buildResponsesMessageStream, buildToolCallStream, consumeStreamForCompletion, extractReasoningDeltas, extractResponsesMessageFromResponse, extractTextDeltas, extractTextFromResponse, extractToolCallsFromResponse, extractToolDeltas, } from './stream-transformers.js';
7
7
  import { executeTool } from './tool-executor.js';
8
8
  import { executeNextTurnParamsFunctions, applyNextTurnParamsToRequest } from './next-turn-params.js';
9
9
  import { hasExecuteFunction } from './tool-types.js';
10
10
  import { isStopConditionMet, stepCountIs } from './stop-conditions.js';
11
+ import { isOutputMessage, isFunctionCallOutputItem, isReasoningOutputItem, isWebSearchCallOutputItem, isFileSearchCallOutputItem, isImageGenerationCallOutputItem, hasTypeProperty, } from './stream-type-guards.js';
11
12
  /**
12
13
  * Default maximum number of tool execution steps if no stopWhen is specified.
13
14
  * This prevents infinite loops in tool execution.
@@ -30,15 +31,6 @@ function isEventStream(value) {
30
31
  const maybeStream = value;
31
32
  return typeof maybeStream.toReadableStream === 'function';
32
33
  }
33
- /**
34
- * Type guard for output items with a type property
35
- */
36
- function hasTypeProperty(item) {
37
- return (typeof item === 'object' &&
38
- item !== null &&
39
- 'type' in item &&
40
- typeof item.type === 'string');
41
- }
42
34
  /**
43
35
  * A wrapper around a streaming response that provides multiple consumption patterns.
44
36
  *
@@ -875,6 +867,55 @@ export class ModelResult {
875
867
  }.call(this);
876
868
  }
877
869
  /**
870
+ * Stream all output items cumulatively as they arrive.
871
+ * Items are emitted with the same ID but progressively updated content as streaming progresses.
872
+ * Also yields tool results (function_call_output) after tool execution completes.
873
+ *
874
+ * Item types include:
875
+ * - message: Assistant text responses (emitted cumulatively as text streams)
876
+ * - function_call: Tool calls (emitted cumulatively as arguments stream)
877
+ * - reasoning: Model reasoning (emitted cumulatively as thinking streams)
878
+ * - web_search_call: Web search operations
879
+ * - file_search_call: File search operations
880
+ * - image_generation_call: Image generation operations
881
+ * - function_call_output: Results from executed tools
882
+ */
883
+ getItemsStream() {
884
+ return async function* () {
885
+ await this.initStream();
886
+ if (!this.reusableStream) {
887
+ throw new Error('Stream not initialized');
888
+ }
889
+ // Stream all items from the API response cumulatively
890
+ yield* buildItemsStream(this.reusableStream);
891
+ // Execute tools if needed
892
+ await this.executeToolsIfNeeded();
893
+ // Yield function call outputs for each executed tool
894
+ for (const round of this.allToolExecutionRounds) {
895
+ for (const toolResult of round.toolResults) {
896
+ yield toolResult;
897
+ }
898
+ }
899
+ // If tools were executed, yield all items from the final response
900
+ if (this.finalResponse && this.allToolExecutionRounds.length > 0) {
901
+ for (const item of this.finalResponse.output) {
902
+ if (isOutputMessage(item) ||
903
+ isFunctionCallOutputItem(item) ||
904
+ isReasoningOutputItem(item) ||
905
+ isWebSearchCallOutputItem(item) ||
906
+ isFileSearchCallOutputItem(item) ||
907
+ isImageGenerationCallOutputItem(item)) {
908
+ yield item;
909
+ }
910
+ }
911
+ }
912
+ }.call(this);
913
+ }
914
+ /**
915
+ * @deprecated Use `getItemsStream()` instead. This method only streams messages,
916
+ * while `getItemsStream()` streams all output item types (messages, function_calls,
917
+ * reasoning, etc.) with cumulative updates.
918
+ *
878
919
  * Stream incremental message updates as content is added in responses format.
879
920
  * Each iteration yields an updated version of the message with new content.
880
921
  * Also yields OpenResponsesFunctionCallOutput after tool execution completes.
@@ -18,6 +18,18 @@ export declare function extractToolDeltas(stream: ReusableReadableStream<models.
18
18
  * Returns ResponsesOutputMessage (assistant/responses format)
19
19
  */
20
20
  export declare function buildResponsesMessageStream(stream: ReusableReadableStream<models.OpenResponsesStreamEvent>): AsyncIterableIterator<models.ResponsesOutputMessage>;
21
+ /**
22
+ * Output item types that can be streamed from a response.
23
+ * This is the union of all item types that appear in response output,
24
+ * plus function_call_output for tool results.
25
+ */
26
+ export type StreamableOutputItem = models.ResponsesOutputMessage | models.ResponsesOutputItemFunctionCall | models.ResponsesOutputItemReasoning | models.ResponsesWebSearchCallOutput | models.ResponsesOutputItemFileSearchCall | models.ResponsesImageGenerationCall | models.OpenResponsesFunctionCallOutput;
27
+ /**
28
+ * Build incremental output item updates from responses stream events.
29
+ * Yields all item types cumulatively - same item may be emitted multiple times
30
+ * with the same ID but progressively updated content as streaming progresses.
31
+ */
32
+ export declare function buildItemsStream(stream: ReusableReadableStream<models.OpenResponsesStreamEvent>): AsyncIterableIterator<StreamableOutputItem>;
21
33
  /**
22
34
  * Build incremental message updates from responses stream events
23
35
  * Returns AssistantMessage (chat format) instead of ResponsesOutputMessage
@@ -127,6 +127,212 @@ export async function* buildResponsesMessageStream(stream) {
127
127
  }
128
128
  }
129
129
  }
130
+ /**
131
+ * Handle output_item.added event - Initialize tracking for new items
132
+ */
133
+ function handleOutputItemAdded(event, itemsInProgress) {
134
+ if (!isOutputItemAddedEvent(event) || !event.item) {
135
+ return undefined;
136
+ }
137
+ const item = event.item;
138
+ if (isOutputMessage(item)) {
139
+ itemsInProgress.set(item.id, {
140
+ type: 'message',
141
+ id: item.id,
142
+ textContent: '',
143
+ });
144
+ return {
145
+ id: item.id,
146
+ type: 'message',
147
+ role: 'assistant',
148
+ status: 'in_progress',
149
+ content: [],
150
+ };
151
+ }
152
+ if (isFunctionCallOutputItem(item)) {
153
+ // Use item.id if available (matches itemId in delta events), fall back to callId
154
+ const itemKey = item.id ?? item.callId;
155
+ itemsInProgress.set(itemKey, {
156
+ type: 'function_call',
157
+ id: itemKey,
158
+ name: item.name,
159
+ callId: item.callId,
160
+ argumentsAccumulated: '',
161
+ });
162
+ return {
163
+ type: 'function_call',
164
+ id: item.id,
165
+ callId: item.callId,
166
+ name: item.name,
167
+ arguments: '',
168
+ status: 'in_progress',
169
+ };
170
+ }
171
+ if (isReasoningOutputItem(item)) {
172
+ itemsInProgress.set(item.id, {
173
+ type: 'reasoning',
174
+ id: item.id,
175
+ reasoningContent: '',
176
+ });
177
+ return {
178
+ type: 'reasoning',
179
+ id: item.id,
180
+ status: 'in_progress',
181
+ summary: [],
182
+ };
183
+ }
184
+ if (isWebSearchCallOutputItem(item)) {
185
+ return item;
186
+ }
187
+ if (isFileSearchCallOutputItem(item)) {
188
+ return item;
189
+ }
190
+ if (isImageGenerationCallOutputItem(item)) {
191
+ return item;
192
+ }
193
+ return undefined;
194
+ }
195
+ /**
196
+ * Handle text delta event for messages
197
+ */
198
+ function handleTextDelta(event, itemsInProgress) {
199
+ if (!isOutputTextDeltaEvent(event) || !event.delta) {
200
+ return undefined;
201
+ }
202
+ const item = itemsInProgress.get(event.itemId);
203
+ if (item?.type === 'message') {
204
+ item.textContent += event.delta;
205
+ return {
206
+ id: item.id,
207
+ type: 'message',
208
+ role: 'assistant',
209
+ status: 'in_progress',
210
+ content: [
211
+ {
212
+ type: 'output_text',
213
+ text: item.textContent,
214
+ annotations: [],
215
+ },
216
+ ],
217
+ };
218
+ }
219
+ return undefined;
220
+ }
221
+ /**
222
+ * Handle function call argument delta event
223
+ */
224
+ function handleFunctionCallDelta(event, itemsInProgress) {
225
+ if (!isFunctionCallArgumentsDeltaEvent(event) || !event.delta) {
226
+ return undefined;
227
+ }
228
+ const item = itemsInProgress.get(event.itemId);
229
+ if (item?.type === 'function_call') {
230
+ item.argumentsAccumulated += event.delta;
231
+ return {
232
+ type: 'function_call',
233
+ // Include id if it differs from callId (means API provided an id)
234
+ id: item.id !== item.callId ? item.id : undefined,
235
+ callId: item.callId,
236
+ name: item.name,
237
+ arguments: item.argumentsAccumulated,
238
+ status: 'in_progress',
239
+ };
240
+ }
241
+ return undefined;
242
+ }
243
+ /**
244
+ * Handle reasoning text delta event
245
+ */
246
+ function handleReasoningDelta(event, itemsInProgress) {
247
+ if (!isReasoningDeltaEvent(event) || !event.delta) {
248
+ return undefined;
249
+ }
250
+ const item = itemsInProgress.get(event.itemId);
251
+ if (item?.type === 'reasoning') {
252
+ item.reasoningContent += event.delta;
253
+ return {
254
+ type: 'reasoning',
255
+ id: item.id,
256
+ status: 'in_progress',
257
+ summary: [
258
+ {
259
+ type: 'summary_text',
260
+ text: item.reasoningContent,
261
+ },
262
+ ],
263
+ };
264
+ }
265
+ return undefined;
266
+ }
267
+ /**
268
+ * Handle output_item.done event - Yield final complete item
269
+ */
270
+ function handleOutputItemDone(event, itemsInProgress) {
271
+ if (!isOutputItemDoneEvent(event) || !event.item) {
272
+ return undefined;
273
+ }
274
+ const item = event.item;
275
+ if (isOutputMessage(item)) {
276
+ itemsInProgress.delete(item.id);
277
+ return item;
278
+ }
279
+ if (isFunctionCallOutputItem(item)) {
280
+ // Use item.id if available (matches itemId in delta events), fall back to callId
281
+ itemsInProgress.delete(item.id ?? item.callId);
282
+ return item;
283
+ }
284
+ if (isReasoningOutputItem(item)) {
285
+ itemsInProgress.delete(item.id);
286
+ return item;
287
+ }
288
+ if (isWebSearchCallOutputItem(item)) {
289
+ return item;
290
+ }
291
+ if (isFileSearchCallOutputItem(item)) {
292
+ return item;
293
+ }
294
+ if (isImageGenerationCallOutputItem(item)) {
295
+ return item;
296
+ }
297
+ return undefined;
298
+ }
299
+ const itemsStreamHandlers = {
300
+ 'response.output_item.added': handleOutputItemAdded,
301
+ 'response.output_text.delta': handleTextDelta,
302
+ 'response.function_call_arguments.delta': handleFunctionCallDelta,
303
+ 'response.reasoning_text.delta': handleReasoningDelta,
304
+ 'response.output_item.done': handleOutputItemDone,
305
+ };
306
+ const streamTerminationEvents = new Set([
307
+ 'response.completed',
308
+ 'response.failed',
309
+ 'response.incomplete',
310
+ ]);
311
+ //#endregion
312
+ /**
313
+ * Build incremental output item updates from responses stream events.
314
+ * Yields all item types cumulatively - same item may be emitted multiple times
315
+ * with the same ID but progressively updated content as streaming progresses.
316
+ */
317
+ export async function* buildItemsStream(stream) {
318
+ const consumer = stream.createConsumer();
319
+ const itemsInProgress = new Map();
320
+ for await (const event of consumer) {
321
+ if (!('type' in event)) {
322
+ continue;
323
+ }
324
+ if (streamTerminationEvents.has(event.type)) {
325
+ return;
326
+ }
327
+ const handler = itemsStreamHandlers[event.type];
328
+ if (handler) {
329
+ const result = handler(event, itemsInProgress);
330
+ if (result) {
331
+ yield result;
332
+ }
333
+ }
334
+ }
335
+ }
130
336
  /**
131
337
  * Build incremental message updates from responses stream events
132
338
  * Returns AssistantMessage (chat format) instead of ResponsesOutputMessage
@@ -58,6 +58,7 @@ export type NextTurnParamsFunctions<TInput> = {
58
58
  export type ToolApprovalCheck<TInput> = (params: TInput, context: TurnContext) => boolean | Promise<boolean>;
59
59
  /**
60
60
  * Base tool function interface with inputSchema
61
+ * @template TInput - Zod schema for tool input
61
62
  */
62
63
  export interface BaseToolFunction<TInput extends $ZodObject<$ZodShape>> {
63
64
  name: string;
@@ -163,17 +163,17 @@ export type Reasoning = {
163
163
  effort?: Effort | null | undefined;
164
164
  summary?: ReasoningSummaryVerbosity | null | undefined;
165
165
  };
166
- export type ChatGenerationParamsResponseFormatPython = {
166
+ export type ResponseFormatPython = {
167
167
  type: "python";
168
168
  };
169
- export type ChatGenerationParamsResponseFormatJSONObject = {
169
+ export type ResponseFormatJSONObject = {
170
170
  type: "json_object";
171
171
  };
172
- export type ChatGenerationParamsResponseFormatText = {
172
+ export type ResponseFormatText = {
173
173
  type: "text";
174
174
  };
175
- export type ChatGenerationParamsResponseFormatUnion = ChatGenerationParamsResponseFormatText | ChatGenerationParamsResponseFormatJSONObject | ResponseFormatJSONSchema | ResponseFormatTextGrammar | ChatGenerationParamsResponseFormatPython;
176
- export type ChatGenerationParamsStop = string | Array<string>;
175
+ export type ResponseFormat = ResponseFormatText | ResponseFormatJSONObject | ResponseFormatJSONSchema | ResponseFormatTextGrammar | ResponseFormatPython;
176
+ export type Stop = string | Array<string>;
177
177
  export type Debug = {
178
178
  echoUpstreamBody?: boolean | undefined;
179
179
  };
@@ -214,7 +214,7 @@ export type ChatGenerationParams = {
214
214
  } | undefined;
215
215
  presencePenalty?: number | null | undefined;
216
216
  reasoning?: Reasoning | undefined;
217
- responseFormat?: ChatGenerationParamsResponseFormatText | ChatGenerationParamsResponseFormatJSONObject | ResponseFormatJSONSchema | ResponseFormatTextGrammar | ChatGenerationParamsResponseFormatPython | undefined;
217
+ responseFormat?: ResponseFormatText | ResponseFormatJSONObject | ResponseFormatJSONSchema | ResponseFormatTextGrammar | ResponseFormatPython | undefined;
218
218
  seed?: number | null | undefined;
219
219
  stop?: string | Array<string> | null | undefined;
220
220
  stream?: boolean | undefined;
@@ -366,36 +366,36 @@ export type Reasoning$Outbound = {
366
366
  export declare const Reasoning$outboundSchema: z.ZodType<Reasoning$Outbound, Reasoning>;
367
367
  export declare function reasoningToJSON(reasoning: Reasoning): string;
368
368
  /** @internal */
369
- export type ChatGenerationParamsResponseFormatPython$Outbound = {
369
+ export type ResponseFormatPython$Outbound = {
370
370
  type: "python";
371
371
  };
372
372
  /** @internal */
373
- export declare const ChatGenerationParamsResponseFormatPython$outboundSchema: z.ZodType<ChatGenerationParamsResponseFormatPython$Outbound, ChatGenerationParamsResponseFormatPython>;
374
- export declare function chatGenerationParamsResponseFormatPythonToJSON(chatGenerationParamsResponseFormatPython: ChatGenerationParamsResponseFormatPython): string;
373
+ export declare const ResponseFormatPython$outboundSchema: z.ZodType<ResponseFormatPython$Outbound, ResponseFormatPython>;
374
+ export declare function responseFormatPythonToJSON(responseFormatPython: ResponseFormatPython): string;
375
375
  /** @internal */
376
- export type ChatGenerationParamsResponseFormatJSONObject$Outbound = {
376
+ export type ResponseFormatJSONObject$Outbound = {
377
377
  type: "json_object";
378
378
  };
379
379
  /** @internal */
380
- export declare const ChatGenerationParamsResponseFormatJSONObject$outboundSchema: z.ZodType<ChatGenerationParamsResponseFormatJSONObject$Outbound, ChatGenerationParamsResponseFormatJSONObject>;
381
- export declare function chatGenerationParamsResponseFormatJSONObjectToJSON(chatGenerationParamsResponseFormatJSONObject: ChatGenerationParamsResponseFormatJSONObject): string;
380
+ export declare const ResponseFormatJSONObject$outboundSchema: z.ZodType<ResponseFormatJSONObject$Outbound, ResponseFormatJSONObject>;
381
+ export declare function responseFormatJSONObjectToJSON(responseFormatJSONObject: ResponseFormatJSONObject): string;
382
382
  /** @internal */
383
- export type ChatGenerationParamsResponseFormatText$Outbound = {
383
+ export type ResponseFormatText$Outbound = {
384
384
  type: "text";
385
385
  };
386
386
  /** @internal */
387
- export declare const ChatGenerationParamsResponseFormatText$outboundSchema: z.ZodType<ChatGenerationParamsResponseFormatText$Outbound, ChatGenerationParamsResponseFormatText>;
388
- export declare function chatGenerationParamsResponseFormatTextToJSON(chatGenerationParamsResponseFormatText: ChatGenerationParamsResponseFormatText): string;
387
+ export declare const ResponseFormatText$outboundSchema: z.ZodType<ResponseFormatText$Outbound, ResponseFormatText>;
388
+ export declare function responseFormatTextToJSON(responseFormatText: ResponseFormatText): string;
389
389
  /** @internal */
390
- export type ChatGenerationParamsResponseFormatUnion$Outbound = ChatGenerationParamsResponseFormatText$Outbound | ChatGenerationParamsResponseFormatJSONObject$Outbound | ResponseFormatJSONSchema$Outbound | ResponseFormatTextGrammar$Outbound | ChatGenerationParamsResponseFormatPython$Outbound;
390
+ export type ResponseFormat$Outbound = ResponseFormatText$Outbound | ResponseFormatJSONObject$Outbound | ResponseFormatJSONSchema$Outbound | ResponseFormatTextGrammar$Outbound | ResponseFormatPython$Outbound;
391
391
  /** @internal */
392
- export declare const ChatGenerationParamsResponseFormatUnion$outboundSchema: z.ZodType<ChatGenerationParamsResponseFormatUnion$Outbound, ChatGenerationParamsResponseFormatUnion>;
393
- export declare function chatGenerationParamsResponseFormatUnionToJSON(chatGenerationParamsResponseFormatUnion: ChatGenerationParamsResponseFormatUnion): string;
392
+ export declare const ResponseFormat$outboundSchema: z.ZodType<ResponseFormat$Outbound, ResponseFormat>;
393
+ export declare function responseFormatToJSON(responseFormat: ResponseFormat): string;
394
394
  /** @internal */
395
- export type ChatGenerationParamsStop$Outbound = string | Array<string>;
395
+ export type Stop$Outbound = string | Array<string>;
396
396
  /** @internal */
397
- export declare const ChatGenerationParamsStop$outboundSchema: z.ZodType<ChatGenerationParamsStop$Outbound, ChatGenerationParamsStop>;
398
- export declare function chatGenerationParamsStopToJSON(chatGenerationParamsStop: ChatGenerationParamsStop): string;
397
+ export declare const Stop$outboundSchema: z.ZodType<Stop$Outbound, Stop>;
398
+ export declare function stopToJSON(stop: Stop): string;
399
399
  /** @internal */
400
400
  export type Debug$Outbound = {
401
401
  echo_upstream_body?: boolean | undefined;
@@ -433,7 +433,7 @@ export type ChatGenerationParams$Outbound = {
433
433
  } | undefined;
434
434
  presence_penalty?: number | null | undefined;
435
435
  reasoning?: Reasoning$Outbound | undefined;
436
- response_format?: ChatGenerationParamsResponseFormatText$Outbound | ChatGenerationParamsResponseFormatJSONObject$Outbound | ResponseFormatJSONSchema$Outbound | ResponseFormatTextGrammar$Outbound | ChatGenerationParamsResponseFormatPython$Outbound | undefined;
436
+ response_format?: ResponseFormatText$Outbound | ResponseFormatJSONObject$Outbound | ResponseFormatJSONSchema$Outbound | ResponseFormatTextGrammar$Outbound | ResponseFormatPython$Outbound | undefined;
437
437
  seed?: number | null | undefined;
438
438
  stop?: string | Array<string> | null | undefined;
439
439
  stream: boolean;
@@ -233,41 +233,44 @@ export function reasoningToJSON(reasoning) {
233
233
  return JSON.stringify(Reasoning$outboundSchema.parse(reasoning));
234
234
  }
235
235
  /** @internal */
236
- export const ChatGenerationParamsResponseFormatPython$outboundSchema = z.object({
236
+ export const ResponseFormatPython$outboundSchema = z.object({
237
237
  type: z.literal("python"),
238
238
  });
239
- export function chatGenerationParamsResponseFormatPythonToJSON(chatGenerationParamsResponseFormatPython) {
240
- return JSON.stringify(ChatGenerationParamsResponseFormatPython$outboundSchema.parse(chatGenerationParamsResponseFormatPython));
239
+ export function responseFormatPythonToJSON(responseFormatPython) {
240
+ return JSON.stringify(ResponseFormatPython$outboundSchema.parse(responseFormatPython));
241
241
  }
242
242
  /** @internal */
243
- export const ChatGenerationParamsResponseFormatJSONObject$outboundSchema = z.object({
243
+ export const ResponseFormatJSONObject$outboundSchema = z.object({
244
244
  type: z.literal("json_object"),
245
245
  });
246
- export function chatGenerationParamsResponseFormatJSONObjectToJSON(chatGenerationParamsResponseFormatJSONObject) {
247
- return JSON.stringify(ChatGenerationParamsResponseFormatJSONObject$outboundSchema.parse(chatGenerationParamsResponseFormatJSONObject));
246
+ export function responseFormatJSONObjectToJSON(responseFormatJSONObject) {
247
+ return JSON.stringify(ResponseFormatJSONObject$outboundSchema.parse(responseFormatJSONObject));
248
248
  }
249
249
  /** @internal */
250
- export const ChatGenerationParamsResponseFormatText$outboundSchema = z.object({
250
+ export const ResponseFormatText$outboundSchema = z.object({
251
251
  type: z.literal("text"),
252
252
  });
253
- export function chatGenerationParamsResponseFormatTextToJSON(chatGenerationParamsResponseFormatText) {
254
- return JSON.stringify(ChatGenerationParamsResponseFormatText$outboundSchema.parse(chatGenerationParamsResponseFormatText));
253
+ export function responseFormatTextToJSON(responseFormatText) {
254
+ return JSON.stringify(ResponseFormatText$outboundSchema.parse(responseFormatText));
255
255
  }
256
256
  /** @internal */
257
- export const ChatGenerationParamsResponseFormatUnion$outboundSchema = z.union([
258
- z.lazy(() => ChatGenerationParamsResponseFormatText$outboundSchema),
259
- z.lazy(() => ChatGenerationParamsResponseFormatJSONObject$outboundSchema),
257
+ export const ResponseFormat$outboundSchema = z.union([
258
+ z.lazy(() => ResponseFormatText$outboundSchema),
259
+ z.lazy(() => ResponseFormatJSONObject$outboundSchema),
260
260
  ResponseFormatJSONSchema$outboundSchema,
261
261
  ResponseFormatTextGrammar$outboundSchema,
262
- z.lazy(() => ChatGenerationParamsResponseFormatPython$outboundSchema),
262
+ z.lazy(() => ResponseFormatPython$outboundSchema),
263
263
  ]);
264
- export function chatGenerationParamsResponseFormatUnionToJSON(chatGenerationParamsResponseFormatUnion) {
265
- return JSON.stringify(ChatGenerationParamsResponseFormatUnion$outboundSchema.parse(chatGenerationParamsResponseFormatUnion));
264
+ export function responseFormatToJSON(responseFormat) {
265
+ return JSON.stringify(ResponseFormat$outboundSchema.parse(responseFormat));
266
266
  }
267
267
  /** @internal */
268
- export const ChatGenerationParamsStop$outboundSchema = z.union([z.string(), z.array(z.string())]);
269
- export function chatGenerationParamsStopToJSON(chatGenerationParamsStop) {
270
- return JSON.stringify(ChatGenerationParamsStop$outboundSchema.parse(chatGenerationParamsStop));
268
+ export const Stop$outboundSchema = z.union([
269
+ z.string(),
270
+ z.array(z.string()),
271
+ ]);
272
+ export function stopToJSON(stop) {
273
+ return JSON.stringify(Stop$outboundSchema.parse(stop));
271
274
  }
272
275
  /** @internal */
273
276
  export const Debug$outboundSchema = z.object({
@@ -314,11 +317,11 @@ export const ChatGenerationParams$outboundSchema = z.object({
314
317
  presencePenalty: z.nullable(z.number()).optional(),
315
318
  reasoning: z.lazy(() => Reasoning$outboundSchema).optional(),
316
319
  responseFormat: z.union([
317
- z.lazy(() => ChatGenerationParamsResponseFormatText$outboundSchema),
318
- z.lazy(() => ChatGenerationParamsResponseFormatJSONObject$outboundSchema),
320
+ z.lazy(() => ResponseFormatText$outboundSchema),
321
+ z.lazy(() => ResponseFormatJSONObject$outboundSchema),
319
322
  ResponseFormatJSONSchema$outboundSchema,
320
323
  ResponseFormatTextGrammar$outboundSchema,
321
- z.lazy(() => ChatGenerationParamsResponseFormatPython$outboundSchema),
324
+ z.lazy(() => ResponseFormatPython$outboundSchema),
322
325
  ]).optional(),
323
326
  seed: z.nullable(z.int()).optional(),
324
327
  stop: z.nullable(z.union([z.string(), z.array(z.string())])).optional(),
@@ -22,11 +22,6 @@ export * from "./chatstreamingmessagechunk.js";
22
22
  export * from "./chatstreamingmessagetoolcall.js";
23
23
  export * from "./chatstreamingresponsechunk.js";
24
24
  export * from "./chatstreamoptions.js";
25
- export * from "./completionchoice.js";
26
- export * from "./completioncreateparams.js";
27
- export * from "./completionlogprobs.js";
28
- export * from "./completionresponse.js";
29
- export * from "./completionusage.js";
30
25
  export * from "./createchargerequest.js";
31
26
  export * from "./datacollection.js";
32
27
  export * from "./defaultparameters.js";
@@ -26,11 +26,6 @@ export * from "./chatstreamingmessagechunk.js";
26
26
  export * from "./chatstreamingmessagetoolcall.js";
27
27
  export * from "./chatstreamingresponsechunk.js";
28
28
  export * from "./chatstreamoptions.js";
29
- export * from "./completionchoice.js";
30
- export * from "./completioncreateparams.js";
31
- export * from "./completionlogprobs.js";
32
- export * from "./completionresponse.js";
33
- export * from "./completionusage.js";
34
29
  export * from "./createchargerequest.js";
35
30
  export * from "./datacollection.js";
36
31
  export * from "./defaultparameters.js";