@opencode/ai 2.2.0 → 2.2.2
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/README.md +66 -62
- package/dist/effect.d.ts +1 -1
- package/dist/effect.js +1 -1
- package/dist/image-client.d.ts +45 -0
- package/dist/image.d.ts +1 -0
- package/dist/index.d.ts +38 -20
- package/dist/index.js +14 -2
- package/dist/media-client.d.ts +1 -0
- package/dist/media-client.js +1 -0
- package/dist/protocols/alibaba-chat.d.ts +39 -4
- package/dist/protocols/alibaba-responses.d.ts +20 -3
- package/dist/protocols/google-images.js +3 -1
- package/dist/protocols/meta-responses.d.ts +40 -6
- package/dist/protocols/meta-responses.js +1 -1
- package/dist/protocols/minimax-images.d.ts +25 -0
- package/dist/protocols/minimax-images.js +150 -0
- package/dist/protocols/open-responses.d.ts +182 -27
- package/dist/protocols/open-responses.js +108 -36
- package/dist/protocols/openai-chat.d.ts +438 -46
- package/dist/protocols/openai-chat.js +121 -39
- package/dist/protocols/openai-compatible-chat.d.ts +35 -4
- package/dist/protocols/openai-compatible-responses.d.ts +20 -3
- package/dist/protocols/openai-freeform.d.ts +47 -0
- package/dist/protocols/openai-freeform.js +54 -0
- package/dist/protocols/openai-images.d.ts +16 -1
- package/dist/protocols/openai-images.js +49 -17
- package/dist/protocols/openai-responses.d.ts +120 -18
- package/dist/protocols/openai-responses.js +17 -8
- package/dist/protocols/venice-chat.d.ts +39 -4
- package/dist/protocols/venice-chat.js +1 -1
- package/dist/protocols/xai-images.d.ts +6 -0
- package/dist/protocols/xai-images.js +4 -5
- package/dist/protocols/xai-responses.d.ts +20 -3
- package/dist/protocols/xai-responses.js +2 -1
- package/dist/protocols/zai-chat.d.ts +39 -4
- package/dist/provider-error.js +5 -4
- package/dist/provider-package.d.ts +2 -0
- package/dist/providers/alibaba.d.ts +58 -10
- package/dist/providers/amazon-bedrock-mantle.d.ts +66 -11
- package/dist/providers/amazon-bedrock-mantle.js +1 -1
- package/dist/providers/amazon-bedrock.d.ts +1 -1
- package/dist/providers/amazon-bedrock.js +1 -1
- package/dist/providers/anthropic-compatible.d.ts +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +1 -1
- package/dist/providers/azure.d.ts +79 -15
- package/dist/providers/baseten.d.ts +74 -12
- package/dist/providers/baseten.js +1 -1
- package/dist/providers/cerebras.d.ts +73 -11
- package/dist/providers/cerebras.js +1 -1
- package/dist/providers/cloudflare-ai-gateway.d.ts +113 -17
- package/dist/providers/cloudflare-workers-ai.d.ts +73 -11
- package/dist/providers/cohere/chat.d.ts +1 -1
- package/dist/providers/cohere/chat.js +1 -1
- package/dist/providers/cohere.d.ts +73 -11
- package/dist/providers/cohere.js +1 -1
- package/dist/providers/deepinfra.d.ts +73 -11
- package/dist/providers/deepinfra.js +1 -1
- package/dist/providers/deepseek.d.ts +73 -11
- package/dist/providers/deepseek.js +1 -1
- package/dist/providers/digitalocean/responses.d.ts +4 -0
- package/dist/providers/digitalocean/responses.js +1 -0
- package/dist/providers/digitalocean.d.ts +320 -21
- package/dist/providers/digitalocean.js +18 -7
- package/dist/providers/fireworks.d.ts +73 -11
- package/dist/providers/fireworks.js +1 -1
- package/dist/providers/google/interactions.d.ts +1 -1
- package/dist/providers/google/interactions.js +1 -1
- package/dist/providers/google-vertex-chat.d.ts +36 -5
- package/dist/providers/google-vertex-chat.js +1 -1
- package/dist/providers/google-vertex-interactions.d.ts +1 -1
- package/dist/providers/google-vertex-interactions.js +1 -1
- package/dist/providers/google-vertex-messages.d.ts +1 -1
- package/dist/providers/google-vertex-messages.js +1 -1
- package/dist/providers/google-vertex-mistral.d.ts +1 -1
- package/dist/providers/google-vertex-mistral.js +1 -1
- package/dist/providers/google-vertex-responses.d.ts +21 -4
- package/dist/providers/google-vertex-responses.js +1 -1
- package/dist/providers/google-vertex.d.ts +2 -2
- package/dist/providers/google-vertex.js +1 -1
- package/dist/providers/google.d.ts +2 -2
- package/dist/providers/google.js +1 -1
- package/dist/providers/groq.d.ts +77 -11
- package/dist/providers/groq.js +1 -1
- package/dist/providers/index.d.ts +0 -4
- package/dist/providers/index.js +0 -4
- package/dist/providers/meta/images.d.ts +2 -0
- package/dist/providers/meta/images.js +1 -0
- package/dist/providers/meta.d.ts +61 -12
- package/dist/providers/meta.js +2 -1
- package/dist/providers/minimax/chat.d.ts +1 -1
- package/dist/providers/minimax/chat.js +1 -1
- package/dist/providers/minimax/images.d.ts +3 -0
- package/dist/providers/minimax/images.js +1 -0
- package/dist/providers/minimax/responses.d.ts +1 -1
- package/dist/providers/minimax/responses.js +1 -1
- package/dist/providers/minimax.d.ts +63 -9
- package/dist/providers/minimax.js +22 -9
- package/dist/providers/mistral.d.ts +3 -3
- package/dist/providers/mistral.js +1 -1
- package/dist/providers/moonshot/messages.d.ts +1 -1
- package/dist/providers/moonshot/messages.js +1 -1
- package/dist/providers/moonshot/responses.d.ts +1 -1
- package/dist/providers/moonshot/responses.js +1 -1
- package/dist/providers/moonshot.d.ts +56 -8
- package/dist/providers/moonshot.js +1 -1
- package/dist/providers/openai-compatible-responses.d.ts +21 -4
- package/dist/providers/openai-compatible.d.ts +38 -7
- package/dist/providers/openai-compatible.js +9 -2
- package/dist/providers/openai.d.ts +59 -11
- package/dist/providers/openai.js +4 -2
- package/dist/providers/opencode.d.ts +3 -3
- package/dist/providers/opencode.js +1 -1
- package/dist/providers/openrouter/responses.d.ts +4 -0
- package/dist/providers/openrouter/responses.js +1 -0
- package/dist/providers/openrouter.d.ts +356 -26
- package/dist/providers/openrouter.js +42 -13
- package/dist/providers/togetherai.d.ts +73 -11
- package/dist/providers/togetherai.js +1 -1
- package/dist/providers/typesafe-ai.d.ts +3 -3
- package/dist/providers/typesafe-ai.js +1 -1
- package/dist/providers/venice/responses.d.ts +4 -0
- package/dist/providers/venice/responses.js +1 -0
- package/dist/providers/venice.d.ts +242 -9
- package/dist/providers/venice.js +33 -17
- package/dist/providers/vercel-ai-gateway.d.ts +8 -8
- package/dist/providers/vercel-ai-gateway.js +12 -2
- package/dist/providers/xai.d.ts +39 -8
- package/dist/providers/xai.js +1 -1
- package/dist/providers/zai-coding-plan/messages.d.ts +1 -1
- package/dist/providers/zai-coding-plan/messages.js +1 -1
- package/dist/providers/zai-coding-plan/responses.d.ts +1 -1
- package/dist/providers/zai-coding-plan/responses.js +1 -1
- package/dist/providers/zai-coding-plan.d.ts +56 -8
- package/dist/providers/zai-coding-plan.js +1 -1
- package/dist/providers/zai.d.ts +37 -6
- package/dist/providers/zai.js +1 -1
- package/dist/route/auth.d.ts +1 -1
- package/dist/route/media-protocol.d.ts +2 -4
- package/dist/route/media.d.ts +1 -1
- package/dist/route/media.js +2 -4
- package/dist/schema/events.d.ts +2 -0
- package/dist/schema/messages.d.ts +35 -1
- package/dist/schema/messages.js +20 -0
- package/dist/speech-client.d.ts +48 -0
- package/dist/speech.d.ts +1 -0
- package/dist/testing/decision.d.ts +16 -0
- package/dist/testing/decision.js +20 -0
- package/dist/testing/image.d.ts +14 -0
- package/dist/testing/image.js +12 -0
- package/dist/testing/media.d.ts +18 -0
- package/dist/testing/media.js +36 -0
- package/dist/testing/script.d.ts +28 -0
- package/dist/testing/script.js +60 -0
- package/dist/testing/speech.d.ts +14 -0
- package/dist/testing/speech.js +12 -0
- package/dist/testing/transcription.d.ts +14 -0
- package/dist/testing/transcription.js +12 -0
- package/dist/testing/video.d.ts +14 -0
- package/dist/testing/video.js +12 -0
- package/dist/testing.d.ts +10 -21
- package/dist/testing.js +11 -54
- package/dist/tool.d.ts +12 -1
- package/dist/tool.js +10 -2
- package/dist/transcription-client.d.ts +64 -0
- package/dist/transcription.d.ts +1 -0
- package/dist/video-client.d.ts +41 -0
- package/dist/video.d.ts +1 -0
- package/package.json +24 -40
- package/dist/protocols/bfl-images.d.ts +0 -47
- package/dist/protocols/bfl-images.js +0 -155
- package/dist/protocols/fal-images.d.ts +0 -34
- package/dist/protocols/fal-images.js +0 -95
- package/dist/protocols/fal-video.d.ts +0 -29
- package/dist/protocols/fal-video.js +0 -73
- package/dist/protocols/replicate-images.d.ts +0 -28
- package/dist/protocols/replicate-images.js +0 -127
- package/dist/protocols/stability-images.d.ts +0 -44
- package/dist/protocols/stability-images.js +0 -131
- package/dist/protocols/utils/fal-queue.d.ts +0 -26
- package/dist/protocols/utils/fal-queue.js +0 -67
- package/dist/providers/black-forest-labs.d.ts +0 -21
- package/dist/providers/black-forest-labs.js +0 -23
- package/dist/providers/fal.d.ts +0 -24
- package/dist/providers/fal.js +0 -26
- package/dist/providers/replicate.d.ts +0 -21
- package/dist/providers/replicate.js +0 -17
- package/dist/providers/stability.d.ts +0 -23
- package/dist/providers/stability.js +0 -18
|
@@ -354,7 +354,7 @@ export declare const routes: (Route<{
|
|
|
354
354
|
readonly role: "developer";
|
|
355
355
|
readonly content: string;
|
|
356
356
|
} | {
|
|
357
|
-
readonly type: "function_call_output";
|
|
357
|
+
readonly type: "custom_tool_call_output" | "function_call_output";
|
|
358
358
|
readonly call_id: string;
|
|
359
359
|
readonly output: string | readonly ({
|
|
360
360
|
readonly type: "input_text";
|
|
@@ -424,6 +424,12 @@ export declare const routes: (Route<{
|
|
|
424
424
|
readonly name: string;
|
|
425
425
|
readonly namespace?: string | undefined;
|
|
426
426
|
readonly arguments: string;
|
|
427
|
+
} | {
|
|
428
|
+
readonly type: "custom_tool_call";
|
|
429
|
+
readonly id?: string | undefined;
|
|
430
|
+
readonly call_id: string;
|
|
431
|
+
readonly name: string;
|
|
432
|
+
readonly input: string;
|
|
427
433
|
} | {
|
|
428
434
|
readonly [x: string]: unknown;
|
|
429
435
|
readonly type: "web_search_call";
|
|
@@ -468,6 +474,17 @@ export declare const routes: (Route<{
|
|
|
468
474
|
})[];
|
|
469
475
|
readonly instructions?: string | undefined;
|
|
470
476
|
readonly tools?: readonly ({
|
|
477
|
+
readonly type: "custom";
|
|
478
|
+
readonly name: string;
|
|
479
|
+
readonly description: string;
|
|
480
|
+
readonly format: {
|
|
481
|
+
readonly type: "text";
|
|
482
|
+
} | {
|
|
483
|
+
readonly type: "grammar";
|
|
484
|
+
readonly syntax: "lark" | "regex";
|
|
485
|
+
readonly definition: string;
|
|
486
|
+
};
|
|
487
|
+
} | {
|
|
471
488
|
readonly type: "function";
|
|
472
489
|
readonly name: string;
|
|
473
490
|
readonly description: string;
|
|
@@ -480,13 +497,13 @@ export declare const routes: (Route<{
|
|
|
480
497
|
readonly type: string;
|
|
481
498
|
})[] | undefined;
|
|
482
499
|
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
483
|
-
readonly type: "function";
|
|
500
|
+
readonly type: "custom" | "function";
|
|
484
501
|
readonly name: string;
|
|
485
502
|
} | {
|
|
486
503
|
readonly type: "allowed_tools";
|
|
487
504
|
readonly mode: "auto" | "none" | "required";
|
|
488
505
|
readonly tools: readonly {
|
|
489
|
-
readonly type: "function";
|
|
506
|
+
readonly type: "custom" | "function";
|
|
490
507
|
readonly name: string;
|
|
491
508
|
}[];
|
|
492
509
|
} | undefined;
|
|
@@ -594,7 +611,14 @@ export declare const routes: (Route<{
|
|
|
594
611
|
readonly ttl?: string | undefined;
|
|
595
612
|
} | undefined;
|
|
596
613
|
}[] | null;
|
|
597
|
-
readonly tool_calls?: readonly {
|
|
614
|
+
readonly tool_calls?: readonly ({
|
|
615
|
+
readonly id: string;
|
|
616
|
+
readonly type: "custom";
|
|
617
|
+
readonly custom: {
|
|
618
|
+
readonly name: string;
|
|
619
|
+
readonly input: string;
|
|
620
|
+
};
|
|
621
|
+
} | {
|
|
598
622
|
readonly id: string;
|
|
599
623
|
readonly type: "function";
|
|
600
624
|
readonly function: {
|
|
@@ -606,13 +630,13 @@ export declare const routes: (Route<{
|
|
|
606
630
|
readonly thought_signature: string;
|
|
607
631
|
};
|
|
608
632
|
} | undefined;
|
|
609
|
-
}[] | undefined;
|
|
633
|
+
})[] | undefined;
|
|
610
634
|
readonly reasoning_content?: string | undefined;
|
|
611
635
|
readonly reasoning?: string | undefined;
|
|
612
636
|
readonly reasoning_text?: string | undefined;
|
|
613
637
|
readonly reasoning_details?: unknown;
|
|
614
638
|
})[];
|
|
615
|
-
readonly tools?: readonly {
|
|
639
|
+
readonly tools?: readonly ({
|
|
616
640
|
readonly type: "function";
|
|
617
641
|
readonly function: {
|
|
618
642
|
readonly name: string;
|
|
@@ -626,12 +650,36 @@ export declare const routes: (Route<{
|
|
|
626
650
|
readonly type: "ephemeral";
|
|
627
651
|
readonly ttl?: string | undefined;
|
|
628
652
|
} | undefined;
|
|
629
|
-
}
|
|
653
|
+
} | {
|
|
654
|
+
readonly type: "custom";
|
|
655
|
+
readonly custom: {
|
|
656
|
+
readonly name: string;
|
|
657
|
+
readonly description: string;
|
|
658
|
+
readonly format: {
|
|
659
|
+
readonly type: "text";
|
|
660
|
+
} | {
|
|
661
|
+
readonly type: "grammar";
|
|
662
|
+
readonly grammar: {
|
|
663
|
+
readonly syntax: "lark" | "regex";
|
|
664
|
+
readonly definition: string;
|
|
665
|
+
};
|
|
666
|
+
};
|
|
667
|
+
};
|
|
668
|
+
readonly cache_control?: {
|
|
669
|
+
readonly type: "ephemeral";
|
|
670
|
+
readonly ttl?: string | undefined;
|
|
671
|
+
} | undefined;
|
|
672
|
+
})[] | undefined;
|
|
630
673
|
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
631
674
|
readonly type: "function";
|
|
632
675
|
readonly function: {
|
|
633
676
|
readonly name: string;
|
|
634
677
|
};
|
|
678
|
+
} | {
|
|
679
|
+
readonly type: "custom";
|
|
680
|
+
readonly custom: {
|
|
681
|
+
readonly name: string;
|
|
682
|
+
};
|
|
635
683
|
} | undefined;
|
|
636
684
|
readonly stream: true;
|
|
637
685
|
readonly stream_options?: {
|
|
@@ -684,5 +732,5 @@ export declare const provider: {
|
|
|
684
732
|
export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ChatOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
685
733
|
export declare const messages: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MessagesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
686
734
|
export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
687
|
-
export declare const model: ProviderPackage.
|
|
735
|
+
export declare const model: ProviderPackage.Model<Settings, ChatOptionsInput>;
|
|
688
736
|
export * as Moonshot from "./moonshot.js";
|
|
@@ -80,7 +80,7 @@ export const provider = configure();
|
|
|
80
80
|
export const chat = provider.chat;
|
|
81
81
|
export const messages = provider.messages;
|
|
82
82
|
export const responses = provider.responses;
|
|
83
|
-
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
83
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions } = {}) => configure({
|
|
84
84
|
apiKey,
|
|
85
85
|
baseURL,
|
|
86
86
|
headers,
|
|
@@ -31,7 +31,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
31
31
|
readonly role: "developer";
|
|
32
32
|
readonly content: string;
|
|
33
33
|
} | {
|
|
34
|
-
readonly type: "function_call_output";
|
|
34
|
+
readonly type: "custom_tool_call_output" | "function_call_output";
|
|
35
35
|
readonly call_id: string;
|
|
36
36
|
readonly output: string | readonly ({
|
|
37
37
|
readonly type: "input_text";
|
|
@@ -101,6 +101,12 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
101
101
|
readonly name: string;
|
|
102
102
|
readonly namespace?: string | undefined;
|
|
103
103
|
readonly arguments: string;
|
|
104
|
+
} | {
|
|
105
|
+
readonly type: "custom_tool_call";
|
|
106
|
+
readonly id?: string | undefined;
|
|
107
|
+
readonly call_id: string;
|
|
108
|
+
readonly name: string;
|
|
109
|
+
readonly input: string;
|
|
104
110
|
} | {
|
|
105
111
|
readonly [x: string]: unknown;
|
|
106
112
|
readonly type: "web_search_call";
|
|
@@ -145,6 +151,17 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
145
151
|
})[];
|
|
146
152
|
readonly instructions?: string | undefined;
|
|
147
153
|
readonly tools?: readonly ({
|
|
154
|
+
readonly type: "custom";
|
|
155
|
+
readonly name: string;
|
|
156
|
+
readonly description: string;
|
|
157
|
+
readonly format: {
|
|
158
|
+
readonly type: "text";
|
|
159
|
+
} | {
|
|
160
|
+
readonly type: "grammar";
|
|
161
|
+
readonly syntax: "lark" | "regex";
|
|
162
|
+
readonly definition: string;
|
|
163
|
+
};
|
|
164
|
+
} | {
|
|
148
165
|
readonly type: "function";
|
|
149
166
|
readonly name: string;
|
|
150
167
|
readonly description: string;
|
|
@@ -157,13 +174,13 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
157
174
|
readonly type: string;
|
|
158
175
|
})[] | undefined;
|
|
159
176
|
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
160
|
-
readonly type: "function";
|
|
177
|
+
readonly type: "custom" | "function";
|
|
161
178
|
readonly name: string;
|
|
162
179
|
} | {
|
|
163
180
|
readonly type: "allowed_tools";
|
|
164
181
|
readonly mode: "auto" | "none" | "required";
|
|
165
182
|
readonly tools: readonly {
|
|
166
|
-
readonly type: "function";
|
|
183
|
+
readonly type: "custom" | "function";
|
|
167
184
|
readonly name: string;
|
|
168
185
|
}[];
|
|
169
186
|
} | undefined;
|
|
@@ -205,4 +222,4 @@ export declare const provider: {
|
|
|
205
222
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
206
223
|
configure: typeof configure;
|
|
207
224
|
};
|
|
208
|
-
export declare const model: ProviderPackage.
|
|
225
|
+
export declare const model: ProviderPackage.Model<Settings, OpenResponsesProviderOptionsInput>;
|
|
@@ -4,7 +4,7 @@ import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
|
4
4
|
import type { ProviderPackage } from "../provider-package.js";
|
|
5
5
|
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
-
type
|
|
7
|
+
export type Config = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
8
8
|
readonly provider?: string;
|
|
9
9
|
readonly baseURL: string;
|
|
10
10
|
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
@@ -90,7 +90,14 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
90
90
|
readonly ttl?: string | undefined;
|
|
91
91
|
} | undefined;
|
|
92
92
|
}[] | null;
|
|
93
|
-
readonly tool_calls?: readonly {
|
|
93
|
+
readonly tool_calls?: readonly ({
|
|
94
|
+
readonly id: string;
|
|
95
|
+
readonly type: "custom";
|
|
96
|
+
readonly custom: {
|
|
97
|
+
readonly name: string;
|
|
98
|
+
readonly input: string;
|
|
99
|
+
};
|
|
100
|
+
} | {
|
|
94
101
|
readonly id: string;
|
|
95
102
|
readonly type: "function";
|
|
96
103
|
readonly function: {
|
|
@@ -102,13 +109,13 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
102
109
|
readonly thought_signature: string;
|
|
103
110
|
};
|
|
104
111
|
} | undefined;
|
|
105
|
-
}[] | undefined;
|
|
112
|
+
})[] | undefined;
|
|
106
113
|
readonly reasoning_content?: string | undefined;
|
|
107
114
|
readonly reasoning?: string | undefined;
|
|
108
115
|
readonly reasoning_text?: string | undefined;
|
|
109
116
|
readonly reasoning_details?: unknown;
|
|
110
117
|
})[];
|
|
111
|
-
readonly tools?: readonly {
|
|
118
|
+
readonly tools?: readonly ({
|
|
112
119
|
readonly type: "function";
|
|
113
120
|
readonly function: {
|
|
114
121
|
readonly name: string;
|
|
@@ -122,12 +129,36 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
122
129
|
readonly type: "ephemeral";
|
|
123
130
|
readonly ttl?: string | undefined;
|
|
124
131
|
} | undefined;
|
|
125
|
-
}
|
|
132
|
+
} | {
|
|
133
|
+
readonly type: "custom";
|
|
134
|
+
readonly custom: {
|
|
135
|
+
readonly name: string;
|
|
136
|
+
readonly description: string;
|
|
137
|
+
readonly format: {
|
|
138
|
+
readonly type: "text";
|
|
139
|
+
} | {
|
|
140
|
+
readonly type: "grammar";
|
|
141
|
+
readonly grammar: {
|
|
142
|
+
readonly syntax: "lark" | "regex";
|
|
143
|
+
readonly definition: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
readonly cache_control?: {
|
|
148
|
+
readonly type: "ephemeral";
|
|
149
|
+
readonly ttl?: string | undefined;
|
|
150
|
+
} | undefined;
|
|
151
|
+
})[] | undefined;
|
|
126
152
|
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
127
153
|
readonly type: "function";
|
|
128
154
|
readonly function: {
|
|
129
155
|
readonly name: string;
|
|
130
156
|
};
|
|
157
|
+
} | {
|
|
158
|
+
readonly type: "custom";
|
|
159
|
+
readonly custom: {
|
|
160
|
+
readonly name: string;
|
|
161
|
+
};
|
|
131
162
|
} | undefined;
|
|
132
163
|
readonly stream: true;
|
|
133
164
|
readonly stream_options?: {
|
|
@@ -157,7 +188,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
157
188
|
readonly seed?: number | undefined;
|
|
158
189
|
readonly stop?: readonly string[] | undefined;
|
|
159
190
|
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
|
|
160
|
-
export declare const configure: (input:
|
|
191
|
+
export declare const configure: (input: Config) => {
|
|
161
192
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
162
193
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
163
194
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
@@ -167,6 +198,6 @@ export declare const provider: {
|
|
|
167
198
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
168
199
|
configure: typeof configure;
|
|
169
200
|
};
|
|
170
|
-
export declare const model: ProviderPackage.
|
|
201
|
+
export declare const model: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput>;
|
|
171
202
|
export declare const imageModel: (modelID: string, settings: Settings) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
172
203
|
export * as OpenAICompatible from "./openai-compatible.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProviderID } from "../schema/index.js";
|
|
1
|
+
import { mergeProviderOptions, ProviderID } from "../schema/index.js";
|
|
2
2
|
import { OpenAICompatibleChat } from "../protocols/openai-compatible-chat.js";
|
|
3
3
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
4
4
|
import { MediaRoute } from "../route/media.js";
|
|
@@ -19,7 +19,14 @@ export const configure = (input) => {
|
|
|
19
19
|
return {
|
|
20
20
|
id: ProviderID.make(provider),
|
|
21
21
|
model: (modelID) => route.model({ id: modelID }),
|
|
22
|
-
|
|
22
|
+
// Many compatible hosts default to hosted URLs. GPT Image models always return bytes and reject the field; a
|
|
23
|
+
// proxy serving one under another name can drop the default with `response_format: null`.
|
|
24
|
+
image: (modelID, providerOptions) => OpenAIImages.model({
|
|
25
|
+
...media,
|
|
26
|
+
id: modelID,
|
|
27
|
+
provider,
|
|
28
|
+
providerOptions: mergeProviderOptions(/gpt-image|chatgpt-image/.test(modelID) ? undefined : { response_format: "b64_json" }, providerOptions),
|
|
29
|
+
}),
|
|
23
30
|
configure,
|
|
24
31
|
};
|
|
25
32
|
};
|
|
@@ -87,7 +87,14 @@ export declare const routes: (Route<{
|
|
|
87
87
|
readonly ttl?: string | undefined;
|
|
88
88
|
} | undefined;
|
|
89
89
|
}[] | null;
|
|
90
|
-
readonly tool_calls?: readonly {
|
|
90
|
+
readonly tool_calls?: readonly ({
|
|
91
|
+
readonly id: string;
|
|
92
|
+
readonly type: "custom";
|
|
93
|
+
readonly custom: {
|
|
94
|
+
readonly name: string;
|
|
95
|
+
readonly input: string;
|
|
96
|
+
};
|
|
97
|
+
} | {
|
|
91
98
|
readonly id: string;
|
|
92
99
|
readonly type: "function";
|
|
93
100
|
readonly function: {
|
|
@@ -99,13 +106,13 @@ export declare const routes: (Route<{
|
|
|
99
106
|
readonly thought_signature: string;
|
|
100
107
|
};
|
|
101
108
|
} | undefined;
|
|
102
|
-
}[] | undefined;
|
|
109
|
+
})[] | undefined;
|
|
103
110
|
readonly reasoning_content?: string | undefined;
|
|
104
111
|
readonly reasoning?: string | undefined;
|
|
105
112
|
readonly reasoning_text?: string | undefined;
|
|
106
113
|
readonly reasoning_details?: unknown;
|
|
107
114
|
})[];
|
|
108
|
-
readonly tools?: readonly {
|
|
115
|
+
readonly tools?: readonly ({
|
|
109
116
|
readonly type: "function";
|
|
110
117
|
readonly function: {
|
|
111
118
|
readonly name: string;
|
|
@@ -119,12 +126,36 @@ export declare const routes: (Route<{
|
|
|
119
126
|
readonly type: "ephemeral";
|
|
120
127
|
readonly ttl?: string | undefined;
|
|
121
128
|
} | undefined;
|
|
122
|
-
}
|
|
129
|
+
} | {
|
|
130
|
+
readonly type: "custom";
|
|
131
|
+
readonly custom: {
|
|
132
|
+
readonly name: string;
|
|
133
|
+
readonly description: string;
|
|
134
|
+
readonly format: {
|
|
135
|
+
readonly type: "text";
|
|
136
|
+
} | {
|
|
137
|
+
readonly type: "grammar";
|
|
138
|
+
readonly grammar: {
|
|
139
|
+
readonly syntax: "lark" | "regex";
|
|
140
|
+
readonly definition: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
readonly cache_control?: {
|
|
145
|
+
readonly type: "ephemeral";
|
|
146
|
+
readonly ttl?: string | undefined;
|
|
147
|
+
} | undefined;
|
|
148
|
+
})[] | undefined;
|
|
123
149
|
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
124
150
|
readonly type: "function";
|
|
125
151
|
readonly function: {
|
|
126
152
|
readonly name: string;
|
|
127
153
|
};
|
|
154
|
+
} | {
|
|
155
|
+
readonly type: "custom";
|
|
156
|
+
readonly custom: {
|
|
157
|
+
readonly name: string;
|
|
158
|
+
};
|
|
128
159
|
} | undefined;
|
|
129
160
|
readonly stream: true;
|
|
130
161
|
readonly stream_options?: {
|
|
@@ -169,7 +200,7 @@ export declare const routes: (Route<{
|
|
|
169
200
|
readonly role: "developer";
|
|
170
201
|
readonly content: string;
|
|
171
202
|
} | {
|
|
172
|
-
readonly type: "function_call_output";
|
|
203
|
+
readonly type: "custom_tool_call_output" | "function_call_output";
|
|
173
204
|
readonly call_id: string;
|
|
174
205
|
readonly output: string | readonly ({
|
|
175
206
|
readonly type: "input_text";
|
|
@@ -239,6 +270,12 @@ export declare const routes: (Route<{
|
|
|
239
270
|
readonly name: string;
|
|
240
271
|
readonly namespace?: string | undefined;
|
|
241
272
|
readonly arguments: string;
|
|
273
|
+
} | {
|
|
274
|
+
readonly type: "custom_tool_call";
|
|
275
|
+
readonly id?: string | undefined;
|
|
276
|
+
readonly call_id: string;
|
|
277
|
+
readonly name: string;
|
|
278
|
+
readonly input: string;
|
|
242
279
|
} | {
|
|
243
280
|
readonly [x: string]: unknown;
|
|
244
281
|
readonly type: "web_search_call";
|
|
@@ -310,6 +347,17 @@ export declare const routes: (Route<{
|
|
|
310
347
|
readonly ttl?: string | undefined;
|
|
311
348
|
} | undefined;
|
|
312
349
|
readonly tools?: readonly ({
|
|
350
|
+
readonly type: "custom";
|
|
351
|
+
readonly name: string;
|
|
352
|
+
readonly description: string;
|
|
353
|
+
readonly format: {
|
|
354
|
+
readonly type: "text";
|
|
355
|
+
} | {
|
|
356
|
+
readonly type: "grammar";
|
|
357
|
+
readonly syntax: "lark" | "regex";
|
|
358
|
+
readonly definition: string;
|
|
359
|
+
};
|
|
360
|
+
} | {
|
|
313
361
|
readonly type: "namespace";
|
|
314
362
|
readonly name: string;
|
|
315
363
|
readonly description: string;
|
|
@@ -342,13 +390,13 @@ export declare const routes: (Route<{
|
|
|
342
390
|
readonly size?: string | undefined;
|
|
343
391
|
})[] | undefined;
|
|
344
392
|
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
345
|
-
readonly type: "function";
|
|
393
|
+
readonly type: "custom" | "function";
|
|
346
394
|
readonly name: string;
|
|
347
395
|
} | {
|
|
348
396
|
readonly type: "allowed_tools";
|
|
349
397
|
readonly mode: "auto" | "none" | "required";
|
|
350
398
|
readonly tools: readonly {
|
|
351
|
-
readonly type: "function";
|
|
399
|
+
readonly type: "custom" | "function";
|
|
352
400
|
readonly name: string;
|
|
353
401
|
}[];
|
|
354
402
|
} | {
|
|
@@ -426,10 +474,10 @@ export declare const provider: {
|
|
|
426
474
|
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<OpenAIDecisionOptionsInput>;
|
|
427
475
|
configure: typeof configure;
|
|
428
476
|
};
|
|
429
|
-
export declare const model: ProviderPackage.
|
|
430
|
-
export declare const chatModel: ProviderPackage.
|
|
431
|
-
export declare const imageModel: (modelID: string, settings
|
|
432
|
-
export declare const decisionModel: (modelID: string, settings
|
|
477
|
+
export declare const model: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput, typeof OpenAIResponses.route.compact>;
|
|
478
|
+
export declare const chatModel: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput>;
|
|
479
|
+
export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
480
|
+
export declare const decisionModel: (modelID: string, settings?: Settings) => import("../decision.js").DecisionModel<OpenAIDecisionOptionsInput>;
|
|
433
481
|
export declare const responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, {
|
|
434
482
|
endpoint: import("../route/client.js").CompactOperation;
|
|
435
483
|
trigger: import("../route/client.js").TriggerCompactOperation;
|
package/dist/providers/openai.js
CHANGED
|
@@ -51,7 +51,9 @@ export const configure = (input = {}) => {
|
|
|
51
51
|
...deployment,
|
|
52
52
|
http: mergeHttpOptions(deployment.http, input.queryParams === undefined ? undefined : new HttpOptions({ query: input.queryParams })),
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
// The ChatGPT backend (ChatGPT sign-in) rejects multipart image edits with "Unsupported content type".
|
|
55
|
+
const imageInput = media.baseURL?.startsWith("https://chatgpt.com/") ? "json-edits" : undefined;
|
|
56
|
+
const image = (modelID, providerOptions) => OpenAIImages.model({ ...media, id: modelID, providerOptions, imageInput });
|
|
55
57
|
const speech = (modelID) => OpenAISpeech.model({ ...media, id: modelID });
|
|
56
58
|
const transcription = (modelID) => OpenAITranscription.model({ ...media, id: modelID });
|
|
57
59
|
const decisionRoute = OpenAIDecisions.route.with({
|
|
@@ -74,7 +76,7 @@ export const configure = (input = {}) => {
|
|
|
74
76
|
};
|
|
75
77
|
};
|
|
76
78
|
export const provider = configure();
|
|
77
|
-
const config = ({ apiKey, baseURL, body, headers: given, organization, project, queryParams, ...providerOptions }) => {
|
|
79
|
+
const config = ({ apiKey, baseURL, body, headers: given, organization, project, queryParams, ...providerOptions } = {}) => {
|
|
78
80
|
const headers = {
|
|
79
81
|
...(organization === undefined ? {} : { "OpenAI-Organization": organization }),
|
|
80
82
|
...(project === undefined ? {} : { "OpenAI-Project": project }),
|
|
@@ -2,7 +2,7 @@ import { HttpOptions, type ModelID, type ProviderOptions } from "../schema/index
|
|
|
2
2
|
import type { ProviderPackage } from "../provider-package.js";
|
|
3
3
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
4
4
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
-
export type
|
|
5
|
+
export type Config = ProviderAuthOption<"optional"> & {
|
|
6
6
|
readonly baseURL?: string;
|
|
7
7
|
readonly headers?: Record<string, string>;
|
|
8
8
|
readonly http?: HttpOptions.Input;
|
|
@@ -10,7 +10,7 @@ export type Options = ProviderAuthOption<"optional"> & {
|
|
|
10
10
|
export type Settings = ProviderPackage.Settings & {
|
|
11
11
|
readonly apiKey?: string;
|
|
12
12
|
};
|
|
13
|
-
export declare const configure: (input?:
|
|
13
|
+
export declare const configure: (input?: Config) => {
|
|
14
14
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
15
15
|
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
16
16
|
configure: typeof configure;
|
|
@@ -21,5 +21,5 @@ export declare const provider: {
|
|
|
21
21
|
configure: typeof configure;
|
|
22
22
|
};
|
|
23
23
|
export declare const decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
24
|
-
export declare const decisionModel: (modelID: string, { apiKey, baseURL, body, headers, ...providerOptions }
|
|
24
|
+
export declare const decisionModel: (modelID: string, { apiKey, baseURL, body, headers, ...providerOptions }?: Settings) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
25
25
|
export * as OpenCode from "./opencode.js";
|
|
@@ -18,5 +18,5 @@ export const configure = (input = {}) => {
|
|
|
18
18
|
};
|
|
19
19
|
export const provider = configure();
|
|
20
20
|
export const decision = provider.decision;
|
|
21
|
-
export const decisionModel = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({ apiKey, baseURL, headers, http: body === undefined ? undefined : { body } }).decision(modelID, providerOptions);
|
|
21
|
+
export const decisionModel = (modelID, { apiKey, baseURL, body, headers, ...providerOptions } = {}) => configure({ apiKey, baseURL, headers, http: body === undefined ? undefined : { body } }).decision(modelID, providerOptions);
|
|
22
22
|
export * as OpenCode from "./opencode.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { OpenResponsesProviderOptionsInput } from "../open-responses-options.js";
|
|
2
|
+
import type { OpenRouter } from "../openrouter.js";
|
|
3
|
+
export { responsesModel as model } from "../openrouter.js";
|
|
4
|
+
export type Settings = OpenRouter.Settings<OpenResponsesProviderOptionsInput>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { responsesModel as model } from "../openrouter.js";
|