@opencode-ai/ai 0.0.0-beta-18219 → 0.0.0-beta-18269

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 (32) hide show
  1. package/dist/cache-policy.js +1 -1
  2. package/dist/protocols/anthropic-messages.js +8 -4
  3. package/dist/protocols/open-responses.d.ts +231 -25
  4. package/dist/protocols/open-responses.js +98 -79
  5. package/dist/protocols/openai-chat.d.ts +1 -0
  6. package/dist/protocols/openai-chat.js +36 -17
  7. package/dist/protocols/openai-compatible-responses.d.ts +37 -3
  8. package/dist/protocols/openai-responses.d.ts +403 -50
  9. package/dist/protocols/openai-responses.js +30 -21
  10. package/dist/protocols/shared.d.ts +3 -4
  11. package/dist/protocols/shared.js +18 -5
  12. package/dist/protocols/utils/open-responses-options.d.ts +0 -1
  13. package/dist/protocols/utils/open-responses-options.js +0 -1
  14. package/dist/protocols/xai-responses.d.ts +52 -3
  15. package/dist/protocols/xai-responses.js +31 -1
  16. package/dist/provider-error.js +4 -2
  17. package/dist/providers/amazon-bedrock-mantle.d.ts +65 -3
  18. package/dist/providers/azure.d.ts +65 -3
  19. package/dist/providers/cerebras.d.ts +228 -0
  20. package/dist/providers/cerebras.js +35 -0
  21. package/dist/providers/deepinfra.d.ts +228 -0
  22. package/dist/providers/deepinfra.js +38 -0
  23. package/dist/providers/google-vertex-responses.d.ts +37 -3
  24. package/dist/providers/index.d.ts +3 -0
  25. package/dist/providers/index.js +3 -0
  26. package/dist/providers/openai-compatible-responses.d.ts +37 -3
  27. package/dist/providers/openai.d.ts +65 -3
  28. package/dist/providers/togetherai.d.ts +228 -0
  29. package/dist/providers/togetherai.js +35 -0
  30. package/dist/schema/options.d.ts +2 -0
  31. package/dist/schema/options.js +2 -0
  32. package/package.json +3 -3
