@opencode-ai/ai 0.0.0-beta-18286 → 0.0.0-beta-18314

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.
@@ -34,7 +34,12 @@ const resolve = (policy) => {
34
34
  // Protocols whose wire format ignores inline cache markers (OpenAI's implicit
35
35
  // prefix caching, Gemini's implicit + out-of-band CachedContent). Skip the
36
36
  // whole policy pass for these — emitting hints would be harmless but pointless.
37
- const RESPECTS_INLINE_HINTS = new Set(["anthropic-messages", "google-vertex-messages", "bedrock-converse", "openrouter"]);
37
+ const RESPECTS_INLINE_HINTS = new Set([
38
+ "anthropic-messages",
39
+ "google-vertex-messages",
40
+ "bedrock-converse",
41
+ "openrouter",
42
+ ]);
38
43
  const makeHint = (ttlSeconds) => ttlSeconds !== undefined ? new CacheHint({ type: "ephemeral", ttlSeconds }) : new CacheHint({ type: "ephemeral" });
39
44
  const markLastTool = (tools, hint, budget) => {
40
45
  if (tools.length === 0)
@@ -178,7 +178,11 @@ const AnthropicToolChoice = Schema.Union([
178
178
  type: Schema.Literals(["auto", "any", "none"]),
179
179
  disable_parallel_tool_use: Schema.optional(Schema.Boolean),
180
180
  }),
181
- Schema.Struct({ type: Schema.tag("tool"), name: Schema.String, disable_parallel_tool_use: Schema.optional(Schema.Boolean) }),
181
+ Schema.Struct({
182
+ type: Schema.tag("tool"),
183
+ name: Schema.String,
184
+ disable_parallel_tool_use: Schema.optional(Schema.Boolean),
185
+ }),
182
186
  ]);
