Skip to content

feat(core): wire Ark provider into aisdk-native and variant system - #63482

Open
drpr wants to merge 3 commits into
anomalyco:devfrom
drpr:feat/ark-core-wiring
Open

drpr wants to merge 3 commits into
anomalyco:devfrom
drpr:feat/ark-core-wiring

Conversation

@drpr

@drpr drpr commented Nov 12, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #63480

Type of change

  • New feature

What does this PR do?

Register the Ark provider in the core wiring so it appears in the provider list and model catalog.

  • aisdk-native.ts: map Ark provider IDs (volcengine, volcengine-coding-plan, byteplus) to the AI SDK
  • variant.ts: Ark variant handling (arkChat)
  • provider.ts: register @opencode/ai/providers/ark as a builtin provider
  • UI: BytePlus provider icon and sprite entry

Note: byteplus is not yet in models.dev, so the icon and mapping have no effect for BytePlus until a catalog entry is added upstream. Only volcengine and volcengine-coding-plan are in models.dev today.

Depends on #63481 — this branch is rebased on top of feat/ark-provider-core and will not compile without it.

The generic GET /models discovery plugin that was previously in this PR has been removed. It affected 13 providers beyond Ark and should be proposed separately per issue #63480.

How did you verify your code works?

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #63481

Public API: adds @opencode/ai/providers/ark export and routes volcengine/volcengine-coding-plan through it (backwards compatible)

Add an Ark provider that extends openai-compatible with Volcengine
defaults: region-based base URL, thinking budget, and prompt cache
key via the X-Ark-Prompt-Id header.

- providers/ark.ts: provider definition with Ark base URL and model list
- providers/index.ts: export the Ark provider
- package.json: export ./providers/ark subpath
- test/provider/ark.test.ts: construction and header forwarding tests

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for splitting this out of #63471. There are a few things to sort out before this can merge.

I couldn't run it end to end. tsc -b in packages/core fails with Cannot find module '@opencode/ai/providers/ark', since that module only comes with #63481, and discovery needs real Ark keys. The existing variant tests pass.

Public API: this adds new provider IDs to the native mapping (byteplus, volcengine, volcengine-coding-plan), a new byteplus provider icon, and new environment-variable fallbacks (ARK_API_KEY, VOLCENGINE_API_KEY, ARK_CODING_PLAN_API_KEY, BYTEPLUS_API_KEY). It also changes how the model list is built for about 18 existing providers (see below). Nothing is removed, but the model lists of those existing providers would change.

Main concerns:

  1. The scope goes beyond what #63480 describes. That issue says the generic GET /models discovery plugin and the local catalog should be discussed separately. This PR still adds plugin/provider/ark.ts, which is that generic discovery plugin, and ark/models.ts, which exports OpenAICompatibleModels. The plugin runs for DeepSeek, Groq, Mistral, MiniMax, Moonshot, Zhipu, SiliconFlow, Fireworks, Novita, Perplexity, NVIDIA and Cerebras as well as Ark (details inline).
  2. It depends on #63481 to compile. The description's "35/35 typecheck pass" can't be true for this branch on its own, and the dependency PR number is still a placeholder. It may be simpler to land this together with, or after, #63481.
  3. byteplus isn't in models.dev. The aisdk-native mapping, the discovery entry and the icon have no effect for BytePlus until a byteplus catalog entry exists there. Only volcengine and volcengine-coding-plan are in models.dev today.

I'd suggest cutting this PR down to the Ark-only wiring: the aisdk-native mapping, the builtin import, the arkChat variant and the icon. Live model discovery can then be proposed separately, if it's wanted.

Related: #63481