@@ -0,0 +1,228 @@
1
+ import type { ProviderPackage } from "../provider-package.js";
2
+ import { type ProviderAuthOption } from "../route/auth-options.js";
3
+ import type { RouteDefaultsInput } from "../route/client.js";
4
+ import { type ModelID } from "../schema/index.js";
5
+ import type { OpenAIProviderOptionsInput } from "./openai-options.js";
6
+ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
7
+ export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
8
+ readonly baseURL?: string;
9
+ readonly providerOptions?: OpenAIProviderOptionsInput;
10
+ };
11
+ export interface Settings extends ProviderPackage.Settings {
12
+ readonly apiKey?: string;
13
+ readonly baseURL?: string;
14
+ readonly providerOptions?: OpenAIProviderOptionsInput;
15
+ }
16
+ export declare const route: import("../route/client.js").Route<{
17
+ readonly model: string;
18
+ readonly messages: readonly ({
19
+ readonly role: "system";
20
+ readonly content: string | readonly ({
21
+ readonly type: "text";
22
+ readonly text: string;
23
+ readonly cache_control?: {
24
+ readonly type: "ephemeral";
25
+ readonly ttl?: string | undefined;
26
+ } | undefined;
27
+ } | {
28
+ readonly type: "image_url";
29
+ readonly image_url: {
30
+ readonly url: string;
31
+ };
32
+ })[];
33
+ } | {
34
+ readonly role: "user";
35
+ readonly content: string | readonly ({
36
+ readonly type: "text";
37
+ readonly text: string;
38
+ readonly cache_control?: {
39
+ readonly type: "ephemeral";
40
+ readonly ttl?: string | undefined;
41
+ } | undefined;
42
+ } | {
43
+ readonly type: "image_url";
44
+ readonly image_url: {
45
+ readonly url: string;
46
+ };
47
+ })[];
48
+ } | {
49
+ readonly [x: string]: unknown;
50
+ readonly content: string | null;
51
+ readonly role: "assistant";
52
+ readonly reasoning?: string | undefined;
53
+ readonly reasoning_content?: string | undefined;
54
+ readonly reasoning_text?: string | undefined;
55
+ readonly cache_control?: {
56
+ readonly type: "ephemeral";
57
+ readonly ttl?: string | undefined;
58
+ } | undefined;
59
+ readonly tool_calls?: readonly {
60
+ readonly id: string;
61
+ readonly type: "function";
62
+ readonly function: {
63
+ readonly name: string;
64
+ readonly arguments: string;
65
+ };
66
+ }[] | undefined;
67
+ readonly reasoning_details?: unknown;
68
+ } | {
69
+ readonly content: string;
70
+ readonly role: "tool";
71
+ readonly tool_call_id: string;
72
+ readonly cache_control?: {
73
+ readonly type: "ephemeral";
74
+ readonly ttl?: string | undefined;
75
+ } | undefined;
76
+ })[];
77
+ readonly stream: true;
78
+ readonly max_completion_tokens?: number | undefined;
79
+ readonly max_tokens?: number | undefined;
80
+ readonly tools?: readonly {
81
+ readonly function: {
82
+ readonly description: string;
83
+ readonly name: string;
84
+ readonly parameters: {
85
+ readonly [x: string]: unknown;
86
+ };
87
+ readonly strict?: boolean | undefined;
88
+ };
89
+ readonly type: "function";
90
+ readonly cache_control?: {
91
+ readonly type: "ephemeral";
92
+ readonly ttl?: string | undefined;
93
+ } | undefined;
94
+ }[] | undefined;
95
+ readonly stop?: readonly string[] | undefined;
96
+ readonly temperature?: number | undefined;
97
+ readonly seed?: number | undefined;
98
+ readonly tool_choice?: "required" | "auto" | "none" | {
99
+ readonly type: "function";
100
+ readonly function: {
101
+ readonly name: string;
102
+ };
103
+ } | undefined;
104
+ readonly top_p?: number | undefined;
105
+ readonly store?: boolean | undefined;
106
+ readonly stream_options?: {
107
+ readonly include_usage: boolean;
108
+ } | undefined;
109
+ readonly prompt_cache_key?: string | undefined;
110
+ readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
111
+ readonly tool_stream?: boolean | undefined;
112
+ readonly frequency_penalty?: number | undefined;
113
+ readonly presence_penalty?: number | undefined;
114
+ }, import("../route/transport/http.js").HttpPrepared<string>>;
115
+ export declare const routes: import("../route/client.js").Route<{
116
+ readonly model: string;
117
+ readonly messages: readonly ({
118
+ readonly role: "system";
119
+ readonly content: string | readonly ({
120
+ readonly type: "text";
121
+ readonly text: string;
122
+ readonly cache_control?: {
123
+ readonly type: "ephemeral";
124
+ readonly ttl?: string | undefined;
125
+ } | undefined;
126
+ } | {
127
+ readonly type: "image_url";
128
+ readonly image_url: {
129
+ readonly url: string;
130
+ };
131
+ })[];
132
+ } | {
133
+ readonly role: "user";
134
+ readonly content: string | readonly ({
135
+ readonly type: "text";
136
+ readonly text: string;
137
+ readonly cache_control?: {
138
+ readonly type: "ephemeral";
139
+ readonly ttl?: string | undefined;
140
+ } | undefined;
141
+ } | {
142
+ readonly type: "image_url";
143
+ readonly image_url: {
144
+ readonly url: string;
145
+ };
146
+ })[];
147
+ } | {
148
+ readonly [x: string]: unknown;
149
+ readonly content: string | null;
150
+ readonly role: "assistant";
151
+ readonly reasoning?: string | undefined;
152
+ readonly reasoning_content?: string | undefined;
153
+ readonly reasoning_text?: string | undefined;
154
+ readonly cache_control?: {
155
+ readonly type: "ephemeral";
156
+ readonly ttl?: string | undefined;
157
+ } | undefined;
158
+ readonly tool_calls?: readonly {
159
+ readonly id: string;
160
+ readonly type: "function";
161
+ readonly function: {
162
+ readonly name: string;
163
+ readonly arguments: string;
164
+ };
165
+ }[] | undefined;
166
+ readonly reasoning_details?: unknown;
167
+ } | {
168
+ readonly content: string;
169
+ readonly role: "tool";
170
+ readonly tool_call_id: string;
171
+ readonly cache_control?: {
172
+ readonly type: "ephemeral";
173
+ readonly ttl?: string | undefined;
174
+ } | undefined;
175
+ })[];
176
+ readonly stream: true;
177
+ readonly max_completion_tokens?: number | undefined;
178
+ readonly max_tokens?: number | undefined;
179
+ readonly tools?: readonly {
180
+ readonly function: {
181
+ readonly description: string;
182
+ readonly name: string;
183
+ readonly parameters: {
184
+ readonly [x: string]: unknown;
185
+ };
186
+ readonly strict?: boolean | undefined;
187
+ };
188
+ readonly type: "function";
189
+ readonly cache_control?: {
190
+ readonly type: "ephemeral";
191
+ readonly ttl?: string | undefined;
192
+ } | undefined;
193
+ }[] | undefined;
194
+ readonly stop?: readonly string[] | undefined;
195
+ readonly temperature?: number | undefined;
196
+ readonly seed?: number | undefined;
197
+ readonly tool_choice?: "required" | "auto" | "none" | {
198
+ readonly type: "function";
199
+ readonly function: {
200
+ readonly name: string;
201
+ };
202
+ } | undefined;
203
+ readonly top_p?: number | undefined;
204
+ readonly store?: boolean | undefined;
205
+ readonly stream_options?: {
206
+ readonly include_usage: boolean;
207
+ } | undefined;
208
+ readonly prompt_cache_key?: string | undefined;
209
+ readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
210
+ readonly tool_stream?: boolean | undefined;
211
+ readonly frequency_penalty?: number | undefined;
212
+ readonly presence_penalty?: number | undefined;
213
+ }, import("../route/transport/http.js").HttpPrepared<string>>[];
214
+ export declare const configure: (input?: LanguageModelOptions) => {
215
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
216
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
217
+ configure: (input?: LanguageModelOptions) => /*elided*/ any;
218
+ };
219
+ export declare const provider: {
220
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
221
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
222
+ configure: (input?: LanguageModelOptions) => {
223
+ id: string & import("effect/Brand").Brand<"AI.ProviderID">;
224
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
225
+ configure: /*elided*/ any;
226
+ };
227
+ };
228
+ export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
@@ -0,0 +1,38 @@
1
+ import { OpenAICompatibleChat } from "../protocols/openai-compatible-chat.js";
2
+ import { AuthOptions } from "../route/auth-options.js";
3
+ import { ProviderID } from "../schema/index.js";
4
+ import { profiles } from "./openai-compatible-profile.js";
5
+ export const id = ProviderID.make("deepinfra");
6
+ export const route = OpenAICompatibleChat.route.with({
7
+ id: "deepinfra-chat",
8
+ provider: id,
9
+ endpoint: { baseURL: profiles.deepinfra.baseURL },
10
+ });
11
+ export const routes = [route];
12
+ export const configure = (input = {}) => {
13
+ const { apiKey: _apiKey, auth: _auth, baseURL, ...defaults } = input;
14
+ const root = baseURL?.replace(/\/+$/, "");
15
+ const configured = route.with({
16
+ ...defaults,
17
+ endpoint: {
18
+ baseURL: root === undefined ? profiles.deepinfra.baseURL : root.endsWith("/openai") ? root : `${root}/openai`,
19
+ },
20
+ auth: AuthOptions.bearer(input, "DEEPINFRA_API_KEY"),
21
+ });
22
+ return {
23
+ id,
24
+ model: (modelID) => configured.model({
25
+ id: modelID,
26
+ compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning_content", supportsStore: false },
27
+ }),
28
+ configure,
29
+ };
30
+ };
31
+ export const provider = configure();
32
+ export const model = (modelID, settings) => configure({
33
+ apiKey: settings.apiKey,
34
+ baseURL: settings.baseURL,
35
+ headers: settings.headers === undefined ? undefined : { ...settings.headers },
36
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
37
+ providerOptions: settings.providerOptions,
38
+ }).model(modelID);
@@ -20,6 +20,43 @@ export interface Settings extends ProviderPackage.Settings {
20
20
  }
