@evolinkai/cli 0.12.0 → 0.13.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolinkai/cli",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Generate images, video and audio with EvoLink, with browser login and quoted submissions.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@napi-rs/keyring": "2.1.0",
36
- "zod": "3.25.76"
36
+ "zod": "4.6.7"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@modelcontextprotocol/sdk": "1.32.1"
package/src/media.mjs CHANGED
@@ -82,6 +82,12 @@ export function checkEstimate(quote, cap) {
82
82
  : quote.estimate.max_usd <= cap;
83
83
  requireThat(withinBudget, 'cost_exceeds_cap', 'The estimated cost exceeds max-cost-usd.', { estimate: quote.estimate, max_cost_usd: cap });
84
84
  }
85
+ // The core names each missing usage in MCP terms; say once how they map to CLI options.
86
+ requireThat(quote.estimate?.status !== 'needs_input' || !quote.estimate.usage_help?.length, 'estimate_unavailable', [
87
+ 'The total cannot be estimated yet, so no quote was saved. It depends on:', ...(quote.estimate?.usage_help ?? []).map(line => `- ${line}`),
88
+ 'In the CLI, media_seconds is --media-seconds and pricing_parameters is --pricing-parameters (a JSON object).'].join('\n'),
89
+ // A copy: the redaction of error details shows an object it has already printed as "[truncated]".
90
+ { estimate: quote.estimate, missing_usage: [...(quote.estimate?.missing_usage ?? [])] });
85
91
  requireThat(['estimated', 'partial', 'token_billed'].includes(quote.estimate?.status), 'estimate_unavailable', 'Complete the estimate input or choose a model with pricing before submission.', { estimate: quote.estimate });
86
92
  }
87
93
 
@@ -41,6 +41,15 @@ export function withModelConstraints(model) {
41
41
  if (properties)
42
42
  properties.duration = { type: 'integer', anyOf: model.params.duration.anyOf, description: model.params.duration.description, default: model.params.duration.default };
43
43
  }
