Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion common/src/constants/model-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export type openrouterModel =
(typeof openrouterModels)[keyof typeof openrouterModels]

export const openCodeZenModels = {
opencode_minimax_m2_7: 'opencode/minimax-m2.7',
opencode_kimi_k2_6: 'opencode/kimi-k2.6',
} as const
export type OpenCodeZenModel =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -869,10 +869,9 @@ describe('/api/v1/chat/completions POST endpoint', () => {
)

it(
'routes opencode/-prefixed models to the OpenCode Zen provider',
'routes OpenCode Zen models to the direct OpenCode Zen provider',
async () => {
const expectedUpstreamModel: Record<string, string> = {
'opencode/minimax-m2.7': 'minimax-m2.7',
'opencode/kimi-k2.6': 'kimi-k2.6',
}

Expand Down
19 changes: 3 additions & 16 deletions web/src/llm-api/opencode-zen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ const OPENCODE_ZEN_MODELS: Record<
string,
{ opencodeId: string; pricing: OpenCodeZenPricing }
> = {
[openCodeZenModels.opencode_minimax_m2_7]: {
opencodeId: 'minimax-m2.7',
pricing: {
inputCostPerToken: 0.3 / 1_000_000,
cachedInputCostPerToken: 0.06 / 1_000_000,
outputCostPerToken: 1.2 / 1_000_000,
},
},
[openCodeZenModels.opencode_kimi_k2_6]: {
opencodeId: 'kimi-k2.6',
pricing: {
Expand All @@ -56,17 +48,12 @@ const OPENCODE_ZEN_MODELS: Record<
},
}

const OPENCODE_ZEN_MODEL_PREFIX = 'opencode/'

export function isOpenCodeZenModel(model: unknown): model is string {
return typeof model === 'string' && model.startsWith(OPENCODE_ZEN_MODEL_PREFIX)
export function isOpenCodeZenModel(model: string): boolean {
return model in OPENCODE_ZEN_MODELS
}

function getOpenCodeZenModelId(model: string): string {
return (
OPENCODE_ZEN_MODELS[model]?.opencodeId ??
model.slice(OPENCODE_ZEN_MODEL_PREFIX.length)
)
return OPENCODE_ZEN_MODELS[model]?.opencodeId ?? model
}

function getOpenCodeZenPricing(model: string): OpenCodeZenPricing {
Expand Down
Loading