@tanstack/ai-byteplus 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +202 -0
  3. package/dist/esm/adapters/image.d.ts +89 -0
  4. package/dist/esm/adapters/image.js +229 -0
  5. package/dist/esm/adapters/image.js.map +1 -0
  6. package/dist/esm/adapters/text.d.ts +163 -0
  7. package/dist/esm/adapters/text.js +347 -0
  8. package/dist/esm/adapters/text.js.map +1 -0
  9. package/dist/esm/adapters/transcription.d.ts +102 -0
  10. package/dist/esm/adapters/transcription.js +274 -0
  11. package/dist/esm/adapters/transcription.js.map +1 -0
  12. package/dist/esm/adapters/tts.d.ts +143 -0
  13. package/dist/esm/adapters/tts.js +307 -0
  14. package/dist/esm/adapters/tts.js.map +1 -0
  15. package/dist/esm/adapters/video.d.ts +182 -0
  16. package/dist/esm/adapters/video.js +442 -0
  17. package/dist/esm/adapters/video.js.map +1 -0
  18. package/dist/esm/audio/transcription-provider-options.d.ts +46 -0
  19. package/dist/esm/audio/tts-provider-options.d.ts +114 -0
  20. package/dist/esm/audio/wire-types.d.ts +261 -0
  21. package/dist/esm/audio/wire-types.js +28 -0
  22. package/dist/esm/audio/wire-types.js.map +1 -0
  23. package/dist/esm/image/image-provider-options.d.ts +165 -0
  24. package/dist/esm/image/image-provider-options.js +134 -0
  25. package/dist/esm/image/image-provider-options.js.map +1 -0
  26. package/dist/esm/image/wire-types.d.ts +149 -0
  27. package/dist/esm/index.d.ts +25 -0
  28. package/dist/esm/index.js +11 -0
  29. package/dist/esm/message-types.d.ts +154 -0
  30. package/dist/esm/model-meta.d.ts +594 -0
  31. package/dist/esm/model-meta.js +619 -0
  32. package/dist/esm/model-meta.js.map +1 -0
  33. package/dist/esm/text/text-provider-options.d.ts +109 -0
  34. package/dist/esm/utils/client.d.ts +183 -0
  35. package/dist/esm/utils/client.js +253 -0
  36. package/dist/esm/utils/client.js.map +1 -0
  37. package/dist/esm/video/video-provider-options.d.ts +197 -0
  38. package/dist/esm/video/video-provider-options.js +191 -0
  39. package/dist/esm/video/video-provider-options.js.map +1 -0
  40. package/dist/esm/video/wire-types.d.ts +248 -0
  41. package/package.json +77 -0
  42. package/src/adapters/image.ts +409 -0
  43. package/src/adapters/text.ts +539 -0
  44. package/src/adapters/transcription.ts +479 -0
  45. package/src/adapters/tts.ts +447 -0
  46. package/src/adapters/video.ts +732 -0
  47. package/src/audio/transcription-provider-options.ts +46 -0
  48. package/src/audio/tts-provider-options.ts +122 -0
  49. package/src/audio/wire-types.ts +290 -0
  50. package/src/image/image-provider-options.ts +288 -0
  51. package/src/image/wire-types.ts +169 -0
  52. package/src/index.ts +222 -0
  53. package/src/message-types.ts +169 -0
  54. package/src/model-meta.ts +954 -0
  55. package/src/text/text-provider-options.ts +151 -0
  56. package/src/utils/client.ts +377 -0
  57. package/src/video/video-provider-options.ts +361 -0
  58. package/src/video/wire-types.ts +293 -0
