feat(llm): add Doubao (Volcengine Ark) as an LLM provider#12219
feat(llm): add Doubao (Volcengine Ark) as an LLM provider#12219MackDing wants to merge 2 commits into
Conversation
Doubao is ByteDance's widely used LLM family, served via Volcengine Ark (火山方舟). Ark exposes an OpenAI-compatible `/chat/completions` surface at https://ark.cn-beijing.volces.com/api/v3/, so the adapter is a thin OpenAI subclass that mirrors the existing Moonshot/Deepseek/zAI pattern. Registration: - core/llm/llms/Doubao.ts — new provider subclass of OpenAI. - core/llm/llms/index.ts — added to the LLMClasses registry. - core/llm/autodetect.ts — listed in PROVIDER_HANDLES_TEMPLATING so Ark's server-side chat template is trusted (consistent with Moonshot and Deepseek). - packages/openai-adapters/src/apis/Doubao.ts — OpenAI-adapter wrapper with the Ark base URL. - packages/openai-adapters/src/types.ts + index.ts — new DoubaoConfigSchema and constructLlmApi case. Notes: - No default model is set. Ark requires either a date-stamped model ID (e.g. `doubao-seed-1-6-251015`, `doubao-1-5-pro-32k-250115`) or an Ark-provisioned endpoint ID (`ep-20240xxx-xxxxx`); hard-coding a bare alias would silently 404. - Docs cover YAML + JSON config, endpoint-ID usage, and link to the Ark model list so users pick an ID that resolves today. Tests: - New packages/openai-adapters/src/apis/Doubao.test.ts covering constructLlmApi(doubao) routing, default apiBase, and preserved OpenAI-chat surface (3 tests). - OpenAI-compatible.vitest.ts subclass matrix entry for parity with Moonshot/Deepseek. - `npm test` in packages/openai-adapters: 148 passed / 5 skipped.
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
2 issues found across 9 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/customize/model-providers/more/doubao.mdx">
<violation number="1" location="docs/customize/model-providers/more/doubao.mdx:15">
P2: Configuration instructions are internally contradictory about using model aliases versus date-stamped model IDs/endpoint IDs, which can lead to invalid setup.</violation>
</file>
<file name="packages/openai-adapters/src/apis/Doubao.ts">
<violation number="1" location="packages/openai-adapters/src/apis/Doubao.ts:19">
P2: Subclass field initialization overwrites `config.apiBase` set by `OpenAIApi`, breaking custom base URL configuration.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
|
I have read the CLA document and I hereby sign the CLA |
|
Quick follow-up: all CI on my side looks green now. If the remaining blocker is the automated review feedback or pending AI checks, I’m happy to submit a follow-up patch. If there is a maintainer-preferred direction for the Doubao provider integration, I can adjust accordingly. Thanks for taking a look. |
- Doubao.ts: remove class field initializer that was overwriting the parent OpenAIApi constructor's apiBase resolution. Pass the default via super() config so config.apiBase overrides still work. - doubao.mdx: replace ambiguous 'use a public model alias' wording with explicit guidance to use date-stamped model IDs or endpoint IDs, and warn that undated aliases are not guaranteed to resolve. Addresses cubic review feedback on continuedev#12219.
|
Thanks for the review. Both findings addressed in b0857a5: Doubao.ts apiBase override — Removed the class field initializer that was clobbering the parent doubao.mdx model ID guidance — Replaced the ambiguous "use a public model alias" wording with explicit instructions to use a date-stamped model ID or an endpoint ID, plus a warning that undated aliases are not guaranteed to resolve on Ark. |
|
Quick follow-up after rechecking the PR status: the standard GitHub checks are passing on my side, and the earlier Cubic findings were addressed in |
|
Additional check on the remaining VSIX blockers: both failing |
What
Adds Doubao (豆包 / ByteDance) via Volcengine Ark as a first-class LLM provider in Continue, following the existing pattern used for Moonshot, Deepseek, MiniMax, zAI, and SiliconFlow.
Doubao is one of the most-used LLM families in China; Volcengine Ark (火山方舟) is its official hosted platform and exposes an OpenAI-compatible
/chat/completionssurface athttps://ark.cn-beijing.volces.com/api/v3/. Today users have to work around the gap by using the generic OpenAI provider withapiBaseandmodeloverrides — this PR makesprovider: doubaojust work.Why
OpenAIsubclass. Registration is the same shape used by Moonshot / Deepseek / zAI.Changes
core/llm/llms/Doubao.tsDoubao extends OpenAIwith Ark base URLcore/llm/llms/index.tsLLMClassescore/llm/autodetect.tsPROVIDER_HANDLES_TEMPLATING(Ark handles chat templating server-side, same as Moonshot/Deepseek)packages/openai-adapters/src/apis/Doubao.tsOpenAIApiwithark.cn-beijing.volces.com/api/v3/packages/openai-adapters/src/types.tsDoubaoConfigSchemain the discriminated unionpackages/openai-adapters/src/index.tsconstructLlmApi→DoubaoApipackages/openai-adapters/src/apis/Doubao.test.tscore/llm/llms/OpenAI-compatible.vitest.tsdocs/customize/model-providers/more/doubao.mdxDiff: 9 files, +222 / −0.
Design notes
doubao-seed-1-6-251015,doubao-1-5-pro-32k-250115) or a user-provisioned endpoint ID (ep-20240xxx-xxxxx). A bare alias likedoubao-1-5-pro-32kwould silently 404, so the adapter intentionally requires the user to pick a valid ID. The docs link to the official Ark model list so users can copy a currently valid one.maxStopWords = 4matches Ark's documented limit for OpenAI-compatible chat completions.beta/completionsFIM protocol today. If that changes, we can overridefimStreamthe way Moonshot and Deepseek do.packages/llm-info— consistent with Moonshot and Deepseek, which also rely solely on theLLMClasses+openai-adaptersregistration.Testing
3 of those 148 are new Doubao tests covering:
constructLlmApi({ provider: "doubao" })returns aDoubaoApiinstance.apiBaseis the Arkcn-beijingv3 URL.chatCompletionStream/chatCompletionNonStream).TypeScript check:
tsc --noEmitonpackages/openai-adapters→ 0 errors.References
Summary by cubic
Adds Doubao (ByteDance) via Volcengine Ark as a first-class LLM provider using the OpenAI-compatible /chat/completions API. Also fixes
apiBasehandling so user overrides are respected over the default.New Features
doubaoprovider with defaultapiBase: https://ark.cn-beijing.volces.com/api/v3/.LLMClassesandconstructLlmApi; addedDoubaoConfigSchema.Migration
doubao-seed-1-6-251015) or endpoint ID (ep-...) inmodel.provider: openaiwith ArkapiBase, switch toprovider: doubaoand keep the samemodelandapiKey.Written for commit b0857a5. Summary will update on new commits.