@opencode/ai 2.3.1 → 2.4.0
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/decision.d.ts +4 -3
- package/dist/decision.js +3 -2
- package/dist/embedding.d.ts +4 -3
- package/dist/embedding.js +3 -2
- package/dist/experimental/cloudflare-run-extraction.js +1 -2
- package/dist/experimental/realtime.d.ts +12 -43
- package/dist/experimental/realtime.js +14 -30
- package/dist/experimental.d.ts +1 -1
- package/dist/image.js +1 -1
- package/dist/media-model.d.ts +5 -4
- package/dist/media-model.js +5 -4
- package/dist/media.js +4 -17
- package/dist/protocols/anthropic-messages.js +7 -11
- package/dist/protocols/bedrock-converse.js +6 -6
- package/dist/protocols/cohere-chat.js +3 -3
- package/dist/protocols/gemini.js +6 -10
- package/dist/protocols/google-interactions.d.ts +299 -6
- package/dist/protocols/google-interactions.js +251 -33
- package/dist/protocols/meta-messages.js +3 -3
- package/dist/protocols/minimax-video.js +7 -1
- package/dist/protocols/mistral-chat.d.ts +1 -0
- package/dist/protocols/mistral-chat.js +3 -3
- package/dist/protocols/open-responses-continuation.js +2 -0
- package/dist/protocols/open-responses.d.ts +162 -114
- package/dist/protocols/open-responses.js +12 -7
- package/dist/protocols/openai-chat.d.ts +1 -0
- package/dist/protocols/openai-chat.js +6 -5
- package/dist/protocols/openai-responses.js +2 -1
- package/dist/protocols/shared.d.ts +12 -1
- package/dist/protocols/shared.js +56 -9
- package/dist/protocols/utils/gateway-protocol.js +1 -0
- package/dist/protocols/utils/gemini-generate-content.d.ts +4 -0
- package/dist/protocols/utils/gemini-generate-content.js +5 -1
- package/dist/protocols/utils/responses-compaction.js +10 -4
- package/dist/protocols/xai-responses.d.ts +2 -1
- package/dist/protocols/xai-responses.js +4 -1
- package/dist/provider-error.js +3 -1
- package/dist/providers/alibaba.js +2 -3
- package/dist/providers/assemblyai.d.ts +2 -4
- package/dist/providers/azure.js +5 -11
- package/dist/providers/baseten.js +2 -3
- package/dist/providers/byteplus.d.ts +2 -4
- package/dist/providers/cartesia.d.ts +2 -4
- package/dist/providers/cloudflare-ai-gateway.js +3 -3
- package/dist/providers/cloudflare-workers-ai.js +2 -3
- package/dist/providers/cohere.js +2 -3
- package/dist/providers/deepgram.d.ts +2 -4
- package/dist/providers/deepinfra.js +2 -3
- package/dist/providers/digitalocean.js +3 -5
- package/dist/providers/elevenlabs.d.ts +2 -4
- package/dist/providers/fireworks.js +2 -3
- package/dist/providers/google-vertex-interactions.d.ts +12 -3
- package/dist/providers/google-vertex-interactions.js +1 -2
- package/dist/providers/google-vertex.js +6 -2
- package/dist/providers/google.d.ts +20 -3
- package/dist/providers/google.js +7 -4
- package/dist/providers/openai-compatible.js +3 -5
- package/dist/providers/openai.js +4 -10
- package/dist/providers/opencode.d.ts +2 -4
- package/dist/providers/opencode.js +2 -3
- package/dist/providers/openrouter.js +3 -5
- package/dist/providers/typesafe-ai.d.ts +2 -4
- package/dist/providers/typesafe-ai.js +2 -3
- package/dist/providers/vercel-ai-gateway.js +3 -5
- package/dist/providers/volcengine.d.ts +2 -4
- package/dist/route/decision.d.ts +4 -7
- package/dist/route/decision.js +8 -10
- package/dist/route/embedding.d.ts +4 -7
- package/dist/route/embedding.js +4 -7
- package/dist/route/executor-service.d.ts +20 -3
- package/dist/route/executor-service.js +72 -2
- package/dist/route/executor.d.ts +5 -5
- package/dist/route/executor.js +68 -73
- package/dist/route/media-protocol.d.ts +2 -1
- package/dist/route/media-protocol.js +2 -10
- package/dist/route/media.d.ts +6 -8
- package/dist/route/media.js +8 -8
- package/dist/route/protocol.d.ts +2 -0
- package/dist/route/protocol.js +4 -1
- package/dist/route/transport/http.d.ts +1 -2
- package/dist/route/transport/http.js +5 -28
- package/dist/schema/errors.js +2 -1
- package/dist/schema/options.d.ts +1 -1
- package/dist/speech.js +1 -1
- package/dist/transcription.js +1 -1
- package/dist/video.js +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { Protocol } from "../route/protocol.js";
|
|
3
|
+
import type { CompactOperation } from "../route/client.js";
|
|
3
4
|
import { OpenResponses } from "./open-responses.js";
|
|
4
5
|
declare const Options: Schema.Struct<{
|
|
5
6
|
readonly minP: Schema.optional<Schema.Number>;
|
|
@@ -289,5 +290,5 @@ export declare const protocol: Protocol<{
|
|
|
289
290
|
readonly status?: unknown;
|
|
290
291
|
readonly status_code?: unknown;
|
|
291
292
|
}, OpenResponses.ParserState>;
|
|
292
|
-
export declare const compact:
|
|
293
|
+
export declare const compact: CompactOperation;
|
|
293
294
|
export * as XAIResponses from "./xai-responses.js";
|
|
@@ -78,5 +78,8 @@ export const protocol = Protocol.make({
|
|
|
78
78
|
},
|
|
79
79
|
stream: ResponsesHostedTools.stream(adapter, HOSTED_TOOLS),
|
|
80
80
|
});
|
|
81
|
-
|
|
81
|
+
const compactFlat = ResponsesCompaction.make(adapter, (request) => OpenResponses.lowerTools(ProviderShared.flattenTools(request.tools), adapter, OpenAIFreeform.tools(request)));
|
|
82
|
+
// /compact lowers the history itself, so flatten the whole request as `Protocol.make` does before every step's body:
|
|
83
|
+
// past calls to namespaced tools then carry the same names as on those steps, and /compact reads the prefix they cached.
|
|
84
|
+
export const compact = (request, executor, options) => compactFlat(ProviderShared.flattenRequest(request), executor, options);
|
|
82
85
|
export * as XAIResponses from "./xai-responses.js";
|
package/dist/provider-error.js
CHANGED
|
@@ -107,6 +107,8 @@ const CONTENT_POLICY_CODES = new Set([
|
|
|
107
107
|
"responsibleaipolicyviolation",
|
|
108
108
|
"content_policy_violation",
|
|
109
109
|
"image_content_policy_violation",
|
|
110
|
+
// OpenAI's cybersecurity safeguard, as an HTTP 400 or a mid-stream error frame.
|
|
111
|
+
"cyber_policy",
|
|
110
112
|
"refusal",
|
|
111
113
|
"datainspectionfailed",
|
|
112
114
|
"moderation_blocked",
|
|
@@ -131,7 +133,7 @@ const QUOTA_TEXT = /insufficient[-_\s]?(?:quota|balance)|(?<!token_)quota[-_\s]?
|
|
|
131
133
|
// explanation only. OpenAI reuses `invalid_prompt` for usage-policy rejections while
|
|
132
134
|
// Bedrock Mantle reuses it for schema validation; Anthropic reports blocked output
|
|
133
135
|
// under `invalid_request_error`. The Vercel AI Gateway drops OpenAI's `moderation_blocked` code.
|
|
134
|
-
const CONTENT_POLICY_TEXT = /violating our usage policy|blocked by content filtering policy|content[-_\s]?policy|rejected (?:as a result of our|by the) safety system|detected potentially unsafe or sensitive content/i;
|
|
136
|
+
const CONTENT_POLICY_TEXT = /violating our usage policy|blocked by content filtering policy|content[-_\s]?policy|rejected (?:as a result of our|by the) safety system|detected potentially unsafe or sensitive content|rejected in accordance with our terms of use/i;
|
|
135
137
|
const SERVER_ERROR_TEXT = /\b(?:try again|(?:please |you can )?retry (?:the |this |your )?request|try (?:the |this |your )?request again|(?:currently |temporarily )?at capacity|overloaded|temporarily unavailable|service[-_\s]?unavailable|(?:server|internal)[-_\s]?error|server (?:is )?busy|provider returned (?:an )?error|resource[-_\s]?exhausted|upstream (?:connect|connection|request)|request buffer limit while retrying upstream)\b/i;
|
|
136
138
|
const Message = Schema.String.check(Schema.isPattern(/\S/));
|
|
137
139
|
const messageAt = (fields, message) => Schema.Struct(fields).pipe(Schema.decodeTo(Schema.String, {
|
|
@@ -9,7 +9,7 @@ import { Route } from "../route/client.js";
|
|
|
9
9
|
import { Endpoint } from "../route/endpoint.js";
|
|
10
10
|
import { Framing } from "../route/framing.js";
|
|
11
11
|
import { MediaRoute } from "../route/media.js";
|
|
12
|
-
import { ProviderConfigurationError, ProviderID, ToolDefinition, } from "../schema/index.js";
|
|
12
|
+
import { mergeTransport, ProviderConfigurationError, ProviderID, ToolDefinition, } from "../schema/index.js";
|
|
13
13
|
export const id = ProviderID.make("alibaba");
|
|
14
14
|
const hosts = new Map([
|
|
15
15
|
["ap-southeast-1", "dashscope-intl.aliyuncs.com"],
|
|
@@ -77,8 +77,7 @@ export const configure = (input) => {
|
|
|
77
77
|
provider: id,
|
|
78
78
|
endpoint: common.endpoint,
|
|
79
79
|
auth: opts.auth,
|
|
80
|
-
|
|
81
|
-
http: input.http,
|
|
80
|
+
...mergeTransport(input),
|
|
82
81
|
});
|
|
83
82
|
const embedding = (id, providerOptions) => embeddingRoute.model({ id, providerOptions });
|
|
84
83
|
return { id, model: chat, chat, messages, responses, image, embedding, configure };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ModelID, type TransportOptions } from "../schema/index.js";
|
|
3
3
|
export type { AssemblyAITranscriptionOptions } from "../protocols/assemblyai-transcription.js";
|
|
4
4
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
-
export type Config = ProviderAuthOption<"optional"> & {
|
|
5
|
+
export type Config = TransportOptions & ProviderAuthOption<"optional"> & {
|
|
6
6
|
/** `https://api.eu.assemblyai.com` for the EU region. */
|
|
7
7
|
readonly baseURL?: string;
|
|
8
|
-
readonly headers?: Record<string, string>;
|
|
9
|
-
readonly http?: HttpOptions;
|
|
10
8
|
};
|
|
11
9
|
export declare const configure: (input?: Config) => {
|
|
12
10
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
package/dist/providers/azure.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Auth } from "../route/auth.js";
|
|
|
2
2
|
import { AuthOptions } from "../route/auth-options.js";
|
|
3
3
|
import { Endpoint } from "../route/endpoint.js";
|
|
4
4
|
import { MediaRoute } from "../route/media.js";
|
|
5
|
-
import { ProviderConfigurationError, ProviderID, } from "../schema/index.js";
|
|
5
|
+
import { mergeTransport, ProviderConfigurationError, ProviderID, } from "../schema/index.js";
|
|
6
6
|
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
7
7
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
8
8
|
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
@@ -92,22 +92,16 @@ export const configure = (input) => {
|
|
|
92
92
|
.model({ id: modelID });
|
|
93
93
|
const image = (modelID, providerOptions) => {
|
|
94
94
|
const target = endpoint(input, modelID);
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
id: modelID,
|
|
99
|
-
provider: id,
|
|
100
|
-
providerOptions,
|
|
101
|
-
http: { ...media.http, query: { ...media.http?.query, ...target.query } },
|
|
102
|
-
});
|
|
95
|
+
const transport = mergeTransport(input, { http: { query: target.query } });
|
|
96
|
+
const media = MediaRoute.deployment({ ...transport, baseURL: target.baseURL }, auth(input));
|
|
97
|
+
return OpenAIImages.model({ ...media, id: modelID, provider: id, providerOptions });
|
|
103
98
|
};
|
|
104
99
|
const embedding = (modelID, providerOptions) => OpenAIEmbeddings.route
|
|
105
100
|
.with({
|
|
106
101
|
provider: id,
|
|
107
102
|
endpoint: endpoint(input, modelID),
|
|
108
103
|
auth: auth(input),
|
|
109
|
-
|
|
110
|
-
http: input.http,
|
|
104
|
+
...mergeTransport(input),
|
|
111
105
|
})
|
|
112
106
|
.model({ id: modelID, providerOptions });
|
|
113
107
|
return {
|
|
@@ -4,7 +4,7 @@ import { SystemOne } from "../protocols/system-one.js";
|
|
|
4
4
|
import { Route } from "../route/client.js";
|
|
5
5
|
import { DecisionRoute } from "../route/decision.js";
|
|
6
6
|
import { Endpoint } from "../route/endpoint.js";
|
|
7
|
-
import { ProviderID } from "../schema/index.js";
|
|
7
|
+
import { mergeTransport, ProviderID } from "../schema/index.js";
|
|
8
8
|
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
9
9
|
export const id = ProviderID.make("baseten");
|
|
10
10
|
const baseURL = "https://inference.baseten.co/v1";
|
|
@@ -36,8 +36,7 @@ export const configure = (input = {}) => {
|
|
|
36
36
|
protocol: decisionProtocol,
|
|
37
37
|
endpoint: Endpoint.path("/systemone", { baseURL: options.endpoint.baseURL }),
|
|
38
38
|
auth: options.auth,
|
|
39
|
-
|
|
40
|
-
http: input.http,
|
|
39
|
+
...mergeTransport(input),
|
|
41
40
|
});
|
|
42
41
|
const decision = (modelID, providerOptions) => decisionRoute.model({ id: modelID, providerOptions });
|
|
43
42
|
return {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type ModelID, type ProviderOptions, type TransportOptions } from "../schema/index.js";
|
|
4
4
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
-
export type Config = ProviderAuthOption<"optional"> & {
|
|
5
|
+
export type Config = TransportOptions & ProviderAuthOption<"optional"> & {
|
|
6
6
|
readonly baseURL?: string;
|
|
7
|
-
readonly headers?: Record<string, string>;
|
|
8
|
-
readonly http?: HttpOptions;
|
|
9
7
|
};
|
|
10
8
|
export type Settings = ProviderPackage.Settings & {
|
|
11
9
|
readonly apiKey?: string | false;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ModelID, type TransportOptions } from "../schema/index.js";
|
|
3
3
|
export type { CartesiaEncoding, CartesiaSpeechOptions } from "../protocols/cartesia-speech.js";
|
|
4
4
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
-
export type Config = ProviderAuthOption<"optional"> & {
|
|
5
|
+
export type Config = TransportOptions & ProviderAuthOption<"optional"> & {
|
|
6
6
|
readonly baseURL?: string;
|
|
7
|
-
readonly headers?: Record<string, string>;
|
|
8
|
-
readonly http?: HttpOptions;
|
|
9
7
|
};
|
|
10
8
|
export declare const configure: (input?: Config) => {
|
|
11
9
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -2,7 +2,7 @@ import { CloudflareRunDecisions } from "../protocols/cloudflare-run-decisions.js
|
|
|
2
2
|
import { AnthropicMessages, OpenAIChat, OpenAIResponses } from "../protocols/index.js";
|
|
3
3
|
import { Auth } from "../route/auth.js";
|
|
4
4
|
import { AuthOptions } from "../route/auth-options.js";
|
|
5
|
-
import { ProviderID } from "../schema/index.js";
|
|
5
|
+
import { mergeTransport, ProviderID } from "../schema/index.js";
|
|
6
6
|
import { encodeJson } from "../utils/json.js";
|
|
7
7
|
import { CloudflareShared } from "./cloudflare-shared.js";
|
|
8
8
|
export const id = ProviderID.make("cloudflare-ai-gateway");
|
|
@@ -45,6 +45,7 @@ export const configure = (input) => {
|
|
|
45
45
|
endpoint: { baseURL: baseURL(input) },
|
|
46
46
|
auth: custom ?? credential(input, (credential) => credential.bearer()),
|
|
47
47
|
headers: { "cf-aig-gateway-id": gatewayId(input), ...headers(input) },
|
|
48
|
+
timeout: input.timeout,
|
|
48
49
|
http: input.http,
|
|
49
50
|
providerOptions: input.providerOptions,
|
|
50
51
|
};
|
|
@@ -74,8 +75,7 @@ export const configure = (input) => {
|
|
|
74
75
|
provider: id,
|
|
75
76
|
endpoint: { baseURL: runBaseURL(input) },
|
|
76
77
|
auth: rest.auth,
|
|
77
|
-
headers: rest.headers,
|
|
78
|
-
http: input.http,
|
|
78
|
+
...mergeTransport(input, { headers: rest.headers }),
|
|
79
79
|
})
|
|
80
80
|
.model({ id: value, providerOptions });
|
|
81
81
|
return {
|
|
@@ -6,7 +6,7 @@ import { AuthOptions } from "../route/auth-options.js";
|
|
|
6
6
|
import { Route } from "../route/client.js";
|
|
7
7
|
import { Endpoint } from "../route/endpoint.js";
|
|
8
8
|
import { MediaRoute } from "../route/media.js";
|
|
9
|
-
import { ProviderID } from "../schema/index.js";
|
|
9
|
+
import { mergeTransport, ProviderID } from "../schema/index.js";
|
|
10
10
|
import { CloudflareShared } from "./cloudflare-shared.js";
|
|
11
11
|
export const id = ProviderID.make("cloudflare-workers-ai");
|
|
12
12
|
export const authEnvVars = ["CLOUDFLARE_API_KEY", "CLOUDFLARE_WORKERS_AI_TOKEN", "CLOUDFLARE_API_TOKEN"];
|
|
@@ -33,8 +33,7 @@ export const configure = (input) => {
|
|
|
33
33
|
provider: id,
|
|
34
34
|
endpoint: { baseURL: runBaseURL(input) },
|
|
35
35
|
auth: auth,
|
|
36
|
-
|
|
37
|
-
http: input.http,
|
|
36
|
+
...mergeTransport(input),
|
|
38
37
|
})
|
|
39
38
|
.model({ id: modelID, providerOptions });
|
|
40
39
|
return {
|
package/dist/providers/cohere.js
CHANGED
|
@@ -3,7 +3,7 @@ import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
|
3
3
|
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
4
4
|
import { Route } from "../route/client.js";
|
|
5
5
|
import { Endpoint } from "../route/endpoint.js";
|
|
6
|
-
import { ProviderID } from "../schema/index.js";
|
|
6
|
+
import { mergeTransport, ProviderID } from "../schema/index.js";
|
|
7
7
|
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
8
8
|
export const id = ProviderID.make("cohere");
|
|
9
9
|
const COMPATIBILITY_BASE_URL = "https://api.cohere.ai/compatibility/v1";
|
|
@@ -26,8 +26,7 @@ export const configure = (input = {}) => {
|
|
|
26
26
|
provider: id,
|
|
27
27
|
endpoint: compatibility.endpoint,
|
|
28
28
|
auth: options.auth,
|
|
29
|
-
|
|
30
|
-
http: input.http,
|
|
29
|
+
...mergeTransport(input),
|
|
31
30
|
});
|
|
32
31
|
return {
|
|
33
32
|
id,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ModelID, type TransportOptions } from "../schema/index.js";
|
|
3
3
|
export type { DeepgramEncoding, DeepgramSpeechOptions } from "../protocols/deepgram-speech.js";
|
|
4
4
|
export type { DeepgramTranscriptionOptions } from "../protocols/deepgram-transcription.js";
|
|
5
5
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
6
|
-
export type Config = ProviderAuthOption<"optional"> & {
|
|
6
|
+
export type Config = TransportOptions & ProviderAuthOption<"optional"> & {
|
|
7
7
|
readonly baseURL?: string;
|
|
8
|
-
readonly headers?: Record<string, string>;
|
|
9
|
-
readonly http?: HttpOptions;
|
|
10
8
|
};
|
|
11
9
|
export declare const configure: (input?: Config) => {
|
|
12
10
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -2,7 +2,7 @@ import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
|
2
2
|
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
3
3
|
import { Route } from "../route/client.js";
|
|
4
4
|
import { Endpoint } from "../route/endpoint.js";
|
|
5
|
-
import { ProviderID } from "../schema/index.js";
|
|
5
|
+
import { mergeTransport, ProviderID } from "../schema/index.js";
|
|
6
6
|
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
7
7
|
export const id = ProviderID.make("deepinfra");
|
|
8
8
|
const baseURL = "https://api.deepinfra.com/v1/openai";
|
|
@@ -28,8 +28,7 @@ export const configure = (input = {}) => {
|
|
|
28
28
|
provider: id,
|
|
29
29
|
endpoint: options.endpoint,
|
|
30
30
|
auth: options.auth,
|
|
31
|
-
|
|
32
|
-
http: input.http,
|
|
31
|
+
...mergeTransport(input),
|
|
33
32
|
});
|
|
34
33
|
return {
|
|
35
34
|
id,
|
|
@@ -8,7 +8,7 @@ import { Route } from "../route/client.js";
|
|
|
8
8
|
import { Endpoint } from "../route/endpoint.js";
|
|
9
9
|
import { MediaRoute } from "../route/media.js";
|
|
10
10
|
import { Protocol } from "../route/protocol.js";
|
|
11
|
-
import { ProviderID } from "../schema/index.js";
|
|
11
|
+
import { mergeTransport, ProviderID } from "../schema/index.js";
|
|
12
12
|
import { bearerRouteDefaults } from "./settings.js";
|
|
13
13
|
export const id = ProviderID.make("digitalocean");
|
|
14
14
|
const baseURL = "https://inference.do-ai.run/v1";
|
|
@@ -48,8 +48,7 @@ export const configure = (input = {}) => {
|
|
|
48
48
|
endpoint: options.endpoint,
|
|
49
49
|
auth: options.auth,
|
|
50
50
|
// DigitalOcean serves TypeSafe's Jev, which needs this header for images.
|
|
51
|
-
headers: { "TypeSafe-Danger-Zone-Images": "true"
|
|
52
|
-
http: input.http,
|
|
51
|
+
...mergeTransport({ headers: { "TypeSafe-Danger-Zone-Images": "true" } }, input),
|
|
53
52
|
});
|
|
54
53
|
const decision = (modelID, providerOptions) => decisionRoute.model({ id: modelID, providerOptions });
|
|
55
54
|
const media = MediaRoute.deployment({ ...input, baseURL: options.endpoint.baseURL }, options.auth);
|
|
@@ -58,8 +57,7 @@ export const configure = (input = {}) => {
|
|
|
58
57
|
provider: id,
|
|
59
58
|
endpoint: options.endpoint,
|
|
60
59
|
auth: options.auth,
|
|
61
|
-
|
|
62
|
-
http: input.http,
|
|
60
|
+
...mergeTransport(input),
|
|
63
61
|
});
|
|
64
62
|
const embedding = (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions });
|
|
65
63
|
const chat = (modelID) => configured.model({
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ModelID, type TransportOptions } from "../schema/index.js";
|
|
3
3
|
export type { ElevenLabsOutputFormat, ElevenLabsSpeechOptions } from "../protocols/elevenlabs-speech.js";
|
|
4
4
|
export type { ElevenLabsTranscriptionOptions } from "../protocols/elevenlabs-transcription.js";
|
|
5
5
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
6
|
-
export type Config = ProviderAuthOption<"optional"> & {
|
|
6
|
+
export type Config = TransportOptions & ProviderAuthOption<"optional"> & {
|
|
7
7
|
readonly baseURL?: string;
|
|
8
|
-
readonly headers?: Record<string, string>;
|
|
9
|
-
readonly http?: HttpOptions;
|
|
10
8
|
};
|
|
11
9
|
export declare const configure: (input?: Config) => {
|
|
12
10
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -2,7 +2,7 @@ import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
|
2
2
|
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
3
3
|
import { Route } from "../route/client.js";
|
|
4
4
|
import { Endpoint } from "../route/endpoint.js";
|
|
5
|
-
import { ProviderID } from "../schema/index.js";
|
|
5
|
+
import { mergeTransport, ProviderID } from "../schema/index.js";
|
|
6
6
|
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
7
7
|
export const id = ProviderID.make("fireworks");
|
|
8
8
|
const baseURL = "https://api.fireworks.ai/inference/v1";
|
|
@@ -22,8 +22,7 @@ export const configure = (input = {}) => {
|
|
|
22
22
|
provider: id,
|
|
23
23
|
endpoint: options.endpoint,
|
|
24
24
|
auth: options.auth,
|
|
25
|
-
|
|
26
|
-
http: input.http,
|
|
25
|
+
...mergeTransport(input),
|
|
27
26
|
});
|
|
28
27
|
return {
|
|
29
28
|
id,
|
|
@@ -24,7 +24,7 @@ export type Settings = ProviderPackage.Settings & GoogleInteractions.ProviderOpt
|
|
|
24
24
|
};
|
|
25
25
|
export declare const routes: Route<{
|
|
26
26
|
readonly model: string;
|
|
27
|
-
readonly input
|
|
27
|
+
readonly input?: readonly ({
|
|
28
28
|
readonly type: "model_output" | "user_input";
|
|
29
29
|
readonly content: readonly ({
|
|
30
30
|
readonly type: "text";
|
|
@@ -54,12 +54,17 @@ export declare const routes: Route<{
|
|
|
54
54
|
readonly name: string;
|
|
55
55
|
readonly result: unknown;
|
|
56
56
|
readonly is_error?: boolean | undefined;
|
|
57
|
-
})[];
|
|
57
|
+
})[] | undefined;
|
|
58
58
|
readonly stream: true;
|
|
59
59
|
readonly store: boolean;
|
|
60
60
|
readonly previous_interaction_id?: string | undefined;
|
|
61
|
+
readonly continuation_token?: string | undefined;
|
|
61
62
|
readonly system_instruction?: string | undefined;
|
|
62
63
|
readonly service_tier?: string | undefined;
|
|
64
|
+
readonly safety_settings?: readonly {
|
|
65
|
+
readonly type: string;
|
|
66
|
+
readonly threshold: string;
|
|
67
|
+
}[] | undefined;
|
|
63
68
|
readonly tools?: readonly {
|
|
64
69
|
readonly type: "function";
|
|
65
70
|
readonly name: string;
|
|
@@ -83,7 +88,7 @@ export declare const routes: Route<{
|
|
|
83
88
|
};
|
|
84
89
|
} | undefined;
|
|
85
90
|
};
|
|
86
|
-
},
|
|
91
|
+
}, GoogleInteractions.Prepared, import("../route/client.js").CompactionOperations | undefined>[];
|
|
87
92
|
export declare const configure: (input?: Config) => {
|
|
88
93
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
89
94
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
@@ -92,6 +97,10 @@ export declare const configure: (input?: Config) => {
|
|
|
92
97
|
readonly thinkingLevel?: import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal"> | undefined;
|
|
93
98
|
readonly thinkingSummaries?: import("../schema/options.js").OpenString<"auto" | "none"> | undefined;
|
|
94
99
|
readonly serviceTier?: import("../schema/options.js").OpenString<"deferred" | "flex" | "priority" | "standard"> | undefined;
|
|
100
|
+
readonly safetySettings?: readonly {
|
|
101
|
+
readonly category: import("../schema/options.js").OpenString<"HARM_CATEGORY_CIVIC_INTEGRITY" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_UNSPECIFIED">;
|
|
102
|
+
readonly threshold: import("../schema/options.js").OpenString<"BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_NONE" | "BLOCK_ONLY_HIGH" | "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "OFF">;
|
|
103
|
+
}[] | undefined;
|
|
95
104
|
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
96
105
|
configure: typeof configure;
|
|
97
106
|
};
|
|
@@ -2,7 +2,6 @@ import { GoogleInteractions } from "../protocols/google-interactions.js";
|
|
|
2
2
|
import { Auth } from "../route/auth.js";
|
|
3
3
|
import { Route } from "../route/client.js";
|
|
4
4
|
import { Endpoint } from "../route/endpoint.js";
|
|
5
|
-
import { Framing } from "../route/framing.js";
|
|
6
5
|
import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
|
|
7
6
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
8
7
|
export const id = ProviderID.make("google-vertex");
|
|
@@ -17,7 +16,7 @@ const route = Route.make({
|
|
|
17
16
|
const serviceTier = request.providerOptions?.serviceTier;
|
|
18
17
|
return typeof serviceTier === "string" ? { "x-vertex-ai-llm-shared-request-type": serviceTier } : {};
|
|
19
18
|
},
|
|
20
|
-
|
|
19
|
+
transport: GoogleInteractions.transport,
|
|
21
20
|
});
|
|
22
21
|
export const routes = [route];
|
|
23
22
|
const configuredRoute = (input) => {
|
|
@@ -9,7 +9,7 @@ import { Route } from "../route/client.js";
|
|
|
9
9
|
import { EmbeddingRoute } from "../route/embedding.js";
|
|
10
10
|
import { Endpoint } from "../route/endpoint.js";
|
|
11
11
|
import { MediaRoute } from "../route/media.js";
|
|
12
|
-
import { ProviderConfigurationError, ProviderID, } from "../schema/index.js";
|
|
12
|
+
import { mergeTransport, ProviderConfigurationError, ProviderID, } from "../schema/index.js";
|
|
13
13
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
14
14
|
export const id = ProviderID.make("google-vertex");
|
|
15
15
|
const fromRequest = Effect.fn("GoogleVertex.fromRequest")(function* (request) {
|
|
@@ -121,7 +121,11 @@ export const configure = (input = {}) => {
|
|
|
121
121
|
message: "Google Vertex embedContent does not support Express Mode API keys; use project credentials",
|
|
122
122
|
});
|
|
123
123
|
return selected.route
|
|
124
|
-
.with({
|
|
124
|
+
.with({
|
|
125
|
+
endpoint: target.endpoint,
|
|
126
|
+
auth: target.auth,
|
|
127
|
+
...mergeTransport(input),
|
|
128
|
+
})
|
|
125
129
|
.model({ id: modelID, providerOptions });
|
|
126
130
|
},
|
|
127
131
|
configure,
|
|
@@ -102,7 +102,7 @@ export declare const routes: (import("../route.js").Route<{
|
|
|
102
102
|
readonly continuationToken?: string | undefined;
|
|
103
103
|
}, Gemini.Prepared, import("../route.js").CompactionOperations | undefined> | import("../route.js").Route<{
|
|
104
104
|
readonly model: string;
|
|
105
|
-
readonly input
|
|
105
|
+
readonly input?: readonly ({
|
|
106
106
|
readonly type: "model_output" | "user_input";
|
|
107
107
|
readonly content: readonly ({
|
|
108
108
|
readonly type: "text";
|
|
@@ -132,12 +132,17 @@ export declare const routes: (import("../route.js").Route<{
|
|
|
132
132
|
readonly name: string;
|
|
133
133
|
readonly result: unknown;
|
|
134
134
|
readonly is_error?: boolean | undefined;
|
|
135
|
-
})[];
|
|
135
|
+
})[] | undefined;
|
|
136
136
|
readonly stream: true;
|
|
137
137
|
readonly store: boolean;
|
|
138
138
|
readonly previous_interaction_id?: string | undefined;
|
|
139
|
+
readonly continuation_token?: string | undefined;
|
|
139
140
|
readonly system_instruction?: string | undefined;
|
|
140
141
|
readonly service_tier?: string | undefined;
|
|
142
|
+
readonly safety_settings?: readonly {
|
|
143
|
+
readonly type: string;
|
|
144
|
+
readonly threshold: string;
|
|
145
|
+
}[] | undefined;
|
|
141
146
|
readonly tools?: readonly {
|
|
142
147
|
readonly type: "function";
|
|
143
148
|
readonly name: string;
|
|
@@ -161,7 +166,7 @@ export declare const routes: (import("../route.js").Route<{
|
|
|
161
166
|
};
|
|
162
167
|
} | undefined;
|
|
163
168
|
};
|
|
164
|
-
},
|
|
169
|
+
}, GoogleInteractions.Prepared, import("../route.js").CompactionOperations | undefined>)[];
|
|
165
170
|
export type Config = RequestOptions & ProviderAuthOption<"optional"> & {
|
|
166
171
|
readonly baseURL?: string;
|
|
167
172
|
readonly providerOptions?: Gemini.ProviderOptionsInput & GoogleInteractions.ProviderOptionsInput;
|
|
@@ -180,6 +185,10 @@ export declare const configure: (input?: Config) => {
|
|
|
180
185
|
readonly thinkingLevel?: import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal"> | undefined;
|
|
181
186
|
readonly thinkingSummaries?: import("../schema/options.js").OpenString<"auto" | "none"> | undefined;
|
|
182
187
|
readonly serviceTier?: import("../schema/options.js").OpenString<"deferred" | "flex" | "priority" | "standard"> | undefined;
|
|
188
|
+
readonly safetySettings?: readonly {
|
|
189
|
+
readonly category: import("../schema/options.js").OpenString<"HARM_CATEGORY_CIVIC_INTEGRITY" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_UNSPECIFIED">;
|
|
190
|
+
readonly threshold: import("../schema/options.js").OpenString<"BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_NONE" | "BLOCK_ONLY_HIGH" | "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "OFF">;
|
|
191
|
+
}[] | undefined;
|
|
183
192
|
}, import("../route.js").CompactionOperations | undefined>;
|
|
184
193
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
185
194
|
video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/google-interactions-video.js").GoogleVideoOptions>;
|
|
@@ -199,6 +208,10 @@ export declare const provider: {
|
|
|
199
208
|
readonly thinkingLevel?: import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal"> | undefined;
|
|
200
209
|
readonly thinkingSummaries?: import("../schema/options.js").OpenString<"auto" | "none"> | undefined;
|
|
201
210
|
readonly serviceTier?: import("../schema/options.js").OpenString<"deferred" | "flex" | "priority" | "standard"> | undefined;
|
|
211
|
+
readonly safetySettings?: readonly {
|
|
212
|
+
readonly category: import("../schema/options.js").OpenString<"HARM_CATEGORY_CIVIC_INTEGRITY" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_UNSPECIFIED">;
|
|
213
|
+
readonly threshold: import("../schema/options.js").OpenString<"BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_NONE" | "BLOCK_ONLY_HIGH" | "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "OFF">;
|
|
214
|
+
}[] | undefined;
|
|
202
215
|
}, import("../route.js").CompactionOperations | undefined>;
|
|
203
216
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
204
217
|
video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/google-interactions-video.js").GoogleVideoOptions>;
|
|
@@ -223,6 +236,10 @@ export declare const interactions: (modelID: string | ModelID) => import("../sch
|
|
|
223
236
|
readonly thinkingLevel?: import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal"> | undefined;
|
|
224
237
|
readonly thinkingSummaries?: import("../schema/options.js").OpenString<"auto" | "none"> | undefined;
|
|
225
238
|
readonly serviceTier?: import("../schema/options.js").OpenString<"deferred" | "flex" | "priority" | "standard"> | undefined;
|
|
239
|
+
readonly safetySettings?: readonly {
|
|
240
|
+
readonly category: import("../schema/options.js").OpenString<"HARM_CATEGORY_CIVIC_INTEGRITY" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_UNSPECIFIED">;
|
|
241
|
+
readonly threshold: import("../schema/options.js").OpenString<"BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_NONE" | "BLOCK_ONLY_HIGH" | "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "OFF">;
|
|
242
|
+
}[] | undefined;
|
|
226
243
|
}, import("../route.js").CompactionOperations | undefined>;
|
|
227
244
|
export declare const speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/google-speech.js").GoogleSpeechOptions>;
|
|
228
245
|
export declare const transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/google-transcription.js").GoogleTranscriptionOptions>;
|
package/dist/providers/google.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Auth } from "../route/auth.js";
|
|
2
2
|
import { AuthOptions } from "../route/auth-options.js";
|
|
3
3
|
import { MediaRoute } from "../route/media.js";
|
|
4
|
-
import { ProviderID } from "../schema/index.js";
|
|
4
|
+
import { mergeTransport, ProviderID } from "../schema/index.js";
|
|
5
5
|
import { Gemini } from "../protocols/gemini.js";
|
|
6
6
|
import { GoogleEmbedContent, } from "../protocols/google-embed-content.js";
|
|
7
7
|
import { GoogleDecisions } from "../protocols/google-decisions.js";
|
|
@@ -30,8 +30,7 @@ export const configure = (input = {}) => {
|
|
|
30
30
|
provider: id,
|
|
31
31
|
endpoint: { baseURL: input.baseURL },
|
|
32
32
|
auth: auth(input),
|
|
33
|
-
|
|
34
|
-
http: input.http,
|
|
33
|
+
...mergeTransport(input),
|
|
35
34
|
});
|
|
36
35
|
return {
|
|
37
36
|
id,
|
|
@@ -44,7 +43,11 @@ export const configure = (input = {}) => {
|
|
|
44
43
|
transcription: (modelID) => GoogleTranscription.model({ ...media, id: modelID }),
|
|
45
44
|
embedding: (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions }),
|
|
46
45
|
decision: (modelID, providerOptions) => GoogleDecisions.route
|
|
47
|
-
.with({
|
|
46
|
+
.with({
|
|
47
|
+
endpoint: { baseURL: media.baseURL },
|
|
48
|
+
auth: media.auth,
|
|
49
|
+
...media.transport,
|
|
50
|
+
})
|
|
48
51
|
.model({ id: modelID, providerOptions }),
|
|
49
52
|
configure,
|
|
50
53
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeProviderOptions, ProviderID, } from "../schema/index.js";
|
|
1
|
+
import { mergeTransport, mergeProviderOptions, ProviderID, } from "../schema/index.js";
|
|
2
2
|
import { OpenAICompatibleChat } from "../protocols/openai-compatible-chat.js";
|
|
3
3
|
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
4
4
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
@@ -23,15 +23,13 @@ export const configure = (input) => {
|
|
|
23
23
|
provider,
|
|
24
24
|
endpoint: { baseURL },
|
|
25
25
|
auth,
|
|
26
|
-
|
|
27
|
-
http: input.http,
|
|
26
|
+
...mergeTransport(input),
|
|
28
27
|
});
|
|
29
28
|
const decisionRoute = SystemOne.route.with({
|
|
30
29
|
provider,
|
|
31
30
|
endpoint: { baseURL },
|
|
32
31
|
auth,
|
|
33
|
-
|
|
34
|
-
http: input.http,
|
|
32
|
+
...mergeTransport(input),
|
|
35
33
|
});
|
|
36
34
|
return {
|
|
37
35
|
id: ProviderID.make(provider),
|
package/dist/providers/openai.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuthOptions } from "../route/auth-options.js";
|
|
2
2
|
import { MediaRoute } from "../route/media.js";
|
|
3
|
-
import { ProviderID, ToolDefinition, } from "../schema/index.js";
|
|
3
|
+
import { mergeTransport, ProviderID, ToolDefinition, } from "../schema/index.js";
|
|
4
4
|
import * as OpenAIChat from "../protocols/openai-chat.js";
|
|
5
5
|
import * as OpenAIResponses from "../protocols/openai-responses.js";
|
|
6
6
|
import { withOpenAIOptions } from "./openai-options.js";
|
|
@@ -47,11 +47,7 @@ export const configure = (input = {}) => {
|
|
|
47
47
|
id,
|
|
48
48
|
capabilities: { promptCacheKey: true },
|
|
49
49
|
});
|
|
50
|
-
const
|
|
51
|
-
const media = {
|
|
52
|
-
...deployment,
|
|
53
|
-
http: { ...deployment.http, query: { ...deployment.http?.query, ...input.queryParams } },
|
|
54
|
-
};
|
|
50
|
+
const media = MediaRoute.deployment({ ...mergeTransport(input, { http: { query: input.queryParams } }), baseURL: input.baseURL }, auth(input));
|
|
55
51
|
// The ChatGPT backend (ChatGPT sign-in) rejects multipart image edits with "Unsupported content type".
|
|
56
52
|
const imageInput = media.baseURL?.startsWith("https://chatgpt.com/") ? "json-edits" : undefined;
|
|
57
53
|
const image = (modelID, providerOptions) => OpenAIImages.model({ ...media, id: modelID, providerOptions, imageInput });
|
|
@@ -60,15 +56,13 @@ export const configure = (input = {}) => {
|
|
|
60
56
|
const decisionRoute = OpenAIDecisions.route.with({
|
|
61
57
|
endpoint: { baseURL: media.baseURL },
|
|
62
58
|
auth: media.auth,
|
|
63
|
-
|
|
64
|
-
http: media.http,
|
|
59
|
+
...media.transport,
|
|
65
60
|
});
|
|
66
61
|
const decision = (modelID, providerOptions) => decisionRoute.model({ id: modelID, providerOptions });
|
|
67
62
|
const embeddingRoute = OpenAIEmbeddings.route.with({
|
|
68
63
|
endpoint: { baseURL: media.baseURL },
|
|
69
64
|
auth: media.auth,
|
|
70
|
-
|
|
71
|
-
http: media.http,
|
|
65
|
+
...media.transport,
|
|
72
66
|
});
|
|
73
67
|
const embedding = (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions });
|
|
74
68
|
return {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ModelID, type ProviderOptions, type TransportOptions } from "../schema/index.js";
|
|
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 Config = ProviderAuthOption<"optional"> & {
|
|
5
|
+
export type Config = TransportOptions & ProviderAuthOption<"optional"> & {
|
|
6
6
|
readonly baseURL?: string;
|
|
7
|
-
readonly headers?: Record<string, string>;
|
|
8
|
-
readonly http?: HttpOptions;
|
|
9
7
|
};
|
|
10
8
|
export type Settings = ProviderPackage.Settings & {
|
|
11
9
|
readonly apiKey?: string | false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProviderID } from "../schema/index.js";
|
|
1
|
+
import { mergeTransport, ProviderID, } from "../schema/index.js";
|
|
2
2
|
import { AuthOptions } from "../route/auth-options.js";
|
|
3
3
|
import { SystemOne } from "../protocols/system-one.js";
|
|
4
4
|
import { toConfig } from "./settings.js";
|
|
@@ -11,8 +11,7 @@ export const configure = (input = {}) => {
|
|
|
11
11
|
endpoint: { baseURL: input.baseURL ?? baseURL },
|
|
12
12
|
auth: AuthOptions.bearer(input, "OPENCODE_API_KEY"),
|
|
13
13
|
// Zen forwards TypeSafe's image opt-in header; text-only requests are unchanged with it.
|
|
14
|
-
headers: { "TypeSafe-Danger-Zone-Images": "true"
|
|
15
|
-
http: input.http,
|
|
14
|
+
...mergeTransport({ headers: { "TypeSafe-Danger-Zone-Images": "true" } }, input),
|
|
16
15
|
});
|
|
17
16
|
const decision = (modelID, providerOptions) => route.model({ id: modelID, providerOptions });
|
|
18
17
|
return { id, decision, configure };
|