@opencode-ai/ai 0.0.0-next-16599 → 0.0.0-next-16601

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.
@@ -366,7 +366,6 @@ export declare const protocol: Protocol<{
366
366
  } | undefined;
367
367
  }[] | undefined;
368
368
  readonly temperature?: number | undefined;
369
- readonly stop_sequences?: readonly string[] | undefined;
370
369
  readonly thinking?: {
371
370
  readonly type: "enabled";
372
371
  readonly budget_tokens: number;
@@ -382,8 +381,9 @@ export declare const protocol: Protocol<{
382
381
  readonly type: "tool";
383
382
  readonly name: string;
384
383
  } | undefined;
385
- readonly top_k?: number | undefined;
386
384
  readonly top_p?: number | undefined;
385
+ readonly top_k?: number | undefined;
386
+ readonly stop_sequences?: readonly string[] | undefined;
387
387
  readonly output_config?: {
388
388
  readonly effort?: string | undefined;
389
389
  } | undefined;
@@ -608,7 +608,6 @@ export declare const route: Route<{
608
608
  } | undefined;
609
609
  }[] | undefined;
610
610
  readonly temperature?: number | undefined;
611
- readonly stop_sequences?: readonly string[] | undefined;
612
611
  readonly thinking?: {
613
612
  readonly type: "enabled";
614
613
  readonly budget_tokens: number;
@@ -624,8 +623,9 @@ export declare const route: Route<{
624
623
  readonly type: "tool";
625
624
  readonly name: string;
626
625
  } | undefined;
627
- readonly top_k?: number | undefined;
628
626
  readonly top_p?: number | undefined;
627
+ readonly top_k?: number | undefined;
628
+ readonly stop_sequences?: readonly string[] | undefined;
629
629
  readonly output_config?: {
630
630
  readonly effort?: string | undefined;
631
631
  } | undefined;
@@ -139,23 +139,6 @@ export declare const protocol: Protocol<{
139
139
  } | undefined;
140
140
  }[];
141
141
  }[] | undefined;
