@opencode-ai/ai 0.0.0-next-16498 → 0.0.0-next-16500

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.
@@ -3,6 +3,7 @@ import { Route, type RouteDefaultsInput } from "../route/client";
3
3
  import { Protocol } from "../route/protocol";
4
4
  import { type ProviderAuthOption } from "../route/auth-options";
5
5
  import { type ModelID, type ProviderOptions } from "../schema";
6
+ import type { ProviderPackage } from "../provider-package";
6
7
  import * as OpenAIChat from "../protocols/openai-chat";
7
8
  export declare const profile: {
8
9
  readonly provider: "openrouter";
@@ -22,6 +23,11 @@ export type ModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & Provide
22
23
  readonly baseURL?: string;
23
24
  readonly providerOptions?: OpenRouterProviderOptionsInput;
24
25
  };
26
+ export interface Settings extends ProviderPackage.Settings {
27
+ readonly apiKey?: string;
28
+ readonly baseURL?: string;
29
+ readonly providerOptions?: OpenRouterProviderOptionsInput;
30
+ }
25
31
  declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
26
32
  model: Schema.String;
27
33
  messages: Schema.$Array<Schema.toTaggedUnion<"role", readonly [Schema.Struct<{
@@ -342,5 +348,5 @@ export declare const provider: {
342
348
  configure: /*elided*/ any;
343
349
  };
344
350
  };
345
- export declare const model: (modelID: string | ModelID) => import("..").Model<OpenRouterProviderOptionsInput>;
351
+ export declare const model: ProviderPackage.Definition<Settings, OpenRouterProviderOptionsInput>["model"];
346
352
  export {};
@@ -84,4 +84,11 @@ export const configure = (input = {}) => {
84
84
  };
85
85
  };
86
86
  export const provider = configure();
87
- export const model = provider.model;
87
+ export const model = (modelID, settings) => configure({
88
+ apiKey: settings.apiKey,
89
+ baseURL: settings.baseURL,
90
+ headers: settings.headers,
91
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
92
+ limits: settings.limits,
93
+ providerOptions: settings.providerOptions,
94
+ }).model(modelID);
@@ -2,11 +2,17 @@ import { type ProviderAuthOption } from "../route/auth-options";
2
2
  import type { RouteDefaultsInput } from "../route/client";
3
3
  import { type ModelID } from "../schema";
4
4
  import type { OpenAIProviderOptionsInput } from "./openai-options";
5
+ import type { ProviderPackage } from "../provider-package";
5
6
  export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
6
7
  export type ModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
7
8
  readonly baseURL?: string;
8
9
  readonly providerOptions?: OpenAIProviderOptionsInput;
9
10
  };
11
+ export interface Settings extends ProviderPackage.Settings {
12
+ readonly apiKey?: string;
13
+ readonly baseURL?: string;
14
+ readonly providerOptions?: OpenAIProviderOptionsInput;
15
+ }
10
16
  export type { XAIImageOptions } from "../protocols/xai-images";
11
17
  export declare const routes: (import("../route").Route<{
12
18
  readonly model: string;
@@ -204,7 +210,7 @@ export declare const provider: {
204
210
  configure: /*elided*/ any;
205
211
  };
206
212
  };
207
- export declare const model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
213
+ export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
208
214
  export declare const responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
209
215
  export declare const chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
210
216
  export declare const image: (modelID: string | ModelID) => import("..").ImageModel<import("./xai").XAIImageOptions>;
@@ -47,7 +47,14 @@ export const configure = (input = {}) => {
47
47
  };
48
48
  };
49
49
  export const provider = configure();
50
- export const model = provider.model;
50
+ export const model = (modelID, settings) => configure({
51
+ apiKey: settings.apiKey,
52
+ baseURL: settings.baseURL,
53
+ headers: settings.headers,
54
+ http: settings.body === undefined ? undefined : { body: { ...settings.body } },
55
+ limits: settings.limits,
56
+ providerOptions: settings.providerOptions,
57
+ }).model(modelID);
51
58
  export const responses = provider.responses;
52
59
  export const chat = provider.chat;
53
60
  export const image = provider.image;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.0.0-next-16498",
3
+ "version": "0.0.0-next-16500",
4
4
  "name": "@opencode-ai/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@clack/prompts": "1.0.0-alpha.1",
32
32
  "@effect/platform-node": "4.0.0-beta.101",
33
- "@opencode-ai/http-recorder": "0.0.0-next-16498",
33
+ "@opencode-ai/http-recorder": "0.0.0-next-16500",
34
34
  "@tsconfig/bun": "1.0.9",
35
35
  "@types/bun": "1.3.13",
36
36
  "@typescript/native-preview": "7.0.0-dev.20251207.1",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@smithy/eventstream-codec": "4.2.14",
41
41
  "@smithy/util-utf8": "4.2.2",
42
- "@opencode-ai/schema": "0.0.0-next-16498",
42
+ "@opencode-ai/schema": "0.0.0-next-16500",
43
43
  "aws4fetch": "1.0.20",
44
44
  "effect": "4.0.0-beta.101",
45
45
  "google-auth-library": "10.5.0"