44
+ // mintlify-docs kling-v4-video-edit.json: duration is 3-30 seconds or "auto" (as long as the input video);
45
+ // the generated index keeps the range but leaves any string open.
46
+ if (model.model === 'kling-v4-video-edit') {
47
+ const anyOf = [{ type: 'integer', minimum: 3, maximum: 30 }, { type: 'string', enum: ['auto'] }];
48
+ model.params.duration = { ...model.params.duration, anyOf };
49
+ const properties = model.inputSchema?.schema.properties;
50
+ if (properties)
51
+ properties.duration = { anyOf, description: model.params.duration.description, default: model.params.duration.default };
52
+ }
44
53
  if (['gpt-image-2', 'gpt-image-2.5-flare', 'gpt-image-2.5-sunburst', 'gpt-image-2-beta'].includes(model.model)) {
45
54
  model.constraints = { ...model.constraints, imageSize: {
46
55
  param: 'size', allowed: ['auto', '1:1', '1:2', '2:1', '1:3', '3:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '9:21', '21:9'],
@@ -1,4 +1,4 @@
1
1
  // Copyright 2024 EvoLink AI. SPDX-License-Identifier: Apache-2.0
2
2
  // Generated from Evolink-AI/evolink-mcp; adapted for direct REST operations. See platform/LICENSE and platform/NOTICE.
3
3
  // Generated by scripts/build-model-params.mjs from the docs site OpenAPI files. Do not edit by hand.
4
- export const MODEL_PARAMS_OVERRIDES_JSON = "{\"meta\":{\"source\":\"mintlify-docs en/api-manual\",\"commit\":\"a5617fe91d961efdad64f051e9f5dc430e278467\",\"files\":1,\"endpoints\":1,\"models\":1},\"models\":{\"gemini-nano-banana-2.1\":{\"model\":\"gemini-nano-banana-2.1\",\"kind\":\"image\",\"path\":\"/v1/images/generations\",\"title\":\"Nano Banana 2.1 API\",\"docs\":\"https://evolink.ai/docs/en/api-manual/image-series/nanobanana/nanobanana-2.1/nanobanana-2.1-image-generate\",\"required\":[\"prompt\"],\"params\":{\"prompt\":{\"type\":\"string\",\"description\":\"Prompt describing the image to generate or how to edit an input image, up to 4000 tokens\",\"required\":true},\"size\":{\"type\":\"string\",\"description\":\"Aspect ratio of the generated image, default is auto\",\"enum\":[\"auto\",\"1:1\",\"1:4\",\"4:1\",\"1:8\",\"8:1\",\"2:3\",\"3:2\",\"3:4\",\"4:3\",\"4:5\",\"5:4\",\"9:16\",\"16:9\",\"21:9\"],\"default\":\"auto\"},\"quality\":{\"type\":\"string\",\"description\":\"Output image resolution, default is 2K Note: Prices vary by resolution. Output images are billed at the selected resolution. Setting this parameter explicitly is recommended\",\"enum\":[\"1K\",\"2K\",\"4K\"],\"default\":\"2K\"},\"image_urls\":{\"type\":\"array\",\"description\":\"List of reference image URLs for image to image generation, image editing, and multi-image composition Note: Up to 14 input images per request; Image size: no more than 20MB; Supported file formats: .jpeg, .jpg, .png, .webp; Image URLs must be directly accessible by the server or trigger a direct image download when accessed (such URLs typically end in an image extension such as .png or .jpg); Input images are billed per image\",\"maxItems\":14,\"items\":{\"type\":\"string\",\"format\":\"uri\"}},\"model_params\":{\"type\":\"object\",\"description\":\"Model extension parameters\",\"properties\":{\"web_search\":{\"type\":\"boolean\",\"description\":\"Whether to enable web search, default is false. When enabled, the model searches for the latest information on the web before generating the image Note: Billed by the actual number of searches performed by the model. A single request may involve multiple searches\",\"default\":false},\"image_search\":{\"type\":\"boolean\",\"description\":\"Whether to enable image search, default is false. When enabled, the model retrieves images from the web as visual references before generating the image Note: Billed by the actual number of searches performed by the model. A single request may involve multiple searches\",\"default\":false},\"thinking_level\":{\"type\":\"string\",\"description\":\"Reasoning level controlling how deeply the model reasons before generating an image, default is auto; auto: leave unspecified and let the model decide; min: minimal reasoning, fastest generation; medium: balanced reasoning; high: deep reasoning Note: Reasoning tokens are billed as text output\",\"enum\":[\"auto\",\"min\",\"medium\",\"high\"],\"default\":\"auto\"}}}},\"inputSchema\":{\"schema\":{\"type\":\"object\",\"required\":[\"prompt\"],\"properties\":{\"prompt\":{\"type\":\"string\",\"description\":\"Prompt describing the image to generate or how to edit an input image, up to `4000` tokens\",\"example\":\"A cat playing in the grass\"},\"size\":{\"type\":\"string\",\"description\":\"Aspect ratio of the generated image, default is `auto`\",\"enum\":[\"auto\",\"1:1\",\"1:4\",\"4:1\",\"1:8\",\"8:1\",\"2:3\",\"3:2\",\"3:4\",\"4:3\",\"4:5\",\"5:4\",\"9:16\",\"16:9\",\"21:9\"],\"default\":\"auto\"},\"quality\":{\"type\":\"string\",\"description\":\"Output image resolution, default is `2K`\\n\\n**Note:**\\n- Prices vary by resolution. Output images are billed at the selected resolution. Setting this parameter explicitly is recommended\",\"enum\":[\"1K\",\"2K\",\"4K\"],\"default\":\"2K\"},\"image_urls\":{\"type\":\"array\",\"description\":\"List of reference image URLs for image to image generation, image editing, and multi-image composition\\n\\n**Note:**\\n- Up to `14` input images per request\\n- Image size: no more than `20MB`\\n- Supported file formats: `.jpeg`, `.jpg`, `.png`, `.webp`\\n- Image URLs must be directly accessible by the server or trigger a direct image download when accessed (such URLs typically end in an image extension such as `.png` or `.jpg`)\\n- Input images are billed per image\",\"items\":{\"type\":\"string\",\"format\":\"uri\"},\"maxItems\":14,\"example\":[\"https://example.com/image1.png\",\"https://example.com/image2.png\"]},\"model_params\":{\"type\":\"object\",\"description\":\"Model extension parameters\",\"properties\":{\"web_search\":{\"type\":\"boolean\",\"description\":\"Whether to enable web search, default is `false`. When enabled, the model searches for the latest information on the web before generating the image\\n\\n**Note:**\\n- Billed by the actual number of searches performed by the model. A single request may involve multiple searches\",\"default\":false,\"example\":true},\"image_search\":{\"type\":\"boolean\",\"description\":\"Whether to enable image search, default is `false`. When enabled, the model retrieves images from the web as visual references before generating the image\\n\\n**Note:**\\n- Billed by the actual number of searches performed by the model. A single request may involve multiple searches\",\"default\":false,\"example\":true},\"thinking_level\":{\"type\":\"string\",\"description\":\"Reasoning level controlling how deeply the model reasons before generating an image, default is `auto`\\n\\n- `auto`: leave unspecified and let the model decide\\n- `min`: minimal reasoning, fastest generation\\n- `medium`: balanced reasoning\\n- `high`: deep reasoning\\n\\n**Note:**\\n- Reasoning tokens are billed as text output\",\"enum\":[\"auto\",\"min\",\"medium\",\"high\"],\"default\":\"auto\",\"example\":\"medium\"}}}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"responseSchema\":{\"schema\":{\"$ref\":\"#/$defs/ImageGenerationResponse\",\"$defs\":{\"ImageGenerationResponse\":{\"type\":\"object\",\"properties\":{\"created\":{\"type\":\"integer\",\"description\":\"Task creation timestamp\",\"example\":1757165031},\"id\":{\"type\":\"string\",\"description\":\"Task ID\",\"example\":\"task-unified-1757165031-uyujaw3d\"},\"model\":{\"type\":\"string\",\"description\":\"Actual model name used\",\"example\":\"gemini-nano-banana-2.1\"},\"object\":{\"type\":\"string\",\"enum\":[\"image.generation.task\"],\"description\":\"Specific task type\"},\"progress\":{\"type\":\"integer\",\"description\":\"Task progress percentage (0-100)\",\"minimum\":0,\"maximum\":100,\"example\":0},\"status\":{\"type\":\"string\",\"description\":\"Task status\",\"enum\":[\"pending\",\"processing\",\"completed\",\"failed\"],\"example\":\"pending\"},\"task_info\":{\"$ref\":\"#/$defs/TaskInfo\",\"description\":\"Asynchronous task information\"},\"type\":{\"type\":\"string\",\"enum\":[\"text\",\"image\",\"audio\",\"video\"],\"description\":\"Task output type\",\"example\":\"image\"},\"usage\":{\"$ref\":\"#/$defs/Usage\",\"description\":\"Usage and billing information\"}}},\"TaskInfo\":{\"type\":\"object\",\"properties\":{\"estimated_time\":{\"type\":\"integer\",\"description\":\"Estimated completion time (seconds)\",\"minimum\":0,\"example\":45}}},\"Usage\":{\"type\":\"object\",\"description\":\"Usage and billing information\",\"properties\":{\"billing_rule\":{\"type\":\"string\",\"description\":\"Billing rule\",\"enum\":[\"per_call\",\"per_image\",\"per_token\",\"per_second\"],\"example\":\"per_image\"},\"credits_reserved\":{\"type\":\"number\",\"description\":\"Estimated credits consumed\",\"minimum\":0,\"example\":3.0845},\"user_group\":{\"type\":\"string\",\"description\":\"Billing group the user belongs to\",\"example\":\"default\"}}}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"example\":{\"prompt\":\"A cat playing on the grass\",\"size\":\"16:9\",\"quality\":\"2K\"}}}}";
4
+ export const MODEL_PARAMS_OVERRIDES_JSON = "{\"meta\":{\"source\":\"mintlify-docs en/api-manual\",\"commit\":\"06edf6dd\",\"files\":211,\"endpoints\":158,\"models\":8},\"models\":{\"gemini-nano-banana-2.1\":{\"model\":\"gemini-nano-banana-2.1\",\"kind\":\"image\",\"path\":\"/v1/images/generations\",\"title\":\"Nano Banana 2.1 API\",\"docs\":\"https://evolink.ai/docs/en/api-manual/image-series/nanobanana/nanobanana-2.1/nanobanana-2.1-image-generate\",\"required\":[\"prompt\"],\"params\":{\"prompt\":{\"type\":\"string\",\"description\":\"Prompt describing the image to generate or how to edit an input image, up to 4000 tokens\",\"required\":true},\"size\":{\"type\":\"string\",\"description\":\"Aspect ratio of the generated image, default is auto\",\"enum\":[\"auto\",\"1:1\",\"1:4\",\"4:1\",\"1:8\",\"8:1\",\"2:3\",\"3:2\",\"3:4\",\"4:3\",\"4:5\",\"5:4\",\"9:16\",\"16:9\",\"21:9\"],\"default\":\"auto\"},\"quality\":{\"type\":\"string\",\"description\":\"Output image resolution, default is 2K Note: Prices vary by resolution. Output images are billed at the selected resolution. Setting this parameter explicitly is recommended\",\"enum\":[\"1K\",\"2K\",\"4K\"],\"default\":\"2K\"},\"image_urls\":{\"type\":\"array\",\"description\":\"List of reference image URLs for image to image generation, image editing, and multi-image composition Note: Up to 14 input images per request; Image size: no more than 20MB; Supported file formats: .jpeg, .jpg, .png, .webp; Image URLs must be directly accessible by the server or trigger a direct image download when accessed (such URLs typically end in an image extension such as .png or .jpg); Input images are billed per image\",\"maxItems\":14,\"items\":{\"type\":\"string\",\"format\":\"uri\"}},\"model_params\":{\"type\":\"object\",\"description\":\"Model extension parameters\",\"properties\":{\"web_search\":{\"type\":\"boolean\",\"description\":\"Whether to enable web search, default is false. When enabled, the model searches for the latest information on the web before generating the image Note: Billed by the actual number of searches performed by the model. A single request may involve multiple searches\",\"default\":false},\"image_search\":{\"type\":\"boolean\",\"description\":\"Whether to enable image search, default is false. When enabled, the model retrieves images from the web as visual references before generating the image Note: Billed by the actual number of searches performed by the model. A single request may involve multiple searches\",\"default\":false},\"thinking_level\":{\"type\":\"string\",\"description\":\"Reasoning level controlling how deeply the model reasons before generating an image, default is auto; auto: leave unspecified and let the model decide; min: minimal reasoning, fastest generation; medium: balanced reasoning; high: deep reasoning Note: Reasoning tokens are billed as text output\",\"enum\":[\"auto\",\"min\",\"medium\",\"high\"],\"default\":\"auto\"}}}},\"inputSchema\":{\"schema\":{\"type\":\"object\",\"required\":[\"prompt\"],\"properties\":{\"prompt\":{\"type\":\"string\",\"description\":\"Prompt describing the image to generate or how to edit an input image, up to `4000` tokens\",\"example\":\"A cat playing in the grass\"},\"size\":{\"type\":\"string\",\"description\":\"Aspect ratio of the generated image, default is `auto`\",\"enum\":[\"auto\",\"1:1\",\"1:4\",\"4:1\",\"1:8\",\"8:1\",\"2:3\",\"3:2\",\"3:4\",\"4:3\",\"4:5\",\"5:4\",\"9:16\",\"16:9\",\"21:9\"],\"default\":\"auto\"},\"quality\":{\"type\":\"string\",\"description\":\"Output image resolution, default is `2K`\\n\\n**Note:**\\n- Prices vary by resolution. Output images are billed at the selected resolution. Setting this parameter explicitly is recommended\",\"enum\":[\"1K\",\"2K\",\"4K\"],\"default\":\"2K\"},\"image_urls\":{\"type\":\"array\",\"description\":\"List of reference image URLs for image to image generation, image editing, and multi-image composition\\n\\n**Note:**\\n- Up to `14` input images per request\\n- Image size: no more than `20MB`\\n- Supported file formats: `.jpeg`, `.jpg`, `.png`, `.webp`\\n- Image URLs must be directly accessible by the server or trigger a direct image download when accessed (such URLs typically end in an image extension such as `.png` or `.jpg`)\\n- Input images are billed per image\",\"items\":{\"type\":\"string\",\"format\":\"uri\"},\"maxItems\":14,\"example\":[\"https://example.com/image1.png\",\"https://example.com/image2.png\"]},\"model_params\":{\"type\":\"object\",\"description\":\"Model extension parameters\",\"properties\":{\"web_search\":{\"type\":\"boolean\",\"description\":\"Whether to enable web search, default is `false`. When enabled, the model searches for the latest information on the web before generating the image\\n\\n**Note:**\\n- Billed by the actual number of searches performed by the model. A single request may involve multiple searches\",\"default\":false,\"example\":true},\"image_search\":{\"type\":\"boolean\",\"description\":\"Whether to enable image search, default is `false`. When enabled, the model retrieves images from the web as visual references before generating the image\\n\\n**Note:**\\n- Billed by the actual number of searches performed by the model. A single request may involve multiple searches\",\"default\":false,\"example\":true},\"thinking_level\":{\"type\":\"string\",\"description\":\"Reasoning level controlling how deeply the model reasons before generating an image, default is `auto`\\n\\n- `auto`: leave unspecified and let the model decide\\n- `min`: minimal reasoning, fastest generation\\n- `medium`: balanced reasoning\\n- `high`: deep reasoning\\n\\n**Note:**\\n- Reasoning tokens are billed as text output\",\"enum\":[\"auto\",\"min\",\"medium\",\"high\"],\"default\":\"auto\",\"example\":\"medium\"}}}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"responseSchema\":{\"schema\":{\"$ref\":\"#/$defs/ImageGenerationResponse\",\"$defs\":{\"ImageGenerationResponse\":{\"type\":\"object\",\"properties\":{\"created\":{\"type\":\"integer\",\"description\":\"Task creation timestamp\",\"example\":1757165031},\"id\":{\"type\":\"string\",\"description\":\"Task ID\",\"example\":\"task-unified-1757165031-uyujaw3d\"},\"model\":{\"type\":\"string\",\"description\":\"Actual model name used\",\"example\":\"gemini-nano-banana-2.1\"},\"object\":{\"type\":\"string\",\"enum\":[\"image.generation.task\"],\"description\":\"Specific task type\"},\"progress\":{\"type\":\"integer\",\"description\":\"Task progress percentage (0-100)\",\"minimum\":0,\"maximum\":100,\"example\":0},\"status\":{\"type\":\"string\",\"description\":\"Task status\",\"enum\":[\"pending\",\"processing\",\"completed\",\"failed\"],\"example\":\"pending\"},\"task_info\":{\"$ref\":\"#/$defs/TaskInfo\",\"description\":\"Asynchronous task information\"},\"type\":{\"type\":\"string\",\"enum\":[\"text\",\"image\",\"audio\",\"video\"],\"description\":\"Task output type\",\"example\":\"image\"},\"usage\":{\"$ref\":\"#/$defs/Usage\",\"description\":\"Usage and billing information\"}}},\"TaskInfo\":{\"type\":\"object\",\"properties\":{\"estimated_time\":{\"type\":\"integer\",\"description\":\"Estimated completion time (seconds)\",\"minimum\":0,\"example\":45}}},\"Usage\":{\"type\":\"object\",\"description\":\"Usage and billing information\",\"properties\":{\"billing_rule\":{\"type\":\"string\",\"description\":\"Billing rule\",\"enum\":[\"per_call\",\"per_image\",\"per_token\",\"per_second\"],\"example\":\"per_image\"},\"credits_reserved\":{\"type\":\"number\",\"description\":\"Estimated credits consumed\",\"minimum\":0,\"example\":3.0845},\"user_group\":{\"type\":\"string\",\"description\":\"Billing group the user belongs to\",\"example\":\"default\"}}}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"example\":{\"prompt\":\"A cat playing on the grass\",\"size\":\"16:9\",\"quality\":\"2K\"}},\"grok-imagine-video-1.5-lite\":{\"model\":\"grok-imagine-video-1.5-lite\",\"kind\":\"video\",\"path\":\"/v1/videos/generations\",\"title\":\"grok-imagine-video-1.5-lite Interface\",\"docs\":\"https://evolink.ai/docs/en/api-manual/video-series/grok/grok-imagine-video-1.5-lite\",\"required\":[\"prompt\"],\"params\":{\"prompt\":{\"type\":\"string\",\"description\":\"Video description prompt (required, cannot be empty) EvoLink platform length limit: Up to 2000 tokens (counted with the cl100k tokenizer, so CJK prompts hit the cap at far fewer characters than Latin ones). The platform also enforces a limit of 60000 UTF-8 bytes.\",\"required\":true},\"image_urls\":{\"type\":\"array\",\"description\":\"Input image URL (optional). One image switches the request to image-to-video. Mode selection: 0 images (omit the field): text-to-video, no image charge; 1 image: image-to-video, used as the first frame; input images are billed separately (see the [pricing section](https://evolink.ai/grok-imagine-video-1-5-lite#pricing)); 2 or more images are rejected — reference-to-video is not supported on Lite Requirements: Playground local uploads: up to 10MiB (10485760 bytes) per image. Image URLs sent directly to the API are validated upstream and do not use this local upload check.; Supported formats: J…\",\"minItems\":0,\"maxItems\":1,\"items\":{\"type\":\"string\",\"format\":\"uri\"}},\"duration\":{\"type\":\"integer\",\"description\":\"Video duration (seconds), any integer between 1 and 15 seconds\",\"default\":6,\"minimum\":1,\"maximum\":15},\"quality\":{\"type\":\"string\",\"description\":\"Video resolution, default is 480p Description: 480p: Standard definition (default); 720p: High definition; 1080p: Upscaled from 720p, billed at a higher per-second rate See the [pricing section](https://evolink.ai/grok-imagine-video-1-5-lite#pricing) for the per-resolution rates.\",\"enum\":[\"480p\",\"720p\",\"1080p\"],\"default\":\"480p\"},\"aspect_ratio\":{\"type\":\"string\",\"description\":\"Output aspect ratio, default is auto Applies to: text-to-video (0 images). With an input image the output follows that image's dimensions and this parameter is ignored. Description: auto: No ratio is sent upstream and the upstream channel decides the framing (text-to-video currently renders 16:9); this is the default value; 16:9: Landscape; 9:16: Portrait; 1:1: Square; 4:3: Landscape, classic TV ratio; 3:4: Portrait, classic TV ratio; 3:2: Landscape, classic photo ratio; 2:3: Portrait, classic photo ratio\",\"enum\":[\"auto\",\"16:9\",\"9:16\",\"1:1\",\"4:3\",\"3:4\",\"3:2\",\"2:3\"],\"default\":\"auto\"}},\"inputSchema\":{\"schema\":{\"type\":\"object\",\"required\":[\"prompt\"],\"properties\":{\"prompt\":{\"type\":\"string\",\"description\":\"Video description prompt (required, cannot be empty)\\n\\n**EvoLink platform length limit:** Up to `2000` tokens (counted with the cl100k tokenizer, so CJK prompts hit the cap at far fewer characters than Latin ones). The platform also enforces a limit of 60000 UTF-8 bytes.\",\"example\":\"The person starts dancing\"},\"image_urls\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"format\":\"uri\"},\"description\":\"Input image URL (optional). One image switches the request to image-to-video.\\n\\n**Mode selection:**\\n- `0` images (omit the field): text-to-video, no image charge\\n- `1` image: image-to-video, used as the first frame; input images are billed separately (see the [pricing section](https://evolink.ai/grok-imagine-video-1-5-lite#pricing))\\n- `2` or more images are rejected — reference-to-video is not supported on Lite\\n\\n**Requirements:**\\n- Playground local uploads: up to `10MiB` (10485760 bytes) per image. Image URLs sent directly to the API are validated upstream and do not use this local upload check.\\n- Supported formats: JPEG, PNG, WebP\",\"minItems\":0,\"maxItems\":1,\"example\":[\"https://example.com/image.jpg\"]},\"duration\":{\"type\":\"integer\",\"description\":\"Video duration (seconds), any integer between `1` and `15` seconds\",\"minimum\":1,\"maximum\":15,\"default\":6,\"example\":6},\"quality\":{\"type\":\"string\",\"description\":\"Video resolution, default is `480p`\\n\\n**Description:**\\n- `480p`: Standard definition (default)\\n- `720p`: High definition\\n- `1080p`: Upscaled from 720p, billed at a higher per-second rate\\n\\nSee the [pricing section](https://evolink.ai/grok-imagine-video-1-5-lite#pricing) for the per-resolution rates.\",\"enum\":[\"480p\",\"720p\",\"1080p\"],\"default\":\"480p\",\"example\":\"480p\"},\"aspect_ratio\":{\"type\":\"string\",\"description\":\"Output aspect ratio, default is `auto`\\n\\n**Applies to:** text-to-video (`0` images). With an input image the output follows that image's dimensions and this parameter is ignored.\\n\\n**Description:**\\n- `auto`: No ratio is sent upstream and the upstream channel decides the framing (text-to-video currently renders 16:9); this is the default value\\n- `16:9`: Landscape\\n- `9:16`: Portrait\\n- `1:1`: Square\\n- `4:3`: Landscape, classic TV ratio\\n- `3:4`: Portrait, classic TV ratio\\n- `3:2`: Landscape, classic photo ratio\\n- `2:3`: Portrait, classic photo ratio\",\"enum\":[\"auto\",\"16:9\",\"9:16\",\"1:1\",\"4:3\",\"3:4\",\"3:2\",\"2:3\"],\"default\":\"auto\",\"example\":\"16:9\"}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"responseSchema\":{\"schema\":{\"$ref\":\"#/$defs/VideoGenerationResponse\",\"$defs\":{\"VideoGenerationResponse\":{\"type\":\"object\",\"properties\":{\"created\":{\"type\":\"integer\",\"description\":\"Task creation timestamp\",\"example\":1757169743},\"id\":{\"type\":\"string\",\"description\":\"Task ID\",\"example\":\"task-unified-1757169743-7cvnl5zw\"},\"model\":{\"type\":\"string\",\"description\":\"Actual model name used\",\"example\":\"grok-imagine-video-1.5-lite\"},\"object\":{\"type\":\"string\",\"enum\":[\"video.generation.task\"],\"description\":\"Specific task type\"},\"progress\":{\"type\":\"integer\",\"description\":\"Task progress percentage (0-100)\",\"minimum\":0,\"maximum\":100,\"example\":0},\"status\":{\"type\":\"string\",\"description\":\"Task status\",\"enum\":[\"pending\",\"processing\",\"completed\",\"failed\"],\"example\":\"pending\"},\"task_info\":{\"$ref\":\"#/$defs/VideoTaskInfo\",\"description\":\"Video task detailed information\"},\"type\":{\"type\":\"string\",\"enum\":[\"text\",\"image\",\"audio\",\"video\"],\"description\":\"Task output type\",\"example\":\"video\"},\"usage\":{\"$ref\":\"#/$defs/Usage\",\"description\":\"Usage and billing information\"}}},\"VideoTaskInfo\":{\"type\":\"object\",\"properties\":{\"estimated_time\":{\"type\":\"integer\",\"description\":\"Estimated completion time (seconds)\",\"minimum\":0,\"example\":120},\"video_duration\":{\"type\":\"integer\",\"description\":\"Video duration (seconds)\",\"example\":6}}},\"Usage\":{\"type\":\"object\",\"description\":\"Usage and billing information\",\"properties\":{\"billing_rule\":{\"type\":\"string\",\"description\":\"Billing rule\",\"enum\":[\"per_call\",\"per_token\",\"per_second\"],\"example\":\"per_second\"},\"credits_reserved\":{\"type\":\"number\",\"description\":\"Estimated credits consumed\",\"minimum\":0,\"example\":5.712},\"user_group\":{\"type\":\"string\",\"description\":\"User group category\",\"example\":\"default\"}}}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"example\":{\"prompt\":\"A neon-lit street at night, slow dolly forward through the rain\",\"duration\":6,\"quality\":\"480p\",\"aspect_ratio\":\"16:9\"}},\"kling-v4-image-to-video\":{\"model\":\"kling-v4-image-to-video\",\"kind\":\"video\",\"path\":\"/v1/videos/generations\",\"title\":\"kling-v4-image-to-video API\",\"docs\":\"https://evolink.ai/docs/en/api-manual/video-series/kling/kling-v4-image-to-video\",\"required\":[\"image_start\",\"prompt\"],\"params\":{\"image_start\":{\"type\":\"string\",\"description\":\"First frame image URL for image-to-video generation (required) Note: Image size: up to 10MB; Supported formats: .jpg, .jpeg, .png; Image dimensions: width and height >= 300px, aspect ratio between 1:2.5 and 2.5:1; Image URL must be directly accessible by the server or trigger a direct download when accessed\",\"format\":\"uri\",\"required\":true},\"image_end\":{\"type\":\"string\",\"description\":\"Last frame image URL Note: image_start (first frame) must be provided when using last frame; Supported formats: .jpg, .jpeg, .png; Image size: up to 10MB; Image URL must be directly accessible by the server or trigger a direct download when accessed\",\"format\":\"uri\"},\"keyframes\":{\"type\":\"array\",\"description\":\"Intermediate frame images, evenly spaced in order between the first and last frames Note: Count: 1 to 8 images; The first frame, intermediate frames, and last frame combined must not exceed 10 images or duration + 1 (for example, up to 4 images for 3 seconds or 6 images for 5 seconds); The last frame is optional. If omitted, the model generates the ending frame; Image size: up to 10MB; Supported formats: .jpg, .jpeg, .png; Image dimensions: width and height >= 300px, aspect ratio between 1:2.5 and 2.5:1; Image URL must be directly accessible by the server or trigger a direct download when acc…\",\"minItems\":0,\"maxItems\":8,\"items\":{\"type\":\"object\",\"properties\":{\"image_url\":{\"type\":\"string\",\"description\":\"Intermediate frame image URL\",\"format\":\"uri\",\"required\":true}}}},\"prompt\":{\"type\":\"string\",\"description\":\"Text prompt describing the video to generate Note: Maximum 2500 characters\",\"maxLength\":2500,\"required\":true},\"duration\":{\"type\":\"integer\",\"description\":\"Video duration in seconds. Defaults to 5 seconds Range: Integer from 3 to 30\",\"default\":5,\"minimum\":3,\"maximum\":30},\"quality\":{\"type\":\"string\",\"description\":\"Resolution tier Options: 720p: Standard 720P; 1080p: High quality 1080P\",\"enum\":[\"720p\",\"1080p\"],\"default\":\"720p\"}},\"inputSchema\":{\"schema\":{\"type\":\"object\",\"required\":[\"image_start\",\"prompt\"],\"properties\":{\"image_start\":{\"type\":\"string\",\"format\":\"uri\",\"description\":\"First frame image URL for image-to-video generation (**required**)\\n\\n**Note:**\\n- Image size: up to `10MB`\\n- Supported formats: `.jpg`, `.jpeg`, `.png`\\n- Image dimensions: width and height >= `300px`, aspect ratio between `1:2.5` and `2.5:1`\\n- Image URL must be directly accessible by the server or trigger a direct download when accessed\",\"example\":\"https://example.com/portrait.jpg\"},\"image_end\":{\"type\":\"string\",\"format\":\"uri\",\"description\":\"Last frame image URL\\n\\n**Note:**\\n- `image_start` (first frame) must be provided when using last frame\\n- Supported formats: `.jpg`, `.jpeg`, `.png`\\n- Image size: up to `10MB`\\n- Image URL must be directly accessible by the server or trigger a direct download when accessed\",\"example\":\"https://example.com/night.jpg\"},\"keyframes\":{\"type\":\"array\",\"description\":\"Intermediate frame images, evenly spaced in order between the first and last frames\\n\\n**Note:**\\n- Count: `1` to `8` images\\n- The first frame, intermediate frames, and last frame combined must not exceed `10` images or `duration` + 1 (for example, up to `4` images for `3` seconds or `6` images for `5` seconds)\\n- The last frame is optional. If omitted, the model generates the ending frame\\n- Image size: up to `10MB`\\n- Supported formats: `.jpg`, `.jpeg`, `.png`\\n- Image dimensions: width and height >= `300px`, aspect ratio between `1:2.5` and `2.5:1`\\n- Image URL must be directly accessible by the server or trigger a direct download when accessed\",\"items\":{\"type\":\"object\",\"properties\":{\"image_url\":{\"type\":\"string\",\"format\":\"uri\",\"description\":\"Intermediate frame image URL\"}},\"required\":[\"image_url\"],\"additionalProperties\":false},\"minItems\":0,\"maxItems\":8,\"example\":[{\"image_url\":\"https://example.com/half-open.jpg\"},{\"image_url\":\"https://example.com/open.jpg\"}]},\"prompt\":{\"type\":\"string\",\"description\":\"Text prompt describing the video to generate\\n\\n**Note:**\\n- Maximum `2500` characters\",\"example\":\"The person in the image slowly turns their head and smiles\",\"maxLength\":2500},\"duration\":{\"type\":\"integer\",\"description\":\"Video duration in seconds. Defaults to `5` seconds\\n\\n**Range:**\\n- Integer from `3` to `30`\",\"minimum\":3,\"maximum\":30,\"default\":5,\"example\":5},\"quality\":{\"type\":\"string\",\"description\":\"Resolution tier\\n\\n**Options:**\\n- `720p`: Standard 720P\\n- `1080p`: High quality 1080P\",\"enum\":[\"720p\",\"1080p\"],\"default\":\"720p\",\"example\":\"720p\"}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"responseSchema\":{\"schema\":{\"$ref\":\"#/$defs/VideoGenerationResponse\",\"$defs\":{\"VideoGenerationResponse\":{\"type\":\"object\",\"properties\":{\"created\":{\"type\":\"integer\",\"description\":\"Task creation timestamp\",\"example\":1757169743},\"id\":{\"type\":\"string\",\"description\":\"Task ID\",\"example\":\"task-unified-1757169743-7cvnl5zw\"},\"model\":{\"type\":\"string\",\"description\":\"Actual model name used\",\"example\":\"kling-v4-image-to-video\"},\"object\":{\"type\":\"string\",\"enum\":[\"video.generation.task\"],\"description\":\"Task type\"},\"progress\":{\"type\":\"integer\",\"description\":\"Task progress percentage (0-100)\",\"minimum\":0,\"maximum\":100,\"example\":0},\"status\":{\"type\":\"string\",\"description\":\"Task status\",\"enum\":[\"pending\",\"processing\",\"completed\",\"failed\"],\"example\":\"pending\"},\"task_info\":{\"$ref\":\"#/$defs/VideoTaskInfo\",\"description\":\"Video task details\"},\"type\":{\"type\":\"string\",\"enum\":[\"text\",\"image\",\"audio\",\"video\"],\"description\":\"Task output type\",\"example\":\"video\"},\"usage\":{\"$ref\":\"#/$defs/VideoUsage\",\"description\":\"Usage and billing information\"}}},\"VideoTaskInfo\":{\"type\":\"object\",\"properties\":{\"estimated_time\":{\"type\":\"integer\",\"description\":\"Estimated completion time (seconds)\",\"minimum\":0,\"example\":300},\"video_duration\":{\"type\":\"integer\",\"description\":\"Video duration (seconds)\",\"example\":5}}},\"VideoUsage\":{\"type\":\"object\",\"description\":\"Usage and billing information\",\"properties\":{\"billing_rule\":{\"type\":\"string\",\"description\":\"Billing rule\",\"enum\":[\"per_call\",\"per_token\",\"per_second\"],\"example\":\"per_second\"},\"credits_reserved\":{\"type\":\"number\",\"description\":\"Estimated credits consumed\",\"minimum\":0,\"example\":53.38},\"user_group\":{\"type\":\"string\",\"description\":\"User group category\",\"example\":\"default\"}}}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"example\":{\"prompt\":\"The person in the image slowly turns their head and smiles\",\"image_start\":\"https://example.com/portrait.jpg\",\"duration\":5,\"quality\":\"720p\"}},\"kling-v4-reference-to-video\":{\"model\":\"kling-v4-reference-to-video\",\"kind\":\"video\",\"path\":\"/v1/videos/generations\",\"title\":\"kling-v4-reference-to-video API\",\"docs\":\"https://evolink.ai/docs/en/api-manual/video-series/kling/kling-v4-reference-to-video\",\"required\":[\"prompt\"],\"params\":{\"prompt\":{\"type\":\"string\",\"description\":\"Text prompt, up to 2500 characters Reference syntax: Use <<<xxx>>> in the prompt to reference images and videos, for example: The person from <<<image_1>>> walks down the street following the camera movement in <<<video_1>>>\",\"maxLength\":2500,\"required\":true},\"video_urls\":{\"type\":\"array\",\"description\":\"Reference video URL array, up to 5 clips, corresponding in order to <<<video_1>>>, <<<video_2>>>, etc. in the prompt Video requirements: Formats: MP4 / MOV; Size: ≤ 200MB per clip; Duration: ≥ 3 seconds per clip, ≤ 30 seconds in total; Dimensions: width and height from 720px to 2160px; Frame rate: 24fps to 60fps; Video URLs must be directly accessible by the server\",\"maxItems\":5,\"items\":{\"type\":\"string\",\"format\":\"uri\"}},\"image_urls\":{\"type\":\"array\",\"description\":\"Reference image URL array (style, scene, or subject references), corresponding in order to <<<image_1>>>, <<<image_2>>>, etc. in the prompt Constraints: Up to 10 images Note: Image URLs must be directly accessible by the server or trigger a direct download when accessed\",\"maxItems\":10,\"items\":{\"type\":\"string\",\"format\":\"uri\"}},\"duration\":{\"type\":\"integer\",\"description\":\"Video duration in seconds, from 3 to 30\",\"default\":5,\"minimum\":3,\"maximum\":30},\"aspect_ratio\":{\"type\":\"string\",\"description\":\"Video aspect ratio Options: 16:9: Landscape; 9:16: Portrait; 1:1: Square; 21:9: Ultrawide\",\"enum\":[\"16:9\",\"9:16\",\"1:1\",\"21:9\"],\"default\":\"16:9\"},\"quality\":{\"type\":\"string\",\"description\":\"Resolution tier Options: 720p: Standard 720P; 1080p: High quality 1080P\",\"enum\":[\"720p\",\"1080p\"],\"default\":\"720p\"}},\"inputSchema\":{\"schema\":{\"type\":\"object\",\"required\":[\"prompt\"],\"properties\":{\"prompt\":{\"type\":\"string\",\"description\":\"Text prompt, up to 2500 characters\\n\\n**Reference syntax:** Use `<<<xxx>>>` in the prompt to reference images and videos, for example: `The person from <<<image_1>>> walks down the street following the camera movement in <<<video_1>>>`\",\"example\":\"The person from <<<image_1>>> walks down the street following the camera movement in <<<video_1>>>\",\"maxLength\":2500},\"video_urls\":{\"type\":\"array\",\"description\":\"Reference video URL array, up to `5` clips, corresponding in order to `<<<video_1>>>`, `<<<video_2>>>`, etc. in the prompt\\n\\n**Video requirements:**\\n- Formats: MP4 / MOV\\n- Size: ≤ 200MB per clip\\n- Duration: ≥ 3 seconds per clip, ≤ 30 seconds in total\\n- Dimensions: width and height from 720px to 2160px\\n- Frame rate: 24fps to 60fps\\n- Video URLs must be directly accessible by the server\",\"items\":{\"type\":\"string\",\"format\":\"uri\"},\"maxItems\":5,\"example\":[\"https://example.com/reference.mp4\"]},\"image_urls\":{\"type\":\"array\",\"description\":\"Reference image URL array (style, scene, or subject references), corresponding in order to `<<<image_1>>>`, `<<<image_2>>>`, etc. in the prompt\\n\\n**Constraints:** Up to `10` images\\n**Note:** Image URLs must be directly accessible by the server or trigger a direct download when accessed\",\"items\":{\"type\":\"string\",\"format\":\"uri\"},\"example\":[\"https://example.com/character.jpg\"],\"maxItems\":10},\"duration\":{\"type\":\"integer\",\"description\":\"Video duration in seconds, from 3 to 30\",\"minimum\":3,\"maximum\":30,\"default\":5,\"example\":5},\"aspect_ratio\":{\"type\":\"string\",\"description\":\"Video aspect ratio\\n\\n**Options:**\\n- `16:9`: Landscape\\n- `9:16`: Portrait\\n- `1:1`: Square\\n- `21:9`: Ultrawide\",\"enum\":[\"16:9\",\"9:16\",\"1:1\",\"21:9\"],\"example\":\"16:9\",\"default\":\"16:9\"},\"quality\":{\"type\":\"string\",\"description\":\"Resolution tier\\n\\n**Options:**\\n- `720p`: Standard 720P\\n- `1080p`: High quality 1080P\",\"enum\":[\"720p\",\"1080p\"],\"default\":\"720p\",\"example\":\"720p\"}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"responseSchema\":{\"schema\":{\"$ref\":\"#/$defs/VideoGenerationResponse\",\"$defs\":{\"VideoGenerationResponse\":{\"type\":\"object\",\"properties\":{\"created\":{\"type\":\"integer\",\"description\":\"Task creation timestamp\",\"example\":1757169743},\"id\":{\"type\":\"string\",\"description\":\"Task ID\",\"example\":\"task-unified-1757169743-7cvnl5zw\"},\"model\":{\"type\":\"string\",\"description\":\"Actual model name used\",\"example\":\"kling-v4-reference-to-video\"},\"object\":{\"type\":\"string\",\"enum\":[\"video.generation.task\"],\"description\":\"Task type\"},\"progress\":{\"type\":\"integer\",\"description\":\"Task progress percentage (0-100)\",\"minimum\":0,\"maximum\":100,\"example\":0},\"status\":{\"type\":\"string\",\"description\":\"Task status\",\"enum\":[\"pending\",\"processing\",\"completed\",\"failed\"],\"example\":\"pending\"},\"task_info\":{\"$ref\":\"#/$defs/VideoTaskInfo\",\"description\":\"Video task details\"},\"type\":{\"type\":\"string\",\"enum\":[\"text\",\"image\",\"audio\",\"video\"],\"description\":\"Task output type\",\"example\":\"video\"},\"usage\":{\"$ref\":\"#/$defs/VideoUsage\",\"description\":\"Usage and billing information\"}}},\"VideoTaskInfo\":{\"type\":\"object\",\"properties\":{\"estimated_time\":{\"type\":\"integer\",\"description\":\"Estimated completion time (seconds)\",\"minimum\":0,\"example\":300},\"video_duration\":{\"type\":\"integer\",\"description\":\"Video duration (seconds)\",\"example\":9}}},\"VideoUsage\":{\"type\":\"object\",\"description\":\"Usage and billing information\",\"properties\":{\"billing_rule\":{\"type\":\"string\",\"description\":\"Billing rule\",\"enum\":[\"per_call\",\"per_token\",\"per_second\"],\"example\":\"per_second\"},\"credits_reserved\":{\"type\":\"number\",\"description\":\"Estimated credits consumed\",\"minimum\":0,\"example\":53.38},\"user_group\":{\"type\":\"string\",\"description\":\"User group category\",\"example\":\"default\"}}}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"example\":{\"prompt\":\"Keep the same motion style as <<<video_1>>> and replace the background with a snowy scene\",\"video_urls\":[\"https://example.com/reference.mp4\"],\"duration\":5,\"aspect_ratio\":\"16:9\",\"quality\":\"720p\"}},\"kling-v4-text-to-video\":{\"model\":\"kling-v4-text-to-video\",\"kind\":\"video\",\"path\":\"/v1/videos/generations\",\"title\":\"kling-v4-text-to-video API\",\"docs\":\"https://evolink.ai/docs/en/api-manual/video-series/kling/kling-v4-text-to-video\",\"required\":[\"prompt\"],\"params\":{\"prompt\":{\"type\":\"string\",\"description\":\"Text prompt describing the video to generate Note: Maximum 2500 characters\",\"maxLength\":2500,\"required\":true},\"duration\":{\"type\":\"integer\",\"description\":\"Video duration in seconds. Defaults to 5 seconds Range: Integer from 3 to 30\",\"default\":5,\"minimum\":3,\"maximum\":30},\"aspect_ratio\":{\"type\":\"string\",\"description\":\"Video aspect ratio Options: 16:9: Landscape; 9:16: Portrait; 1:1: Square; 21:9: Ultrawide\",\"enum\":[\"16:9\",\"9:16\",\"1:1\",\"21:9\"],\"default\":\"16:9\"},\"quality\":{\"type\":\"string\",\"description\":\"Resolution tier Options: 720p: Standard 720P; 1080p: High quality 1080P\",\"enum\":[\"720p\",\"1080p\"],\"default\":\"720p\"}},\"inputSchema\":{\"schema\":{\"type\":\"object\",\"required\":[\"prompt\"],\"properties\":{\"prompt\":{\"type\":\"string\",\"description\":\"Text prompt describing the video to generate\\n\\n**Note:**\\n- Maximum `2500` characters\",\"example\":\"A cat running on a grassy field under bright sunshine\",\"maxLength\":2500},\"duration\":{\"type\":\"integer\",\"description\":\"Video duration in seconds. Defaults to `5` seconds\\n\\n**Range:**\\n- Integer from `3` to `30`\",\"minimum\":3,\"maximum\":30,\"default\":5,\"example\":5},\"aspect_ratio\":{\"type\":\"string\",\"description\":\"Video aspect ratio\\n\\n**Options:**\\n- `16:9`: Landscape\\n- `9:16`: Portrait\\n- `1:1`: Square\\n- `21:9`: Ultrawide\",\"enum\":[\"16:9\",\"9:16\",\"1:1\",\"21:9\"],\"example\":\"16:9\",\"default\":\"16:9\"},\"quality\":{\"type\":\"string\",\"description\":\"Resolution tier\\n\\n**Options:**\\n- `720p`: Standard 720P\\n- `1080p`: High quality 1080P\",\"enum\":[\"720p\",\"1080p\"],\"default\":\"720p\",\"example\":\"720p\"}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"responseSchema\":{\"schema\":{\"$ref\":\"#/$defs/VideoGenerationResponse\",\"$defs\":{\"VideoGenerationResponse\":{\"type\":\"object\",\"properties\":{\"created\":{\"type\":\"integer\",\"description\":\"Task creation timestamp\",\"example\":1757169743},\"id\":{\"type\":\"string\",\"description\":\"Task ID\",\"example\":\"task-unified-1757169743-7cvnl5zw\"},\"model\":{\"type\":\"string\",\"description\":\"Actual model name used\",\"example\":\"kling-v4-text-to-video\"},\"object\":{\"type\":\"string\",\"enum\":[\"video.generation.task\"],\"description\":\"Task type\"},\"progress\":{\"type\":\"integer\",\"description\":\"Task progress percentage (0-100)\",\"minimum\":0,\"maximum\":100,\"example\":0},\"status\":{\"type\":\"string\",\"description\":\"Task status\",\"enum\":[\"pending\",\"processing\",\"completed\",\"failed\"],\"example\":\"pending\"},\"task_info\":{\"$ref\":\"#/$defs/VideoTaskInfo\",\"description\":\"Video task details\"},\"type\":{\"type\":\"string\",\"enum\":[\"text\",\"image\",\"audio\",\"video\"],\"description\":\"Task output type\",\"example\":\"video\"},\"usage\":{\"$ref\":\"#/$defs/VideoUsage\",\"description\":\"Usage and billing information\"}}},\"VideoTaskInfo\":{\"type\":\"object\",\"properties\":{\"estimated_time\":{\"type\":\"integer\",\"description\":\"Estimated completion time (seconds)\",\"minimum\":0,\"example\":300},\"video_duration\":{\"type\":\"integer\",\"description\":\"Video duration (seconds)\",\"example\":5}}},\"VideoUsage\":{\"type\":\"object\",\"description\":\"Usage and billing information\",\"properties\":{\"billing_rule\":{\"type\":\"string\",\"description\":\"Billing rule\",\"enum\":[\"per_call\",\"per_token\",\"per_second\"],\"example\":\"per_second\"},\"credits_reserved\":{\"type\":\"number\",\"description\":\"Estimated credits consumed\",\"minimum\":0,\"example\":53.38},\"user_group\":{\"type\":\"string\",\"description\":\"User group category\",\"example\":\"default\"}}}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"example\":{\"prompt\":\"A cat running on a grassy field under bright sunshine\",\"duration\":5,\"aspect_ratio\":\"16:9\",\"quality\":\"720p\"}},\"kling-v4-video-edit\":{\"model\":\"kling-v4-video-edit\",\"kind\":\"video\",\"path\":\"/v1/videos/generations\",\"title\":\"kling-v4-video-edit API\",\"docs\":\"https://evolink.ai/docs/en/api-manual/video-series/kling/kling-v4-video-edit\",\"required\":[\"prompt\",\"video_urls\"],\"params\":{\"prompt\":{\"type\":\"string\",\"description\":\"Editing instructions, up to 2500 characters Reference syntax: Use <<<xxx>>> in the prompt to reference images and videos, for example: Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>\",\"maxLength\":2500,\"required\":true},\"video_urls\":{\"type\":\"array\",\"description\":\"Video URL array for editing. Exactly 1 clip is supported, referenced as <<<video_1>>> in the prompt Video requirements: Formats: MP4 / MOV; Size: ≤ 200MB; Duration: 3 to 30 seconds; Dimensions: width and height from 720px to 2160px; Frame rate: 24fps to 60fps; The video URL must be directly accessible by the server\",\"minItems\":1,\"maxItems\":1,\"items\":{\"type\":\"string\",\"format\":\"uri\"},\"required\":true},\"image_urls\":{\"type\":\"array\",\"description\":\"Reference image URL array (style references) Constraints: Up to 10 images Note: Image URLs must be directly accessible by the server or trigger a direct download when accessed\",\"maxItems\":10,\"items\":{\"type\":\"string\",\"format\":\"uri\"}},\"duration\":{\"type\":\"integer|string\",\"description\":\"Output video duration in seconds. Defaults to auto Values: Integer: 3 to 30 seconds; auto: Match the original video duration\",\"default\":\"auto\",\"minimum\":3,\"maximum\":30},\"quality\":{\"type\":\"string\",\"description\":\"Resolution tier Options: 720p: Standard 720P; 1080p: High quality 1080P\",\"enum\":[\"720p\",\"1080p\"],\"default\":\"720p\"}},\"inputSchema\":{\"schema\":{\"type\":\"object\",\"required\":[\"prompt\",\"video_urls\"],\"properties\":{\"prompt\":{\"type\":\"string\",\"description\":\"Editing instructions, up to 2500 characters\\n\\n**Reference syntax:** Use `<<<xxx>>>` in the prompt to reference images and videos, for example: `Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>`\",\"example\":\"Adjust the color to warm tones and add a cinematic feel\",\"maxLength\":2500},\"video_urls\":{\"type\":\"array\",\"description\":\"Video URL array for editing. Exactly `1` clip is supported, referenced as `<<<video_1>>>` in the prompt\\n\\n**Video requirements:**\\n- Formats: MP4 / MOV\\n- Size: ≤ 200MB\\n- Duration: 3 to 30 seconds\\n- Dimensions: width and height from 720px to 2160px\\n- Frame rate: 24fps to 60fps\\n- The video URL must be directly accessible by the server\",\"items\":{\"type\":\"string\",\"format\":\"uri\"},\"minItems\":1,\"maxItems\":1,\"example\":[\"https://example.com/original.mp4\"]},\"image_urls\":{\"type\":\"array\",\"description\":\"Reference image URL array (style references)\\n\\n**Constraints:** Up to `10` images\\n**Note:** Image URLs must be directly accessible by the server or trigger a direct download when accessed\",\"items\":{\"type\":\"string\",\"format\":\"uri\"},\"example\":[\"https://example.com/style_ref.jpg\"],\"maxItems\":10},\"duration\":{\"description\":\"Output video duration in seconds. Defaults to `auto`\\n\\n**Values:**\\n- Integer: `3` to `30` seconds\\n- `auto`: Match the original video duration\",\"oneOf\":[{\"type\":\"integer\",\"minimum\":3,\"maximum\":30},{\"type\":\"string\",\"enum\":[\"auto\"]}],\"default\":\"auto\",\"example\":\"auto\"},\"quality\":{\"type\":\"string\",\"description\":\"Resolution tier\\n\\n**Options:**\\n- `720p`: Standard 720P\\n- `1080p`: High quality 1080P\",\"enum\":[\"720p\",\"1080p\"],\"default\":\"720p\",\"example\":\"720p\"}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"responseSchema\":{\"schema\":{\"$ref\":\"#/$defs/VideoGenerationResponse\",\"$defs\":{\"VideoGenerationResponse\":{\"type\":\"object\",\"properties\":{\"created\":{\"type\":\"integer\",\"description\":\"Task creation timestamp\",\"example\":1757169743},\"id\":{\"type\":\"string\",\"description\":\"Task ID\",\"example\":\"task-unified-1757169743-7cvnl5zw\"},\"model\":{\"type\":\"string\",\"description\":\"Actual model name used\",\"example\":\"kling-v4-video-edit\"},\"object\":{\"type\":\"string\",\"enum\":[\"video.generation.task\"],\"description\":\"Task type\"},\"progress\":{\"type\":\"integer\",\"description\":\"Task progress percentage (0-100)\",\"minimum\":0,\"maximum\":100,\"example\":0},\"status\":{\"type\":\"string\",\"description\":\"Task status\",\"enum\":[\"pending\",\"processing\",\"completed\",\"failed\"],\"example\":\"pending\"},\"task_info\":{\"$ref\":\"#/$defs/VideoTaskInfo\",\"description\":\"Video task details\"},\"type\":{\"type\":\"string\",\"enum\":[\"text\",\"image\",\"audio\",\"video\"],\"description\":\"Task output type\",\"example\":\"video\"},\"usage\":{\"$ref\":\"#/$defs/VideoUsage\",\"description\":\"Usage and billing information\"}}},\"VideoTaskInfo\":{\"type\":\"object\",\"properties\":{\"estimated_time\":{\"type\":\"integer\",\"description\":\"Estimated completion time (seconds)\",\"minimum\":0,\"example\":300},\"video_duration\":{\"type\":\"integer\",\"description\":\"Video duration (seconds)\",\"example\":9}}},\"VideoUsage\":{\"type\":\"object\",\"description\":\"Usage and billing information\",\"properties\":{\"billing_rule\":{\"type\":\"string\",\"description\":\"Billing rule\",\"enum\":[\"per_call\",\"per_token\",\"per_second\"],\"example\":\"per_second\"},\"credits_reserved\":{\"type\":\"number\",\"description\":\"Estimated credits consumed\",\"minimum\":0,\"example\":63.92},\"user_group\":{\"type\":\"string\",\"description\":\"User group category\",\"example\":\"default\"}}}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"example\":{\"prompt\":\"Adjust the color to warm tones and add a cinematic feel\",\"video_urls\":[\"https://example.com/original.mp4\"],\"quality\":\"720p\"}},\"qwen-audio-3.1-tts-flash\":{\"model\":\"qwen-audio-3.1-tts-flash\",\"kind\":\"audio\",\"path\":\"/v1/audios/generations\",\"title\":\"Qwen Audio 3.1 TTS Flash Speech Synthesis\",\"docs\":\"https://evolink.ai/docs/en/api-manual/audio-series/qwen-audio-tts/qwen-audio-3.1-tts-flash\",\"required\":[],\"params\":{\"prompt\":{\"type\":\"string\",\"description\":\"Text to synthesize Constraints: Maximum 5000 characters; Keep punctuation in long text: long continuous passages without sentence breaks may be truncated upstream at about 1500 output tokens (about 120 seconds of audio). The task still reports success and is billed for the tokens actually generated; the gateway cannot detect this truncation; You can also use input. At least one non-empty text field is required; supplying just one is recommended. Different contents in both fields return 400 (parameter_conflict); Text must be in a language supported by the selected voice; otherwise pronunciatio…\",\"maxLength\":5000},\"input\":{\"type\":\"string\",\"description\":\"Alias for prompt, with the same length limits and usage rules; Provide at least one non-empty text field, prompt or input; If both are supplied, their contents must match; otherwise 400 (parameter_conflict) is returned\",\"maxLength\":5000},\"voice\":{\"type\":\"string\",\"description\":\"Voice name, case-sensitive; 68 system voices; see the [voice list](/en/api-manual/audio-series/qwen-audio-tts/qwen-audio-3.1-tts-flash-voices) for names, gender, and use cases; Defaults to longanhuan_v3.1 if omitted; You can also supply a voice you created with [Voice Enrollment](/en/api-manual/audio-series/qwen-audio-tts/voice-enrollment): cloned voices follow qwen-audio-3.1-tts-flash-{prefix}-{32-character-id}, and designed voices follow qwen-audio-3.1-tts-flash-vd-{prefix}-{32-character-id}. Only the account that created the voice can use it. Voices from other models, such as qwen-tts-vd-……\",\"default\":\"longanhuan_v3.1\"},\"response_format\":{\"type\":\"string\",\"description\":\"Output audio format: mp3, wav, or opus; defaults to mp3; opus uses an Ogg Opus container; You can also use format. Supplying just one field is recommended; conflicting values return 400 (parameter_conflict)\",\"enum\":[\"mp3\",\"wav\",\"opus\"],\"default\":\"mp3\"},\"format\":{\"type\":\"string\",\"description\":\"Alias for response_format; supports mp3, wav, and opus; Defaults to mp3 when neither field is supplied; If both fields are supplied, their values must match; otherwise 400 (parameter_conflict) is returned\",\"enum\":[\"mp3\",\"wav\",\"opus\"]},\"sample_rate\":{\"type\":\"integer\",\"description\":\"Output sample rate (Hz); 22050 and 44100 are not supported when response_format is opus; Omitted or null uses the default; 0 or a value outside the list returns 400\",\"enum\":[8000,12000,16000,22050,24000,44100,48000,null],\"default\":24000},\"volume\":{\"type\":\"integer\",\"description\":\"Volume, from 0 to 100\",\"default\":50,\"minimum\":0,\"maximum\":100},\"speech_rate\":{\"type\":\"number\",\"description\":\"Speech rate multiplier; 1.0: normal speed (default); 2.0: double speed; 0.5: half speed Range: 0.5 to 2.0. Adjusting speech rate does not change output token count\",\"default\":1,\"minimum\":0.5,\"maximum\":2},\"pitch\":{\"type\":\"number\",\"description\":\"Pitch multiplier; 1.0: default pitch; Above 1.0 raises pitch; below 1.0 lowers it Range: 0.5 to 2.0 Changing pitch also changes speech rate and audio duration; Higher pitch speeds up speech and shortens audio; lower pitch slows it down and lengthens audio. Duration varies approximately inversely with the square of the pitch value; For a sentence lasting about 2.8 seconds at 1.0: 0.8 is about 4.3 seconds, 1.2 about 2.1 seconds, 0.5 about 10.9 seconds, and 2.0 about 0.7 seconds; Small adjustments between 0.8 and 1.2 are recommended; values near 0.5 or 2.0 make speech noticeably too slow or too…\",\"default\":1,\"minimum\":0.5,\"maximum\":2},\"instruction\":{\"type\":\"string\",\"description\":\"Natural-language instructions to control emotion, tone, character, dialect, and other delivery choices Constraints: Maximum 100 billing characters: Han characters (including Japanese kanji and Korean hanja) count as 2; other characters count as 1, including kana and Hangul (about 50 Han characters or 100 English characters). Exceeding the limit returns 400 Examples: 用欢快、热情的语气说 (speak cheerfully and enthusiastically); 请用上海话表达 (use Shanghainese; multilingual and dialect voices); Speak slowly in a calm and gentle tone Instructions do not count toward input tokens, but can change the generated au…\"},\"language\":{\"type\":\"string\",\"description\":\"Target-language hint to improve the reading of numbers, abbreviations, and symbols, and synthesis in less common languages For example, with zh, 110 in hello, this is 110 is read as “yao yao ling” in Chinese | Value | Language | Value | Language | |---|---|---|---| | zh | Chinese | th | Thai | | en | English | id | Indonesian | | fr | French | vi | Vietnamese | | de | German | es | Spanish | | ja | Japanese | it | Italian | | ko | Korean | ms | Malay | | ru | Russian | fil | Filipino | | pt | Portuguese | ar | Arabic | The model detects the language if omitted; this parameter does not transla…\",\"enum\":[\"zh\",\"en\",\"fr\",\"de\",\"ja\",\"ko\",\"ru\",\"pt\",\"th\",\"id\",\"vi\",\"es\",\"it\",\"ms\",\"fil\",\"ar\"]},\"enable_ssml\":{\"type\":\"boolean\",\"description\":\"Parse prompt as SSML When enabled, SSML tags can be used, such as <break time=\\\"1s\\\"/> for a pause: <speak>欢迎收听今天的节目。<break time=\\\"1s\\\"/>我们马上开始。</speak> Pauses inserted with SSML do not count toward output tokens\",\"default\":false},\"hot_fix\":{\"type\":\"object\",\"description\":\"Custom pronunciation and text replacement to correct polyphonic characters, proper names, and other pronunciations; pronunciation: annotate words with pinyin (separate syllables with spaces and mark tones with digits, such as tian1 qi4) to override the default pronunciation; replace: replace specified words before synthesis. Synthesis and billing use the replaced text, which must also stay within 5000 characters; exceeding the limit returns 400 (prompt_too_long) The two lists may contain at most 200 entries in total, counted as key-value pairs within the objects. Exceeding the limit returns 4…\",\"properties\":{\"pronunciation\":{\"type\":\"array\",\"description\":\"Custom pronunciation list; each item is an object such as {\\\"word\\\": \\\"pinyin\\\"}\",\"items\":{\"type\":\"object\"}},\"replace\":{\"type\":\"array\",\"description\":\"Text replacement list; each item is an object such as {\\\"original word\\\": \\\"replacement text\\\"}\",\"items\":{\"type\":\"object\"}}}},\"enable_aigc_tag\":{\"type\":\"boolean\",\"description\":\"Embed an invisible AIGC marker in generated audio (applies to wav / mp3 / opus)\",\"default\":false}},\"inputSchema\":{\"schema\":{\"type\":\"object\",\"required\":[],\"description\":\"Provide at least one non-empty text field, `prompt` or `input`; if both are supplied, their contents must match. If both `response_format` and `format` are supplied, their values must match.\",\"anyOf\":[{\"required\":[\"prompt\"],\"properties\":{\"prompt\":{\"pattern\":\"\\\\S\"}}},{\"required\":[\"input\"],\"properties\":{\"input\":{\"pattern\":\"\\\\S\"}}}],\"properties\":{\"prompt\":{\"type\":\"string\",\"description\":\"Text to synthesize\\n\\n**Constraints:**\\n- Maximum `5000` characters\\n- Keep punctuation in long text: long continuous passages without sentence breaks may be truncated upstream at about `1500` output tokens (about 120 seconds of audio). The task still reports success and is billed for the tokens actually generated; the gateway cannot detect this truncation\\n- You can also use `input`. At least one non-empty text field is required; supplying just one is recommended. Different contents in both fields return `400` (`parameter_conflict`)\\n- Text must be in a language supported by the selected voice; otherwise pronunciation may be incorrect\\n\\n**Emotion and paralinguistic tags:** Embed tags directly in the text without extra parameters; tag text counts toward billing characters\\n- **Control tags**: Set the emotion or style of the following text until the next control tag. `[sad]` sad, `[amazed]` amazed, `[deep and loud shouting]` deep, loud shouting, `[trembling]` trembling, `[angry]` angry, `[excited]` excited, `[sarcastic]` sarcastic, `[curious]` curious, `[like dracula]` low and eerie, `[bored]` bored, `[tired]` tired, `[scornful]` scornful, `[shouting]` shouting, `[asmr]` soft ASMR whispers, `[panicked]` panicked, `[mischievously]` mischievous, `[empathetic]` empathetic, `[whispers]` whispering, `[reluctantly]` reluctant, `[crying]` crying, `[serious]` serious, `[very slowly]` very slowly, `[very fast]` very fast\\n- **Paralinguistic tags**: Insert a vocal effect at this position without changing the emotion of the surrounding text. `[gasp]` gasp, `[sighing]` sigh, `[clears throat]` clear the throat, `[giggles]` giggle, `[laughing]` laugh, `[cough]` cough, `[snorts]` snort\\n\\n**Example:** `[excited]今天的天气真不错![laughing]我们一起出去玩吧!`\\n\\nWhen `enable_ssml` is `true`, this field is parsed as SSML\",\"maxLength\":5000,\"example\":\"我家的后面有一个很大的花园。\"},\"input\":{\"type\":\"string\",\"description\":\"Alias for `prompt`, with the same length limits and usage rules\\n\\n- Provide at least one non-empty text field, `prompt` or `input`\\n- If both are supplied, their contents must match; otherwise `400` (`parameter_conflict`) is returned\",\"maxLength\":5000,\"example\":\"我家的后面有一个很大的花园。\"},\"voice\":{\"type\":\"string\",\"description\":\"Voice name, case-sensitive\\n\\n- 68 system voices; see the [voice list](/en/api-manual/audio-series/qwen-audio-tts/qwen-audio-3.1-tts-flash-voices) for names, gender, and use cases\\n- Defaults to `longanhuan_v3.1` if omitted\\n- You can also supply a voice you created with [Voice Enrollment](/en/api-manual/audio-series/qwen-audio-tts/voice-enrollment): cloned voices follow `qwen-audio-3.1-tts-flash-{prefix}-{32-character-id}`, and designed voices follow `qwen-audio-3.1-tts-flash-vd-{prefix}-{32-character-id}`. Only the account that created the voice can use it. Voices from other models, such as `qwen-tts-vd-…` from `qwen-voice-design`, return `400` (`invalid_voice`). Missing voices or voices owned by another account return `404` (`voice_not_found`)\\n- Custom voices expire by default `6 hours` after the creation task completes; synthesis after expiry returns `404` (`voice_expired`). Create a new voice with Voice Enrollment\",\"default\":\"longanhuan_v3.1\",\"example\":\"longanhuan_v3.1\"},\"response_format\":{\"type\":\"string\",\"description\":\"Output audio format: `mp3`, `wav`, or `opus`; defaults to `mp3`\\n\\n- `opus` uses an Ogg Opus container\\n- You can also use `format`. Supplying just one field is recommended; conflicting values return `400` (`parameter_conflict`)\",\"enum\":[\"mp3\",\"wav\",\"opus\"],\"default\":\"mp3\",\"example\":\"mp3\"},\"format\":{\"type\":\"string\",\"description\":\"Alias for `response_format`; supports `mp3`, `wav`, and `opus`\\n\\n- Defaults to `mp3` when neither field is supplied\\n- If both fields are supplied, their values must match; otherwise `400` (`parameter_conflict`) is returned\",\"enum\":[\"mp3\",\"wav\",\"opus\"],\"example\":\"mp3\"},\"sample_rate\":{\"type\":[\"integer\",\"null\"],\"description\":\"Output sample rate (Hz)\\n\\n- `22050` and `44100` are not supported when `response_format` is `opus`\\n- Omitted or `null` uses the default; `0` or a value outside the list returns `400`\",\"enum\":[8000,12000,16000,22050,24000,44100,48000,null],\"default\":24000,\"example\":24000},\"volume\":{\"type\":\"integer\",\"description\":\"Volume, from `0` to `100`\",\"minimum\":0,\"maximum\":100,\"default\":50,\"example\":50},\"speech_rate\":{\"type\":\"number\",\"description\":\"Speech rate multiplier\\n\\n- `1.0`: normal speed (default)\\n- `2.0`: double speed; `0.5`: half speed\\n\\nRange: `0.5` to `2.0`. Adjusting speech rate does not change output token count\",\"minimum\":0.5,\"maximum\":2,\"default\":1,\"example\":1},\"pitch\":{\"type\":\"number\",\"description\":\"Pitch multiplier\\n\\n- `1.0`: default pitch\\n- Above `1.0` raises pitch; below `1.0` lowers it\\n\\nRange: `0.5` to `2.0`\\n\\n**Changing pitch also changes speech rate and audio duration**\\n- Higher pitch speeds up speech and shortens audio; lower pitch slows it down and lengthens audio. Duration varies approximately inversely with the square of the pitch value\\n- For a sentence lasting about 2.8 seconds at `1.0`: `0.8` is about 4.3 seconds, `1.2` about 2.1 seconds, `0.5` about 10.9 seconds, and `2.0` about 0.7 seconds\\n- Small adjustments between `0.8` and `1.2` are recommended; values near `0.5` or `2.0` make speech noticeably too slow or too fast\\n- If `speech_rate` is also supplied with a value other than `1.0`, `pitch` has no effect; the two cannot be combined\\n- Adjusting pitch does not change output token count\",\"minimum\":0.5,\"maximum\":2,\"default\":1,\"example\":1},\"instruction\":{\"type\":\"string\",\"description\":\"Natural-language instructions to control emotion, tone, character, dialect, and other delivery choices\\n\\n**Constraints:**\\n- Maximum `100` billing characters: Han characters (including Japanese kanji and Korean hanja) count as 2; other characters count as 1, including kana and Hangul (about 50 Han characters or 100 English characters). Exceeding the limit returns `400`\\n\\n**Examples:**\\n- `用欢快、热情的语气说` (speak cheerfully and enthusiastically)\\n- `请用上海话表达` (use Shanghainese; multilingual and dialect voices)\\n- `Speak slowly in a calm and gentle tone`\\n\\nInstructions do not count toward input tokens, but can change the generated audio duration and therefore output tokens\\n\\n> The parameter is `instruction` (singular); `instructions` returns `400`\",\"example\":\"用欢快、热情的语气说\"},\"language\":{\"type\":\"string\",\"description\":\"Target-language hint to improve the reading of numbers, abbreviations, and symbols, and synthesis in less common languages\\n\\nFor example, with `zh`, `110` in `hello, this is 110` is read as “yao yao ling” in Chinese\\n\\n| Value | Language | Value | Language |\\n|---|---|---|---|\\n| `zh` | Chinese | `th` | Thai |\\n| `en` | English | `id` | Indonesian |\\n| `fr` | French | `vi` | Vietnamese |\\n| `de` | German | `es` | Spanish |\\n| `ja` | Japanese | `it` | Italian |\\n| `ko` | Korean | `ms` | Malay |\\n| `ru` | Russian | `fil` | Filipino |\\n| `pt` | Portuguese | `ar` | Arabic |\\n\\nThe model detects the language if omitted; this parameter does not translate text\",\"enum\":[\"zh\",\"en\",\"fr\",\"de\",\"ja\",\"ko\",\"ru\",\"pt\",\"th\",\"id\",\"vi\",\"es\",\"it\",\"ms\",\"fil\",\"ar\"],\"example\":\"zh\"},\"enable_ssml\":{\"type\":\"boolean\",\"description\":\"Parse `prompt` as SSML\\n\\nWhen enabled, SSML tags can be used, such as `<break time=\\\"1s\\\"/>` for a pause:\\n`<speak>欢迎收听今天的节目。<break time=\\\"1s\\\"/>我们马上开始。</speak>`\\n\\nPauses inserted with SSML do not count toward output tokens\",\"default\":false,\"example\":false},\"hot_fix\":{\"type\":\"object\",\"description\":\"Custom pronunciation and text replacement to correct polyphonic characters, proper names, and other pronunciations\\n\\n- `pronunciation`: annotate words with pinyin (separate syllables with spaces and mark tones with digits, such as `tian1 qi4`) to override the default pronunciation\\n- `replace`: replace specified words before synthesis. Synthesis and billing use the replaced text, which must also stay within `5000` characters; exceeding the limit returns `400` (`prompt_too_long`)\\n\\nThe two lists may contain at most `200` entries in total, counted as key-value pairs within the objects. Exceeding the limit returns `400` (`invalid_parameter`)\\n\\nProvide at least one list. Each provided list must be a non-empty array of objects in `{\\\"word\\\": \\\"value\\\"}` form\\n\\n**Example:**\\n```json\\n{\\n \\\"pronunciation\\\": [{\\\"天气\\\": \\\"tian1 qi4\\\"}],\\n \\\"replace\\\": [{\\\"今天\\\": \\\"金天\\\"}]\\n}\\n```\",\"properties\":{\"pronunciation\":{\"type\":\"array\",\"description\":\"Custom pronunciation list; each item is an object such as `{\\\"word\\\": \\\"pinyin\\\"}`\",\"items\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"string\"}},\"example\":[{\"天气\":\"tian1 qi4\"}]},\"replace\":{\"type\":\"array\",\"description\":\"Text replacement list; each item is an object such as `{\\\"original word\\\": \\\"replacement text\\\"}`\",\"items\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"string\"}},\"example\":[{\"今天\":\"金天\"}]}}},\"enable_aigc_tag\":{\"type\":\"boolean\",\"description\":\"Embed an invisible AIGC marker in generated audio (applies to `wav` / `mp3` / `opus`)\",\"default\":false,\"example\":false}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"responseSchema\":{\"schema\":{\"$ref\":\"#/$defs/QwenAudioTtsResponse\",\"$defs\":{\"QwenAudioTtsResponse\":{\"type\":\"object\",\"properties\":{\"created\":{\"type\":\"integer\",\"description\":\"Task creation timestamp\",\"example\":1790000000},\"id\":{\"type\":\"string\",\"description\":\"Task ID\",\"example\":\"task-unified-1790000000-abcd1234\"},\"model\":{\"type\":\"string\",\"description\":\"Model actually used\",\"example\":\"qwen-audio-3.1-tts-flash\"},\"object\":{\"type\":\"string\",\"enum\":[\"audio.generation.task\"],\"description\":\"Specific task object type\"},\"progress\":{\"type\":\"integer\",\"description\":\"Task progress percentage (0–100)\",\"minimum\":0,\"maximum\":100,\"example\":0},\"status\":{\"type\":\"string\",\"description\":\"Task status\",\"enum\":[\"pending\",\"processing\",\"completed\",\"failed\"],\"example\":\"pending\"},\"task_info\":{\"$ref\":\"#/$defs/AudioTaskInfo\",\"description\":\"Audio task details\"},\"type\":{\"type\":\"string\",\"enum\":[\"audio\"],\"description\":\"Task output type\",\"example\":\"audio\"},\"usage\":{\"$ref\":\"#/$defs/AudioUsage\",\"description\":\"Usage and billing information\"}}},\"AudioTaskInfo\":{\"type\":\"object\",\"properties\":{\"estimated_time\":{\"type\":\"integer\",\"description\":\"Estimated completion time in seconds; increases with text length, up to about `90` seconds\",\"minimum\":0,\"example\":3},\"audio_type\":{\"type\":\"string\",\"description\":\"Audio task type\",\"example\":\"tts\"}}},\"AudioUsage\":{\"type\":\"object\",\"description\":\"Usage information\",\"properties\":{\"credits_reserved\":{\"type\":\"number\",\"description\":\"Credits reserved based on text length; settled against actual token usage on completion, with excess refunded or shortfall charged\",\"minimum\":0,\"example\":0.0144}}}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"example\":{\"prompt\":\"我家的后面有一个很大的花园。\"}},\"veo-3.1-lite-generate-preview\":{\"model\":\"veo-3.1-lite-generate-preview\",\"kind\":\"video\",\"path\":\"/v1/videos/generations\",\"title\":\"Veo-3.1-Lite-Generate-Preview API\",\"docs\":\"https://evolink.ai/docs/en/api-manual/video-series/veo3.1/veo-3.1-lite-generate-preview-generate\",\"required\":[\"prompt\"],\"params\":{\"prompt\":{\"type\":\"string\",\"description\":\"Prompt describing the video, up to 2000 tokens. Counted with cl100k; tokens are not characters. Google lists English as the supported prompt language. EvoLink does not reject requests based on prompt language; results in other languages are not guaranteed.\",\"required\":true},\"image_urls\":{\"type\":\"array\",\"description\":\"Input image URLs for image-to-video Notes: Up to 2 images per request: 1 image is used as the first frame, 2 images are used as the first and last frames; Image size: no larger than 10 MB; Supported file formats: .jpg, .jpeg, .png\",\"maxItems\":2,\"items\":{\"type\":\"string\",\"format\":\"uri\"}},\"generation_type\":{\"type\":\"string\",\"description\":\"Generation mode. When omitted it is inferred from the number of images: TEXT: Text-to-video (input images, if any, are not used); FIRST&LAST: First-last frame, 1-2 images REFERENCE (reference images) is not supported by this model and returns 400\",\"enum\":[\"TEXT\",\"FIRST&LAST\"]},\"aspect_ratio\":{\"type\":\"string\",\"description\":\"Video aspect ratio. auto is the same as omitting aspect_ratio: no ratio is specified and the model decides\",\"enum\":[\"auto\",\"16:9\",\"9:16\"]},\"generate_audio\":{\"type\":\"boolean\",\"description\":\"Whether to generate audio, default true. Generating audio increases the per-second rate\",\"default\":true},\"duration\":{\"type\":\"integer\",\"description\":\"Video duration in seconds, default 4. Longer videos cost more\",\"enum\":[4,6,8],\"default\":4},\"n\":{\"type\":\"integer\",\"description\":\"Number of videos to generate, default 1. Each video is billed separately\",\"default\":1,\"minimum\":1,\"maximum\":4},\"quality\":{\"type\":\"string\",\"description\":\"Output resolution, default 720p. 1080p has a higher per-second rate; 4k is not supported by this model\",\"enum\":[\"720p\",\"1080p\"],\"default\":\"720p\"},\"seed\":{\"type\":\"integer\",\"description\":\"Random seed used to reproduce generation results\",\"minimum\":1,\"maximum\":4294967295},\"negative_prompt\":{\"type\":\"string\",\"description\":\"Negative prompt describing content to exclude from the video\"},\"person_generation\":{\"type\":\"string\",\"description\":\"Person generation control. When omitted, the upstream default is allow_adult. allow_adult: allow adults only; dont_allow: do not generate videos containing people or faces\",\"enum\":[\"allow_adult\",\"dont_allow\"]},\"resize_mode\":{\"type\":\"string\",\"description\":\"Image resize mode for image-to-video. When omitted, the upstream default is pad. pad: add padding to fit the output aspect ratio; crop: center-crop to fit the output aspect ratio. Requires an input image; providing this parameter without an image returns 400\",\"enum\":[\"pad\",\"crop\"]}},\"inputSchema\":{\"schema\":{\"type\":\"object\",\"required\":[\"prompt\"],\"properties\":{\"prompt\":{\"type\":\"string\",\"description\":\"Prompt describing the video, up to `2000` tokens. Counted with cl100k; tokens are not characters. Google lists English as the supported prompt language. EvoLink does not reject requests based on prompt language; results in other languages are not guaranteed.\",\"example\":\"A golden retriever puppy running through a sunlit meadow, slow motion, cinematic lighting\"},\"image_urls\":{\"type\":\"array\",\"description\":\"Input image URLs for image-to-video\\n\\n**Notes:**\\n- Up to `2` images per request: `1` image is used as the first frame, `2` images are used as the first and last frames\\n- Image size: no larger than `10 MB`\\n- Supported file formats: `.jpg`, `.jpeg`, `.png`\",\"items\":{\"type\":\"string\",\"format\":\"uri\"},\"maxItems\":2,\"example\":[\"https://example.com/first-frame.jpg\"]},\"generation_type\":{\"type\":\"string\",\"description\":\"Generation mode. When omitted it is inferred from the number of images:\\n- `TEXT`: Text-to-video (input images, if any, are not used)\\n- `FIRST&LAST`: First-last frame, 1-2 images\\n\\n`REFERENCE` (reference images) is not supported by this model and returns `400`\",\"enum\":[\"TEXT\",\"FIRST&LAST\"]},\"aspect_ratio\":{\"type\":\"string\",\"description\":\"Video aspect ratio. `auto` is the same as omitting `aspect_ratio`: no ratio is specified and the model decides\",\"enum\":[\"auto\",\"16:9\",\"9:16\"]},\"generate_audio\":{\"type\":\"boolean\",\"description\":\"Whether to generate audio, default `true`. Generating audio increases the per-second rate\",\"default\":true},\"duration\":{\"type\":\"integer\",\"description\":\"Video duration in seconds, default `4`. Longer videos cost more\",\"enum\":[4,6,8],\"default\":4},\"n\":{\"type\":\"integer\",\"description\":\"Number of videos to generate, default `1`. Each video is billed separately\",\"minimum\":1,\"maximum\":4,\"default\":1},\"quality\":{\"type\":\"string\",\"description\":\"Output resolution, default `720p`. `1080p` has a higher per-second rate; `4k` is not supported by this model\",\"enum\":[\"720p\",\"1080p\"],\"default\":\"720p\"},\"seed\":{\"type\":\"integer\",\"description\":\"Random seed used to reproduce generation results\",\"minimum\":1,\"maximum\":4294967295},\"negative_prompt\":{\"type\":\"string\",\"description\":\"Negative prompt describing content to exclude from the video\"},\"person_generation\":{\"type\":\"string\",\"description\":\"Person generation control. When omitted, the upstream default is `allow_adult`. `allow_adult`: allow adults only; `dont_allow`: do not generate videos containing people or faces\",\"enum\":[\"allow_adult\",\"dont_allow\"]},\"resize_mode\":{\"type\":\"string\",\"description\":\"Image resize mode for image-to-video. When omitted, the upstream default is `pad`. `pad`: add padding to fit the output aspect ratio; `crop`: center-crop to fit the output aspect ratio. Requires an input image; providing this parameter without an image returns `400`\",\"enum\":[\"pad\",\"crop\"]}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"responseSchema\":{\"schema\":{\"$ref\":\"#/$defs/VideoGenerationResponse\",\"$defs\":{\"VideoGenerationResponse\":{\"type\":\"object\",\"properties\":{\"created\":{\"type\":\"integer\",\"description\":\"Task creation timestamp\",\"example\":1757169743},\"id\":{\"type\":\"string\",\"description\":\"Task ID\",\"example\":\"task-unified-1757169743-7cvnl5zw\"},\"model\":{\"type\":\"string\",\"description\":\"Actual model name used\",\"example\":\"veo-3.1-lite-generate-preview\"},\"object\":{\"type\":\"string\",\"enum\":[\"video.generation.task\"],\"description\":\"Specific type of the task\"},\"progress\":{\"type\":\"integer\",\"description\":\"Task progress percentage (0-100)\",\"minimum\":0,\"maximum\":100,\"example\":0},\"status\":{\"type\":\"string\",\"description\":\"Task status\",\"enum\":[\"pending\",\"processing\",\"completed\",\"failed\"],\"example\":\"processing\"},\"task_info\":{\"$ref\":\"#/$defs/VideoTaskInfo\",\"description\":\"Video task details\"},\"type\":{\"type\":\"string\",\"enum\":[\"text\",\"image\",\"audio\",\"video\"],\"description\":\"Output type of the task\",\"example\":\"video\"},\"usage\":{\"$ref\":\"#/$defs/VideoUsage\",\"description\":\"Usage and billing information\"}}},\"VideoTaskInfo\":{\"type\":\"object\",\"properties\":{\"estimated_time\":{\"type\":\"integer\",\"description\":\"Estimated completion time (seconds)\",\"minimum\":0,\"example\":600},\"video_duration\":{\"type\":\"integer\",\"description\":\"Video duration (seconds)\",\"example\":4}}},\"VideoUsage\":{\"type\":\"object\",\"description\":\"Usage and billing information\",\"properties\":{\"billing_rule\":{\"type\":\"string\",\"description\":\"Billing rule\",\"enum\":[\"per_call\",\"per_token\",\"per_second\"],\"example\":\"per_call\"},\"credits_reserved\":{\"type\":\"number\",\"description\":\"Estimated credits consumed\",\"minimum\":0,\"example\":12.24},\"user_group\":{\"type\":\"string\",\"description\":\"User group category\",\"example\":\"default\"}}}}},\"unresolved_refs\":false,\"dialect\":\"3.1.0\"},\"example\":{\"prompt\":\"A golden retriever puppy running through a sunlit meadow, slow motion, cinematic lighting\"}}}}";
@@ -14,7 +14,7 @@ export function registerPlatformOperations(registry, config) {
14
14
  registerSearchModels(registry, config);
15
15
  registerDiscovery(registry, config);
16
16
  registerGetModel(registry, config);
17
- registerPricingRules(registry);
17
+ registerPricingRules(registry, config);
18
18
  registerEstimateCost(registry, config);
19
19
  registerGenerateTools(registry, config);
20
20
  registerGetTask(registry, config);
@@ -4,10 +4,18 @@ import { controlBaseURL } from './pricing-client.js';
4
4
  import { DEFAULT_READ_TIMEOUT_MS, evoHeaders, fetchWithTimeout, readJsonBody, timeoutFromEnv } from './http-policy.js';
5
5
  const catalogs = new Map();
6
6
  const healths = new Map();
7
+ /** While the platform limits catalog requests, a catalog or availability list read this recently is used again. */
8
+ const LIMITED_REUSE_MS = 10 * 60_000;
9
+ class CatalogLimitedError extends Error {
10
+ }
7
11
  async function read(path) {
8
12
  const response = await fetchWithTimeout(`${controlBaseURL()}${path}`, {
9
13
  method: 'GET', headers: { Accept: 'application/json', ...evoHeaders('model_catalog') },
10
14
  }, timeoutFromEnv('EVOLINK_MCP_READ_TIMEOUT_MS', DEFAULT_READ_TIMEOUT_MS));
15
+ if (response.status === 429) {
16
+ await response.body?.cancel();
17
+ throw new CatalogLimitedError('The current model catalog is unavailable; try again before selecting or submitting a model.');
18
+ }
11
19
  const body = await readJsonBody(response);
12
20
  if (!response.ok || !Array.isArray(body.models))
13
21
  throw new Error('The current model catalog is unavailable; try again before selecting or submitting a model.');
@@ -17,11 +25,21 @@ export async function currentModels() {
17
25
  const now = Date.now();
18
26
  const key = controlBaseURL();
19
27
  const catalog = catalogs.get(key), health = healths.get(key);
28
+ // A stale availability list can only let through a model the gateway then refuses; it never changes a price.
29
+ const reusable = (cached, error) => error instanceof CatalogLimitedError && cached !== undefined && now - cached.fetchedAt < LIMITED_REUSE_MS;
20
30
  const [models, available] = await Promise.all([
21
31
  (async () => {
22
32
  if (catalog && now - catalog.fetchedAt < 5 * 60_000)
23
33
  return catalog.models;
24
- const body = await read('/v1/catalog/models');
34
+ let body;
35
+ try {
36
+ body = await read('/v1/catalog/models');
37
+ }
38
+ catch (error) {
39
+ if (reusable(catalog, error))
40
+ return catalog.models;
41
+ throw error;
42
+ }
25
43
  const models = body.models.filter(model => typeof model.model_id === 'string'
26
44
  && Array.isArray(model.aliases) && Array.isArray(model.capabilities) && Array.isArray(model.protocols));
27
45
  catalogs.set(key, { models, fetchedAt: now });
@@ -30,7 +48,15 @@ export async function currentModels() {
30
48
  (async () => {
31
49
  if (health && now - health.fetchedAt < 30_000)
32
50
  return health.available;
33
- const body = await read('/v1/catalog/health');
51
+ let body;
52
+ try {
53
+ body = await read('/v1/catalog/health');
54
+ }
55
+ catch (error) {
56
+ if (reusable(health, error))
57
+ return health.available;
58
+ throw error;
59
+ }
34
60
  const available = new Set(body.models
35
61
  .filter(model => typeof model.model_id === 'string' && model.status === 'available').map(model => model.model_id.toLowerCase()));
36
62
  healths.set(key, { available, fetchedAt: now });
@@ -0,0 +1,18 @@
1
+ // Copyright 2024 EvoLink AI. SPDX-License-Identifier: Apache-2.0
2
+ // Generated from Evolink-AI/evolink-mcp; adapted for direct REST operations. See platform/LICENSE and platform/NOTICE.
3
+ // The gateway decides whether a Midjourney V7 edit is promptless after removing controlled parameters
4
+ // (provider SDK EffectiveMJV7EditPrompt, which wraps cleanRemixPrompt in provider/client_youchuan.go).
5
+ // These patterns keep the SDK's boundaries: RE2 \s is ASCII only, (?i) folds the long s (U+017F) with s, and Go's
6
+ // strings.TrimSpace removes NEL but not BOM, unlike String.prototype.trim.
7
+ const space = '[\\t\\n\\f\\r ]';
8
+ const nonSpace = '[^\\t\\n\\f\\r ]';
9
+ const fold = (words) => words.replace(/s/g, '[s\u017f]');
10
+ const forbidden = new RegExp(`${space}*--(${fold('version|v')})${space}*${nonSpace}+|${space}*--niji(?:${space}+\\d+)?\\b`, 'gi');
11
+ const billing = new RegExp(`${space}*--(${fold('fast|turbo|draft|relax')})\\b`, 'gi');
12
+ const unsupportedArgs = new RegExp(`${space}*--(${fold('stop|cref|cw|repeat|r|personalize|p')})\\b(?:${space}+${nonSpace}+)?`, 'gi');
13
+ const unsupportedFlags = new RegExp(`${space}*--(${fold('stealth|public')})\\b`, 'gi');
14
+ const goTrimSpace = /^[\u0009-\u000d\u0020\u0085\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]+|[\u0009-\u000d\u0020\u0085\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]+$/g;
15
+ /** The prompt text a Midjourney V7 edit keeps; an empty result runs and bills the edit as fast. */
16
+ export function effectiveMjV7EditPrompt(prompt) {
17
+ return prompt.replace(forbidden, '').replace(billing, '').replace(unsupportedArgs, '').replace(unsupportedFlags, '').replace(goTrimSpace, '');
18
+ }
@@ -7,7 +7,8 @@ export function referenceInputs(spec) {
7
7
  const result = [];
8
8
  for (const [parameter, value] of Object.entries(spec.params)) {
9
9
  let kind;
10
- if (/^(?:.*_)?image_urls?$|^(?:images|image|input_image|first_frame|last_frame)$/.test(parameter))
10
+ // Kling 4.0 and MiniMax H3 take first and last frames as image_start / image_end, and Kling 4.0 middle frames as keyframes.
11
+ if (/^(?:.*_)?image_urls?$|^(?:images|image|input_image|first_frame|last_frame|image_start|image_end|keyframes)$/.test(parameter))
11
12
  kind = 'image';
12
13
  else if (/^(?:.*_)?video_urls?$|^videos$/.test(parameter))
13
14
  kind = 'video';
@@ -0,0 +1,40 @@
1
+ // Copyright 2024 EvoLink AI. SPDX-License-Identifier: Apache-2.0
2
+ // Generated from Evolink-AI/evolink-mcp; adapted for direct REST operations. See platform/LICENSE and platform/NOTICE.
3
+ import { currentRequestCredentials } from '../request-context.js';
4
+ const WINDOW_MS = 60_000;
5
+ const MAX_KEYS = 10_000;
6
+ const calls = new Map();
7
+ let clock = () => Date.now();
8
+ /**
9
+ * Price checks (estimate_cost, get_pricing_rules) each signed-in account may make per minute, per tool. The hosted
10
+ * service reaches the platform's per-IP catalog limit from one address for everyone, so one busy assistant must not
11
+ * use it up. A local server serves one user and is not limited here. EVOLINK_MCP_PRICING_CALLS_PER_MINUTE changes
12
+ * the number; 0 turns the limit off.
13
+ */
14
+ export function pricingCallsPerMinute() {
15
+ const raw = process.env.EVOLINK_MCP_PRICING_CALLS_PER_MINUTE;
16
+ const value = raw === undefined || raw.trim() === '' ? 30 : Number(raw);
17
+ return Number.isInteger(value) && value >= 0 && value <= 100_000 ? value : 30;
18
+ }
19
+ /** Counts one call. An account already at its limit is not counted; the result says when its oldest call leaves the window. */
20
+ export function pricingCallLimitReached(tool) {
21
+ const owner = currentRequestCredentials()?.uploadOwner, limit = pricingCallsPerMinute();
22
+ if (!owner || limit === 0)
23
+ return undefined;
24
+ const key = `${tool} ${owner}`, now = clock();
25
+ const recent = (calls.get(key) ?? []).filter(at => now - at < WINDOW_MS);
26
+ calls.delete(key);
27
+ if (recent.length >= limit) {
28
+ calls.set(key, recent);
29
+ return { limit, retryAfterSeconds: Math.max(1, Math.ceil((recent[0] + WINDOW_MS - now) / 1000)) };
30
+ }
31
+ calls.set(key, [...recent, now]);
32
+ // The least recently used account leaves first once the map is full.
33
+ if (calls.size > MAX_KEYS)
34
+ calls.delete(calls.keys().next().value);
35
+ return undefined;
36
+ }
37
+ export function resetPricingCallsForTests(now) {
38
+ calls.clear();
39
+ clock = now ?? (() => Date.now());
40
+ }
@@ -0,0 +1,59 @@
1
+ // Copyright 2024 EvoLink AI. SPDX-License-Identifier: Apache-2.0
2
+ // Generated from Evolink-AI/evolink-mcp; adapted for direct REST operations. See platform/LICENSE and platform/NOTICE.
3
+ // Rule parameters the gateway derives from differently named request fields. Each mapping mirrors the gateway's
4
+ // pre-deduction code (GroAPI feat/task-microservice-split); without it the published default quotes the cheaper case.
5
+ const proTiers = { '1K': '1K', '1.5K': '1.5K', '2K': '2K' };
6
+ const proTier = (value) => typeof value === 'string' ? proTiers[value.trim().toUpperCase()] : undefined;
7
+ // service/multi_sku_billing_service.go seedDreamProOutputTierThresholdPixels. Every 1K and 1.5K ratio preset is
8
+ // below it and every 2K preset above it, so a ratio follows quality.
9
+ const SEEDREAM_PRO_2K_PIXELS = 2_610_000;
10
+ /** controller preprocessSeedream5ProParams, then service ResolveSeedDreamProOutput. */
11
+ function seedreamProTier(input) {
12
+ const size = typeof input.size === 'string' ? input.size.trim() : '';
13
+ if (size === '' || size === 'auto' || size.includes(':'))
14
+ return proTier(input.quality) ?? '1K';
15
+ const named = proTier(size);
16
+ if (named)
17
+ return named;
18
+ const pixels = /^(\d+)\s*x\s*(\d+)$/.exec(size.toLowerCase().replace(/\u00d7/g, 'x'));
19
+ return pixels && Number(pixels[1]) * Number(pixels[2]) > SEEDREAM_PRO_2K_PIXELS ? '2K' : '1K';
20
+ }
21
+ /** service/minimax_h3_models.go MiniMaxH3CountInputImages: first frame, last frame and references all count. */
22
+ function inputImageCount(input) {
23
+ const filled = (value) => typeof value === 'string' && value.trim() !== '';
24
+ return ['image_start', 'image_end'].filter(key => filled(input[key])).length
25
+ + (Array.isArray(input.image_urls) ? input.image_urls.filter(filled).length : 0);
26
+ }
27
+ const derived = {
28
+ 'doubao-seedream-5.0-pro output_images_2k': input => seedreamProTier(input) === '2K' ? 1 : 0,
29
+ 'doubao-seedream-5.0-pro output_images_standard': input => seedreamProTier(input) === '2K' ? 0 : 1,
30
+ 'minimax-h3-reference-to-video image_count': inputImageCount,
31
+ 'minimax-h3-max-reference-to-video image_count': inputImageCount,
32
+ // service/tencent_video_upscale.go: the output keeps the source frame rate up to max_fps (120 when unset),
33
+ // so only a 30 fps cap fixes the price tier before the source is measured.
34
+ 'tencent-video-upscale output_fps': (_input, modelParams) => String(modelParams.max_fps).trim() === '30' ? 30 : undefined,
35
+ };
36
+ /** Keys ("model parameter") the generation input decides; a different pricing_parameters value conflicts. */
37
+ export const DERIVED_QUOTE_PARAMETERS = new Set(Object.keys(derived));
38
+ export function derivedQuoteParameter(model, name, input, modelParams) {
39
+ return derived[`${model.toLowerCase()} ${name}`]?.(input, modelParams);
40
+ }
41
+ /** Settings the generation input cannot carry: without measured usage the higher-priced value is quoted. */
42
+ export const CONSERVATIVE_QUOTE_PARAMETERS = {
43
+ // controller/unified_videos.go rejects content_filter on a draft conversion; the draft's own setting is kept.
44
+ 'seedance-2.5-draft-to-video content_filter': { value: false,
45
+ note: 'Assumes the source draft was generated without the content filter (10% more); if it kept the default content_filter=true, pass pricing_parameters.content_filter=true.' },
46
+ };
47
+ /**
48
+ * A documented setting value that stands for the rule's own default. Kling 4.0 video edit documents duration "auto"
49
+ * (as long as the input video); its rule reads duration_seconds 0 as the input length.
50
+ */
51
+ const RULE_DEFAULT_WORDS = { 'kling-v4-video-edit duration_seconds': 'auto' };
52
+ export function isRuleDefaultWord(model, name, value) {
53
+ const word = RULE_DEFAULT_WORDS[`${model.toLowerCase()} ${name}`];
54
+ return word !== undefined && typeof value === 'string' && value.trim().toLowerCase() === word;
55
+ }
56
+ /** Usage the request cannot state: quoting it needs pricing_parameters unless a mapping above fixes it. */
57
+ export function derivedUsage(model, name) {
58
+ return model.toLowerCase() === 'tencent-video-upscale' && name === 'output_fps';
59
+ }
@@ -6,6 +6,8 @@ import { requestAccountQuote } from './api-client.js';
6
6
  import { getPricingRules, PricingMoney } from './pricing-rules-client.js';
7
7
  import { isSeedanceGeneration } from './seedance-input.js';
8
8
  import { searchUsage } from './search-usage.js';
9
+ import { effectiveMjV7EditPrompt } from './mj-prompt.js';
10
+ import { CONSERVATIVE_QUOTE_PARAMETERS, derivedQuoteParameter, derivedUsage, isRuleDefaultWord } from './pricing-derived.js';
9
11
  const decimal = z.string().max(64).regex(/^(?:0|[1-9]\d*)(?:\.\d+)?$/);
10
12
  const identifier = z.string().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/);
11
13
  const rational = z.string().max(128).regex(/^(?:0|[1-9]\d*)(?:\.\d+|\/[1-9]\d*)?$/);
@@ -51,6 +53,8 @@ function fail(code, message, param) { throw new QuoteError(code, message, param)
51
53
  const aliases = { duration_seconds: ['duration'], output_seconds: ['duration'], image_count: ['n', 'count'],
52
54
  video_count: ['n', 'count'], resolution: ['quality'], quality: ['resolution'] };
53
55
  const measured = /(?:tokens|input_seconds|output_seconds|source_output_seconds|first_input_video_seconds|search_count)$/;
56
+ /** A rule parameter that measures usage (tokens, seconds, searches, a derived rate) rather than a setting. */
57
+ export const isUsageParameter = (model, name) => measured.test(name) || derivedUsage(model, name);
54
58
  /** Map only declared billing parameters. Prompts and asset URLs stay in generation input. */
55
59
  export function prepareQuoteParameters(rule, entry, input, pricingParameters = {}, mediaSeconds, allowMissingUsage = false) {
56
60
  const declared = new Map((rule.parameters ?? []).map(p => [p.name, p]));
@@ -60,17 +64,34 @@ export function prepareQuoteParameters(rule, entry, input, pricingParameters = {
60
64
  }
61
65
  const parameters = {};
62
66
  const searches = searchUsage(entry, input);
67
+ // Midjourney documents speed and upscale type inside model_params. A setting is read there only where the
68
+ // documentation puts it, so another model's model_params never changes its price.
69
+ const nestedSpec = entry.spec?.params.model_params?.properties ?? {};
70
+ const nestedInput = input.model_params && typeof input.model_params === 'object' && !Array.isArray(input.model_params)
71
+ ? input.model_params : {};
72
+ const documented = (key) => entry.spec?.params[key] ?? nestedSpec[key];
73
+ const given = (key) => input[key] !== undefined ? input[key] : nestedSpec[key] ? nestedInput[key] : undefined;
74
+ const model = entry.id ?? '';
75
+ const usage = (key) => isUsageParameter(model, key);
63
76
  for (const [name, p] of declared) {
64
77
  const search = searches.find(item => item.parameter === name);
65
78
  // A declared duration and duration_seconds have different meanings (smart duration).
66
79
  // Video edit's duration=-1 is an operation setting, never expected output seconds.
67
80
  const expectedEditDuration = name === 'duration_seconds' && entry.id === 'seedance-2.5-video-edit' && isSeedanceGeneration(entry);
68
81
  const generationNames = [name, ...(aliases[name] ?? []).filter(alias => !declared.has(alias) && !(expectedEditDuration && alias === 'duration'))];
69
- const supplied = generationNames.filter(key => input[key] !== undefined).map(key => input[key]);
82
+ // A documented word for the rule's own default (Kling 4.0 edit duration "auto") prices as that default.
83
+ const asRule = (value) => isRuleDefaultWord(model, name, value) ? p.default ?? value : value;
84
+ const supplied = generationNames.map(given).filter(value => value !== undefined).map(asRule);
70
85
  if (supplied.some(value => String(value) !== String(supplied[0]))) {
71
86
  fail('conflicting_quote_parameter', `Conflicting generation values for ${name}.`, name);
72
87
  }
73
88
  let value = supplied[0];
89
+ // A promptless Midjourney V7 edit runs and bills as fast whatever speed was requested.
90
+ if (value === undefined && name === 'prompt_present')
91
+ value = typeof input.prompt === 'string' && effectiveMjV7EditPrompt(input.prompt) !== '';
92
+ // Some rule parameters come from differently named request fields, as the gateway pre-deducts them.
93
+ if (value === undefined)
94
+ value = derivedQuoteParameter(model, name, input, nestedInput);
74
95
  if (value === undefined && name === 'input_images') {
75
96
  if (Array.isArray(input.image_urls))
76
97
  value = input.image_urls.length;
@@ -80,9 +101,9 @@ export function prepareQuoteParameters(rule, entry, input, pricingParameters = {
80
101
  value = 0;
81
102
  }
82
103
  // Expected usage cannot change settings or references the model will actually receive.
83
- if (value === undefined && pricingParameters[name] !== undefined && !measured.test(name)
84
- && generationNames.some(key => entry.spec?.params[key] !== undefined)) {
85
- value = generationNames.map(key => entry.spec?.params[key]?.default).find(v => v !== undefined) ?? p.default;
104
+ if (value === undefined && pricingParameters[name] !== undefined && !usage(name)
105
+ && generationNames.some(key => documented(key) !== undefined)) {
106
+ value = asRule(generationNames.map(key => documented(key)?.default).find(v => v !== undefined) ?? p.default);
86
107
  }
87
108
  if (pricingParameters[name] !== undefined) {
88
109
  if (value !== undefined && String(value) !== String(pricingParameters[name])) {
@@ -111,8 +132,8 @@ export function prepareQuoteParameters(rule, entry, input, pricingParameters = {
111
132
  continue;
112
133
  fail('quote_usage_required', `Provide expected generated ${name} in pricing_parameters.`, name);
113
134
  }
114
- if (value === undefined && !measured.test(name)) {
115
- const defaults = generationNames.map(key => entry.spec?.params[key]?.default).filter(v => v !== undefined);
135
+ if (value === undefined && !usage(name)) {
136
+ const defaults = generationNames.map(key => documented(key)?.default).filter(v => v !== undefined).map(asRule);
116
137
  value = defaults[0];
117
138
  }
118
139
  const references = Array.isArray(input.video_urls) && input.video_urls.length > 0
@@ -122,11 +143,13 @@ export function prepareQuoteParameters(rule, entry, input, pricingParameters = {
122
143
  // The rules evaluator separately records the missing actual/expected search count.
123
144
  if (value === undefined && search?.enabled && allowMissingUsage)
124
145
  value = '0';
125
- if (value === undefined && measured.test(name) && (p.required || references || /tokens$/.test(name) || search?.enabled || (name === 'search_count' && input.web_search === true) || p.default === undefined)) {
146
+ if (value === undefined && usage(name) && (p.required || references || /tokens$/.test(name) || search?.enabled || (name === 'search_count' && input.web_search === true) || p.default === undefined)) {
126
147
  if (allowMissingUsage)
127
148
  continue;
128
149
  fail('quote_usage_required', `Provide measured or expected usage for ${name} in pricing_parameters.`, name);
129
150
  }
151
+ if (value === undefined)
152
+ value = CONSERVATIVE_QUOTE_PARAMETERS[`${model.toLowerCase()} ${name}`]?.value;
130
153
  if (value === undefined)
131
154
  value = p.default;
132
155
  if (value === undefined) {