Skip to content

Commit 0988ce8

Browse files
committed
fix(opencode): use branded types for litellm ModelID and ProviderID
1 parent e8ce6a8 commit 0988ce8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/opencode/src/provider/litellm.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Log } from "../util/log"
22
import { Env } from "../env"
33
import type { Provider } from "./provider"
4+
import { ModelID, ProviderID } from "./schema"
45

56
export namespace LiteLLM {
67
const log = Log.create({ service: "litellm" })
@@ -75,8 +76,8 @@ export namespace LiteLLM {
7576
const supportsTemperature = info.supported_openai_params?.includes("temperature") ?? true
7677

7778
return {
78-
id: entry.model_name,
79-
providerID: "litellm",
79+
id: ModelID.make(entry.model_name),
80+
providerID: ProviderID.make("litellm"),
8081
name: entry.model_name,
8182
api: {
8283
id: entry.model_name,
@@ -133,8 +134,8 @@ export namespace LiteLLM {
133134

134135
function toBasicModel(id: string): Provider.Model {
135136
return {
136-
id,
137-
providerID: "litellm",
137+
id: ModelID.make(id),
138+
providerID: ProviderID.make("litellm"),
138139
name: id,
139140
api: { id, url: "", npm: "@ai-sdk/openai-compatible" },
140141
status: "active",

packages/opencode/src/provider/provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ export namespace Provider {
947947
// Seed LiteLLM provider so it is always available for interactive configuration
948948
if (!database["litellm"]) {
949949
database["litellm"] = {
950-
id: "litellm",
950+
id: ProviderID.make("litellm"),
951951
name: "LiteLLM",
952952
env: ["LITELLM_API_KEY"],
953953
options: {},

0 commit comments

Comments
 (0)