@opencode-ai/ai 0.0.0-next-16671 → 0.0.0-next-16680

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +1 -1
  2. package/dist/image-client.d.ts +4 -4
  3. package/dist/image.d.ts +4 -4
  4. package/dist/image.js +2 -2
  5. package/dist/index.d.ts +2 -2
  6. package/dist/llm.d.ts +11 -11
  7. package/dist/llm.js +3 -3
  8. package/dist/protocols/anthropic-messages.js +8 -4
  9. package/dist/protocols/bedrock-converse.js +3 -5
  10. package/dist/protocols/google-images.js +2 -2
  11. package/dist/protocols/open-responses.d.ts +8 -8
  12. package/dist/protocols/open-responses.js +4 -9
  13. package/dist/protocols/openai-chat.d.ts +4 -4
  14. package/dist/protocols/openai-chat.js +3 -3
  15. package/dist/protocols/openai-compatible-chat.d.ts +2 -2
  16. package/dist/protocols/openai-compatible-responses.d.ts +2 -2
  17. package/dist/protocols/openai-images.js +2 -2
  18. package/dist/protocols/shared.d.ts +16 -16
  19. package/dist/protocols/shared.js +6 -6
  20. package/dist/protocols/utils/bedrock-media.d.ts +1 -1
  21. package/dist/protocols/utils/image-input.d.ts +5 -5
  22. package/dist/protocols/utils/image-input.js +2 -2
  23. package/dist/protocols/utils/tool-schema.d.ts +2 -2
  24. package/dist/protocols/utils/tool-stream.d.ts +7 -7
  25. package/dist/protocols/utils/tool-stream.js +2 -2
  26. package/dist/protocols/xai-images.js +2 -2
  27. package/dist/protocols/zai-images.js +2 -2
  28. package/dist/provider-error.d.ts +2 -2
  29. package/dist/provider-error.js +2 -2
  30. package/dist/provider-package.d.ts +2 -2
  31. package/dist/provider.d.ts +8 -8
  32. package/dist/providers/amazon-bedrock.d.ts +7 -7
  33. package/dist/providers/anthropic-compatible.d.ts +6 -6
  34. package/dist/providers/anthropic.d.ts +7 -7
  35. package/dist/providers/azure.d.ts +13 -13
  36. package/dist/providers/cloudflare.d.ts +8 -8
  37. package/dist/providers/github-copilot.d.ts +15 -15
  38. package/dist/providers/google-vertex-chat.d.ts +6 -6
  39. package/dist/providers/google-vertex-messages.d.ts +6 -6
  40. package/dist/providers/google-vertex-responses.d.ts +6 -6
  41. package/dist/providers/google-vertex.d.ts +6 -6
  42. package/dist/providers/google.d.ts +7 -7
  43. package/dist/providers/openai-compatible-responses.d.ts +6 -6
  44. package/dist/providers/openai-compatible.d.ts +20 -20
  45. package/dist/providers/openai.d.ts +19 -19
  46. package/dist/providers/openrouter.d.ts +11 -11
  47. package/dist/providers/xai.d.ts +19 -19
  48. package/dist/providers/zai.d.ts +4 -4
  49. package/dist/route/auth-options.d.ts +3 -3
  50. package/dist/route/auth.d.ts +4 -4
  51. package/dist/route/auth.js +4 -4
  52. package/dist/route/client.d.ts +18 -18
  53. package/dist/route/client.js +6 -6
  54. package/dist/route/executor.d.ts +3 -3
  55. package/dist/route/executor.js +4 -4
  56. package/dist/route/framing.d.ts +2 -2
  57. package/dist/route/index.d.ts +1 -1
  58. package/dist/route/protocol.d.ts +3 -3
  59. package/dist/route/transport/http.d.ts +1 -1
  60. package/dist/route/transport/index.d.ts +3 -3
  61. package/dist/route/transport/websocket.d.ts +10 -10
  62. package/dist/route/transport/websocket.js +3 -3
  63. package/dist/schema/errors.d.ts +6 -6
  64. package/dist/schema/errors.js +18 -18
  65. package/dist/schema/events.js +1 -1
  66. package/dist/schema/ids.d.ts +3 -3
  67. package/dist/schema/ids.js +4 -3
  68. package/dist/schema/messages.d.ts +2 -2
  69. package/dist/schema/messages.js +2 -2
  70. package/dist/schema/options.d.ts +38 -38
  71. package/dist/schema/options.js +31 -29
  72. package/dist/testing.d.ts +4 -4
  73. package/package.json +3 -3
@@ -3,7 +3,7 @@ import { Tool } from "@opencode-ai/schema/tool";
3
3
  import { Effect, Schema, Stream } from "effect";
