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