183
187
  const AnthropicThinking = Schema.Union([
184
188
  Schema.Struct({
@@ -382,7 +386,11 @@ const lowerServerToolResult = Effect.fn("AnthropicMessages.lowerServerToolResult
382
386
  // Prefer the provider-owned replay payload; fall back to the result value for
383
387
  // histories constructed directly from provider events.
384
388
  const payload = part.providerMetadata?.anthropic?.["result"] ?? part.result.value;
385
- return { type: wireType, tool_use_id: scrubToolCallID(part.id), content: payload };
389
+ return {
390
+ type: wireType,
391
+ tool_use_id: scrubToolCallID(part.id),
392
+ content: payload,
393
+ };
386
394
  });
387
395
  const fileIdFromMetadata = (metadata) => {
388
396
  if (!ProviderShared.isRecord(metadata))
@@ -754,13 +762,13 @@ const lowerMessages = Effect.fn("AnthropicMessages.lowerMessages")(function* (re
754
762
  });
755
763
  const resolveOptions = Effect.fn("AnthropicMessages.resolveOptions")(function* (request) {
756
764
  const input = request.providerOptions;
757
- const rawServiceTier = input?.service_tier ?? input?.serviceTier;
765
+ const rawServiceTier = input?.service_tier ??
766
+ input?.serviceTier;
758
767
  const service_tier = rawServiceTier === "auto" || rawServiceTier === "standard_only"
759
768
  ? rawServiceTier
760
769
  : undefined;
761
770
  const rawMetadata = input?.metadata;
762
- const metadata = ProviderShared.isRecord(rawMetadata) &&
763
- (typeof rawMetadata.user_id === "string" || rawMetadata.user_id === null)
771
+ const metadata = ProviderShared.isRecord(rawMetadata) && (typeof rawMetadata.user_id === "string" || rawMetadata.user_id === null)
764
772
  ? { user_id: rawMetadata.user_id }
765
773
  : undefined;
766
774
  const container = typeof input?.container === "string" ||
@@ -1251,7 +1259,9 @@ export const route = Route.make({
1251
1259
  provider: "anthropic",
1252
1260
  providerMetadataKey: "anthropic",
1253
1261
  protocol,
1254
- endpoint: Endpoint.path((input) => (input.request.model.provider === "anthropic" ? `${PATH}?beta=true` : PATH), { baseURL: DEFAULT_BASE_URL }),
1262
+ endpoint: Endpoint.path((input) => (input.request.model.provider === "anthropic" ? `${PATH}?beta=true` : PATH), {
1263
+ baseURL: DEFAULT_BASE_URL,
1264
+ }),
1255
1265
  auth: Auth.none,
1256
1266
  framing,
1257
1267
  headers: () => ({ "anthropic-version": "2023-06-01" }),
@@ -508,7 +508,9 @@ const step = (state, event) => Effect.gen(function* () {
508
508
  module: ADAPTER,
509
509
  method: "stream",
510
510
  reason: classifyProviderFailure({
511
- message: event.exception.details.message ?? event.exception.details.originalMessage ?? "Bedrock Converse stream error",
511
+ message: event.exception.details.message ??
512
+ event.exception.details.originalMessage ??
513
+ "Bedrock Converse stream error",
512
514
  code: event.exception.type,
513
515
  }),
514
516
  });
@@ -535,7 +535,9 @@ const step = (state, event) => {
535
535
  id,
536
536
  name: part.functionCall.name,
537
537
  input,
538
- providerMetadata: part.thoughtSignature ? googleMetadata({ thoughtSignature: part.thoughtSignature }) : undefined,
538
+ providerMetadata: part.thoughtSignature
539
+ ? googleMetadata({ thoughtSignature: part.thoughtSignature })
540
+ : undefined,
539
541
  }));
540
542
  hasToolCalls = true;
541
543
  }
@@ -361,7 +361,10 @@ const lowerMessages = Effect.fn("OpenAIChat.lowerMessages")(function* (request,
361
361
  ...options,
362
362
  toolCallID: (id) => {
363
363
  if (mistral)
364
- return id.replace(/[^a-zA-Z0-9]/g, "").slice(0, 9).padEnd(9, "0");
364
+ return id
365
+ .replace(/[^a-zA-Z0-9]/g, "")
366
+ .slice(0, 9)
367
+ .padEnd(9, "0");
365
368
  if (modelID.includes("claude"))
366
369
  return id.replace(/[^a-zA-Z0-9_-]/g, "_");
367
370
  if (request.model.provider === "openai" || request.model.provider === "azure" || modelID.startsWith("openai/"))
@@ -424,7 +427,8 @@ const lowerMessages = Effect.fn("OpenAIChat.lowerMessages")(function* (request,
424
427
  : { role: "user", content: part.text });
425
428
  continue;
426
429
  }
427
- if (message.role === "assistant" && message.content.every((part) => part.type === "text" && part.text.trim() === ""))
430
+ if (message.role === "assistant" &&
431
+ message.content.every((part) => part.type === "text" && part.text.trim() === ""))
428
432
  continue;
429
433
  if (message.role === "tool") {
430
434
  const lowered = yield* lowerToolMessages(message, lowering);
@@ -573,8 +577,7 @@ export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (reques
573
577
  const supportsStore = request.model.compatibility?.supportsStore ?? detectSupportsStore(provider, baseURL);
574
578
  const supportsUsageInStreaming = request.model.compatibility?.supportsUsageInStreaming ?? detectSupportsUsageInStreaming();
575
579
  const supportsStrictMode = request.model.compatibility?.supportsStrictMode ?? detectSupportsStrictMode(provider, baseURL);
576
- const zaiToolStream = request.model.compatibility?.zaiToolStream ??
577
- detectZaiToolStream(provider, baseURL, request.model.id);
580
+ const zaiToolStream = request.model.compatibility?.zaiToolStream ?? detectZaiToolStream(provider, baseURL, request.model.id);
578
581
  const hasHistory = hasToolHistory(request.messages);
579
582
  const hasActiveTools = request.tools.length > 0;
580
583
  return {
@@ -14,7 +14,9 @@ export const ResponseIncludables = [
14
14
  "message.output_text.logprobs",
15
15
  ];
16
16
  export const ServiceTiers = ["auto", "default", "flex", "priority"];
17
- export const ServiceTier = Schema.declare((value) => typeof value === "string", { title: "ServiceTier" });
17
+ export const ServiceTier = Schema.declare((value) => typeof value === "string", {
18
+ title: "ServiceTier",
19
+ });
18
20
  export const Truncations = ["auto", "disabled"];
19
21
  export const TextVerbositySchema = TextVerbosity;
20
22
  export const ResponseIncludableSchema = Schema.declare((value) => typeof value === "string", { title: "ResponseIncludable" });
@@ -0,0 +1,315 @@
1
+ import type { ProviderPackage } from "../provider-package.js";
2
+ import { OpenAIChat } from "../protocols/openai-chat.js";
3
+ import { type ProviderAuthOption } from "../route/auth-options.js";
4
+ import { Route, type RouteDefaultsInput } from "../route/client.js";
5
+ import { Protocol } from "../route/protocol.js";
6
+ import { type ModelID } from "../schema/index.js";
7
+ import type { OpenAIProviderOptionsInput } from "./openai-options.js";
8
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
9
+ export type ProviderOptions = Pick<OpenAIProviderOptionsInput, "reasoningEffort"> & {
10
+ /** Controls visible reasoning on GPT-OSS; other models always use parsed reasoning. */
11
+ readonly includeReasoning?: boolean;
12
+ readonly parallelToolCalls?: boolean;
13
+ readonly serviceTier?: "on_demand" | "flex" | "auto" | "performance" | (string & {});
14
+ readonly user?: string;
15
+ };
16
+ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
17
+ readonly baseURL?: string;
18
+ readonly providerOptions?: ProviderOptions;
19
+ };
20
+ export interface Settings extends ProviderPackage.Settings {
21
+ readonly apiKey?: string;
22
+ readonly baseURL?: string;
23
+ readonly providerOptions?: ProviderOptions;
24
+ }
25
+ export declare const protocol: Protocol<{
26
+ readonly model: string;
27
+ readonly messages: readonly ({
28
+ readonly role: "system";
29
+ readonly content: string | readonly ({
30
+ readonly type: "text";
31
+ readonly text: string;
32
+ readonly cache_control?: {
33
+ readonly type: "ephemeral";
34
+ readonly ttl?: string | undefined;
35
+ } | undefined;
36
+ } | {
37
+ readonly type: "image_url";
38
+ readonly image_url: {
39
+ readonly url: string;
40
+ };
41
+ })[];
42
+ } | {
43
+ readonly role: "user";
44
+ readonly content: string | readonly ({
45
+ readonly type: "text";
46
+ readonly text: string;
47
+ readonly cache_control?: {
48
+ readonly type: "ephemeral";
49
+ readonly ttl?: string | undefined;
50
+ } | undefined;
51
+ } | {
52
+ readonly type: "image_url";
53
+ readonly image_url: {
54
+ readonly url: string;
55
+ };
56
+ })[];
57
+ } | {
58
+ readonly [x: string]: unknown;
59
+ readonly content: string | null;
60
+ readonly role: "assistant";
61
+ readonly reasoning?: string | undefined;
62
+ readonly reasoning_content?: string | undefined;
63
+ readonly reasoning_text?: string | undefined;
64
+ readonly cache_control?: {
65
+ readonly type: "ephemeral";
66
+ readonly ttl?: string | undefined;
67
+ } | undefined;
68
+ readonly tool_calls?: readonly {
69
+ readonly id: string;
70
+ readonly type: "function";
71
+ readonly function: {
72
+ readonly name: string;
73
+ readonly arguments: string;
74
+ };
75
+ }[] | undefined;
76
+ readonly reasoning_details?: unknown;
77
+ } | {
78
+ readonly content: string;
79
+ readonly role: "tool";
80
+ readonly tool_call_id: string;
81
+ readonly cache_control?: {
82
+ readonly type: "ephemeral";
83
+ readonly ttl?: string | undefined;
84
+ } | undefined;
85
+ })[];
86
+ readonly stream: true;
87
+ readonly max_completion_tokens?: number | undefined;
88
+ readonly max_tokens?: number | undefined;
89
+ readonly tools?: readonly {
90
+ readonly function: {
91
+ readonly description: string;
92
+ readonly name: string;
93
+ readonly parameters: {
94
+ readonly [x: string]: unknown;
95
+ };
96
+ readonly strict?: boolean | undefined;
97
+ };
98
+ readonly type: "function";
99
+ readonly cache_control?: {
100
+ readonly type: "ephemeral";
101
+ readonly ttl?: string | undefined;
102
+ } | undefined;
103
+ }[] | undefined;
104
+ readonly stop?: readonly string[] | undefined;
105
+ readonly user?: string | undefined;
106
+ readonly temperature?: number | undefined;
107
+ readonly seed?: number | undefined;
108
+ readonly service_tier?: string | undefined;
109
+ readonly tool_choice?: "required" | "auto" | "none" | {
110
+ readonly type: "function";
111
+ readonly function: {
112
+ readonly name: string;
113
+ };
114
+ } | undefined;
115
+ readonly top_p?: number | undefined;
116
+ readonly store?: boolean | undefined;
117
+ readonly stream_options?: {
118
+ readonly include_usage: boolean;
119
+ } | undefined;
120
+ readonly prompt_cache_key?: string | undefined;
121
+ readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
122
+ readonly tool_stream?: boolean | undefined;
123
+ readonly frequency_penalty?: number | undefined;
124
+ readonly presence_penalty?: number | undefined;
125
+ readonly parallel_tool_calls?: boolean | undefined;
126
+ readonly reasoning_format?: "parsed" | undefined;
127
+ readonly include_reasoning?: boolean | undefined;
128
+ }, string, {
129
+ readonly [x: string]: unknown;
130
+ readonly error?: {
131
+ readonly [x: string]: unknown;
132
+ readonly message: string;
133
+ readonly code?: string | number | null | undefined;
134
+ } | null | undefined;
135
+ readonly usage?: {
136
+ readonly [x: string]: unknown;
137
+ readonly prompt_tokens?: number | null | undefined;
138
+ readonly completion_tokens?: number | null | undefined;
139
+ readonly total_tokens?: number | null | undefined;
140
+ readonly cached_tokens?: number | null | undefined;
141
+ readonly prompt_cache_hit_tokens?: number | null | undefined;
142
+ readonly prompt_tokens_details?: {
143
+ readonly [x: string]: unknown;
144
+ readonly cached_tokens?: number | null | undefined;
145
+ readonly cache_write_tokens?: number | null | undefined;
146
+ } | null | undefined;
147
+ readonly completion_tokens_details?: {
148
+ readonly [x: string]: unknown;
149
+ readonly reasoning_tokens?: number | null | undefined;
150
+ readonly accepted_prediction_tokens?: number | null | undefined;
151
+ readonly rejected_prediction_tokens?: number | null | undefined;
152
+ } | null | undefined;
153
+ } | null | undefined;
154
+ readonly choices?: readonly {
155
+ readonly [x: string]: unknown;
156
+ readonly delta?: {
157
+ readonly [x: string]: unknown;
158
+ readonly reasoning?: string | null | undefined;
159
+ readonly reasoning_content?: string | null | undefined;
160
+ readonly reasoning_text?: string | null | undefined;
161
+ readonly content?: string | null | undefined;
162
+ readonly refusal?: string | null | undefined;
163
+ readonly tool_calls?: readonly {
164
+ readonly function?: {
165
+ readonly name?: string | null | undefined;
166
+ readonly arguments?: string | null | undefined;
167
+ } | null | undefined;
168
+ readonly id?: string | null | undefined;
169
+ readonly index?: number | null | undefined;
170
+ }[] | null | undefined;
171
+ readonly reasoning_details?: unknown;
172
+ } | null | undefined;
173
+ readonly usage?: {
174
+ readonly [x: string]: unknown;
175
+ readonly prompt_tokens?: number | null | undefined;
176
+ readonly completion_tokens?: number | null | undefined;
177
+ readonly total_tokens?: number | null | undefined;
178
+ readonly cached_tokens?: number | null | undefined;
179
+ readonly prompt_cache_hit_tokens?: number | null | undefined;
180
+ readonly prompt_tokens_details?: {
181
+ readonly [x: string]: unknown;
182
+ readonly cached_tokens?: number | null | undefined;
183
+ readonly cache_write_tokens?: number | null | undefined;
184
+ } | null | undefined;
185
+ readonly completion_tokens_details?: {
186
+ readonly [x: string]: unknown;
187
+ readonly reasoning_tokens?: number | null | undefined;
188
+ readonly accepted_prediction_tokens?: number | null | undefined;
189
+ readonly rejected_prediction_tokens?: number | null | undefined;
190
+ } | null | undefined;
191
+ } | null | undefined;
192
+ readonly finish_reason?: string | null | undefined;
193
+ readonly native_finish_reason?: string | null | undefined;
194
+ }[] | null | undefined;
195
+ }, OpenAIChat.ParserState>;
196
+ export declare const route: Route<{
197
+ readonly model: string;
198
+ readonly messages: readonly ({
199
+ readonly role: "system";
200
+ readonly content: string | readonly ({
201
+ readonly type: "text";
202
+ readonly text: string;
203
+ readonly cache_control?: {
204
+ readonly type: "ephemeral";
205
+ readonly ttl?: string | undefined;
206
+ } | undefined;
207
+ } | {
208
+ readonly type: "image_url";
209
+ readonly image_url: {
210
+ readonly url: string;
211
+ };
212
+ })[];
213
+ } | {
214
+ readonly role: "user";
215
+ readonly content: string | readonly ({
216
+ readonly type: "text";
217
+ readonly text: string;
218
+ readonly cache_control?: {
219
+ readonly type: "ephemeral";
220
+ readonly ttl?: string | undefined;
221
+ } | undefined;
222
+ } | {
223
+ readonly type: "image_url";
224
+ readonly image_url: {
225
+ readonly url: string;
226
+ };
227
+ })[];
228
+ } | {
229
+ readonly [x: string]: unknown;
230
+ readonly content: string | null;
231
+ readonly role: "assistant";
232
+ readonly reasoning?: string | undefined;
233
+ readonly reasoning_content?: string | undefined;
234
+ readonly reasoning_text?: string | undefined;
235
+ readonly cache_control?: {
236
+ readonly type: "ephemeral";
237
+ readonly ttl?: string | undefined;
238
+ } | undefined;
239
+ readonly tool_calls?: readonly {
240
+ readonly id: string;
241
+ readonly type: "function";
242
+ readonly function: {
243
+ readonly name: string;
244
+ readonly arguments: string;
245
+ };
246
+ }[] | undefined;
247
+ readonly reasoning_details?: unknown;
248
+ } | {
249
+ readonly content: string;
250
+ readonly role: "tool";
251
+ readonly tool_call_id: string;
252
+ readonly cache_control?: {
253
+ readonly type: "ephemeral";
254
+ readonly ttl?: string | undefined;
255
+ } | undefined;
256
+ })[];
257
+ readonly stream: true;
258
+ readonly max_completion_tokens?: number | undefined;
259
+ readonly max_tokens?: number | undefined;
260
+ readonly tools?: readonly {
261
+ readonly function: {
262
+ readonly description: string;
263
+ readonly name: string;
264
+ readonly parameters: {
265
+ readonly [x: string]: unknown;
266
+ };
267
+ readonly strict?: boolean | undefined;
268
+ };
269
+ readonly type: "function";
270
+ readonly cache_control?: {
271
+ readonly type: "ephemeral";
272
+ readonly ttl?: string | undefined;
273
+ } | undefined;
274
+ }[] | undefined;
275
+ readonly stop?: readonly string[] | undefined;
276
+ readonly user?: string | undefined;
277
+ readonly temperature?: number | undefined;
278
+ readonly seed?: number | undefined;
279
+ readonly service_tier?: string | undefined;
280
+ readonly tool_choice?: "required" | "auto" | "none" | {
281
+ readonly type: "function";
282
+ readonly function: {
283
+ readonly name: string;
284
+ };
285
+ } | undefined;
286
+ readonly top_p?: number | undefined;
287
+ readonly store?: boolean | undefined;
288
+ readonly stream_options?: {
289
+ readonly include_usage: boolean;
290
+ } | undefined;
291
+ readonly prompt_cache_key?: string | undefined;
292
+ readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
293
+ readonly tool_stream?: boolean | undefined;
294
+ readonly frequency_penalty?: number | undefined;
295
+ readonly presence_penalty?: number | undefined;
296
+ readonly parallel_tool_calls?: boolean | undefined;
297
+ readonly reasoning_format?: "parsed" | undefined;
298
+ readonly include_reasoning?: boolean | undefined;
299
+ }, import("../route/transport/http.js").HttpPrepared<string>>;
300
+ export declare const configure: (input?: LanguageModelOptions) => {
301
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
302
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ProviderOptions>;
303
+ configure: (input?: LanguageModelOptions) => /*elided*/ any;
304
+ };
305
+ export declare const provider: {
306
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
307
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ProviderOptions>;
308
+ configure: (input?: LanguageModelOptions) => {
309
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
310
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ProviderOptions>;
311
+ configure: /*elided*/ any;
312
+ };
313
+ };
314
+ export declare const model: ProviderPackage.Definition<Settings, ProviderOptions>["model"];
315
+ export * as Groq from "./groq.js";
@@ -0,0 +1,82 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { OpenAIChat } from "../protocols/openai-chat.js";
3
+ import { ProviderShared } from "../protocols/shared.js";
4
+ import { AuthOptions } from "../route/auth-options.js";
5
+ import { Route } from "../route/client.js";
6
+ import { Endpoint } from "../route/endpoint.js";
7
+ import { Framing } from "../route/framing.js";
8
+ import { Protocol } from "../route/protocol.js";
9
+ import { ProviderID } from "../schema/index.js";
10
+ import { profiles } from "./openai-compatible-profile.js";
11
+ export const id = ProviderID.make("groq");
12
+ const Options = Schema.Struct({
13
+ includeReasoning: Schema.optional(Schema.Boolean),
14
+ parallelToolCalls: Schema.optional(Schema.Boolean),
15
+ serviceTier: Schema.optional(Schema.String),
16
+ user: Schema.optional(Schema.String),
17
+ });
18
+ export const protocol = Protocol.make({
19
+ id: "groq-chat",
20
+ body: {
21
+ schema: Schema.Struct({
22
+ ...OpenAIChat.bodyFields,
23
+ reasoning_format: Schema.optional(Schema.Literal("parsed")),
24
+ include_reasoning: Schema.optional(Schema.Boolean),
25
+ parallel_tool_calls: Schema.optional(Schema.Boolean),
26
+ service_tier: Schema.optional(Schema.String),
27
+ user: Schema.optional(Schema.String),
28
+ }),
29
+ from: Effect.fn("Groq.fromRequest")(function* (request) {
30
+ const options = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(Options))(request.providerOptions ?? {});
31
+ const gptOSS = request.model.id.startsWith("openai/gpt-oss-");
32
+ return {
33
+ ...(yield* OpenAIChat.fromRequest(request)),
34
+ reasoning_format: gptOSS ? undefined : "parsed",
35
+ include_reasoning: gptOSS ? options.includeReasoning : undefined,
36
+ parallel_tool_calls: options.parallelToolCalls,
37
+ service_tier: options.serviceTier,
38
+ user: options.user,
39
+ };
40
+ }),
41
+ },
42
+ stream: OpenAIChat.protocol.stream,
43
+ });
44
+ export const route = Route.make({
45
+ id: "groq-chat",
46
+ provider: id,
47
+ providerMetadataKey: "openai",
48
+ protocol,
49
+ endpoint: Endpoint.path("/chat/completions", { baseURL: profiles.groq.baseURL }),
50
+ framing: Framing.sse,
51
+ });
52
+ export const configure = (input = {}) => {
53
+ const { apiKey: _apiKey, auth: _auth, baseURL, ...defaults } = input;
54
+ const configured = route.with({
55
+ ...defaults,
56
+ endpoint: { baseURL: baseURL ?? profiles.groq.baseURL },
57
+ auth: AuthOptions.bearer(input, "GROQ_API_KEY"),
58
+ });
59
+ return {
60
+ id,
61
+ model: (modelID) => configured.model({
62
+ id: modelID,
63
+ compatibility: {
64
+ maxTokensField: "max_completion_tokens",
65
+ reasoningField: "reasoning",
66
+ requireReasoning: false,
67
+ supportsStore: false,
68
+ supportsStrictMode: false,
69
+ },
70
+ }),
71
+ configure,
72
+ };
73
+ };
74
+ export const provider = configure();
75
+ export const model = (modelID, settings) => configure({
76
+ apiKey: settings.apiKey,
77
+ baseURL: settings.baseURL,
78
+ headers: settings.headers === undefined ? undefined : { ...settings.headers },
79
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
80
+ providerOptions: settings.providerOptions,
81
+ }).model(modelID);
82
+ export * as Groq from "./groq.js";
@@ -12,6 +12,7 @@ export * as GoogleVertex from "./google-vertex.js";
12
12
  export * as GoogleVertexChat from "./google-vertex-chat.js";
13
13
  export * as GoogleVertexMessages from "./google-vertex-messages.js";
14
14
  export * as GoogleVertexResponses from "./google-vertex-responses.js";
15
+ export * as Groq from "./groq.js";
15
16
  export * as OpenAI from "./openai.js";
16
17
  export * as OpenAICompatible from "./openai-compatible.js";
17
18
  export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
@@ -12,6 +12,7 @@ export * as GoogleVertex from "./google-vertex.js";
12
12
  export * as GoogleVertexChat from "./google-vertex-chat.js";
13
13
  export * as GoogleVertexMessages from "./google-vertex-messages.js";
14
14
  export * as GoogleVertexResponses from "./google-vertex-responses.js";
15
+ export * as Groq from "./groq.js";
15
16
  export * as OpenAI from "./openai.js";
16
17
  export * as OpenAICompatible from "./openai-compatible.js";
17
18
  export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.0.0-beta-18286",
3
+ "version": "0.0.0-beta-18314",
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-rc.111",
33
- "@opencode-ai/http-recorder": "0.0.0-beta-18286",
33
+ "@opencode-ai/http-recorder": "0.0.0-beta-18314",
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-beta-18286",
42
+ "@opencode-ai/schema": "0.0.0-beta-18314",
43
43
  "aws4fetch": "1.0.20",
44
44
  "effect": "4.0.0-rc.111",
45
45
  "google-auth-library": "10.5.0"