MCPcopy Create free account
hub / github.com/anomalyco/opencode / fromModelsDevModel

Function fromModelsDevModel

packages/opencode/src/provider/provider.ts:1188–1237  ·  view source on GitHub ↗
(provider: ModelsDev.Provider, model: ModelsDev.Model)

Source from the content-addressed store, hash-verified

1186}
1187
1188function fromModelsDevModel(provider: ModelsDev.Provider, model: ModelsDev.Model): Model {
1189 const base: Model = {
1190 id: ModelV2.ID.make(model.id),
1191 providerID: ProviderV2.ID.make(provider.id),
1192 name: model.name,
1193 family: model.family,
1194 api: {
1195 id: model.id,
1196 url: model.provider?.api ?? provider.api ?? "",
1197 npm: model.provider?.npm ?? provider.npm ?? "@ai-sdk/openai-compatible",
1198 },
1199 status: model.status ?? "active",
1200 headers: {},
1201 options: {},
1202 cost: cost(model.cost),
1203 limit: {
1204 context: model.limit.context,
1205 input: model.limit.input,
1206 output: model.limit.output,
1207 },
1208 capabilities: {
1209 temperature: model.temperature ?? false,
1210 reasoning: model.reasoning ?? false,
1211 attachment: model.attachment ?? false,
1212 toolcall: model.tool_call ?? true,
1213 input: {
1214 text: model.modalities?.input?.includes("text") ?? false,
1215 audio: model.modalities?.input?.includes("audio") ?? false,
1216 image: model.modalities?.input?.includes("image") ?? false,
1217 video: model.modalities?.input?.includes("video") ?? false,
1218 pdf: model.modalities?.input?.includes("pdf") ?? false,
1219 },
1220 output: {
1221 text: model.modalities?.output?.includes("text") ?? false,
1222 audio: model.modalities?.output?.includes("audio") ?? false,
1223 image: model.modalities?.output?.includes("image") ?? false,
1224 video: model.modalities?.output?.includes("video") ?? false,
1225 pdf: model.modalities?.output?.includes("pdf") ?? false,
1226 },
1227 interleaved: model.interleaved ?? false,
1228 },
1229 release_date: model.release_date ?? "",
1230 variants: {},
1231 }
1232
1233 return {
1234 ...base,
1235 variants: mapValues(ProviderTransform.variants(base), (v) => v),
1236 }
1237}
1238
1239export function fromModelsDevProvider(provider: ModelsDev.Provider): Info {
1240 const models: Record<string, Model> = {}

Callers 1

fromModelsDevProviderFunction · 0.85

Calls 2

costFunction · 0.70
makeMethod · 0.45

Tested by

no test coverage detected