MCPcopy Index your code
hub / github.com/anomalyco/opencode / withDefaults

Function withDefaults

packages/core/src/session/runner/model.ts:90–102  ·  view source on GitHub ↗
(model: ModelV2.Info, route: AnyRoute)

Source from the content-addressed store, hash-verified

88}
89
90const withDefaults = (model: ModelV2.Info, route: AnyRoute) => {
91 const body = model.request.body
92 const httpBody = Object.hasOwn(body, "apiKey")
93 ? Object.fromEntries(Object.entries(body).filter(([key]) => key !== "apiKey"))
94 : body
95 return route.with({
96 provider: model.providerID,
97 endpoint: model.api.url === undefined ? undefined : { baseURL: model.api.url },
98 headers: model.request.headers,
99 http: { body: httpBody },
100 limits: { context: model.limit.context, output: model.limit.output },
101 })
102}
103
104const withVariant = (
105 model: ModelV2.Info,

Callers 1

fromCatalogModelFunction · 0.85

Calls 1

withMethod · 0.80

Tested by

no test coverage detected