@opencode-ai/ai
Advanced tools
| import type { ProviderPackage } from "../provider-package.js"; | ||
| import { type ProviderAuthOption } from "../route/auth-options.js"; | ||
| import type { RouteDefaultsInput } from "../route/client.js"; | ||
| import { type ModelID } from "../schema/index.js"; | ||
| import type { OpenAIProviderOptionsInput } from "./openai-options.js"; | ||
| export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & { | ||
| readonly baseURL?: string; | ||
| readonly providerOptions?: OpenAIProviderOptionsInput; | ||
| }; | ||
| export interface Settings extends ProviderPackage.Settings { | ||
| readonly apiKey?: string; | ||
| readonly baseURL?: string; | ||
| readonly providerOptions?: OpenAIProviderOptionsInput; | ||
| } | ||
| export declare const route: import("../route/client.js").Route<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly content: string | null; | ||
| readonly role: "assistant"; | ||
| readonly reasoning?: string | undefined; | ||
| readonly reasoning_content?: string | undefined; | ||
| readonly reasoning_text?: string | undefined; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly reasoning_details?: unknown; | ||
| } | { | ||
| readonly content: string; | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_completion_tokens?: number | undefined; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly function: { | ||
| readonly description: string; | ||
| readonly name: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict?: boolean | undefined; | ||
| }; | ||
| readonly type: "function"; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly seed?: number | undefined; | ||
| readonly tool_choice?: "required" | "auto" | "none" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly store?: boolean | undefined; | ||
| readonly stream_options?: { | ||
| readonly include_usage: boolean; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>; | ||
| export declare const routes: import("../route/client.js").Route<{ | ||
| readonly model: string; | ||
| readonly messages: readonly ({ | ||
| readonly role: "system"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly role: "user"; | ||
| readonly content: string | readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| } | { | ||
| readonly type: "image_url"; | ||
| readonly image_url: { | ||
| readonly url: string; | ||
| }; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly content: string | null; | ||
| readonly role: "assistant"; | ||
| readonly reasoning?: string | undefined; | ||
| readonly reasoning_content?: string | undefined; | ||
| readonly reasoning_text?: string | undefined; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| readonly tool_calls?: readonly { | ||
| readonly id: string; | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| readonly arguments: string; | ||
| }; | ||
| }[] | undefined; | ||
| readonly reasoning_details?: unknown; | ||
| } | { | ||
| readonly content: string; | ||
| readonly role: "tool"; | ||
| readonly tool_call_id: string; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| })[]; | ||
| readonly stream: true; | ||
| readonly max_completion_tokens?: number | undefined; | ||
| readonly max_tokens?: number | undefined; | ||
| readonly tools?: readonly { | ||
| readonly function: { | ||
| readonly description: string; | ||
| readonly name: string; | ||
| readonly parameters: { | ||
| readonly [x: string]: unknown; | ||
| }; | ||
| readonly strict?: boolean | undefined; | ||
| }; | ||
| readonly type: "function"; | ||
| readonly cache_control?: { | ||
| readonly type: "ephemeral"; | ||
| readonly ttl?: string | undefined; | ||
| } | undefined; | ||
| }[] | undefined; | ||
| readonly stop?: readonly string[] | undefined; | ||
| readonly temperature?: number | undefined; | ||
| readonly seed?: number | undefined; | ||
| readonly tool_choice?: "required" | "auto" | "none" | { | ||
| readonly type: "function"; | ||
| readonly function: { | ||
| readonly name: string; | ||
| }; | ||
| } | undefined; | ||
| readonly top_p?: number | undefined; | ||
| readonly store?: boolean | undefined; | ||
| readonly stream_options?: { | ||
| readonly include_usage: boolean; | ||
| } | undefined; | ||
| readonly prompt_cache_key?: string | undefined; | ||
| readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined; | ||
| readonly tool_stream?: boolean | undefined; | ||
| readonly frequency_penalty?: number | undefined; | ||
| readonly presence_penalty?: number | undefined; | ||
| }, import("../route/transport/http.js").HttpPrepared<string>>[]; | ||
| export declare const configure: (input?: LanguageModelOptions) => { | ||
| id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>; | ||
| configure: (input?: LanguageModelOptions) => /*elided*/ any; | ||
| }; | ||
| export declare const provider: { | ||
| id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>; | ||
| configure: (input?: LanguageModelOptions) => { | ||
| id: string & import("effect/Brand").Brand<"AI.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput>; | ||
| configure: /*elided*/ any; | ||
| }; | ||
| }; | ||
| export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"]; |
| import { OpenAICompatibleChat } from "../protocols/openai-compatible-chat.js"; | ||
| import { AuthOptions } from "../route/auth-options.js"; | ||
| import { ProviderID } from "../schema/index.js"; | ||
| import { profiles } from "./openai-compatible-profile.js"; | ||
| export const id = ProviderID.make("deepinfra"); | ||
| export const route = OpenAICompatibleChat.route.with({ | ||
| id: "deepinfra-chat", | ||
| provider: id, | ||
| endpoint: { baseURL: profiles.deepinfra.baseURL }, | ||
| }); | ||
| export const routes = [route]; | ||
| export const configure = (input = {}) => { | ||
| const { apiKey: _apiKey, auth: _auth, baseURL, ...defaults } = input; | ||
| const root = baseURL?.replace(/\/+$/, ""); | ||
| const configured = route.with({ | ||
| ...defaults, | ||
| endpoint: { | ||
| baseURL: root === undefined ? profiles.deepinfra.baseURL : root.endsWith("/openai") ? root : `${root}/openai`, | ||
| }, | ||
| auth: AuthOptions.bearer(input, "DEEPINFRA_API_KEY"), | ||
| }); | ||
| return { | ||
| id, | ||
| model: (modelID) => configured.model({ | ||
| id: modelID, | ||
| compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning_content", supportsStore: false }, | ||
| }), | ||
| configure, | ||
| }; | ||
| }; | ||
| export const provider = configure(); | ||
| export const model = (modelID, settings) => configure({ | ||
| apiKey: settings.apiKey, | ||
| baseURL: settings.baseURL, | ||
| headers: settings.headers === undefined ? undefined : { ...settings.headers }, | ||
| http: settings.body === undefined ? undefined : { body: { ...settings.body } }, | ||
| providerOptions: settings.providerOptions, | ||
| }).model(modelID); |
@@ -9,2 +9,3 @@ export * as Anthropic from "./anthropic.js"; | ||
| export { CloudflareAIGateway, CloudflareWorkersAI } from "./cloudflare.js"; | ||
| export * as DeepInfra from "./deepinfra.js"; | ||
| export * as Google from "./google.js"; | ||
@@ -11,0 +12,0 @@ export * as GoogleVertex from "./google-vertex.js"; |
@@ -9,2 +9,3 @@ export * as Anthropic from "./anthropic.js"; | ||
| export { CloudflareAIGateway, CloudflareWorkersAI } from "./cloudflare.js"; | ||
| export * as DeepInfra from "./deepinfra.js"; | ||
| export * as Google from "./google.js"; | ||
@@ -11,0 +12,0 @@ export * as GoogleVertex from "./google-vertex.js"; |
+3
-3
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "version": "0.0.0-dev-18262", | ||
| "version": "0.0.0-dev-18263", | ||
| "name": "@opencode-ai/ai", | ||
@@ -33,3 +33,3 @@ "type": "module", | ||
| "@effect/platform-node": "4.0.0-rc.111", | ||
| "@opencode-ai/http-recorder": "0.0.0-dev-18262", | ||
| "@opencode-ai/http-recorder": "0.0.0-dev-18263", | ||
| "@tsconfig/bun": "1.0.9", | ||
@@ -43,3 +43,3 @@ "@types/bun": "1.3.13", | ||
| "@smithy/util-utf8": "4.2.2", | ||
| "@opencode-ai/schema": "0.0.0-dev-18262", | ||
| "@opencode-ai/schema": "0.0.0-dev-18263", | ||
| "aws4fetch": "1.0.20", | ||
@@ -46,0 +46,0 @@ "effect": "4.0.0-rc.111", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1346543
0.8%210
0.96%30971
0.87%+ Added
- Removed