baseURL: "https://ark.ap-southeast.bytepluses.com/api/v3",
env: ["BYTEPLUS_API_KEY"],
},
// MiniMax

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From here down, the plugin covers providers that have nothing to do with Ark: MiniMax, DeepSeek, Groq, Fireworks, SiliconFlow, Moonshot, Zhipu, Novita, Perplexity, Mistral, NVIDIA and Cerebras. When any of their keys is set, the transform calls evt.add, which replaces that provider's whole models.dev model list with whatever GET /models returns. Catalog models that the endpoint doesn't list disappear. Anything the endpoint does list (Groq's Whisper, TTS and guard models, Ark's embedding, image and video models) shows up as a chat model. This is the generic discovery plugin that #63480 said would be discussed separately. Could it be limited to the Ark IDs, or left out of this PR?

Comment thread packages/core/src/ark/models.ts Outdated
cost: previous ? previous.cost : [{ input: Money.USDPerMillionTokens.zero, output: Money.USDPerMillionTokens.zero, cache: { read: Money.USDPerMillionTokens.zero, write: Money.USDPerMillionTokens.zero } }],
status: previous?.status ?? "active",
enabled: previous?.enabled ?? true,
limit: previous?.limit ?? { context: 0, output: 0 },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A model returned by /models that has no catalog template is added with limit: { context: 0, output: 0 }, zero cost, tools: true and text-only input. A zero context limit will likely break compaction and context accounting, and it will mislead users about cost. A missing template would be better skipped, or at least given defaults that aren't zero.

["@opencode/ai/providers/azure/messages", () => import("@opencode/ai/providers/azure/messages")],
["@opencode/ai/providers/baseten", () => import("@opencode/ai/providers/baseten")],
["@opencode/ai/providers/baseten/decisions", () => import("@opencode/ai/providers/baseten/decisions")],
["@opencode/ai/providers/ark", () => import("@opencode/ai/providers/ark")],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@opencode/ai/providers/ark doesn't exist on this branch or on dev, so tsc -b in packages/core fails here with TS2307. This needs #63481 to land first, or the two PRs need to land together.

alex added 2 commits November 12, 2026 15:47
Register the Ark provider in the core wiring:

- aisdk-native.ts: map Ark provider IDs to the AI SDK
- ark/models.ts: Ark model definitions
- plugin/provider/ark.ts: Ark provider plugin (config, fetch, models)
- variant.ts: Ark variant handling
- provider.ts: export the Ark provider
- ui: BytePlus provider icon and sprite entry
Per review feedback on anomalyco#63482, the generic GET /models discovery plugin
(plugin/provider/ark.ts) and its model template helper (ark/models.ts)
are out of scope for this PR — they affect 13 providers beyond Ark and
should be proposed separately per issue anomalyco#63480.

Remove:
- plugin/provider/ark.ts: the generic OpenAI-compatible discovery plugin
- ark/models.ts: the OpenAICompatibleModels merge helper
- plugin/provider.ts: the ArkPlugin import and registration

Keep:
- aisdk-native.ts: Ark provider ID mappings (volcengine, byteplus, etc.)
- variant.ts: Ark variant handling
- provider.ts: builtin import for @opencode/ai/providers/ark
- ui: BytePlus provider icon and sprite entry

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commits address all three earlier points: the generic discovery plugin and ark/models.ts are gone, and @opencode/ai/providers/ark now resolves. tsc -b in packages/core passes, as do the new Ark provider tests (5) and the variant and aisdk-native tests (40). I couldn't send real requests to Ark without credentials.

Public API: this adds the @opencode/ai/providers/ark export and the Ark namespace in @opencode/ai, plus a new byteplus provider icon. volcengine and volcengine-coding-plan models from models.dev are now routed through the Ark package instead of plain openai-compatible, so the request shape gains Ark's thinking switch. It's backwards compatible: nothing existing is removed.

One thing to settle: this branch now contains the #63481 commit as well, so the two PRs overlap. Whichever merges first, the other will need to be rebased or closed.

This branch has not been deployed

No deployments
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.

feat: add BytePlus/Volcengine Ark provider support

1 participant