@opencode/ai 0.0.0-dev-20122 → 0.0.0-dev-20124
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/experimental/evaluation.js +1 -1
- package/dist/generation.d.ts +1 -7
- package/dist/generation.js +1 -11
- package/dist/image.d.ts +2 -2
- package/dist/image.js +2 -2
- package/dist/llm.js +1 -1
- package/dist/media-model.d.ts +0 -2
- package/dist/media-model.js +0 -2
- package/dist/protocols/alibaba-messages.d.ts +1 -1
- package/dist/protocols/anthropic-messages.d.ts +34 -34
- package/dist/protocols/assemblyai-transcription.d.ts +2 -1
- package/dist/protocols/assemblyai-transcription.js +10 -14
- package/dist/protocols/bfl-images.js +15 -31
- package/dist/protocols/cartesia-speech.d.ts +2 -2
- package/dist/protocols/cartesia-speech.js +10 -16
- package/dist/protocols/deepgram-speech.d.ts +3 -3
- package/dist/protocols/deepgram-speech.js +7 -11
- package/dist/protocols/deepgram-transcription.d.ts +2 -1
- package/dist/protocols/deepgram-transcription.js +9 -13
- package/dist/protocols/elevenlabs-speech.d.ts +3 -3
- package/dist/protocols/elevenlabs-speech.js +9 -13
- package/dist/protocols/fal-images.d.ts +2 -1
- package/dist/protocols/fal-images.js +16 -29
- package/dist/protocols/fal-video.d.ts +2 -2
- package/dist/protocols/fal-video.js +9 -24
- package/dist/protocols/gemini.d.ts +13 -13
- package/dist/protocols/google-images.d.ts +3 -3
- package/dist/protocols/google-images.js +11 -21
- package/dist/protocols/google-speech.js +7 -13
- package/dist/protocols/google-transcription.d.ts +2 -1
- package/dist/protocols/google-transcription.js +8 -20
- package/dist/protocols/google-video.d.ts +2 -2
- package/dist/protocols/google-video.js +14 -30
- package/dist/protocols/meta-images.d.ts +3 -4
- package/dist/protocols/meta-images.js +12 -21
- package/dist/protocols/meta-messages.d.ts +5 -5
- package/dist/protocols/meta-responses.js +5 -2
- package/dist/protocols/openai-images.d.ts +4 -5
- package/dist/protocols/openai-images.js +24 -55
- package/dist/protocols/openai-responses.js +8 -2
- package/dist/protocols/openai-speech.js +7 -11
- package/dist/protocols/openai-transcription.js +21 -29
- package/dist/protocols/replicate-images.js +11 -17
- package/dist/protocols/runway-video.d.ts +3 -3
- package/dist/protocols/runway-video.js +10 -16
- package/dist/protocols/shared.d.ts +5 -17
- package/dist/protocols/shared.js +3 -39
- package/dist/protocols/stability-images.d.ts +2 -1
- package/dist/protocols/stability-images.js +24 -36
- package/dist/protocols/utils/fal-queue.d.ts +1 -3
- package/dist/protocols/utils/fal-queue.js +4 -6
- package/dist/protocols/utils/media-input.d.ts +15 -1
- package/dist/protocols/utils/media-input.js +22 -0
- package/dist/protocols/utils/speech-stream.d.ts +3 -3
- package/dist/protocols/utils/speech-stream.js +1 -4
- package/dist/protocols/xai-images.d.ts +4 -4
- package/dist/protocols/xai-images.js +12 -28
- package/dist/protocols/xai-video.js +12 -18
- package/dist/protocols/zai-images.d.ts +2 -2
- package/dist/protocols/zai-images.js +8 -11
- package/dist/protocols/zai-messages.d.ts +1 -1
- package/dist/providers/alibaba.d.ts +1 -1
- package/dist/providers/anthropic-compatible.d.ts +5 -5
- package/dist/providers/anthropic.d.ts +5 -5
- package/dist/providers/assemblyai.d.ts +1 -1
- package/dist/providers/assemblyai.js +5 -10
- package/dist/providers/azure.js +2 -2
- package/dist/providers/black-forest-labs.d.ts +1 -1
- package/dist/providers/black-forest-labs.js +5 -10
- package/dist/providers/cartesia.d.ts +1 -1
- package/dist/providers/cartesia.js +5 -10
- package/dist/providers/cloudflare-ai-gateway.d.ts +10 -10
- package/dist/providers/deepgram.d.ts +1 -1
- package/dist/providers/deepgram.js +6 -12
- package/dist/providers/elevenlabs.d.ts +1 -1
- package/dist/providers/elevenlabs.js +5 -10
- package/dist/providers/fal.d.ts +1 -1
- package/dist/providers/fal.js +5 -12
- package/dist/providers/google-vertex-messages.d.ts +5 -5
- package/dist/providers/google-vertex.d.ts +3 -3
- package/dist/providers/google.d.ts +3 -3
- package/dist/providers/google.js +7 -12
- package/dist/providers/meta.d.ts +8 -8
- package/dist/providers/meta.js +4 -8
- package/dist/providers/minimax.d.ts +5 -5
- package/dist/providers/moonshot.d.ts +5 -5
- package/dist/providers/openai.d.ts +7 -8
- package/dist/providers/openai.js +10 -11
- package/dist/providers/opencode-zen.js +1 -1
- package/dist/providers/openrouter.d.ts +6 -7
- package/dist/providers/openrouter.js +1 -1
- package/dist/providers/replicate.d.ts +1 -1
- package/dist/providers/replicate.js +5 -10
- package/dist/providers/runway.d.ts +1 -1
- package/dist/providers/runway.js +5 -10
- package/dist/providers/stability.d.ts +1 -1
- package/dist/providers/stability.js +6 -11
- package/dist/providers/typesafe-ai.js +1 -1
- package/dist/providers/vercel-ai-gateway.js +1 -1
- package/dist/providers/xai.js +5 -10
- package/dist/providers/zai-coding-plan.d.ts +1 -1
- package/dist/providers/zai.js +4 -8
- package/dist/route/client.d.ts +0 -1
- package/dist/route/client.js +1 -6
- package/dist/route/endpoint.d.ts +1 -0
- package/dist/route/endpoint.js +2 -2
- package/dist/route/framing.d.ts +10 -1
- package/dist/route/framing.js +45 -5
- package/dist/route/media-protocol.d.ts +42 -35
- package/dist/route/media-protocol.js +67 -62
- package/dist/route/media.d.ts +6 -2
- package/dist/route/media.js +40 -29
- package/dist/schema/options.d.ts +6 -3
- package/dist/schema/options.js +7 -3
- package/dist/speech.d.ts +2 -2
- package/dist/speech.js +2 -2
- package/dist/transcription.js +2 -2
- package/dist/utils/json.d.ts +4 -0
- package/dist/utils/json.js +4 -0
- package/dist/video.d.ts +2 -2
- package/dist/video.js +2 -2
- package/package.json +3 -3
- package/dist/protocols/utils/meta-image.d.ts +0 -2
- package/dist/protocols/utils/meta-image.js +0 -13
- package/dist/protocols/utils/openai-image.d.ts +0 -5
- package/dist/protocols/utils/openai-image.js +0 -18
|
@@ -3,10 +3,8 @@ import { ImageModel, ImageResponse } from "../image.js";
|
|
|
3
3
|
import { Media } from "../media.js";
|
|
4
4
|
import { MediaProtocol } from "../route/media-protocol.js";
|
|
5
5
|
import { MediaRoute } from "../route/media.js";
|
|
6
|
-
import {
|
|
7
|
-
const
|
|
8
|
-
const NAME = "Z.ai Images";
|
|
9
|
-
const PROVIDER = ProviderID.make("zai");
|
|
6
|
+
import { mergeJsonRecords } from "../schema/index.js";
|
|
7
|
+
const route = MediaProtocol.identity({ id: "zai-images", name: "Z.ai Images", provider: "zai" });
|
|
10
8
|
export const DEFAULT_BASE_URL = "https://api.z.ai/api/paas/v4";
|
|
11
9
|
export const PATH = "/images/generations";
|
|
12
10
|
// ---------------------------------------------------------------------------
|
|
@@ -37,11 +35,12 @@ const fromRequest = Effect.fn("ZAIImages.fromRequest")(function* (request) {
|
|
|
37
35
|
// ---------------------------------------------------------------------------
|
|
38
36
|
// 6. Response decoding
|
|
39
37
|
// ---------------------------------------------------------------------------
|
|
38
|
+
const decodeDocument = route.decodeJson(ZAIImageResponse);
|
|
40
39
|
const decodeResponse = Effect.fn("ZAIImages.decodeResponse")(function* (response) {
|
|
41
|
-
const output = yield*
|
|
40
|
+
const output = yield* decodeDocument(response);
|
|
42
41
|
const decoded = output.value;
|
|
43
42
|
if (decoded.data.length === 0)
|
|
44
|
-
return yield* output.invalid(`${
|
|
43
|
+
return yield* output.invalid(`${route.name} returned no images`);
|
|
45
44
|
const filters = decoded.content_filter ?? [];
|
|
46
45
|
return new ImageResponse({
|
|
47
46
|
// Z.ai returns only URLs and no content type; the media type resolves when the asset is materialized.
|
|
@@ -51,7 +50,7 @@ const decodeResponse = Effect.fn("ZAIImages.decodeResponse")(function* (response
|
|
|
51
50
|
? undefined
|
|
52
51
|
: filters.map((filter) => ({
|
|
53
52
|
type: "moderated",
|
|
54
|
-
message: `${
|
|
53
|
+
message: `${route.name} applied a content filter${filter.role === undefined ? "" : ` for ${filter.role}`}${filter.level === undefined ? "" : ` at level ${filter.level}`}`,
|
|
55
54
|
providerMetadata: { zai: filter },
|
|
56
55
|
})),
|
|
57
56
|
providerMetadata: {
|
|
@@ -67,14 +66,12 @@ const decodeResponse = Effect.fn("ZAIImages.decodeResponse")(function* (response
|
|
|
67
66
|
// ---------------------------------------------------------------------------
|
|
68
67
|
// 7. Protocol and route
|
|
69
68
|
// ---------------------------------------------------------------------------
|
|
70
|
-
export const protocol = MediaProtocol.inline({
|
|
71
|
-
id: ADAPTER,
|
|
72
|
-
name: NAME,
|
|
69
|
+
export const protocol = MediaProtocol.inline(route, {
|
|
73
70
|
unsupported: ["images", "mask", "n", "aspectRatio", "seed", "format"],
|
|
74
71
|
body: { from: fromRequest },
|
|
75
72
|
response: { decode: decodeResponse },
|
|
76
73
|
});
|
|
77
|
-
export const model = (input) => ImageModel.fromRoute({
|
|
74
|
+
export const model = (input) => ImageModel.fromRoute({ protocol, baseURL: DEFAULT_BASE_URL, path: PATH }, input);
|
|
78
75
|
export const ZAIImages = {
|
|
79
76
|
protocol,
|
|
80
77
|
model,
|
|
@@ -222,7 +222,7 @@ export declare const protocol: Protocol<{
|
|
|
222
222
|
readonly thinking?: {
|
|
223
223
|
readonly type: string;
|
|
224
224
|
} | undefined;
|
|
225
|
-
readonly service_tier?: "auto" |
|
|
225
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
226
226
|
readonly container?: string | {
|
|
227
227
|
readonly id?: string | null | undefined;
|
|
228
228
|
readonly skills?: readonly {
|
|
@@ -372,7 +372,7 @@ export declare const routes: (Route<{
|
|
|
372
372
|
readonly type: string;
|
|
373
373
|
readonly budget_tokens?: number | undefined;
|
|
374
374
|
} | undefined;
|
|
375
|
-
readonly service_tier?: "auto" |
|
|
375
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
376
376
|
readonly container?: string | {
|
|
377
377
|
readonly id?: string | null | undefined;
|
|
378
378
|
readonly skills?: readonly {
|
|
@@ -238,20 +238,20 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
238
238
|
readonly thinking?: {
|
|
239
239
|
readonly type: "enabled";
|
|
240
240
|
readonly budget_tokens: number;
|
|
241
|
-
readonly display?: (
|
|
241
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
242
242
|
readonly block_binding?: {
|
|
243
|
-
readonly prefix_mismatch_behavior?: (
|
|
243
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
244
244
|
} | undefined;
|
|
245
245
|
} | {
|
|
246
246
|
readonly type: "adaptive";
|
|
247
|
-
readonly display?: (
|
|
247
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
248
248
|
readonly block_binding?: {
|
|
249
|
-
readonly prefix_mismatch_behavior?: (
|
|
249
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
250
250
|
} | undefined;
|
|
251
251
|
} | {
|
|
252
252
|
readonly type: "disabled";
|
|
253
253
|
} | undefined;
|
|
254
|
-
readonly service_tier?: "auto" |
|
|
254
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
255
255
|
readonly container?: string | {
|
|
256
256
|
readonly id?: string | null | undefined;
|
|
257
257
|
readonly skills?: readonly {
|
|
@@ -223,20 +223,20 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
223
223
|
readonly thinking?: {
|
|
224
224
|
readonly type: "enabled";
|
|
225
225
|
readonly budget_tokens: number;
|
|
226
|
-
readonly display?: (
|
|
226
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
227
227
|
readonly block_binding?: {
|
|
228
|
-
readonly prefix_mismatch_behavior?: (
|
|
228
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
229
229
|
} | undefined;
|
|
230
230
|
} | {
|
|
231
231
|
readonly type: "adaptive";
|
|
232
|
-
readonly display?: (
|
|
232
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
233
233
|
readonly block_binding?: {
|
|
234
|
-
readonly prefix_mismatch_behavior?: (
|
|
234
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
235
235
|
} | undefined;
|
|
236
236
|
} | {
|
|
237
237
|
readonly type: "disabled";
|
|
238
238
|
} | undefined;
|
|
239
|
-
readonly service_tier?: "auto" |
|
|
239
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
240
240
|
readonly container?: string | {
|
|
241
241
|
readonly id?: string | null | undefined;
|
|
242
242
|
readonly skills?: readonly {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
-
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
2
|
+
import { type HttpOptions, type ModelID } 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
5
|
export type Config = ProviderAuthOption<"optional"> & {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Auth } from "../route/auth.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { MediaRoute } from "../route/media.js";
|
|
3
|
+
import { ProviderID } from "../schema/index.js";
|
|
4
|
+
import { AssemblyAITranscription } from "../protocols/assemblyai-transcription.js";
|
|
4
5
|
export const id = ProviderID.make("assemblyai");
|
|
5
|
-
const baseURL = DEFAULT_BASE_URL;
|
|
6
6
|
// The key is the whole `authorization` value, without a scheme.
|
|
7
7
|
const auth = (options) => {
|
|
8
8
|
if ("auth" in options && options.auth)
|
|
@@ -12,13 +12,8 @@ const auth = (options) => {
|
|
|
12
12
|
.pipe(Auth.header("authorization"));
|
|
13
13
|
};
|
|
14
14
|
export const configure = (input = {}) => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
auth: auth(input),
|
|
18
|
-
baseURL: input.baseURL ?? baseURL,
|
|
19
|
-
headers: input.headers,
|
|
20
|
-
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
21
|
-
});
|
|
15
|
+
const media = MediaRoute.deployment(input, auth(input));
|
|
16
|
+
const transcription = (modelID) => AssemblyAITranscription.model({ ...media, id: modelID });
|
|
22
17
|
return {
|
|
23
18
|
id,
|
|
24
19
|
transcription,
|
package/dist/providers/azure.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Auth } from "../route/auth.js";
|
|
2
2
|
import {} from "../route/auth-options.js";
|
|
3
|
+
import { Endpoint } from "../route/endpoint.js";
|
|
3
4
|
import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
|
|
4
5
|
import * as OpenAIChat from "../protocols/openai-chat.js";
|
|
5
6
|
import * as OpenAIResponses from "../protocols/openai-responses.js";
|
|
6
|
-
import { ProviderShared } from "../protocols/shared.js";
|
|
7
7
|
import { withOpenAIOptions } from "./openai-options.js";
|
|
8
8
|
export const id = ProviderID.make("azure");
|
|
9
9
|
const routeAuth = Auth.remove("authorization");
|
|
@@ -58,7 +58,7 @@ const configuredRoute = (route, input, modelID) => route.with({
|
|
|
58
58
|
endpoint: endpoint(input, modelID),
|
|
59
59
|
});
|
|
60
60
|
function endpoint(input, modelID) {
|
|
61
|
-
const baseURL =
|
|
61
|
+
const baseURL = Endpoint.trimBaseUrl(input.baseURL ?? resourceBaseURL(input.resourceName));
|
|
62
62
|
const query = { "api-version": input.apiVersion ?? "v1", ...input.queryParams };
|
|
63
63
|
if (input.useDeploymentBasedUrls)
|
|
64
64
|
return { baseURL: `${baseURL}/deployments/${modelID}`, query };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
-
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
2
|
+
import { type HttpOptions, type ModelID } from "../schema/index.js";
|
|
3
3
|
export type { BlackForestLabsImageOptions } from "../protocols/bfl-images.js";
|
|
4
4
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
5
|
export type Config = ProviderAuthOption<"optional"> & {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Auth } from "../route/auth.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { MediaRoute } from "../route/media.js";
|
|
3
|
+
import { ProviderID } from "../schema/index.js";
|
|
4
|
+
import { BlackForestLabsImages } from "../protocols/bfl-images.js";
|
|
4
5
|
export const id = ProviderID.make("black-forest-labs");
|
|
5
|
-
const baseURL = DEFAULT_BASE_URL;
|
|
6
6
|
const auth = (options) => {
|
|
7
7
|
if ("auth" in options && options.auth)
|
|
8
8
|
return options.auth;
|
|
@@ -11,13 +11,8 @@ const auth = (options) => {
|
|
|
11
11
|
.pipe(Auth.header("x-key"));
|
|
12
12
|
};
|
|
13
13
|
export const configure = (input = {}) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
auth: auth(input),
|
|
17
|
-
baseURL: input.baseURL ?? baseURL,
|
|
18
|
-
headers: input.headers,
|
|
19
|
-
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
20
|
-
});
|
|
14
|
+
const media = MediaRoute.deployment(input, auth(input));
|
|
15
|
+
const image = (modelID) => BlackForestLabsImages.model({ ...media, id: modelID });
|
|
21
16
|
return {
|
|
22
17
|
id,
|
|
23
18
|
image,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
-
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
2
|
+
import { type HttpOptions, type ModelID } 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
5
|
export type Config = ProviderAuthOption<"optional"> & {
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { AuthOptions } from "../route/auth-options.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { MediaRoute } from "../route/media.js";
|
|
3
|
+
import { ProviderID } from "../schema/index.js";
|
|
4
|
+
import { CartesiaSpeech } from "../protocols/cartesia-speech.js";
|
|
4
5
|
export const id = ProviderID.make("cartesia");
|
|
5
|
-
const baseURL = DEFAULT_BASE_URL;
|
|
6
6
|
const auth = (options) => AuthOptions.bearer(options, "CARTESIA_API_KEY");
|
|
7
7
|
export const configure = (input = {}) => {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
auth: auth(input),
|
|
11
|
-
baseURL: input.baseURL ?? baseURL,
|
|
12
|
-
headers: input.headers,
|
|
13
|
-
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
14
|
-
});
|
|
8
|
+
const media = MediaRoute.deployment(input, auth(input));
|
|
9
|
+
const speech = (modelID) => CartesiaSpeech.model({ ...media, id: modelID });
|
|
15
10
|
return {
|
|
16
11
|
id,
|
|
17
12
|
speech,
|
|
@@ -474,20 +474,20 @@ export declare const messagesRoute: import("../route/client.js").Route<{
|
|
|
474
474
|
readonly thinking?: {
|
|
475
475
|
readonly type: "enabled";
|
|
476
476
|
readonly budget_tokens: number;
|
|
477
|
-
readonly display?: (
|
|
477
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
478
478
|
readonly block_binding?: {
|
|
479
|
-
readonly prefix_mismatch_behavior?: (
|
|
479
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
480
480
|
} | undefined;
|
|
481
481
|
} | {
|
|
482
482
|
readonly type: "adaptive";
|
|
483
|
-
readonly display?: (
|
|
483
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
484
484
|
readonly block_binding?: {
|
|
485
|
-
readonly prefix_mismatch_behavior?: (
|
|
485
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
486
486
|
} | undefined;
|
|
487
487
|
} | {
|
|
488
488
|
readonly type: "disabled";
|
|
489
489
|
} | undefined;
|
|
490
|
-
readonly service_tier?: "auto" |
|
|
490
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
491
491
|
readonly container?: string | {
|
|
492
492
|
readonly id?: string | null | undefined;
|
|
493
493
|
readonly skills?: readonly {
|
|
@@ -858,20 +858,20 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
858
858
|
readonly thinking?: {
|
|
859
859
|
readonly type: "enabled";
|
|
860
860
|
readonly budget_tokens: number;
|
|
861
|
-
readonly display?: (
|
|
861
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
862
862
|
readonly block_binding?: {
|
|
863
|
-
readonly prefix_mismatch_behavior?: (
|
|
863
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
864
864
|
} | undefined;
|
|
865
865
|
} | {
|
|
866
866
|
readonly type: "adaptive";
|
|
867
|
-
readonly display?: (
|
|
867
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
868
868
|
readonly block_binding?: {
|
|
869
|
-
readonly prefix_mismatch_behavior?: (
|
|
869
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
870
870
|
} | undefined;
|
|
871
871
|
} | {
|
|
872
872
|
readonly type: "disabled";
|
|
873
873
|
} | undefined;
|
|
874
|
-
readonly service_tier?: "auto" |
|
|
874
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
875
875
|
readonly container?: string | {
|
|
876
876
|
readonly id?: string | null | undefined;
|
|
877
877
|
readonly skills?: readonly {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
-
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
2
|
+
import { type HttpOptions, type ModelID } 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">;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Auth } from "../route/auth.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { MediaRoute } from "../route/media.js";
|
|
3
|
+
import { ProviderID } from "../schema/index.js";
|
|
4
|
+
import { DeepgramSpeech } from "../protocols/deepgram-speech.js";
|
|
4
5
|
import { DeepgramTranscription } from "../protocols/deepgram-transcription.js";
|
|
5
6
|
export const id = ProviderID.make("deepgram");
|
|
6
|
-
const baseURL = DEFAULT_BASE_URL;
|
|
7
7
|
const auth = (options) => {
|
|
8
8
|
if ("auth" in options && options.auth)
|
|
9
9
|
return options.auth;
|
|
@@ -12,17 +12,11 @@ const auth = (options) => {
|
|
|
12
12
|
.pipe(Auth.scheme("Token"));
|
|
13
13
|
};
|
|
14
14
|
export const configure = (input = {}) => {
|
|
15
|
-
const media = (
|
|
16
|
-
id: modelID,
|
|
17
|
-
auth: auth(input),
|
|
18
|
-
baseURL: input.baseURL ?? baseURL,
|
|
19
|
-
headers: input.headers,
|
|
20
|
-
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
21
|
-
});
|
|
15
|
+
const media = MediaRoute.deployment(input, auth(input));
|
|
22
16
|
return {
|
|
23
17
|
id,
|
|
24
|
-
speech: (modelID) => DeepgramSpeech.model(media
|
|
25
|
-
transcription: (modelID) => DeepgramTranscription.model(media
|
|
18
|
+
speech: (modelID) => DeepgramSpeech.model({ ...media, id: modelID }),
|
|
19
|
+
transcription: (modelID) => DeepgramTranscription.model({ ...media, id: modelID }),
|
|
26
20
|
configure,
|
|
27
21
|
};
|
|
28
22
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
-
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
2
|
+
import { type HttpOptions, type ModelID } from "../schema/index.js";
|
|
3
3
|
export type { ElevenLabsOutputFormat, ElevenLabsSpeechOptions } from "../protocols/elevenlabs-speech.js";
|
|
4
4
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
5
|
export type Config = ProviderAuthOption<"optional"> & {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Auth } from "../route/auth.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { MediaRoute } from "../route/media.js";
|
|
3
|
+
import { ProviderID } from "../schema/index.js";
|
|
4
|
+
import { ElevenLabsSpeech } from "../protocols/elevenlabs-speech.js";
|
|
4
5
|
export const id = ProviderID.make("elevenlabs");
|
|
5
|
-
const baseURL = DEFAULT_BASE_URL;
|
|
6
6
|
const auth = (options) => {
|
|
7
7
|
if ("auth" in options && options.auth)
|
|
8
8
|
return options.auth;
|
|
@@ -11,13 +11,8 @@ const auth = (options) => {
|
|
|
11
11
|
.pipe(Auth.header("xi-api-key"));
|
|
12
12
|
};
|
|
13
13
|
export const configure = (input = {}) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
auth: auth(input),
|
|
17
|
-
baseURL: input.baseURL ?? baseURL,
|
|
18
|
-
headers: input.headers,
|
|
19
|
-
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
20
|
-
});
|
|
14
|
+
const media = MediaRoute.deployment(input, auth(input));
|
|
15
|
+
const speech = (modelID) => ElevenLabsSpeech.model({ ...media, id: modelID });
|
|
21
16
|
return {
|
|
22
17
|
id,
|
|
23
18
|
speech,
|
package/dist/providers/fal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
-
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
2
|
+
import { type HttpOptions, type ModelID } from "../schema/index.js";
|
|
3
3
|
export type { FalImageOptions } from "../protocols/fal-images.js";
|
|
4
4
|
export type { FalVideoOptions } from "../protocols/fal-video.js";
|
|
5
5
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
package/dist/providers/fal.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Auth } from "../route/auth.js";
|
|
2
|
-
import {
|
|
2
|
+
import { MediaRoute } from "../route/media.js";
|
|
3
|
+
import { ProviderID } from "../schema/index.js";
|
|
3
4
|
import { FalImages } from "../protocols/fal-images.js";
|
|
4
5
|
import { FalVideo } from "../protocols/fal-video.js";
|
|
5
|
-
import { FalQueue } from "../protocols/utils/fal-queue.js";
|
|
6
6
|
export const id = ProviderID.make("fal");
|
|
7
|
-
const baseURL = FalQueue.DEFAULT_BASE_URL;
|
|
8
7
|
// fal authenticates with `Authorization: Key <FAL_KEY>` rather than a bearer token.
|
|
9
8
|
const auth = (options) => {
|
|
10
9
|
if ("auth" in options && options.auth)
|
|
@@ -14,17 +13,11 @@ const auth = (options) => {
|
|
|
14
13
|
.pipe(Auth.scheme("Key"));
|
|
15
14
|
};
|
|
16
15
|
export const configure = (input = {}) => {
|
|
17
|
-
const media = (
|
|
18
|
-
id: modelID,
|
|
19
|
-
auth: auth(input),
|
|
20
|
-
baseURL: input.baseURL ?? baseURL,
|
|
21
|
-
headers: input.headers,
|
|
22
|
-
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
23
|
-
});
|
|
16
|
+
const media = MediaRoute.deployment(input, auth(input));
|
|
24
17
|
return {
|
|
25
18
|
id,
|
|
26
|
-
image: (modelID) => FalImages.model(media
|
|
27
|
-
video: (modelID) => FalVideo.model(media
|
|
19
|
+
image: (modelID) => FalImages.model({ ...media, id: modelID }),
|
|
20
|
+
video: (modelID) => FalVideo.model({ ...media, id: modelID }),
|
|
28
21
|
configure,
|
|
29
22
|
};
|
|
30
23
|
};
|
|
@@ -236,20 +236,20 @@ export declare const routes: Route<{
|
|
|
236
236
|
thinking?: {
|
|
237
237
|
readonly type: "enabled";
|
|
238
238
|
readonly budget_tokens: number;
|
|
239
|
-
readonly display?: (
|
|
239
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
240
240
|
readonly block_binding?: {
|
|
241
|
-
readonly prefix_mismatch_behavior?: (
|
|
241
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
242
242
|
} | undefined;
|
|
243
243
|
} | {
|
|
244
244
|
readonly type: "adaptive";
|
|
245
|
-
readonly display?: (
|
|
245
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
246
246
|
readonly block_binding?: {
|
|
247
|
-
readonly prefix_mismatch_behavior?: (
|
|
247
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
248
248
|
} | undefined;
|
|
249
249
|
} | {
|
|
250
250
|
readonly type: "disabled";
|
|
251
251
|
} | undefined;
|
|
252
|
-
service_tier?: "auto" |
|
|
252
|
+
service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
253
253
|
container?: string | {
|
|
254
254
|
readonly id?: string | null | undefined;
|
|
255
255
|
readonly skills?: readonly {
|
|
@@ -83,8 +83,8 @@ export declare const routes: Route<{
|
|
|
83
83
|
} | undefined;
|
|
84
84
|
readonly cachedContent?: string | undefined;
|
|
85
85
|
readonly safetySettings?: readonly {
|
|
86
|
-
readonly category: (
|
|
87
|
-
readonly threshold: (
|
|
86
|
+
readonly category: import("../schema/options.js").OpenString<"HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY">;
|
|
87
|
+
readonly threshold: import("../schema/options.js").OpenString<"HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF">;
|
|
88
88
|
}[] | undefined;
|
|
89
89
|
readonly labels?: {
|
|
90
90
|
readonly [x: string]: string;
|
|
@@ -105,7 +105,7 @@ export declare const routes: Route<{
|
|
|
105
105
|
readonly thinkingConfig?: {
|
|
106
106
|
readonly thinkingBudget?: number | undefined;
|
|
107
107
|
readonly includeThoughts?: boolean | undefined;
|
|
108
|
-
readonly thinkingLevel?: (
|
|
108
|
+
readonly thinkingLevel?: import("../schema/options.js").OpenString<"minimal" | "low" | "medium" | "high"> | undefined;
|
|
109
109
|
} | undefined;
|
|
110
110
|
readonly maxOutputTokens?: number | undefined;
|
|
111
111
|
} | undefined;
|
|
@@ -68,8 +68,8 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
68
68
|
} | undefined;
|
|
69
69
|
readonly cachedContent?: string | undefined;
|
|
70
70
|
readonly safetySettings?: readonly {
|
|
71
|
-
readonly category: (
|
|
72
|
-
readonly threshold: (
|
|
71
|
+
readonly category: import("../schema/options.js").OpenString<"HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY">;
|
|
72
|
+
readonly threshold: import("../schema/options.js").OpenString<"HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF">;
|
|
73
73
|
}[] | undefined;
|
|
74
74
|
readonly labels?: {
|
|
75
75
|
readonly [x: string]: string;
|
|
@@ -90,7 +90,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
90
90
|
readonly thinkingConfig?: {
|
|
91
91
|
readonly thinkingBudget?: number | undefined;
|
|
92
92
|
readonly includeThoughts?: boolean | undefined;
|
|
93
|
-
readonly thinkingLevel?: (
|
|
93
|
+
readonly thinkingLevel?: import("../schema/options.js").OpenString<"minimal" | "low" | "medium" | "high"> | undefined;
|
|
94
94
|
} | undefined;
|
|
95
95
|
readonly maxOutputTokens?: number | undefined;
|
|
96
96
|
} | undefined;
|
package/dist/providers/google.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Auth } from "../route/auth.js";
|
|
2
|
-
import {
|
|
2
|
+
import { MediaRoute } from "../route/media.js";
|
|
3
|
+
import { ProviderID } from "../schema/index.js";
|
|
3
4
|
import { Gemini } from "../protocols/gemini.js";
|
|
4
5
|
import { GoogleImages } from "../protocols/google-images.js";
|
|
5
6
|
import { GoogleSpeech } from "../protocols/google-speech.js";
|
|
@@ -20,20 +21,14 @@ const configuredRoute = (input) => {
|
|
|
20
21
|
};
|
|
21
22
|
export const configure = (input = {}) => {
|
|
22
23
|
const route = configuredRoute(input);
|
|
23
|
-
const media = (
|
|
24
|
-
id: modelID,
|
|
25
|
-
auth: auth(input),
|
|
26
|
-
baseURL: input.baseURL,
|
|
27
|
-
headers: input.headers,
|
|
28
|
-
http: mergeHttpOptions(input.http === undefined ? undefined : HttpOptions.make(input.http)),
|
|
29
|
-
});
|
|
24
|
+
const media = MediaRoute.deployment(input, auth(input));
|
|
30
25
|
return {
|
|
31
26
|
id,
|
|
32
27
|
model: (modelID) => route.model({ id: modelID }),
|
|
33
|
-
image: (modelID) => GoogleImages.model(media
|
|
34
|
-
video: (modelID) => GoogleVideo.model(media
|
|
35
|
-
speech: (modelID) => GoogleSpeech.model(media
|
|
36
|
-
transcription: (modelID) => GoogleTranscription.model(media
|
|
28
|
+
image: (modelID) => GoogleImages.model({ ...media, id: modelID }),
|
|
29
|
+
video: (modelID) => GoogleVideo.model({ ...media, id: modelID }),
|
|
30
|
+
speech: (modelID) => GoogleSpeech.model({ ...media, id: modelID }),
|
|
31
|
+
transcription: (modelID) => GoogleTranscription.model({ ...media, id: modelID }),
|
|
37
32
|
configure,
|
|
38
33
|
};
|
|
39
34
|
};
|
package/dist/providers/meta.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
|
3
3
|
import { MetaImages } from "../protocols/meta-images.js";
|
|
4
4
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
5
5
|
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
6
|
-
import { ToolDefinition, type ModelID } from "../schema/index.js";
|
|
6
|
+
import { ToolDefinition, type ModelID, type OpenString } from "../schema/index.js";
|
|
7
7
|
import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js";
|
|
8
8
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
9
9
|
export type ProviderOptionsInput = OpenResponsesProviderOptionsInput & Pick<AnthropicMessages.OptionsInput, "thinking" | "effort">;
|
|
@@ -23,8 +23,8 @@ export interface WebSearchOptions {
|
|
|
23
23
|
export declare const webSearch: (options?: WebSearchOptions) => ToolDefinition;
|
|
24
24
|
export interface ImageGenerationOptions {
|
|
25
25
|
readonly size?: string;
|
|
26
|
-
readonly outputFormat?: "webp" | "png" | "jpeg"
|
|
27
|
-
readonly reasoningStrength?: "low" | "high"
|
|
26
|
+
readonly outputFormat?: OpenString<"webp" | "png" | "jpeg">;
|
|
27
|
+
readonly reasoningStrength?: OpenString<"low" | "high">;
|
|
28
28
|
readonly enableImageSearch?: boolean;
|
|
29
29
|
readonly enableWebSearch?: boolean;
|
|
30
30
|
readonly enableShell?: boolean;
|
|
@@ -560,20 +560,20 @@ export declare const routes: (Route<{
|
|
|
560
560
|
readonly thinking?: {
|
|
561
561
|
readonly type: "enabled";
|
|
562
562
|
readonly budget_tokens: number;
|
|
563
|
-
readonly display?:
|
|
563
|
+
readonly display?: OpenString<"summarized" | "omitted"> | undefined;
|
|
564
564
|
readonly block_binding?: {
|
|
565
|
-
readonly prefix_mismatch_behavior?:
|
|
565
|
+
readonly prefix_mismatch_behavior?: OpenString<"error" | "drop_block"> | undefined;
|
|
566
566
|
} | undefined;
|
|
567
567
|
} | {
|
|
568
568
|
readonly type: "adaptive";
|
|
569
|
-
readonly display?:
|
|
569
|
+
readonly display?: OpenString<"summarized" | "omitted"> | undefined;
|
|
570
570
|
readonly block_binding?: {
|
|
571
|
-
readonly prefix_mismatch_behavior?:
|
|
571
|
+
readonly prefix_mismatch_behavior?: OpenString<"error" | "drop_block"> | undefined;
|
|
572
572
|
} | undefined;
|
|
573
573
|
} | {
|
|
574
574
|
readonly type: "disabled";
|
|
575
575
|
} | undefined;
|
|
576
|
-
readonly service_tier?: "auto" |
|
|
576
|
+
readonly service_tier?: OpenString<"auto" | "standard_only"> | undefined;
|
|
577
577
|
readonly container?: string | {
|
|
578
578
|
readonly id?: string | null | undefined;
|
|
579
579
|
readonly skills?: readonly {
|
package/dist/providers/meta.js
CHANGED
|
@@ -6,7 +6,8 @@ import { MetaImages } from "../protocols/meta-images.js";
|
|
|
6
6
|
import { AuthOptions } from "../route/auth-options.js";
|
|
7
7
|
import { Route } from "../route/client.js";
|
|
8
8
|
import { Endpoint } from "../route/endpoint.js";
|
|
9
|
-
import {
|
|
9
|
+
import { MediaRoute } from "../route/media.js";
|
|
10
|
+
import { ProviderID, ToolDefinition } from "../schema/index.js";
|
|
10
11
|
export const id = ProviderID.make("meta");
|
|
11
12
|
const baseURL = "https://api.meta.ai/v1";
|
|
12
13
|
export const webSearch = (options = {}) => ToolDefinition.make({
|
|
@@ -84,13 +85,8 @@ export const configure = (input = {}) => {
|
|
|
84
85
|
id: modelID,
|
|
85
86
|
compatibility: { requireSignature: false },
|
|
86
87
|
});
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
baseURL: endpoint ?? baseURL,
|
|
90
|
-
auth: options.auth,
|
|
91
|
-
headers: input.headers,
|
|
92
|
-
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
93
|
-
});
|
|
88
|
+
const media = MediaRoute.deployment(input, options.auth);
|
|
89
|
+
const image = (modelID) => MetaImages.model({ ...media, id: modelID });
|
|
94
90
|
return { id, model: responses, responses, chat, messages, image, configure };
|
|
95
91
|
};
|
|
96
92
|
export const provider = configure();
|