Skip to content

feat: add BytePlus ModelArk providers (chat, image, video) - #3498

Open
jelveh wants to merge 2 commits into
mainfrom
feat/byteplus-chat-provider
Open

feat: add BytePlus ModelArk providers (chat, image, video)#3498
jelveh wants to merge 2 commits into
mainfrom
feat/byteplus-chat-provider

Conversation

@jelveh

@jelveh jelveh commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What

Adds BytePlus ModelArk as a provider for the puter-chat-completion, puter-image-generation, and puter-video-generation drivers. One providers.byteplus config entry (apiKey + regional apiBaseUrl) powers all three.

Chat (puter-chat-completion)

  • OpenAI-compatible endpoint at ark.ap-southeast.bytepluses.com/api/v3; providers.byteplus.apiBaseUrl selects the region (e.g. eu-west), apiKey gates registration as usual.
  • Static catalog of 16 chat models — Seed 2.x/1.x (vision), GLM-5.2/4.7, DeepSeek V4/V3.2, GPT-OSS-120B — with context/output limits and per-token pricing from the official model list and pricing pages.
  • Streaming, tool calling, and Ark's thinking / response_format / stop params passed through custom; reasoning_content normalized to reasoning.

Image (puter-image-generation) — Seedream / SeedEdit

  • dola-seedream-5-0-pro, seedream-5-0-lite, seedream-4-5, seedream-4-0, seededit-3-0-i2i via Ark's OpenAI-compatible /images/generations (same SDK/client pattern as the chat provider).
  • Quality tiers 1k/1.5k/2k; aspect ratios resolve to Ark's documented pixel sizes; explicit WxH passes through with Ark's total-pixel/aspect bounds enforced. Watermark disabled explicitly (Ark defaults it on).
  • Pro model bills by output pixel count (≤2.61MP vs above) plus per-input-image from the 2nd reference on; the rest are flat per-image.

Video (puter-video-generation) — Seedance

  • Seedance 2.0 / 2.0 Fast / 2.0 Mini / 1.5 Pro / 1.0 Pro / 1.0 Pro Fast via Ark's task-based /contents/generations/tasks + status polling (no SDK; plain fetch, Cloudflare-provider pattern).
  • Billed per video token from the task's usage.completion_tokens; per-second estimates feed capSecondsToRemainingCredits so clips clamp to remaining credit instead of failing whole. 1.5 Pro's audio vs silent rates follow generate_audio (new optional field on IGenerateVideoParams), sent explicitly for deterministic billing.
  • First-frame (input_reference), first+last frame (last_frame), and Seedance-2.0 reference_images inputs supported, with Ark's mutual-exclusivity rules enforced.

Notes

  • Bare deepseek-v4-* names stay with the first-party DeepSeek provider; BytePlus only claims byteplus/-prefixed aliases, so existing model routing is untouched (locked in by a test).
  • Tiered-pricing chat models are billed at the base (≤128K prompt) tier, same simplification as the ZAI GLM catalog.
  • Audio input is deliberately left out of chat modalities: Ark folds audio tokens into prompt_tokens at ~15x the text rate, which would underbill.
  • dreamina-seedance-2-5 is on Ark's pricing page but its API access is still listed as "available soon", so it's excluded from the video catalog for now.
  • The video catalog lists 4k/4K dimension spellings for Seedance 2.0 because the driver's resolution normalization is case-sensitive.

Testing

  • 72 offline unit tests across the three providers (real in-memory PuterServer + live MeteringService; OpenAI SDK mocked for chat/image, global fetch stubbed for video) plus env-gated integration tests (PUTER_TEST_AI_BYTEPLUS_API_KEY).
  • Full ai-chat byteplus, ai-image, and ai-video suites passing (324 tests); tsc and eslint clean.
  • Chat verified live: booted server lists all 16 models via /puterai/chat/models; real-key requests reach ModelArk and fail only on account-side model activation (ModelNotOpen), confirming auth, wire format, and error classification.

Adds BytePlus ModelArk as a provider for the puter-chat-completion
driver, following the MiniMax/ZAI providers as reference per
doc/contributing-apis.md.

- OpenAI-compatible endpoint at ark.ap-southeast.bytepluses.com/api/v3
  (apiBaseUrl config selects the region)
