@opencode-ai/ai 0.0.0-beta-17963 → 0.0.0-beta-18045
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.
- package/dist/protocols/anthropic-messages.d.ts +4 -0
- package/dist/protocols/anthropic-messages.js +23 -14
- package/dist/protocols/gemini.d.ts +40 -40
- package/dist/protocols/gemini.js +68 -50
- package/dist/protocols/open-responses-channel.js +3 -0
- package/dist/protocols/open-responses.d.ts +6 -6
- package/dist/protocols/open-responses.js +19 -7
- package/dist/protocols/openai-chat.d.ts +42 -2
- package/dist/protocols/openai-chat.js +37 -7
- package/dist/protocols/openai-compatible-responses.d.ts +1 -1
- package/dist/protocols/openai-responses.d.ts +6 -6
- package/dist/protocols/openai-responses.js +1 -2
- package/dist/protocols/shared.d.ts +2 -0
- package/dist/protocols/shared.js +11 -0
- package/dist/protocols/utils/open-responses-options.d.ts +4 -3
- package/dist/protocols/utils/open-responses-options.js +2 -1
- package/dist/protocols/utils/openai-options.d.ts +3 -3
- package/dist/protocols/utils/openai-options.js +1 -1
- package/dist/protocols/utils/tool-schema.js +1 -28
- package/dist/protocols/xai-responses.d.ts +1 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +11 -11
- package/dist/providers/anthropic-compatible.d.ts +1 -0
- package/dist/providers/anthropic.d.ts +1 -0
- package/dist/providers/azure.d.ts +8 -8
- package/dist/providers/cloudflare.d.ts +2 -2
- package/dist/providers/google-vertex-chat.d.ts +2 -2
- package/dist/providers/google-vertex-messages.d.ts +1 -0
- package/dist/providers/google-vertex-responses.d.ts +1 -1
- package/dist/providers/google-vertex.d.ts +7 -7
- package/dist/providers/google-vertex.js +13 -1
- package/dist/providers/google.d.ts +7 -7
- package/dist/providers/openai-compatible-responses.d.ts +1 -1
- package/dist/providers/openai-compatible.d.ts +9 -9
- package/dist/providers/openai-options.d.ts +6 -2
- package/dist/providers/openai.d.ts +12 -12
- package/dist/providers/openrouter.d.ts +22 -0
- package/dist/providers/openrouter.js +3 -2
- package/dist/providers/xai.d.ts +11 -11
- package/package.json +5 -5
|
@@ -323,7 +323,7 @@ export declare const CloudflareAIGateway: {
|
|
|
323
323
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
324
324
|
configure: (options: AIGatewayOptions) => {
|
|
325
325
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
326
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
326
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
327
327
|
configure: /*elided*/ any;
|
|
328
328
|
};
|
|
329
329
|
};
|
|
@@ -331,7 +331,7 @@ export declare const CloudflareWorkersAI: {
|
|
|
331
331
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
332
332
|
configure: (options: WorkersAIOptions) => {
|
|
333
333
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
334
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
334
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
335
335
|
configure: /*elided*/ any;
|
|
336
336
|
};
|
|
337
337
|
};
|
|
@@ -117,14 +117,14 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
117
117
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
118
118
|
export declare const configure: (input?: Config) => {
|
|
119
119
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
120
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
120
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
121
121
|
configure: (input?: Config) => /*elided*/ any;
|
|
122
122
|
};
|
|
123
123
|
export declare const provider: {
|
|
124
124
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
125
125
|
configure: (input?: Config) => {
|
|
126
126
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
127
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
127
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
128
128
|
configure: /*elided*/ any;
|
|
129
129
|
};
|
|
130
130
|
};
|
|
@@ -180,6 +180,7 @@ export declare const routes: Route<{
|
|
|
180
180
|
thinking?: {
|
|
181
181
|
readonly type: "enabled";
|
|
182
182
|
readonly budget_tokens: number;
|
|
183
|
+
readonly display?: "summarized" | "omitted" | undefined;
|
|
183
184
|
} | {
|
|
184
185
|
readonly type: "adaptive";
|
|
185
186
|
readonly display?: "summarized" | "omitted" | undefined;
|
|
@@ -130,7 +130,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
130
130
|
readonly presence_penalty?: number | undefined;
|
|
131
131
|
readonly safety_identifier?: string | undefined;
|
|
132
132
|
readonly top_logprobs?: number | undefined;
|
|
133
|
-
readonly service_tier?: "
|
|
133
|
+
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
134
134
|
readonly max_output_tokens?: number | undefined;
|
|
135
135
|
readonly max_tool_calls?: number | undefined;
|
|
136
136
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -28,23 +28,22 @@ export type Settings = ProviderPackage.Settings & ({
|
|
|
28
28
|
};
|
|
29
29
|
export declare const routes: Route<{
|
|
30
30
|
readonly contents: readonly {
|
|
31
|
-
readonly
|
|
32
|
-
readonly parts: readonly ({
|
|
31
|
+
readonly parts?: readonly ({
|
|
33
32
|
readonly inlineData: {
|
|
34
33
|
readonly mimeType: string;
|
|
35
34
|
readonly data: string;
|
|
36
35
|
};
|
|
37
36
|
} | {
|
|
38
37
|
readonly text: string;
|
|
39
|
-
readonly thought?: boolean | undefined;
|
|
40
|
-
readonly thoughtSignature?: string | undefined;
|
|
38
|
+
readonly thought?: boolean | null | undefined;
|
|
39
|
+
readonly thoughtSignature?: string | null | undefined;
|
|
41
40
|
} | {
|
|
42
41
|
readonly functionCall: {
|
|
43
42
|
readonly name: string;
|
|
44
|
-
readonly id?: string | undefined;
|
|
43
|
+
readonly id?: string | null | undefined;
|
|
45
44
|
readonly args?: unknown;
|
|
46
45
|
};
|
|
47
|
-
readonly thoughtSignature?: string | undefined;
|
|
46
|
+
readonly thoughtSignature?: string | null | undefined;
|
|
48
47
|
} | {
|
|
49
48
|
readonly functionResponse: {
|
|
50
49
|
readonly name: string;
|
|
@@ -57,7 +56,8 @@ export declare const routes: Route<{
|
|
|
57
56
|
};
|
|
58
57
|
}[] | undefined;
|
|
59
58
|
};
|
|
60
|
-
})[];
|
|
59
|
+
})[] | null | undefined;
|
|
60
|
+
readonly role?: "model" | "user" | null | undefined;
|
|
61
61
|
}[];
|
|
62
62
|
readonly tools?: readonly {
|
|
63
63
|
readonly functionDeclarations: readonly {
|
|
@@ -10,11 +10,23 @@ 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) {
|
|
12
12
|
const body = yield* Gemini.protocol.body.from(request);
|
|
13
|
+
// Vertex's native REST schema rejects `id` on FunctionCall/FunctionResponse parts with HTTP 400,
|
|
14
|
+
// unlike AI Studio, so history minted there cannot be lowered verbatim.
|
|
15
|
+
const contents = body.contents.map((content) => ({
|
|
16
|
+
...content,
|
|
17
|
+
parts: (content.parts ?? []).map((part) => {
|
|
18
|
+
if ("functionCall" in part)
|
|
19
|
+
return { ...part, functionCall: { ...part.functionCall, id: undefined } };
|
|
20
|
+
if ("functionResponse" in part)
|
|
21
|
+
return { ...part, functionResponse: { ...part.functionResponse, id: undefined } };
|
|
22
|
+
return part;
|
|
23
|
+
}),
|
|
24
|
+
}));
|
|
13
25
|
const value = request.providerOptions?.labels;
|
|
14
26
|
const labels = ProviderShared.isRecord(value)
|
|
15
27
|
? Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "string"))
|
|
16
28
|
: undefined;
|
|
17
|
-
return { ...body, labels };
|
|
29
|
+
return { ...body, contents, labels };
|
|
18
30
|
});
|
|
19
31
|
const protocol = {
|
|
20
32
|
...Gemini.protocol,
|
|
@@ -9,23 +9,22 @@ export type GeminiProviderOptionsInput = Gemini.ProviderOptionsInput;
|
|
|
9
9
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
10
10
|
export declare const routes: import("../route/client.js").Route<{
|
|
11
11
|
readonly contents: readonly {
|
|
12
|
-
readonly
|
|
13
|
-
readonly parts: readonly ({
|
|
12
|
+
readonly parts?: readonly ({
|
|
14
13
|
readonly inlineData: {
|
|
15
14
|
readonly mimeType: string;
|
|
16
15
|
readonly data: string;
|
|
17
16
|
};
|
|
18
17
|
} | {
|
|
19
18
|
readonly text: string;
|
|
20
|
-
readonly thought?: boolean | undefined;
|
|
21
|
-
readonly thoughtSignature?: string | undefined;
|
|
19
|
+
readonly thought?: boolean | null | undefined;
|
|
20
|
+
readonly thoughtSignature?: string | null | undefined;
|
|
22
21
|
} | {
|
|
23
22
|
readonly functionCall: {
|
|
24
23
|
readonly name: string;
|
|
25
|
-
readonly id?: string | undefined;
|
|
24
|
+
readonly id?: string | null | undefined;
|
|
26
25
|
readonly args?: unknown;
|
|
27
26
|
};
|
|
28
|
-
readonly thoughtSignature?: string | undefined;
|
|
27
|
+
readonly thoughtSignature?: string | null | undefined;
|
|
29
28
|
} | {
|
|
30
29
|
readonly functionResponse: {
|
|
31
30
|
readonly name: string;
|
|
@@ -38,7 +37,8 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
38
37
|
};
|
|
39
38
|
}[] | undefined;
|
|
40
39
|
};
|
|
41
|
-
})[];
|
|
40
|
+
})[] | null | undefined;
|
|
41
|
+
readonly role?: "model" | "user" | null | undefined;
|
|
42
42
|
}[];
|
|
43
43
|
readonly tools?: readonly {
|
|
44
44
|
readonly functionDeclarations: readonly {
|
|
@@ -128,7 +128,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
128
128
|
readonly presence_penalty?: number | undefined;
|
|
129
129
|
readonly safety_identifier?: string | undefined;
|
|
130
130
|
readonly top_logprobs?: number | undefined;
|
|
131
|
-
readonly service_tier?: "
|
|
131
|
+
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
132
132
|
readonly max_output_tokens?: number | undefined;
|
|
133
133
|
readonly max_tool_calls?: number | undefined;
|
|
134
134
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -118,51 +118,51 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
118
118
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
119
119
|
export declare const configure: (input: GenericModelOptions) => {
|
|
120
120
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
121
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
121
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
122
122
|
configure: (input: GenericModelOptions) => /*elided*/ any;
|
|
123
123
|
};
|
|
124
124
|
export declare const provider: {
|
|
125
125
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
126
126
|
configure: (input: GenericModelOptions) => {
|
|
127
127
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
128
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
128
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
129
129
|
configure: /*elided*/ any;
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
132
|
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
133
133
|
export declare const baseten: {
|
|
134
134
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
135
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
135
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
136
136
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
137
137
|
};
|
|
138
138
|
export declare const cerebras: {
|
|
139
139
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
140
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
140
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
141
141
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
142
142
|
};
|
|
143
143
|
export declare const deepinfra: {
|
|
144
144
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
145
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
145
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
146
146
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
147
147
|
};
|
|
148
148
|
export declare const deepseek: {
|
|
149
149
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
150
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
150
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
151
151
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
152
152
|
};
|
|
153
153
|
export declare const fireworks: {
|
|
154
154
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
155
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
155
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
156
156
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
157
157
|
};
|
|
158
158
|
export declare const groq: {
|
|
159
159
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
160
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
160
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
161
161
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
162
162
|
};
|
|
163
163
|
export declare const togetherai: {
|
|
164
164
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
165
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
165
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
166
166
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
167
167
|
};
|
|
168
168
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type ProviderOptions } from "../schema/index.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { OpenAIServiceTier } from "../protocols/utils/openai-options.js";
|
|
3
|
+
import type { Options } from "../protocols/utils/open-responses-options.js";
|
|
3
4
|
export type { OpenAIResponseIncludable, OpenAIServiceTier } from "../protocols/utils/openai-options.js";
|
|
4
|
-
export type OpenAIOptionsInput =
|
|
5
|
+
export type OpenAIOptionsInput = Omit<Options, "serviceTier"> & {
|
|
6
|
+
readonly serviceTier?: OpenAIServiceTier;
|
|
7
|
+
readonly [key: string]: unknown;
|
|
8
|
+
};
|
|
5
9
|
export type OpenAIProviderOptionsInput = OpenAIOptionsInput;
|
|
6
10
|
export declare const gpt5DefaultOptions: (modelID: string, options?: {
|
|
7
11
|
readonly textVerbosity?: boolean;
|
|
@@ -227,7 +227,7 @@ export declare const routes: (Route<{
|
|
|
227
227
|
readonly presence_penalty?: number | undefined;
|
|
228
228
|
readonly safety_identifier?: string | undefined;
|
|
229
229
|
readonly top_logprobs?: number | undefined;
|
|
230
|
-
readonly service_tier?: "
|
|
230
|
+
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
231
231
|
readonly max_output_tokens?: number | undefined;
|
|
232
232
|
readonly max_tool_calls?: number | undefined;
|
|
233
233
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
@@ -258,29 +258,29 @@ export interface Settings extends ProviderPackage.Settings {
|
|
|
258
258
|
}
|
|
259
259
|
export declare const configure: (input?: Config) => {
|
|
260
260
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
261
|
-
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
262
|
-
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
263
|
-
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
261
|
+
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
262
|
+
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
263
|
+
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
264
264
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
265
265
|
configure: (input?: Config) => /*elided*/ any;
|
|
266
266
|
};
|
|
267
267
|
export declare const provider: {
|
|
268
268
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
269
|
-
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
270
|
-
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
271
|
-
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
269
|
+
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
270
|
+
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
271
|
+
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
272
272
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
273
273
|
configure: (input?: Config) => {
|
|
274
274
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
275
|
-
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
276
|
-
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
277
|
-
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
275
|
+
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
276
|
+
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
277
|
+
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
278
278
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
279
279
|
configure: /*elided*/ any;
|
|
280
280
|
};
|
|
281
281
|
};
|
|
282
282
|
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
283
283
|
export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
284
|
-
export declare const responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
285
|
-
export declare const chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./
|
|
284
|
+
export declare const responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
285
|
+
export declare const chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>;
|
|
286
286
|
export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
@@ -288,6 +288,8 @@ export declare const protocol: Protocol<{
|
|
|
288
288
|
readonly prompt_tokens?: number | null | undefined;
|
|
289
289
|
readonly completion_tokens?: number | null | undefined;
|
|
290
290
|
readonly total_tokens?: number | null | undefined;
|
|
291
|
+
readonly cached_tokens?: number | null | undefined;
|
|
292
|
+
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
291
293
|
readonly prompt_tokens_details?: {
|
|
292
294
|
readonly [x: string]: unknown;
|
|
293
295
|
readonly cached_tokens?: number | null | undefined;
|
|
@@ -301,6 +303,7 @@ export declare const protocol: Protocol<{
|
|
|
301
303
|
} | null | undefined;
|
|
302
304
|
} | null | undefined;
|
|
303
305
|
readonly choices?: readonly {
|
|
306
|
+
readonly [x: string]: unknown;
|
|
304
307
|
readonly delta?: {
|
|
305
308
|
readonly [x: string]: unknown;
|
|
306
309
|
readonly reasoning?: string | null | undefined;
|
|
@@ -318,6 +321,25 @@ export declare const protocol: Protocol<{
|
|
|
318
321
|
}[] | null | undefined;
|
|
319
322
|
readonly reasoning_details?: unknown;
|
|
320
323
|
} | null | undefined;
|
|
324
|
+
readonly usage?: {
|
|
325
|
+
readonly [x: string]: unknown;
|
|
326
|
+
readonly prompt_tokens?: number | null | undefined;
|
|
327
|
+
readonly completion_tokens?: number | null | undefined;
|
|
328
|
+
readonly total_tokens?: number | null | undefined;
|
|
329
|
+
readonly cached_tokens?: number | null | undefined;
|
|
330
|
+
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
331
|
+
readonly prompt_tokens_details?: {
|
|
332
|
+
readonly [x: string]: unknown;
|
|
333
|
+
readonly cached_tokens?: number | null | undefined;
|
|
334
|
+
readonly cache_write_tokens?: number | null | undefined;
|
|
335
|
+
} | null | undefined;
|
|
336
|
+
readonly completion_tokens_details?: {
|
|
337
|
+
readonly [x: string]: unknown;
|
|
338
|
+
readonly reasoning_tokens?: number | null | undefined;
|
|
339
|
+
readonly accepted_prediction_tokens?: number | null | undefined;
|
|
340
|
+
readonly rejected_prediction_tokens?: number | null | undefined;
|
|
341
|
+
} | null | undefined;
|
|
342
|
+
} | null | undefined;
|
|
321
343
|
readonly finish_reason?: string | null | undefined;
|
|
322
344
|
readonly native_finish_reason?: string | null | undefined;
|
|
323
345
|
}[] | null | undefined;
|
|
@@ -8,7 +8,7 @@ import { ProviderID } from "../schema/index.js";
|
|
|
8
8
|
import * as OpenAICompatibleProfiles from "./openai-compatible-profile.js";
|
|
9
9
|
import * as OpenAIChat from "../protocols/openai-chat.js";
|
|
10
10
|
import { newBreakpoints, ttlBucket } from "../protocols/utils/cache.js";
|
|
11
|
-
import { isRecord } from "../protocols/shared.js";
|
|
11
|
+
import { isRecord, ProviderShared } from "../protocols/shared.js";
|
|
12
12
|
export const profile = OpenAICompatibleProfiles.profiles.openrouter;
|
|
13
13
|
export const id = ProviderID.make(profile.provider);
|
|
14
14
|
const ADAPTER = "openrouter";
|
|
@@ -39,11 +39,12 @@ export const protocol = Protocol.make({
|
|
|
39
39
|
reasoning_details: reasoningDetails,
|
|
40
40
|
};
|
|
41
41
|
});
|
|
42
|
+
const cacheKey = ProviderShared.clampPromptCacheKey(request.promptCacheKey);
|
|
42
43
|
return {
|
|
43
44
|
...body,
|
|
44
45
|
messages,
|
|
45
46
|
...bodyOptions(request.providerOptions),
|
|
46
|
-
...(
|
|
47
|
+
...(cacheKey ? { prompt_cache_key: cacheKey } : {}),
|
|
47
48
|
};
|
|
48
49
|
})),
|
|
49
50
|
},
|
package/dist/providers/xai.d.ts
CHANGED
|
@@ -114,28 +114,28 @@ export declare const routes: (Route<{
|
|
|
114
114
|
}, import("../route/transport/http.js").HttpPrepared<string>> | Route<unknown, import("../protocols/open-responses-channel.js").Prepared>)[];
|
|
115
115
|
export declare const configure: (input?: LanguageModelOptions) => {
|
|
116
116
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
117
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
118
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
119
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
117
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIOptionsInput>;
|
|
118
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIOptionsInput>;
|
|
119
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIOptionsInput>;
|
|
120
120
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
|
121
121
|
configure: (input?: LanguageModelOptions) => /*elided*/ any;
|
|
122
122
|
};
|
|
123
123
|
export declare const provider: {
|
|
124
124
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
125
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
126
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
127
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
125
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIOptionsInput>;
|
|
126
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIOptionsInput>;
|
|
127
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIOptionsInput>;
|
|
128
128
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
|
129
129
|
configure: (input?: LanguageModelOptions) => {
|
|
130
130
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
131
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
132
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
133
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
131
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIOptionsInput>;
|
|
132
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIOptionsInput>;
|
|
133
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIOptionsInput>;
|
|
134
134
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
|
135
135
|
configure: /*elided*/ any;
|
|
136
136
|
};
|
|
137
137
|
};
|
|
138
138
|
export declare const model: ProviderPackage.Definition<Settings, XAIProviderOptionsInput>["model"];
|
|
139
|
-
export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
140
|
-
export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
139
|
+
export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIOptionsInput>;
|
|
140
|
+
export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIOptionsInput>;
|
|
141
141
|
export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-beta-
|
|
3
|
+
"version": "0.0.0-beta-18045",
|
|
4
4
|
"name": "@opencode-ai/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
32
|
-
"@effect/platform-node": "4.0.0-rc.
|
|
33
|
-
"@opencode-ai/http-recorder": "0.0.0-beta-
|
|
32
|
+
"@effect/platform-node": "4.0.0-rc.111",
|
|
33
|
+
"@opencode-ai/http-recorder": "0.0.0-beta-18045",
|
|
34
34
|
"@tsconfig/bun": "1.0.9",
|
|
35
35
|
"@types/bun": "1.3.13",
|
|
36
36
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@smithy/eventstream-codec": "4.2.14",
|
|
41
41
|
"@smithy/util-utf8": "4.2.2",
|
|
42
|
-
"@opencode-ai/schema": "0.0.0-beta-
|
|
42
|
+
"@opencode-ai/schema": "0.0.0-beta-18045",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
|
-
"effect": "4.0.0-rc.
|
|
44
|
+
"effect": "4.0.0-rc.111",
|
|
45
45
|
"google-auth-library": "10.5.0"
|
|
46
46
|
}
|
|
47
47
|
}
|