Skip to content

refactor(core): refactor model resolving logic, fix missing variant logic - #48943

Merged
rekram1-node merged 19 commits into
v2from
catalog-native
Sep 14, 2026
Merged

rekram1-node merged 19 commits into
v2from
catalog-native

Conversation

@rekram1-node

Copy link
Copy Markdown
Collaborator

No description provided.

normalize() maps each models.dev npm package onto its @opencode/ai
equivalent where one exists; the 13 npm packages without one stay on
aisdk:. The generic openai-compatible package receives the provider
identity as a per-model setting, which the AI SDK path inferred.
…ages

MiniMax uses the native Messages package, Meta the native Responses
package, and Baseten, DeepSeek, Fireworks and Cloudflare Workers AI
their own packages instead of generic openai-compatible. Alibaba, Z.AI,
Moonshot and the coding plans stay generic for now.
Variant.resolve(model, options) builds effort, toggle and budget
variants for a catalog model from a per-package spelling table keyed by
the package as it appears in the catalog, native or aisdk:. models.dev
is the first caller; the variant plugin and config best-guess variants
follow.
Reasoning variants are built from three controls: effort, toggle and
token budget. Each package entry says how it spells each one; shared
spellings are plain functions and shared formats are plain values, so
packages that behave alike point at the same format and packages that
differ spread and override.

Native Bedrock variants now ride in body.additionalModelRequestFields,
matching what the AI SDK translator produced.
Each package maps to a protocol: a function that, given a model and one
reasoning control it supports (effort, toggle or token budget), returns
the variants for it in that protocol's vocabulary. Model checks such as
Claude's manual-effort generations are local variables inside the
protocol, so they steer both the spelling and the assumed values.

Nothing declared means the model is assumed to support effort and the
protocol chooses the values, so config models without a variants key
get that protocol's defaults through the same code path models.dev
records use. models.dev strips its null placeholders before calling in.

The GitHub Copilot entry is removed: the Copilot plugin builds variants
from Copilot's own model list.
models.dev records have carried native packages since the catalog
started registering them, so guards written against AI SDK npm names
silently stopped matching. Match the native package instead.
…t fixtures

Copilot's Anthropic-protocol models were registered as
aisdk:@ai-sdk/anthropic; the native Anthropic package replaces it.
Test fixtures standing in for models.dev records now seed the native
packages models.dev emits.
Cloudflare Workers AI and Google Vertex drop their AI SDK hooks; the
packages they matched no longer reach the catalog, and the resolver
already expands endpoint variables on every route. Vertex expands its
endpoint templates on model settings too, where MaaS models carry them.
Modal registers the native openai-compatible package directly.
The catalog editor is the single place AI SDK packages become native.
Every provider and model write runs AISDKNative.rewrite, which picks the
native package and translates AI SDK settings into the native spelling
based on the package the target will run under, so options written on a
model that inherits its provider's package are translated too. The
resolver no longer maps at request time, and the config plugin and V1
migration no longer carry their own rewrite calls.

Host-specific packages are keyed by the models.dev provider ID, covering
every regional and plan sibling for Alibaba, Moonshot, MiniMax, Z.AI and
Meta, with the wire format following the source package. Bedrock body
options and the Mantle chat/responses choice depend on the model, so they
are only translated on model writes; provider-level values stay inert.
Native Bedrock credentials pass through unchanged, and the legacy
@opencode-ai/ai scope normalizes on write.

The VariantPlugin GLM hack and the AI SDK twin protocol entries are
removed since AI SDK packages with native twins never reach the variant
table anymore.
@rekram1-node
rekram1-node merged commit 2226afa into v2 Sep 14, 2026
4 of 8 checks passed
@rekram1-node
rekram1-node deleted the catalog-native branch September 14, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant