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

Function apiKey

packages/core/src/session/runner/model.ts:83–88  ·  view source on GitHub ↗
(model: ModelV2.Info, credential?: Credential.Value)

Source from the content-addressed store, hash-verified

81export const layerWith = (resolve: Interface["resolve"]) => Layer.succeed(Service, Service.of({ resolve }))
82
83const apiKey = (model: ModelV2.Info, credential?: Credential.Value) => {
84 if (credential?.type === "key") return Auth.value(credential.key)
85 if (credential?.type === "oauth") return Auth.value(credential.access)
86 const value = model.request.body.apiKey ?? model.api.settings?.apiKey
87 if (typeof value === "string") return Auth.value(value)
88}
89
90const withDefaults = (model: ModelV2.Info, route: AnyRoute) => {
91 const body = model.request.body

Callers 1

fromCatalogModelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected