@opencode/ai 0.0.0-reserved → 2.0.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/README.md +879 -2
- package/dist/cache-policy.d.ts +2 -0
- package/dist/cache-policy.js +129 -0
- package/dist/image-client.d.ts +19 -0
- package/dist/image-client.js +28 -0
- package/dist/image.d.ts +110 -0
- package/dist/image.js +103 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +12 -0
- package/dist/llm.d.ts +252 -0
- package/dist/llm.js +74 -0
- package/dist/protocols/alibaba-chat.d.ts +225 -0
- package/dist/protocols/alibaba-chat.js +75 -0
- package/dist/protocols/alibaba-messages.d.ts +350 -0
- package/dist/protocols/alibaba-messages.js +40 -0
- package/dist/protocols/alibaba-responses.d.ts +255 -0
- package/dist/protocols/alibaba-responses.js +80 -0
- package/dist/protocols/anthropic-messages.d.ts +980 -0
- package/dist/protocols/anthropic-messages.js +1460 -0
- package/dist/protocols/bedrock-converse.d.ts +499 -0
- package/dist/protocols/bedrock-converse.js +643 -0
- package/dist/protocols/bedrock-event-stream.d.ts +9 -0
- package/dist/protocols/bedrock-event-stream.js +97 -0
- package/dist/protocols/gemini.d.ts +285 -0
- package/dist/protocols/gemini.js +671 -0
- package/dist/protocols/google-images.d.ts +30 -0
- package/dist/protocols/google-images.js +181 -0
- package/dist/protocols/index.d.ts +12 -0
- package/dist/protocols/index.js +12 -0
- package/dist/protocols/meta-images.d.ts +26 -0
- package/dist/protocols/meta-images.js +89 -0
- package/dist/protocols/meta-messages.d.ts +356 -0
- package/dist/protocols/meta-messages.js +41 -0
- package/dist/protocols/meta-responses.d.ts +473 -0
- package/dist/protocols/meta-responses.js +173 -0
- package/dist/protocols/mistral-chat.d.ts +540 -0
- package/dist/protocols/mistral-chat.js +624 -0
- package/dist/protocols/open-responses-channel.d.ts +25 -0
- package/dist/protocols/open-responses-channel.js +141 -0
- package/dist/protocols/open-responses-continuation.d.ts +16 -0
- package/dist/protocols/open-responses-continuation.js +170 -0
- package/dist/protocols/open-responses.d.ts +1715 -0
- package/dist/protocols/open-responses.js +1228 -0
- package/dist/protocols/openai-chat.d.ts +860 -0
- package/dist/protocols/openai-chat.js +966 -0
- package/dist/protocols/openai-compatible-chat.d.ts +109 -0
- package/dist/protocols/openai-compatible-chat.js +19 -0
- package/dist/protocols/openai-compatible-responses.d.ts +172 -0
- package/dist/protocols/openai-compatible-responses.js +18 -0
- package/dist/protocols/openai-images.d.ts +32 -0
- package/dist/protocols/openai-images.js +183 -0
- package/dist/protocols/openai-responses.d.ts +1389 -0
- package/dist/protocols/openai-responses.js +260 -0
- package/dist/protocols/shared.d.ts +193 -0
- package/dist/protocols/shared.js +290 -0
- package/dist/protocols/utils/bedrock-auth.d.ts +60 -0
- package/dist/protocols/utils/bedrock-auth.js +85 -0
- package/dist/protocols/utils/bedrock-cache.d.ts +19 -0
- package/dist/protocols/utils/bedrock-cache.js +49 -0
- package/dist/protocols/utils/bedrock-media.d.ts +55 -0
- package/dist/protocols/utils/bedrock-media.js +73 -0
- package/dist/protocols/utils/cache.d.ts +6 -0
- package/dist/protocols/utils/cache.js +5 -0
- package/dist/protocols/utils/gemini-tool-schema.d.ts +2 -0
- package/dist/protocols/utils/gemini-tool-schema.js +103 -0
- package/dist/protocols/utils/image-input.d.ts +21 -0
- package/dist/protocols/utils/image-input.js +20 -0
- package/dist/protocols/utils/lifecycle.d.ts +24 -0
- package/dist/protocols/utils/lifecycle.js +72 -0
- package/dist/protocols/utils/meta-image.d.ts +2 -0
- package/dist/protocols/utils/meta-image.js +13 -0
- package/dist/protocols/utils/open-responses-options.d.ts +56 -0
- package/dist/protocols/utils/open-responses-options.js +61 -0
- package/dist/protocols/utils/openai-image.d.ts +5 -0
- package/dist/protocols/utils/openai-image.js +18 -0
- package/dist/protocols/utils/openai-options.d.ts +16 -0
- package/dist/protocols/utils/openai-options.js +14 -0
- package/dist/protocols/utils/partial-json-options.d.ts +62 -0
- package/dist/protocols/utils/partial-json-options.js +52 -0
- package/dist/protocols/utils/partial-json.d.ts +8 -0
- package/dist/protocols/utils/partial-json.js +279 -0
- package/dist/protocols/utils/responses-checkpoint.d.ts +4 -0
- package/dist/protocols/utils/responses-checkpoint.js +107 -0
- package/dist/protocols/utils/responses-compaction.d.ts +4 -0
- package/dist/protocols/utils/responses-compaction.js +129 -0
- package/dist/protocols/utils/responses-hosted-tools.d.ts +26 -0
- package/dist/protocols/utils/responses-hosted-tools.js +32 -0
- package/dist/protocols/utils/tool-schema.d.ts +8 -0
- package/dist/protocols/utils/tool-schema.js +54 -0
- package/dist/protocols/utils/tool-stream.d.ts +710 -0
- package/dist/protocols/utils/tool-stream.js +155 -0
- package/dist/protocols/xai-images.d.ts +26 -0
- package/dist/protocols/xai-images.js +106 -0
- package/dist/protocols/xai-responses.d.ts +250 -0
- package/dist/protocols/xai-responses.js +81 -0
- package/dist/protocols/zai-chat.d.ts +202 -0
- package/dist/protocols/zai-chat.js +49 -0
- package/dist/protocols/zai-images.d.ts +22 -0
- package/dist/protocols/zai-images.js +79 -0
- package/dist/protocols/zai-messages.d.ts +344 -0
- package/dist/protocols/zai-messages.js +27 -0
- package/dist/protocols.d.ts +1 -0
- package/dist/protocols.js +1 -0
- package/dist/provider-error.d.ts +15 -0
- package/dist/provider-error.js +125 -0
- package/dist/provider-package.d.ts +15 -0
- package/dist/provider-package.js +1 -0
- package/dist/provider.d.ts +23 -0
- package/dist/provider.js +2 -0
- package/dist/providers/alibaba/chat.d.ts +1 -0
- package/dist/providers/alibaba/chat.js +1 -0
- package/dist/providers/alibaba/messages.d.ts +3 -0
- package/dist/providers/alibaba/messages.js +1 -0
- package/dist/providers/alibaba/responses.d.ts +3 -0
- package/dist/providers/alibaba/responses.js +1 -0
- package/dist/providers/alibaba.d.ts +711 -0
- package/dist/providers/alibaba.js +94 -0
- package/dist/providers/amazon-bedrock/mantle/chat.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/chat.js +1 -0
- package/dist/providers/amazon-bedrock/mantle/responses.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/responses.js +1 -0
- package/dist/providers/amazon-bedrock/mantle.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle.js +1 -0
- package/dist/providers/amazon-bedrock-mantle.d.ts +313 -0
- package/dist/providers/amazon-bedrock-mantle.js +79 -0
- package/dist/providers/amazon-bedrock.d.ts +173 -0
- package/dist/providers/amazon-bedrock.js +41 -0
- package/dist/providers/anthropic-compatible.d.ts +309 -0
- package/dist/providers/anthropic-compatible.js +50 -0
- package/dist/providers/anthropic.d.ts +307 -0
- package/dist/providers/anthropic.js +42 -0
- package/dist/providers/azure/chat.d.ts +2 -0
- package/dist/providers/azure/chat.js +1 -0
- package/dist/providers/azure/responses.d.ts +2 -0
- package/dist/providers/azure/responses.js +1 -0
- package/dist/providers/azure.d.ts +598 -0
- package/dist/providers/azure.js +115 -0
- package/dist/providers/baseten.d.ts +228 -0
- package/dist/providers/baseten.js +38 -0
- package/dist/providers/cerebras.d.ts +227 -0
- package/dist/providers/cerebras.js +40 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +237 -0
- package/dist/providers/cloudflare-ai-gateway.js +65 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +231 -0
- package/dist/providers/cloudflare-workers-ai.js +51 -0
- package/dist/providers/deepinfra.d.ts +227 -0
- package/dist/providers/deepinfra.js +43 -0
- package/dist/providers/deepseek.d.ts +228 -0
- package/dist/providers/deepseek.js +41 -0
- package/dist/providers/fireworks.d.ts +228 -0
- package/dist/providers/fireworks.js +38 -0
- package/dist/providers/google-vertex/chat.d.ts +2 -0
- package/dist/providers/google-vertex/chat.js +1 -0
- package/dist/providers/google-vertex/gemini.d.ts +2 -0
- package/dist/providers/google-vertex/gemini.js +1 -0
- package/dist/providers/google-vertex/messages.d.ts +2 -0
- package/dist/providers/google-vertex/messages.js +1 -0
- package/dist/providers/google-vertex/responses.d.ts +2 -0
- package/dist/providers/google-vertex/responses.js +1 -0
- package/dist/providers/google-vertex-chat.d.ts +132 -0
- package/dist/providers/google-vertex-chat.js +55 -0
- package/dist/providers/google-vertex-messages.d.ts +306 -0
- package/dist/providers/google-vertex-messages.js +75 -0
- package/dist/providers/google-vertex-responses.d.ts +197 -0
- package/dist/providers/google-vertex-responses.js +56 -0
- package/dist/providers/google-vertex-shared.d.ts +22 -0
- package/dist/providers/google-vertex-shared.js +72 -0
- package/dist/providers/google-vertex.d.ts +119 -0
- package/dist/providers/google-vertex.js +98 -0
- package/dist/providers/google.d.ts +114 -0
- package/dist/providers/google.js +42 -0
- package/dist/providers/groq.d.ts +314 -0
- package/dist/providers/groq.js +81 -0
- package/dist/providers/index.d.ts +31 -0
- package/dist/providers/index.js +31 -0
- package/dist/providers/meta/chat.d.ts +2 -0
- package/dist/providers/meta/chat.js +1 -0
- package/dist/providers/meta/messages.d.ts +2 -0
- package/dist/providers/meta/messages.js +1 -0
- package/dist/providers/meta/responses.d.ts +2 -0
- package/dist/providers/meta/responses.js +1 -0
- package/dist/providers/meta.d.ts +636 -0
- package/dist/providers/meta.js +113 -0
- package/dist/providers/minimax/chat.d.ts +4 -0
- package/dist/providers/minimax/chat.js +8 -0
- package/dist/providers/minimax/messages.d.ts +1 -0
- package/dist/providers/minimax/messages.js +1 -0
- package/dist/providers/minimax/responses.d.ts +4 -0
- package/dist/providers/minimax/responses.js +8 -0
- package/dist/providers/minimax.d.ts +598 -0
- package/dist/providers/minimax.js +89 -0
- package/dist/providers/mistral.d.ts +207 -0
- package/dist/providers/mistral.js +28 -0
- package/dist/providers/moonshot/chat.d.ts +1 -0
- package/dist/providers/moonshot/chat.js +1 -0
- package/dist/providers/moonshot/messages.d.ts +4 -0
- package/dist/providers/moonshot/messages.js +8 -0
- package/dist/providers/moonshot/responses.d.ts +4 -0
- package/dist/providers/moonshot/responses.js +8 -0
- package/dist/providers/moonshot.d.ts +596 -0
- package/dist/providers/moonshot.js +90 -0
- package/dist/providers/open-responses-options.d.ts +6 -0
- package/dist/providers/open-responses-options.js +1 -0
- package/dist/providers/openai/chat.d.ts +2 -0
- package/dist/providers/openai/chat.js +1 -0
- package/dist/providers/openai/responses.d.ts +2 -0
- package/dist/providers/openai/responses.js +1 -0
- package/dist/providers/openai-compatible/responses.d.ts +1 -0
- package/dist/providers/openai-compatible/responses.js +1 -0
- package/dist/providers/openai-compatible-responses.d.ts +195 -0
- package/dist/providers/openai-compatible-responses.js +32 -0
- package/dist/providers/openai-compatible.d.ts +130 -0
- package/dist/providers/openai-compatible.js +33 -0
- package/dist/providers/openai-options.d.ts +26 -0
- package/dist/providers/openai-options.js +41 -0
- package/dist/providers/openai.d.ts +404 -0
- package/dist/providers/openai.js +82 -0
- package/dist/providers/openrouter.d.ts +563 -0
- package/dist/providers/openrouter.js +114 -0
- package/dist/providers/togetherai.d.ts +227 -0
- package/dist/providers/togetherai.js +40 -0
- package/dist/providers/xai.d.ts +163 -0
- package/dist/providers/xai.js +88 -0
- package/dist/providers/zai/chat.d.ts +1 -0
- package/dist/providers/zai/chat.js +1 -0
- package/dist/providers/zai-coding-plan/chat.d.ts +1 -0
- package/dist/providers/zai-coding-plan/chat.js +1 -0
- package/dist/providers/zai-coding-plan/messages.d.ts +4 -0
- package/dist/providers/zai-coding-plan/messages.js +8 -0
- package/dist/providers/zai-coding-plan/responses.d.ts +4 -0
- package/dist/providers/zai-coding-plan/responses.js +8 -0
- package/dist/providers/zai-coding-plan.d.ts +577 -0
- package/dist/providers/zai-coding-plan.js +63 -0
- package/dist/providers/zai.d.ts +149 -0
- package/dist/providers/zai.js +53 -0
- package/dist/providers.d.ts +1 -0
- package/dist/providers.js +1 -0
- package/dist/route/auth-options.d.ts +34 -0
- package/dist/route/auth-options.js +14 -0
- package/dist/route/auth.d.ts +51 -0
- package/dist/route/auth.js +87 -0
- package/dist/route/client.d.ts +430 -0
- package/dist/route/client.js +307 -0
- package/dist/route/endpoint.d.ts +28 -0
- package/dist/route/endpoint.js +21 -0
- package/dist/route/executor.d.ts +27 -0
- package/dist/route/executor.js +183 -0
- package/dist/route/framing.d.ts +29 -0
- package/dist/route/framing.js +14 -0
- package/dist/route/index.d.ts +16 -0
- package/dist/route/index.js +9 -0
- package/dist/route/protocol.d.ts +76 -0
- package/dist/route/protocol.js +16 -0
- package/dist/route/transport/http.d.ts +34 -0
- package/dist/route/transport/http.js +68 -0
- package/dist/route/transport/index.d.ts +41 -0
- package/dist/route/transport/index.js +4 -0
- package/dist/route/transport/websocket-channel.d.ts +57 -0
- package/dist/route/transport/websocket-channel.js +1 -0
- package/dist/route/transport/websocket.d.ts +56 -0
- package/dist/route/transport/websocket.js +370 -0
- package/dist/route.d.ts +1 -0
- package/dist/route.js +1 -0
- package/dist/schema/errors.d.ts +170 -0
- package/dist/schema/errors.js +131 -0
- package/dist/schema/events.d.ts +8123 -0
- package/dist/schema/events.js +550 -0
- package/dist/schema/ids.d.ts +17 -0
- package/dist/schema/ids.js +10 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.js +5 -0
- package/dist/schema/messages.d.ts +646 -0
- package/dist/schema/messages.js +301 -0
- package/dist/schema/options.d.ts +159 -0
- package/dist/schema/options.js +189 -0
- package/dist/testing.d.ts +1693 -0
- package/dist/testing.js +129 -0
- package/dist/tool-history.d.ts +2 -0
- package/dist/tool-history.js +84 -0
- package/dist/tool-runtime.d.ts +15 -0
- package/dist/tool-runtime.js +62 -0
- package/dist/tool.d.ts +136 -0
- package/dist/tool.js +66 -0
- package/dist/utils/record.d.ts +2 -0
- package/dist/utils/record.js +2 -0
- package/dist/utils/sanitize.d.ts +1 -0
- package/dist/utils/sanitize.js +12 -0
- package/package.json +43 -10
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
+
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
4
|
+
import { type ModelID } from "../schema/index.js";
|
|
5
|
+
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
+
export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
8
|
+
readonly baseURL?: string;
|
|
9
|
+
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
|
+
};
|
|
11
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
12
|
+
readonly apiKey?: string;
|
|
13
|
+
readonly baseURL?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const route: Route<{
|
|
16
|
+
readonly model: string;
|
|
17
|
+
readonly messages: readonly ({
|
|
18
|
+
readonly role: "system";
|
|
19
|
+
readonly content: string | readonly ({
|
|
20
|
+
readonly type: "text";
|
|
21
|
+
readonly text: string;
|
|
22
|
+
readonly cache_control?: {
|
|
23
|
+
readonly type: "ephemeral";
|
|
24
|
+
readonly ttl?: string | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
} | {
|
|
27
|
+
readonly type: "image_url";
|
|
28
|
+
readonly image_url: {
|
|
29
|
+
readonly url: string;
|
|
30
|
+
};
|
|
31
|
+
})[];
|
|
32
|
+
} | {
|
|
33
|
+
readonly role: "user";
|
|
34
|
+
readonly content: string | readonly ({
|
|
35
|
+
readonly type: "text";
|
|
36
|
+
readonly text: string;
|
|
37
|
+
readonly cache_control?: {
|
|
38
|
+
readonly type: "ephemeral";
|
|
39
|
+
readonly ttl?: string | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
} | {
|
|
42
|
+
readonly type: "image_url";
|
|
43
|
+
readonly image_url: {
|
|
44
|
+
readonly url: string;
|
|
45
|
+
};
|
|
46
|
+
})[];
|
|
47
|
+
} | {
|
|
48
|
+
readonly [x: string]: unknown;
|
|
49
|
+
readonly content: string | null;
|
|
50
|
+
readonly role: "assistant";
|
|
51
|
+
readonly reasoning?: string | undefined;
|
|
52
|
+
readonly reasoning_content?: string | undefined;
|
|
53
|
+
readonly reasoning_text?: string | undefined;
|
|
54
|
+
readonly cache_control?: {
|
|
55
|
+
readonly type: "ephemeral";
|
|
56
|
+
readonly ttl?: string | undefined;
|
|
57
|
+
} | undefined;
|
|
58
|
+
readonly tool_calls?: readonly {
|
|
59
|
+
readonly id: string;
|
|
60
|
+
readonly type: "function";
|
|
61
|
+
readonly function: {
|
|
62
|
+
readonly name: string;
|
|
63
|
+
readonly arguments: string;
|
|
64
|
+
};
|
|
65
|
+
}[] | undefined;
|
|
66
|
+
readonly reasoning_details?: unknown;
|
|
67
|
+
} | {
|
|
68
|
+
readonly content: string;
|
|
69
|
+
readonly role: "tool";
|
|
70
|
+
readonly tool_call_id: string;
|
|
71
|
+
readonly cache_control?: {
|
|
72
|
+
readonly type: "ephemeral";
|
|
73
|
+
readonly ttl?: string | undefined;
|
|
74
|
+
} | undefined;
|
|
75
|
+
})[];
|
|
76
|
+
readonly stream: true;
|
|
77
|
+
readonly max_completion_tokens?: number | undefined;
|
|
78
|
+
readonly max_tokens?: number | undefined;
|
|
79
|
+
readonly tools?: readonly {
|
|
80
|
+
readonly function: {
|
|
81
|
+
readonly description: string;
|
|
82
|
+
readonly name: string;
|
|
83
|
+
readonly parameters: {
|
|
84
|
+
readonly [x: string]: unknown;
|
|
85
|
+
};
|
|
86
|
+
readonly strict?: boolean | undefined;
|
|
87
|
+
};
|
|
88
|
+
readonly type: "function";
|
|
89
|
+
readonly cache_control?: {
|
|
90
|
+
readonly type: "ephemeral";
|
|
91
|
+
readonly ttl?: string | undefined;
|
|
92
|
+
} | undefined;
|
|
93
|
+
}[] | undefined;
|
|
94
|
+
readonly stop?: readonly string[] | undefined;
|
|
95
|
+
readonly temperature?: number | undefined;
|
|
96
|
+
readonly seed?: number | undefined;
|
|
97
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
98
|
+
readonly type: "function";
|
|
99
|
+
readonly function: {
|
|
100
|
+
readonly name: string;
|
|
101
|
+
};
|
|
102
|
+
} | undefined;
|
|
103
|
+
readonly top_p?: number | undefined;
|
|
104
|
+
readonly frequency_penalty?: number | undefined;
|
|
105
|
+
readonly presence_penalty?: number | undefined;
|
|
106
|
+
readonly prompt_cache_key?: string | undefined;
|
|
107
|
+
readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
108
|
+
readonly store?: boolean | undefined;
|
|
109
|
+
readonly stream_options?: {
|
|
110
|
+
readonly include_usage: boolean;
|
|
111
|
+
} | undefined;
|
|
112
|
+
readonly tool_stream?: boolean | undefined;
|
|
113
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
|
|
114
|
+
export declare const routes: Route<{
|
|
115
|
+
readonly model: string;
|
|
116
|
+
readonly messages: readonly ({
|
|
117
|
+
readonly role: "system";
|
|
118
|
+
readonly content: string | readonly ({
|
|
119
|
+
readonly type: "text";
|
|
120
|
+
readonly text: string;
|
|
121
|
+
readonly cache_control?: {
|
|
122
|
+
readonly type: "ephemeral";
|
|
123
|
+
readonly ttl?: string | undefined;
|
|
124
|
+
} | undefined;
|
|
125
|
+
} | {
|
|
126
|
+
readonly type: "image_url";
|
|
127
|
+
readonly image_url: {
|
|
128
|
+
readonly url: string;
|
|
129
|
+
};
|
|
130
|
+
})[];
|
|
131
|
+
} | {
|
|
132
|
+
readonly role: "user";
|
|
133
|
+
readonly content: string | readonly ({
|
|
134
|
+
readonly type: "text";
|
|
135
|
+
readonly text: string;
|
|
136
|
+
readonly cache_control?: {
|
|
137
|
+
readonly type: "ephemeral";
|
|
138
|
+
readonly ttl?: string | undefined;
|
|
139
|
+
} | undefined;
|
|
140
|
+
} | {
|
|
141
|
+
readonly type: "image_url";
|
|
142
|
+
readonly image_url: {
|
|
143
|
+
readonly url: string;
|
|
144
|
+
};
|
|
145
|
+
})[];
|
|
146
|
+
} | {
|
|
147
|
+
readonly [x: string]: unknown;
|
|
148
|
+
readonly content: string | null;
|
|
149
|
+
readonly role: "assistant";
|
|
150
|
+
readonly reasoning?: string | undefined;
|
|
151
|
+
readonly reasoning_content?: string | undefined;
|
|
152
|
+
readonly reasoning_text?: string | undefined;
|
|
153
|
+
readonly cache_control?: {
|
|
154
|
+
readonly type: "ephemeral";
|
|
155
|
+
readonly ttl?: string | undefined;
|
|
156
|
+
} | undefined;
|
|
157
|
+
readonly tool_calls?: readonly {
|
|
158
|
+
readonly id: string;
|
|
159
|
+
readonly type: "function";
|
|
160
|
+
readonly function: {
|
|
161
|
+
readonly name: string;
|
|
162
|
+
readonly arguments: string;
|
|
163
|
+
};
|
|
164
|
+
}[] | undefined;
|
|
165
|
+
readonly reasoning_details?: unknown;
|
|
166
|
+
} | {
|
|
167
|
+
readonly content: string;
|
|
168
|
+
readonly role: "tool";
|
|
169
|
+
readonly tool_call_id: string;
|
|
170
|
+
readonly cache_control?: {
|
|
171
|
+
readonly type: "ephemeral";
|
|
172
|
+
readonly ttl?: string | undefined;
|
|
173
|
+
} | undefined;
|
|
174
|
+
})[];
|
|
175
|
+
readonly stream: true;
|
|
176
|
+
readonly max_completion_tokens?: number | undefined;
|
|
177
|
+
readonly max_tokens?: number | undefined;
|
|
178
|
+
readonly tools?: readonly {
|
|
179
|
+
readonly function: {
|
|
180
|
+
readonly description: string;
|
|
181
|
+
readonly name: string;
|
|
182
|
+
readonly parameters: {
|
|
183
|
+
readonly [x: string]: unknown;
|
|
184
|
+
};
|
|
185
|
+
readonly strict?: boolean | undefined;
|
|
186
|
+
};
|
|
187
|
+
readonly type: "function";
|
|
188
|
+
readonly cache_control?: {
|
|
189
|
+
readonly type: "ephemeral";
|
|
190
|
+
readonly ttl?: string | undefined;
|
|
191
|
+
} | undefined;
|
|
192
|
+
}[] | undefined;
|
|
193
|
+
readonly stop?: readonly string[] | undefined;
|
|
194
|
+
readonly temperature?: number | undefined;
|
|
195
|
+
readonly seed?: number | undefined;
|
|
196
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
197
|
+
readonly type: "function";
|
|
198
|
+
readonly function: {
|
|
199
|
+
readonly name: string;
|
|
200
|
+
};
|
|
201
|
+
} | undefined;
|
|
202
|
+
readonly top_p?: number | undefined;
|
|
203
|
+
readonly frequency_penalty?: number | undefined;
|
|
204
|
+
readonly presence_penalty?: number | undefined;
|
|
205
|
+
readonly prompt_cache_key?: string | undefined;
|
|
206
|
+
readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
207
|
+
readonly store?: boolean | undefined;
|
|
208
|
+
readonly stream_options?: {
|
|
209
|
+
readonly include_usage: boolean;
|
|
210
|
+
} | undefined;
|
|
211
|
+
readonly tool_stream?: boolean | undefined;
|
|
212
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
|
|
213
|
+
export declare const configure: (input?: LanguageModelOptions) => {
|
|
214
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
215
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
216
|
+
configure: (input?: LanguageModelOptions) => /*elided*/ any;
|
|
217
|
+
};
|
|
218
|
+
export declare const provider: {
|
|
219
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
220
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
221
|
+
configure: (input?: LanguageModelOptions) => {
|
|
222
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
223
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
224
|
+
configure: /*elided*/ any;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { Endpoint } from "../route/endpoint.js";
|
|
5
|
+
import { ProviderID } from "../schema/index.js";
|
|
6
|
+
export const id = ProviderID.make("deepinfra");
|
|
7
|
+
const baseURL = "https://api.deepinfra.com/v1/openai";
|
|
8
|
+
export const route = Route.make({
|
|
9
|
+
id: "deepinfra-chat",
|
|
10
|
+
provider: id,
|
|
11
|
+
providerMetadataKey: "deepinfra",
|
|
12
|
+
protocol: OpenAIChat.protocol,
|
|
13
|
+
endpoint: Endpoint.path("/chat/completions", { baseURL }),
|
|
14
|
+
framing: OpenAIChat.framing,
|
|
15
|
+
});
|
|
16
|
+
export const routes = [route];
|
|
17
|
+
export const configure = (input = {}) => {
|
|
18
|
+
const { apiKey: _apiKey, auth: _auth, baseURL: endpoint, ...defaults } = input;
|
|
19
|
+
const root = endpoint?.replace(/\/+$/, "");
|
|
20
|
+
const configured = route.with({
|
|
21
|
+
...defaults,
|
|
22
|
+
endpoint: {
|
|
23
|
+
baseURL: root === undefined ? baseURL : root.endsWith("/openai") ? root : `${root}/openai`,
|
|
24
|
+
},
|
|
25
|
+
auth: AuthOptions.bearer(input, "DEEPINFRA_API_KEY"),
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
id,
|
|
29
|
+
model: (modelID) => configured.model({
|
|
30
|
+
id: modelID,
|
|
31
|
+
compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning_content", supportsStore: false },
|
|
32
|
+
}),
|
|
33
|
+
configure,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export const provider = configure();
|
|
37
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
38
|
+
apiKey,
|
|
39
|
+
baseURL,
|
|
40
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
41
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
42
|
+
providerOptions,
|
|
43
|
+
}).model(modelID);
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
+
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
4
|
+
import { type ModelID } from "../schema/index.js";
|
|
5
|
+
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
+
export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
8
|
+
readonly baseURL?: string;
|
|
9
|
+
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
|
+
};
|
|
11
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
12
|
+
readonly apiKey?: string;
|
|
13
|
+
readonly baseURL?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const route: Route<{
|
|
16
|
+
readonly model: string;
|
|
17
|
+
readonly messages: readonly ({
|
|
18
|
+
readonly role: "system";
|
|
19
|
+
readonly content: string | readonly ({
|
|
20
|
+
readonly type: "text";
|
|
21
|
+
readonly text: string;
|
|
22
|
+
readonly cache_control?: {
|
|
23
|
+
readonly type: "ephemeral";
|
|
24
|
+
readonly ttl?: string | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
} | {
|
|
27
|
+
readonly type: "image_url";
|
|
28
|
+
readonly image_url: {
|
|
29
|
+
readonly url: string;
|
|
30
|
+
};
|
|
31
|
+
})[];
|
|
32
|
+
} | {
|
|
33
|
+
readonly role: "user";
|
|
34
|
+
readonly content: string | readonly ({
|
|
35
|
+
readonly type: "text";
|
|
36
|
+
readonly text: string;
|
|
37
|
+
readonly cache_control?: {
|
|
38
|
+
readonly type: "ephemeral";
|
|
39
|
+
readonly ttl?: string | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
} | {
|
|
42
|
+
readonly type: "image_url";
|
|
43
|
+
readonly image_url: {
|
|
44
|
+
readonly url: string;
|
|
45
|
+
};
|
|
46
|
+
})[];
|
|
47
|
+
} | {
|
|
48
|
+
readonly [x: string]: unknown;
|
|
49
|
+
readonly content: string | null;
|
|
50
|
+
readonly role: "assistant";
|
|
51
|
+
readonly reasoning?: string | undefined;
|
|
52
|
+
readonly reasoning_content?: string | undefined;
|
|
53
|
+
readonly reasoning_text?: string | undefined;
|
|
54
|
+
readonly cache_control?: {
|
|
55
|
+
readonly type: "ephemeral";
|
|
56
|
+
readonly ttl?: string | undefined;
|
|
57
|
+
} | undefined;
|
|
58
|
+
readonly tool_calls?: readonly {
|
|
59
|
+
readonly id: string;
|
|
60
|
+
readonly type: "function";
|
|
61
|
+
readonly function: {
|
|
62
|
+
readonly name: string;
|
|
63
|
+
readonly arguments: string;
|
|
64
|
+
};
|
|
65
|
+
}[] | undefined;
|
|
66
|
+
readonly reasoning_details?: unknown;
|
|
67
|
+
} | {
|
|
68
|
+
readonly content: string;
|
|
69
|
+
readonly role: "tool";
|
|
70
|
+
readonly tool_call_id: string;
|
|
71
|
+
readonly cache_control?: {
|
|
72
|
+
readonly type: "ephemeral";
|
|
73
|
+
readonly ttl?: string | undefined;
|
|
74
|
+
} | undefined;
|
|
75
|
+
})[];
|
|
76
|
+
readonly stream: true;
|
|
77
|
+
readonly max_completion_tokens?: number | undefined;
|
|
78
|
+
readonly max_tokens?: number | undefined;
|
|
79
|
+
readonly tools?: readonly {
|
|
80
|
+
readonly function: {
|
|
81
|
+
readonly description: string;
|
|
82
|
+
readonly name: string;
|
|
83
|
+
readonly parameters: {
|
|
84
|
+
readonly [x: string]: unknown;
|
|
85
|
+
};
|
|
86
|
+
readonly strict?: boolean | undefined;
|
|
87
|
+
};
|
|
88
|
+
readonly type: "function";
|
|
89
|
+
readonly cache_control?: {
|
|
90
|
+
readonly type: "ephemeral";
|
|
91
|
+
readonly ttl?: string | undefined;
|
|
92
|
+
} | undefined;
|
|
93
|
+
}[] | undefined;
|
|
94
|
+
readonly stop?: readonly string[] | undefined;
|
|
95
|
+
readonly temperature?: number | undefined;
|
|
96
|
+
readonly seed?: number | undefined;
|
|
97
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
98
|
+
readonly type: "function";
|
|
99
|
+
readonly function: {
|
|
100
|
+
readonly name: string;
|
|
101
|
+
};
|
|
102
|
+
} | undefined;
|
|
103
|
+
readonly top_p?: number | undefined;
|
|
104
|
+
readonly frequency_penalty?: number | undefined;
|
|
105
|
+
readonly presence_penalty?: number | undefined;
|
|
106
|
+
readonly prompt_cache_key?: string | undefined;
|
|
107
|
+
readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
108
|
+
readonly store?: boolean | undefined;
|
|
109
|
+
readonly stream_options?: {
|
|
110
|
+
readonly include_usage: boolean;
|
|
111
|
+
} | undefined;
|
|
112
|
+
readonly tool_stream?: boolean | undefined;
|
|
113
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
|
|
114
|
+
export declare const routes: Route<{
|
|
115
|
+
readonly model: string;
|
|
116
|
+
readonly messages: readonly ({
|
|
117
|
+
readonly role: "system";
|
|
118
|
+
readonly content: string | readonly ({
|
|
119
|
+
readonly type: "text";
|
|
120
|
+
readonly text: string;
|
|
121
|
+
readonly cache_control?: {
|
|
122
|
+
readonly type: "ephemeral";
|
|
123
|
+
readonly ttl?: string | undefined;
|
|
124
|
+
} | undefined;
|
|
125
|
+
} | {
|
|
126
|
+
readonly type: "image_url";
|
|
127
|
+
readonly image_url: {
|
|
128
|
+
readonly url: string;
|
|
129
|
+
};
|
|
130
|
+
})[];
|
|
131
|
+
} | {
|
|
132
|
+
readonly role: "user";
|
|
133
|
+
readonly content: string | readonly ({
|
|
134
|
+
readonly type: "text";
|
|
135
|
+
readonly text: string;
|
|
136
|
+
readonly cache_control?: {
|
|
137
|
+
readonly type: "ephemeral";
|
|
138
|
+
readonly ttl?: string | undefined;
|
|
139
|
+
} | undefined;
|
|
140
|
+
} | {
|
|
141
|
+
readonly type: "image_url";
|
|
142
|
+
readonly image_url: {
|
|
143
|
+
readonly url: string;
|
|
144
|
+
};
|
|
145
|
+
})[];
|
|
146
|
+
} | {
|
|
147
|
+
readonly [x: string]: unknown;
|
|
148
|
+
readonly content: string | null;
|
|
149
|
+
readonly role: "assistant";
|
|
150
|
+
readonly reasoning?: string | undefined;
|
|
151
|
+
readonly reasoning_content?: string | undefined;
|
|
152
|
+
readonly reasoning_text?: string | undefined;
|
|
153
|
+
readonly cache_control?: {
|
|
154
|
+
readonly type: "ephemeral";
|
|
155
|
+
readonly ttl?: string | undefined;
|
|
156
|
+
} | undefined;
|
|
157
|
+
readonly tool_calls?: readonly {
|
|
158
|
+
readonly id: string;
|
|
159
|
+
readonly type: "function";
|
|
160
|
+
readonly function: {
|
|
161
|
+
readonly name: string;
|
|
162
|
+
readonly arguments: string;
|
|
163
|
+
};
|
|
164
|
+
}[] | undefined;
|
|
165
|
+
readonly reasoning_details?: unknown;
|
|
166
|
+
} | {
|
|
167
|
+
readonly content: string;
|
|
168
|
+
readonly role: "tool";
|
|
169
|
+
readonly tool_call_id: string;
|
|
170
|
+
readonly cache_control?: {
|
|
171
|
+
readonly type: "ephemeral";
|
|
172
|
+
readonly ttl?: string | undefined;
|
|
173
|
+
} | undefined;
|
|
174
|
+
})[];
|
|
175
|
+
readonly stream: true;
|
|
176
|
+
readonly max_completion_tokens?: number | undefined;
|
|
177
|
+
readonly max_tokens?: number | undefined;
|
|
178
|
+
readonly tools?: readonly {
|
|
179
|
+
readonly function: {
|
|
180
|
+
readonly description: string;
|
|
181
|
+
readonly name: string;
|
|
182
|
+
readonly parameters: {
|
|
183
|
+
readonly [x: string]: unknown;
|
|
184
|
+
};
|
|
185
|
+
readonly strict?: boolean | undefined;
|
|
186
|
+
};
|
|
187
|
+
readonly type: "function";
|
|
188
|
+
readonly cache_control?: {
|
|
189
|
+
readonly type: "ephemeral";
|
|
190
|
+
readonly ttl?: string | undefined;
|
|
191
|
+
} | undefined;
|
|
192
|
+
}[] | undefined;
|
|
193
|
+
readonly stop?: readonly string[] | undefined;
|
|
194
|
+
readonly temperature?: number | undefined;
|
|
195
|
+
readonly seed?: number | undefined;
|
|
196
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
197
|
+
readonly type: "function";
|
|
198
|
+
readonly function: {
|
|
199
|
+
readonly name: string;
|
|
200
|
+
};
|
|
201
|
+
} | undefined;
|
|
202
|
+
readonly top_p?: number | undefined;
|
|
203
|
+
readonly frequency_penalty?: number | undefined;
|
|
204
|
+
readonly presence_penalty?: number | undefined;
|
|
205
|
+
readonly prompt_cache_key?: string | undefined;
|
|
206
|
+
readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
207
|
+
readonly store?: boolean | undefined;
|
|
208
|
+
readonly stream_options?: {
|
|
209
|
+
readonly include_usage: boolean;
|
|
210
|
+
} | undefined;
|
|
211
|
+
readonly tool_stream?: boolean | undefined;
|
|
212
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
|
|
213
|
+
export declare const configure: (input?: LanguageModelOptions) => {
|
|
214
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
215
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
216
|
+
configure: (input?: LanguageModelOptions) => /*elided*/ any;
|
|
217
|
+
};
|
|
218
|
+
export declare const provider: {
|
|
219
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
220
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
221
|
+
configure: (input?: LanguageModelOptions) => {
|
|
222
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
223
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
224
|
+
configure: /*elided*/ any;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
228
|
+
export * as DeepSeek from "./deepseek.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { Endpoint } from "../route/endpoint.js";
|
|
5
|
+
import { ProviderID } from "../schema/index.js";
|
|
6
|
+
export const id = ProviderID.make("deepseek");
|
|
7
|
+
const baseURL = "https://api.deepseek.com/v1";
|
|
8
|
+
export const route = Route.make({
|
|
9
|
+
id: "deepseek-chat",
|
|
10
|
+
provider: id,
|
|
11
|
+
providerMetadataKey: "deepseek",
|
|
12
|
+
protocol: OpenAIChat.protocol,
|
|
13
|
+
endpoint: Endpoint.path("/chat/completions", { baseURL }),
|
|
14
|
+
framing: OpenAIChat.framing,
|
|
15
|
+
});
|
|
16
|
+
export const routes = [route];
|
|
17
|
+
export const configure = (input = {}) => {
|
|
18
|
+
const { apiKey: _apiKey, auth: _auth, baseURL: endpoint, ...defaults } = input;
|
|
19
|
+
const configured = route.with({
|
|
20
|
+
...defaults,
|
|
21
|
+
endpoint: { baseURL: endpoint ?? baseURL },
|
|
22
|
+
auth: AuthOptions.bearer(input, "DEEPSEEK_API_KEY"),
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
id,
|
|
26
|
+
model: (modelID) => configured.model({
|
|
27
|
+
id: modelID,
|
|
28
|
+
compatibility: { maxTokensField: "max_tokens", supportsStore: false },
|
|
29
|
+
}),
|
|
30
|
+
configure,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export const provider = configure();
|
|
34
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
35
|
+
apiKey,
|
|
36
|
+
baseURL,
|
|
37
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
38
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
39
|
+
providerOptions,
|
|
40
|
+
}).model(modelID);
|
|
41
|
+
export * as DeepSeek from "./deepseek.js";
|