- Static catalog of 16 chat models (Seed 2.x/1.x incl. vision, GLM,
  DeepSeek, GPT-OSS) with limits and per-token pricing from the
  official docs
- Passes Ark's thinking/response_format/stop params through custom;
  normalizes reasoning_content to reasoning
- Bare deepseek-v4-* names stay with the first-party DeepSeek
  provider; BytePlus only claims prefixed aliases
- Offline unit tests (mocked SDK against a real test server) plus an
  env-gated integration test
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 93.34%
⬆️ +0.04%
21014 / 22513
🔵 Statements 91.74%
⬆️ +0.05%
22498 / 24521
🔵 Functions 89.39%
⬆️ +0.12%
3515 / 3932
🔵 Branches 80.37%
⬆️ +0.13%
15374 / 19128
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/backend/drivers/ai-chat/ChatCompletionDriver.ts 92.59%
⬆️ +0.08%
84.38%
⬆️ +0.10%
96.66%
🟰 ±0%
93.85%
⬆️ +0.07%
141-144, 262, 292, 306, 339-341, 431-435, 464, 640, 664, 670, 677, 1042, 1049-1061, 1067-1072, 1102, 1110, 1129
src/backend/drivers/ai-chat/providers/byteplus/BytePlusProvider.ts 100% 90.69% 100% 100%
src/backend/drivers/ai-chat/providers/byteplus/models.ts 100% 100% 100% 100%
src/backend/drivers/ai-image/ImageGenerationDriver.ts 91.47%
⬇️ -0.39%
80.98%
⬇️ -0.17%
94.44%
🟰 ±0%
90.96%
⬇️ -0.39%
110, 160, 163, 179-183, 345-353, 409-413, 417-421, 448, 451, 482-486
src/backend/drivers/ai-image/providers/byteplus/BytePlusImageProvider.ts 97.64% 91.26% 100% 97.56% 160-162, 296
src/backend/drivers/ai-image/providers/byteplus/models.ts 100% 100% 100% 100%
src/backend/drivers/ai-video/VideoGenerationDriver.ts 85.78%
⬇️ -0.22%
69.68%
⬆️ +0.12%
85.71%
🟰 ±0%
86.01%
⬇️ -0.23%
110, 157, 172, 191-195, 305-313, 344, 418-434, 450-454, 476, 486, 489, 520-524, 547-552
src/backend/drivers/ai-video/types.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/backend/drivers/ai-video/providers/byteplus/BytePlusVideoProvider.ts 92.48% 83.33% 95% 93.79% 132-134, 147-149, 217, 267-271, 283, 309-313, 342-344, 363, 436-439
src/backend/drivers/ai-video/providers/byteplus/models.ts 100% 100% 100% 100%
Generated in workflow #653 for commit e610748 by the Vitest Coverage Report Action

Extends the BytePlus ModelArk integration to the puter-image-generation
and puter-video-generation drivers, reusing the same services.byteplus
API key and regional apiBaseUrl as the chat provider.

Image (Seedream/SeedEdit via OpenAI-compatible /images/generations):
- dola-seedream-5-0-pro (pixel-tier pricing + billed input images from
  the 2nd on), seedream-5-0-lite, 4-5, 4-0, and seededit-3-0-i2i
- quality tiers 1K/1.5K/2K; aspect ratios resolve to Ark's documented
  pixel sizes; explicit WxH passes through with Ark's bounds enforced

Video (Seedance via Ark's async /contents/generations/tasks + polling):
- Seedance 2.0 / 2.0 Fast / 2.0 Mini / 1.5 Pro / 1.0 Pro / 1.0 Pro Fast
  (2.5 is priced but its API isn't live yet, so it's excluded)
- per-video-token billing from usage.completion_tokens, with per-second
  estimates feeding the credit cap; audio vs silent rates for 1.5 Pro
- first/last frame and reference-image inputs; generate_audio param
  added to IGenerateVideoParams

Pricing and capabilities hardcoded from the official docs (ModelArk
pages 1544106, 1330310, 1520757, 1521309, 1541523). Offline unit tests
mock the SDK / global fetch; integration tests are env-gated on
PUTER_TEST_AI_BYTEPLUS_API_KEY.
@jelveh jelveh changed the title feat: add BytePlus ModelArk chat provider feat: add BytePlus ModelArk providers (chat, image, video) Aug 3, 2026
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