feat: add BytePlus ModelArk providers (chat, image, video) - #3498
Open
jelveh wants to merge 2 commits into
Open
Conversation
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
Contributor
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.
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 BytePlus ModelArk as a provider for the
puter-chat-completion,puter-image-generation, andputer-video-generationdrivers. Oneproviders.byteplusconfig entry (apiKey + regionalapiBaseUrl) powers all three.Chat (
puter-chat-completion)ark.ap-southeast.bytepluses.com/api/v3;providers.byteplus.apiBaseUrlselects the region (e.g. eu-west),apiKeygates registration as usual.thinking/response_format/stopparams passed throughcustom;reasoning_contentnormalized toreasoning.Image (
puter-image-generation) — Seedream / SeedEditdola-seedream-5-0-pro,seedream-5-0-lite,seedream-4-5,seedream-4-0,seededit-3-0-i2ivia Ark's OpenAI-compatible/images/generations(same SDK/client pattern as the chat provider).1k/1.5k/2k; aspect ratios resolve to Ark's documented pixel sizes; explicitWxHpasses through with Ark's total-pixel/aspect bounds enforced. Watermark disabled explicitly (Ark defaults it on).Video (
puter-video-generation) — Seedance/contents/generations/tasks+ status polling (no SDK; plainfetch, Cloudflare-provider pattern).usage.completion_tokens; per-second estimates feedcapSecondsToRemainingCreditsso clips clamp to remaining credit instead of failing whole. 1.5 Pro's audio vs silent rates followgenerate_audio(new optional field onIGenerateVideoParams), sent explicitly for deterministic billing.input_reference), first+last frame (last_frame), and Seedance-2.0reference_imagesinputs supported, with Ark's mutual-exclusivity rules enforced.Notes
deepseek-v4-*names stay with the first-party DeepSeek provider; BytePlus only claimsbyteplus/-prefixed aliases, so existing model routing is untouched (locked in by a test).modalities: Ark folds audio tokens intoprompt_tokensat ~15x the text rate, which would underbill.dreamina-seedance-2-5is 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.4k/4Kdimension spellings for Seedance 2.0 because the driver's resolution normalization is case-sensitive.Testing
fetchstubbed for video) plus env-gated integration tests (PUTER_TEST_AI_BYTEPLUS_API_KEY).ai-chatbyteplus,ai-image, andai-videosuites passing (324 tests);tscand eslint clean./puterai/chat/models; real-key requests reach ModelArk and fail only on account-side model activation (ModelNotOpen), confirming auth, wire format, and error classification.