anomalyco / anomalyco/opencode
v2: normalize or reject unprefixed AI SDK packages in native provider config
@jlongster is already working on this.
Since Aug 25, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Problem
Native V2 provider configuration accepts an AI SDK npm package without the required aisdk: prefix, but the resulting provider fails only when a prompt is sent. This makes a plausible configuration silently select the native OpenCode provider loader instead of AI SDK compatibility.
{
"providers": {
"custom": {
"package": "@ai-sdk/openai-compatible",
"models": { "chat": {} }
}
}
}
The currently working form requires an undocumented/non-obvious discriminator:
{
"providers": {
"custom": {
"package": "aisdk:@ai-sdk/openai-compatible",
"models": { "chat": {} }
}
}
}
The same issue applies to model-level package overrides. Legacy V1 provider.*.npm and model-level provider.npm values are automatically normalized during migration, and models.dev packages are also normalized, so native V2 config behaves inconsistently with those sources.
Current implementation
packages/core/src/config/plugin/provider.tscopies provider-level and model-levelpackagevalues directly into the catalog.packages/core/src/provider.tsrecognizes AI SDK packages only when prefixed withaisdk:.packages/core/src/model-resolver.tstreats every unprefixed package as a native OpenCode provider module.- V2 provider and model config schemas currently accept the invalid-looking-but-runtime-broken bare AI SDK strings.
Expected behavior
Native V2 configuration should either normalize obvious AI SDK package names such as @ai-sdk/* at both provider and model levels, or reject them early with an actionable validation error explaining the required aisdk: prefix. The public V2 provider documentation should explain native versus AI SDK package selection.
Preserve legitimate unprefixed native provider modules and native file:// packages; arbitrary third-party AI SDK packages may still need an explicit discriminator.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.