feat(llm): add Doubao (Volcengine Ark) as an LLM provider#12219
Open
MackDing wants to merge 1 commit intocontinuedev:mainfrom
Open
feat(llm): add Doubao (Volcengine Ark) as an LLM provider#12219MackDing wants to merge 1 commit intocontinuedev:mainfrom
MackDing wants to merge 1 commit intocontinuedev:mainfrom
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.
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
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.
| To use Doubao models: | ||
|
|
||
| 1. Create an API key on the [Volcengine Ark console](https://console.volcengine.com/ark/). | ||
| 2. Either deploy the model you want as an endpoint and copy its endpoint ID, or use a public model alias. |
Contributor
There was a problem hiding this comment.
P2: Configuration instructions are internally contradictory about using model aliases versus date-stamped model IDs/endpoint IDs, which can lead to invalid setup.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/customize/model-providers/more/doubao.mdx, line 15:
<comment>Configuration instructions are internally contradictory about using model aliases versus date-stamped model IDs/endpoint IDs, which can lead to invalid setup.</comment>
<file context>
@@ -0,0 +1,111 @@
+To use Doubao models:
+
+1. Create an API key on the [Volcengine Ark console](https://console.volcengine.com/ark/).
+2. Either deploy the model you want as an endpoint and copy its endpoint ID, or use a public model alias.
+3. Add the following configuration:
+
</file context>
| * Reference: https://www.volcengine.com/docs/82379 | ||
| */ | ||
| export class DoubaoApi extends OpenAIApi { | ||
| apiBase: string = "https://ark.cn-beijing.volces.com/api/v3/"; |
Contributor
There was a problem hiding this comment.
P2: Subclass field initialization overwrites config.apiBase set by OpenAIApi, breaking custom base URL configuration.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/openai-adapters/src/apis/Doubao.ts, line 19:
<comment>Subclass field initialization overwrites `config.apiBase` set by `OpenAIApi`, breaking custom base URL configuration.</comment>
<file context>
@@ -0,0 +1,26 @@
+ * Reference: https://www.volcengine.com/docs/82379
+ */
+export class DoubaoApi extends OpenAIApi {
+ apiBase: string = "https://ark.cn-beijing.volces.com/api/v3/";
+ constructor(config: DoubaoConfig) {
+ super({
</file context>
Author
|
I have read the CLA document and I hereby sign the CLA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. Users can now set
provider: doubaoto use China-region Doubao models without workarounds.New Features
doubaoprovider with defaultapiBase: https://ark.cn-beijing.volces.com/api/v3/.LLMClassesandconstructLlmApi; addedDoubaoConfigSchema.Migration
doubao-seed-1-6-251015) or endpoint ID (e.g.ep-...) inmodel.provider: openaiwith ArkapiBase, switch toprovider: doubaoand keep the samemodelandapiKey.Written for commit 27dd211. Summary will update on new commits.