fix: use OpenCode model catalog URL (#39672)

Co-authored-by: Dax Raad <d@ironbay.co>
This commit is contained in:
opencode-agent[bot] 2026-07-30 10:12:08 -04:00 committed by GitHub
commit a4f25a94b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 8 additions and 8 deletions

View file

@ -1,4 +1,4 @@
const modelsUrl = process.env.OPENCODE_MODELS_URL || "https://models.dev" const modelsUrl = process.env.OPENCODE_MODELS_URL || "https://models.opencode.ai"
export const modelsData = process.env.MODELS_DEV_API_JSON export const modelsData = process.env.MODELS_DEV_API_JSON
? await Bun.file(process.env.MODELS_DEV_API_JSON).text() ? await Bun.file(process.env.MODELS_DEV_API_JSON).text()

View file

@ -151,10 +151,10 @@ const layer = Layer.effect(
), ),
) )
const source = Flag.OPENCODE_MODELS_URL || "https://models.dev" const source = Flag.OPENCODE_MODELS_URL || "https://models.opencode.ai"
const filepath = path.join( const filepath = path.join(
Global.Path.cache, Global.Path.cache,
source === "https://models.dev" ? "models.json" : `models-${Hash.fast(source)}.json`, source === "https://models.opencode.ai" ? "models.json" : `models-${Hash.fast(source)}.json`,
) )
const ttl = Duration.minutes(5) const ttl = Duration.minutes(5)
const lockKey = `models-dev:${filepath}` const lockKey = `models-dev:${filepath}`

View file

@ -2,7 +2,7 @@ import * as fs from "node:fs/promises"
import * as path from "node:path" import * as path from "node:path"
const RECORDINGS_DIR = path.resolve(import.meta.dir, "..", "test", "fixtures", "recordings") const RECORDINGS_DIR = path.resolve(import.meta.dir, "..", "test", "fixtures", "recordings")
const MODELS_DEV_URL = "https://models.dev/api.json" const MODELS_DEV_URL = "https://models.opencode.ai/api.json"
type JsonRecord = Record<string, unknown> type JsonRecord = Record<string, unknown>

View file

@ -1,8 +1,8 @@
import { query } from "@solidjs/router" import { query } from "@solidjs/router"
export const modelCatalogSourceUrl = "https://models.dev/catalog.json" export const modelCatalogSourceUrl = "https://models.opencode.ai/catalog.json"
export const modelCatalogPricingUrl = "https://models.dev/api.json" export const modelCatalogPricingUrl = "https://models.opencode.ai/api.json"
export const modelCatalogLabSourceUrl = "https://models.dev/labs" export const modelCatalogLabSourceUrl = "https://models.opencode.ai/labs"
export type ModelCatalogCost = { export type ModelCatalogCost = {
input: number input: number

View file

@ -45,7 +45,7 @@ function providerIconsPlugin() {
} }
async function fetchProviderIcons() { async function fetchProviderIcons() {
const url = process.env.OPENCODE_MODELS_URL || "https://models.dev" const url = process.env.OPENCODE_MODELS_URL || "https://models.opencode.ai"
const providers = await fetch(`${url}/api.json`) const providers = await fetch(`${url}/api.json`)
.then((res) => res.json()) .then((res) => res.json())
.then((json) => Object.keys(json)) .then((json) => Object.keys(json))