@@ -0,0 +1,134 @@
1
+ import { BYTEPLUS_IMAGE_MAX_REFERENCE_IMAGES } from "../model-meta.js";
2
+ //#region src/image/image-provider-options.ts
3
+ /**
4
+ * Provider options and request validation for Seedream image generation.
5
+ *
6
+ * Field names, enums, defaults and ranges come from the harvested Ark
7
+ * OpenAPI document for the `ImageGenerations` action; the Seedream 4.0
8
+ * behaviour noted below was confirmed live on 2026-07-31.
9
+ */
10
+ /**
11
+ * BytePlus documents a 600-word ceiling on the image prompt. Word-based, so
12
+ * it is only meaningful for space-separated scripts — the check below never
13
+ * fires for Chinese or Japanese text, which is the intended behaviour.
14
+ */
15
+ var BYTEPLUS_IMAGE_MAX_PROMPT_WORDS = 600;
16
+ /**
17
+ * Upper bound of `sequential_image_generation_options.max_images`, i.e. the
18
+ * most images one request can return.
19
+ */
20
+ var BYTEPLUS_IMAGE_MAX_SEQUENTIAL_IMAGES = 15;
21
+ /**
22
+ * Models that accept `output_format`.
23
+ *
24
+ * The Ark OpenAPI document's field note claims 5.0-lite only, but its own
25
+ * request demo sends `output_format` on `seedream-5-0-260128`, so the whole
26
+ * 5.0 family is treated as supporting it. The Seedream 4.x snapshots are
27
+ * documented as not reading it, so `output_format` is omitted from their
28
+ * provider-options type — but, as with `sequential_image_generation`, it is
29
+ * not gated at runtime: a value that reaches a model which does not read it
30
+ * comes back as an Ark error rather than a local rejection.
31
+ */
32
+ var BYTEPLUS_OUTPUT_FORMAT_IMAGE_MODELS = [
33
+ "dola-seedream-5-0-pro-260628",
34
+ "seedream-5-0-260128",
35
+ "seedream-5-0-lite-260128"
36
+ ];
37
+ var SIZE_TOKENS = [
38
+ "1K",
39
+ "2K",
40
+ "4K"
41
+ ];
42
+ /**
43
+ * Parses a Seedream `size` string. Accepts a shorthand token (case-insensitive
44
+ * — `2k` normalizes to `2K`) or explicit `WIDTHxHEIGHT` pixels, and returns
45
+ * `undefined` for anything else, including mixtures such as `2K x 1024`.
46
+ */
47
+ function parseBytePlusImageSize(size) {
48
+ const trimmed = size.trim();
49
+ const token = SIZE_TOKENS.find((candidate) => candidate.toLowerCase() === trimmed.toLowerCase());
50
+ if (token) return {
51
+ kind: "token",
52
+ value: token
53
+ };
54
+ const pixels = /^(\d+)[xX](\d+)$/.exec(trimmed);
55
+ if (pixels) {
56
+ const width = Number(pixels[1]);
57
+ const height = Number(pixels[2]);
58
+ if (width > 0 && height > 0) return {
59
+ kind: "pixels",
60
+ width,
61
+ height
62
+ };
63
+ }
64
+ }
65
+ /**
66
+ * Validates the generic `size` option and returns the string to put on the
67
+ * wire (`2K`, `2048x2048`), or `undefined` when no size was requested.
68
+ *
69
+ * This checks the *form* only. Which pixel dimensions a given model actually
70
+ * accepts is not encoded here, so the message deliberately makes no per-model
71
+ * claim; an out-of-range size is left to the API to reject.
72
+ *
73
+ * @throws Error when the value is neither a size token nor `WIDTHxHEIGHT`.
74
+ */
75
+ function resolveBytePlusImageSize(size) {
76
+ if (size === void 0) return void 0;
77
+ const parsed = parseBytePlusImageSize(size);
78
+ if (!parsed) throw new Error(`byteplus: size "${size}" is not a Seedream size. Use a size token (${SIZE_TOKENS.join(", ")}) or explicit pixels with an ASCII "x" ("2048x2048") — never a mix of the two.`);
79
+ return parsed.kind === "token" ? parsed.value : `${parsed.width}x${parsed.height}`;
80
+ }
81
+ /**
82
+ * Validates the prompt text against BytePlus's documented limits.
83
+ *
84
+ * @throws Error when the prompt is empty or exceeds
85
+ * {@link BYTEPLUS_IMAGE_MAX_PROMPT_WORDS} words.
86
+ */
87
+ function validateBytePlusImagePrompt(model, prompt) {
88
+ if (prompt.trim().length === 0) throw new Error(`byteplus: model "${model}" requires prompt text. Seedream takes an instruction even when editing reference images.`);
89
+ const words = prompt.trim().split(/\s+/).length;
90
+ if (words > 600) throw new Error(`byteplus: prompt is ${words} words; model "${model}" accepts at most 600.`);
91
+ }
92
+ /**
93
+ * Validates the reference-image count against the model's editing limit.
94
+ *
95
+ * A model this package has no limit for is left to Ark, deliberately and
96
+ * explicitly. `model` is typed closed, but `wire-types.ts` documents that the
97
+ * endpoint also accepts preconfigured endpoint ids (`ep-…`), so a JS caller
98
+ * can reach an id that is not in the table. Reading `undefined` out of it and
99
+ * comparing `count > undefined` — always false — would disable the guard by
100
+ * accident and look identical to passing; the explicit early return says the
101
+ * skip is intended.
102
+ *
103
+ * @throws Error when more references are supplied than a *known* model accepts.
104
+ */
105
+ function validateBytePlusReferenceImages(model, count) {
106
+ const max = BYTEPLUS_IMAGE_MAX_REFERENCE_IMAGES[model];
107
+ if (max === void 0) return;
108
+ if (count > max) throw new Error(`byteplus: model "${model}" accepts at most ${max} reference images; received ${count}.`);
109
+ }
110
+ /**
111
+ * Maps the generic `numberOfImages` option onto Seedream's group-image
112
+ * parameters.
113
+ *
114
+ * The endpoint has no `n`: more than one image per request is only reachable
115
+ * through `sequential_image_generation: 'auto'`, where `max_images` is an
116
+ * upper bound and the model decides how many images the prompt actually
117
+ * warrants. A request for N images can therefore come back with fewer — the
118
+ * one place BytePlus cannot honour `numberOfImages` exactly.
119
+ *
120
+ * @throws Error when the count is not an integer in `[1, 15]`.
121
+ */
122
+ function resolveBytePlusSequentialImages(model, numberOfImages) {
123
+ if (numberOfImages === void 0) return {};
124
+ if (!Number.isInteger(numberOfImages) || numberOfImages < 1 || numberOfImages > 15) throw new Error(`byteplus: numberOfImages must be a whole number between 1 and 15 on model "${model}"; received ${numberOfImages}.`);
125
+ if (numberOfImages === 1) return {};
126
+ return {
127
+ sequential_image_generation: "auto",
128
+ sequential_image_generation_options: { max_images: numberOfImages }
129
+ };
130
+ }
131
+ //#endregion
132
+ export { BYTEPLUS_IMAGE_MAX_PROMPT_WORDS, BYTEPLUS_IMAGE_MAX_SEQUENTIAL_IMAGES, BYTEPLUS_OUTPUT_FORMAT_IMAGE_MODELS, parseBytePlusImageSize, resolveBytePlusImageSize, resolveBytePlusSequentialImages, validateBytePlusImagePrompt, validateBytePlusReferenceImages };
133
+
134
+ //# sourceMappingURL=image-provider-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-provider-options.js","names":[],"sources":["../../../src/image/image-provider-options.ts"],"sourcesContent":["/**\n * Provider options and request validation for Seedream image generation.\n *\n * Field names, enums, defaults and ranges come from the harvested Ark\n * OpenAPI document for the `ImageGenerations` action; the Seedream 4.0\n * behaviour noted below was confirmed live on 2026-07-31.\n */\nimport { BYTEPLUS_IMAGE_MAX_REFERENCE_IMAGES } from '../model-meta'\nimport type {\n BytePlusImageOutputFormat,\n BytePlusImageResponseFormat,\n BytePlusOptimizePromptOptions,\n BytePlusSequentialImageGeneration,\n BytePlusSequentialImageGenerationOptions,\n} from './wire-types'\nimport type { BytePlusImageModel, BytePlusImageSize } from '../model-meta'\n\n/**\n * BytePlus documents a 600-word ceiling on the image prompt. Word-based, so\n * it is only meaningful for space-separated scripts — the check below never\n * fires for Chinese or Japanese text, which is the intended behaviour.\n */\nexport const BYTEPLUS_IMAGE_MAX_PROMPT_WORDS = 600\n\n/**\n * Upper bound of `sequential_image_generation_options.max_images`, i.e. the\n * most images one request can return.\n */\nexport const BYTEPLUS_IMAGE_MAX_SEQUENTIAL_IMAGES = 15\n\n/**\n * Models that accept `output_format`.\n *\n * The Ark OpenAPI document's field note claims 5.0-lite only, but its own\n * request demo sends `output_format` on `seedream-5-0-260128`, so the whole\n * 5.0 family is treated as supporting it. The Seedream 4.x snapshots are\n * documented as not reading it, so `output_format` is omitted from their\n * provider-options type — but, as with `sequential_image_generation`, it is\n * not gated at runtime: a value that reaches a model which does not read it\n * comes back as an Ark error rather than a local rejection.\n */\nexport const BYTEPLUS_OUTPUT_FORMAT_IMAGE_MODELS: ReadonlyArray<BytePlusImageModel> =\n [\n 'dola-seedream-5-0-pro-260628',\n 'seedream-5-0-260128',\n 'seedream-5-0-lite-260128',\n ]\n\n/**\n * Base provider options shared by every Seedream model.\n */\nexport interface BytePlusImageBaseProviderOptions {\n /**\n * Return images as expiring links (`url`, valid 24 hours) or inline base64\n * (`b64_json`).\n *\n * @default 'url'\n */\n response_format?: BytePlusImageResponseFormat\n\n /**\n * Whether to stamp an \"AI generated\" watermark in the bottom-right corner.\n *\n * **BytePlus defaults this to `true`.** Pass `false` for a clean image.\n */\n watermark?: boolean\n\n /**\n * Group-image mode. Set to `auto` to let the model return a set of related\n * images (bounded by {@link BytePlusImageBaseProviderOptions.sequential_image_generation_options}).\n * `generateImage()`'s `numberOfImages` sets this for you; an explicit value\n * here wins.\n *\n * Documented on Seedream 5.0-lite, 4.5 and 4.0. It is sent as given on\n * every model rather than gated locally — the shipped 5.0 ids post-date the\n * published parameter table, and an unsupported combination comes back as a\n * clear Ark error.\n *\n * @default 'disabled'\n */\n sequential_image_generation?: BytePlusSequentialImageGeneration\n\n /** Bounds for group-image mode. Only read when the mode is `auto`. */\n sequential_image_generation_options?: BytePlusSequentialImageGenerationOptions\n\n /**\n * Prompt-rewriting configuration. Documented on Seedream 5.0-lite, 4.5 and\n * 4.0; `mode: 'fast'` is unsupported on 5.0-lite and 4.5.\n */\n optimize_prompt_options?: BytePlusOptimizePromptOptions\n}\n\n/**\n * Provider options for the Seedream 5.0 family, which additionally chooses the\n * generated file format.\n */\nexport interface BytePlusSeedream5ImageProviderOptions extends BytePlusImageBaseProviderOptions {\n /**\n * File format of the generated image.\n *\n * @default 'jpeg'\n */\n output_format?: BytePlusImageOutputFormat\n}\n\n/**\n * Every Seedream provider option, used as the adapter's base option type.\n * Call sites are narrowed per model by\n * {@link BytePlusImageModelProviderOptionsByName}.\n */\nexport type BytePlusImageProviderOptions = BytePlusSeedream5ImageProviderOptions\n\n/**\n * Type-only map from image model name to its provider options.\n */\nexport type BytePlusImageModelProviderOptionsByName = {\n 'dola-seedream-5-0-pro-260628': BytePlusSeedream5ImageProviderOptions\n 'seedream-5-0-260128': BytePlusSeedream5ImageProviderOptions\n 'seedream-5-0-lite-260128': BytePlusSeedream5ImageProviderOptions\n 'seedream-4-5-251128': BytePlusImageBaseProviderOptions\n 'seedream-4-0-250828': BytePlusImageBaseProviderOptions\n}\n\n/**\n * Type-only map from image model name to the non-text prompt modalities it\n * accepts. Every shipped Seedream model takes reference images for\n * image-conditioned generation.\n */\nexport type BytePlusImageModelInputModalitiesByName = {\n [K in BytePlusImageModel]: readonly ['image']\n}\n\n/**\n * A parsed `size` value: either the shorthand token form or explicit pixels.\n */\nexport type ParsedBytePlusImageSize =\n | { kind: 'token'; value: '1K' | '2K' | '4K' }\n | { kind: 'pixels'; width: number; height: number }\n\nconst SIZE_TOKENS = ['1K', '2K', '4K'] as const\n\n/**\n * Parses a Seedream `size` string. Accepts a shorthand token (case-insensitive\n * — `2k` normalizes to `2K`) or explicit `WIDTHxHEIGHT` pixels, and returns\n * `undefined` for anything else, including mixtures such as `2K x 1024`.\n */\nexport function parseBytePlusImageSize(\n size: string,\n): ParsedBytePlusImageSize | undefined {\n const trimmed = size.trim()\n\n const token = SIZE_TOKENS.find(\n (candidate) => candidate.toLowerCase() === trimmed.toLowerCase(),\n )\n if (token) return { kind: 'token', value: token }\n\n // ASCII \"x\" only: the docs render the separator as U+00D7 (`2048×2048`),\n // which the API does not accept, so it must not slip through here either.\n const pixels = /^(\\d+)[xX](\\d+)$/.exec(trimmed)\n if (pixels) {\n const width = Number(pixels[1])\n const height = Number(pixels[2])\n if (width > 0 && height > 0) return { kind: 'pixels', width, height }\n }\n\n return undefined\n}\n\n/**\n * Validates the generic `size` option and returns the string to put on the\n * wire (`2K`, `2048x2048`), or `undefined` when no size was requested.\n *\n * This checks the *form* only. Which pixel dimensions a given model actually\n * accepts is not encoded here, so the message deliberately makes no per-model\n * claim; an out-of-range size is left to the API to reject.\n *\n * @throws Error when the value is neither a size token nor `WIDTHxHEIGHT`.\n */\nexport function resolveBytePlusImageSize(\n size: BytePlusImageSize | string | undefined,\n): string | undefined {\n if (size === undefined) return undefined\n\n const parsed = parseBytePlusImageSize(size)\n if (!parsed) {\n throw new Error(\n `byteplus: size \"${size}\" is not a Seedream size. Use a size token ` +\n `(${SIZE_TOKENS.join(', ')}) or explicit pixels with an ASCII \"x\" ` +\n `(\"2048x2048\") — never a mix of the two.`,\n )\n }\n\n return parsed.kind === 'token'\n ? parsed.value\n : `${parsed.width}x${parsed.height}`\n}\n\n/**\n * Validates the prompt text against BytePlus's documented limits.\n *\n * @throws Error when the prompt is empty or exceeds\n * {@link BYTEPLUS_IMAGE_MAX_PROMPT_WORDS} words.\n */\nexport function validateBytePlusImagePrompt(\n model: string,\n prompt: string,\n): void {\n if (prompt.trim().length === 0) {\n throw new Error(\n `byteplus: model \"${model}\" requires prompt text. Seedream takes an ` +\n `instruction even when editing reference images.`,\n )\n }\n\n const words = prompt.trim().split(/\\s+/).length\n if (words > BYTEPLUS_IMAGE_MAX_PROMPT_WORDS) {\n throw new Error(\n `byteplus: prompt is ${words} words; model \"${model}\" accepts at most ` +\n `${BYTEPLUS_IMAGE_MAX_PROMPT_WORDS}.`,\n )\n }\n}\n\n/**\n * Validates the reference-image count against the model's editing limit.\n *\n * A model this package has no limit for is left to Ark, deliberately and\n * explicitly. `model` is typed closed, but `wire-types.ts` documents that the\n * endpoint also accepts preconfigured endpoint ids (`ep-…`), so a JS caller\n * can reach an id that is not in the table. Reading `undefined` out of it and\n * comparing `count > undefined` — always false — would disable the guard by\n * accident and look identical to passing; the explicit early return says the\n * skip is intended.\n *\n * @throws Error when more references are supplied than a *known* model accepts.\n */\nexport function validateBytePlusReferenceImages(\n model: BytePlusImageModel,\n count: number,\n): void {\n const max = BYTEPLUS_IMAGE_MAX_REFERENCE_IMAGES[model] as number | undefined\n if (max === undefined) return\n if (count > max) {\n throw new Error(\n `byteplus: model \"${model}\" accepts at most ${max} reference images; received ${count}.`,\n )\n }\n}\n\n/**\n * Maps the generic `numberOfImages` option onto Seedream's group-image\n * parameters.\n *\n * The endpoint has no `n`: more than one image per request is only reachable\n * through `sequential_image_generation: 'auto'`, where `max_images` is an\n * upper bound and the model decides how many images the prompt actually\n * warrants. A request for N images can therefore come back with fewer — the\n * one place BytePlus cannot honour `numberOfImages` exactly.\n *\n * @throws Error when the count is not an integer in `[1, 15]`.\n */\nexport function resolveBytePlusSequentialImages(\n model: string,\n numberOfImages: number | undefined,\n): {\n sequential_image_generation?: BytePlusSequentialImageGeneration\n sequential_image_generation_options?: BytePlusSequentialImageGenerationOptions\n} {\n if (numberOfImages === undefined) return {}\n\n if (\n !Number.isInteger(numberOfImages) ||\n numberOfImages < 1 ||\n numberOfImages > BYTEPLUS_IMAGE_MAX_SEQUENTIAL_IMAGES\n ) {\n throw new Error(\n `byteplus: numberOfImages must be a whole number between 1 and ` +\n `${BYTEPLUS_IMAGE_MAX_SEQUENTIAL_IMAGES} on model \"${model}\"; received ${numberOfImages}.`,\n )\n }\n\n if (numberOfImages === 1) return {}\n\n return {\n sequential_image_generation: 'auto',\n sequential_image_generation_options: { max_images: numberOfImages },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,IAAa,kCAAkC;;;;;AAM/C,IAAa,uCAAuC;;;;;;;;;;;;AAapD,IAAa,sCACX;CACE;CACA;CACA;AACF;AA6FF,IAAM,cAAc;CAAC;CAAM;CAAM;AAAI;;;;;;AAOrC,SAAgB,uBACd,MACqC;CACrC,MAAM,UAAU,KAAK,KAAK;CAE1B,MAAM,QAAQ,YAAY,MACvB,cAAc,UAAU,YAAY,MAAM,QAAQ,YAAY,CACjE;CACA,IAAI,OAAO,OAAO;EAAE,MAAM;EAAS,OAAO;CAAM;CAIhD,MAAM,SAAS,mBAAmB,KAAK,OAAO;CAC9C,IAAI,QAAQ;EACV,MAAM,QAAQ,OAAO,OAAO,EAAE;EAC9B,MAAM,SAAS,OAAO,OAAO,EAAE;EAC/B,IAAI,QAAQ,KAAK,SAAS,GAAG,OAAO;GAAE,MAAM;GAAU;GAAO;EAAO;CACtE;AAGF;;;;;;;;;;;AAYA,SAAgB,yBACd,MACoB;CACpB,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;CAE/B,MAAM,SAAS,uBAAuB,IAAI;CAC1C,IAAI,CAAC,QACH,MAAM,IAAI,MACR,mBAAmB,KAAK,8CAClB,YAAY,KAAK,IAAI,EAAE,+EAE/B;CAGF,OAAO,OAAO,SAAS,UACnB,OAAO,QACP,GAAG,OAAO,MAAM,GAAG,OAAO;AAChC;;;;;;;AAQA,SAAgB,4BACd,OACA,QACM;CACN,IAAI,OAAO,KAAK,CAAC,CAAC,WAAW,GAC3B,MAAM,IAAI,MACR,oBAAoB,MAAM,0FAE5B;CAGF,MAAM,QAAQ,OAAO,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;CACzC,IAAI,QAAA,KACF,MAAM,IAAI,MACR,uBAAuB,MAAM,iBAAiB,MAAM,uBAEtD;AAEJ;;;;;;;;;;;;;;AAeA,SAAgB,gCACd,OACA,OACM;CACN,MAAM,MAAM,oCAAoC;CAChD,IAAI,QAAQ,KAAA,GAAW;CACvB,IAAI,QAAQ,KACV,MAAM,IAAI,MACR,oBAAoB,MAAM,oBAAoB,IAAI,8BAA8B,MAAM,EACxF;AAEJ;;;;;;;;;;;;;AAcA,SAAgB,gCACd,OACA,gBAIA;CACA,IAAI,mBAAmB,KAAA,GAAW,OAAO,CAAC;CAE1C,IACE,CAAC,OAAO,UAAU,cAAc,KAChC,iBAAiB,KACjB,iBAAA,IAEA,MAAM,IAAI,MACR,8EACuD,MAAM,cAAc,eAAe,EAC5F;CAGF,IAAI,mBAAmB,GAAG,OAAO,CAAC;CAElC,OAAO;EACL,6BAA6B;EAC7B,qCAAqC,EAAE,YAAY,eAAe;CACpE;AACF"}
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Wire types for the BytePlus Ark image endpoint (`POST /images/generations`).
3
+ *
4
+ * Hand-written minimal shapes covering only the fields this adapter sends and
5
+ * reads. Provenance for every field is noted inline. Two sources:
6
+ *
7
+ * 1. The harvested OpenAPI 3.1 document for the `ark` service, action
8
+ * `ImageGenerations` (`x-updated-time: 2026-06-08`) — authoritative for
9
+ * field names, enum values, defaults and ranges.
10
+ * 2. A live `seedream-4-0-250828` call against
11
+ * `https://ark.ap-southeast.bytepluses.com/api/v3` on 2026-07-31, which
12
+ * pinned the actual response shape.
13
+ *
14
+ * The endpoint deviates from OpenAI's `/images/generations` in three ways that
15
+ * matter: there is no `n` parameter, `size` accepts a shorthand token as well
16
+ * as `WxH`, and input images for editing ride along in a top-level `image`
17
+ * field rather than a separate `/images/edits` endpoint.
18
+ */
19
+ /** How generated images come back. `url` links expire 24 hours after generation. */
20
+ export type BytePlusImageResponseFormat = 'url' | 'b64_json';
21
+ /** File format of the generated image. Seedream 5.0 family only. */
22
+ export type BytePlusImageOutputFormat = 'png' | 'jpeg';
23
+ /**
24
+ * Group-image ("sequential generation") switch.
25
+ *
26
+ * - `auto` — the model decides whether to return a set of related images and
27
+ * how many, bounded by `sequential_image_generation_options.max_images`.
28
+ * - `disabled` — exactly one image.
29
+ */
30
+ export type BytePlusSequentialImageGeneration = 'auto' | 'disabled';
31
+ /** Group-image bounds. Only read when `sequential_image_generation` is `auto`. */
32
+ export interface BytePlusSequentialImageGenerationOptions {
33
+ /** Upper bound on images returned for this request. Range `[1, 15]`. */
34
+ max_images?: number;
35
+ }
36
+ /** Prompt-rewriting configuration. Seedream 5.0-lite / 4.5 / 4.0 only. */
37
+ export interface BytePlusOptimizePromptOptions {
38
+ /**
39
+ * `standard` produces higher-quality results but is slower; `fast` is
40
+ * quicker with average quality (unsupported on Seedream 5.0-lite and 4.5).
41
+ */
42
+ mode: 'standard' | 'fast';
43
+ }
44
+ /**
45
+ * Request body for `POST /images/generations`.
46
+ *
47
+ * `model` and `prompt` are the only required fields.
48
+ */
49
+ export interface BytePlusImageGenerationRequest {
50
+ /** Seedream model id (or a preconfigured endpoint id). */
51
+ model: string;
52
+ /**
53
+ * Instruction text. The BytePlus docs give the limit as 600 English words.
54
+ * That ceiling is documentation-derived, not probe-confirmed.
55
+ */
56
+ prompt: string;
57
+ /**
58
+ * Input images for image-conditioned generation (editing, reference-guided
59
+ * generation, multi-reference composition). Each entry is either a publicly
60
+ * reachable URL or a data URI of the form
61
+ * `data:image/<format>;base64,<data>` — BytePlus requires `<format>` to be
62
+ * **lowercase**. Typed as an array because that is the form the OpenAPI
63
+ * schema documents.
64
+ */
65
+ image?: Array<string>;
66
+ /**
67
+ * Output size, as either a shorthand token (`1K`, `2K`, `4K`) or explicit
68
+ * pixel dimensions (`2048x2048`) — never a mix of the two. Defaults to
69
+ * `2048x2048` server-side.
70
+ */
71
+ size?: string;
72
+ /** Defaults to `url` server-side. */
73
+ response_format?: BytePlusImageResponseFormat;
74
+ /**
75
+ * Generated file format. Only the Seedream 5.0 family accepts this; the
76
+ * live 4.0 response carried no `output_format` at all. Defaults to `jpeg`.
77
+ */
78
+ output_format?: BytePlusImageOutputFormat;
79
+ /**
80
+ * Whether to stamp an "AI generated" watermark in the bottom-right corner.
81
+ *
82
+ * **Defaults to `true`** — unlike most providers, BytePlus watermarks unless
83
+ * you explicitly opt out with `watermark: false`.
84
+ */
85
+ watermark?: boolean;
86
+ /** Defaults to `disabled` server-side. */
87
+ sequential_image_generation?: BytePlusSequentialImageGeneration;
88
+ /** Only effective when `sequential_image_generation` is `auto`. */
89
+ sequential_image_generation_options?: BytePlusSequentialImageGenerationOptions;
90
+ /** Prompt-rewriting configuration. */
91
+ optimize_prompt_options?: BytePlusOptimizePromptOptions;
92
+ /**
93
+ * Server-sent-events mode, emitting each image as it finishes. Not used by
94
+ * this adapter — `generateImage()` resolves a complete result, and the core
95
+ * `stream: true` path chunks that result itself.
96
+ */
97
+ stream?: boolean;
98
+ }
99
+ /**
100
+ * One entry of the `data` array — either a generated image or, in group-image
101
+ * mode, a per-image failure.
102
+ *
103
+ * `url` is present when `response_format` is `url`, `b64_json` when it is
104
+ * `b64_json`. `size` is the *actual* pixel size the model produced (a `1K`
105
+ * request came back as `1152x864` live), and is only returned by some models.
106
+ * `error` is set instead of the image fields when that particular image of a
107
+ * group failed (e.g. `OutputImageSensitiveContentDetected`) while others
108
+ * succeeded.
109
+ *
110
+ * The OpenAPI document contradicts itself here, describing `data` items as a
111
+ * nested `{error[], imagecontent[]}` wrapper; the live response is the flat
112
+ * shape modeled below, so that is what this adapter reads.
113
+ */
114
+ export interface BytePlusImageData {
115
+ url?: string;
116
+ b64_json?: string;
117
+ size?: string;
118
+ error?: BytePlusImageErrorObject;
119
+ }
120
+ /**
121
+ * Usage block. BytePlus bills images, not input tokens: `total_tokens`
122
+ * currently equals `output_tokens` because input tokens are not counted, and
123
+ * `generated_images` counts only successful generations.
124
+ */
125
+ export interface BytePlusImageUsage {
126
+ generated_images?: number;
127
+ output_tokens?: number;
128
+ total_tokens?: number;
129
+ }
130
+ /**
131
+ * Ark error object. Codes are dotted strings for transport-level failures
132
+ * (`InvalidEndpointOrModel.NotFound`) and bare identifiers for content
133
+ * failures (`OutputImageSensitiveContentDetected`,
134
+ * `InputTextSensitiveContentDetected`, `QuotaExceeded`).
135
+ */
136
+ export interface BytePlusImageErrorObject {
137
+ code?: string;
138
+ message?: string;
139
+ }
140
+ /** Response body of `POST /images/generations`. */
141
+ export interface BytePlusImageGenerationResponse {
142
+ model?: string;
143
+ /** Unix timestamp (seconds) of creation. */
144
+ created?: number;
145
+ data?: Array<BytePlusImageData>;
146
+ usage?: BytePlusImageUsage;
147
+ /** Present when the request as a whole failed. */
148
+ error?: BytePlusImageErrorObject;
149
+ }
@@ -0,0 +1,25 @@
1
+ export { BytePlusVideoAdapter, byteplusVideo, createBytePlusVideo, } from './adapters/video.js';
2
+ export type { BytePlusVideoConfig } from './adapters/video.js';
3
+ export { parseBytePlusVideoSize, resolveBytePlusVideoResolution, resolveBytePlusVideoSize, supportsLastFrame, supportsReferenceMedia, } from './video/video-provider-options.js';
4
+ export type { BytePlusVideoModelProviderOptionsByName, BytePlusVideoProviderOptions, BytePlusVideoServiceTier, } from './video/video-provider-options.js';
5
+ export type { BytePlusVideoContentPart, BytePlusVideoContentRole, BytePlusVideoCreateRequest, BytePlusVideoCreateResponse, BytePlusVideoTask, BytePlusVideoTaskContent, BytePlusVideoTaskError, BytePlusVideoTaskListItem, BytePlusVideoTaskListResponse, BytePlusVideoTaskStatus, BytePlusVideoTaskUsage, } from './video/wire-types.js';
6
+ export { BYTEPLUS_DEFAULT_TTS_SPEAKER, BYTEPLUS_TTS_MAX_OUTPUT_SECONDS, BytePlusTTSAdapter, byteplusSpeech, createBytePlusSpeech, toSpeechRate, } from './adapters/tts.js';
7
+ export type { BytePlusTTSProviderOptions, BytePlusTTSResult, BytePlusTTSVoice, } from './audio/tts-provider-options.js';
8
+ export { BytePlusTranscriptionAdapter, byteplusTranscription, createBytePlusTranscription, } from './adapters/transcription.js';
9
+ export type { BytePlusTranscriptionWord } from './adapters/transcription.js';
10
+ export type { BytePlusTranscriptionProviderOptions } from './audio/transcription-provider-options.js';
11
+ export { BYTEPLUS_ASR_RESOURCE_HEADER, BYTEPLUS_ASR_RESOURCE_ID, BYTEPLUS_TTS_SAMPLE_RATES, } from './audio/wire-types.js';
12
+ export type { BytePlusASRAudio, BytePlusASRRecognizeRequest, BytePlusASRRecognizeResponse, BytePlusASRResult, BytePlusASRUtterance, BytePlusASRWord, BytePlusTTSAudioConfig, BytePlusTTSAudioFormat, BytePlusTTSCreateRequest, BytePlusTTSCreateResponse, BytePlusTTSReference, BytePlusTTSSampleRate, BytePlusTTSSubtitle, BytePlusTTSSubtitleEntry, BytePlusVoiceErrorBody, } from './audio/wire-types.js';
13
+ export { BytePlusImageAdapter, byteplusImage, createBytePlusImage, } from './adapters/image.js';
14
+ export type { BytePlusImageConfig } from './adapters/image.js';
15
+ export { BYTEPLUS_IMAGE_MAX_PROMPT_WORDS, BYTEPLUS_IMAGE_MAX_SEQUENTIAL_IMAGES, BYTEPLUS_OUTPUT_FORMAT_IMAGE_MODELS, parseBytePlusImageSize, } from './image/image-provider-options.js';
16
+ export type { BytePlusImageBaseProviderOptions, BytePlusImageModelInputModalitiesByName, BytePlusImageModelProviderOptionsByName, BytePlusImageProviderOptions, BytePlusSeedream5ImageProviderOptions, ParsedBytePlusImageSize, } from './image/image-provider-options.js';
17
+ export type { BytePlusImageData, BytePlusImageErrorObject, BytePlusImageGenerationRequest, BytePlusImageGenerationResponse, BytePlusImageOutputFormat, BytePlusImageResponseFormat, BytePlusImageUsage, BytePlusOptimizePromptOptions, BytePlusSequentialImageGeneration, BytePlusSequentialImageGenerationOptions, } from './image/wire-types.js';
18
+ export { BytePlusTextAdapter, byteplusText, createBytePlusText, } from './adapters/text.js';
19
+ export type { BytePlusTextConfig } from './adapters/text.js';
20
+ export type { BytePlusAudioMetadata, BytePlusChatContentPart, BytePlusDocumentMetadata, BytePlusEncryptedContentFields, BytePlusImageMetadata, BytePlusImagePixelLimit, BytePlusImageUrlContentPart, BytePlusInputAudioContentPart, BytePlusMessageMetadataByModality, BytePlusStreamDeltaExtras, BytePlusTextMetadata, BytePlusVideoMetadata, BytePlusVideoUrlContentPart, } from './message-types.js';
21
+ export { BYTEPLUS_ARK_BASE_URL, BYTEPLUS_VOICE_BASE_URL, bytePlusArkError, bytePlusArkHeaders, bytePlusVoiceError, bytePlusVoiceHeaders, getBytePlusArkApiKeyFromEnv, getBytePlusVoiceApiKeyFromEnv, withBytePlusArkDefaults, withBytePlusVoiceDefaults, } from './utils/client.js';
22
+ export type { BytePlusArkConfig, BytePlusVoiceConfig } from './utils/client.js';
23
+ export type { BytePlusNamedToolChoice, BytePlusReasoningEffort, BytePlusServiceTier, BytePlusTextProviderOptions, BytePlusThinkingOption, BytePlusToolChoice, } from './text/text-provider-options.js';
24
+ export { BYTEPLUS_CHAT_MODELS, BYTEPLUS_IMAGE_MAX_REFERENCE_IMAGES, BYTEPLUS_IMAGE_MODELS, BYTEPLUS_STRUCTURED_OUTPUT_CHAT_MODELS, BYTEPLUS_THINKING_SUMMARY_MODELS, BYTEPLUS_TRANSCRIPTION_MODELS, BYTEPLUS_TTS_MODELS, BYTEPLUS_VIDEO_DURATIONS, BYTEPLUS_VIDEO_FALLBACK_DURATIONS, BYTEPLUS_VIDEO_MODELS, emitsEncryptedContent, getBytePlusVideoDurationOptions, isKnownBytePlusVideoModel, supportsStructuredOutput, } from './model-meta.js';
25
+ export type { BytePlusChatModel, BytePlusChatModelProviderOptionsByName, BytePlusChatModelStructuredOutputByName, BytePlusChatModelToolCapabilitiesByName, BytePlusImageModel, BytePlusImageModelSizeByName, BytePlusImageSize, BytePlusImageSizeToken, BytePlusModelInputModalitiesByName, BytePlusProviderToolKind, BytePlusStructuredOutputChatModel, BytePlusThinkingSummaryModel, BytePlusTranscriptionModel, BytePlusTTSModel, BytePlusVideoModel, BytePlusVideoModelDurationByName, BytePlusVideoModelInputModalitiesByName, BytePlusVideoModelOrString, BytePlusVideoModelResolutionByName, BytePlusVideoModelSizeByName, BytePlusVideoRatio, BytePlusVideoResolution, BytePlusVideoSize, ResolveBytePlusVideoInputModalities, ResolveBytePlusVideoSize, ResolveInputModalities, ResolveProviderOptions, } from './model-meta.js';
@@ -0,0 +1,11 @@
1
+ import { BYTEPLUS_ARK_BASE_URL, BYTEPLUS_VOICE_BASE_URL, bytePlusArkError, bytePlusArkHeaders, bytePlusVoiceError, bytePlusVoiceHeaders, getBytePlusArkApiKeyFromEnv, getBytePlusVoiceApiKeyFromEnv, withBytePlusArkDefaults, withBytePlusVoiceDefaults } from "./utils/client.js";
2
+ import { BYTEPLUS_CHAT_MODELS, BYTEPLUS_IMAGE_MAX_REFERENCE_IMAGES, BYTEPLUS_IMAGE_MODELS, BYTEPLUS_STRUCTURED_OUTPUT_CHAT_MODELS, BYTEPLUS_THINKING_SUMMARY_MODELS, BYTEPLUS_TRANSCRIPTION_MODELS, BYTEPLUS_TTS_MODELS, BYTEPLUS_VIDEO_DURATIONS, BYTEPLUS_VIDEO_FALLBACK_DURATIONS, BYTEPLUS_VIDEO_MODELS, emitsEncryptedContent, getBytePlusVideoDurationOptions, isKnownBytePlusVideoModel, supportsStructuredOutput } from "./model-meta.js";
3
+ import { parseBytePlusVideoSize, resolveBytePlusVideoResolution, resolveBytePlusVideoSize, supportsLastFrame, supportsReferenceMedia } from "./video/video-provider-options.js";
4
+ import { BytePlusVideoAdapter, byteplusVideo, createBytePlusVideo } from "./adapters/video.js";
5
+ import { BYTEPLUS_DEFAULT_TTS_SPEAKER, BYTEPLUS_TTS_MAX_OUTPUT_SECONDS, BytePlusTTSAdapter, byteplusSpeech, createBytePlusSpeech, toSpeechRate } from "./adapters/tts.js";
6
+ import { BYTEPLUS_ASR_RESOURCE_HEADER, BYTEPLUS_ASR_RESOURCE_ID, BYTEPLUS_TTS_SAMPLE_RATES } from "./audio/wire-types.js";
7
+ import { BytePlusTranscriptionAdapter, byteplusTranscription, createBytePlusTranscription } from "./adapters/transcription.js";
8
+ import { BYTEPLUS_IMAGE_MAX_PROMPT_WORDS, BYTEPLUS_IMAGE_MAX_SEQUENTIAL_IMAGES, BYTEPLUS_OUTPUT_FORMAT_IMAGE_MODELS, parseBytePlusImageSize } from "./image/image-provider-options.js";
9
+ import { BytePlusImageAdapter, byteplusImage, createBytePlusImage } from "./adapters/image.js";
10
+ import { BytePlusTextAdapter, byteplusText, createBytePlusText } from "./adapters/text.js";
11
+ export { BYTEPLUS_ARK_BASE_URL, BYTEPLUS_ASR_RESOURCE_HEADER, BYTEPLUS_ASR_RESOURCE_ID, BYTEPLUS_CHAT_MODELS, BYTEPLUS_DEFAULT_TTS_SPEAKER, BYTEPLUS_IMAGE_MAX_PROMPT_WORDS, BYTEPLUS_IMAGE_MAX_REFERENCE_IMAGES, BYTEPLUS_IMAGE_MAX_SEQUENTIAL_IMAGES, BYTEPLUS_IMAGE_MODELS, BYTEPLUS_OUTPUT_FORMAT_IMAGE_MODELS, BYTEPLUS_STRUCTURED_OUTPUT_CHAT_MODELS, BYTEPLUS_THINKING_SUMMARY_MODELS, BYTEPLUS_TRANSCRIPTION_MODELS, BYTEPLUS_TTS_MAX_OUTPUT_SECONDS, BYTEPLUS_TTS_MODELS, BYTEPLUS_TTS_SAMPLE_RATES, BYTEPLUS_VIDEO_DURATIONS, BYTEPLUS_VIDEO_FALLBACK_DURATIONS, BYTEPLUS_VIDEO_MODELS, BYTEPLUS_VOICE_BASE_URL, BytePlusImageAdapter, BytePlusTTSAdapter, BytePlusTextAdapter, BytePlusTranscriptionAdapter, BytePlusVideoAdapter, bytePlusArkError, bytePlusArkHeaders, bytePlusVoiceError, bytePlusVoiceHeaders, byteplusImage, byteplusSpeech, byteplusText, byteplusTranscription, byteplusVideo, createBytePlusImage, createBytePlusSpeech, createBytePlusText, createBytePlusTranscription, createBytePlusVideo, emitsEncryptedContent, getBytePlusArkApiKeyFromEnv, getBytePlusVideoDurationOptions, getBytePlusVoiceApiKeyFromEnv, isKnownBytePlusVideoModel, parseBytePlusImageSize, parseBytePlusVideoSize, resolveBytePlusVideoResolution, resolveBytePlusVideoSize, supportsLastFrame, supportsReferenceMedia, supportsStructuredOutput, toSpeechRate, withBytePlusArkDefaults, withBytePlusVoiceDefaults };
@@ -0,0 +1,154 @@
1
+ /**
2
+ * BytePlus ModelArk chat message types.
3
+ *
4
+ * Ark's `/chat/completions` wire format is OpenAI Chat Completions plus a few
5
+ * Ark-only extensions, so the OpenAI SDK types (via `@tanstack/openai-base`)
6
+ * cover everything except the fields below. This file is the source of truth
7
+ * for the Ark-only parts of a chat message:
8
+ *
9
+ * - `encrypted_content` on the assistant message (thinking-summary models)
10
+ * - `video_url` content parts (no OpenAI equivalent)
11
+ * - `input_audio` accepting a `url` as well as inline base64
12
+ *
13
+ * Field shapes verified live against
14
+ * `https://ark.ap-southeast.bytepluses.com/api/v3` on 2026-07-31 — see the
15
+ * probe findings referenced from `model-meta.ts`.
16
+ */
17
+ /**
18
+ * Opaque signature blob emitted alongside `reasoning_content` by the
19
+ * thinking-summary models (see `BYTEPLUS_THINKING_SUMMARY_MODELS`).
20
+ *
21
+ * Non-streaming responses carry it on `choices[].message.encrypted_content`;
22
+ * streaming delivers the whole blob as one dedicated chunk
23
+ * (`delta.encrypted_content`, with empty `content` / `reasoning_content`)
24
+ * between the reasoning deltas and the content deltas.
25
+ *
26
+ * When present it should be echoed back verbatim on the assistant message in
27
+ * the next turn. Probing showed omitting it does *not* fail a request, so it
28
+ * is preserved-and-replayed rather than required.
29
+ */
30
+ export interface BytePlusEncryptedContentFields {
31
+ encrypted_content?: string;
32
+ }
33
+ /**
34
+ * Streaming delta fields Ark adds on top of the OpenAI chunk shape.
35
+ */
36
+ export interface BytePlusStreamDeltaExtras extends BytePlusEncryptedContentFields {
37
+ reasoning_content?: string;
38
+ }
39
+ /**
40
+ * Bounds on how large an image is scaled to before tokenization.
41
+ *
42
+ * Probe-verified to live *inside* `image_url` (a number at the content-part
43
+ * level is silently ignored; Ark validates the object form — asking for
44
+ * `min_pixels` below the model's floor is rejected with a specific error).
45
+ */
46
+ export interface BytePlusImagePixelLimit {
47
+ max_pixels?: number;
48
+ min_pixels?: number;
49
+ }
50
+ /**
51
+ * Image content part. Ark's `image_url` extends OpenAI's with an `xhigh`
52
+ * detail level and {@link BytePlusImagePixelLimit}.
53
+ */
54
+ export interface BytePlusImageUrlContentPart {
55
+ type: 'image_url';
56
+ image_url: {
57
+ url: string;
58
+ detail?: 'auto' | 'low' | 'high' | 'xhigh';
59
+ image_pixel_limit?: BytePlusImagePixelLimit;
60
+ };
61
+ }
62
+ /**
63
+ * Video content part. Ark accepts a public URL or a `data:` URI; there is no
64
+ * OpenAI Chat Completions equivalent, so this shape is defined here.
65
+ */
66
+ export interface BytePlusVideoUrlContentPart {
67
+ type: 'video_url';
68
+ video_url: {
69
+ url: string;
70
+ /**
71
+ * Frame sampling rate in frames per second. Omitted by the adapter unless
72
+ * the caller sets it through content-part metadata.
73
+ */
74
+ fps?: number;
75
+ };
76
+ }
77
+ /**
78
+ * Audio content part. Ark extends OpenAI's `input_audio` (inline base64 +
79
+ * `format`) with a `url` alternative.
80
+ */
81
+ export interface BytePlusInputAudioContentPart {
82
+ type: 'input_audio';
83
+ input_audio: {
84
+ /** Base64 audio payload. Mutually exclusive with `url`. */
85
+ data?: string;
86
+ /** Container format of `data`. Required whenever `data` is set. */
87
+ format?: 'wav' | 'mp3' | 'ogg' | 'flac' | 'm4a' | 'aac' | 'pcm';
88
+ /** Public audio URL. Mutually exclusive with `data`. */
89
+ url?: string;
90
+ };
91
+ }
92
+ /**
93
+ * The Ark-only content parts, as a single union. The adapter funnels these
94
+ * through one documented cast when handing them to the OpenAI SDK, whose
95
+ * content-part union has no arm for `video_url`, for URL-addressed audio, or
96
+ * for the extra `image_url` fields.
97
+ */
98
+ export type BytePlusChatContentPart = BytePlusImageUrlContentPart | BytePlusVideoUrlContentPart | BytePlusInputAudioContentPart;
99
+ /**
100
+ * Metadata for BytePlus text content parts. Ark has no text-part options.
101
+ */
102
+ export interface BytePlusTextMetadata {
103
+ }
104
+ /**
105
+ * Metadata for BytePlus image content parts.
106
+ */
107
+ export interface BytePlusImageMetadata {
108
+ /**
109
+ * Processing detail for the image. Ark adds `xhigh` to OpenAI's set.
110
+ *
111
+ * @default 'auto'
112
+ */
113
+ detail?: 'auto' | 'low' | 'high' | 'xhigh';
114
+ /**
115
+ * Bounds the pixel count the image is scaled to before tokenization —
116
+ * see {@link BytePlusImagePixelLimit}. Lower `max_pixels` trades detail for
117
+ * input tokens.
118
+ */
119
+ image_pixel_limit?: BytePlusImagePixelLimit;
120
+ }
121
+ /**
122
+ * Metadata for BytePlus audio content parts.
123
+ */
124
+ export interface BytePlusAudioMetadata {
125
+ /**
126
+ * Container format for inline base64 audio. Inferred from the part's
127
+ * `mimeType` when omitted.
128
+ */
129
+ format?: BytePlusInputAudioContentPart['input_audio']['format'];
130
+ }
131
+ /**
132
+ * Metadata for BytePlus video content parts.
133
+ */
134
+ export interface BytePlusVideoMetadata {
135
+ /** Frame sampling rate in frames per second. */
136
+ fps?: number;
137
+ }
138
+ /**
139
+ * Metadata for BytePlus document content parts. Ark's chat API takes no
140
+ * document parts — the field exists so the modality map stays total.
141
+ */
142
+ export interface BytePlusDocumentMetadata {
143
+ }
144
+ /**
145
+ * Map of modality to BytePlus-specific content-part metadata. Used for type
146
+ * inference when constructing multimodal messages.
147
+ */
148
+ export interface BytePlusMessageMetadataByModality {
149
+ text: BytePlusTextMetadata;
150
+ image: BytePlusImageMetadata;
151
+ audio: BytePlusAudioMetadata;
152
+ video: BytePlusVideoMetadata;
153
+ document: BytePlusDocumentMetadata;
154
+ }