142
- readonly generationConfig?: {
143
- readonly temperature?: number | undefined;
144
- readonly topP?: number | undefined;
145
- readonly topK?: number | undefined;
146
- readonly stopSequences?: readonly string[] | undefined;
147
- readonly thinkingConfig?: {
148
- readonly thinkingBudget?: number | undefined;
149
- readonly includeThoughts?: boolean | undefined;
150
- readonly thinkingLevel?: string | undefined;
151
- } | undefined;
152
- readonly maxOutputTokens?: number | undefined;
153
- } | undefined;
154
- readonly systemInstruction?: {
155
- readonly parts: readonly {
156
- readonly text: string;
157
- }[];
158
- } | undefined;
159
142
  readonly toolConfig?: {
160
143
  readonly functionCallingConfig: {
161
144
  readonly mode: "AUTO" | "NONE" | "ANY";
@@ -168,6 +151,23 @@ export declare const protocol: Protocol<{
168
151
  readonly threshold: string;
169
152
  }[] | undefined;
170
153
  readonly serviceTier?: string | undefined;
154
+ readonly systemInstruction?: {
155
+ readonly parts: readonly {
156
+ readonly text: string;
157
+ }[];
158
+ } | undefined;
159
+ readonly generationConfig?: {
160
+ readonly temperature?: number | undefined;
161
+ readonly topP?: number | undefined;
162
+ readonly topK?: number | undefined;
163
+ readonly stopSequences?: readonly string[] | undefined;
164
+ readonly thinkingConfig?: {
165
+ readonly thinkingBudget?: number | undefined;
166
+ readonly includeThoughts?: boolean | undefined;
167
+ readonly thinkingLevel?: string | undefined;
168
+ } | undefined;
169
+ readonly maxOutputTokens?: number | undefined;
170
+ } | undefined;
171
171
  }, string, {
172
172
  readonly candidates?: readonly {
173
173
  readonly content?: {
@@ -258,23 +258,6 @@ export declare const route: Route<{
258
258
  } | undefined;
259
259
  }[];
260
260
  }[] | undefined;
261
- readonly generationConfig?: {
262
- readonly temperature?: number | undefined;
263
- readonly topP?: number | undefined;
264
- readonly topK?: number | undefined;
265
- readonly stopSequences?: readonly string[] | undefined;
266
- readonly thinkingConfig?: {
267
- readonly thinkingBudget?: number | undefined;
268
- readonly includeThoughts?: boolean | undefined;
269
- readonly thinkingLevel?: string | undefined;
270
- } | undefined;
271
- readonly maxOutputTokens?: number | undefined;
272
- } | undefined;
273
- readonly systemInstruction?: {
274
- readonly parts: readonly {
275
- readonly text: string;
276
- }[];
277
- } | undefined;
278
261
  readonly toolConfig?: {
279
262
  readonly functionCallingConfig: {
280
263
  readonly mode: "AUTO" | "NONE" | "ANY";
@@ -287,5 +270,22 @@ export declare const route: Route<{
287
270
  readonly threshold: string;
288
271
  }[] | undefined;
289
272
  readonly serviceTier?: string | undefined;
273
+ readonly systemInstruction?: {
274
+ readonly parts: readonly {
275
+ readonly text: string;
276
+ }[];
277
+ } | undefined;
278
+ readonly generationConfig?: {
279
+ readonly temperature?: number | undefined;
280
+ readonly topP?: number | undefined;
281
+ readonly topK?: number | undefined;
282
+ readonly stopSequences?: readonly string[] | undefined;
283
+ readonly thinkingConfig?: {
284
+ readonly thinkingBudget?: number | undefined;
285
+ readonly includeThoughts?: boolean | undefined;
286
+ readonly thinkingLevel?: string | undefined;
287
+ } | undefined;
288
+ readonly maxOutputTokens?: number | undefined;
289
+ } | undefined;
290
290
  }, import("../route/transport/http").HttpPrepared<string>>;
291
291
  export * as Gemini from "./gemini";
@@ -63,6 +63,7 @@ export declare const bodyFields: {
63
63
  }>>;
64
64
  store: Schema.optional<Schema.Boolean>;
65
65
  reasoning_effort: Schema.optional<Schema.String>;
66
+ max_completion_tokens: Schema.optional<Schema.Number>;
66
67
  max_tokens: Schema.optional<Schema.Number>;
67
68
  temperature: Schema.optional<Schema.Number>;
68
69
  top_p: Schema.optional<Schema.Number>;
@@ -127,6 +128,7 @@ declare const OpenAIChatBody: Schema.Struct<{
127
128
  }>>;
128
129
  store: Schema.optional<Schema.Boolean>;
129
130
  reasoning_effort: Schema.optional<Schema.String>;
131
+ max_completion_tokens: Schema.optional<Schema.Number>;
130
132
  max_tokens: Schema.optional<Schema.Number>;
131
133
  temperature: Schema.optional<Schema.Number>;
132
134
  top_p: Schema.optional<Schema.Number>;
@@ -248,12 +250,8 @@ export declare const protocol: Protocol<{
248
250
  }[] | undefined;
249
251
  readonly temperature?: number | undefined;
250
252
  readonly seed?: number | undefined;
251
- readonly frequency_penalty?: number | undefined;
253
+ readonly max_completion_tokens?: number | undefined;
252
254
  readonly max_tokens?: number | undefined;
253
- readonly presence_penalty?: number | undefined;
254
- readonly stream_options?: {
255
- readonly include_usage: boolean;
256
- } | undefined;
257
255
  readonly tool_choice?: "required" | "none" | "auto" | {
258
256
  readonly type: "function";
259
257
  readonly function: {
@@ -262,7 +260,12 @@ export declare const protocol: Protocol<{
262
260
  } | undefined;
263
261
  readonly top_p?: number | undefined;
264
262
  readonly store?: boolean | undefined;
263
+ readonly stream_options?: {
264
+ readonly include_usage: boolean;
265
+ } | undefined;
265
266
  readonly reasoning_effort?: string | undefined;
267
+ readonly frequency_penalty?: number | undefined;
268
+ readonly presence_penalty?: number | undefined;
266
269
  }, string, {
267
270
  readonly error?: {
268
271
  readonly message: string;
@@ -352,12 +355,8 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
352
355
  }[] | undefined;
353
356
  readonly temperature?: number | undefined;
354
357
  readonly seed?: number | undefined;
355
- readonly frequency_penalty?: number | undefined;
358
+ readonly max_completion_tokens?: number | undefined;
356
359
  readonly max_tokens?: number | undefined;
357
- readonly presence_penalty?: number | undefined;
358
- readonly stream_options?: {
359
- readonly include_usage: boolean;
360
- } | undefined;
361
360
  readonly tool_choice?: "required" | "none" | "auto" | {
362
361
  readonly type: "function";
363
362
  readonly function: {
@@ -366,7 +365,12 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
366
365
  } | undefined;
367
366
  readonly top_p?: number | undefined;
368
367
  readonly store?: boolean | undefined;
368
+ readonly stream_options?: {
369
+ readonly include_usage: boolean;
370
+ } | undefined;
369
371
  readonly reasoning_effort?: string | undefined;
372
+ readonly frequency_penalty?: number | undefined;
373
+ readonly presence_penalty?: number | undefined;
370
374
  }, string>;
371
375
  export declare const route: Route<{
372
376
  readonly model: string;
@@ -419,12 +423,8 @@ export declare const route: Route<{
419
423
  }[] | undefined;
420
424
  readonly temperature?: number | undefined;
421
425
  readonly seed?: number | undefined;
422
- readonly frequency_penalty?: number | undefined;
426
+ readonly max_completion_tokens?: number | undefined;
423
427
  readonly max_tokens?: number | undefined;
424
- readonly presence_penalty?: number | undefined;
425
- readonly stream_options?: {
426
- readonly include_usage: boolean;
427
- } | undefined;
428
428
  readonly tool_choice?: "required" | "none" | "auto" | {
429
429
  readonly type: "function";
430
430
  readonly function: {
@@ -433,6 +433,11 @@ export declare const route: Route<{
433
433
  } | undefined;
434
434
  readonly top_p?: number | undefined;
435
435
  readonly store?: boolean | undefined;
436
+ readonly stream_options?: {
437
+ readonly include_usage: boolean;
438
+ } | undefined;
436
439
  readonly reasoning_effort?: string | undefined;
440
+ readonly frequency_penalty?: number | undefined;
441
+ readonly presence_penalty?: number | undefined;
437
442
  }, HttpTransport.HttpPrepared<string>>;
438
443
  export * as OpenAIChat from "./openai-chat";
@@ -80,6 +80,7 @@ export const bodyFields = {
80
80
  stream_options: Schema.optional(Schema.Struct({ include_usage: Schema.Boolean })),
81
81
  store: Schema.optional(Schema.Boolean),
82
82
  reasoning_effort: Schema.optional(OpenAIOptions.OpenAIReasoningEffort),
83
+ max_completion_tokens: Schema.optional(Schema.Number),
83
84
  max_tokens: Schema.optional(Schema.Number),
84
85
  temperature: Schema.optional(Schema.Number),
85
86
  top_p: Schema.optional(Schema.Number),
@@ -336,6 +337,7 @@ const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (request) {
336
337
  return yield* ProviderShared.invalidRequest(`OpenAI Chat reasoning field conflicts with reserved field ${reasoningField}`);
337
338
  const generation = request.generation;
338
339
  const toolSchemaCompatibility = request.model.compatibility?.toolSchema;
340
+ const maxTokensField = request.model.compatibility?.maxTokensField ?? "max_tokens";
339
341
  return {
340
342
  model: request.model.id,
341
343
  messages: yield* lowerMessages(request),
@@ -345,7 +347,9 @@ const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (request) {
345
347
  tool_choice: request.toolChoice ? yield* lowerToolChoice(request.toolChoice) : undefined,
346
348
  stream: true,
347
349
  stream_options: { include_usage: true },
348
- max_tokens: generation?.maxTokens,
350
+ ...(maxTokensField === "max_completion_tokens"
351
+ ? { max_completion_tokens: generation?.maxTokens }
352
+ : { max_tokens: generation?.maxTokens }),
349
353
  temperature: generation?.temperature,
350
354
  top_p: generation?.topP,
351
355
  frequency_penalty: generation?.frequencyPenalty,
@@ -58,12 +58,8 @@ export declare const route: Route<{
58
58
  }[] | undefined;
59
59
  readonly temperature?: number | undefined;
60
60
  readonly seed?: number | undefined;
61
- readonly frequency_penalty?: number | undefined;
61
+ readonly max_completion_tokens?: number | undefined;
62
62
  readonly max_tokens?: number | undefined;
63
- readonly presence_penalty?: number | undefined;
64
- readonly stream_options?: {
65
- readonly include_usage: boolean;
66
- } | undefined;
67
63
  readonly tool_choice?: "required" | "none" | "auto" | {
68
64
  readonly type: "function";
69
65
  readonly function: {
@@ -72,6 +68,11 @@ export declare const route: Route<{
72
68
  } | undefined;
73
69
  readonly top_p?: number | undefined;
74
70
  readonly store?: boolean | undefined;
71
+ readonly stream_options?: {
72
+ readonly include_usage: boolean;
73
+ } | undefined;
75
74
  readonly reasoning_effort?: string | undefined;
75
+ readonly frequency_penalty?: number | undefined;
76
+ readonly presence_penalty?: number | undefined;
76
77
  }, import("../route/transport/http").HttpPrepared<string>>;
77
78
  export * as OpenAICompatibleChat from "./openai-compatible-chat";
@@ -179,7 +179,6 @@ export declare const routes: import("../route").Route<{
179
179
  } | undefined;
180
180
  }[] | undefined;
181
181
  readonly temperature?: number | undefined;
182
- readonly stop_sequences?: readonly string[] | undefined;
183
182
  readonly thinking?: {
184
183
  readonly type: "enabled";
185
184
  readonly budget_tokens: number;
@@ -195,8 +194,9 @@ export declare const routes: import("../route").Route<{
195
194
  readonly type: "tool";
196
195
  readonly name: string;
197
196
  } | undefined;
198
- readonly top_k?: number | undefined;
199
197
  readonly top_p?: number | undefined;
198
+ readonly top_k?: number | undefined;
199
+ readonly stop_sequences?: readonly string[] | undefined;
200
200
  readonly output_config?: {
201
201
  readonly effort?: string | undefined;
202
202
  } | undefined;
@@ -163,7 +163,6 @@ export declare const routes: import("../route").Route<{
163
163
  } | undefined;
164
164
  }[] | undefined;
165
165
  readonly temperature?: number | undefined;
166
- readonly stop_sequences?: readonly string[] | undefined;
167
166
  readonly thinking?: {
168
167
  readonly type: "enabled";
169
168
  readonly budget_tokens: number;
@@ -179,8 +178,9 @@ export declare const routes: import("../route").Route<{
179
178
  readonly type: "tool";
180
179
  readonly name: string;
181
180
  } | undefined;
182
- readonly top_k?: number | undefined;
183
181
  readonly top_p?: number | undefined;
182
+ readonly top_k?: number | undefined;
183
+ readonly stop_sequences?: readonly string[] | undefined;
184
184
  readonly output_config?: {
185
185
  readonly effort?: string | undefined;
186
186
  } | undefined;
@@ -72,12 +72,8 @@ export declare const routes: (RouteDef<{
72
72
  }[] | undefined;
73
73
  readonly temperature?: number | undefined;
74
74
  readonly seed?: number | undefined;
75
- readonly frequency_penalty?: number | undefined;
75
+ readonly max_completion_tokens?: number | undefined;
76
76
  readonly max_tokens?: number | undefined;
77
- readonly presence_penalty?: number | undefined;
78
- readonly stream_options?: {
79
- readonly include_usage: boolean;
80
- } | undefined;
81
77
  readonly tool_choice?: "required" | "none" | "auto" | {
82
78
  readonly type: "function";
83
79
  readonly function: {
@@ -86,7 +82,12 @@ export declare const routes: (RouteDef<{
86
82
  } | undefined;
87
83
  readonly top_p?: number | undefined;
88
84
  readonly store?: boolean | undefined;
85
+ readonly stream_options?: {
86
+ readonly include_usage: boolean;
87
+ } | undefined;
89
88
  readonly reasoning_effort?: string | undefined;
89
+ readonly frequency_penalty?: number | undefined;
90
+ readonly presence_penalty?: number | undefined;
90
91
  }, import("../route/transport/http").HttpPrepared<string>> | RouteDef<{
91
92
  readonly input: readonly ({
92
93
  readonly type: "reasoning";
@@ -79,12 +79,8 @@ export declare const aiGatewayRoute: import("../route").Route<{
79
79
  }[] | undefined;
80
80
  readonly temperature?: number | undefined;
81
81
  readonly seed?: number | undefined;
82
- readonly frequency_penalty?: number | undefined;
82
+ readonly max_completion_tokens?: number | undefined;
83
83
  readonly max_tokens?: number | undefined;
84
- readonly presence_penalty?: number | undefined;
85
- readonly stream_options?: {
86
- readonly include_usage: boolean;
87
- } | undefined;
88
84
  readonly tool_choice?: "required" | "none" | "auto" | {
89
85
  readonly type: "function";
90
86
  readonly function: {
@@ -93,7 +89,12 @@ export declare const aiGatewayRoute: import("../route").Route<{
93
89
  } | undefined;
94
90
  readonly top_p?: number | undefined;
95
91
  readonly store?: boolean | undefined;
92
+ readonly stream_options?: {
93
+ readonly include_usage: boolean;
94
+ } | undefined;
96
95
  readonly reasoning_effort?: string | undefined;
96
+ readonly frequency_penalty?: number | undefined;
97
+ readonly presence_penalty?: number | undefined;
97
98
  }, import("../route/transport/http").HttpPrepared<string>>;
98
99
  export declare const workersAIRoute: import("../route").Route<{
99
100
  readonly model: string;
@@ -146,12 +147,8 @@ export declare const workersAIRoute: import("../route").Route<{
146
147
  }[] | undefined;
147
148
  readonly temperature?: number | undefined;
148
149
  readonly seed?: number | undefined;
149
- readonly frequency_penalty?: number | undefined;
150
+ readonly max_completion_tokens?: number | undefined;
150
151
  readonly max_tokens?: number | undefined;
151
- readonly presence_penalty?: number | undefined;
152
- readonly stream_options?: {
153
- readonly include_usage: boolean;
154
- } | undefined;
155
152
  readonly tool_choice?: "required" | "none" | "auto" | {
156
153
  readonly type: "function";
157
154
  readonly function: {
@@ -160,7 +157,12 @@ export declare const workersAIRoute: import("../route").Route<{
160
157
  } | undefined;
161
158
  readonly top_p?: number | undefined;
162
159
  readonly store?: boolean | undefined;
160
+ readonly stream_options?: {
161
+ readonly include_usage: boolean;
162
+ } | undefined;
163
163
  readonly reasoning_effort?: string | undefined;
164
+ readonly frequency_penalty?: number | undefined;
165
+ readonly presence_penalty?: number | undefined;
164
166
  }, import("../route/transport/http").HttpPrepared<string>>;
165
167
  export declare const routes: import("../route").Route<{
166
168
  readonly model: string;
@@ -213,12 +215,8 @@ export declare const routes: import("../route").Route<{
213
215
  }[] | undefined;
214
216
  readonly temperature?: number | undefined;
215
217
  readonly seed?: number | undefined;
216
- readonly frequency_penalty?: number | undefined;
218
+ readonly max_completion_tokens?: number | undefined;
217
219
  readonly max_tokens?: number | undefined;
218
- readonly presence_penalty?: number | undefined;
219
- readonly stream_options?: {
220
- readonly include_usage: boolean;
221
- } | undefined;
222
220
  readonly tool_choice?: "required" | "none" | "auto" | {
223
221
  readonly type: "function";
224
222
  readonly function: {
@@ -227,7 +225,12 @@ export declare const routes: import("../route").Route<{
227
225
  } | undefined;
228
226
  readonly top_p?: number | undefined;
229
227
  readonly store?: boolean | undefined;
228
+ readonly stream_options?: {
229
+ readonly include_usage: boolean;
230
+ } | undefined;
230
231
  readonly reasoning_effort?: string | undefined;
232
+ readonly frequency_penalty?: number | undefined;
233
+ readonly presence_penalty?: number | undefined;
231
234
  }, import("../route/transport/http").HttpPrepared<string>>[];
232
235
  export declare const CloudflareAIGateway: {
233
236
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
@@ -60,12 +60,8 @@ export declare const routes: (import("../route").Route<{
60
60
  }[] | undefined;
61
61
  readonly temperature?: number | undefined;
62
62
  readonly seed?: number | undefined;
63
- readonly frequency_penalty?: number | undefined;
63
+ readonly max_completion_tokens?: number | undefined;
64
64
  readonly max_tokens?: number | undefined;
65
- readonly presence_penalty?: number | undefined;
66
- readonly stream_options?: {
67
- readonly include_usage: boolean;
68
- } | undefined;
69
65
  readonly tool_choice?: "required" | "none" | "auto" | {
70
66
  readonly type: "function";
71
67
  readonly function: {
@@ -74,7 +70,12 @@ export declare const routes: (import("../route").Route<{
74
70
  } | undefined;
75
71
  readonly top_p?: number | undefined;
76
72
  readonly store?: boolean | undefined;
73
+ readonly stream_options?: {
74
+ readonly include_usage: boolean;
75
+ } | undefined;
77
76
  readonly reasoning_effort?: string | undefined;
77
+ readonly frequency_penalty?: number | undefined;
78
+ readonly presence_penalty?: number | undefined;
78
79
  }, import("../route/transport/http").HttpPrepared<string>> | import("../route").Route<{
79
80
  readonly input: readonly ({
80
81
  readonly type: "reasoning";
@@ -69,12 +69,8 @@ export declare const routes: import("../route").Route<{
69
69
  }[] | undefined;
70
70
  readonly temperature?: number | undefined;
71
71
  readonly seed?: number | undefined;
72
- readonly frequency_penalty?: number | undefined;
72
+ readonly max_completion_tokens?: number | undefined;
73
73
  readonly max_tokens?: number | undefined;
74
- readonly presence_penalty?: number | undefined;
75
- readonly stream_options?: {
76
- readonly include_usage: boolean;
77
- } | undefined;
78
74
  readonly tool_choice?: "required" | "none" | "auto" | {
79
75
  readonly type: "function";
80
76
  readonly function: {
@@ -83,7 +79,12 @@ export declare const routes: import("../route").Route<{
83
79
  } | undefined;
84
80
  readonly top_p?: number | undefined;
85
81
  readonly store?: boolean | undefined;
82
+ readonly stream_options?: {
83
+ readonly include_usage: boolean;
84
+ } | undefined;
86
85
  readonly reasoning_effort?: string | undefined;
86
+ readonly frequency_penalty?: number | undefined;
87
+ readonly presence_penalty?: number | undefined;
87
88
  }, import("../route/transport/http").HttpPrepared<string>>[];
88
89
  export declare const configure: (input?: Config) => {
89
90
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
@@ -177,7 +177,6 @@ export declare const routes: Route<{
177
177
  temperature?: number | undefined;
178
178
  stream: true;
179
179
  max_tokens: number;
180
- stop_sequences?: readonly string[] | undefined;
181
180
  thinking?: {
182
181
  readonly type: "enabled";
183
182
  readonly budget_tokens: number;
@@ -193,8 +192,9 @@ export declare const routes: Route<{
193
192
  readonly type: "tool";
194
193
  readonly name: string;
195
194
  } | undefined;
196
- top_k?: number | undefined;
197
195
  top_p?: number | undefined;
196
+ top_k?: number | undefined;
197
+ stop_sequences?: readonly string[] | undefined;
198
198
  output_config?: {
199
199
  readonly effort?: string | undefined;
200
200
  } | undefined;
@@ -66,23 +66,6 @@ export declare const routes: Route<{
66
66
  } | undefined;
67
67
  }[];
68
68
  }[] | undefined;
69
- readonly generationConfig?: {
70
- readonly temperature?: number | undefined;
71
- readonly topP?: number | undefined;
72
- readonly topK?: number | undefined;
73
- readonly stopSequences?: readonly string[] | undefined;
74
- readonly thinkingConfig?: {
75
- readonly thinkingBudget?: number | undefined;
76
- readonly includeThoughts?: boolean | undefined;
77
- readonly thinkingLevel?: string | undefined;
78
- } | undefined;
79
- readonly maxOutputTokens?: number | undefined;
80
- } | undefined;
81
- readonly systemInstruction?: {
82
- readonly parts: readonly {
83
- readonly text: string;
84
- }[];
85
- } | undefined;
86
69
  readonly toolConfig?: {
87
70
  readonly functionCallingConfig: {
88
71
  readonly mode: "AUTO" | "NONE" | "ANY";
@@ -95,6 +78,23 @@ export declare const routes: Route<{
95
78
  readonly threshold: string;
96
79
  }[] | undefined;
97
80
  readonly serviceTier?: string | undefined;
81
+ readonly systemInstruction?: {
82
+ readonly parts: readonly {
83
+ readonly text: string;
84
+ }[];
85
+ } | undefined;
86
+ readonly generationConfig?: {
87
+ readonly temperature?: number | undefined;
88
+ readonly topP?: number | undefined;
89
+ readonly topK?: number | undefined;
90
+ readonly stopSequences?: readonly string[] | undefined;
91
+ readonly thinkingConfig?: {
92
+ readonly thinkingBudget?: number | undefined;
93
+ readonly includeThoughts?: boolean | undefined;
94
+ readonly thinkingLevel?: string | undefined;
95
+ } | undefined;
96
+ readonly maxOutputTokens?: number | undefined;
97
+ } | undefined;
98
98
  }, import("../route/transport/http").HttpPrepared<string>>[];
99
99
  export declare const configure: (input?: Config) => {
100
100
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
@@ -49,23 +49,6 @@ export declare const routes: import("../route").Route<{
49
49
  } | undefined;
50
50
  }[];
51
51
  }[] | undefined;
52
- readonly generationConfig?: {
53
- readonly temperature?: number | undefined;
54
- readonly topP?: number | undefined;
55
- readonly topK?: number | undefined;
56
- readonly stopSequences?: readonly string[] | undefined;
57
- readonly thinkingConfig?: {
58
- readonly thinkingBudget?: number | undefined;
59
- readonly includeThoughts?: boolean | undefined;
60
- readonly thinkingLevel?: string | undefined;
61
- } | undefined;
62
- readonly maxOutputTokens?: number | undefined;
63
- } | undefined;
64
- readonly systemInstruction?: {
65
- readonly parts: readonly {
66
- readonly text: string;
67
- }[];
68
- } | undefined;
69
52
  readonly toolConfig?: {
70
53
  readonly functionCallingConfig: {
71
54
  readonly mode: "AUTO" | "NONE" | "ANY";
@@ -78,6 +61,23 @@ export declare const routes: import("../route").Route<{
78
61
  readonly threshold: string;
79
62
  }[] | undefined;
80
63
  readonly serviceTier?: string | undefined;
64
+ readonly systemInstruction?: {
65
+ readonly parts: readonly {
66
+ readonly text: string;
67
+ }[];
68
+ } | undefined;
69
+ readonly generationConfig?: {
70
+ readonly temperature?: number | undefined;
71
+ readonly topP?: number | undefined;
72
+ readonly topK?: number | undefined;
73
+ readonly stopSequences?: readonly string[] | undefined;
74
+ readonly thinkingConfig?: {
75
+ readonly thinkingBudget?: number | undefined;
76
+ readonly includeThoughts?: boolean | undefined;
77
+ readonly thinkingLevel?: string | undefined;
78
+ } | undefined;
79
+ readonly maxOutputTokens?: number | undefined;
80
+ } | undefined;
81
81
  }, import("../route/transport/http").HttpPrepared<string>>[];
82
82
  export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
83
83
  readonly baseURL?: string;
@@ -69,12 +69,8 @@ export declare const routes: import("../route").Route<{
69
69
  }[] | undefined;
70
70
  readonly temperature?: number | undefined;
71
71
  readonly seed?: number | undefined;
72
- readonly frequency_penalty?: number | undefined;
72
+ readonly max_completion_tokens?: number | undefined;
73
73
  readonly max_tokens?: number | undefined;
74
- readonly presence_penalty?: number | undefined;
75
- readonly stream_options?: {
76
- readonly include_usage: boolean;
77
- } | undefined;
78
74
  readonly tool_choice?: "required" | "none" | "auto" | {
79
75
  readonly type: "function";
80
76
  readonly function: {
@@ -83,7 +79,12 @@ export declare const routes: import("../route").Route<{
83
79
  } | undefined;
84
80
  readonly top_p?: number | undefined;
85
81
  readonly store?: boolean | undefined;
82
+ readonly stream_options?: {
83
+ readonly include_usage: boolean;
84
+ } | undefined;
86
85
  readonly reasoning_effort?: string | undefined;
86
+ readonly frequency_penalty?: number | undefined;
87
+ readonly presence_penalty?: number | undefined;
87
88
  }, import("../route/transport/http").HttpPrepared<string>>[];
88
89
  export declare const configure: (input: GenericModelOptions) => {
89
90
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
@@ -58,12 +58,8 @@ export declare const routes: (Route<{
58
58
  }[] | undefined;
59
59
  readonly temperature?: number | undefined;
60
60
  readonly seed?: number | undefined;
61
- readonly frequency_penalty?: number | undefined;
61
+ readonly max_completion_tokens?: number | undefined;
62
62
  readonly max_tokens?: number | undefined;
63
- readonly presence_penalty?: number | undefined;
64
- readonly stream_options?: {
65
- readonly include_usage: boolean;
66
- } | undefined;
67
63
  readonly tool_choice?: "required" | "none" | "auto" | {
68
64
  readonly type: "function";
69
65
  readonly function: {
@@ -72,7 +68,12 @@ export declare const routes: (Route<{
72
68
  } | undefined;
73
69
  readonly top_p?: number | undefined;
74
70
  readonly store?: boolean | undefined;
71
+ readonly stream_options?: {
72
+ readonly include_usage: boolean;
73
+ } | undefined;
75
74
  readonly reasoning_effort?: string | undefined;
75
+ readonly frequency_penalty?: number | undefined;
76
+ readonly presence_penalty?: number | undefined;
76
77
  }, import("../route/transport/http").HttpPrepared<string>> | Route<{
77
78
  readonly input: readonly ({
78
79
  readonly type: "reasoning";
@@ -84,6 +84,7 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
84
84
  }>>;
85
85
  store: Schema.optional<Schema.Boolean>;
86
86
  reasoning_effort: Schema.optional<Schema.String>;
87
+ max_completion_tokens: Schema.optional<Schema.Number>;
87
88
  max_tokens: Schema.optional<Schema.Number>;
88
89
  temperature: Schema.optional<Schema.Number>;
89
90
  top_p: Schema.optional<Schema.Number>;
@@ -145,12 +146,8 @@ export declare const protocol: Protocol<{
145
146
  }[] | undefined;
146
147
  readonly temperature?: number | undefined;
147
148
  readonly seed?: number | undefined;
148
- readonly frequency_penalty?: number | undefined;
149
+ readonly max_completion_tokens?: number | undefined;
149
150
  readonly max_tokens?: number | undefined;
150
- readonly presence_penalty?: number | undefined;
151
- readonly stream_options?: {
152
- readonly include_usage: boolean;
153
- } | undefined;
154
151
  readonly tool_choice?: "required" | "none" | "auto" | {
155
152
  readonly type: "function";
156
153
  readonly function: {
@@ -159,7 +156,12 @@ export declare const protocol: Protocol<{
159
156
  } | undefined;
160
157
  readonly top_p?: number | undefined;
161
158
  readonly store?: boolean | undefined;
159
+ readonly stream_options?: {
160
+ readonly include_usage: boolean;
161
+ } | undefined;
162
162
  readonly reasoning_effort?: string | undefined;
163
+ readonly frequency_penalty?: number | undefined;
164
+ readonly presence_penalty?: number | undefined;
163
165
  }, string, {
164
166
  readonly error?: {
165
167
  readonly message: string;
@@ -250,12 +252,8 @@ export declare const route: Route<{
250
252
  }[] | undefined;
251
253
  readonly temperature?: number | undefined;
252
254
  readonly seed?: number | undefined;
253
- readonly frequency_penalty?: number | undefined;
255
+ readonly max_completion_tokens?: number | undefined;
254
256
  readonly max_tokens?: number | undefined;
255
- readonly presence_penalty?: number | undefined;
256
- readonly stream_options?: {
257
- readonly include_usage: boolean;
258
- } | undefined;
259
257
  readonly tool_choice?: "required" | "none" | "auto" | {
260
258
  readonly type: "function";
261
259
  readonly function: {
@@ -264,7 +262,12 @@ export declare const route: Route<{
264
262
  } | undefined;
265
263
  readonly top_p?: number | undefined;
266
264
  readonly store?: boolean | undefined;
265
+ readonly stream_options?: {
266
+ readonly include_usage: boolean;
267
+ } | undefined;
267
268
  readonly reasoning_effort?: string | undefined;
269
+ readonly frequency_penalty?: number | undefined;
270
+ readonly presence_penalty?: number | undefined;
268
271
  }, import("../route/transport/http").HttpPrepared<string>>;
269
272
  export declare const routes: Route<{
270
273
  readonly [x: string]: any;
@@ -318,12 +321,8 @@ export declare const routes: Route<{
318
321
  }[] | undefined;
319
322
  readonly temperature?: number | undefined;
320
323
  readonly seed?: number | undefined;
321
- readonly frequency_penalty?: number | undefined;
324
+ readonly max_completion_tokens?: number | undefined;
322
325
  readonly max_tokens?: number | undefined;
323
- readonly presence_penalty?: number | undefined;
324
- readonly stream_options?: {
325
- readonly include_usage: boolean;
326
- } | undefined;
327
326
  readonly tool_choice?: "required" | "none" | "auto" | {
328
327
  readonly type: "function";
329
328
  readonly function: {
@@ -332,7 +331,12 @@ export declare const routes: Route<{
332
331
  } | undefined;
333
332
  readonly top_p?: number | undefined;
334
333
  readonly store?: boolean | undefined;
334
+ readonly stream_options?: {
335
+ readonly include_usage: boolean;
336
+ } | undefined;
335
337
  readonly reasoning_effort?: string | undefined;
338
+ readonly frequency_penalty?: number | undefined;
339
+ readonly presence_penalty?: number | undefined;
336
340
  }, import("../route/transport/http").HttpPrepared<string>>[];
337
341
  export declare const configure: (input?: ModelOptions) => {
338
342
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
@@ -68,12 +68,8 @@ export declare const routes: (Route<{
68
68
  }[] | undefined;
69
69
  readonly temperature?: number | undefined;
70
70
  readonly seed?: number | undefined;
71
- readonly frequency_penalty?: number | undefined;
71
+ readonly max_completion_tokens?: number | undefined;
72
72
  readonly max_tokens?: number | undefined;
73
- readonly presence_penalty?: number | undefined;
74
- readonly stream_options?: {
75
- readonly include_usage: boolean;
76
- } | undefined;
77
73
  readonly tool_choice?: "required" | "none" | "auto" | {
78
74
  readonly type: "function";
79
75
  readonly function: {
@@ -82,7 +78,12 @@ export declare const routes: (Route<{
82
78
  } | undefined;
83
79
  readonly top_p?: number | undefined;
84
80
  readonly store?: boolean | undefined;
81
+ readonly stream_options?: {
82
+ readonly include_usage: boolean;
83
+ } | undefined;
85
84
  readonly reasoning_effort?: string | undefined;
85
+ readonly frequency_penalty?: number | undefined;
86
+ readonly presence_penalty?: number | undefined;
86
87
  }, import("../route/transport/http").HttpPrepared<string>> | Route<{
87
88
  readonly input: readonly ({
88
89
  readonly type: "reasoning";
@@ -12,52 +12,9 @@ const applyQuery = (url, query) => {
12
12
  Object.entries(query).forEach(([key, value]) => next.searchParams.set(key, value));
13
13
  return next.toString();
14
14
  };
15
- const PROTOCOL_BODY_OVERLAY_DENYLIST = new Set([
16
- "anthropic_version",
17
- "content",
18
- "contents",
19
- "frequencyPenalty",
20
- "frequency_penalty",
21
- "generationConfig",
22
- "inferenceConfig",
23
- "input",
24
- "maxTokens",
25
- "max_tokens",
26
- "messages",
27
- "model",
28
- "presencePenalty",
29
- "presence_penalty",
30
- "responseFormat",
31
- "response_format",
32
- "seed",
33
- "stop",
34
- "stopSequences",
35
- "stop_sequences",
36
- "stream",
37
- "streamOptions",
38
- "stream_options",
39
- "system",
40
- "systemInstruction",
41
- "system_instruction",
42
- "temperature",
43
- "thinking",
44
- "toolChoice",
45
- "toolConfig",
46
- "tool_choice",
47
- "tool_config",
48
- "tools",
49
- "topK",
50
- "topP",
51
- "top_k",
52
- "top_p",
53
- ]);
54
- const forbiddenBodyOverlayKeys = (body) => Object.keys(body).filter((key) => PROTOCOL_BODY_OVERLAY_DENYLIST.has(key));
55
15
  const bodyWithOverlay = (body, request, encodeBody) => Effect.gen(function* () {
56
16
  if (request.http?.body === undefined)
57
17
  return { jsonBody: body, bodyText: encodeBody(body) };
58
- const forbiddenKeys = forbiddenBodyOverlayKeys(request.http.body);
59
- if (forbiddenKeys.length > 0)
60
- return yield* ProviderShared.invalidRequest(`http.body cannot overlay protocol-owned field(s): ${forbiddenKeys.join(", ")}`);
61
18
  if (ProviderShared.isRecord(body)) {
62
19
  const overlaid = mergeJsonRecords(body, request.http.body) ?? {};
63
20
  return { jsonBody: overlaid, bodyText: ProviderShared.encodeJson(overlaid) };
@@ -79,9 +79,12 @@ export declare namespace ModelDefaults {
79
79
  }
80
80
  export declare const ModelToolSchemaCompatibility: Schema.Literals<readonly ["gemini", "moonshot"]>;
81
81
  export type ModelToolSchemaCompatibility = Schema.Schema.Type<typeof ModelToolSchemaCompatibility>;
82
+ export declare const ModelMaxTokensFieldCompatibility: Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>;
83
+ export type ModelMaxTokensFieldCompatibility = Schema.Schema.Type<typeof ModelMaxTokensFieldCompatibility>;
82
84
  declare const ModelCompatibility_base: Schema.Class<ModelCompatibility, Schema.Struct<{
83
85
  readonly toolSchema: Schema.optional<Schema.Literals<readonly ["gemini", "moonshot"]>>;
84
86
  readonly reasoningField: Schema.optional<Schema.String>;
87
+ readonly maxTokensField: Schema.optional<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>;
85
88
  }>, {}>;
86
89
  export declare class ModelCompatibility extends ModelCompatibility_base {
87
90
  }
@@ -118,9 +118,11 @@ export class ModelDefaults extends Schema.Class("LLM.ModelDefaults")({
118
118
  };
119
119
  })(ModelDefaults || (ModelDefaults = {}));
120
120
  export const ModelToolSchemaCompatibility = Schema.Literals(["gemini", "moonshot"]);
121
+ export const ModelMaxTokensFieldCompatibility = Schema.Literals(["max_completion_tokens", "max_tokens"]);
121
122
  export class ModelCompatibility extends Schema.Class("LLM.ModelCompatibility")({
122
123
  toolSchema: Schema.optional(ModelToolSchemaCompatibility),
123
124
  reasoningField: Schema.optional(Schema.String),
125
+ maxTokensField: Schema.optional(ModelMaxTokensFieldCompatibility),
124
126
  }) {
125
127
  }
126
128
  (function (ModelCompatibility) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.0.0-next-16599",
3
+ "version": "0.0.0-next-16601",
4
4
  "name": "@opencode-ai/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@clack/prompts": "1.0.0-alpha.1",
32
32
  "@effect/platform-node": "4.0.0-beta.101",
33
- "@opencode-ai/http-recorder": "0.0.0-next-16599",
33
+ "@opencode-ai/http-recorder": "0.0.0-next-16601",
34
34
  "@tsconfig/bun": "1.0.9",
35
35
  "@types/bun": "1.3.13",
36
36
  "@typescript/native-preview": "7.0.0-dev.20251207.1",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@smithy/eventstream-codec": "4.2.14",
41
41
  "@smithy/util-utf8": "4.2.2",
42
- "@opencode-ai/schema": "0.0.0-next-16599",
42
+ "@opencode-ai/schema": "0.0.0-next-16601",
43
43
  "aws4fetch": "1.0.20",
44
44
  "effect": "4.0.0-beta.101",
45
45
  "google-auth-library": "10.5.0"