@opencode/ai 0.0.0-beta-19500 → 0.0.0-dev-19274

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 (114) hide show
  1. package/README.md +0 -200
  2. package/dist/protocols/anthropic-messages.d.ts +1 -24
  3. package/dist/protocols/anthropic-messages.js +12 -58
  4. package/dist/protocols/meta-messages.d.ts +0 -6
  5. package/dist/protocols/open-responses-channel.d.ts +0 -2
  6. package/dist/protocols/open-responses-channel.js +2 -2
  7. package/dist/protocols/open-responses-continuation.d.ts +3 -7
  8. package/dist/protocols/open-responses-continuation.js +7 -16
  9. package/dist/protocols/open-responses.d.ts +9 -141
  10. package/dist/protocols/open-responses.js +7 -29
  11. package/dist/provider-package.d.ts +0 -4
  12. package/dist/providers/amazon-bedrock-mantle.d.ts +62 -4
  13. package/dist/providers/amazon-bedrock-mantle.js +20 -23
  14. package/dist/providers/amazon-bedrock.js +3 -3
  15. package/dist/providers/anthropic-compatible.d.ts +2 -7
  16. package/dist/providers/anthropic-compatible.js +12 -18
  17. package/dist/providers/anthropic.d.ts +2 -7
  18. package/dist/providers/anthropic.js +9 -12
  19. package/dist/providers/azure.d.ts +2 -1
  20. package/dist/providers/azure.js +14 -14
  21. package/dist/providers/baseten.d.ts +3 -2
  22. package/dist/providers/baseten.js +6 -6
  23. package/dist/providers/cerebras.d.ts +3 -2
  24. package/dist/providers/cerebras.js +6 -6
  25. package/dist/providers/cloudflare-ai-gateway.d.ts +2 -1
  26. package/dist/providers/cloudflare-ai-gateway.js +10 -16
  27. package/dist/providers/cloudflare-workers-ai.d.ts +2 -1
  28. package/dist/providers/cloudflare-workers-ai.js +9 -15
  29. package/dist/providers/deepinfra.d.ts +3 -2
  30. package/dist/providers/deepinfra.js +6 -6
  31. package/dist/providers/deepseek.d.ts +3 -2
  32. package/dist/providers/deepseek.js +6 -6
  33. package/dist/providers/fireworks.d.ts +3 -2
  34. package/dist/providers/fireworks.js +6 -6
  35. package/dist/providers/google-vertex-chat.d.ts +3 -2
  36. package/dist/providers/google-vertex-chat.js +12 -12
  37. package/dist/providers/google-vertex-messages.d.ts +3 -8
  38. package/dist/providers/google-vertex-messages.js +12 -12
  39. package/dist/providers/google-vertex-responses.d.ts +3 -2
  40. package/dist/providers/google-vertex-responses.js +12 -12
  41. package/dist/providers/google-vertex-shared.js +3 -14
  42. package/dist/providers/google-vertex.d.ts +2 -1
  43. package/dist/providers/google-vertex.js +12 -18
  44. package/dist/providers/google.d.ts +3 -2
  45. package/dist/providers/google.js +6 -6
  46. package/dist/providers/groq.d.ts +3 -2
  47. package/dist/providers/groq.js +6 -6
  48. package/dist/providers/index.d.ts +0 -3
  49. package/dist/providers/index.js +0 -3
  50. package/dist/providers/meta.d.ts +3 -8
  51. package/dist/providers/meta.js +6 -6
  52. package/dist/providers/minimax/chat.js +6 -6
  53. package/dist/providers/minimax/responses.js +6 -6
  54. package/dist/providers/minimax.d.ts +3 -8
  55. package/dist/providers/minimax.js +6 -6
  56. package/dist/providers/mistral.d.ts +3 -2
  57. package/dist/providers/mistral.js +6 -6
  58. package/dist/providers/openai-compatible-responses.d.ts +3 -2
  59. package/dist/providers/openai-compatible-responses.js +7 -7
  60. package/dist/providers/openai-compatible.d.ts +3 -2
  61. package/dist/providers/openai-compatible.js +7 -7
  62. package/dist/providers/openai.d.ts +3 -2
  63. package/dist/providers/openai.js +9 -9
  64. package/dist/providers/openrouter.d.ts +3 -2
  65. package/dist/providers/openrouter.js +6 -6
  66. package/dist/providers/togetherai.d.ts +3 -2
  67. package/dist/providers/togetherai.js +6 -6
  68. package/dist/providers/xai.d.ts +3 -2
  69. package/dist/providers/xai.js +6 -10
  70. package/dist/providers/zai.d.ts +8 -133
  71. package/dist/providers/zai.js +0 -32
  72. package/dist/route/client.js +2 -5
  73. package/dist/route/transport/websocket.js +2 -6
  74. package/dist/schema/errors.d.ts +0 -12
  75. package/dist/schema/errors.js +0 -11
  76. package/dist/schema/options.d.ts +0 -2
  77. package/dist/schema/options.js +0 -2
  78. package/package.json +3 -3
  79. package/dist/protocols/alibaba-chat.d.ts +0 -225
  80. package/dist/protocols/alibaba-chat.js +0 -75
  81. package/dist/protocols/alibaba-messages.d.ts +0 -350
  82. package/dist/protocols/alibaba-messages.js +0 -40
  83. package/dist/protocols/alibaba-responses.d.ts +0 -255
  84. package/dist/protocols/alibaba-responses.js +0 -80
  85. package/dist/protocols/zai-chat.d.ts +0 -202
  86. package/dist/protocols/zai-chat.js +0 -49
  87. package/dist/protocols/zai-messages.d.ts +0 -344
  88. package/dist/protocols/zai-messages.js +0 -27
  89. package/dist/providers/alibaba/chat.d.ts +0 -1
  90. package/dist/providers/alibaba/chat.js +0 -1
  91. package/dist/providers/alibaba/messages.d.ts +0 -3
  92. package/dist/providers/alibaba/messages.js +0 -1
  93. package/dist/providers/alibaba/responses.d.ts +0 -3
  94. package/dist/providers/alibaba/responses.js +0 -1
  95. package/dist/providers/alibaba.d.ts +0 -711
  96. package/dist/providers/alibaba.js +0 -94
  97. package/dist/providers/moonshot/chat.d.ts +0 -1
  98. package/dist/providers/moonshot/chat.js +0 -1
  99. package/dist/providers/moonshot/messages.d.ts +0 -4
  100. package/dist/providers/moonshot/messages.js +0 -8
  101. package/dist/providers/moonshot/responses.d.ts +0 -4
  102. package/dist/providers/moonshot/responses.js +0 -8
  103. package/dist/providers/moonshot.d.ts +0 -596
  104. package/dist/providers/moonshot.js +0 -90
  105. package/dist/providers/zai/chat.d.ts +0 -1
  106. package/dist/providers/zai/chat.js +0 -1
  107. package/dist/providers/zai-coding-plan/chat.d.ts +0 -1
  108. package/dist/providers/zai-coding-plan/chat.js +0 -1
  109. package/dist/providers/zai-coding-plan/messages.d.ts +0 -4
  110. package/dist/providers/zai-coding-plan/messages.js +0 -8
  111. package/dist/providers/zai-coding-plan/responses.d.ts +0 -4
  112. package/dist/providers/zai-coding-plan/responses.js +0 -8
  113. package/dist/providers/zai-coding-plan.d.ts +0 -577
  114. package/dist/providers/zai-coding-plan.js +0 -63
