@opencode-ai/ai
Advanced tools
+22
-19
| import { type ProviderAuthOption } from "../route/auth-options"; | ||
| import type { RouteDefaultsInput } from "../route/client"; | ||
| import { type ModelID } from "../schema"; | ||
| import type { OpenAIProviderOptionsInput } from "./openai-options"; | ||
| import { Route, type RouteDefaultsInput } from "../route/client"; | ||
| import { type ModelID, type ProviderOptions } from "../schema"; | ||
| import type { OpenAIOptionsInput } from "./openai-options"; | ||
| import type { ProviderPackage } from "../provider-package"; | ||
| export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">; | ||
| export type XAIProviderOptionsInput = ProviderOptions & { | ||
| readonly xai?: OpenAIOptionsInput; | ||
| }; | ||
| export type ModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & { | ||
| readonly baseURL?: string; | ||
| readonly providerOptions?: OpenAIProviderOptionsInput; | ||
| readonly providerOptions?: XAIProviderOptionsInput; | ||
| }; | ||
@@ -14,6 +17,6 @@ export interface Settings extends ProviderPackage.Settings { | ||
| readonly baseURL?: string; | ||
| readonly providerOptions?: OpenAIProviderOptionsInput; | ||
| readonly providerOptions?: XAIProviderOptionsInput; | ||
| } | ||
| export type { XAIImageOptions } from "../protocols/xai-images"; | ||
| export declare const routes: (import("../route").Route<{ | ||
| export declare const routes: (Route<{ | ||
| readonly model: string; | ||
@@ -84,3 +87,3 @@ readonly messages: readonly ({ | ||
| readonly reasoning_effort?: string | undefined; | ||
| }, import("../route/transport/http").HttpPrepared<string>> | import("../route").Route<{ | ||
| }, import("../route/transport/http").HttpPrepared<string>> | Route<{ | ||
| readonly input: readonly ({ | ||
@@ -194,5 +197,5 @@ readonly type: "reasoning"; | ||
| id: string & import("effect/Brand").Brand<"LLM.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>; | ||
| responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>; | ||
| chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>; | ||
| model: (modelID: string | ModelID) => import("..").Model<XAIProviderOptionsInput>; | ||
| responses: (modelID: string | ModelID) => import("..").Model<XAIProviderOptionsInput>; | ||
| chat: (modelID: string | ModelID) => import("..").Model<XAIProviderOptionsInput>; | ||
| image: (modelID: string | ModelID) => import("..").ImageModel<import("./xai").XAIImageOptions>; | ||
@@ -203,11 +206,11 @@ configure: (input?: ModelOptions) => /*elided*/ any; | ||
| id: string & import("effect/Brand").Brand<"LLM.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>; | ||
| responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>; | ||
| chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>; | ||
| model: (modelID: string | ModelID) => import("..").Model<XAIProviderOptionsInput>; | ||
| responses: (modelID: string | ModelID) => import("..").Model<XAIProviderOptionsInput>; | ||
| chat: (modelID: string | ModelID) => import("..").Model<XAIProviderOptionsInput>; | ||
| image: (modelID: string | ModelID) => import("..").ImageModel<import("./xai").XAIImageOptions>; | ||
| configure: (input?: ModelOptions) => { | ||
| id: string & import("effect/Brand").Brand<"LLM.ProviderID">; | ||
| model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>; | ||
| responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>; | ||
| chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>; | ||
| model: (modelID: string | ModelID) => import("..").Model<XAIProviderOptionsInput>; | ||
| responses: (modelID: string | ModelID) => import("..").Model<XAIProviderOptionsInput>; | ||
| chat: (modelID: string | ModelID) => import("..").Model<XAIProviderOptionsInput>; | ||
| image: (modelID: string | ModelID) => import("..").ImageModel<import("./xai").XAIImageOptions>; | ||
@@ -217,5 +220,5 @@ configure: /*elided*/ any; | ||
| }; | ||
| export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"]; | ||
| export declare const responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>; | ||
| export declare const chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>; | ||
| export declare const model: ProviderPackage.Definition<Settings, XAIProviderOptionsInput>["model"]; | ||
| export declare const responses: (modelID: string | ModelID) => import("..").Model<XAIProviderOptionsInput>; | ||
| export declare const chat: (modelID: string | ModelID) => import("..").Model<XAIProviderOptionsInput>; | ||
| export declare const image: (modelID: string | ModelID) => import("..").ImageModel<import("./xai").XAIImageOptions>; |
| import { AuthOptions } from "../route/auth-options"; | ||
| import { Route } from "../route/client"; | ||
| import { Endpoint } from "../route/endpoint"; | ||
| import { HttpOptions, ProviderID } from "../schema"; | ||
| import * as OpenAICompatibleProfiles from "./openai-compatible-profile"; | ||
| import * as OpenAICompatibleChat from "../protocols/openai-compatible-chat"; | ||
| import * as OpenAIChat from "../protocols/openai-chat"; | ||
| import * as OpenAIResponses from "../protocols/openai-responses"; | ||
| import { XAIImages } from "../protocols/xai-images"; | ||
| export const id = ProviderID.make("xai"); | ||
| export const routes = [OpenAIResponses.route, OpenAICompatibleChat.route]; | ||
| const responsesRoute = Route.make({ | ||
| id: "openai-responses", | ||
| provider: id, | ||
| providerMetadataKey: "xai", | ||
| protocol: OpenAIResponses.protocol, | ||
| endpoint: Endpoint.path("/responses", { baseURL: OpenAICompatibleProfiles.profiles.xai.baseURL }), | ||
| transport: OpenAIResponses.httpTransport, | ||
| defaults: { providerOptions: { xai: { store: false } } }, | ||
| }); | ||
| const chatRoute = Route.make({ | ||
| id: "openai-compatible-chat", | ||
| provider: id, | ||
| providerMetadataKey: "xai", | ||
| protocol: OpenAIChat.protocol, | ||
| endpoint: Endpoint.path("/chat/completions", { baseURL: OpenAICompatibleProfiles.profiles.xai.baseURL }), | ||
| transport: OpenAICompatibleChat.route.transport, | ||
| }); | ||
| export const routes = [responsesRoute, chatRoute]; | ||
| const auth = (options) => AuthOptions.bearer(options, "XAI_API_KEY"); | ||
| const configuredResponsesRoute = (input) => { | ||
| const { apiKey: _, auth: _auth, baseURL, ...rest } = input; | ||
| return OpenAIResponses.route.with({ | ||
| return responsesRoute.with({ | ||
| ...rest, | ||
| provider: id, | ||
| endpoint: { baseURL: baseURL ?? OpenAICompatibleProfiles.profiles.xai.baseURL }, | ||
@@ -21,5 +40,4 @@ auth: auth(input), | ||
| const { apiKey: _, auth: _auth, baseURL, ...rest } = input; | ||
| return OpenAICompatibleChat.route.with({ | ||
| return chatRoute.with({ | ||
| ...rest, | ||
| provider: id, | ||
| endpoint: { baseURL: baseURL ?? OpenAICompatibleProfiles.profiles.xai.baseURL }, | ||
@@ -26,0 +44,0 @@ auth: auth(input), |
+3
-3
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "version": "0.0.0-next-16531", | ||
| "version": "0.0.0-next-16535", | ||
| "name": "@opencode-ai/ai", | ||
@@ -33,3 +33,3 @@ "type": "module", | ||
| "@effect/platform-node": "4.0.0-beta.101", | ||
| "@opencode-ai/http-recorder": "0.0.0-next-16531", | ||
| "@opencode-ai/http-recorder": "0.0.0-next-16535", | ||
| "@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-next-16531", | ||
| "@opencode-ai/schema": "0.0.0-next-16535", | ||
| "aws4fetch": "1.0.20", | ||
@@ -46,0 +46,0 @@ "effect": "4.0.0-beta.101", |
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.
1076901
0.07%25155
0.08%+ Added
- Removed