4
4
  import * as Sse from "effect/unstable/encoding/Sse";
5
5
  import { Headers, HttpClientRequest } from "effect/unstable/http";
6
- import { InvalidProviderOutputReason, InvalidRequestReason, LLMError, } from "../schema";
6
+ import { InvalidProviderOutputReason, InvalidRequestReason, AIError, } from "../schema";
7
7
  import { isRecord } from "../utils/record";
8
8
  export { isRecord };
9
9
  export const Json = Schema.fromJsonString(Schema.Unknown);
@@ -19,7 +19,7 @@ export const optionalNull = (schema) => Schema.optional(Schema.NullOr(schema));
19
19
  * when at least one is defined. Returns `undefined` when neither input nor
20
20
  * output is known so routes don't publish a misleading `0`.
21
21
  *
22
- * Under the additive `LLM.Usage` contract, `inputTokens` and `outputTokens`
22
+ * Under the additive `AI.Usage` contract, `inputTokens` and `outputTokens`
23
23
  * are the non-cached input and visible output only. The provider-supplied
24
24
  * `total` is the source of truth when present; the computed fallback
25
25
  * under-counts cache and reasoning by design and exists mainly so
@@ -63,7 +63,7 @@ export const sumTokens = (...values) => {
63
63
  return undefined;
64
64
  return values.reduce((acc, value) => acc + (value ?? 0), 0);
65
65
  };
66
- export const eventError = (route, message, raw) => new LLMError({
66
+ export const eventError = (route, message, raw) => new AIError({
67
67
  module: "ProviderShared",
68
68
  method: "stream",
69
69
  reason: new InvalidProviderOutputReason({ route, message, raw }),
@@ -185,7 +185,7 @@ export const errorText = (error) => {
185
185
  * `decodeChunk` sees one JSON string per element. The SSE channel emits a
186
186
  * `Retry` control event on its error channel; we drop it here (we don't
187
187
  * implement client-driven retries) so the public error channel stays
188
- * `LLMError`.
188
+ * `AIError`.
189
189
  */
190
190
  export const sseFraming = (bytes) => bytes.pipe(Stream.decodeText(), Stream.pipeThroughChannel(Sse.decode()), Stream.catchTag("Retry", () => Stream.empty), Stream.filter((event) => event.data.length > 0 && event.data !== "[DONE]"), Stream.map((event) => event.data));
191
191
  /**
@@ -195,7 +195,7 @@ export const sseFraming = (bytes) => bytes.pipe(Stream.decodeText(), Stream.pipe
195
195
  * `InvalidRequestReason` with route context or trace metadata, the change
196
196
  * lands here.
197
197
  */
198
- export const invalidRequest = (message) => new LLMError({
198
+ export const invalidRequest = (message) => new AIError({
199
199
  module: "ProviderShared",
200
200
  method: "request",
201
201
  reason: new InvalidRequestReason({ message }),
@@ -224,7 +224,7 @@ export const unsupportedContent = (route, role, types) => invalidRequest(`${rout
224
224
  * Build a `validate` step from a Schema decoder. Replaces the per-route
225
225
  * lambda body `(payload) => decode(payload).pipe(Effect.mapError((e) =>
226
226
  * invalid(e.message)))`. Any decode error is translated into
227
- * `LLMError` carrying the original parse-error message.
227
+ * `AIError` carrying the original parse-error message.
228
228
  */
229
229
  export const validateWith = (decode) => (payload) => decode(payload).pipe(Effect.mapError((error) => invalidRequest(error.message)));
230
230
  /**
@@ -45,5 +45,5 @@ export declare const lower: (part: {
45
45
  bytes: string;
46
46
  };
47
47
  };
48
- }, import("../..").LLMError, never>;
48
+ }, import("../..").AIError, never>;
49
49
  export * as BedrockMedia from "./bedrock-media";
@@ -1,14 +1,14 @@
1
1
  import { Effect } from "effect";
2
2
  import type { ImageInput } from "../../image";
3
- import { LLMError } from "../../schema";
3
+ import { AIError } from "../../schema";
4
4
  export declare const dataUrl: (input: Extract<ImageInput, {
5
5
  readonly type: "bytes";
6
6
  }>) => string;
7
7
  export declare const decodeDataUrl: (url: string, module: string) => Effect.Effect<{
8
8
  readonly mediaType: string;
9
9
  readonly data: Uint8Array;
10
- } | undefined, LLMError>;
11
- export declare const invalidImageInput: (module: string, message: string) => LLMError;
10
+ } | undefined, AIError>;
11
+ export declare const invalidImageInput: (module: string, message: string) => AIError;
12
12
  export declare const ImageInputs: {
13
13
  readonly dataUrl: (input: Extract<ImageInput, {
14
14
  readonly type: "bytes";
@@ -16,6 +16,6 @@ export declare const ImageInputs: {
16
16
  readonly decodeDataUrl: (url: string, module: string) => Effect.Effect<{
17
17
  readonly mediaType: string;
18
18
  readonly data: Uint8Array;
19
- } | undefined, LLMError>;
20
- readonly invalid: (module: string, message: string) => LLMError;
19
+ } | undefined, AIError>;
20
+ readonly invalid: (module: string, message: string) => AIError;
21
21
  };
@@ -1,6 +1,6 @@
1
1
  import { Effect, Encoding } from "effect";
2
- import { InvalidRequestReason, LLMError } from "../../schema";
3
- const invalid = (module, message) => new LLMError({
2
+ import { InvalidRequestReason, AIError } from "../../schema";
3
+ const invalid = (module, message) => new AIError({
4
4
  module,
5
5
  method: "generate",
6
6
  reason: new InvalidRequestReason({ message }),
@@ -1,7 +1,7 @@
1
- import type { JsonSchema, ModelToolSchemaCompatibility } from "../../schema";
1
+ import type { JsonSchema, LanguageModelToolSchemaCompatibility } from "../../schema";
2
2
  export declare const ToolSchemaProjection: {
3
3
  readonly gemini: (schema: JsonSchema) => JsonSchema;
4
- readonly modelCompatibility: (schema: JsonSchema, compatibility: ModelToolSchemaCompatibility | undefined) => JsonSchema;
4
+ readonly modelCompatibility: (schema: JsonSchema, compatibility: LanguageModelToolSchemaCompatibility | undefined) => JsonSchema;
5
5
  readonly moonshot: (schema: JsonSchema) => JsonSchema;
6
6
  readonly openAI: (schema: JsonSchema) => JsonSchema;
7
7
  readonly responses: (schema: JsonSchema) => JsonSchema;
@@ -1,5 +1,5 @@
1
1
  import { Effect } from "effect";
2
- import { LLMError, LLMEvent, type ProviderMetadata } from "../../schema";
2
+ import { AIError, LLMEvent, type ProviderMetadata } from "../../schema";
3
3
  import { type ToolAccumulator } from "../shared";
4
4
  type StreamKey = string | number;
5
5
  /**
@@ -33,7 +33,7 @@ export interface AppendOutcome<K extends StreamKey> {
33
33
  }
34
34
  /** Create empty accumulator state for one provider stream. */
35
35
  export declare const empty: <K extends StreamKey>() => State<K>;
36
- export declare const isError: <K extends StreamKey>(result: AppendOutcome<K> | LLMError) => result is LLMError;
36
+ export declare const isError: <K extends StreamKey>(result: AppendOutcome<K> | AIError) => result is AIError;
37
37
  /**
38
38
  * Register a tool call whose start event arrived before any argument deltas.
39
39
  * Used by Anthropic `content_block_start`, Bedrock `contentBlockStart`, and
@@ -52,13 +52,13 @@ export declare const appendOrStart: <K extends StreamKey>(route: string, tools:
52
52
  readonly id?: string;
53
53
  readonly name?: string;
54
54
  readonly text: string;
55
- }, missingToolMessage: string) => AppendOutcome<K> | LLMError;
55
+ }, missingToolMessage: string) => AppendOutcome<K> | AIError;
56
56
  /**
57
57
  * Append argument text to a tool that must already have been started. This keeps
58
58
  * protocols honest when their stream grammar promises a start event before any
59
59
  * argument delta.
60
60
  */
61
- export declare const appendExisting: <K extends StreamKey>(route: string, tools: State<K>, key: K, text: string, missingToolMessage: string) => AppendOutcome<K> | LLMError;
61
+ export declare const appendExisting: <K extends StreamKey>(route: string, tools: State<K>, key: K, text: string, missingToolMessage: string) => AppendOutcome<K> | AIError;
62
62
  /**
63
63
  * Finalize one pending tool call: parse the accumulated raw JSON, remove it
64
64
  * from state, and return either a call or a non-executable local input error.
@@ -252,7 +252,7 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
252
252
  } | undefined;
253
253
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
254
254
  })[];
255
- }, LLMError, never>;
255
+ }, AIError, never>;
256
256
  /**
257
257
  * Finalize one pending tool call with an authoritative final input string.
258
258
  * OpenAI Responses can send accumulated deltas and then repeat the completed
@@ -445,7 +445,7 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
445
445
  } | undefined;
446
446
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
447
447
  })[];
448
- }, LLMError, never>;
448
+ }, AIError, never>;
449
449
  /**
450
450
  * Finalize every pending tool call at once. OpenAI Chat has this shape: it does
451
451
  * not emit per-tool stop events, so all accumulated calls finish independently
@@ -635,5 +635,5 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
635
635
  } | undefined;
636
636
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
637
637
  })[];
638
- }, LLMError, never>;
638
+ }, AIError, never>;
639
639
  export * as ToolStream from "./tool-stream";
@@ -1,5 +1,5 @@
1
1
  import { Effect } from "effect";
2
- import { LLMError, LLMEvent } from "../../schema";
2
+ import { AIError, LLMEvent } from "../../schema";
3
3
  import { eventError, parseToolInput } from "../shared";
4
4
  /** Create empty accumulator state for one provider stream. */
5
5
  export const empty = () => ({});
@@ -54,7 +54,7 @@ const appendTool = (tools, key, tool, text) => {
54
54
  events,
55
55
  };
56
56
  };
57
- export const isError = (result) => result instanceof LLMError;
57
+ export const isError = (result) => result instanceof AIError;
58
58
  /**
59
59
  * Register a tool call whose start event arrived before any argument deltas.
60
60
  * Used by Anthropic `content_block_start`, Bedrock `contentBlockStart`, and
@@ -2,7 +2,7 @@ import { Effect, Encoding, Schema } from "effect";
2
2
  import { Headers, HttpClientRequest } from "effect/unstable/http";
3
3
  import { GeneratedImage, ImageModel, ImageResponse } from "../image";
4
4
  import { Auth } from "../route/auth";
5
- import { InvalidProviderOutputReason, LLMError, Usage, mergeHttpOptions, mergeJsonRecords, } from "../schema";
5
+ import { InvalidProviderOutputReason, AIError, Usage, mergeHttpOptions, mergeJsonRecords, } from "../schema";
6
6
  import { ProviderShared, optionalNull } from "./shared";
7
7
  import { ImageInputs } from "./utils/image-input";
8
8
  const ADAPTER = "xai-images";
@@ -28,7 +28,7 @@ const nativeOptions = (options) => {
28
28
  ...native,
29
29
  };
30
30
  };
31
- const invalidOutput = (message) => new LLMError({
31
+ const invalidOutput = (message) => new AIError({
32
32
  module: ADAPTER,
33
33
  method: "generate",
34
34
  reason: new InvalidProviderOutputReason({ message, route: ADAPTER }),
@@ -2,7 +2,7 @@ import { Effect, Schema } from "effect";
2
2
  import { Headers, HttpClientRequest } from "effect/unstable/http";
3
3
  import { GeneratedImage, ImageModel, ImageResponse } from "../image";
4
4
  import { Auth } from "../route/auth";
5
- import { InvalidProviderOutputReason, LLMError, mergeHttpOptions, mergeJsonRecords } from "../schema";
5
+ import { InvalidProviderOutputReason, AIError, mergeHttpOptions, mergeJsonRecords } from "../schema";
6
6
  import { ProviderShared } from "./shared";
7
7
  import { ImageInputs } from "./utils/image-input";
8
8
  const ADAPTER = "zai-images";
@@ -27,7 +27,7 @@ const nativeOptions = (options) => {
27
27
  ...native,
28
28
  };
29
29
  };
30
- const invalidOutput = (message) => new LLMError({
30
+ const invalidOutput = (message) => new AIError({
31
31
  module: ADAPTER,
32
32
  method: "generate",
33
33
  reason: new InvalidProviderOutputReason({ message, route: ADAPTER }),
@@ -1,4 +1,4 @@
1
- import { LLMError, type HttpContext, type HttpRateLimitDetails, type ProviderMetadata } from "./schema";
1
+ import { AIError, type HttpContext, type HttpRateLimitDetails, type ProviderMetadata } from "./schema";
2
2
  export declare const isContextOverflow: (message: string) => boolean;
3
3
  export declare const isPayloadTooLarge: (message: string) => boolean;
4
4
  export declare const isContextOverflowFailure: (failure: unknown) => boolean;
@@ -11,4 +11,4 @@ export interface ProviderFailure {
11
11
  readonly http?: HttpContext | undefined;
12
12
  readonly providerMetadata?: ProviderMetadata | undefined;
13
13
  }
14
- export declare function classifyProviderFailure(input: ProviderFailure): LLMError["reason"];
14
+ export declare function classifyProviderFailure(input: ProviderFailure): AIError["reason"];
@@ -1,5 +1,5 @@
1
1
  import { Option, Schema } from "effect";
2
- import { AuthenticationReason, ContentPolicyReason, InvalidRequestReason, LLMError, ProviderErrorEvent, ProviderInternalReason, QuotaExceededReason, RateLimitReason, UnknownProviderReason, } from "./schema";
2
+ import { AuthenticationReason, ContentPolicyReason, InvalidRequestReason, AIError, ProviderErrorEvent, ProviderInternalReason, QuotaExceededReason, RateLimitReason, UnknownProviderReason, } from "./schema";
3
3
  const patterns = [
4
4
  /prompt is too long/i,
5
5
  /input is too long for requested model/i,
@@ -32,7 +32,7 @@ const exclusions = [/^(throttling error|service unavailable):/i, /rate limit/i,
32
32
  export const isContextOverflow = (message) => !exclusions.some((pattern) => pattern.test(message)) &&
33
33
  (patterns.some((pattern) => pattern.test(message)) || /^400\s*(status code)?\s*\(no body\)/i.test(message));
34
34
  export const isPayloadTooLarge = (message) => payloadPatterns.some((pattern) => pattern.test(message));
35
- export const isContextOverflowFailure = (failure) => failure instanceof LLMError
35
+ export const isContextOverflowFailure = (failure) => failure instanceof AIError
36
36
  ? failure.reason._tag === "InvalidRequest" && failure.reason.classification === "context-overflow"
37
37
  : Schema.is(ProviderErrorEvent)(failure) && failure.classification === "context-overflow";
38
38
  const decodeJson = Schema.decodeUnknownOption(Schema.UnknownFromJsonString);
@@ -1,4 +1,4 @@
1
- import type { Model, ProviderOptions } from "./schema";
1
+ import type { LanguageModel, ProviderOptions } from "./schema";
2
2
  export interface Settings extends Readonly<Record<string, unknown>> {
3
3
  readonly baseURL?: string;
4
4
  readonly headers?: Readonly<Record<string, string>>;
@@ -10,6 +10,6 @@ export interface Settings extends Readonly<Record<string, unknown>> {
10
10
  };
11
11
  }
12
12
  export interface Definition<ProviderSettings extends Settings = Settings, Options extends ProviderOptions = ProviderOptions> {
13
- readonly model: (modelID: string, settings: ProviderSettings) => Model<Options>;
13
+ readonly model: (modelID: string, settings: ProviderSettings) => LanguageModel<Options>;
14
14
  }
15
15
  export * as ProviderPackage from "./provider-package";
@@ -1,22 +1,22 @@
1
- import type { Model, ModelID, ProviderID } from "./schema";
2
- export type ModelOptions = Pick<Model.Input, "defaults" | "compatibility">;
1
+ import type { LanguageModel, ModelID, ProviderID } from "./schema";
2
+ export type LanguageModelOptions = Pick<LanguageModel.Input, "defaults" | "compatibility">;
3
3
  /**
4
4
  * Advanced structural provider definition helper. Built-in providers should
5
5
  * prefer explicit `configure(options).model(id)` facades so deployment config is
6
6
  * chosen before model selection. The optional `apis` map remains for external
7
7
  * structural providers that expose multiple route selectors behind one provider.
8
8
  */
9
- export type ModelFactory<Options extends ModelOptions = ModelOptions> = (id: string | ModelID, options?: Options) => Model;
10
- type AnyModelFactory = (...args: never[]) => Model;
11
- export interface Definition<Factory extends AnyModelFactory = ModelFactory> {
9
+ export type LanguageModelFactory<Options extends LanguageModelOptions = LanguageModelOptions> = (id: string | ModelID, options?: Options) => LanguageModel;
10
+ type AnyLanguageModelFactory = (...args: never[]) => LanguageModel;
11
+ export interface Definition<Factory extends AnyLanguageModelFactory = LanguageModelFactory> {
12
12
  readonly id: ProviderID;
13
13
  readonly model: Factory;
14
- readonly apis?: Record<string, AnyModelFactory>;
14
+ readonly apis?: Record<string, AnyLanguageModelFactory>;
15
15
  }
16
16
  type DefinitionShape = {
17
17
  readonly id: ProviderID;
18
- readonly model: (...args: never[]) => Model;
19
- readonly apis?: Record<string, (...args: never[]) => Model>;
18
+ readonly model: (...args: never[]) => LanguageModel;
19
+ readonly apis?: Record<string, (...args: never[]) => LanguageModel>;
20
20
  };
21
21
  type NoExtraFields<Input, Shape> = Input & Record<Exclude<keyof Input, keyof Shape>, never>;
22
22
  export declare const make: <DefinitionType extends DefinitionShape>(definition: NoExtraFields<DefinitionType, DefinitionShape>) => NoExtraFields<DefinitionType, DefinitionShape>;
@@ -2,7 +2,7 @@ import type { RouteDefaultsInput } from "../route/client";
2
2
  import type { ProviderPackage } from "../provider-package";
3
3
  import { type ModelID } from "../schema";
4
4
  import type { BedrockCredentials } from "../protocols/bedrock-converse";
5
- export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
5
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
6
6
  export type Config = RouteDefaultsInput & {
7
7
  readonly apiKey?: string;
8
8
  readonly headers?: Record<string, string>;
@@ -144,8 +144,8 @@ export declare const routes: import("../route").Route<{
144
144
  } | undefined;
145
145
  }, import("../route/transport/http").HttpPrepared<object>>[];
146
146
  export declare const configure: (input?: Config) => {
147
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
148
- model: (modelID: string | ModelID) => import("..").Model<{
147
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
148
+ model: (modelID: string | ModelID) => import("..").LanguageModel<{
149
149
  readonly [x: string]: {
150
150
  readonly [x: string]: unknown;
151
151
  };
@@ -153,15 +153,15 @@ export declare const configure: (input?: Config) => {
153
153
  configure: (input?: Config) => /*elided*/ any;
154
154
  };
155
155
  export declare const provider: {
156
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
157
- model: (modelID: string | ModelID) => import("..").Model<{
156
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
157
+ model: (modelID: string | ModelID) => import("..").LanguageModel<{
158
158
  readonly [x: string]: {
159
159
  readonly [x: string]: unknown;
160
160
  };
161
161
  }>;
162
162
  configure: (input?: Config) => {
163
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
164
- model: (modelID: string | ModelID) => import("..").Model<{
163
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
164
+ model: (modelID: string | ModelID) => import("..").LanguageModel<{
165
165
  readonly [x: string]: {
166
166
  readonly [x: string]: unknown;
167
167
  };
@@ -6,7 +6,7 @@ import { type ModelID } from "../schema";
6
6
  export type AnthropicOptionsInput = AnthropicMessages.OptionsInput;
7
7
  export type AnthropicProviderOptionsInput = AnthropicMessages.ProviderOptionsInput;
8
8
  export type AnthropicThinkingInput = AnthropicMessages.ThinkingInput;
9
- export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
9
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
10
10
  export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
11
11
  readonly provider?: string;
12
12
  readonly baseURL: string;
@@ -202,15 +202,15 @@ export declare const routes: import("../route").Route<{
202
202
  } | undefined;
203
203
  }, import("../route/transport/http").HttpPrepared<string>>[];
204
204
  export declare const configure: (input: Config) => {
205
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
206
- model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
205
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
206
+ model: (modelID: string | ModelID) => import("..").LanguageModel<AnthropicMessages.ProviderOptionsInput>;
207
207
  configure: (input: Config) => /*elided*/ any;
208
208
  };
209
209
  export declare const provider: {
210
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
210
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
211
211
  configure: (input: Config) => {
212
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
213
- model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
212
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
213
+ model: (modelID: string | ModelID) => import("..").LanguageModel<AnthropicMessages.ProviderOptionsInput>;
214
214
  configure: /*elided*/ any;
215
215
  };
216
216
  };
@@ -6,7 +6,7 @@ import { AnthropicMessages } from "../protocols/anthropic-messages";
6
6
  export type AnthropicOptionsInput = AnthropicMessages.OptionsInput;
7
7
  export type AnthropicProviderOptionsInput = AnthropicMessages.ProviderOptionsInput;
8
8
  export type AnthropicThinkingInput = AnthropicMessages.ThinkingInput;
9
- export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
9
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
10
10
  export declare const routes: import("../route").Route<{
11
11
  readonly model: string;
12
12
  readonly messages: readonly ({
@@ -200,16 +200,16 @@ export type Settings = ProviderPackage.Settings & ({
200
200
  readonly providerOptions?: AnthropicMessages.ProviderOptionsInput;
201
201
  };
202
202
  export declare const configure: (input?: Config) => {
203
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
204
- model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
203
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
204
+ model: (modelID: string | ModelID) => import("..").LanguageModel<AnthropicMessages.ProviderOptionsInput>;
205
205
  configure: (input?: Config) => /*elided*/ any;
206
206
  };
207
207
  export declare const provider: {
208
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
209
- model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
208
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
209
+ model: (modelID: string | ModelID) => import("..").LanguageModel<AnthropicMessages.ProviderOptionsInput>;
210
210
  configure: (input?: Config) => {
211
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
212
- model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
211
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
212
+ model: (modelID: string | ModelID) => import("..").LanguageModel<AnthropicMessages.ProviderOptionsInput>;
213
213
  configure: /*elided*/ any;
214
214
  };
215
215
  };
@@ -3,18 +3,18 @@ import type { Route as RouteDef, RouteDefaultsInput } from "../route/client";
3
3
  import type { ProviderPackage } from "../provider-package";
4
4
  import { type ModelID } from "../schema";
5
5
  import { type OpenAIProviderOptionsInput } from "./openai-options";
6
- export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
6
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
7
7
  type AzureURL = AtLeastOne<{
8
8
  readonly resourceName: string;
9
9
  readonly baseURL: string;
10
10
  }>;
11
- export type ModelOptions = AzureURL & RouteDefaultsInput & ProviderAuthOption<"optional"> & {
11
+ export type LanguageModelOptions = AzureURL & RouteDefaultsInput & ProviderAuthOption<"optional"> & {
12
12
  readonly apiVersion?: string;
13
13
  readonly queryParams?: Record<string, string>;
14
14
  readonly useCompletionUrls?: boolean;
15
15
  readonly providerOptions?: OpenAIProviderOptionsInput;
16
16
  };
17
- export type Config = ModelOptions;
17
+ export type Config = LanguageModelOptions;
18
18
  export type Settings = ProviderPackage.Settings & AzureURL & {
19
19
  readonly apiKey?: string;
20
20
  readonly apiVersion?: string;
@@ -224,23 +224,23 @@ export declare const routes: (RouteDef<{
224
224
  readonly max_output_tokens?: number | undefined;
225
225
  }, import("../route/transport/http").HttpPrepared<string>>)[];
226
226
  export declare const configure: (input: Config) => {
227
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
228
- model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
229
- responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
230
- chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
227
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
228
+ model: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
229
+ responses: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
230
+ chat: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
231
231
  configure: (input: Config) => /*elided*/ any;
232
232
  };
233
233
  export declare const provider: {
234
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
234
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
235
235
  configure: (input: Config) => {
236
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
237
- model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
238
- responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
239
- chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
236
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
237
+ model: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
238
+ responses: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
239
+ chat: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
240
240
  configure: /*elided*/ any;
241
241
  };
242
242
  };
243
243
  export declare const responsesModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
244
244
  export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
245
- export declare const model: (modelID: string, settings: Settings) => import("..").Model<OpenAIProviderOptionsInput>;
245
+ export declare const model: (modelID: string, settings: Settings) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
246
246
  export {};
@@ -3,8 +3,8 @@ import { type AtLeastOne, type ProviderAuthOption } from "../route/auth-options"
3
3
  import type { RouteDefaultsInput } from "../route/client";
4
4
  import { type ModelID } from "../schema";
5
5
  import type { OpenAIProviderOptionsInput } from "./openai-options";
6
- export declare const aiGatewayID: string & import("effect/Brand").Brand<"LLM.ProviderID">;
7
- export declare const workersAIID: string & import("effect/Brand").Brand<"LLM.ProviderID">;
6
+ export declare const aiGatewayID: string & import("effect/Brand").Brand<"AI.ProviderID">;
7
+ export declare const workersAIID: string & import("effect/Brand").Brand<"AI.ProviderID">;
8
8
  export declare const aiGatewayAuthEnvVars: readonly ["CLOUDFLARE_API_TOKEN", "CF_AIG_TOKEN"];
9
9
  export declare const workersAIAuthEnvVars: readonly ["CLOUDFLARE_API_KEY", "CLOUDFLARE_WORKERS_AI_TOKEN"];
10
10
  type CloudflareSecret = string | Redacted.Redacted | Config.Config<string | Redacted.Redacted>;
@@ -317,18 +317,18 @@ export declare const routes: import("../route").Route<{
317
317
  readonly presence_penalty?: number | undefined;
318
318
  }, import("../route/transport/http").HttpPrepared<string>>[];
319
319
  export declare const CloudflareAIGateway: {
320
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
320
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
321
321
  configure: (options: AIGatewayOptions) => {
322
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
323
- model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
322
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
323
+ model: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
324
324
  configure: /*elided*/ any;
325
325
  };
326
326
  };
327
327
  export declare const CloudflareWorkersAI: {
328
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
328
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
329
329
  configure: (options: WorkersAIOptions) => {
330
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
331
- model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
330
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
331
+ model: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
332
332
  configure: /*elided*/ any;
333
333
  };
334
334
  };
@@ -2,13 +2,13 @@ import { type ProviderAuthOption } from "../route/auth-options";
2
2
  import type { RouteDefaultsInput } from "../route/client";
3
3
  import { type ModelID } from "../schema";
4
4
  import { type OpenAIProviderOptionsInput } from "./openai-options";
5
- export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
6
- export type ModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
5
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
6
+ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
7
7
  readonly baseURL: string;
8
8
  readonly endpoint?: "chat" | "responses";
9
9
  readonly providerOptions?: OpenAIProviderOptionsInput;
10
10
  };
11
- export declare const shouldUseResponsesApi: (modelID: string | ModelID, endpoint?: ModelOptions["endpoint"]) => boolean;
11
+ export declare const shouldUseResponsesApi: (modelID: string | ModelID, endpoint?: LanguageModelOptions["endpoint"]) => boolean;
12
12
  export declare const routes: (import("../route").Route<{
13
13
  readonly model: string;
14
14
  readonly messages: readonly ({
@@ -211,20 +211,20 @@ export declare const routes: (import("../route").Route<{
211
211
  readonly prompt_cache_key?: string | undefined;
212
212
  readonly max_output_tokens?: number | undefined;
213
213
  }, import("../route/transport/http").HttpPrepared<string>>)[];
214
- export declare const configure: (options: ModelOptions) => {
215
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
216
- model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
217
- responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
218
- chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
219
- configure: (options: ModelOptions) => /*elided*/ any;
214
+ export declare const configure: (options: LanguageModelOptions) => {
215
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
216
+ model: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
217
+ responses: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
218
+ chat: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
219
+ configure: (options: LanguageModelOptions) => /*elided*/ any;
220
220
  };
221
221
  export declare const provider: {
222
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
223
- configure: (options: ModelOptions) => {
224
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
225
- model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
226
- responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
227
- chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
222
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
223
+ configure: (options: LanguageModelOptions) => {
224
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
225
+ model: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
226
+ responses: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
227
+ chat: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
228
228
  configure: /*elided*/ any;
229
229
  };
230
230
  };
@@ -3,7 +3,7 @@ import type { RouteDefaultsInput } from "../route/client";
3
3
  import { type ModelID } from "../schema";
4
4
  import { GoogleVertexShared } from "./google-vertex-shared";
5
5
  import type { OpenAIProviderOptionsInput } from "./openai-options";
6
- export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
6
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
7
7
  export type Config = RouteDefaultsInput & GoogleVertexShared.OAuthOptions & {
8
8
  readonly baseURL?: string;
9
9
  readonly location?: string;
@@ -115,15 +115,15 @@ export declare const routes: import("../route").Route<{
115
115
  readonly presence_penalty?: number | undefined;
116
116
  }, import("../route/transport/http").HttpPrepared<string>>[];
117
117
  export declare const configure: (input?: Config) => {
118
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
119
- model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
118
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
119
+ model: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
120
120
  configure: (input?: Config) => /*elided*/ any;
121
121
  };
122
122
  export declare const provider: {
123
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
123
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
124
124
  configure: (input?: Config) => {
125
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
126
- model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
125
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
126
+ model: (modelID: string | ModelID) => import("..").LanguageModel<OpenAIProviderOptionsInput>;
127
127
  configure: /*elided*/ any;
128
128
  };
129
129
  };
@@ -6,7 +6,7 @@ import { GoogleVertexShared } from "./google-vertex-shared";
6
6
  export type AnthropicOptionsInput = AnthropicMessages.OptionsInput;
7
7
  export type AnthropicProviderOptionsInput = AnthropicMessages.ProviderOptionsInput;
8
8
  export type AnthropicThinkingInput = AnthropicMessages.ThinkingInput;
9
- export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
9
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
10
10
  export type Config = RouteDefaultsInput & GoogleVertexShared.OAuthOptions & {
11
11
  readonly baseURL?: string;
12
12
  readonly location?: string;
@@ -200,15 +200,15 @@ export declare const routes: Route<{
200
200
  } | undefined;
201
201
  }, import("../route/transport/http").HttpPrepared<string>>[];
202
202
  export declare const configure: (input?: Config) => {
203
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
204
- model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
203
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
204
+ model: (modelID: string | ModelID) => import("..").LanguageModel<AnthropicMessages.ProviderOptionsInput>;
205
205
  configure: (input?: Config) => /*elided*/ any;
206
206
  };
207
207
  export declare const provider: {
208
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
208
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
209
209
  configure: (input?: Config) => {
210
- id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
211
- model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
210
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
211
+ model: (modelID: string | ModelID) => import("..").LanguageModel<AnthropicMessages.ProviderOptionsInput>;
212
212
  configure: /*elided*/ any;
213
213
  };
214
214
  };