Skip to content

bug: config provider-level npm override dropped for inherited models #41162

Closed as not planned

Description

@Qiiks

Problem

A config-level npm override for an existing provider (e.g. provider.synthetic.npm = "@ai-sdk/anthropic") is silently dropped for models inherited from models.dev. The config-merge parsed object in provider.ts never carries npm, and apiNpm is only recomputed for models explicitly declared in config.

Impact: inherited models keep their models.dev api.npm, so the request uses the overridden options.baseURL with the original SDK — producing mismatched SDK+URL 404s. Concrete failure: with provider.synthetic.npm = "@ai-sdk/anthropic" + options.baseURL = ".../anthropic/v1", opencode POSTs /chat/completions (openai-compatible SDK) to an Anthropic-compatible base URL → 404 API route not found.

Expected behavior

A provider-level npm in config should propagate to all inherited models (those not explicitly declared in provider.models), so the SDK matches the overridden endpoint.

Environment

  • opencode version: 1.18.14+ (reproducible on dev)
  • Platform: Windows x64 (endpoint-agnostic)

Activity

  1. github-actions commented on Aug 8, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of an existing issue. Please check:

    • Provider-level npm field silently ignored unless models is also configured #33888: Provider-level npm field silently ignored unless models is also configured — describes the same root cause (npm resolution only happens inside the provider.models loop, so inherited/discovered models keep their original SDK regardless of the provider-level npm override) and includes the same workaround (enumerate models explicitly).
  2. github-actions commented on Oct 7, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions