Skip to content
Closed
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
13 changes: 13 additions & 0 deletions packages/opencode/src/provider/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,13 @@ export namespace Provider {
// extend database from config
for (const [providerID, provider] of configProviders) {
const existing = database[providerID]

// Validate custom providers that have no database entry
if (!existing && !provider.api && !provider.npm && !provider.models) {
log.warn("custom provider has no api, npm, or models — skipping", { providerID })
continue
}

const parsed: Info = {
id: ProviderID.make(providerID),
name: provider.name ?? existing?.name ?? providerID,
Expand Down Expand Up @@ -1175,6 +1182,12 @@ export namespace Provider {
)
parsed.models[modelID] = parsedModel
}

// Warn if custom provider has models with no context limit
if (!existing && Object.values(parsed.models).some((m) => m.limit.context === 0)) {
log.warn("custom provider models have no context limit — set limit.context in config", { providerID })
}

database[providerID] = parsed
}

Expand Down
Loading