@@ -5,7 +5,7 @@ import { Auth } from "../route/auth.js";
5
5
  import { Route } from "../route/client.js";
6
6
  import { Endpoint } from "../route/endpoint.js";
7
7
  import { Framing } from "../route/framing.js";
8
- import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
8
+ import { ProviderID } from "../schema/index.js";
9
9
  import { GoogleVertexShared } from "./google-vertex-shared.js";
10
10
  export const id = ProviderID.make("google-vertex");
11
11
  const fromRequest = Effect.fn("GoogleVertex.fromRequest")(function* (request) {
@@ -53,10 +53,7 @@ const configuredRoute = (input, modelID) => {
53
53
  const apiKey = GoogleVertexShared.apiKey(input);
54
54
  const endpointModel = String(modelID).startsWith("endpoints/");
55
55
  if (apiKey !== undefined && endpointModel)
56
- throw new ProviderConfigurationError({
57
- provider: id,
58
- message: "Google Vertex tuned models do not support Express Mode API keys",
59
- });
56
+ throw new Error("Google Vertex tuned models do not support Express Mode API keys");
60
57
  const location = GoogleVertexShared.location(inputLocation, "us-central1");
61
58
  const project = GoogleVertexShared.project(inputProject);
62
59
  const endpoint = baseURL ??
@@ -80,19 +77,16 @@ export const provider = {
80
77
  id,
81
78
  configure,
82
79
  };
83
- export const model = (modelID, { accessToken, apiKey, baseURL, body, headers, location, project, ...providerOptions }) => {
84
- if (apiKey !== undefined && accessToken !== undefined)
85
- throw new ProviderConfigurationError({
86
- provider: id,
87
- message: "Google Vertex apiKey cannot be combined with accessToken or auth",
88
- });
80
+ export const model = (modelID, settings) => {
81
+ if (settings.apiKey !== undefined && settings.accessToken !== undefined)
82
+ throw new Error("Google Vertex apiKey cannot be combined with accessToken or auth");
89
83
  return configure({
90
- ...(apiKey === undefined ? { accessToken: accessToken } : { apiKey: apiKey }),
91
- baseURL,
92
- headers: headers === undefined ? undefined : { ...headers },
93
- http: body === undefined ? undefined : { body: { ...body } },
94
- location,
95
- project,
96
- providerOptions,
84
+ ...(settings.apiKey === undefined ? { accessToken: settings.accessToken } : { apiKey: settings.apiKey }),
85
+ baseURL: settings.baseURL,
86
+ headers: settings.headers === undefined ? undefined : { ...settings.headers },
87
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
88
+ location: settings.location,
89
+ project: settings.project,
90
+ providerOptions: settings.providerOptions,
97
91
  }).model(modelID);
98
92
  };
@@ -89,10 +89,11 @@ export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
89
89
  readonly baseURL?: string;
90
90
  readonly providerOptions?: Gemini.ProviderOptionsInput;
91
91
  };
92
- export type Settings = ProviderPackage.Settings & Gemini.ProviderOptionsInput & {
92
+ export interface Settings extends ProviderPackage.Settings {
93
93
  readonly apiKey?: string;
94
94
  readonly baseURL?: string;
95
- };
95
+ readonly providerOptions?: Gemini.ProviderOptionsInput;
96
+ }
96
97
  export declare const configure: (input?: Config) => {
97
98
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
98
99
  model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
@@ -32,11 +32,11 @@ export const configure = (input = {}) => {
32
32
  };
33
33
  };
34
34
  export const provider = configure();
35
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
36
- apiKey,
37
- baseURL,
38
- headers: headers === undefined ? undefined : { ...headers },
39
- http: body === undefined ? undefined : { body: { ...body } },
40
- providerOptions,
35
+ export const model = (modelID, settings) => configure({
36
+ apiKey: settings.apiKey,
37
+ baseURL: settings.baseURL,
38
+ headers: settings.headers === undefined ? undefined : { ...settings.headers },
39
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
40
+ providerOptions: settings.providerOptions,
41
41
  }).model(modelID);
42
42
  export const image = provider.image;
@@ -17,10 +17,11 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
17
17
  readonly baseURL?: string;
18
18
  readonly providerOptions?: ProviderOptions;
19
19
  };
20
- export type Settings = ProviderPackage.Settings & ProviderOptions & {
20
+ export interface Settings extends ProviderPackage.Settings {
21
21
  readonly apiKey?: string;
22
22
  readonly baseURL?: string;
23
- };
23
+ readonly providerOptions?: ProviderOptions;
24
+ }
24
25
  export declare const protocol: Protocol<{
25
26
  readonly model: string;
26
27
  readonly messages: readonly ({
@@ -71,11 +71,11 @@ export const configure = (input = {}) => {
71
71
  };
72
72
  };
73
73
  export const provider = configure();
74
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
75
- apiKey,
76
- baseURL,
77
- headers: headers === undefined ? undefined : { ...headers },
78
- http: body === undefined ? undefined : { body: { ...body } },
79
- providerOptions,
74
+ export const model = (modelID, settings) => configure({
75
+ apiKey: settings.apiKey,
76
+ baseURL: settings.baseURL,
77
+ headers: settings.headers === undefined ? undefined : { ...settings.headers },
78
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
79
+ providerOptions: settings.providerOptions,
80
80
  }).model(modelID);
81
81
  export * as Groq from "./groq.js";
@@ -1,4 +1,3 @@
1
- export * as Alibaba from "./alibaba.js";
2
1
  export * as Anthropic from "./anthropic.js";
3
2
  export * as AnthropicCompatible from "./anthropic-compatible.js";
4
3
  export * as AmazonBedrock from "./amazon-bedrock.js";
@@ -20,7 +19,6 @@ export * as Groq from "./groq.js";
20
19
  export * as Meta from "./meta.js";
21
20
  export * as MiniMax from "./minimax.js";
22
21
  export * as Mistral from "./mistral.js";
23
- export * as Moonshot from "./moonshot.js";
24
22
  export * as OpenAI from "./openai.js";
25
23
  export * as OpenAICompatible from "./openai-compatible.js";
26
24
  export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
@@ -28,4 +26,3 @@ export * as OpenRouter from "./openrouter.js";
28
26
  export * as TogetherAI from "./togetherai.js";
29
27
  export * as XAI from "./xai.js";
30
28
  export * as ZAI from "./zai.js";
31
- export * as ZAICodingPlan from "./zai-coding-plan.js";
@@ -1,4 +1,3 @@
1
- export * as Alibaba from "./alibaba.js";
2
1
  export * as Anthropic from "./anthropic.js";
3
2
  export * as AnthropicCompatible from "./anthropic-compatible.js";
4
3
  export * as AmazonBedrock from "./amazon-bedrock.js";
@@ -20,7 +19,6 @@ export * as Groq from "./groq.js";
20
19
  export * as Meta from "./meta.js";
21
20
  export * as MiniMax from "./minimax.js";
22
21
  export * as Mistral from "./mistral.js";
23
- export * as Moonshot from "./moonshot.js";
24
22
  export * as OpenAI from "./openai.js";
25
23
  export * as OpenAICompatible from "./openai-compatible.js";
26
24
  export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
@@ -28,4 +26,3 @@ export * as OpenRouter from "./openrouter.js";
28
26
  export * as TogetherAI from "./togetherai.js";
29
27
  export * as XAI from "./xai.js";
30
28
  export * as ZAI from "./zai.js";
31
- export * as ZAICodingPlan from "./zai-coding-plan.js";
@@ -34,10 +34,11 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
34
34
  readonly baseURL?: string;
35
35
  readonly providerOptions?: ProviderOptionsInput;
36
36
  };
37
- export type Settings = ProviderPackage.Settings & ProviderOptionsInput & {
37
+ export interface Settings extends ProviderPackage.Settings {
38
38
  readonly apiKey?: string;
39
39
  readonly baseURL?: string;
40
- };
40
+ readonly providerOptions?: ProviderOptionsInput;
41
+ }
41
42
  export declare const routes: (Route<{
42
43
  readonly model: string;
43
44
  readonly messages: readonly ({
@@ -544,15 +545,9 @@ export declare const routes: (Route<{
544
545
  readonly type: "enabled";
545
546
  readonly budget_tokens: number;
546
547
  readonly display?: "summarized" | "omitted" | undefined;
547
- readonly block_binding?: {
548
- readonly prefix_mismatch_behavior?: string | undefined;
549
- } | undefined;
550
548
  } | {
551
549
  readonly type: "adaptive";
552
550
  readonly display?: "summarized" | "omitted" | undefined;
553
- readonly block_binding?: {
554
- readonly prefix_mismatch_behavior?: string | undefined;
555
- } | undefined;
556
551
  } | {
557
552
  readonly type: "disabled";
558
553
  } | undefined;
@@ -101,13 +101,13 @@ export const image = provider.image;
101
101
  export const model = (modelID, settings) => fromSettings(settings).responses(modelID);
102
102
  export const chatModel = (modelID, settings) => fromSettings(settings).chat(modelID);
103
103
  export const messagesModel = (modelID, settings) => fromSettings(settings).messages(modelID);
104
- function fromSettings({ apiKey, baseURL, body, headers, ...providerOptions }) {
104
+ function fromSettings(settings) {
105
105
  return configure({
106
- apiKey,
107
- baseURL,
108
- headers,
109
- http: body === undefined ? undefined : { body: { ...body } },
110
- providerOptions,
106
+ apiKey: settings.apiKey,
107
+ baseURL: settings.baseURL,
108
+ headers: settings.headers,
109
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
110
+ providerOptions: settings.providerOptions,
111
111
  });
112
112
  }
113
113
  export * as Meta from "./meta.js";
@@ -1,8 +1,8 @@
1
1
  import { MiniMax } from "../minimax.js";
2
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => MiniMax.configure({
3
- apiKey,
4
- baseURL,
5
- headers,
6
- http: body === undefined ? undefined : { body: { ...body } },
7
- providerOptions,
2
+ export const model = (modelID, settings) => MiniMax.configure({
3
+ apiKey: settings.apiKey,
4
+ baseURL: settings.baseURL,
5
+ headers: settings.headers,
6
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
7
+ providerOptions: settings.providerOptions,
8
8
  }).chat(modelID);
@@ -1,8 +1,8 @@
1
1
  import { MiniMax } from "../minimax.js";
2
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => MiniMax.configure({
3
- apiKey,
4
- baseURL,
5
- headers,
6
- http: body === undefined ? undefined : { body: { ...body } },
7
- providerOptions,
2
+ export const model = (modelID, settings) => MiniMax.configure({
3
+ apiKey: settings.apiKey,
4
+ baseURL: settings.baseURL,
5
+ headers: settings.headers,
6
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
7
+ providerOptions: settings.providerOptions,
8
8
  }).responses(modelID);
@@ -29,10 +29,11 @@ export type Config = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthO
29
29
  readonly baseURL?: string;
30
30
  readonly providerOptions?: ProviderOptionsInput;
31
31
  };
32
- export type Settings<Options = MessagesOptionsInput> = ProviderPackage.Settings & Options & {
32
+ export interface Settings<Options = MessagesOptionsInput> extends ProviderPackage.Settings {
33
33
  readonly apiKey?: string;
34
34
  readonly baseURL?: string;
35
- };
35
+ readonly providerOptions?: Options;
36
+ }
36
37
  export declare const routes: (Route<{
37
38
  readonly max_tokens: number;
38
39
  readonly model: string;
@@ -247,15 +248,9 @@ export declare const routes: (Route<{
247
248
  readonly type: "enabled";
248
249
  readonly budget_tokens: number;
249
250
  readonly display?: "summarized" | "omitted" | undefined;
250
- readonly block_binding?: {
251
- readonly prefix_mismatch_behavior?: string | undefined;
252
- } | undefined;
253
251
  } | {
254
252
  readonly type: "adaptive";
255
253
  readonly display?: "summarized" | "omitted" | undefined;
256
- readonly block_binding?: {
257
- readonly prefix_mismatch_behavior?: string | undefined;
258
- } | undefined;
259
254
  } | {
260
255
  readonly type: "disabled";
261
256
  } | undefined;
@@ -76,12 +76,12 @@ export const configure = (input = {}) => {
76
76
  return { id, model: messages, messages, chat, responses, configure };
77
77
  };
78
78
  export const provider = configure();
79
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
80
- apiKey,
81
- baseURL,
82
- headers,
83
- http: body === undefined ? undefined : { body: { ...body } },
84
- providerOptions,
79
+ export const model = (modelID, settings) => configure({
80
+ apiKey: settings.apiKey,
81
+ baseURL: settings.baseURL,
82
+ headers: settings.headers,
83
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
84
+ providerOptions: settings.providerOptions,
85
85
  }).model(modelID);
86
86
  export const messages = provider.messages;
87
87
  export const chat = provider.chat;
@@ -9,10 +9,11 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
9
9
  readonly baseURL?: string;
10
10
  readonly providerOptions?: ProviderOptions;
11
11
  };
12
- export type Settings = ProviderPackage.Settings & ProviderOptions & {
12
+ export interface Settings extends ProviderPackage.Settings {
13
13
  readonly apiKey?: string;
14
14
  readonly baseURL?: string;
15
- };
15
+ readonly providerOptions?: ProviderOptions;
16
+ }
16
17
  export declare const route: import("../route/client.js").Route<{
17
18
  readonly model: string;
18
19
  readonly messages: readonly ({
@@ -18,11 +18,11 @@ export const configure = (input = {}) => {
18
18
  };
19
19
  };
20
20
  export const provider = configure();
21
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
22
- apiKey,
23
- baseURL,
24
- headers: headers === undefined ? undefined : { ...headers },
25
- http: body === undefined ? undefined : { body: { ...body } },
26
- providerOptions,
21
+ export const model = (modelID, settings) => configure({
22
+ apiKey: settings.apiKey,
23
+ baseURL: settings.baseURL,
24
+ headers: settings.headers === undefined ? undefined : { ...settings.headers },
25
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
26
+ providerOptions: settings.providerOptions,
27
27
  }).model(modelID);
28
28
  export * as Mistral from "./mistral.js";
@@ -10,11 +10,12 @@ export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
10
10
  readonly baseURL: string;
11
11
  readonly providerOptions?: OpenResponsesProviderOptionsInput;
12
12
  };
13
- export type Settings = ProviderPackage.Settings & OpenResponsesProviderOptionsInput & {
13
+ export interface Settings extends ProviderPackage.Settings {
14
14
  readonly apiKey?: string;
15
15
  readonly baseURL: string;
16
16
  readonly provider?: string;
17
- };
17
+ readonly providerOptions?: OpenResponsesProviderOptionsInput;
18
+ }
18
19
  export declare const routes: import("../route/client.js").Route<{
19
20
  readonly input: readonly ({
20
21
  readonly [x: string]: unknown;
@@ -22,11 +22,11 @@ export const provider = {
22
22
  id,
23
23
  configure,
24
24
  };
25
- export const model = (modelID, { apiKey, baseURL, body, headers, provider, ...providerOptions }) => configure({
26
- apiKey,
27
- baseURL,
28
- headers: headers === undefined ? undefined : { ...headers },
29
- http: body === undefined ? undefined : { body: { ...body } },
30
- provider,
31
- providerOptions,
25
+ export const model = (modelID, settings) => configure({
26
+ apiKey: settings.apiKey,
27
+ baseURL: settings.baseURL,
28
+ headers: settings.headers === undefined ? undefined : { ...settings.headers },
29
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
30
+ provider: settings.provider,
31
+ providerOptions: settings.providerOptions,
32
32
  }).model(modelID);
@@ -9,11 +9,12 @@ type GenericModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & Provide
9
9
  readonly baseURL: string;
10
10
  readonly providerOptions?: OpenAIProviderOptionsInput;
11
11
  };
12
- export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
12
+ export interface Settings extends ProviderPackage.Settings {
13
13
  readonly apiKey?: string;
14
14
  readonly baseURL: string;
15
15
  readonly provider?: string;
16
- };
16
+ readonly providerOptions?: OpenAIProviderOptionsInput;
17
+ }
17
18
  export declare const routes: import("../route/client.js").Route<{
18
19
  readonly model: string;
19
20
  readonly messages: readonly ({
@@ -22,12 +22,12 @@ export const provider = {
22
22
  id,
23
23
  configure,
24
24
  };
25
- export const model = (modelID, { apiKey, baseURL, body, headers, provider, ...providerOptions }) => configure({
26
- apiKey,
27
- baseURL,
28
- headers: headers === undefined ? undefined : { ...headers },
29
- http: body === undefined ? undefined : { body: { ...body } },
30
- provider,
31
- providerOptions,
25
+ export const model = (modelID, settings) => configure({
26
+ apiKey: settings.apiKey,
27
+ baseURL: settings.baseURL,
28
+ headers: settings.headers === undefined ? undefined : { ...settings.headers },
29
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
30
+ provider: settings.provider,
31
+ providerOptions: settings.providerOptions,
32
32
  }).model(modelID);
33
33
  export * as OpenAICompatible from "./openai-compatible.js";
@@ -346,13 +346,14 @@ export interface ImageGenerationOptions {
346
346
  readonly size?: OpenAIImageString<"auto" | "256x256" | "512x512" | "1024x1024" | "1536x1024" | "1024x1536" | "1792x1024" | "1024x1792">;
347
347
  }
348
348
  export declare const imageGeneration: (options?: ImageGenerationOptions) => ToolDefinition;
349
- export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
349
+ export interface Settings extends ProviderPackage.Settings {
350
350
  readonly apiKey?: string;
351
351
  readonly baseURL?: string;
352
352
  readonly organization?: string;
353
353
  readonly project?: string;
354
354
  readonly queryParams?: Readonly<Record<string, string>>;
355
- };
355
+ readonly providerOptions?: OpenAIProviderOptionsInput;
356
+ }
356
357
  export declare const configure: (input?: Config) => {
357
358
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
358
359
  model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, {
@@ -58,19 +58,19 @@ export const configure = (input = {}) => {
58
58
  };
59
59
  };
60
60
  export const provider = configure();
61
- const config = ({ apiKey, baseURL, body, headers: given, organization, project, queryParams, ...providerOptions }) => {
61
+ const config = (settings) => {
62
62
  const headers = {
63
- ...(organization === undefined ? {} : { "OpenAI-Organization": organization }),
64
- ...(project === undefined ? {} : { "OpenAI-Project": project }),
65
- ...given,
63
+ ...(settings.organization === undefined ? {} : { "OpenAI-Organization": settings.organization }),
64
+ ...(settings.project === undefined ? {} : { "OpenAI-Project": settings.project }),
65
+ ...settings.headers,
66
66
  };
67
67
  return {
68
- apiKey,
69
- baseURL,
68
+ apiKey: settings.apiKey,
69
+ baseURL: settings.baseURL,
70
70
  headers: Object.keys(headers).length === 0 ? undefined : headers,
71
- http: body === undefined ? undefined : { body: { ...body } },
72
- providerOptions,
73
- queryParams: queryParams === undefined ? undefined : { ...queryParams },
71
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
72
+ providerOptions: settings.providerOptions,
73
+ queryParams: settings.queryParams === undefined ? undefined : { ...settings.queryParams },
74
74
  };
75
75
  };
76
76
  export const model = (modelID, settings) => {
@@ -77,10 +77,11 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
77
77
  readonly baseURL?: string;
78
78
  readonly providerOptions?: OpenRouterProviderOptionsInput;
79
79
  };
80
- export type Settings = ProviderPackage.Settings & OpenRouterProviderOptionsInput & {
80
+ export interface Settings extends ProviderPackage.Settings {
81
81
  readonly apiKey?: string;
82
82
  readonly baseURL?: string;
83
- };
83
+ readonly providerOptions?: OpenRouterProviderOptionsInput;
84
+ }
84
85
  declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
85
86
  model: Schema.String;
86
87
  messages: Schema.$Array<Schema.toTaggedUnion<"role", readonly [Schema.Struct<{
@@ -105,10 +105,10 @@ export const configure = (input = {}) => {
105
105
  };
106
106
  };
107
107
  export const provider = configure();
108
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
109
- apiKey,
110
- baseURL,
111
- headers,
112
- http: body === undefined ? undefined : { body: { ...body } },
113
- providerOptions,
108
+ export const model = (modelID, settings) => configure({
109
+ apiKey: settings.apiKey,
110
+ baseURL: settings.baseURL,
111
+ headers: settings.headers,
112
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
113
+ providerOptions: settings.providerOptions,
114
114
  }).model(modelID);
@@ -8,10 +8,11 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
8
8
  readonly baseURL?: string;
9
9
  readonly providerOptions?: OpenAIProviderOptionsInput;
10
10
  };
11
- export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
11
+ export interface Settings extends ProviderPackage.Settings {
12
12
  readonly apiKey?: string;
13
13
  readonly baseURL?: string;
14
- };
14
+ readonly providerOptions?: OpenAIProviderOptionsInput;
15
+ }
15
16
  export declare const route: Route<{
16
17
  readonly model: string;
17
18
  readonly messages: readonly ({
@@ -31,10 +31,10 @@ export const configure = (input = {}) => {
31
31
  };
32
32
  };
33
33
  export const provider = configure();
34
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
35
- apiKey,
36
- baseURL,
37
- headers: headers === undefined ? undefined : { ...headers },
38
- http: body === undefined ? undefined : { body: { ...body } },
39
- providerOptions,
34
+ export const model = (modelID, settings) => configure({
35
+ apiKey: settings.apiKey,
36
+ baseURL: settings.baseURL,
37
+ headers: settings.headers === undefined ? undefined : { ...settings.headers },
38
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
39
+ providerOptions: settings.providerOptions,
40
40
  }).model(modelID);
@@ -11,10 +11,11 @@ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> &
11
11
  readonly baseURL?: string;
12
12
  readonly providerOptions?: XAIProviderOptionsInput;
13
13
  };
14
- export type Settings = ProviderPackage.Settings & XAIProviderOptionsInput & {
14
+ export interface Settings extends ProviderPackage.Settings {
15
15
  readonly apiKey?: string;
16
16
  readonly baseURL?: string;
17
- };
17
+ readonly providerOptions?: XAIProviderOptionsInput;
18
+ }
18
19
  export type { XAIImageOptions } from "../protocols/xai-images.js";
19
20
  declare const responsesRoute: Route<unknown, import("../protocols/open-responses-channel.js").Prepared, {
20
21
  endpoint: import("../route/client.js").CompactOperation;
@@ -20,10 +20,6 @@ const responsesRoute = Route.make({
20
20
  id: "openai-responses",
21
21
  name: "xAI Responses",
22
22
  rotateAfterMs: RESPONSES_WEBSOCKET_ROTATE_AFTER_MS,
23
- // xAI continues a chain only from stored responses: with `store: false` (the route default) `previous_response_id`
24
- // fails with "Response with id=… not found", so those steps are sent in full over the reused connection. It also
25
- // rejects `instructions` next to `previous_response_id` and keeps the instructions of the response it continues.
26
- continuation: ({ instructions: _instructions, ...request }) => (request.store === false ? undefined : request),
27
23
  }),
28
24
  defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } },
29
25
  });
@@ -76,12 +72,12 @@ export const configure = (input = {}) => {
76
72
  };
77
73
  };
78
74
  export const provider = configure();
79
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
80
- apiKey,
81
- baseURL,
82
- headers,
83
- http: body === undefined ? undefined : { body: { ...body } },
84
- providerOptions,
75
+ export const model = (modelID, settings) => configure({
76
+ apiKey: settings.apiKey,
77
+ baseURL: settings.baseURL,
78
+ headers: settings.headers,
79
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
80
+ providerOptions: settings.providerOptions,
85
81
  }).model(modelID);
86
82
  export const responses = provider.responses;
87
83
  export const chat = provider.chat;