21
21
  export declare const routes: import("../route/client.js").Route<{
22
22
  readonly input: readonly ({
23
+ readonly [x: string]: unknown;
24
+ readonly id: string;
25
+ readonly type: "web_search_call";
26
+ readonly status?: string | undefined;
27
+ readonly action?: {
28
+ readonly [x: string]: unknown;
29
+ } | null | undefined;
30
+ } | {
31
+ readonly [x: string]: unknown;
32
+ readonly id: string;
33
+ readonly type: "file_search_call";
34
+ readonly status?: string | undefined;
35
+ readonly queries?: readonly string[] | undefined;
36
+ readonly results?: readonly {
37
+ readonly [x: string]: unknown;
38
+ }[] | null | undefined;
39
+ } | {
40
+ readonly [x: string]: unknown;
41
+ readonly id: string;
42
+ readonly type: "code_interpreter_call";
43
+ readonly status?: string | undefined;
44
+ readonly code?: string | null | undefined;
45
+ readonly container_id?: string | null | undefined;
46
+ readonly outputs?: readonly {
47
+ readonly [x: string]: unknown;
48
+ }[] | null | undefined;
49
+ } | {
50
+ readonly [x: string]: unknown;
51
+ readonly id: string;
52
+ readonly type: "mcp_call";
53
+ readonly status?: string | undefined;
54
+ readonly name?: string | undefined;
55
+ readonly output?: string | null | undefined;
56
+ readonly error?: unknown;
57
+ readonly arguments?: string | undefined;
58
+ readonly server_label?: string | undefined;
59
+ } | {
23
60
  readonly type: "reasoning";
24
61
  readonly summary: readonly {
25
62
  readonly type: "summary_text";
@@ -27,9 +64,6 @@ export declare const routes: import("../route/client.js").Route<{
27
64
  }[];
28
65
  readonly id?: string | undefined;
29
66
  readonly encrypted_content?: string | null | undefined;
30
- } | {
31
- readonly type: "item_reference";
32
- readonly id: string;
33
67
  } | {
34
68
  readonly role: "system";
35
69
  readonly content: string;
@@ -3,8 +3,10 @@ export * as AnthropicCompatible from "./anthropic-compatible.js";
3
3
  export * as AmazonBedrock from "./amazon-bedrock.js";
4
4
  export * as AmazonBedrockMantle from "./amazon-bedrock-mantle.js";
5
5
  export * as Azure from "./azure.js";
6
+ export * as Cerebras from "./cerebras.js";
6
7
  export * as Cloudflare from "./cloudflare.js";
7
8
  export { CloudflareAIGateway, CloudflareWorkersAI } from "./cloudflare.js";
9
+ export * as DeepInfra from "./deepinfra.js";
8
10
  export * as Google from "./google.js";
9
11
  export * as GoogleVertex from "./google-vertex.js";
10
12
  export * as GoogleVertexChat from "./google-vertex-chat.js";
@@ -14,5 +16,6 @@ export * as OpenAI from "./openai.js";
14
16
  export * as OpenAICompatible from "./openai-compatible.js";
15
17
  export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
16
18
  export * as OpenRouter from "./openrouter.js";
19
+ export * as TogetherAI from "./togetherai.js";
17
20
  export * as XAI from "./xai.js";
18
21
  export * as ZAI from "./zai.js";
@@ -3,8 +3,10 @@ export * as AnthropicCompatible from "./anthropic-compatible.js";
3
3
  export * as AmazonBedrock from "./amazon-bedrock.js";
4
4
  export * as AmazonBedrockMantle from "./amazon-bedrock-mantle.js";
5
5
  export * as Azure from "./azure.js";
6
+ export * as Cerebras from "./cerebras.js";
6
7
  export * as Cloudflare from "./cloudflare.js";
7
8
  export { CloudflareAIGateway, CloudflareWorkersAI } from "./cloudflare.js";
9
+ export * as DeepInfra from "./deepinfra.js";
8
10
  export * as Google from "./google.js";
9
11
  export * as GoogleVertex from "./google-vertex.js";
10
12
  export * as GoogleVertexChat from "./google-vertex-chat.js";
@@ -14,5 +16,6 @@ export * as OpenAI from "./openai.js";
14
16
  export * as OpenAICompatible from "./openai-compatible.js";
15
17
  export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
16
18
  export * as OpenRouter from "./openrouter.js";
19
+ export * as TogetherAI from "./togetherai.js";
17
20
  export * as XAI from "./xai.js";
18
21
  export * as ZAI from "./zai.js";
@@ -18,6 +18,43 @@ export interface Settings extends ProviderPackage.Settings {
18
18
  }
19
19
  export declare const routes: import("../route/client.js").Route<{
20
20
  readonly input: readonly ({
21
+ readonly [x: string]: unknown;
22
+ readonly id: string;
23
+ readonly type: "web_search_call";
24
+ readonly status?: string | undefined;
25
+ readonly action?: {
26
+ readonly [x: string]: unknown;
27
+ } | null | undefined;
28
+ } | {
29
+ readonly [x: string]: unknown;
30
+ readonly id: string;
31
+ readonly type: "file_search_call";
32
+ readonly status?: string | undefined;
33
+ readonly queries?: readonly string[] | undefined;
34
+ readonly results?: readonly {
35
+ readonly [x: string]: unknown;
36
+ }[] | null | undefined;
37
+ } | {
38
+ readonly [x: string]: unknown;
39
+ readonly id: string;
40
+ readonly type: "code_interpreter_call";
41
+ readonly status?: string | undefined;
42
+ readonly code?: string | null | undefined;
43
+ readonly container_id?: string | null | undefined;
44
+ readonly outputs?: readonly {
45
+ readonly [x: string]: unknown;
46
+ }[] | null | undefined;
47
+ } | {
48
+ readonly [x: string]: unknown;
49
+ readonly id: string;
50
+ readonly type: "mcp_call";
51
+ readonly status?: string | undefined;
52
+ readonly name?: string | undefined;
53
+ readonly output?: string | null | undefined;
54
+ readonly error?: unknown;
55
+ readonly arguments?: string | undefined;
56
+ readonly server_label?: string | undefined;
57
+ } | {
21
58
  readonly type: "reasoning";
22
59
  readonly summary: readonly {
23
60
  readonly type: "summary_text";
@@ -25,9 +62,6 @@ export declare const routes: import("../route/client.js").Route<{
25
62
  }[];
26
63
  readonly id?: string | undefined;
27
64
  readonly encrypted_content?: string | null | undefined;
28
- } | {
29
- readonly type: "item_reference";
30
- readonly id: string;
31
65
  } | {
32
66
  readonly role: "system";
33
67
  readonly content: string;
@@ -107,6 +107,43 @@ export declare const routes: (Route<{
107
107
  readonly presence_penalty?: number | undefined;
108
108
  }, import("../route/transport/http.js").HttpPrepared<string>> | Route<{
109
109
  readonly input: readonly ({
110
+ readonly [x: string]: unknown;
111
+ readonly id: string;
112
+ readonly type: "web_search_call";
113
+ readonly status?: string | undefined;
114
+ readonly action?: {
115
+ readonly [x: string]: unknown;
116
+ } | null | undefined;
117
+ } | {
118
+ readonly [x: string]: unknown;
119
+ readonly id: string;
120
+ readonly type: "file_search_call";
121
+ readonly status?: string | undefined;
122
+ readonly queries?: readonly string[] | undefined;
123
+ readonly results?: readonly {
124
+ readonly [x: string]: unknown;
125
+ }[] | null | undefined;
126
+ } | {
127
+ readonly [x: string]: unknown;
128
+ readonly id: string;
129
+ readonly type: "code_interpreter_call";
130
+ readonly status?: string | undefined;
131
+ readonly code?: string | null | undefined;
132
+ readonly container_id?: string | null | undefined;
133
+ readonly outputs?: readonly {
134
+ readonly [x: string]: unknown;
135
+ }[] | null | undefined;
136
+ } | {
137
+ readonly [x: string]: unknown;
138
+ readonly id: string;
139
+ readonly type: "mcp_call";
140
+ readonly status?: string | undefined;
141
+ readonly name?: string | undefined;
142
+ readonly output?: string | null | undefined;
143
+ readonly error?: unknown;
144
+ readonly arguments?: string | undefined;
145
+ readonly server_label?: string | undefined;
146
+ } | {
110
147
  readonly type: "reasoning";
111
148
  readonly summary: readonly {
112
149
  readonly type: "summary_text";
@@ -114,9 +151,6 @@ export declare const routes: (Route<{
114
151
  }[];
115
152
  readonly id?: string | undefined;
116
153
  readonly encrypted_content?: string | null | undefined;
117
- } | {
118
- readonly type: "item_reference";
119
- readonly id: string;
120
154
  } | {
121
155
  readonly role: "system";
122
156
  readonly content: string;
@@ -170,6 +204,34 @@ export declare const routes: (Route<{
170
204
  readonly type: "input_video";
171
205
  readonly video_url: string;
172
206
  })[];
207
+ } | {
208
+ readonly [x: string]: unknown;
209
+ readonly id: string;
210
+ readonly type: "computer_call";
211
+ readonly status?: string | undefined;
212
+ readonly action?: {
213
+ readonly [x: string]: unknown;
214
+ } | null | undefined;
215
+ readonly call_id?: string | undefined;
216
+ readonly pending_safety_checks?: readonly {
217
+ readonly [x: string]: unknown;
218
+ }[] | undefined;
219
+ } | {
220
+ readonly [x: string]: unknown;
221
+ readonly id: string;
222
+ readonly type: "web_search_preview_call";
223
+ readonly status?: string | undefined;
224
+ readonly action?: {
225
+ readonly [x: string]: unknown;
226
+ } | null | undefined;
227
+ } | {
228
+ readonly [x: string]: unknown;
229
+ readonly id: string;
230
+ readonly type: "image_generation_call";
231
+ readonly status?: string | undefined;
232
+ readonly result?: string | null | undefined;
233
+ readonly revised_prompt?: string | null | undefined;
234
+ readonly output_format?: "png" | "jpeg" | "webp" | undefined;
173
235
  })[];
174
236
  readonly model: string;
175
237
  readonly stream: true;