Open History to see the last commit
1/**
2 * BytePlus ModelArk model metadata.
3 *
4 * Every Ark model id in this file — chat, video and image — was verified live
5 * against `https://ark.ap-southeast.bytepluses.com/api/v3` on 2026-07-31. The
6 * two Seed Speech ids are the exception: they live on the voice host, which
7 * needs a separate key that was not available, so they are docs-derived.
8 * Capability metadata is a mix of probed and docs-derived facts; anything not
9 * confirmed against the live API is annotated as such at its declaration.
10 * BytePlus
11 * deactivates model ids aggressively (the whole `seedance-1-0-lite-*` family,
12 * `seed-1-6-lite-*`, `seedream-3-0-*`, and the `doubao-`/`skylark-` names are
13 * all 404s internationally), so only dated, probe-confirmed ids are shipped.
14 *
15 * Prefix rules, also probe-confirmed:
16 * - `dola-seed-2-1-turbo-260628` and `dola-seedream-5-0-pro-260628` are the
17 * canonical ids; the bare forms resolve as aliases but the API echoes the
18 * prefixed id back.
19 * - The Seedance 2.0 family *requires* the `dreamina-` prefix.
20 * - Older models reject the `dola-` prefix outright.
21 */
22import type { DurationOptions } from '@tanstack/ai/adapters'
23import type { BytePlusTextProviderOptions } from './text/text-provider-options'
24
25/**
26 * BytePlus exposes no server-side provider tools (no hosted web search, code
27 * interpreter, …) on the international Ark endpoint, so every chat model
28 * advertises an empty tool set. Typing it as `never` makes passing another
29 * provider's `ProviderTool` to a BytePlus adapter a compile-time error.
30 */
31export type BytePlusProviderToolKind = never
32
33/**
34 * Internal metadata structure describing a BytePlus model.
35 */
36interface ModelMeta {
37 name: string
38 supports: {
39 input: ReadonlyArray<'text' | 'image' | 'audio' | 'video' | 'document'>
40 output: ReadonlyArray<'text' | 'image' | 'audio' | 'video'>
41 capabilities?: ReadonlyArray<
42 'reasoning' | 'tool_calling' | 'structured_outputs'
43 >
44 tools?: ReadonlyArray<BytePlusProviderToolKind>
45 }
46 context_window?: number
47 max_input_tokens?: number
48 max_output_tokens?: number
49}
50
51// ============================================================================
52// Chat models (Seed / GLM / DeepSeek / gpt-oss on Ark)
53// ============================================================================
54
55const DOLA_SEED_2_1_TURBO = {
56 name: 'dola-seed-2-1-turbo-260628',
57 context_window: 256_000,
58 max_input_tokens: 256_000,
59 max_output_tokens: 256_000,
60 supports: {
61 input: ['text', 'image', 'video'],
62 output: ['text'],
63 capabilities: ['reasoning', 'tool_calling', 'structured_outputs'],
64 tools: [] as const,
65 },
66} as const satisfies ModelMeta
67
68const SEED_2_0_LITE_260428 = {
69 name: 'seed-2-0-lite-260428',
70 context_window: 256_000,
71 max_input_tokens: 256_000,
72 max_output_tokens: 128_000,
73 supports: {
74 input: ['text', 'image', 'video', 'audio'],
75 output: ['text'],
76 // Live-probed 2026-07-31: rejects both json_schema and json_object.
77 capabilities: ['reasoning', 'tool_calling'],
78 tools: [] as const,
79 },
80} as const satisfies ModelMeta
81
82const SEED_2_0_MINI_260428 = {
83 name: 'seed-2-0-mini-260428',
84 context_window: 256_000,
85 max_input_tokens: 256_000,
86 max_output_tokens: 128_000,
87 supports: {
88 input: ['text', 'image', 'video', 'audio'],
89 output: ['text'],
90 // Live-probed 2026-07-31: rejects both json_schema and json_object.
91 capabilities: ['reasoning', 'tool_calling'],
92 tools: [] as const,
93 },
94} as const satisfies ModelMeta
95
96const SEED_2_0_PRO_260328 = {
97 name: 'seed-2-0-pro-260328',
98 context_window: 256_000,
99 max_input_tokens: 224_000,
100 max_output_tokens: 128_000,
101 supports: {
102 input: ['text', 'image', 'video'],
103 output: ['text'],
104 // Live-probed 2026-07-31: accepts json_schema, despite the docs table
105 // saying otherwise.
106 capabilities: ['reasoning', 'tool_calling', 'structured_outputs'],
107 tools: [] as const,
108 },
109} as const satisfies ModelMeta
110
111const SEED_2_0_LITE_260228 = {
112 name: 'seed-2-0-lite-260228',
113 context_window: 256_000,
114 max_input_tokens: 224_000,
115 max_output_tokens: 128_000,
116 supports: {
117 input: ['text', 'image', 'video'],
118 output: ['text'],
119 capabilities: ['reasoning', 'tool_calling', 'structured_outputs'],
120 tools: [] as const,
121 },
122} as const satisfies ModelMeta
123
124const SEED_2_0_MINI_260215 = {
125 name: 'seed-2-0-mini-260215',
126 context_window: 256_000,
127 max_input_tokens: 224_000,
128 max_output_tokens: 128_000,
129 supports: {
130 input: ['text', 'image', 'video'],
131 output: ['text'],
132 capabilities: ['reasoning', 'tool_calling', 'structured_outputs'],
133 tools: [] as const,
134 },
135} as const satisfies ModelMeta
136
137const SEED_2_0_CODE_PREVIEW_260328 = {
138 name: 'seed-2-0-code-preview-260328',
139 context_window: 256_000,
140 max_input_tokens: 224_000,
141 max_output_tokens: 128_000,
142 supports: {
143 input: ['text', 'image', 'video'],
144 output: ['text'],
145 capabilities: ['reasoning', 'tool_calling'],
146 tools: [] as const,
147 },
148} as const satisfies ModelMeta
149
150const SEED_1_8_251228 = {
151 name: 'seed-1-8-251228',
152 context_window: 256_000,
153 max_input_tokens: 224_000,
154 max_output_tokens: 64_000,
155 supports: {
156 input: ['text', 'image', 'video'],
157 output: ['text'],
158 capabilities: ['reasoning', 'tool_calling', 'structured_outputs'],
159 tools: [] as const,
160 },
161} as const satisfies ModelMeta
162
163const SEED_1_6_250915 = {
164 name: 'seed-1-6-250915',
165 context_window: 256_000,
166 max_input_tokens: 224_000,
167 max_output_tokens: 32_000,
168 supports: {
169 input: ['text', 'image', 'video'],
170 output: ['text'],
171 capabilities: ['reasoning', 'tool_calling', 'structured_outputs'],
172 tools: [] as const,
173 },
174} as const satisfies ModelMeta
175
176const SEED_1_6_250615 = {
177 name: 'seed-1-6-250615',
178 context_window: 256_000,
179 max_input_tokens: 224_000,
180 max_output_tokens: 32_000,
181 supports: {
182 input: ['text', 'image', 'video'],
183 output: ['text'],
184 capabilities: ['reasoning', 'tool_calling', 'structured_outputs'],
185 tools: [] as const,
186 },
187} as const satisfies ModelMeta
188
189const SEED_1_6_FLASH_250715 = {
190 name: 'seed-1-6-flash-250715',
191 context_window: 256_000,
192 max_input_tokens: 224_000,
193 max_output_tokens: 32_000,
194 supports: {
195 input: ['text', 'image', 'video'],
196 output: ['text'],
197 capabilities: ['reasoning', 'tool_calling', 'structured_outputs'],
198 tools: [] as const,
199 },
200} as const satisfies ModelMeta
201
202const SEED_1_6_FLASH_250615 = {
203 name: 'seed-1-6-flash-250615',
204 context_window: 256_000,
205 max_input_tokens: 224_000,
206 max_output_tokens: 32_000,
207 supports: {
208 input: ['text', 'image', 'video'],
209 output: ['text'],
210 capabilities: ['reasoning', 'tool_calling', 'structured_outputs'],
211 tools: [] as const,
212 },
213} as const satisfies ModelMeta
214
215const GLM_5_2_260617 = {
216 name: 'glm-5-2-260617',
217 context_window: 1_024_000,
218 max_input_tokens: 1_024_000,
219 max_output_tokens: 128_000,
220 supports: {
221 input: ['text'],
222 output: ['text'],
223 // Live-probed 2026-07-31: accepts json_schema, despite the docs table
224 // saying otherwise.
225 capabilities: ['reasoning', 'tool_calling', 'structured_outputs'],
226 tools: [] as const,
227 },
228} as const satisfies ModelMeta
229
230const GLM_4_7_251222 = {
231 name: 'glm-4-7-251222',
232 context_window: 256_000,
233 max_input_tokens: 224_000,
234 max_output_tokens: 128_000,
235 supports: {
236 input: ['text'],
237 output: ['text'],
238 // Adherence-probed 2026-07-31: ACCEPTS a json_schema with 200 but ignores
239 // it and answers in prose, so it is not a structured-output model. A
240 // status-code-only probe reads this as support — see the note on
241 // BYTEPLUS_STRUCTURED_OUTPUT_CHAT_MODELS.
242 capabilities: ['reasoning', 'tool_calling'],
243 tools: [] as const,
244 },
245} as const satisfies ModelMeta
246
247const DEEPSEEK_V4_PRO_260425 = {
248 name: 'deepseek-v4-pro-260425',
249 context_window: 1_024_000,
250 max_input_tokens: 1_024_000,
251 max_output_tokens: 384_000,
252 supports: {
253 input: ['text'],
254 output: ['text'],
255 capabilities: ['reasoning', 'tool_calling'],
256 tools: [] as const,
257 },
258} as const satisfies ModelMeta
259
260const DEEPSEEK_V4_FLASH_260425 = {
261 name: 'deepseek-v4-flash-260425',
262 context_window: 1_024_000,
263 max_input_tokens: 1_024_000,
264 max_output_tokens: 384_000,
265 supports: {
266 input: ['text'],
267 output: ['text'],
268 capabilities: ['reasoning', 'tool_calling'],
269 tools: [] as const,
270 },
271} as const satisfies ModelMeta
272
273// The one model on Ark that defaults to `thinking: disabled`.
274const DEEPSEEK_V3_2_251201 = {
275 name: 'deepseek-v3-2-251201',
276 context_window: 128_000,
277 max_input_tokens: 128_000,
278 max_output_tokens: 32_000,
279 supports: {
280 input: ['text'],
281 output: ['text'],
282 // Live-probed 2026-07-31: rejects both json_schema and json_object.
283 capabilities: ['reasoning', 'tool_calling'],
284 tools: [] as const,
285 },
286} as const satisfies ModelMeta
287
288// The only model accepting `thinking: {type: 'auto'}`. Tool calling is
289// undocumented on Ark and unverified, so it is not advertised.
290const GPT_OSS_120B_250805 = {
291 name: 'gpt-oss-120b-250805',
292 context_window: 128_000,
293 max_input_tokens: 96_000,
294 max_output_tokens: 64_000,
295 supports: {
296 input: ['text'],
297 output: ['text'],
298 capabilities: ['reasoning'],
299 tools: [] as const,
300 },
301} as const satisfies ModelMeta
302
303/**
304 * All supported BytePlus chat model identifiers.
305 */
306export const BYTEPLUS_CHAT_MODELS = [
307 DOLA_SEED_2_1_TURBO.name,
308 SEED_2_0_LITE_260428.name,
309 SEED_2_0_MINI_260428.name,
310 SEED_2_0_PRO_260328.name,
311 SEED_2_0_LITE_260228.name,
312 SEED_2_0_MINI_260215.name,
313 SEED_2_0_CODE_PREVIEW_260328.name,
314 SEED_1_8_251228.name,
315 SEED_1_6_250915.name,
316 SEED_1_6_250615.name,
317 SEED_1_6_FLASH_250715.name,
318 SEED_1_6_FLASH_250615.name,
319 GLM_5_2_260617.name,
320 GLM_4_7_251222.name,
321 DEEPSEEK_V4_PRO_260425.name,
322 DEEPSEEK_V4_FLASH_260425.name,
323 DEEPSEEK_V3_2_251201.name,
324 GPT_OSS_120B_250805.name,
325] as const
326
327/**
328 * Union of all supported BytePlus chat model names.
329 */
330export type BytePlusChatModel = (typeof BYTEPLUS_CHAT_MODELS)[number]
331
332/**
333 * Chat models that emit a `encrypted_content` blob alongside
334 * `reasoning_content` when thinking is enabled ("thinking summary" models).
335 *
336 * The blob is an opaque signature over the reasoning trace: when it is
337 * present it must be echoed back verbatim on the assistant message in the
338 * next turn. Live probing showed omitting it did *not* fail a simple tool
339 * round-trip, so adapters preserve and replay it when present but must never
340 * treat its absence as an error.
341 */
342export const BYTEPLUS_THINKING_SUMMARY_MODELS = [
343 DOLA_SEED_2_1_TURBO.name,
344 SEED_2_0_LITE_260428.name,
345 SEED_2_0_MINI_260428.name,
346 SEED_2_0_PRO_260328.name,
347] as const
348
349/**
350 * Union of chat models that emit `encrypted_content`.
351 */
352export type BytePlusThinkingSummaryModel =
353 (typeof BYTEPLUS_THINKING_SUMMARY_MODELS)[number]
354
355const THINKING_SUMMARY_MODEL_SET: ReadonlySet<string> = new Set(
356 BYTEPLUS_THINKING_SUMMARY_MODELS,
357)
358
359/**
360 * True when the model emits `encrypted_content` that should be round-tripped
361 * on subsequent turns.
362 */
363export function emitsEncryptedContent(model: string): boolean {
364 return THINKING_SUMMARY_MODEL_SET.has(model)
365}
366
367/**
368 * Chat models that accept `response_format: {type: 'json_schema'}`.
369 *
370 * Live-probed against all 18 chat models on 2026-07-31, not docs-derived — the
371 * BytePlus capability tables are wrong here in both directions.
372 *
373 * Membership needs TWO things, because the API has both failure modes:
374 * 1. The request is accepted. Seven models (`seed-2-0-lite-260428`,
375 * `seed-2-0-mini-260428`, `seed-2-0-code-preview-260328`, both
376 * `deepseek-v4-*`, `deepseek-v3-2-251201`, `gpt-oss-120b-250805`) answer a
377 * JSON schema with 400 InvalidParameter — and reject
378 * `{type: 'json_object'}` too, so there is no JSON-mode fallback.
379 * 2. The schema is actually honoured. `glm-4-7-251222` accepts the request
380 * with 200 and then ignores the schema, answering in prose (reproduced
381 * twice by the adherence probe). A status-code-only probe wrongly reads
382 * that as support, so it is excluded.
383 *
384 * Models that fail either check need tool-shaped extraction instead.
385 *
386 * Note that the default chat model `seed-2-0-lite-260428` is one of the
387 * rejecting models: structured-output work needs `seed-2-0-lite-260228` or
388 * `dola-seed-2-1-turbo-260628`.
389 */
390export const BYTEPLUS_STRUCTURED_OUTPUT_CHAT_MODELS = [
391 DOLA_SEED_2_1_TURBO.name,
392 SEED_2_0_PRO_260328.name,
393 SEED_2_0_LITE_260228.name,
394 SEED_2_0_MINI_260215.name,
395 SEED_1_8_251228.name,
396 SEED_1_6_250915.name,
397 SEED_1_6_250615.name,
398 SEED_1_6_FLASH_250715.name,
399 SEED_1_6_FLASH_250615.name,
400 GLM_5_2_260617.name,
401] as const
402
403const STRUCTURED_OUTPUT_MODEL_SET: ReadonlySet<string> = new Set(
404 BYTEPLUS_STRUCTURED_OUTPUT_CHAT_MODELS,
405)
406
407/**
408 * True when the model supports native JSON-schema structured output.
409 */
410export function supportsStructuredOutput(model: string): boolean {
411 return STRUCTURED_OUTPUT_MODEL_SET.has(model)
412}
413
414/**
415 * Type-only map from chat model name to whether it supports native
416 * JSON-schema structured output.
417 */
418export type BytePlusChatModelStructuredOutputByName = {
419 [K in BytePlusChatModel]: K extends BytePlusStructuredOutputChatModel
420 ? true
421 : false
422}
423
424/**
425 * Union of chat models supporting native JSON-schema structured output.
426 */
427export type BytePlusStructuredOutputChatModel =
428 (typeof BYTEPLUS_STRUCTURED_OUTPUT_CHAT_MODELS)[number]
429
430/**
431 * Type-only map from chat model name to its supported input modalities.
432 * Used for type inference when constructing multimodal messages.
433 */
434export type BytePlusModelInputModalitiesByName = {
435 [DOLA_SEED_2_1_TURBO.name]: typeof DOLA_SEED_2_1_TURBO.supports.input
436 [SEED_2_0_LITE_260428.name]: typeof SEED_2_0_LITE_260428.supports.input
437 [SEED_2_0_MINI_260428.name]: typeof SEED_2_0_MINI_260428.supports.input
438 [SEED_2_0_PRO_260328.name]: typeof SEED_2_0_PRO_260328.supports.input
439 [SEED_2_0_LITE_260228.name]: typeof SEED_2_0_LITE_260228.supports.input
440 [SEED_2_0_MINI_260215.name]: typeof SEED_2_0_MINI_260215.supports.input
441 [SEED_2_0_CODE_PREVIEW_260328.name]: typeof SEED_2_0_CODE_PREVIEW_260328.supports.input
442 [SEED_1_8_251228.name]: typeof SEED_1_8_251228.supports.input
443 [SEED_1_6_250915.name]: typeof SEED_1_6_250915.supports.input
444 [SEED_1_6_250615.name]: typeof SEED_1_6_250615.supports.input
445 [SEED_1_6_FLASH_250715.name]: typeof SEED_1_6_FLASH_250715.supports.input
446 [SEED_1_6_FLASH_250615.name]: typeof SEED_1_6_FLASH_250615.supports.input
447 [GLM_5_2_260617.name]: typeof GLM_5_2_260617.supports.input
448 [GLM_4_7_251222.name]: typeof GLM_4_7_251222.supports.input
449 [DEEPSEEK_V4_PRO_260425.name]: typeof DEEPSEEK_V4_PRO_260425.supports.input
450 [DEEPSEEK_V4_FLASH_260425.name]: typeof DEEPSEEK_V4_FLASH_260425.supports.input
451 [DEEPSEEK_V3_2_251201.name]: typeof DEEPSEEK_V3_2_251201.supports.input
452 [GPT_OSS_120B_250805.name]: typeof GPT_OSS_120B_250805.supports.input
453}
454
455/**
456 * Type-only map from chat model name to its supported provider tools.
457 * BytePlus exposes no provider-tool factories, so every model gets an empty
458 * tuple — passing another provider's tool is then a compile-time error.
459 */
460export type BytePlusChatModelToolCapabilitiesByName = {
461 [K in BytePlusChatModel]: ReadonlyArray<BytePlusProviderToolKind>
462}
463
464/**
465 * Type-only map from chat model name to its provider options type.
466 */
467export type BytePlusChatModelProviderOptionsByName = {
468 [K in BytePlusChatModel]: BytePlusTextProviderOptions
469}
470
471// ============================================================================
472// Video models (Seedance, async task API)
473// ============================================================================
474
475/**
476 * Output aspect ratios accepted by the Seedance task API. `adaptive` is only
477 * meaningful for image-to-video, where the ratio follows the input frame.
478 */
479export type BytePlusVideoRatio =
480 | '16:9'
481 | '9:16'
482 | '4:3'
483 | '3:4'
484 | '1:1'
485 | '21:9'
486 | 'adaptive'
487
488/**
489 * Resolution tiers accepted by the Seedance task API.
490 *
491 * Resolution tiers are model-specific (see
492 * {@link BytePlusVideoModelResolutionByName}). Two findings that still
493 * contradict older BytePlus prose: there is **no 2K tier on any Seedance
494 * model**, and `4k` exists only on `dreamina-seedance-2-0-260128` (Seedance
495 * 2.5 is 480p/720p only, per the live ModelArk docs).
496 *
497 * The API matches this field case-insensitively (`4K`, `4k` and `1080P` are
498 * all accepted), so this package standardizes on the lowercase spelling.
499 */
500export type BytePlusVideoResolution = '480p' | '720p' | '1080p' | '4k'
501
502/**
503 * Generic `size` template for Seedance models: either a bare aspect ratio
504 * ("16:9") or `ratio_resolution` ("16:9_720p"). The Seedance API takes the
505 * two as separate `ratio` / `resolution` fields; the adapter splits this
506 * template back apart.
507 */
508export type BytePlusVideoSize<
509 TResolution extends BytePlusVideoResolution = BytePlusVideoResolution,
510> = BytePlusVideoRatio | `${BytePlusVideoRatio}_${TResolution}`
511
512// Multimodal reference-media capabilities (reference images / video / audio)
513// are docs-derived from the ModelArk create-task page. Model ids and the
514// resolution / duration tables for 2.0 were also live-probed on 2026-07-31;
515// 2.5 lands from the public docs once the model was fully opened (2026-08-07).
516const DREAMINA_SEEDANCE_2_5 = {
517 name: 'dreamina-seedance-2-5-260628',
518 supports: {
519 input: ['text', 'image', 'video', 'audio'],
520 output: ['video', 'audio'],
521 },
522} as const satisfies ModelMeta
523
524const DREAMINA_SEEDANCE_2_0 = {
525 name: 'dreamina-seedance-2-0-260128',
526 supports: {
527 input: ['text', 'image', 'video', 'audio'],
528 output: ['video', 'audio'],
529 },
530} as const satisfies ModelMeta
531
532const DREAMINA_SEEDANCE_2_0_FAST = {
533 name: 'dreamina-seedance-2-0-fast-260128',
534 supports: {
535 input: ['text', 'image', 'video', 'audio'],
536 output: ['video', 'audio'],
537 },
538} as const satisfies ModelMeta
539
540const DREAMINA_SEEDANCE_2_0_MINI = {
541 name: 'dreamina-seedance-2-0-mini-260615',
542 supports: {
543 input: ['text', 'image', 'video', 'audio'],
544 output: ['video', 'audio'],
545 },
546} as const satisfies ModelMeta
547
548const SEEDANCE_1_5_PRO = {
549 name: 'seedance-1-5-pro-251215',
550 supports: {
551 input: ['text', 'image'],
552 output: ['video', 'audio'],
553 },
554} as const satisfies ModelMeta
555
556const SEEDANCE_1_0_PRO = {
557 name: 'seedance-1-0-pro-250528',
558 supports: {
559 input: ['text', 'image'],
560 output: ['video'],
561 },
562} as const satisfies ModelMeta
563
564const SEEDANCE_1_0_PRO_FAST = {
565 name: 'seedance-1-0-pro-fast-251015',
566 supports: {
567 input: ['text', 'image'],
568 output: ['video'],
569 },
570} as const satisfies ModelMeta
571
572/**
573 * All supported Seedance video model identifiers.
574 */
575export const BYTEPLUS_VIDEO_MODELS = [
576 DREAMINA_SEEDANCE_2_5.name,
577 DREAMINA_SEEDANCE_2_0.name,
578 DREAMINA_SEEDANCE_2_0_FAST.name,
579 DREAMINA_SEEDANCE_2_0_MINI.name,
580 SEEDANCE_1_5_PRO.name,
581 SEEDANCE_1_0_PRO.name,
582 SEEDANCE_1_0_PRO_FAST.name,
583] as const
584
585/**
586 * Union of all supported Seedance video model names.
587 */
588export type BytePlusVideoModel = (typeof BYTEPLUS_VIDEO_MODELS)[number]
589
590/**
591 * Type-only map from video model name to the non-text prompt modalities it
592 * accepts. Seedance 2.5 and the 2.0 family take multimodal references
593 * (start/end frames, reference images, reference video and audio); the 1.x
594 * models take start/end frames only.
595 */
596export type BytePlusVideoModelInputModalitiesByName = {
597 [DREAMINA_SEEDANCE_2_5.name]: readonly ['image', 'video', 'audio']
598 [DREAMINA_SEEDANCE_2_0.name]: readonly ['image', 'video', 'audio']
599 [DREAMINA_SEEDANCE_2_0_FAST.name]: readonly ['image', 'video', 'audio']
600 [DREAMINA_SEEDANCE_2_0_MINI.name]: readonly ['image', 'video', 'audio']
601 [SEEDANCE_1_5_PRO.name]: readonly ['image']
602 [SEEDANCE_1_0_PRO.name]: readonly ['image']
603 [SEEDANCE_1_0_PRO_FAST.name]: readonly ['image']
604}
605
606/**
607 * Type-only map from video model name to the resolutions it accepts.
608 *
609 * 2.0 / 1.x cells were probe-verified on 2026-07-31; 2.5 comes from the
610 * public ModelArk create-task docs (2026-08-07). Note
611 * `seedance-1-0-pro-fast-251015` does accept `1080p`, despite older BytePlus
612 * prose listing it as 480p/720p.
613 */
614export type BytePlusVideoModelResolutionByName = {
615 [DREAMINA_SEEDANCE_2_5.name]: '480p' | '720p'
616 [DREAMINA_SEEDANCE_2_0.name]: '480p' | '720p' | '1080p' | '4k'
617 [DREAMINA_SEEDANCE_2_0_FAST.name]: '480p' | '720p'
618 [DREAMINA_SEEDANCE_2_0_MINI.name]: '480p' | '720p'
619 [SEEDANCE_1_5_PRO.name]: '480p' | '720p' | '1080p'
620 [SEEDANCE_1_0_PRO.name]: '480p' | '720p' | '1080p'
621 [SEEDANCE_1_0_PRO_FAST.name]: '480p' | '720p' | '1080p'
622}
623
624/**
625 * Type-only map from video model name to its accepted `size` strings.
626 */
627export type BytePlusVideoModelSizeByName = {
628 [K in BytePlusVideoModel]: BytePlusVideoSize<
629 BytePlusVideoModelResolutionByName[K]
630 >
631}
632
633/**
634 * A Seedance model id: one this package knows, or any other string.
635 *
636 * The open half is a deliberate escape hatch for models BytePlus ships between
637 * releases of this package. Adding a model to {@link BYTEPLUS_VIDEO_MODELS}
638 * *narrows* it — the adapter's guards switch on and reject against this
639 * file's tables. For a model whose real limits are unknown that is strictly
640 * worse than the open path, which lets Ark judge. So an id lands in the
641 * known table only once its capability cells are documented or probed.
642 *
643 * Discovering ids: `GET /models` on the Ark data plane enumerates the catalog
644 * (id, `task_type`, `modalities`, `status`). It is not exhaustive —
645 * `seedream-5-0-lite-260128` answers requests but is missing from the
646 * listing — so absence there is not evidence of absence. The ModelArk
647 * release notes (https://docs.byteplus.com/en/docs/ModelArk/1159178) are the
648 * other watch surface.
649 *
650 * To probe an id, POST `/contents/generations/tasks` with only
651 * `{"model": "<id>"}`. Three outcomes, all live-verified:
652 * - 400 `MissingParameter` (about `content`) — live and usable.
653 * - 404 `ModelNotOpen` — real, but not activated on this account.
654 * - 404 `InvalidEndpointOrModel.NotFound` — no such model.
655 *
656 * Unknown ids trade compile-time narrowing for reach: the full size surface is
657 * accepted, provider options are ungated, and the adapter's model-specific
658 * runtime guards stand down so a new model's legitimate request reaches Ark.
659 * Known ids keep their documented / probe-verified narrowing.
660 */
661export type BytePlusVideoModelOrString = BytePlusVideoModel | (string & {})
662
663/**
664 * Resolve the `size` type for a video model: the model's probe-verified
665 * template union when known, otherwise the full template surface plus any
666 * string (a future model may bring ratios or resolution tiers that do not
667 * exist today).
668 */
669export type ResolveBytePlusVideoSize<TModel extends string> =
670 TModel extends BytePlusVideoModel
671 ? BytePlusVideoModelSizeByName[TModel]
672 : BytePlusVideoSize | (string & {})
673
674/**
675 * Resolve the accepted non-text prompt modalities for a video model. Unknown
676 * models accept all three rather than none, so a new model's reference media
677 * is not a compile error.
678 */
679export type ResolveBytePlusVideoInputModalities<TModel extends string> =
680 TModel extends BytePlusVideoModel
681 ? BytePlusVideoModelInputModalitiesByName[TModel]
682 : readonly ['image', 'video', 'audio']
683
684const VIDEO_MODEL_SET: ReadonlySet<string> = new Set(BYTEPLUS_VIDEO_MODELS)
685
686/**
687 * True when the id is one this package has probe-verified metadata for.
688 *
689 * The adapter uses this to decide whether its model-specific guards apply:
690 * see {@link BytePlusVideoModelOrString}.
691 */
692export function isKnownBytePlusVideoModel(
693 model: string,
694): model is BytePlusVideoModel {
695 return VIDEO_MODEL_SET.has(model)
696}
697
698/**
699 * Per-model duration type. Seedance accepts any integer second inside the
700 * model's range, so this is a continuous range expressed as `number` — a
701 * literal union cannot represent it. (The API also accepts `duration: -1` on
702 * Seedance 2.5, 2.0 and 1.5-pro to let the model choose; that is reachable
703 * through provider options, not through the generic `duration`.)
704 */
705export type BytePlusVideoModelDurationByName = {
706 [K in BytePlusVideoModel]: number
707}
708
709/**
710 * Runtime duration table backing `availableDurations()` / `snapDuration()`.
711 */
712export const BYTEPLUS_VIDEO_DURATIONS: {
713 readonly [TModel in BytePlusVideoModel]: DurationOptions<
714 BytePlusVideoModelDurationByName[TModel]
715 >
716} = {
717 'dreamina-seedance-2-5-260628': {
718 kind: 'range',
719 min: 4,
720 max: 30,
721 step: 1,
722 unit: 'seconds',
723 },
724 'dreamina-seedance-2-0-260128': {
725 kind: 'range',
726 min: 4,
727 max: 15,
728 step: 1,
729 unit: 'seconds',
730 },
731 'dreamina-seedance-2-0-fast-260128': {
732 kind: 'range',
733 min: 4,
734 max: 15,
735 step: 1,
736 unit: 'seconds',
737 },
738 'dreamina-seedance-2-0-mini-260615': {
739 kind: 'range',
740 min: 4,
741 max: 15,
742 step: 1,
743 unit: 'seconds',
744 },
745 'seedance-1-5-pro-251215': {
746 kind: 'range',
747 min: 4,
748 max: 12,
749 step: 1,
750 unit: 'seconds',
751 },
752 'seedance-1-0-pro-250528': {
753 kind: 'range',
754 min: 2,
755 max: 12,
756 step: 1,
757 unit: 'seconds',
758 },
759 'seedance-1-0-pro-fast-251015': {
760 kind: 'range',
761 min: 2,
762 max: 12,
763 step: 1,
764 unit: 'seconds',
765 },
766}
767
768/**
769 * Duration hint for a model this package has no table for.
770 *
771 * Spans every range Seedance has shipped so far (2s on the 1.0 models through
772 * 30s on Seedance 2.5) so `availableDurations()` can still drive a UI. It is
773 * a hint, not a contract: the adapter does **not** snap an unknown model's
774 * duration against it, because clamping a future model's legitimate longer
775 * request down to 30 would corrupt the request rather than protect it.
776 */
777export const BYTEPLUS_VIDEO_FALLBACK_DURATIONS: DurationOptions<number> = {
778 kind: 'range',
779 min: 2,
780 max: 30,
781 step: 1,
782 unit: 'seconds',
783}
784
785/**
786 * Look up the duration options for a Seedance video model, falling back to
787 * {@link BYTEPLUS_VIDEO_FALLBACK_DURATIONS} for an id this package does not
788 * know.
789 */
790export function getBytePlusVideoDurationOptions(
791 model: BytePlusVideoModelOrString,
792): DurationOptions<number> {
793 return isKnownBytePlusVideoModel(model)
794 ? BYTEPLUS_VIDEO_DURATIONS[model]
795 : BYTEPLUS_VIDEO_FALLBACK_DURATIONS
796}
797
798// ============================================================================
799// Image models (Seedream)
800// ============================================================================
801
802/**
803 * Shorthand size tokens accepted by `/images/generations`. A request uses
804 * either a token or an explicit `WxH` string — never both.
805 */
806export type BytePlusImageSizeToken = '1K' | '2K' | '4K'
807
808/**
809 * Accepted `size` values for Seedream models: a shorthand token or an
810 * explicit pixel size such as `2048x2048`.
811 */
812export type BytePlusImageSize = BytePlusImageSizeToken | `${number}x${number}`
813
814const DOLA_SEEDREAM_5_0_PRO = {
815 name: 'dola-seedream-5-0-pro-260628',
816 supports: {
817 input: ['text', 'image'],
818 output: ['image'],
819 },
820} as const satisfies ModelMeta
821
822const SEEDREAM_5_0 = {
823 name: 'seedream-5-0-260128',
824 supports: {
825 input: ['text', 'image'],
826 output: ['image'],
827 },
828} as const satisfies ModelMeta
829
830const SEEDREAM_5_0_LITE = {
831 name: 'seedream-5-0-lite-260128',
832 supports: {
833 input: ['text', 'image'],
834 output: ['image'],
835 },
836} as const satisfies ModelMeta
837
838const SEEDREAM_4_5 = {
839 name: 'seedream-4-5-251128',
840 supports: {
841 input: ['text', 'image'],
842 output: ['image'],
843 },
844} as const satisfies ModelMeta
845
846const SEEDREAM_4_0 = {
847 name: 'seedream-4-0-250828',
848 supports: {
849 input: ['text', 'image'],
850 output: ['image'],
851 },
852} as const satisfies ModelMeta
853
854/**
855 * All supported Seedream image model identifiers.
856 */
857export const BYTEPLUS_IMAGE_MODELS = [
858 DOLA_SEEDREAM_5_0_PRO.name,
859 SEEDREAM_5_0.name,
860 SEEDREAM_5_0_LITE.name,
861 SEEDREAM_4_5.name,
862 SEEDREAM_4_0.name,
863] as const
864
865/**
866 * Union of all supported Seedream image model names.
867 */
868export type BytePlusImageModel = (typeof BYTEPLUS_IMAGE_MODELS)[number]
869
870/**
871 * Type-only map from image model name to its accepted `size` strings.
872 */
873export type BytePlusImageModelSizeByName = {
874 [K in BytePlusImageModel]: BytePlusImageSize
875}
876
877/**
878 * Maximum number of reference images accepted per editing request.
879 * Seedream 5.0 Pro caps at 10 references; the other editing-capable models
880 * accept up to 14.
881 *
882 * Docs-derived, not live-probed. The 14 for `seedream-5-0-260128` is weaker
883 * still — the docs never state a cap for that model, so it is inferred from
884 * the rest of the family.
885 */
886export const BYTEPLUS_IMAGE_MAX_REFERENCE_IMAGES: {
887 readonly [K in BytePlusImageModel]: number
888} = {
889 'dola-seedream-5-0-pro-260628': 10,
890 'seedream-5-0-260128': 14,
891 'seedream-5-0-lite-260128': 14,
892 'seedream-4-5-251128': 14,
893 'seedream-4-0-250828': 14,
894}
895
896// ============================================================================
897// Seed Speech models (voice host — separate product and API key)
898// ============================================================================
899
900const SEED_AUDIO_1_0 = {
901 name: 'seed-audio-1.0',
902 supports: {
903 input: ['text', 'audio'],
904 output: ['audio'],
905 },
906} as const satisfies ModelMeta
907
908// Seed Speech ASR is endpoint-addressed: `POST /api/v3/auc/bigmodel/recognize/
909// flash` selects the model through the `X-Api-Resource-Id` header
910// (`volc.seedasr.auc_turbo`) and takes no `model` field in the body. This
911// synthetic identifier satisfies the SDK's `TranscriptionOptions.model`
912// contract and gives logging and fixture matching a stable value.
913const SEED_ASR = {
914 name: 'seed-asr',
915 supports: {
916 input: ['audio'],
917 output: ['text'],
918 },
919} as const satisfies ModelMeta
920
921/**
922 * All supported Seed Speech TTS model identifiers.
923 *
924 * Note: TTS runs on `voice.ap-southeast-1.bytepluses.com` with an
925 * `X-Api-Key` header and a *different* API key from Ark.
926 */
927export const BYTEPLUS_TTS_MODELS = [SEED_AUDIO_1_0.name] as const
928
929/**
930 * All supported Seed Speech transcription model identifiers.
931 */
932export const BYTEPLUS_TRANSCRIPTION_MODELS = [SEED_ASR.name] as const
933
934/**
935 * Union of all supported Seed Speech TTS model names.
936 */
937export type BytePlusTTSModel = (typeof BYTEPLUS_TTS_MODELS)[number]
938
939/**
940 * Union of all supported Seed Speech transcription model names.
941 */
942export type BytePlusTranscriptionModel =
943 (typeof BYTEPLUS_TRANSCRIPTION_MODELS)[number]
944
945// ============================================================================
946// Type resolution helpers
947// ============================================================================
948
949/**
950 * Resolve provider options for a specific model. Models listed in the chat
951 * map get their explicit options; anything else falls back to the base chat
952 * options.
953 */
954export type ResolveProviderOptions<TModel extends string> =
955 TModel extends keyof BytePlusChatModelProviderOptionsByName
956 ? BytePlusChatModelProviderOptionsByName[TModel]
957 : BytePlusTextProviderOptions
958
959/**
960 * Resolve input modalities for a specific model. Models missing from the map
961 * are treated as text-only.
962 */
963export type ResolveInputModalities<TModel extends string> =
964 TModel extends keyof BytePlusModelInputModalitiesByName
965 ? BytePlusModelInputModalitiesByName[TModel]
966 : readonly ['text']