{
  "openapi": "3.1.0",
  "info": {
    "title": "TokenLab AI Gateway",
    "description": "TokenLab public AI API: model discovery, generation, files, cached content, asynchronous tasks, and management-token account reporting.",
    "version": "1.0.0",
    "termsOfService": "https://tokenlab.sh/tos",
    "contact": {
      "name": "Technical Support",
      "email": "hello@tokenlab.sh"
    }
  },
  "servers": [
    {
      "url": "https://api.tokenlab.sh",
      "description": "Production server"
    }
  ],
  "tags": [
    {
      "name": "Chat",
      "description": "Chat completions API (OpenAI-compatible)"
    },
    {
      "name": "Responses",
      "description": "OpenAI Responses API-compatible native endpoints"
    },
    {
      "name": "Embeddings",
      "description": "Text embeddings API"
    },
    {
      "name": "Images",
      "description": "Image generation API"
    },
    {
      "name": "Audio",
      "description": "Audio processing API (TTS & STT)"
    },
    {
      "name": "Video",
      "description": "Video generation API"
    },
    {
      "name": "Models",
      "description": "Available models listing"
    },
    {
      "name": "Anthropic",
      "description": "Anthropic-compatible Messages API"
    },
    {
      "name": "Gemini",
      "description": "Google Gemini-compatible API"
    },
    {
      "name": "Management",
      "description": "Organization API key management and key-level usage/billing via management token"
    },
    {
      "name": "Files",
      "description": "Batch file upload and retrieval"
    },
    {
      "name": "Batches",
      "description": "OpenAI-compatible asynchronous batch jobs"
    },
    {
      "name": "Seedance Volc Compatible",
      "description": "Seedance 2.0 Volc-style compatibility endpoints"
    },
    {
      "name": "Decisions"
    },
    {
      "name": "Webhooks",
      "description": "Workspace webhook management with Management Tokens (mt-...). Inference API keys do not grant management access."
    },
    {
      "name": "Gemini Resources",
      "description": "Workspace-owned Gemini files, uploads, and cached content"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Create chat completion",
        "description": "Creates a model response from a Chat Completions request. Supported request formats are listed in each model’s details. Unknown fields are accepted on a best-effort basis; model-specific support is not guaranteed.",
        "operationId": "createChatCompletion",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              },
              "examples": {
                "basic": {
                  "summary": "Basic chat completion",
                  "value": {
                    "model": "gpt-4o",
                    "messages": [
                      {
                        "role": "system",
                        "content": "You are a helpful assistant."
                      },
                      {
                        "role": "user",
                        "content": "Hello!"
                      }
                    ]
                  }
                },
                "streaming": {
                  "summary": "Streaming response",
                  "value": {
                    "model": "gpt-4o",
                    "messages": [
                      {
                        "role": "user",
                        "content": "Tell me a story"
                      }
                    ],
                    "stream": true
                  }
                },
                "function_calling": {
                  "summary": "Function calling",
                  "value": {
                    "model": "gpt-4o",
                    "messages": [
                      {
                        "role": "user",
                        "content": "What's the weather in Tokyo?"
                      }
                    ],
                    "tools": [
                      {
                        "type": "function",
                        "function": {
                          "name": "get_weather",
                          "description": "Get weather for a location",
                          "parameters": {
                            "type": "object",
                            "properties": {
                              "location": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "location"
                            ]
                          }
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-Sent Events stream with JSON chunks"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeySync"
          }
        ]
      }
    },
    "/v1/embeddings": {
      "post": {
        "tags": [
          "Embeddings"
        ],
        "summary": "Create embeddings",
        "description": "Creates embedding vectors for text or token input. Use a model whose details list the `embedding` or `text-embedding` operation; models that list `multimodal-embedding` use `POST /v1/multimodal/embeddings`. Limits on items and tokens depend on the model.",
        "operationId": "createEmbedding",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingRequest"
              },
              "examples": {
                "single": {
                  "summary": "Single text embedding",
                  "value": {
                    "model": "text-embedding-3-small",
                    "input": "The quick brown fox jumps over the lazy dog"
                  }
                },
                "batch": {
                  "summary": "Batch embeddings",
                  "value": {
                    "model": "text-embedding-3-small",
                    "input": [
                      "Hello world",
                      "How are you?"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbeddingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          }
        ]
      }
    },
    "/v1/multimodal/embeddings": {
      "post": {
        "tags": [
          "Embeddings"
        ],
        "summary": "Create multimodal embeddings",
        "description": "Creates embeddings for multimodal input items with a model that lists the `multimodal-embedding` operation. Only text input is active; a request with an image returns 400 `image_input_deferred`.",
        "operationId": "createMultimodalEmbedding",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MultimodalEmbeddingRequest"
              },
              "examples": {
                "text": {
                  "summary": "Text input",
                  "value": {
                    "model": "qwen3-vl-embedding",
                    "input": {
                      "text": "Describe this product for semantic search."
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MultimodalEmbeddingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          }
        ]
      }
    },
    "/v1/images/generations": {
      "post": {
        "tags": [
          "Images"
        ],
        "summary": "Create image",
        "description": "Creates an image given a prompt.",
        "operationId": "createImage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageGenerationRequest"
              },
              "examples": {
                "basic": {
                  "summary": "Basic image generation",
                  "value": {
                    "model": "gpt-image-2",
                    "prompt": "A white cat sitting on a rainy windowsill",
                    "size": "1024x1024",
                    "quality": "auto"
                  }
                },
                "high_quality": {
                  "summary": "High quality image",
                  "value": {
                    "model": "gpt-image-2",
                    "prompt": "A cinematic product photo of matte black headphones on a glass desk",
                    "size": "1536x1024",
                    "quality": "high"
                  }
                }
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ImageGenerationMultipartRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageGenerationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyImage"
          }
        ]
      }
    },
    "/v1/images/{id}": {
      "get": {
        "tags": [
          "Images"
        ],
        "summary": "Get image task status",
        "description": "Compatibility alias for polling public async image task IDs such as `ldtask_...`. Prefer the `poll_url` returned by create responses, or use `/v1/tasks/{id}` as the canonical fixed status endpoint. This route uses the same authorization, ownership checks, billing headers, terminal snapshots, and response shape as the image-specific status handler.",
        "operationId": "getImageTaskStatusAlias",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The public async image task ID returned by `id` / `task_id`, or embedded in `poll_url`.",
            "schema": {
              "type": "string",
              "pattern": "^ldtask_[0-9a-fA-F]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Image task status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "task_id": {
                      "type": "string"
                    },
                    "poll_url": {
                      "type": "string"
                    },
                    "created": {
                      "type": "integer"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "completed",
                        "failed"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "additionalProperties": true
                        }
                      ]
                    },
                    "error_details": {
                      "$ref": "#/components/schemas/AsyncTaskErrorDetails"
                    },
                    "media_retention": {
                      "$ref": "#/components/schemas/MediaRetention"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Task not available to the current API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Task not found or no longer available",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/audio/speech": {
      "post": {
        "tags": [
          "Audio"
        ],
        "summary": "Create speech",
        "description": "Generates audio from the input text (Text-to-Speech).",
        "operationId": "createSpeech",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AudioSpeechRequest"
              },
              "examples": {
                "basic": {
                  "summary": "Basic TTS",
                  "value": {
                    "model": "grok-tts",
                    "input": "Hello, welcome to TokenLab!",
                    "voice": "eve"
                  }
                },
                "voice_and_speed": {
                  "summary": "Voice and speed",
                  "value": {
                    "model": "qwen3-tts-flash",
                    "input": "This is a speech synthesis example.",
                    "voice": "Cherry",
                    "response_format": "wav",
                    "speed": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Audio file",
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "audio/opus": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "audio/aac": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "audio/flac": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          }
        ]
      }
    },
    "/v1/audio/transcriptions": {
      "post": {
        "tags": [
          "Audio"
        ],
        "summary": "Create transcription",
        "description": "Transcribes audio into text (Speech-to-Text).",
        "operationId": "createTranscription",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AudioTranscriptionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioTranscriptionResponse"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          }
        ]
      }
    },
    "/v1/videos/generations": {
      "post": {
        "tags": [
          "Video"
        ],
        "summary": "Create video generation task",
        "description": "Creates an asynchronous video generation task. The response returns the task ID (`id` and `task_id`) and a `poll_url`; poll `GET /v1/tasks/{id}` until `status` is `completed` or `failed`, then read `video_url`. The accepted operations, fields, resolutions, durations and aspect ratios depend on the model; `GET /v1/models/{model}` lists them per operation.",
        "operationId": "createVideo",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoGenerationRequest"
              },
              "examples": {
                "text_to_video": {
                  "summary": "Text-to-Video",
                  "value": {
                    "model": "veo3.1",
                    "prompt": "A cinematic shot of a golden retriever running through a field of sunflowers",
                    "operation": "text-to-video",
                    "duration": 8,
                    "aspect_ratio": "16:9"
                  }
                },
                "image_to_video": {
                  "summary": "Image-to-Video",
                  "value": {
                    "model": "hailuo-2.3",
                    "prompt": "Make this image come alive with gentle movement",
                    "operation": "image-to-video",
                    "image_url": "https://example.com/image.jpg",
                    "duration": 6
                  }
                },
                "reference_to_video": {
                  "summary": "Reference-to-Video",
                  "value": {
                    "model": "veo3.1",
                    "prompt": "Keep the same subject identity and palette while adding subtle motion",
                    "operation": "reference-to-video",
                    "reference_images": [
                      "https://example.com/ref-a.jpg"
                    ],
                    "duration": 8,
                    "aspect_ratio": "9:16",
                    "resolution": "720p"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoGenerationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "description": "The `task_id` of a continuation request does not belong to your workspace (`task_not_owned`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "A Seedance material is still preparing (`seedance_material_preparing`), or the selected model cannot use the provided materials (`seedance_material_route_unavailable`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "Seedance material is still preparing. Please retry after it becomes ACTIVE.",
                    "type": "invalid_request_error",
                    "code": "seedance_material_preparing",
                    "param": "material_asset_id",
                    "inactive_asset_ids": [
                      "asset-20260720123456-abc12"
                    ]
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyTask"
          }
        ]
      }
    },
    "/v1/videos/generations/{id}": {
      "get": {
        "tags": [
          "Video"
        ],
        "summary": "Get video task status",
        "description": "Retrieves the status and result of a video generation task. This path remains for existing integrations and returns the result in the same format as `GET /v1/tasks/{id}`; new clients should poll `/v1/tasks/{id}`. A failed task is still returned with HTTP 200 and `status: failed`.",
        "operationId": "getVideoTask",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The async task ID returned by `id` / `task_id`, or embedded in `poll_url`",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Task status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTaskResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The task does not belong to your workspace (`task_not_owned`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "The task has expired or is no longer available (`async_task_not_found`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "description": "The task cannot be read at the moment; retry (`async_task_owner_unavailable`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/videos/assets": {
      "post": {
        "tags": [
          "Video"
        ],
        "summary": "Create Seedance material asset",
        "description": "Uploads one Seedance material asset URL into a TokenLab material group. Image materials must use supported dimensions; an invalid source is rejected with 400 seedance_material_source_invalid instead of remaining in PROCESSING. Real-person assets require the group_id mapped from Result.GroupId returned by GetVisualValidateResult.",
        "operationId": "createSeedanceMaterialAsset",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeedanceMaterialAssetCreateRequest"
              },
              "examples": {
                "virtual_avatar_asset": {
                  "summary": "Create a virtual-avatar material asset",
                  "value": {
                    "asset_url": "https://example.com/reference.png",
                    "asset_name": "Front view",
                    "asset_type": "Image",
                    "library_type": "aigc_avatar",
                    "group_id": "group-20260720123456-vrt01"
                  }
                },
                "real_person_asset": {
                  "summary": "Create a real-person material asset",
                  "value": {
                    "asset_url": "https://example.com/verified-person-closeup.jpg",
                    "asset_name": "Creator A close-up",
                    "asset_type": "Image",
                    "library_type": "liveness_face",
                    "group_id": "group-20260720123456-real1"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Material asset created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeedanceMaterialAsset"
                },
                "examples": {
                  "asset_created": {
                    "summary": "Material asset accepted for processing",
                    "value": {
                      "id": "asset-20260720123456-qn7wr",
                      "object": "seedance.material_asset",
                      "group_id": "group-20260720123456-vrt01",
                      "library_type": "aigc_avatar",
                      "asset_name": "Front view",
                      "asset_type": "Image",
                      "status": "PROCESSING",
                      "ready": false,
                      "error_message": null,
                      "metadata": null,
                      "created_at": 1782998400000
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "description": "Material asset mapping conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/MaterialLibraryUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "Video"
        ],
        "summary": "List Seedance material assets",
        "description": "Lists Seedance material assets owned by the authenticated organization. Use library_type, group_id, and status filters to find assets for a generation workflow.",
        "operationId": "listSeedanceMaterialAssets",
        "parameters": [
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "group_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by TokenLab material asset group id."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PROCESSING",
                "ACTIVE",
                "FAILED",
                "DELETED"
              ]
            }
          },
          {
            "name": "library_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "aigc_avatar",
                "liveness_face"
              ]
            },
            "description": "Filter by material library class."
          },
          {
            "name": "project_name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "default": "default"
            },
            "description": "Project scope for the material resource."
          }
        ],
        "responses": {
          "200": {
            "description": "Material assets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeedanceMaterialAssetList"
                },
                "examples": {
                  "assets": {
                    "summary": "Material assets",
                    "value": {
                      "assets": [
                        {
                          "id": "asset-20260720123456-qn7wr",
                          "object": "seedance.material_asset",
                          "group_id": "group-20260720123456-vrt01",
                          "library_type": "aigc_avatar",
                          "asset_name": "Front view",
                          "asset_type": "Image",
                          "status": "ACTIVE",
                          "ready": true,
                          "error_message": null,
                          "metadata": null,
                          "created_at": 1782998400000
                        }
                      ],
                      "next_page_token": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/videos/assets/{assetId}": {
      "get": {
        "tags": [
          "Video"
        ],
        "summary": "Get Seedance material asset",
        "description": "Retrieves one TokenLab Seedance material asset and its asynchronous ingestion status.",
        "operationId": "getSeedanceMaterialAsset",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "asset-20260720123456-qn7wr"
          },
          {
            "name": "project_name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "default": "default"
            },
            "description": "Project scope for the material resource."
          }
        ],
        "responses": {
          "200": {
            "description": "Material asset",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeedanceMaterialAsset"
                },
                "examples": {
                  "asset": {
                    "summary": "Material asset",
                    "value": {
                      "id": "asset-20260720123456-qn7wr",
                      "object": "seedance.material_asset",
                      "group_id": "group-20260720123456-vrt01",
                      "library_type": "aigc_avatar",
                      "asset_name": "Front view",
                      "asset_type": "Image",
                      "status": "ACTIVE",
                      "ready": true,
                      "error_message": null,
                      "metadata": null,
                      "created_at": 1782998400000
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/MaterialLibraryUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "Video"
        ],
        "operationId": "updateSeedanceMaterialAsset",
        "summary": "Update Seedance material asset",
        "description": "Updates the name or metadata of an ACTIVE Seedance material asset owned by the authenticated organization.",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "description": "TokenLab material asset ID.",
            "schema": {
              "type": "string"
            },
            "example": "asset-20260720123456-qn7wr"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeedanceMaterialAssetUpdateRequest"
              },
              "examples": {
                "update_asset": {
                  "summary": "Update asset metadata",
                  "value": {
                    "asset_name": "Front view approved",
                    "metadata": {
                      "approved_by": "creative-team"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Material asset updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeedanceMaterialAsset"
                },
                "examples": {
                  "asset_updated": {
                    "summary": "Material asset updated",
                    "value": {
                      "id": "asset-20260720123456-qn7wr",
                      "object": "seedance.material_asset",
                      "group_id": "group-20260720123456-vrt01",
                      "library_type": "aigc_avatar",
                      "asset_name": "Front view approved",
                      "asset_type": "Image",
                      "status": "ACTIVE",
                      "ready": true,
                      "error_message": null,
                      "metadata": {
                        "approved_by": "creative-team"
                      },
                      "created_at": 1782998400000
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The material asset is still processing (code seedance_material_preparing) and cannot be updated yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "The material asset failed processing and cannot be updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "Image width must be between 300px and 6000px.",
                    "type": "invalid_request_error",
                    "code": "seedance_material_source_invalid",
                    "param": "asset_url"
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/MaterialLibraryUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Video"
        ],
        "summary": "Delete Seedance material asset",
        "description": "Deletes a Seedance material asset owned by the authenticated organization.",
        "operationId": "deleteSeedanceMaterialAsset",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "asset-20260720123456-qn7wr"
          },
          {
            "name": "project_name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "default": "default"
            },
            "description": "Project scope for the material resource."
          }
        ],
        "responses": {
          "200": {
            "description": "Material asset deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeedanceMaterialAssetDeleteResponse"
                },
                "examples": {
                  "asset_deleted": {
                    "summary": "Material asset deleted",
                    "value": {
                      "deleted": true,
                      "id": "asset-20260720123456-qn7wr"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The material is still being prepared. Retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/MaterialLibraryUnavailable"
          }
        }
      }
    },
    "/v1/tasks/{id}": {
      "get": {
        "tags": [
          "Tasks"
        ],
        "summary": "Get async task status",
        "description": "Retrieves the status and result of an asynchronous generation task: image, video, music, 3D, Worlds, and asynchronous audio transcription. Prefer the `poll_url` returned by the create response; `/v1/tasks/{id}` is the canonical fixed status endpoint. A failed task still returns HTTP 200; read `status`.",
        "operationId": "getAsyncTask",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The async task ID returned by `id` / `task_id`, or embedded in `poll_url`",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Task status (task-type specific fields may be present)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "`missing_task_id` or `invalid_task_id`: the task ID is missing or not valid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`task_not_owned`: task not available to the current API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "`async_task_not_found`: the task has expired or is not available",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "description": "`async_task_owner_unavailable`: the task cannot be read right now. Retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Tasks"
        ],
        "summary": "Cancel async task",
        "description": "Cancels a queued asynchronous task when cancellation is supported for the selected task. Cancellation currently supports queued Seedance video tasks (`seedance-2.0`, `seedance-2.0-fast`, and `seedance-2.5`) while they are still waiting to run. Tasks that are already processing, completed, failed, expired, or unsupported are not cancelled.",
        "operationId": "cancelAsyncTask",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The async task ID returned by `id` / `task_id`, or embedded in `poll_url`",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Task cancelled. The task remains queryable and is represented as `failed` with `cancelled: true` for compatibility with existing async task status values.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTaskResponse"
                },
                "example": {
                  "id": "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "task_id": "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "poll_url": "/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "status": "failed",
                  "cancelled": true,
                  "cancellation_status": "cancelled",
                  "error": "Task cancelled before execution"
                }
              }
            }
          },
          "400": {
            "description": "This task does not support cancellation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Task not available to the current API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Task not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Task is no longer cancellable, for example because it is already processing or terminal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "List models",
        "description": "Lists the currently available models. Use `view=compact` for model selection and `view=full` for the existing OpenAI-compatible discovery shape. Native API calls default to `full`. Non-chat recommendations are available through `recommended_for`. No API key is needed; a valid key filters the list by its model permissions and delivery option, and an invalid key returns 401.",
        "operationId": "listModels",
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "description": "Filter by public model provider, for example openai, anthropic, google, or minimax.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "description": "Filter by a capability tag such as `reasoning`, `tool-use`, `vision`, or `text-to-image`. The values in a model's `tokenlab.capabilities` are valid tags. To filter by kind of model, use `category`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Filter by model category.",
            "schema": {
              "type": "string",
              "enum": [
                "chat",
                "embedding",
                "translation",
                "image",
                "video",
                "audio",
                "tts",
                "stt",
                "rerank",
                "3d",
                "music",
                "decision"
              ]
            }
          },
          {
            "name": "recommended_for",
            "in": "query",
            "required": false,
            "description": "Sort supported non-chat models for a task category and include recommendation evidence.",
            "schema": {
              "type": "string",
              "enum": [
                "image",
                "video",
                "music",
                "3d",
                "tts",
                "stt",
                "embedding",
                "rerank",
                "translation",
                "decision"
              ]
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "Choose compact model-selection fields or the full OpenAI-compatible list shape.",
            "schema": {
              "type": "string",
              "enum": [
                "compact",
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of models",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ModelsResponse"
                    },
                    {
                      "$ref": "#/components/schemas/CompactModelsResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/models/{model}": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "Get model",
        "description": "Retrieves current model details, including supported operations, request parameters, request endpoints, selector limits, and pricing when available. Non-chat integrations should read these current model-specific request details before creating a request. No API key is needed.",
        "operationId": "getModel",
        "security": [],
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "description": "The model ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Model information",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Model"
                }
              }
            }
          },
          "404": {
            "description": "Model not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "tags": [
          "Anthropic"
        ],
        "summary": "Create message (Anthropic-compatible)",
        "description": "Creates a model response using Anthropic's native Messages request format. Works with models whose `accepted_request_formats` lists `anthropic_messages`. Supports streaming (`stream: true`, Anthropic server-sent events). Errors use the Anthropic error format.\n\n**Authentication:** Use `x-api-key` header or `Authorization: Bearer` header. If both are sent with different values, `x-api-key` is used. The `anthropic-version` header is optional; use `2023-06-01`.",
        "operationId": "createAnthropicMessage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnthropicMessagesRequest"
              },
              "examples": {
                "basic": {
                  "summary": "Basic message",
                  "value": {
                    "model": "claude-sonnet-4-6",
                    "max_tokens": 1024,
                    "messages": [
                      {
                        "role": "user",
                        "content": "Hello, Claude!"
                      }
                    ]
                  }
                },
                "with_system": {
                  "summary": "With system prompt",
                  "value": {
                    "model": "claude-sonnet-4-6",
                    "max_tokens": 1024,
                    "system": "You are a helpful assistant.",
                    "messages": [
                      {
                        "role": "user",
                        "content": "What is 2+2?"
                      }
                    ]
                  }
                },
                "streaming": {
                  "summary": "Streaming response",
                  "value": {
                    "model": "claude-sonnet-4-6",
                    "max_tokens": 1024,
                    "stream": true,
                    "messages": [
                      {
                        "role": "user",
                        "content": "Tell me a story"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicMessagesResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Anthropic server-sent events: message_start, content_block_start, content_block_delta, content_block_stop, message_delta, and message_stop. SSE comment lines may appear while the model works. A failure after the stream has started arrives as an `event: error` event with the error body of this endpoint."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "401": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "402": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "403": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "409": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "413": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "429": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "500": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "502": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "503": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "504": {
            "$ref": "#/components/responses/AnthropicError"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeySync"
          }
        ]
      }
    },
    "/v1/messages/count_tokens": {
      "post": {
        "tags": [
          "Anthropic"
        ],
        "summary": "Count message tokens (Anthropic-compatible)",
        "description": "Counts the input tokens of a Messages-format request without creating a response. Authentication is required; the call is not billed. The count is for planning; the charge for the real request comes from its usage. TokenLab prefers a count from the model's own counter. When that is not available, it returns a local estimate and sets the response header `X-TokenLab-Count-Tokens-Source: local_estimate`. Authentication, permission and input errors are still errors. Content that references an Anthropic `file_id` is not supported and returns 400.",
        "operationId": "countAnthropicMessageTokens",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnthropicCountTokensRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token count response",
            "headers": {
              "X-TokenLab-Count-Tokens-Source": {
                "description": "`local_estimate` when TokenLab returned its own estimate. Absent when the count came from the model's counter.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "local_estimate"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicCountTokensResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "401": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "402": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "403": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "429": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "500": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "502": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "503": {
            "$ref": "#/components/responses/AnthropicError"
          }
        }
      }
    },
    "/v1beta/models/{model}:generateContent": {
      "post": {
        "tags": [
          "Gemini"
        ],
        "summary": "Generate content (Gemini-compatible)",
        "description": "Generates content using the Gemini GenerateContent request shape. The model details must advertise Gemini requests and the model must be available. ProtoJSON lowerCamelCase and original proto snake_case field names are preserved. Unknown fields are accepted on a best-effort basis; model-specific support is not guaranteed.\n\n**Authentication:** Use `?key=` query parameter, `x-goog-api-key` header, or `Authorization: Bearer` header.",
        "operationId": "geminiGenerateContent",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "name": "model",
            "in": "path",
            "required": true,
            "description": "Model name (e.g., gemini-2.5-pro)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "description": "API key (alternative to header auth)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiRequest"
              },
              "examples": {
                "basic": {
                  "summary": "Basic text generation",
                  "value": {
                    "contents": [
                      {
                        "parts": [
                          {
                            "text": "Hello, Gemini!"
                          }
                        ]
                      }
                    ]
                  }
                },
                "with_config": {
                  "summary": "With generation config",
                  "value": {
                    "contents": [
                      {
                        "parts": [
                          {
                            "text": "Explain quantum computing"
                          }
                        ]
                      }
                    ],
                    "generationConfig": {
                      "temperature": 0.7,
                      "maxOutputTokens": 1024
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiResponse"
                }
              }
            }
          },
          "400": {
            "description": "Gemini-native invalid request error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Gemini-native authentication error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Gemini-native payment error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Gemini-native server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        }
      }
    },
    "/v1beta/models/{model}:streamGenerateContent": {
      "post": {
        "tags": [
          "Gemini"
        ],
        "summary": "Stream generate content (Gemini-compatible)",
        "description": "Streams native Gemini GenerateContent Server-Sent Events without adding Chat Completions terminators. Metadata-only chunks, intermediate chunks without finishReason, and natural EOF are valid.\n\n**Authentication:** Use `?key=` query parameter, `x-goog-api-key` header, or `Authorization: Bearer` header.",
        "operationId": "geminiStreamGenerateContent",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "name": "model",
            "in": "path",
            "required": true,
            "description": "Model name (e.g., gemini-2.5-pro)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "description": "API key (alternative to header auth)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Streaming response",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "SSE stream with Gemini response chunks"
                }
              }
            }
          },
          "400": {
            "description": "Gemini-native invalid request error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Gemini-native authentication error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Gemini-native payment error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Gemini-native server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        }
      }
    },
    "/v1beta/models/{model}:countTokens": {
      "post": {
        "tags": [
          "Gemini"
        ],
        "summary": "Count tokens (Gemini-compatible)",
        "description": "Counts the input tokens of a Gemini request. The call is not billed and needs no account balance. Send `contents` or a full `generateContentRequest`. Either official ProtoJSON field-name spelling is accepted; other fields are forwarded on a best-effort basis. Use only with a model whose model details list `countTokens`.\n\n**Authentication:** Use `?key=` query parameter, `x-goog-api-key` header, or `Authorization: Bearer` header.",
        "operationId": "geminiCountTokens",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "description": "Model name (e.g., gemini-2.5-pro)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "description": "API key (alternative to header auth)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contents": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "generateContentRequest": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "generate_content_request": {
                    "type": "object",
                    "additionalProperties": true
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Gemini-native token count response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "totalTokens"
                  ],
                  "properties": {
                    "totalTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of input tokens in the request."
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Gemini-native error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Gemini-native authentication error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "No route is available for the model right now",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1beta/models/{model}:embedContent": {
      "post": {
        "tags": [
          "Gemini"
        ],
        "summary": "Embed content (Gemini-compatible)",
        "description": "Creates an embedding using the native Gemini EmbedContent contract.",
        "operationId": "geminiEmbedContent",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "content"
                ],
                "properties": {
                  "content": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "taskType": {
                    "type": "string"
                  },
                  "task_type": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "outputDimensionality": {
                    "type": "integer"
                  },
                  "output_dimensionality": {
                    "type": "integer"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Gemini-native embedding response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Gemini-native error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        }
      }
    },
    "/v1beta/models/{model}:batchEmbedContents": {
      "post": {
        "tags": [
          "Gemini"
        ],
        "summary": "Batch embed contents (Gemini-compatible)",
        "description": "Creates multiple embeddings using the native Gemini BatchEmbedContents contract.",
        "operationId": "geminiBatchEmbedContents",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "requests"
                ],
                "properties": {
                  "requests": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Gemini-native batch embedding response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Gemini-native error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        }
      }
    },
    "/v1/responses": {
      "post": {
        "tags": [
          "Responses"
        ],
        "summary": "Create response (OpenAI Responses API)",
        "description": "Creates a response using the OpenAI Responses API request shape. The model details must advertise the Responses request format and the model must be available. Unknown fields are accepted on a best-effort basis; model-specific support is not guaranteed.",
        "operationId": "createResponse",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Model to use"
                  },
                  "input": {
                    "oneOf": [
                      {
                        "type": "string",
                        "description": "Single string input."
                      },
                      {
                        "type": "array",
                        "description": "Structured input items for the conversation."
                      }
                    ],
                    "description": "Input content as a string or structured item array."
                  },
                  "instructions": {
                    "type": "string",
                    "description": "System instructions"
                  },
                  "max_output_tokens": {
                    "type": "integer",
                    "description": "Maximum output tokens"
                  },
                  "temperature": {
                    "type": "number",
                    "description": "Sampling temperature. Range and default depend on the model."
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false,
                    "description": "If true, returns a stream of server-sent events."
                  },
                  "tools": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "description": "Tools available to the model. Tool types and combinations are validated by the selected service."
                  },
                  "tool_choice": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "additionalProperties": true
                      }
                    ],
                    "description": "Tool choice policy or explicit tool selection."
                  },
                  "stream_options": {
                    "type": "object",
                    "properties": {
                      "include_obfuscation": {
                        "type": "boolean",
                        "description": "When true, request obfuscated tokens in Responses stream events where supported."
                      }
                    },
                    "additionalProperties": true,
                    "description": "Responses streaming options."
                  },
                  "include": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Additional response sections to include when supported."
                  },
                  "service_tier": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "TokenLab serves this request at the standard service tier. auto and default are forwarded. Other values, such as flex, priority, fast and ultrafast, are ignored and billed at the standard price."
                  },
                  "truncation": {
                    "type": "string",
                    "description": "Truncation strategy for long conversations."
                  },
                  "background": {
                    "type": "boolean",
                    "default": false,
                    "description": "Run asynchronously, where supported. Poll GET /v1/responses/{id}."
                  },
                  "previous_response_id": {
                    "type": "string",
                    "description": "Stored response of your account to continue (404 response_not_found otherwise)."
                  },
                  "prompt": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Reference to a reusable prompt template and variables."
                  },
                  "store": {
                    "type": "boolean",
                    "default": true,
                    "description": "Store the response for retrieval and previous_response_id."
                  },
                  "reasoning": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Reasoning configuration."
                  },
                  "top_p": {
                    "type": "number",
                    "description": "Nucleus sampling probability."
                  },
                  "parallel_tool_calls": {
                    "type": "boolean",
                    "description": "Whether the model may issue parallel tool calls, when the model supports it."
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Request metadata."
                  },
                  "text": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Text formatting options."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional key that stops a second run of the same request. Send a new unique value, such as a UUID, for each request, and keep it for retries after a timeout. A retry with the same key does not run again: it returns `409` with `idempotency_replay_unavailable`, or usually `idempotency_conflict` when the body changed. Exception: when a non-stream result finished after the client disconnected, a retry with the same key and body within 24 hours returns that result (up to 1 MB) with the header `Idempotent-Replayed: true` and no second charge. A key longer than 255 characters is ignored, and the request then has no idempotency protection. With `background: true`, a retry with the same key and body returns the original response object instead and does not create or charge a second response; a different body is rejected, and its status code is not guaranteed. See [Retry safely with an idempotency key](https://tokenlab.sh/docs/en/guides/error-handling#idempotency-key).",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ]
      }
    },
    "/v1/responses/{id}": {
      "get": {
        "tags": [
          "Responses"
        ],
        "summary": "Retrieve response",
        "description": "Retrieves a stored response by ID, or polls a background response. It returns 404 with code response_not_found when the ID is unknown, belongs to another account, was deleted, was created with store false, or is past its retention. TokenLab keeps a stored response for 24 hours; some stay retrievable for up to 30 days.",
        "operationId": "retrieveResponse",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Response id returned by POST /v1/responses."
          },
          {
            "name": "include",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Additional response fields to include, forwarded where the model supports them."
          },
          {
            "name": "include_obfuscation",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "Whether streamed events include obfuscation fields, forwarded where the model supports it."
          },
          {
            "name": "stream",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "Whether to retrieve the response as an event stream. Applies while the response is still running; a finished response is returned as JSON."
          },
          {
            "name": "starting_after",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "Sequence number after which streaming events are returned. Applies only with stream."
          }
        ],
        "responses": {
          "200": {
            "description": "Stored response"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          }
        }
      },
      "delete": {
        "tags": [
          "Responses"
        ],
        "summary": "Delete response",
        "description": "Deletes a stored response. This operation is deletion, not cancellation of an in-progress response. An unknown ID, an ID from another account, and an ID that was already deleted return 404 with code response_not_found. A successful call returns 200 with deleted true.",
        "operationId": "deleteResponse",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Response id returned by POST /v1/responses."
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted response"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          }
        }
      }
    },
    "/v1/responses/compact": {
      "post": {
        "tags": [
          "Responses"
        ],
        "summary": "Compact response context (OpenAI Responses API)",
        "description": "Compacts Responses input and returns a `response.compaction` object. Send its output items unchanged as input of the next Responses request, with the same model. The model must list openai_responses in accepted_request_formats, or the request returns 400. Streaming is not supported. The request is billed by token usage.",
        "operationId": "compactResponse",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "input"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Model to use for compaction. Codex CLI sends the current session model."
                  },
                  "input": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "description": "Responses input items to compact."
                      }
                    ],
                    "description": "Conversation input to compact."
                  },
                  "max_output_tokens": {
                    "type": "integer",
                    "description": "Maximum output tokens."
                  },
                  "stream": {
                    "type": "boolean",
                    "description": "Streaming is not supported for compaction. stream true returns 400."
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Request metadata."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful compaction response"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          }
        ]
      }
    },
    "/v1/rerank": {
      "post": {
        "tags": [
          "Embeddings"
        ],
        "summary": "Rerank documents",
        "description": "Reranks documents by relevance to a query. Use a model whose details list the `rerank` operation. Limits: query up to 32,000 characters; 1 to 1,000 documents, each up to 100,000 characters and 2,000,000 characters in total.",
        "operationId": "rerankDocuments",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "query",
                  "documents"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Reranker model to use"
                  },
                  "query": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32000,
                    "description": "Query to rank against"
                  },
                  "documents": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 1000,
                    "items": {
                      "type": "string",
                      "maxLength": 100000
                    },
                    "description": "Documents to rerank, up to 2,000,000 characters in total."
                  },
                  "top_n": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Number of results, from 1 to the number of documents."
                  },
                  "return_documents": {
                    "type": "boolean",
                    "description": "Include document text, for models that list it."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ranked results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "results",
                    "model"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "results": {
                      "type": "array",
                      "description": "Documents ranked by relevance, best first.",
                      "items": {
                        "type": "object",
                        "required": [
                          "index"
                        ],
                        "properties": {
                          "index": {
                            "type": "integer",
                            "description": "Index of the document in the request"
                          },
                          "relevance_score": {
                            "type": "number",
                            "description": "Relevance score. Its range depends on the model."
                          },
                          "document": {
                            "description": "Document text, when requested and returned by the model"
                          }
                        },
                        "additionalProperties": true
                      }
                    },
                    "model": {
                      "type": "string"
                    },
                    "usage": {
                      "type": "object",
                      "description": "Usage reported for the request: `total_tokens`, or `search_units` for models billed per search.",
                      "properties": {
                        "total_tokens": {
                          "type": "integer"
                        },
                        "search_units": {
                          "type": "integer"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          }
        ]
      }
    },
    "/v1/music/generations": {
      "post": {
        "tags": [
          "Audio"
        ],
        "summary": "Create music generation task",
        "description": "Creates a music, lyrics, or sound generation task. Returns a task ID for polling. Models differ in the fields they accept; read the model's details with GET /v1/models/{model} before sending optional fields. The user field is not supported.",
        "operationId": "createMusic",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "default": "suno-music",
                    "description": "Music model ID, for example suno-music."
                  },
                  "prompt": {
                    "type": "string",
                    "maxLength": 5000,
                    "description": "Music description or replacement text. Optional with continue_clip_id: an extension without tags and title keeps the source song and takes no prompt."
                  },
                  "title": {
                    "type": "string",
                    "description": "Title for the generated song."
                  },
                  "tags": {
                    "type": "string",
                    "maxLength": 1000,
                    "description": "Style tags, for example pop, upbeat, electronic."
                  },
                  "negative_tags": {
                    "type": "string",
                    "maxLength": 1000,
                    "description": "Styles to avoid. Required when audio_operation is add-instrumental."
                  },
                  "action": {
                    "type": "string",
                    "enum": [
                      "MUSIC",
                      "LYRICS"
                    ],
                    "description": "MUSIC or LYRICS."
                  },
                  "mv": {
                    "type": "string",
                    "enum": [
                      "chirp-v6",
                      "chirp-v6-mini",
                      "chirp-v6-wild"
                    ],
                    "description": "Suno model version. Required when generating new audio."
                  },
                  "make_instrumental": {
                    "type": "boolean",
                    "description": "Generate instrumental output without vocals."
                  },
                  "audio_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Publicly reachable reference or uploaded audio URL. Defaults to upload-cover when audio_operation is omitted."
                  },
                  "audio_operation": {
                    "type": "string",
                    "enum": [
                      "upload-cover",
                      "upload-extend",
                      "add-instrumental",
                      "replace-section",
                      "vocal-separate",
                      "multi-stem-separation",
                      "advanced-split"
                    ],
                    "description": "Operation on existing audio; each needs its own fields (see the music guide)."
                  },
                  "continue_clip_id": {
                    "type": "string",
                    "description": "Clip ID to continue when extending an existing generation. To set new lyrics with prompt, also send tags and title."
                  },
                  "continue_at": {
                    "type": "number",
                    "description": "Timestamp in seconds for continuation flows. Required and greater than 0 when audio_operation is upload-extend."
                  },
                  "task_id": {
                    "type": "string",
                    "description": "Earlier music task, for replacement or stem separation."
                  },
                  "audio_id": {
                    "type": "string",
                    "description": "Audio ID from that task. Required with task_id."
                  },
                  "infill_start_s": {
                    "type": "number",
                    "minimum": 0,
                    "description": "Replacement start, in seconds."
                  },
                  "infill_end_s": {
                    "type": "number",
                    "minimum": 0,
                    "description": "Replacement end, 6 to 60 seconds after the start."
                  },
                  "full_lyrics": {
                    "type": "string",
                    "description": "Full lyrics after replacement."
                  },
                  "stem_name": {
                    "type": "string",
                    "description": "Stem name. Required for advanced-split."
                  },
                  "duration": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 380,
                    "description": "Length in seconds, where listed."
                  },
                  "output_format": {
                    "type": "string",
                    "description": "Audio file format listed by the model, for example mp3, wav or flac."
                  },
                  "seed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 4294967294,
                    "description": "Seed, where listed."
                  },
                  "steps": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "Generation steps, where listed. The range depends on the model."
                  },
                  "cfg_scale": {
                    "type": "number",
                    "minimum": 1,
                    "maximum": 25,
                    "description": "Prompt guidance strength, where listed."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Task ID. Poll GET /v1/tasks/{id} with it."
                    },
                    "task_id": {
                      "type": "string",
                      "description": "Alias of id."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "completed",
                        "failed"
                      ]
                    },
                    "poll_url": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyTask"
          }
        ]
      }
    },
    "/v1/music/generations/{id}": {
      "get": {
        "tags": [
          "Audio"
        ],
        "summary": "Get music task status",
        "description": "Retrieves the status and result of a music generation task.",
        "operationId": "getMusicTask",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The music generation task ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Task status. A failed task still returns HTTP 200; read status, error, and error_details.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "status"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "task_id": {
                      "type": "string"
                    },
                    "poll_url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "completed",
                        "failed",
                        "timeout"
                      ]
                    },
                    "progress": {
                      "type": "integer",
                      "description": "Returned only when a real progress value is available."
                    },
                    "audio_id": {
                      "type": "string",
                      "description": "Source audio ID, usable with this task's ID in follow-up operations."
                    },
                    "audio_url": {
                      "type": "string",
                      "format": "uri",
                      "description": "Audio file URL when completed. A TokenLab media-result link that stays valid for 30 days."
                    },
                    "video_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "image_url": {
                      "type": "string",
                      "format": "uri",
                      "description": "Cover image URL, when the model returns one."
                    },
                    "title": {
                      "type": "string"
                    },
                    "lyrics": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "description": "Output files, for example separated audio, each with audio_url or url.",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "error": {
                      "$ref": "#/components/schemas/AsyncTaskError"
                    },
                    "error_details": {
                      "$ref": "#/components/schemas/AsyncTaskErrorDetails"
                    },
                    "media_retention": {
                      "$ref": "#/components/schemas/MediaRetention"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "description": "Task not found"
          }
        }
      }
    },
    "/v1/3d/generations": {
      "post": {
        "tags": [
          "Video"
        ],
        "summary": "Create 3D model generation task",
        "description": "Creates a 3D model generation task from text or an image. Returns a task ID for polling. Models differ in the operations and fields they accept; read the model's details with GET /v1/models/{model} before sending optional fields.",
        "operationId": "create3D",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "default": "tripo-h3.1",
                    "description": "3D model ID. Send it explicitly."
                  },
                  "operation": {
                    "type": "string",
                    "enum": [
                      "text-to-3d",
                      "image-to-3d"
                    ],
                    "description": "Optional; inferred from whether an image is sent."
                  },
                  "prompt": {
                    "type": "string",
                    "maxLength": 2000,
                    "description": "3D model description, up to 2000 characters; a model can set a lower limit. Required whenever the model's details list prompt, which includes image-to-3D requests for the current models."
                  },
                  "image": {
                    "type": "string",
                    "description": "Base64 image for image-to-3D"
                  },
                  "image_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Public image URL for image-to-3D."
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "glb",
                      "fbx",
                      "obj",
                      "usdz"
                    ]
                  },
                  "quality": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "standard",
                      "high"
                    ]
                  },
                  "style": {
                    "type": "string",
                    "description": "Style hint for compatible 3D model families."
                  },
                  "seed": {
                    "type": "integer",
                    "description": "Seed for repeatable generation where supported by the model."
                  },
                  "user": {
                    "type": "string",
                    "description": "End-user identifier."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Task ID. Poll GET /v1/tasks/{id} with it."
                    },
                    "task_id": {
                      "type": "string",
                      "description": "Alias of id."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "completed",
                        "failed"
                      ]
                    },
                    "poll_url": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyTask"
          }
        ]
      }
    },
    "/v1/3d/generations/{id}": {
      "get": {
        "tags": [
          "Video"
        ],
        "summary": "Get 3D task status",
        "description": "Retrieves the status and result of a 3D generation task.",
        "operationId": "get3DTask",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The 3D generation task ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Task status. A failed task still returns HTTP 200; read status, error, and error_details.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "status"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "task_id": {
                      "type": "string"
                    },
                    "poll_url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "completed",
                        "failed",
                        "timeout"
                      ]
                    },
                    "progress": {
                      "type": "integer",
                      "description": "Returned only when a real progress value is available."
                    },
                    "model_url": {
                      "type": "string",
                      "format": "uri",
                      "description": "3D model file URL when completed. A TokenLab media-result link that stays valid for 30 days."
                    },
                    "glb_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "fbx_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "error": {
                      "$ref": "#/components/schemas/AsyncTaskError"
                    },
                    "error_details": {
                      "$ref": "#/components/schemas/AsyncTaskErrorDetails"
                    },
                    "media_retention": {
                      "$ref": "#/components/schemas/MediaRetention"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "description": "Task not found"
          }
        }
      }
    },
    "/v1/management/balance": {
      "get": {
        "tags": [
          "Management"
        ],
        "summary": "Get organization balance",
        "description": "Returns the current organization balance totals for the authenticated management token.",
        "operationId": "getManagementBalance",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Organization balance totals",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagementBalanceResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        }
      }
    },
    "/v1/management/api-keys": {
      "get": {
        "tags": [
          "Management"
        ],
        "summary": "List organization API keys",
        "description": "Lists user-managed API keys for the current organization management token.",
        "operationId": "listManagementApiKeys",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List of API keys",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagementApiKeyListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        }
      },
      "post": {
        "tags": [
          "Management"
        ],
        "summary": "Create organization API key",
        "description": "Creates a new user API key for the current organization management token.",
        "operationId": "createManagementApiKey",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50,
                    "default": "Default Key",
                    "description": "Display name for the user API key. Trimmed server-side. Length must be 1-50 characters."
                  },
                  "limitAmount": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 1000000,
                    "description": "Spending limit input in USD. `null` or omitted means unlimited usage, and `0` means zero quota."
                  },
                  "limitCurrency": {
                    "type": "string",
                    "enum": [
                      "USD"
                    ],
                    "default": "USD",
                    "description": "Currency for `limitAmount`. USD is the only active currency. Sending `CNY` returns 400 `currency_retired`."
                  },
                  "models": {
                    "type": "array",
                    "default": [],
                    "description": "Optional model allowlist. Empty array means no per-key model restriction beyond organization policy.",
                    "items": {
                      "type": "string"
                    }
                  },
                  "expiresAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time",
                    "description": "Optional RFC3339 timestamp. null means no expiry."
                  },
                  "deliveryPolicy": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "auto",
                      "verified",
                      "official",
                      null
                    ],
                    "description": "Per-key Delivery policy. null inherits the Workspace default."
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagementCreatedApiKey"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        }
      }
    },
    "/v1/management/api-keys/{keyId}": {
      "patch": {
        "tags": [
          "Management"
        ],
        "summary": "Update organization API key",
        "description": "Updates a user-managed API key for the current organization management token.",
        "operationId": "updateManagementApiKey",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "parameters": [
          {
            "name": "keyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "inactive",
                      "suspended",
                      "revoked"
                    ],
                    "description": "Lifecycle status for the user API key."
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50,
                    "description": "Updated display name. Length must be 1-50 characters after trimming."
                  },
                  "limitAmount": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 1000000,
                    "description": "Updated spending limit input in USD. `null` means unlimited and `0` means zero quota."
                  },
                  "limitCurrency": {
                    "type": "string",
                    "enum": [
                      "USD"
                    ],
                    "description": "Currency for `limitAmount`. USD is the only active currency. Sending `CNY` returns 400 `currency_retired`.",
                    "default": "USD"
                  },
                  "models": {
                    "type": "array",
                    "description": "Updated model allowlist.",
                    "items": {
                      "type": "string"
                    }
                  },
                  "expiresAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time",
                    "description": "Updated RFC3339 expiry timestamp. null clears the expiry."
                  },
                  "deliveryPolicy": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "auto",
                      "verified",
                      "official",
                      null
                    ],
                    "description": "Per-key Delivery policy. null inherits the Workspace default."
                  }
                },
                "description": "At least one field must be provided.",
                "minProperties": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagementApiKey"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "A revoked API key cannot be reactivated. Create a new key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "example": {
                  "error": {
                    "message": "A revoked API key cannot be reactivated. Create a new key.",
                    "type": "invalid_request_error",
                    "code": "api_key_revoked"
                  }
                }
              }
            }
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        }
      }
    },
    "/v1/management/api-keys/{keyId}/usage": {
      "get": {
        "tags": [
          "Management"
        ],
        "summary": "Get API key usage",
        "description": "Returns paginated usage details for this API key.",
        "operationId": "getManagementApiKeyUsage",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "parameters": [
          {
            "name": "keyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            },
            "description": "1-based page number. Default is 1."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Page size. Default is 50 and the maximum is 100."
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Filter by requested model name. Maximum length 100."
          },
          {
            "name": "modelVendor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Filter by public model vendor. Maximum length 100."
          },
          {
            "name": "scene",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "chat",
                "image",
                "audio",
                "video",
                "embedding",
                "rerank",
                "translation",
                "music",
                "3d",
                "realtime",
                "systemone"
              ]
            },
            "description": "Filter by public request scene."
          },
          {
            "name": "startDate",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Lower bound, inclusive. Accepts RFC3339 with timezone (for example 2026-03-28T00:00:00+08:00) or YYYY-MM-DD, which means 00:00 UTC."
          },
          {
            "name": "endDate",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Upper bound, inclusive. Accepts RFC3339 with timezone (for example 2026-03-28T23:59:59+08:00) or YYYY-MM-DD, which means 00:00 UTC at the start of that day. To include a whole day, pass the next day's date or an RFC3339 time at the end of the day."
          }
        ],
        "responses": {
          "200": {
            "description": "API key usage details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagementUsageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        }
      }
    },
    "/v1/management/api-keys/{keyId}/billing": {
      "get": {
        "tags": [
          "Management"
        ],
        "summary": "Get API key billing",
        "description": "Returns aggregated billing breakdowns for this API key.",
        "operationId": "getManagementApiKeyBilling",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "parameters": [
          {
            "name": "keyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Filter by requested model name. Maximum length 100."
          },
          {
            "name": "modelVendor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Filter by public model vendor. Maximum length 100."
          },
          {
            "name": "scene",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "chat",
                "image",
                "audio",
                "video",
                "embedding",
                "rerank",
                "translation",
                "music",
                "3d",
                "realtime",
                "systemone"
              ]
            },
            "description": "Filter by public request scene."
          },
          {
            "name": "startDate",
            "in": "query",
            "description": "Lower bound, inclusive. Accepts RFC3339 with timezone (for example 2026-03-28T00:00:00+08:00) or YYYY-MM-DD, which means 00:00 UTC.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "description": "Upper bound, inclusive. Accepts RFC3339 with timezone (for example 2026-03-28T23:59:59+08:00) or YYYY-MM-DD, which means 00:00 UTC at the start of that day. To include a whole day, pass the next day's date or an RFC3339 time at the end of the day.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "API key billing breakdowns",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagementBillingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        }
      }
    },
    "/v1/models/{model}/pricing": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "Get model pricing",
        "description": "Retrieves pricing-only detail for one model. No API key is needed. Use it to explain a price, not to build a request.",
        "operationId": "getModelPricing",
        "security": [],
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "description": "The model ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Model pricing information",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelPricingResponse"
                }
              }
            }
          },
          "404": {
            "description": "Model not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/files": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Upload file",
        "description": "Uploads a TokenLab/OpenAI-compatible batch or image file.",
        "operationId": "uploadFile",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The file: up to 200 MiB for batch, 50 MiB for images."
                  },
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "batch",
                      "user_data",
                      "vision"
                    ],
                    "description": "Use batch for Batch API JSONL files, or user_data/vision for image edits."
                  },
                  "model": {
                    "type": "string",
                    "description": "Optional TokenLab extension for image file uploads. Defaults to gpt-image-2 and binds the returned file_id to the selected image-edit configuration."
                  },
                  "expires_after[anchor]": {
                    "type": "string",
                    "enum": [
                      "created_at"
                    ],
                    "description": "For `purpose=batch`: counts the expiry from the upload time. Send it together with `expires_after[seconds]`. Without it, a batch file expires 24 hours after upload."
                  },
                  "expires_after[seconds]": {
                    "type": "integer",
                    "minimum": 3600,
                    "maximum": 2592000,
                    "description": "For `purpose=batch`: seconds until the file expires, from 1 hour to 30 days."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Uploaded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileObject"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "413": {
            "description": "File too large: batch files up to 200 MiB, image files up to 50 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "List files",
        "operationId": "listFiles",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Number of files to return, 1 to 10,000 (default 10,000).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "purpose",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "batch",
                "batch_output",
                "user_data",
                "vision"
              ]
            },
            "description": "Optional file purpose filter. batch and batch_output cover Batch API files; user_data and vision cover TokenLab image/reference file bindings."
          }
        ],
        "responses": {
          "200": {
            "description": "List of files",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/files/{file_id}": {
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Retrieve file",
        "operationId": "retrieveFile",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "File metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileObject"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "File not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Files"
        ],
        "summary": "Delete file",
        "description": "Deletes a batch file or a bound image/reference file.",
        "operationId": "deleteFile",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "File ID returned by the Files API."
          }
        ],
        "responses": {
          "200": {
            "description": "File deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDeletedObject"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/files/{file_id}/content": {
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Retrieve file content",
        "operationId": "retrieveFileContent",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "File content",
            "content": {
              "application/jsonl": {
                "schema": {
                  "type": "string"
                }
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "File not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/batches": {
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Create batch",
        "description": "Creates a batch job from an uploaded JSONL file with `purpose` set to `batch`. Endpoints: `/v1/chat/completions` and `/v1/embeddings`. A file holds up to 50,000 requests and 200 MiB; every line needs a unique `custom_id`, `method` `POST`, a `url` equal to `endpoint`, and a `body` with `model`. Streaming is not supported. The estimated cost is reserved when the batch is created; a balance that is too low returns 402.",
        "operationId": "createBatch",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchObject"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          }
        ]
      },
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "List batches",
        "description": "Lists the batches created through this endpoint in the current Workspace, newest first by default.",
        "operationId": "listBatches",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Number of batches to return. Default 20.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Batch ID cursor: return batches after this one. Cannot be combined with `before`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "Batch ID cursor: return batches before this one. Cannot be combined with `after`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "description": "Sort order by creation time.",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of batches",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/batches/{batch_id}": {
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "Retrieve batch",
        "description": "Returns the current status, request counts, and result file IDs of a batch.",
        "operationId": "retrieveBatch",
        "parameters": [
          {
            "name": "batch_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Batch object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchObject"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Batch not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/batches/{batch_id}/cancel": {
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Cancel batch",
        "description": "Requests cancellation of a batch that has not finished. The response shows the current status, which may be `cancelling` or already `cancelled`; a finished batch keeps its status.",
        "operationId": "cancelBatch",
        "parameters": [
          {
            "name": "batch_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cancelled batch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchObject"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Batch not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pricing": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "List model pricing",
        "description": "Returns the current public prices of active models, with optional provider and tag filters. No API key is needed.",
        "operationId": "getPricing",
        "security": [],
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "description": "Filter by model maker, for example `openai`, `anthropic`, `google`, or `deepseek`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "description": "Filter by a capability tag such as `reasoning`, `tool-use`, `vision`, or `text-to-image`. The values in a model's `capabilities` are valid tags.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pricing information for matching models",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/translations": {
      "post": {
        "tags": [
          "Text"
        ],
        "summary": "Translate text",
        "description": "Translates text into a target language with a model that lists the `translation` operation. This is text-to-text translation; audio translation uses `POST /v1/audio/translations`.",
        "operationId": "createTranslation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TranslationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Translated text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TranslationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          }
        ]
      }
    },
    "/v1/audio/translations": {
      "post": {
        "tags": [
          "Audio"
        ],
        "summary": "Translate audio",
        "description": "Transcribes audio and translates the result to English.",
        "operationId": "createAudioTranslation",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file",
                  "model"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "model": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "response_format": {
                    "type": "string"
                  },
                  "temperature": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Translated transcript",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioTranscriptionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "413": {
            "$ref": "#/components/responses/BadRequest"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          }
        ]
      }
    },
    "/v1/realtime": {
      "get": {
        "tags": [
          "Realtime"
        ],
        "summary": "Connect to realtime WebSocket",
        "description": "Returns realtime endpoint metadata for a normal HTTP GET request; no API key is needed. WebSocket clients use the same path with `?model={model}` and an `Authorization: Bearer` or `x-api-key` header to open a realtime voice session with a model that lists the `realtime` operation. A credential that names no usable API key is refused before the upgrade with 401, 403, 429, or 503. Other rejections arrive as one JSON message with `type: \"error\"`, followed by a close code. This surface is a TokenLab WebSocket subset of OpenAI Realtime; it does not expose REST helper endpoints such as client secrets, Calls, or legacy beta session creation.",
        "operationId": "connectRealtime",
        "parameters": [
          {
            "name": "model",
            "in": "query",
            "required": false,
            "description": "Realtime model ID. Required for WebSocket upgrade requests; optional for plain HTTP metadata checks.",
            "schema": {
              "type": "string"
            },
            "example": "grok-voice-latest"
          }
        ],
        "responses": {
          "101": {
            "description": "WebSocket connection established"
          },
          "200": {
            "description": "Realtime endpoint metadata returned for non-WebSocket GET requests",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "websocket_url",
                    "protocol"
                  ],
                  "properties": {
                    "object": {
                      "type": "string",
                      "example": "realtime.endpoint"
                    },
                    "websocket_url": {
                      "type": "string",
                      "example": "/v1/realtime?model={model}"
                    },
                    "protocol": {
                      "type": "string",
                      "example": "tokenlab_realtime_proxy"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "description": "Authentication service temporarily unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/edits": {
      "post": {
        "tags": [
          "Images"
        ],
        "summary": "Edit image",
        "description": "Edits an image using multipart image uploads, JSON image URLs, or the official JSON images array for supported GPT Image models.",
        "operationId": "editImage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Model to use for image edits. Send this explicitly."
                  },
                  "prompt": {
                    "type": "string",
                    "maxLength": 32000,
                    "description": "Description of the edit. Required unless the model takes no prompt."
                  },
                  "image_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Single source image URL. Kept for TokenLab compatibility; use images for the official JSON shape."
                  },
                  "n": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "quality": {
                    "type": "string"
                  },
                  "size": {
                    "type": "string"
                  },
                  "aspect_ratio": {
                    "type": "string"
                  },
                  "resolution": {
                    "type": "string"
                  },
                  "response_format": {
                    "type": "string"
                  },
                  "background": {
                    "type": "string",
                    "enum": [
                      "transparent",
                      "opaque",
                      "auto"
                    ]
                  },
                  "output_format": {
                    "type": "string",
                    "enum": [
                      "png",
                      "jpeg",
                      "webp",
                      "gif"
                    ],
                    "description": "gif and svg are for models whose contract lists them; other models reject them. svg is not an edit format. gif takes no mask, stream, partial_images or output_compression."
                  },
                  "output_compression": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "compression": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "moderation": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "low"
                    ]
                  },
                  "async": {
                    "type": "boolean",
                    "description": "Return a task at once, for models that list async (else 400 unsupported_async_mode). Poll GET /v1/tasks/{id}."
                  },
                  "stream": {
                    "type": "boolean",
                    "description": "Reserved image streaming flag. The public edit route currently rejects true."
                  },
                  "user": {
                    "type": "string"
                  },
                  "image_urls": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 16,
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "description": "Multiple source image URLs. GPT Image edits accept up to 16 source images; xAI Grok Imagine Image 2.0 edits accept at most 5 source images; the other xAI Grok Imagine edit models accept at most 3."
                  },
                  "images": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 16,
                    "description": "Official JSON image references for image edits. Provide exactly one of image_url or file_id for each item. GPT Image edits accept up to 16 source images; xAI Grok Imagine Image 2.0 edits accept at most 5 source images; the other xAI Grok Imagine edit models accept at most 3.",
                    "items": {
                      "type": "object",
                      "oneOf": [
                        {
                          "required": [
                            "image_url"
                          ]
                        },
                        {
                          "required": [
                            "file_id"
                          ]
                        }
                      ],
                      "properties": {
                        "image_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "file_id": {
                          "type": "string",
                          "description": "A file id returned by TokenLab /v1/files and bound to the same image-edit configuration."
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "mask": {
                    "type": "object",
                    "oneOf": [
                      {
                        "required": [
                          "image_url"
                        ]
                      },
                      {
                        "required": [
                          "file_id"
                        ]
                      }
                    ],
                    "properties": {
                      "image_url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Source mask image URL. Public http/https URLs and compatible data URLs are supported by the runtime validation path."
                      },
                      "file_id": {
                        "type": "string",
                        "description": "A file id returned by TokenLab /v1/files and bound to the same image-edit configuration."
                      }
                    },
                    "additionalProperties": false,
                    "description": "Optional JSON mask reference for image edits. Provide exactly one of image_url or file_id. Multipart requests can also send mask as a file part."
                  },
                  "width": {
                    "type": "integer",
                    "description": "Model-specific output width in pixels. See get_model."
                  },
                  "height": {
                    "type": "integer",
                    "description": "Model-specific output height in pixels. See get_model."
                  },
                  "steps": {
                    "type": "integer",
                    "description": "Model-specific inference step count. See get_model."
                  },
                  "cfg_scale": {
                    "type": "number",
                    "description": "Model-specific image CFG scale. See get_model."
                  },
                  "guidance_scale": {
                    "type": "number",
                    "description": "Model-specific guidance scale. See get_model."
                  },
                  "guidance": {
                    "type": "number",
                    "description": "Model-specific guidance value. See get_model."
                  },
                  "control_strength": {
                    "type": "number",
                    "description": "Model-specific edit control strength. See get_model."
                  },
                  "fidelity": {
                    "type": "number",
                    "description": "Model-specific image edit fidelity. See get_model."
                  },
                  "creativity": {
                    "type": "number",
                    "description": "Model-specific image edit creativity. See get_model."
                  },
                  "frame_count": {
                    "type": "integer",
                    "minimum": 2,
                    "maximum": 16,
                    "description": "Number of GIF frames, from 2 to 16. Only with output_format gif. The model lists it when it serves gif."
                  },
                  "frame_duration_ms": {
                    "type": "integer",
                    "minimum": 20,
                    "maximum": 2000,
                    "description": "Time of each GIF frame in milliseconds, from 20 to 2000. Only with output_format gif. The model lists it when it serves gif."
                  }
                },
                "additionalProperties": true,
                "anyOf": [
                  {
                    "required": [
                      "image_url"
                    ]
                  },
                  {
                    "required": [
                      "image_urls"
                    ]
                  },
                  {
                    "required": [
                      "images"
                    ]
                  }
                ]
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "model"
                ],
                "properties": {
                  "image": {
                    "oneOf": [
                      {
                        "type": "string",
                        "format": "binary"
                      },
                      {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 16,
                        "items": {
                          "type": "string",
                          "format": "binary"
                        }
                      }
                    ],
                    "description": "Source image file(s). Repeat image for multiple source images. GPT Image edits accept up to 16 images; xAI Grok Imagine Image 2.0 edits accept at most 5 source images; the other xAI Grok Imagine edit models accept at most 3."
                  },
                  "mask": {
                    "type": "string",
                    "format": "binary"
                  },
                  "model": {
                    "type": "string",
                    "description": "Model to use for image edits. Send this explicitly, for example gpt-image-2."
                  },
                  "prompt": {
                    "type": "string",
                    "maxLength": 32000,
                    "description": "Description of the edit. Required unless the model takes no prompt."
                  },
                  "n": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "quality": {
                    "type": "string"
                  },
                  "size": {
                    "type": "string"
                  },
                  "aspect_ratio": {
                    "type": "string"
                  },
                  "resolution": {
                    "type": "string"
                  },
                  "response_format": {
                    "type": "string"
                  },
                  "background": {
                    "type": "string",
                    "enum": [
                      "transparent",
                      "opaque",
                      "auto"
                    ]
                  },
                  "output_format": {
                    "type": "string",
                    "enum": [
                      "png",
                      "jpeg",
                      "webp",
                      "gif"
                    ],
                    "description": "gif and svg are for models whose contract lists them; other models reject them. svg is not an edit format. gif takes no mask, stream, partial_images or output_compression."
                  },
                  "output_compression": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "compression": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "moderation": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "low"
                    ]
                  },
                  "async": {
                    "type": "boolean"
                  },
                  "stream": {
                    "type": "boolean"
                  },
                  "user": {
                    "type": "string"
                  },
                  "image[]": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 16,
                    "items": {
                      "type": "string",
                      "format": "binary"
                    },
                    "description": "Alternative repeated multipart field name for multiple source images. The same model-specific limits apply: GPT Image up to 16, xAI Grok Imagine Image 2.0 up to 5, other xAI Grok Imagine edit models up to 3."
                  },
                  "width": {
                    "type": "integer",
                    "description": "Model-specific output width in pixels. See get_model."
                  },
                  "height": {
                    "type": "integer",
                    "description": "Model-specific output height in pixels. See get_model."
                  },
                  "steps": {
                    "type": "integer",
                    "description": "Model-specific inference step count. See get_model."
                  },
                  "cfg_scale": {
                    "type": "number",
                    "description": "Model-specific image CFG scale. See get_model."
                  },
                  "guidance_scale": {
                    "type": "number",
                    "description": "Model-specific guidance scale. See get_model."
                  },
                  "guidance": {
                    "type": "number",
                    "description": "Model-specific guidance value. See get_model."
                  },
                  "control_strength": {
                    "type": "number",
                    "description": "Model-specific edit control strength. See get_model."
                  },
                  "fidelity": {
                    "type": "number",
                    "description": "Model-specific image edit fidelity. See get_model."
                  },
                  "creativity": {
                    "type": "number",
                    "description": "Model-specific image edit creativity. See get_model."
                  },
                  "frame_count": {
                    "type": "integer",
                    "minimum": 2,
                    "maximum": 16,
                    "description": "Number of GIF frames, from 2 to 16. Only with output_format gif. The model lists it when it serves gif."
                  },
                  "frame_duration_ms": {
                    "type": "integer",
                    "minimum": 20,
                    "maximum": 2000,
                    "description": "Time of each GIF frame in milliseconds, from 20 to 2000. Only with output_format gif. The model lists it when it serves gif."
                  }
                },
                "additionalProperties": true,
                "anyOf": [
                  {
                    "required": [
                      "image"
                    ]
                  },
                  {
                    "required": [
                      "image[]"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Edited image response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageGenerationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "413": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyImage"
          }
        ]
      }
    },
    "/v1/images/variations": {
      "post": {
        "tags": [
          "Images"
        ],
        "summary": "Create image variation",
        "description": "Generates image variations from a multipart image upload.",
        "operationId": "createImageVariation",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "image"
                ],
                "properties": {
                  "image": {
                    "type": "string",
                    "format": "binary"
                  },
                  "model": {
                    "type": "string",
                    "description": "Required model identifier for legacy variation-compatible routes. For current image-to-image workflows, prefer /v1/images/edits with gpt-image-2 or /v1/images/generations with an image-to-image model."
                  },
                  "n": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "size": {
                    "type": "string"
                  },
                  "response_format": {
                    "type": "string"
                  },
                  "user": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Variation response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageGenerationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "413": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          }
        ]
      }
    },
    "/v1beta/models": {
      "get": {
        "tags": [
          "Gemini"
        ],
        "summary": "List Gemini-native models",
        "description": "Lists the models that accept Gemini requests. Each model's `supportedGenerationMethods` lists the actions you can call on it. No API key is needed.",
        "operationId": "listGeminiModels",
        "parameters": [
          {
            "name": "pageSize",
            "in": "query",
            "description": "Maximum number of models to return. Default: 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 50
            }
          },
          {
            "name": "pageToken",
            "in": "query",
            "description": "Continuation token from a previous page. An invalid token returns 400.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Gemini model list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiModelListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1beta/models/{model}": {
      "get": {
        "tags": [
          "Gemini"
        ],
        "summary": "Get Gemini-native model",
        "description": "Returns metadata for one model that accepts Gemini requests. An alias resolves to the model's canonical ID. A model that does not accept Gemini requests returns 404. No API key is needed.",
        "operationId": "getGeminiModel",
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "description": "Model name or alias (e.g., gemini-2.5-pro)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Gemini model details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiModelInfo"
                }
              }
            }
          },
          "404": {
            "description": "Model not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiErrorResponse"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1/worlds/media-assets/prepare-upload": {
      "post": {
        "tags": [
          "Worlds"
        ],
        "summary": "Prepare World Labs media asset upload",
        "description": "Creates a World Labs media asset record and returns a signed upload URL. Use the returned media_asset_id from native world_prompt objects with source=media_asset. Media assets can only be used by the organization that created them.",
        "operationId": "prepareWorldMediaAssetUpload",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "file_name",
                  "kind"
                ],
                "properties": {
                  "file_name": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "File name, such as landscape.jpg."
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "image",
                      "video"
                    ],
                    "description": "High-level media type."
                  },
                  "extension": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "File extension without dot, such as jpg, png, or mp4."
                  },
                  "metadata": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": true,
                    "description": "Optional application metadata."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Upload prepared",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "media_asset",
                    "upload_info"
                  ],
                  "properties": {
                    "media_asset": {
                      "type": "object",
                      "required": [
                        "media_asset_id",
                        "file_name"
                      ],
                      "properties": {
                        "created_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "file_name": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "image",
                            "video"
                          ]
                        },
                        "media_asset_id": {
                          "type": "string"
                        },
                        "extension": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "metadata": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": true
                        },
                        "updated_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        }
                      },
                      "additionalProperties": true
                    },
                    "upload_info": {
                      "type": "object",
                      "required": [
                        "upload_url"
                      ],
                      "properties": {
                        "upload_method": {
                          "type": "string"
                        },
                        "upload_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "curl_example": {
                          "type": "string"
                        },
                        "required_headers": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/worlds/media-assets/{id}": {
      "get": {
        "tags": [
          "Worlds"
        ],
        "summary": "Get World Labs media asset",
        "description": "Retrieves metadata for a World Labs media asset prepared through TokenLab. The media asset must belong to the authenticated organization.",
        "operationId": "getWorldMediaAsset",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Media asset ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Media asset metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "media_asset_id",
                    "file_name"
                  ],
                  "properties": {
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "file_name": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "image",
                        "video"
                      ]
                    },
                    "media_asset_id": {
                      "type": "string"
                    },
                    "extension": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "metadata": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true
                    },
                    "updated_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/worlds/generations": {
      "post": {
        "tags": [
          "Worlds"
        ],
        "summary": "Create world generation task",
        "description": "Creates a World Labs Marble world generation task for TokenLab-supported Marble models. Returns a task ID for polling. TokenLab supports native world_prompt media_asset references when the media asset was prepared through TokenLab.",
        "operationId": "createWorld",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [],
                "properties": {
                  "model": {
                    "type": "string",
                    "default": "marble-1.0",
                    "enum": [
                      "marble-1.0",
                      "marble-1.0-draft",
                      "marble-1.1",
                      "marble-1.1-plus"
                    ],
                    "description": "Marble model to use. Defaults to marble-1.0 when model is omitted."
                  },
                  "prompt": {
                    "type": "string",
                    "maxLength": 4000,
                    "description": "Text prompt used for text or guided image/video world generation."
                  },
                  "display_name": {
                    "type": "string",
                    "description": "Optional display name for the generated world, up to 64 characters.",
                    "maxLength": 64
                  },
                  "world_prompt": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Native World Labs world_prompt object for advanced callers. Supported prompt types are text, image, multi-image, and video. A content reference may be {\"source\": \"media_asset\", \"media_asset_id\": \"...\"} with an ID prepared by /v1/worlds/media-assets/prepare-upload."
                  },
                  "image": {
                    "type": "string",
                    "description": "Base64 or data URL image prompt."
                  },
                  "image_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Image URL prompt."
                  },
                  "images": {
                    "type": "array",
                    "description": "Shortcut multi-image prompts. Provide up to 4 images. Use native world_prompt.reconstruct_images=true for up to 8 images.",
                    "items": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "uri": {
                              "type": "string"
                            },
                            "image_url": {
                              "type": "string"
                            },
                            "url": {
                              "type": "string"
                            },
                            "azimuth": {
                              "type": "number"
                            }
                          },
                          "additionalProperties": true
                        }
                      ]
                    },
                    "maxItems": 4
                  },
                  "video_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Video URL prompt."
                  },
                  "is_pano": {
                    "oneOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "string",
                        "enum": [
                          "auto"
                        ]
                      }
                    ],
                    "description": "Whether an image prompt is an existing panorama. Use true for pano input, false for single-image input, or auto."
                  },
                  "seed": {
                    "type": "integer",
                    "description": "Optional seed from 0 through 4294967295.",
                    "minimum": 0,
                    "maximum": 4294967295
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 32
                    },
                    "description": "Optional World Labs tags. Provide up to 10 tags, each up to 32 characters.",
                    "maxItems": 10
                  },
                  "permission": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Optional visibility and access settings: public, allow_id_access, allowed_readers, and allowed_writers."
                  },
                  "user": {
                    "type": "string",
                    "description": "End-user identifier."
                  }
                },
                "anyOf": [
                  {
                    "required": [
                      "world_prompt"
                    ]
                  },
                  {
                    "required": [
                      "prompt"
                    ]
                  },
                  {
                    "required": [
                      "image"
                    ]
                  },
                  {
                    "required": [
                      "image_url"
                    ]
                  },
                  {
                    "required": [
                      "images"
                    ]
                  },
                  {
                    "required": [
                      "video_url"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "task_id": {
                      "type": "string"
                    },
                    "operation_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "completed",
                        "failed"
                      ]
                    },
                    "poll_url": {
                      "type": "string"
                    },
                    "world_id": {
                      "type": "string"
                    },
                    "world_marble_url": {
                      "type": "string"
                    },
                    "model_url": {
                      "type": "string"
                    },
                    "glb_url": {
                      "type": "string"
                    },
                    "pano_url": {
                      "type": "string"
                    },
                    "thumbnail_url": {
                      "type": "string"
                    },
                    "caption": {
                      "type": "string"
                    },
                    "error": {
                      "$ref": "#/components/schemas/AsyncTaskError"
                    },
                    "error_details": {
                      "$ref": "#/components/schemas/AsyncTaskErrorDetails"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyTask"
          }
        ]
      }
    },
    "/v1/worlds/generations/{id}": {
      "get": {
        "tags": [
          "Worlds"
        ],
        "summary": "Get world generation status",
        "description": "Retrieves the status and result of a World Labs Marble world generation task.",
        "operationId": "getWorldStatus",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "World generation task ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Task status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "status"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "task_id": {
                      "type": "string"
                    },
                    "operation_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "completed",
                        "failed",
                        "timeout"
                      ]
                    },
                    "world_id": {
                      "type": "string"
                    },
                    "world_marble_url": {
                      "type": "string"
                    },
                    "model_url": {
                      "type": "string"
                    },
                    "glb_url": {
                      "type": "string"
                    },
                    "pano_url": {
                      "type": "string"
                    },
                    "thumbnail_url": {
                      "type": "string"
                    },
                    "caption": {
                      "type": "string"
                    },
                    "error": {
                      "$ref": "#/components/schemas/AsyncTaskError"
                    },
                    "error_details": {
                      "$ref": "#/components/schemas/AsyncTaskErrorDetails"
                    },
                    "media_retention": {
                      "$ref": "#/components/schemas/MediaRetention"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/worlds/list": {
      "post": {
        "tags": [
          "Worlds"
        ],
        "summary": "List World Labs worlds",
        "description": "Lists World Labs worlds created through TokenLab for the authenticated organization. Results only include resources created through TokenLab.",
        "operationId": "listWorlds",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "page_size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20
                  },
                  "page_token": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "status": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "SUCCEEDED",
                      "PENDING",
                      "FAILED",
                      "RUNNING"
                    ]
                  },
                  "model": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "marble-1.0",
                      "marble-1.1",
                      "marble-1.1-plus",
                      "marble-1.0-draft"
                    ],
                    "description": "Model filter."
                  },
                  "tags": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    },
                    "description": "Tag filter. A world matches when it has at least one of the tags."
                  },
                  "is_public": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "created_after": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "created_before": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "sort_by": {
                    "type": "string",
                    "enum": [
                      "created_at",
                      "updated_at"
                    ],
                    "default": "created_at"
                  },
                  "sort_order": {
                    "type": "string",
                    "enum": [
                      "asc",
                      "desc"
                    ],
                    "default": "desc",
                    "description": "TokenLab extension for ascending or descending order."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "World list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "worlds"
                  ],
                  "properties": {
                    "worlds": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "world_id"
                        ],
                        "properties": {
                          "display_name": {
                            "type": "string"
                          },
                          "world_id": {
                            "type": "string"
                          },
                          "world_marble_url": {
                            "type": "string",
                            "format": "uri"
                          },
                          "assets": {
                            "type": "object",
                            "additionalProperties": true
                          },
                          "created_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "model": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "permission": {
                            "type": "object",
                            "additionalProperties": true
                          },
                          "tags": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "items": {
                              "type": "string"
                            }
                          },
                          "updated_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "world_prompt": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        },
                        "additionalProperties": true
                      }
                    },
                    "next_page_token": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/worlds/{id}": {
      "get": {
        "tags": [
          "Worlds"
        ],
        "summary": "Get World Labs world",
        "description": "Retrieves a World Labs world generated through TokenLab. The world ID must be owned by the authenticated organization.",
        "operationId": "getWorld",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "World ID."
          }
        ],
        "responses": {
          "200": {
            "description": "World details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "world_id"
                  ],
                  "properties": {
                    "display_name": {
                      "type": "string"
                    },
                    "world_id": {
                      "type": "string"
                    },
                    "world_marble_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "assets": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "created_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "model": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "permission": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "tags": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string"
                      }
                    },
                    "updated_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "world_prompt": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "tags": [
          "Worlds"
        ],
        "summary": "Delete World Labs world",
        "description": "Deletes a World Labs world generated through TokenLab. This permanently deletes the world and associated assets when World Labs accepts the deletion. TokenLab keeps task status records for usage history.",
        "operationId": "deleteWorld",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "World ID."
          }
        ],
        "responses": {
          "200": {
            "description": "World deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "deleted",
                    "world_id"
                  ],
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    },
                    "world_id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/videos/assets/groups": {
      "post": {
        "tags": [
          "Video"
        ],
        "summary": "Create Seedance material asset group",
        "description": "Creates a TokenLab Seedance virtual-avatar material group. Real-person material groups are created by GetVisualValidateResult after the H5 validation succeeds.",
        "operationId": "createSeedanceMaterialAssetGroup",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeedanceMaterialAssetGroupCreateRequest"
              },
              "examples": {
                "virtual_avatar_group": {
                  "summary": "Create a virtual-avatar material group",
                  "value": {
                    "library_type": "aigc_avatar",
                    "group_name": "Product references",
                    "description": "Reusable product shots"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Material asset group created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeedanceMaterialAssetGroup"
                },
                "examples": {
                  "group_created": {
                    "summary": "Material group created",
                    "value": {
                      "id": "group-20260720123456-vrt01",
                      "object": "seedance.material_asset_group",
                      "library_type": "aigc_avatar",
                      "group_name": "Product references",
                      "description": "Reusable product shots",
                      "status": "ACTIVE",
                      "metadata": null,
                      "created_at": 1782998400000
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "description": "Material group mapping conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/MaterialLibraryUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "Video"
        ],
        "summary": "List Seedance material asset groups",
        "description": "Lists Seedance material groups owned by the authenticated organization. Real-person groups are returned after GetVisualValidateResult succeeds.",
        "operationId": "listSeedanceMaterialAssetGroups",
        "parameters": [
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "DELETED"
              ]
            }
          },
          {
            "name": "library_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "aigc_avatar",
                "liveness_face"
              ]
            },
            "description": "Filter by TokenLab material library class."
          },
          {
            "name": "project_name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "default": "default"
            },
            "description": "Project scope for the material resource."
          }
        ],
        "responses": {
          "200": {
            "description": "Material asset groups",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeedanceMaterialAssetGroupList"
                },
                "examples": {
                  "groups": {
                    "summary": "Material groups",
                    "value": {
                      "groups": [
                        {
                          "id": "group-20260720123456-vrt01",
                          "object": "seedance.material_asset_group",
                          "library_type": "aigc_avatar",
                          "group_name": "Product references",
                          "description": "Reusable product shots",
                          "status": "ACTIVE",
                          "metadata": null,
                          "created_at": 1782998400000
                        },
                        {
                          "id": "group-20260720123456-real1",
                          "object": "seedance.material_asset_group",
                          "library_type": "liveness_face",
                          "group_name": "Creator A",
                          "description": null,
                          "status": "ACTIVE",
                          "metadata": null,
                          "created_at": 1782998400000
                        }
                      ],
                      "next_page_token": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/videos/assets/groups/{groupId}": {
      "get": {
        "tags": [
          "Video"
        ],
        "summary": "Get Seedance material asset group",
        "description": "Retrieves one TokenLab Seedance material group.",
        "operationId": "getSeedanceMaterialAssetGroup",
        "parameters": [
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "group-20260720123456-vrt01"
          },
          {
            "name": "project_name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "default": "default"
            },
            "description": "Project scope for the material resource."
          }
        ],
        "responses": {
          "200": {
            "description": "Material asset group",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeedanceMaterialAssetGroup"
                },
                "examples": {
                  "group": {
                    "summary": "Material group",
                    "value": {
                      "id": "group-20260720123456-vrt01",
                      "object": "seedance.material_asset_group",
                      "library_type": "aigc_avatar",
                      "group_name": "Product references",
                      "description": "Reusable product shots",
                      "status": "ACTIVE",
                      "metadata": null,
                      "created_at": 1782998400000
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/MaterialLibraryUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "Video"
        ],
        "summary": "Update Seedance material asset group",
        "description": "Updates display metadata for a TokenLab Seedance material group.",
        "operationId": "updateSeedanceMaterialAssetGroup",
        "parameters": [
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "group-20260720123456-vrt01"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeedanceMaterialAssetGroupUpdateRequest"
              },
              "examples": {
                "update_group": {
                  "summary": "Update group display fields",
                  "value": {
                    "group_name": "Updated references",
                    "description": "Images approved for summer videos"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Material asset group updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeedanceMaterialAssetGroup"
                },
                "examples": {
                  "group_updated": {
                    "summary": "Material group updated",
                    "value": {
                      "id": "group-20260720123456-vrt01",
                      "object": "seedance.material_asset_group",
                      "library_type": "aigc_avatar",
                      "group_name": "Updated references",
                      "description": "Images approved for summer videos",
                      "status": "ACTIVE",
                      "metadata": null,
                      "created_at": 1782998400000
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The material is still being prepared. Retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/MaterialLibraryUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "Video"
        ],
        "summary": "Delete Seedance material asset group",
        "description": "Deletes a TokenLab Seedance material group and its material assets. The operation is irreversible when accepted.",
        "operationId": "deleteSeedanceMaterialAssetGroup",
        "parameters": [
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "group-20260720123456-vrt01"
          },
          {
            "name": "project_name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "default": "default"
            },
            "description": "Project scope for the material resource."
          }
        ],
        "responses": {
          "200": {
            "description": "Material asset group deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeedanceMaterialAssetDeleteResponse"
                },
                "examples": {
                  "group_deleted": {
                    "summary": "Material group deleted",
                    "value": {
                      "deleted": true,
                      "id": "group-20260720123456-vrt01"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The material is still being prepared. Retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/MaterialLibraryUnavailable"
          }
        }
      }
    },
    "/api/v3/contents/generations/tasks": {
      "post": {
        "tags": [
          "Seedance Volc Compatible"
        ],
        "summary": "Create Seedance task (Volc wire-compatible)",
        "description": "Creates a Seedance 2.0 or Seedance 2.5 video task with the official Volc REST body and response shape. Authentication uses a TokenLab Bearer API key. TokenLab additionally accepts an optional Idempotency-Key header so a client can recover the same task ID after a lost create response.",
        "operationId": "createVolcCompatibleSeedanceTask",
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Client-generated key for idempotent REST task creation, 1-255 characters without line breaks. Under the same TokenLab API credential, reusing the same key with the same JSON body returns the original cgt task ID; reusing it with a different body returns 409 with code idempotency_conflict. A key that is too long or contains line breaks returns 400. Keep the credential, key, and request body unchanged when retrying after a timeout or disconnect."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VolcSeedanceCreateTaskRequest"
              },
              "example": {
                "model": "seedance-2.0",
                "content": [
                  {
                    "type": "text",
                    "text": "A cinematic forest at sunset"
                  },
                  {
                    "type": "image_url",
                    "role": "reference_image",
                    "image_url": {
                      "url": "https://example.com/ref.png"
                    }
                  }
                ],
                "ratio": "16:9",
                "duration": 5,
                "resolution": "720p",
                "generate_audio": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task created",
            "headers": {
              "Idempotency-Replayed": {
                "description": "Present with value true when this response recovered an earlier create request.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceCreateTaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or unsupported authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "409": {
            "description": "The Idempotency-Key was already used with a different request body (code idempotency_conflict).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "503": {
            "description": "The service or the requested Delivery tier is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Seedance Volc Compatible"
        ],
        "summary": "List Seedance tasks (Volc-compatible)",
        "description": "Lists Seedance compatibility tasks of the authenticated organization. Only tasks created through the Volc-compatible create endpoint are listed. Without filter.task_ids, the list covers the past seven days.",
        "operationId": "listVolcCompatibleSeedanceTasks",
        "parameters": [
          {
            "name": "page_num",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 1
            },
            "description": "Page number."
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 20
            },
            "description": "Page size."
          },
          {
            "name": "filter.status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "running",
                "succeeded",
                "failed",
                "cancelled",
                "expired"
              ]
            },
            "description": "Filter by task status."
          },
          {
            "name": "filter.task_ids",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Exact task IDs. Repeat filter.task_ids for multiple IDs."
          },
          {
            "name": "filter.model",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by the model value sent when the task was created."
          },
          {
            "name": "filter.service_tier",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "default",
                "flex"
              ]
            },
            "description": "Filter by service tier."
          }
        ],
        "responses": {
          "200": {
            "description": "Task list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceTaskListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or unsupported authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v3/contents/generations/tasks/{id}": {
      "get": {
        "tags": [
          "Seedance Volc Compatible"
        ],
        "summary": "Get Seedance task (Volc-compatible)",
        "operationId": "getVolcCompatibleSeedanceTask",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Compatibility task ID returned by the create endpoint. IDs start with cgt-."
          }
        ],
        "responses": {
          "200": {
            "description": "Task status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceTask"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or unsupported authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "403": {
            "description": "The task belongs to another organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "404": {
            "description": "Task not found or expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Seedance Volc Compatible"
        ],
        "summary": "Cancel Seedance task (Volc-compatible)",
        "operationId": "deleteVolcCompatibleSeedanceTask",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Compatibility task ID returned by the create endpoint. IDs start with cgt-."
          }
        ],
        "responses": {
          "200": {
            "description": "Cancellation accepted. The response body is empty. Only a queued task can be cancelled."
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or unsupported authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "403": {
            "description": "The task belongs to another organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "404": {
            "description": "Task not found or expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "409": {
            "description": "The task is no longer queued (code task_not_cancellable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v3": {
      "get": {
        "tags": [
          "Seedance Volc Compatible"
        ],
        "summary": "Seedance Action dispatcher (GET)",
        "description": "Dispatches Volc-style Action requests. Use Version=2024-01-01 or omit Version.",
        "operationId": "dispatchVolcCompatibleSeedanceActionGet",
        "parameters": [
          {
            "name": "Action",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "CreateContentsGenerationsTasks",
                "GetContentsGenerationsTask",
                "ListContentsGenerationsTasks",
                "DeleteContentsGenerationsTasks"
              ]
            }
          },
          {
            "name": "Version",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "2024-01-01"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Action response. Create/Get/List actions return JSON; DeleteContentsGenerationsTasks returns an empty body.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/VolcSeedanceCreateTaskResponse"
                    },
                    {
                      "$ref": "#/components/schemas/VolcSeedanceTask"
                    },
                    {
                      "$ref": "#/components/schemas/VolcSeedanceTaskListResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or unsupported authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VolcSeedanceError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Seedance Volc Compatible"
        ],
        "summary": "Seedance Action dispatcher (POST)",
        "description": "Dispatches Volc-style Action requests with TokenLab Bearer authentication. Real-person validation and material asset Actions use Version=2024-01-01 and are POST-only. The same POST contract is also available at the API root for endpoint-only migration from Volcengine.",
        "operationId": "dispatchVolcCompatibleSeedanceActionPost",
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          },
          {
            "name": "Action",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "CreateContentsGenerationsTasks",
                "GetContentsGenerationsTask",
                "ListContentsGenerationsTasks",
                "DeleteContentsGenerationsTasks",
                "CreateVisualValidateSession",
                "GetVisualValidateResult",
                "CreateAssetGroup",
                "ListAssetGroups",
                "GetAssetGroup",
                "UpdateAssetGroup",
                "DeleteAssetGroup",
                "CreateAsset",
                "ListAssets",
                "GetAsset",
                "UpdateAsset",
                "DeleteAsset"
              ]
            }
          },
          {
            "name": "Version",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "2024-01-01"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/VolcCreateVisualValidateSessionRequest"
                  },
                  {
                    "$ref": "#/components/schemas/VolcGetVisualValidateResultRequest"
                  },
                  {
                    "$ref": "#/components/schemas/VolcMaterialActionRequest"
                  },
                  {
                    "type": "object",
                    "additionalProperties": true
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Action response. Content-generation actions return task JSON; real-person validation and material asset actions return the official ResponseMetadata + Result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/VolcSeedanceCreateTaskResponse"
                    },
                    {
                      "$ref": "#/components/schemas/VolcSeedanceTask"
                    },
                    {
                      "$ref": "#/components/schemas/VolcSeedanceTaskListResponse"
                    },
                    {
                      "$ref": "#/components/schemas/VolcCreateVisualValidateSessionResponse"
                    },
                    {
                      "$ref": "#/components/schemas/VolcGetVisualValidateResultResponse"
                    },
                    {
                      "$ref": "#/components/schemas/VolcMaterialActionResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/VolcSeedanceError"
                    },
                    {
                      "$ref": "#/components/schemas/VolcVisualValidationError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or unsupported authentication",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/VolcSeedanceError"
                    },
                    {
                      "$ref": "#/components/schemas/VolcVisualValidationError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Access denied",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/VolcSeedanceError"
                    },
                    {
                      "$ref": "#/components/schemas/VolcVisualValidationError"
                    }
                  ]
                }
              }
            }
          },
          "405": {
            "description": "Action does not support this HTTP method",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/VolcSeedanceError"
                    },
                    {
                      "$ref": "#/components/schemas/VolcVisualValidationError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Conflict: Idempotency-Key reuse, task not cancellable, material group mapping conflict, or a verified real-person group that cannot be deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/VolcSeedanceError"
                    },
                    {
                      "$ref": "#/components/schemas/VolcVisualValidationError"
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "The request could not be processed, for example a material source failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/VolcSeedanceError"
                    },
                    {
                      "$ref": "#/components/schemas/VolcVisualValidationError"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/VolcSeedanceError"
                    },
                    {
                      "$ref": "#/components/schemas/VolcVisualValidationError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/VolcSeedanceError"
                    },
                    {
                      "$ref": "#/components/schemas/VolcVisualValidationError"
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "The service is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/VolcSeedanceError"
                    },
                    {
                      "$ref": "#/components/schemas/VolcVisualValidationError"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/systemone": {
      "post": {
        "tags": [
          "Decisions"
        ],
        "summary": "Evaluate decision questions",
        "description": "Evaluate state with named probability, choice, and ordered score questions. Synchronous JSON only. Token usage is reported when available; zero-priced output tokens are still included.",
        "operationId": "createSystemOneDecision",
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryPolicy"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "state",
                  "questions"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "minLength": 1
                  },
                  "state": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "additionalProperties": true
                      },
                      {
                        "type": "array",
                        "items": {}
                      }
                    ]
                  },
                  "questions": {
                    "type": "object",
                    "minProperties": 1,
                    "additionalProperties": {
                      "oneOf": [
                        {
                          "type": "object",
                          "required": [
                            "type",
                            "instructions"
                          ],
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "noul"
                              ]
                            },
                            "instructions": {
                              "oneOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": true
                                },
                                {
                                  "type": "array",
                                  "items": {}
                                }
                              ]
                            },
                            "criteria": {
                              "type": "object",
                              "properties": {
                                "true": {
                                  "oneOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": true
                                    },
                                    {
                                      "type": "array",
                                      "items": {}
                                    }
                                  ]
                                },
                                "false": {
                                  "oneOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": true
                                    },
                                    {
                                      "type": "array",
                                      "items": {}
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "true",
                                "false"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "required": [
                            "type",
                            "instructions",
                            "criteria"
                          ],
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "choice"
                              ]
                            },
                            "instructions": {
                              "oneOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": true
                                },
                                {
                                  "type": "array",
                                  "items": {}
                                }
                              ]
                            },
                            "criteria": {
                              "type": "object",
                              "minProperties": 1,
                              "maxProperties": 255,
                              "additionalProperties": {
                                "oneOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": true
                                  },
                                  {
                                    "type": "array",
                                    "items": {}
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            }
                          },
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "required": [
                            "type",
                            "instructions",
                            "criteria"
                          ],
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "score"
                              ]
                            },
                            "instructions": {
                              "oneOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": true
                                },
                                {
                                  "type": "array",
                                  "items": {}
                                }
                              ]
                            },
                            "criteria": {
                              "type": "array",
                              "minItems": 2,
                              "maxItems": 10,
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": true
                                  },
                                  {
                                    "type": "array",
                                    "items": {}
                                  }
                                ]
                              }
                            }
                          },
                          "additionalProperties": false
                        }
                      ]
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Decision results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "model",
                    "answers"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "answers": {
                      "type": "object",
                      "additionalProperties": {
                        "oneOf": [
                          {
                            "type": "object",
                            "required": [
                              "type",
                              "noul"
                            ],
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "noul"
                                ]
                              },
                              "noul": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1
                              }
                            },
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "required": [
                              "type",
                              "choice"
                            ],
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "choice"
                                ]
                              },
                              "choice": {
                                "type": "string"
                              },
                              "probabilities": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                }
                              },
                              "confidence": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1
                              }
                            },
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "required": [
                              "type",
                              "score"
                            ],
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "score"
                                ]
                              },
                              "score": {
                                "type": "number",
                                "minimum": 0
                              },
                              "probabilities": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                }
                              },
                              "confidence": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1
                              },
                              "legend": {
                                "type": "object",
                                "additionalProperties": {
                                  "oneOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": true
                                    },
                                    {
                                      "type": "array",
                                      "items": {}
                                    }
                                  ]
                                }
                              }
                            },
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "usage": {
                      "type": "object",
                      "required": [
                        "input_tokens",
                        "output_tokens"
                      ],
                      "properties": {
                        "input_tokens": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "output_tokens": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/DeliveryUnavailable"
          }
        }
      }
    },
    "/v1/management/webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook endpoints",
        "description": "Requires a workspace Management Token (mt-...), created at Dashboard > API > Management Tokens. Send Authorization: Bearer mt-.... Inference API keys (sk-...) and webhook signing secrets (whsec_...) are not accepted. Only the token workspace is accessible.",
        "operationId": "listWebhooks",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List webhook endpoints result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Webhook not found in this workspace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Endpoint quota reached or endpoint paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        },
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ]
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Create webhook endpoint",
        "description": "Requires a workspace Management Token (mt-...), created at Dashboard > API > Management Tokens. Send Authorization: Bearer mt-.... Inference API keys (sk-...) and webhook signing secrets (whsec_...) are not accepted. Only the token workspace is accessible. The full whsec_ signing secret is returned only on creation or rotation. Store it securely; GET/list never return it. Rotation takes effect immediately for new deliveries; already in-flight deliveries can still use the previous secret. Up to 10 endpoints per workspace. Subscriptions cover future terminal async task events; existing tasks are not replayed.",
        "operationId": "createWebhook",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Create webhook endpoint result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedWebhookEndpoint"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Webhook not found in this workspace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Endpoint quota reached or endpoint paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookEndpointRequest"
              }
            }
          }
        }
      }
    },
    "/v1/management/webhooks/{webhookId}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Retrieve webhook endpoint",
        "description": "Requires a workspace Management Token (mt-...), created at Dashboard > API > Management Tokens. Send Authorization: Bearer mt-.... Inference API keys (sk-...) and webhook signing secrets (whsec_...) are not accepted. Only the token workspace is accessible.",
        "operationId": "getWebhook",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Retrieve webhook endpoint result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Webhook not found in this workspace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Endpoint quota reached or endpoint paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        },
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ]
      },
      "patch": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Update webhook endpoint",
        "description": "Requires a workspace Management Token (mt-...), created at Dashboard > API > Management Tokens. Send Authorization: Bearer mt-.... Inference API keys (sk-...) and webhook signing secrets (whsec_...) are not accepted. Only the token workspace is accessible.",
        "operationId": "updateWebhook",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Update webhook endpoint result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Webhook not found in this workspace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Endpoint quota reached or endpoint paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        },
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookEndpointRequest"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete webhook endpoint",
        "description": "Requires a workspace Management Token (mt-...), created at Dashboard > API > Management Tokens. Send Authorization: Bearer mt-.... Inference API keys (sk-...) and webhook signing secrets (whsec_...) are not accepted. Only the token workspace is accessible.",
        "operationId": "deleteWebhook",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Delete webhook endpoint result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedWebhookEndpoint"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Webhook not found in this workspace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Endpoint quota reached or endpoint paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        },
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ]
      }
    },
    "/v1/management/webhooks/{webhookId}/rotate-secret": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Rotate webhook signing secret",
        "description": "Requires a workspace Management Token (mt-...), created at Dashboard > API > Management Tokens. Send Authorization: Bearer mt-.... Inference API keys (sk-...) and webhook signing secrets (whsec_...) are not accepted. Only the token workspace is accessible. The full whsec_ signing secret is returned only on creation or rotation. Store it securely; GET/list never return it. Rotation takes effect immediately for new deliveries; already in-flight deliveries can still use the previous secret.",
        "operationId": "rotateWebhookSecret",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Rotate webhook signing secret result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedWebhookEndpoint"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Webhook not found in this workspace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Endpoint quota reached or endpoint paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        },
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ]
      }
    },
    "/v1/management/webhooks/{webhookId}/test": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a test webhook",
        "description": "Requires a workspace Management Token (mt-...), created at Dashboard > API > Management Tokens. Send Authorization: Bearer mt-.... Inference API keys (sk-...) and webhook signing secrets (whsec_...) are not accepted. Only the token workspace is accessible. Sends webhook.test through the same signed delivery path. HTTP 200 reports a persisted attempt; inspect outcome and http_status to determine receiver success. Resume a paused endpoint before testing.",
        "operationId": "testWebhook",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Send a test webhook result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Webhook not found in this workspace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Endpoint quota reached or endpoint paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        },
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ]
      }
    },
    "/v1/management/webhooks/{webhookId}/deliveries": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook deliveries",
        "description": "Requires a workspace Management Token (mt-...), created at Dashboard > API > Management Tokens. Send Authorization: Bearer mt-.... Inference API keys (sk-...) and webhook signing secrets (whsec_...) are not accepted. Only the token workspace is accessible. Returns cumulative attempts and latest outcome per event and endpoint. A previously confirmed delivery remains delivered even if a duplicate fails. History contains no payloads or signing secrets; no manual replay operation is provided.",
        "operationId": "listWebhookDeliveries",
        "security": [
          {
            "ManagementTokenAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List webhook deliveries result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Webhook not found in this workspace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Endpoint quota reached or endpoint paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "simple"
          }
        },
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ]
      }
    },
    "/v1beta/files:register": {
      "post": {
        "tags": [
          "Gemini Resources"
        ],
        "operationId": "geminiRegisterFiles",
        "summary": "Register Gemini files",
        "description": "Registers files from a supported source using Gemini JSON. The service validates the source and request fields. Resources can only be read, referenced, changed, or deleted in their owning Workspace. Missing, expired, or inaccessible resources return a Gemini-format error.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "API key alternative to Bearer or x-goog-api-key."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Reuse the same key and request body when recovering a create response. A different body with the same key returns a conflict."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/GeminiFileResource"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "file": {
                          "$ref": "#/components/schemas/GeminiFileResource"
                        },
                        "files": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/GeminiFileResource"
                          }
                        }
                      },
                      "additionalProperties": true
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "401": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "403": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "404": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "409": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "429": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "502": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "503": {
            "$ref": "#/components/responses/GeminiResourceError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiFileRegisterRequest"
              }
            }
          }
        }
      }
    },
    "/v1beta/files": {
      "post": {
        "tags": [
          "Gemini Resources"
        ],
        "operationId": "geminiCreateFile",
        "summary": "Create Gemini file metadata",
        "description": "Creates a Gemini file resource from JSON metadata. Upload file bytes through /upload/v1beta/files. Resources can only be read, referenced, changed, or deleted in their owning Workspace. Missing, expired, or inaccessible resources return a Gemini-format error.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "API key alternative to Bearer or x-goog-api-key."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Reuse the same key and request body when recovering a create response. A different body with the same key returns a conflict."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/GeminiFileResource"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "file": {
                          "$ref": "#/components/schemas/GeminiFileResource"
                        },
                        "files": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/GeminiFileResource"
                          }
                        }
                      },
                      "additionalProperties": true
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "401": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "403": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "404": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "409": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "429": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "502": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "503": {
            "$ref": "#/components/responses/GeminiResourceError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiFileCreateRequest"
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Gemini Resources"
        ],
        "operationId": "geminiListFiles",
        "summary": "List Gemini files",
        "description": "Lists files belonging to the current Workspace. `pageSize` defaults to 50 and is at most 100. Use `nextPageToken` as `pageToken` to continue; an invalid `pageToken` returns 400. Resources can only be read, referenced, changed, or deleted in their owning Workspace. Missing, expired, or inaccessible resources return a Gemini-format error.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "API key alternative to Bearer or x-goog-api-key."
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Requested page size, 1 to 100. Default: 50. page_size is also accepted."
          },
          {
            "name": "pageToken",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque nextPageToken from the previous response. page_token is also accepted."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "files": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/GeminiFileResource"
                      }
                    },
                    "nextPageToken": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "files"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "401": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "403": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "404": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "409": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "429": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "502": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "503": {
            "$ref": "#/components/responses/GeminiResourceError"
          }
        }
      }
    },
    "/v1beta/files/{fileId}": {
      "get": {
        "tags": [
          "Gemini Resources"
        ],
        "operationId": "geminiGetFile",
        "summary": "Get Gemini file",
        "description": "Reads metadata for a Gemini file. Resources can only be read, referenced, changed, or deleted in their owning Workspace. Missing, expired, or inaccessible resources return a Gemini-format error.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Suffix of the returned files/{fileId} name."
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "API key alternative to Bearer or x-goog-api-key."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiFileResource"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "401": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "403": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "404": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "409": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "429": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "502": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "503": {
            "$ref": "#/components/responses/GeminiResourceError"
          }
        }
      },
      "delete": {
        "tags": [
          "Gemini Resources"
        ],
        "operationId": "geminiDeleteFile",
        "summary": "Delete Gemini file",
        "description": "Deletes a Gemini file. Save anything needed before deletion. Resources can only be read, referenced, changed, or deleted in their owning Workspace. Missing, expired, or inaccessible resources return a Gemini-format error.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "API key alternative to Bearer or x-goog-api-key."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "401": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "403": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "404": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "409": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "429": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "502": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "503": {
            "$ref": "#/components/responses/GeminiResourceError"
          }
        }
      }
    },
    "/v1beta/cachedContents": {
      "post": {
        "tags": [
          "Gemini Resources"
        ],
        "operationId": "geminiCreateCachedContent",
        "summary": "Create Gemini cached content",
        "description": "Creates cached content for a current TokenLab Gemini model. Supported fields, resource references, and lifetime depend on the service and model; lowerCamelCase and the corresponding proto snake_case names are accepted. Resources can only be read, referenced, changed, or deleted in their owning Workspace. Missing, expired, or inaccessible resources return a Gemini-format error.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "API key alternative to Bearer or x-goog-api-key."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Reuse the same key and request body when recovering a create response. A different body with the same key returns a conflict."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiCachedContentResource"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "401": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "403": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "404": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "409": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "429": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "502": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "503": {
            "$ref": "#/components/responses/GeminiResourceError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiCachedContentRequest"
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Gemini Resources"
        ],
        "operationId": "geminiListCachedContents",
        "summary": "List Gemini cached content",
        "description": "Lists cached content belonging to the current Workspace. `pageSize` defaults to 50 and is at most 100. Use `nextPageToken` as `pageToken` to continue; an invalid `pageToken` returns 400. Resources can only be read, referenced, changed, or deleted in their owning Workspace. Missing, expired, or inaccessible resources return a Gemini-format error.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "API key alternative to Bearer or x-goog-api-key."
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Requested page size, 1 to 100. Default: 50. page_size is also accepted."
          },
          {
            "name": "pageToken",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque nextPageToken from the previous response. page_token is also accepted."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "cachedContents"
                  ],
                  "properties": {
                    "cachedContents": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/GeminiCachedContentResource"
                      }
                    },
                    "nextPageToken": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "401": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "403": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "404": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "409": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "429": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "502": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "503": {
            "$ref": "#/components/responses/GeminiResourceError"
          }
        }
      }
    },
    "/v1beta/cachedContents/{cacheId}": {
      "get": {
        "tags": [
          "Gemini Resources"
        ],
        "operationId": "geminiGetCachedContent",
        "summary": "Get Gemini cached content",
        "description": "Reads cached content metadata. Resources can only be read, referenced, changed, or deleted in their owning Workspace. Missing, expired, or inaccessible resources return a Gemini-format error.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "cacheId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Suffix of the returned cachedContents/{cacheId} name."
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "API key alternative to Bearer or x-goog-api-key."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiCachedContentResource"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "401": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "403": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "404": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "409": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "429": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "502": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "503": {
            "$ref": "#/components/responses/GeminiResourceError"
          }
        }
      },
      "patch": {
        "tags": [
          "Gemini Resources"
        ],
        "operationId": "geminiUpdateCachedContent",
        "summary": "Update Gemini cached content",
        "description": "Updates the cache lifetime. Invalid lifetime or unsupported fields return a Gemini-format error. Resources can only be read, referenced, changed, or deleted in their owning Workspace. Missing, expired, or inaccessible resources return a Gemini-format error.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "cacheId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "API key alternative to Bearer or x-goog-api-key."
          },
          {
            "name": "updateMask",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Gemini field mask when required by the service."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiCachedContentResource"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "401": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "403": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "404": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "409": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "429": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "502": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "503": {
            "$ref": "#/components/responses/GeminiResourceError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiCachedContentUpdateRequest"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Gemini Resources"
        ],
        "operationId": "geminiDeleteCachedContent",
        "summary": "Delete Gemini cached content",
        "description": "Deletes cached content. It cannot be used by subsequent generation after deletion. Resources can only be read, referenced, changed, or deleted in their owning Workspace. Missing, expired, or inaccessible resources return a Gemini-format error.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "cacheId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "API key alternative to Bearer or x-goog-api-key."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "401": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "403": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "404": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "409": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "429": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "502": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "503": {
            "$ref": "#/components/responses/GeminiResourceError"
          }
        }
      }
    },
    "/upload/v1beta/files": {
      "post": {
        "tags": [
          "Gemini Resources"
        ],
        "operationId": "geminiUploadFile",
        "summary": "Upload Gemini file",
        "description": "Uploads bytes or starts a resumable upload. For resumable start, send metadata and read X-Goog-Upload-URL. Continue only at that returned URL. The upload URL grants access to that upload, expires after one hour, and must be kept private. Resources can only be read, referenced, changed, or deleted in their owning Workspace. Missing, expired, or inaccessible resources return a Gemini-format error.",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "GeminiApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "API key alternative to Bearer or x-goog-api-key."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Reuse the same key and request body when recovering a create response. A different body with the same key returns a conflict."
          },
          {
            "name": "X-Goog-Upload-Protocol",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Upload protocol such as resumable."
          },
          {
            "name": "X-Goog-Upload-Command",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Upload command such as start or upload, finalize."
          },
          {
            "name": "X-Goog-Upload-Header-Content-Length",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Expected file byte length when starting a resumable upload."
          },
          {
            "name": "X-Goog-Upload-Header-Content-Type",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "File MIME type when starting a resumable upload."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "file": {
                      "$ref": "#/components/schemas/GeminiFileResource"
                    }
                  },
                  "additionalProperties": true
                }
              }
            },
            "headers": {
              "X-Goog-Upload-URL": {
                "description": "Private resumable upload URL; returned for resumable start. Use it as supplied.",
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "401": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "403": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "404": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "409": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "429": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "502": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "503": {
            "$ref": "#/components/responses/GeminiResourceError"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiFileCreateRequest"
              }
            },
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "*/*": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "none"
          }
        }
      }
    },
    "/upload/v1beta/files/session/{sessionId}": {
      "post": {
        "tags": [
          "Gemini Resources"
        ],
        "operationId": "geminiContinueFileUpload",
        "summary": "Continue Gemini file upload",
        "description": "Sends bytes or commands to the exact URL returned by resumable start. The session in the URL authorizes this upload; an API key is not required. Keep the URL private. A missing or expired session returns 404; a session that can no longer be continued returns 410. A nonterminal chunk can return 308, so do not treat that response as a page redirect.",
        "security": [],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Goog-Upload-Command",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Upload command such as upload, finalize."
          },
          {
            "name": "X-Goog-Upload-Offset",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Zero-based byte offset of the chunk."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "file": {
                      "$ref": "#/components/schemas/GeminiFileResource"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "308": {
            "description": "Upload chunk accepted; more data or finalization is needed."
          },
          "400": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "401": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "403": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "404": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "409": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "410": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "429": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "502": {
            "$ref": "#/components/responses/GeminiResourceError"
          },
          "503": {
            "$ref": "#/components/responses/GeminiResourceError"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "*/*": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "x-mint": {
          "metadata": {
            "playground": "none"
          }
        }
      }
    },
    "/v1/media-results/{id}": {
      "get": {
        "tags": [
          "Media Results"
        ],
        "summary": "Get a media result",
        "description": "Returns a generated image, video, audio or downloadable 3D result. Result URLs have this form and stay valid for 30 days from when the result is first recorded. Use the URL exactly as you received it: its token grants access, and no API key is needed.",
        "operationId": "getMediaResult",
        "security": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Result ID, followed by the file extension, for example `.png`, `.mp4`, `.mp3` or `.glb`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "token",
            "in": "query",
            "required": true,
            "description": "Access token from the URL you received.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          {
            "name": "metadata",
            "in": "query",
            "required": false,
            "description": "Return the saving status as JSON instead of the file.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file, or the saving status when `metadata=true`.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "expires_at",
                    "kind"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "saving",
                        "saved",
                        "failed",
                        "expired"
                      ]
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "content_type": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "image",
                        "video",
                        "audio",
                        "3d"
                      ]
                    }
                  }
                },
                "example": {
                  "status": "saved",
                  "expires_at": "2026-11-06T08:00:00.000Z",
                  "content_type": "video/mp4",
                  "kind": "video"
                }
              }
            }
          },
          "302": {
            "description": "Redirect to a short-lived download URL for a saved image, video or audio file. The download URL lasts at most five minutes."
          },
          "404": {
            "description": "`media_not_found`: the token or file extension does not match the result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "410": {
            "description": "`media_expired`: the 30-day period has ended, or saving failed more than 24 hours ago.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "502": {
            "description": "`media_unavailable`: the result is not available now. Retry after the `Retry-After` delay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "503": {
            "description": "`media_unavailable`: the result is not available now. Retry after the `Retry-After` delay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "API Key authentication. Create or manage API keys in [Dashboard > API > API Keys](https://tokenlab.sh/dashboard/api?tab=keys)."
      },
      "ManagementTokenAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Management Token",
        "description": "Management token authentication. Create or manage Management Tokens in [Dashboard > API > Management Tokens](https://tokenlab.sh/dashboard/api?tab=tokens)."
      },
      "GeminiApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-goog-api-key",
        "description": "TokenLab API key for Gemini requests."
      }
    },
    "schemas": {
      "ChatCompletionRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "ID of the model to use (e.g., gpt-5.4, claude-sonnet-4-6)",
            "example": "gpt-4o"
          },
          "messages": {
            "type": "array",
            "description": "A list of messages comprising the conversation",
            "items": {
              "$ref": "#/components/schemas/ChatMessage"
            },
            "minItems": 1
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "description": "Sampling temperature. Range and default depend on the model."
          },
          "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Nucleus sampling probability. The default depends on the model."
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 128,
            "default": 1,
            "description": "Number of completions. Many models accept only 1."
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "If true, returns a stream of server-sent events that ends with `data: [DONE]`."
          },
          "stop": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ],
            "description": "Stop sequences. The number of sequences allowed depends on the model."
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "Maximum output tokens, including thinking tokens. Send max_tokens or max_completion_tokens, not both."
          },
          "max_completion_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "Maximum output tokens, including thinking tokens. Send only one of this and max_tokens."
          },
          "presence_penalty": {
            "type": "number",
            "minimum": -2,
            "maximum": 2,
            "default": 0,
            "description": "Presence penalty (-2 to 2)"
          },
          "frequency_penalty": {
            "type": "number",
            "minimum": -2,
            "maximum": 2,
            "default": 0,
            "description": "Frequency penalty (-2 to 2)"
          },
          "tools": {
            "type": "array",
            "description": "List of tools the model may call",
            "items": {
              "$ref": "#/components/schemas/Tool"
            }
          },
          "functions": {
            "type": "array",
            "description": "Deprecated function definitions retained by the official Chat Completions contract.",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "function_call": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "additionalProperties": true
              }
            ],
            "description": "Deprecated function-call selection retained by the official Chat Completions contract."
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "none",
                  "auto",
                  "required"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "function"
                    ]
                  },
                  "function": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name"
                    ]
                  }
                },
                "required": [
                  "type",
                  "function"
                ]
              }
            ],
            "description": "Controls which function is called"
          },
          "response_format": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "text",
                  "json_object",
                  "json_schema"
                ]
              },
              "json_schema": {
                "type": "object",
                "description": "Required when type is json_schema.",
                "required": [
                  "name",
                  "schema"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "schema": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "strict": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                }
              }
            },
            "description": "Response format. json_object and json_schema support depends on the model."
          },
          "seed": {
            "type": "integer",
            "description": "Seed for repeatable output, where supported. Not guaranteed."
          },
          "user": {
            "type": "string",
            "description": "End-user identifier for abuse detection"
          },
          "stream_options": {
            "type": "object",
            "description": "Streaming options.",
            "properties": {
              "include_usage": {
                "type": "boolean",
                "description": "When true, the stream carries one extra chunk with token usage before data: [DONE]. Without it, the stream carries no usage."
              }
            },
            "additionalProperties": true
          },
          "parallel_tool_calls": {
            "type": "boolean",
            "description": "Whether the model may issue parallel tool calls."
          },
          "reasoning_effort": {
            "type": "string",
            "description": "Reasoning effort. Values depend on the model; an unsupported value returns 400 invalid_value."
          },
          "logprobs": {
            "type": "boolean",
            "description": "Whether to return log probabilities for output tokens."
          },
          "top_logprobs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "description": "Number of most likely tokens to return at each position when logprobs is enabled."
          },
          "logit_bias": {
            "type": "object",
            "additionalProperties": {
              "type": "number",
              "minimum": -100,
              "maximum": 100
            },
            "description": "Token ID to bias (-100 to 100). Support depends on the model."
          },
          "modalities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Requested output modalities such as text or audio."
          },
          "audio": {
            "type": "object",
            "additionalProperties": true,
            "description": "Audio output configuration when requesting audio modality."
          },
          "translation_options": {
            "type": "object",
            "required": [
              "target_lang"
            ],
            "properties": {
              "source_lang": {
                "type": "string",
                "description": "Source language code. Omit when the model supports automatic detection."
              },
              "target_lang": {
                "type": "string",
                "description": "Target language code."
              }
            },
            "description": "Language settings for models that translate audio or video through Chat Completions."
          },
          "prediction": {
            "type": "object",
            "additionalProperties": true,
            "description": "Prediction hints for models that support draft or speculative decoding."
          },
          "service_tier": {
            "type": [
              "string",
              "null"
            ],
            "description": "TokenLab serves this request at the standard service tier. auto and default are forwarded. Other values, such as flex, priority, fast and ultrafast, are ignored and billed at the standard price."
          },
          "anthropic_options": {
            "type": "object",
            "description": "Options for Claude models.",
            "properties": {
              "prompt_caching": {
                "type": "boolean",
                "description": "Set true to cache the start of the prompt on Claude models. TokenLab marks the end of the system prompt and the latest user message as cache points. Use either this option or your own cache_control marks, not both."
              },
              "prompt_caching_ttl": {
                "type": "string",
                "enum": [
                  "5m",
                  "1h"
                ],
                "description": "Cache lifetime. Defaults to 5m. When the service that handles the request cannot keep a cache for 1h, TokenLab can use the 5-minute cache instead of rejecting the request."
              }
            },
            "additionalProperties": true
          },
          "extra": {
            "type": "object",
            "description": "Extension options. extra.prompt_caching and extra.prompt_caching_ttl are the same as the anthropic_options fields.",
            "properties": {
              "prompt_caching": {
                "type": "boolean",
                "description": "Set true to cache the start of the prompt on Claude models. TokenLab marks the end of the system prompt and the latest user message as cache points. Use either this option or your own cache_control marks, not both."
              },
              "prompt_caching_ttl": {
                "type": "string",
                "enum": [
                  "5m",
                  "1h"
                ],
                "description": "Cache lifetime. Defaults to 5m. When the service that handles the request cannot keep a cache for 1h, TokenLab can use the 5-minute cache instead of rejecting the request."
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "ChatMessage": {
        "type": "object",
        "required": [
          "role"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "user",
              "assistant",
              "function",
              "tool",
              "developer"
            ],
            "description": "The role of the message author"
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "text"
                          ]
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "image_url"
                          ]
                        },
                        "image_url": {
                          "type": "object",
                          "properties": {
                            "url": {
                              "type": "string"
                            },
                            "detail": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "low",
                                "high"
                              ]
                            }
                          },
                          "required": [
                            "url"
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "image_url"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "video_url"
                          ]
                        },
                        "video_url": {
                          "type": "object",
                          "properties": {
                            "url": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "url"
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "video_url"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "input_audio"
                          ]
                        },
                        "input_audio": {
                          "type": "object",
                          "properties": {
                            "data": {
                              "type": "string",
                              "description": "Public audio URL or Base64 data URL."
                            },
                            "format": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "data"
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "input_audio"
                      ]
                    }
                  ]
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Message content (text or multimodal)"
          },
          "name": {
            "type": "string",
            "description": "Name of the function/tool (for function/tool messages)"
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ToolCall"
            },
            "description": "Tool calls made by the assistant"
          },
          "tool_call_id": {
            "type": "string",
            "description": "ID of the tool call being responded to"
          },
          "reasoning_details": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "description": "Assistant messages only: the reasoning_details returned in an earlier response, sent back unchanged."
          }
        }
      },
      "Tool": {
        "type": "object",
        "required": [
          "type",
          "function"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "function"
            ],
            "description": "Tool type (currently only 'function')"
          },
          "function": {
            "$ref": "#/components/schemas/FunctionDefinition"
          }
        }
      },
      "FunctionDefinition": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 64,
            "description": "Function name"
          },
          "description": {
            "type": "string",
            "description": "Function description"
          },
          "parameters": {
            "type": "object",
            "description": "JSON Schema for function parameters"
          }
        }
      },
      "ToolCall": {
        "type": "object",
        "required": [
          "id",
          "type",
          "function"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Tool call ID"
          },
          "type": {
            "type": "string",
            "enum": [
              "function"
            ]
          },
          "function": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "arguments": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "arguments"
            ]
          }
        }
      },
      "ChatCompletionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the completion",
            "example": "chatcmpl-abc123"
          },
          "object": {
            "type": "string",
            "enum": [
              "chat.completion"
            ],
            "description": "Object type"
          },
          "created": {
            "type": "integer",
            "description": "Unix timestamp of creation"
          },
          "model": {
            "type": "string",
            "description": "Model used for completion"
          },
          "choices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatChoice"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/UsageInfo"
          },
          "system_fingerprint": {
            "type": "string",
            "description": "System fingerprint"
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices"
        ]
      },
      "ChatChoice": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "description": "Choice index"
          },
          "message": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string",
                "enum": [
                  "assistant"
                ]
              },
              "content": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tool_calls": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ToolCall"
                }
              },
              "refusal": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "reasoning_content": {
                "type": "string",
                "description": "Thinking text, when the model thinks. Some models return only a summary, or no text."
              },
              "reasoning_details": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                },
                "description": "Thinking blocks with their signatures. To continue a conversation with thinking, send them back unchanged in the assistant message."
              }
            }
          },
          "finish_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "stop",
              "length",
              "tool_calls",
              "content_filter"
            ],
            "description": "Reason for completion"
          }
        },
        "required": [
          "index",
          "message",
          "finish_reason"
        ]
      },
      "UsageInfo": {
        "type": "object",
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "description": "Tokens in the prompt"
          },
          "completion_tokens": {
            "type": "integer",
            "description": "Tokens in the completion, including thinking tokens"
          },
          "total_tokens": {
            "type": "integer",
            "description": "Total tokens used"
          },
          "cache_creation_input_tokens": {
            "type": "integer",
            "description": "Prompt tokens written to the cache. Present only when the value is greater than 0."
          },
          "prompt_tokens_details": {
            "type": "object",
            "properties": {
              "cached_tokens": {
                "type": "integer",
                "description": "Prompt tokens read from the cache"
              },
              "audio_tokens": {
                "type": "integer"
              }
            }
          },
          "completion_tokens_details": {
            "type": "object",
            "properties": {
              "reasoning_tokens": {
                "type": "integer"
              },
              "audio_tokens": {
                "type": "integer"
              }
            }
          }
        }
      },
      "EmbeddingRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "ID of the model to use",
            "example": "text-embedding-3-small"
          },
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  }
                }
              }
            ],
            "description": "Text(s) or token array(s) to embed. Limits depend on the model."
          },
          "encoding_format": {
            "type": "string",
            "enum": [
              "float",
              "base64"
            ],
            "default": "float",
            "description": "Output format"
          },
          "dimensions": {
            "type": "integer",
            "minimum": 1,
            "description": "Vector dimensions, for models that list dimensions."
          },
          "user": {
            "type": "string",
            "description": "End-user identifier"
          }
        }
      },
      "EmbeddingResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "string",
                  "enum": [
                    "embedding"
                  ]
                },
                "index": {
                  "type": "integer"
                },
                "embedding": {
                  "oneOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "number"
                      }
                    },
                    {
                      "type": "string"
                    }
                  ]
                }
              },
              "required": [
                "object",
                "index",
                "embedding"
              ]
            }
          },
          "model": {
            "type": "string"
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "prompt_tokens",
              "total_tokens"
            ]
          }
        },
        "required": [
          "object",
          "data",
          "model",
          "usage"
        ]
      },
      "ImageGenerationRequest": {
        "type": "object",
        "required": [
          "model"
        ],
        "properties": {
          "prompt": {
            "type": "string",
            "maxLength": 32000,
            "description": "Image description. Required for every model that takes a prompt; a tool whose contract lists no prompt (background removal, upscaling, vectorizing) is called without one."
          },
          "model": {
            "type": "string",
            "description": "Model to use. Send this explicitly; query GET /v1/models?recommended_for=image for current recommendations."
          },
          "operation": {
            "type": "string",
            "enum": [
              "text-to-image",
              "image-to-image",
              "image-edit"
            ],
            "description": "Public image operation family. Reference-image models use image-to-image with image_url, image_urls, or reference_image_urls."
          },
          "image_url": {
            "type": "string",
            "format": "uri",
            "description": "Single reference image URL for compatible image-to-image models."
          },
          "image_urls": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "Reference image URLs for compatible image-to-image models."
          },
          "reference_image_urls": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "Alias used by compatible reference-image model families."
          },
          "mask_url": {
            "type": "string",
            "format": "uri",
            "description": "Optional mask URL for compatible image operations."
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "default": 1,
            "description": "Number of images to generate"
          },
          "size": {
            "type": "string",
            "description": "Image size. Defaults are model-specific. For gpt-image-2, omit this field or use auto for automatic sizing, or send WIDTHxHEIGHT; custom dimensions must both be multiples of 16, longest edge <= 3840px, long/short ratio <= 3:1, and total pixels between 655,360 and 8,294,400. For Google image models with resolution tiers (gemini-3.1-flash-image, gemini-3-pro-image, gemini-3.1-flash-lite-image, gemini-nano-banana-2.1, nano-banana-2, nano-banana-2.1, nano-banana-pro), send an output size from the model's size table or a resolution tier: 1K, 2K, or 4K. TokenLab sends a tier as resolution. A tier that the model does not support, or a tier that is different from resolution, returns 400 invalid_image_size_contract. The recommended form for these models is aspect_ratio with resolution."
          },
          "quality": {
            "type": "string",
            "description": "Image quality. Defaults and accepted values are model-specific. For gpt-image-2, omit this field or use auto for automatic quality, or send low, medium, or high. Other models may accept different values; check the model details."
          },
          "style": {
            "type": "string",
            "enum": [
              "vivid",
              "natural"
            ],
            "description": "Optional model-specific style selector. Only send when the selected model documents support for this parameter."
          },
          "expand_prompt": {
            "type": "boolean",
            "description": "Ask compatible models to expand or enhance the prompt."
          },
          "prompt_extend": {
            "type": "boolean",
            "description": "For z-image-turbo, enable prompt expansion. Defaults to false. Enabling it uses the model's prompt-expansion price."
          },
          "negative_prompt": {
            "type": "string",
            "description": "Content to avoid for compatible image models."
          },
          "seed": {
            "type": "integer",
            "description": "Seed for deterministic-compatible image models."
          },
          "response_format": {
            "type": "string",
            "enum": [
              "url",
              "b64_json"
            ],
            "description": "How the images are returned. Omitted: when the model returns image bytes, each image is in data[].b64_json, and also in data[].url when TokenLab stored it; when the model returns a link, each image is in data[].url. url: only data[].url. b64_json: only data[].b64_json. Links are TokenLab media-result URLs that stay valid for 30 days."
          },
          "async": {
            "type": "boolean",
            "description": "Return a task at once, for models that list async (else 400 unsupported_async_mode). Poll GET /v1/tasks/{id}."
          },
          "background": {
            "type": "string",
            "enum": [
              "transparent",
              "opaque",
              "auto"
            ],
            "description": "Background handling for compatible image flows. For gpt-image-2 generation and edits, accepted values are auto and opaque; transparent is not supported. Other models may support different values."
          },
          "output_format": {
            "type": "string",
            "enum": [
              "png",
              "jpeg",
              "webp",
              "gif",
              "svg"
            ],
            "description": "Output image format for compatible image models such as gpt-image-2. gif and svg are for models whose contract lists them; other models reject them. svg works on /v1/images/generations only, needs svg.model, and takes n 1 only. gif takes no mask, stream, partial_images or output_compression."
          },
          "output_compression": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Output compression level from 0 to 100 for compressed formats"
          },
          "compression": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Alias for output_compression when supported by the selected model"
          },
          "moderation": {
            "type": "string",
            "enum": [
              "auto",
              "low"
            ],
            "description": "Moderation strictness for compatible image models such as gpt-image-2"
          },
          "stream": {
            "type": "boolean",
            "description": "Reserved image streaming flag. The public generation route currently rejects true."
          },
          "aspect_ratio": {
            "type": "string",
            "description": "Aspect-ratio selector for compatible image model families."
          },
          "resolution": {
            "type": "string",
            "description": "Resolution selector for compatible image model families."
          },
          "user": {
            "type": "string",
            "description": "End-user identifier"
          },
          "width": {
            "type": "integer",
            "description": "Model-specific output width in pixels. See get_model."
          },
          "height": {
            "type": "integer",
            "description": "Model-specific output height in pixels. See get_model."
          },
          "steps": {
            "type": "integer",
            "description": "Model-specific inference step count. See get_model."
          },
          "cfg_scale": {
            "type": "number",
            "description": "Model-specific image CFG scale. See get_model."
          },
          "guidance_scale": {
            "type": "number",
            "description": "Model-specific guidance scale. See get_model."
          },
          "guidance": {
            "type": "number",
            "description": "Model-specific guidance value. See get_model."
          },
          "raw": {
            "type": "boolean",
            "description": "Less processed, more natural output. Only for models that list raw (for example flux-pro-1.1-ultra)."
          },
          "image_prompt": {
            "type": "string",
            "format": "uri",
            "description": "Reference image URL that guides a text-to-image result. Only for models that list image_prompt. Cannot be combined with other image URL fields."
          },
          "svg": {
            "type": "object",
            "required": [
              "model"
            ],
            "additionalProperties": false,
            "description": "SVG settings. Only with output_format svg, where svg.model is required: the author model that writes the SVG, which sets the price.",
            "properties": {
              "model": {
                "type": "string",
                "minLength": 1,
                "description": "Author model. The model details list the accepted values (parameter_options, svg.model)."
              },
              "reasoning": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "description": "Reasoning settings of the author model.",
                "properties": {
                  "effort": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Reasoning effort of the author model."
                  }
                }
              }
            }
          },
          "frame_count": {
            "type": "integer",
            "minimum": 2,
            "maximum": 16,
            "description": "Number of GIF frames, from 2 to 16. Only with output_format gif. The model lists it when it serves gif."
          },
          "frame_duration_ms": {
            "type": "integer",
            "minimum": 20,
            "maximum": 2000,
            "description": "Time of each GIF frame in milliseconds, from 20 to 2000. Only with output_format gif. The model lists it when it serves gif."
          }
        }
      },
      "ImageGenerationMultipartRequest": {
        "type": "object",
        "required": [
          "model"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "Model to use. Send this explicitly."
          },
          "prompt": {
            "type": "string",
            "maxLength": 32000,
            "description": "Image description. Required for every model that takes a prompt; a tool whose contract lists no prompt (background removal, upscaling, vectorizing) is called without one."
          },
          "operation": {
            "type": "string",
            "enum": [
              "text-to-image",
              "image-to-image",
              "image-edit"
            ]
          },
          "image": {
            "type": "string",
            "format": "binary",
            "description": "Local reference image upload for compatible image-to-image models."
          },
          "image_urls": {
            "type": "string",
            "description": "Comma-separated reference image URLs."
          },
          "reference_image_urls": {
            "type": "string",
            "description": "Comma-separated reference image URLs for compatible model families."
          },
          "mask_url": {
            "type": "string",
            "format": "uri"
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "default": 1
          },
          "quality": {
            "type": "string"
          },
          "expand_prompt": {
            "type": "boolean"
          },
          "prompt_extend": {
            "type": "boolean",
            "description": "For z-image-turbo, enable prompt expansion. Defaults to false. Enabling it uses the model's prompt-expansion price."
          },
          "negative_prompt": {
            "type": "string"
          },
          "seed": {
            "type": "integer"
          },
          "response_format": {
            "type": "string",
            "enum": [
              "url",
              "b64_json"
            ]
          },
          "async": {
            "type": "boolean"
          },
          "background": {
            "type": "string",
            "enum": [
              "transparent",
              "opaque",
              "auto"
            ]
          },
          "output_format": {
            "type": "string",
            "enum": [
              "png",
              "jpeg",
              "webp",
              "gif",
              "svg"
            ],
            "description": "gif and svg are for models whose contract lists them; other models reject them. svg works on /v1/images/generations only, needs svg.model, and takes n 1 only. gif takes no mask, stream, partial_images or output_compression."
          },
          "output_compression": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "compression": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "moderation": {
            "type": "string",
            "enum": [
              "auto",
              "low"
            ]
          },
          "stream": {
            "type": "boolean"
          },
          "size": {
            "type": "string"
          },
          "aspect_ratio": {
            "type": "string"
          },
          "resolution": {
            "type": "string"
          },
          "style": {
            "type": "string"
          },
          "user": {
            "type": "string"
          },
          "width": {
            "type": "integer",
            "description": "Model-specific output width in pixels. See get_model."
          },
          "height": {
            "type": "integer",
            "description": "Model-specific output height in pixels. See get_model."
          },
          "steps": {
            "type": "integer",
            "description": "Model-specific inference step count. See get_model."
          },
          "cfg_scale": {
            "type": "number",
            "description": "Model-specific image CFG scale. See get_model."
          },
          "guidance_scale": {
            "type": "number",
            "description": "Model-specific guidance scale. See get_model."
          },
          "guidance": {
            "type": "number",
            "description": "Model-specific guidance value. See get_model."
          },
          "svg": {
            "type": "string",
            "description": "SVG settings as a JSON object string, for example {\"model\":\"...\"}. Same keys and rules as svg in the JSON request."
          },
          "frame_count": {
            "type": "integer",
            "minimum": 2,
            "maximum": 16,
            "description": "Number of GIF frames, from 2 to 16. Only with output_format gif. The model lists it when it serves gif."
          },
          "frame_duration_ms": {
            "type": "integer",
            "minimum": 20,
            "maximum": 2000,
            "description": "Time of each GIF frame in milliseconds, from 20 to 2000. Only with output_format gif. The model lists it when it serves gif."
          }
        },
        "additionalProperties": false
      },
      "ImageGenerationResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Task ID when the request runs as a task. Same value as task_id."
          },
          "created": {
            "type": "integer",
            "description": "Unix timestamp"
          },
          "usage": {
            "type": "object",
            "description": "Token counts for token-priced image models such as gpt-image-2, when available.",
            "properties": {
              "input_tokens": {
                "type": "number"
              },
              "output_tokens": {
                "type": "number"
              },
              "total_tokens": {
                "type": "number"
              },
              "input_tokens_details": {
                "type": "object",
                "additionalProperties": true
              },
              "output_tokens_details": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "additionalProperties": true
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "description": "Image URL"
                },
                "b64_json": {
                  "type": "string",
                  "description": "Base64 encoded image"
                },
                "revised_prompt": {
                  "type": "string",
                  "description": "Revised prompt returned by models that rewrite or enhance the submitted prompt."
                }
              }
            }
          },
          "task_id": {
            "type": "string",
            "description": "Task ID when the request runs as a task."
          },
          "status": {
            "type": "string",
            "description": "Task status when the request runs as a task."
          },
          "poll_url": {
            "type": "string",
            "description": "URL to poll for the task result."
          },
          "error": {
            "$ref": "#/components/schemas/AsyncTaskError"
          },
          "error_details": {
            "$ref": "#/components/schemas/AsyncTaskErrorDetails"
          },
          "media_retention": {
            "$ref": "#/components/schemas/MediaRetention"
          },
          "svg_usage": {
            "type": "object",
            "description": "Token counts of the SVG author model, as the upstream reports them. Present only for SVG output; these tokens are not in usage.",
            "additionalProperties": true
          }
        },
        "required": [
          "created",
          "data"
        ]
      },
      "AudioSpeechRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "TTS model. There is no default model. Query GET /v1/models?recommended_for=tts for the current shortlist.",
            "example": "grok-tts"
          },
          "input": {
            "type": "string",
            "maxLength": 4096,
            "description": "Text to synthesize."
          },
          "voice": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "required": [
                  "id"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            ],
            "description": "Voice name or voice ID. Accepted values depend on the model; read the model's details. Some models also accept voice_id."
          },
          "voice_id": {
            "type": "string",
            "description": "Voice ID, for models that list this parameter."
          },
          "instructions": {
            "type": "string",
            "maxLength": 2000,
            "description": "Optional style or delivery instructions, for models that list this parameter."
          },
          "prompt": {
            "type": "string",
            "maxLength": 2000,
            "description": "Optional speaking style prompt, for models that list this parameter."
          },
          "language_code": {
            "type": "string",
            "description": "Optional language code, for models that list this parameter.",
            "example": "en-US"
          },
          "response_format": {
            "type": "string",
            "description": "Audio format. Accepted values depend on the model; read the model's details before sending one.",
            "example": "mp3"
          },
          "stream_format": {
            "type": "string",
            "enum": [
              "audio",
              "sse"
            ],
            "default": "audio",
            "description": "TokenLab delivery format. Send sse only when the model's details list it."
          },
          "speed": {
            "type": "number",
            "minimum": 0.25,
            "maximum": 4,
            "description": "Speech speed, for models that support it. A model can narrow the range."
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2,
            "description": "Sampling temperature, for models that list this parameter."
          }
        },
        "additionalProperties": false
      },
      "AudioTranscriptionRequest": {
        "type": "object",
        "required": [
          "file",
          "model"
        ],
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "Audio file to transcribe"
          },
          "model": {
            "type": "string",
            "description": "Transcription model ID. There is no default model.",
            "example": "whisper-large-v3"
          },
          "language": {
            "type": "string",
            "description": "ISO-639-1 language code"
          },
          "prompt": {
            "type": "string",
            "description": "Optional prompt text, for models that list this parameter."
          },
          "response_format": {
            "type": "string",
            "default": "json",
            "description": "json, or text/verbose_json where the model lists them."
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Sampling temperature, for models that list this parameter."
          },
          "timestamp_granularities": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "word",
                "segment"
              ]
            },
            "description": "Timestamp granularity selection, for models that list this parameter. Some models need verbose_json output for timestamps."
          }
        }
      },
      "AudioTranscriptionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Task ID. Only an accepted asynchronous transcription returns it, with status and poll_url instead of the transcript. Poll GET /v1/tasks/{id}; the completed task returns text and, when available, duration, segments, and words."
          },
          "task_id": {
            "type": "string",
            "description": "Alias of id."
          },
          "status": {
            "type": "string",
            "description": "Task status of an accepted asynchronous transcription."
          },
          "poll_url": {
            "type": "string",
            "description": "Status URL of an accepted asynchronous transcription."
          },
          "text": {
            "type": "string",
            "description": "Transcribed text"
          },
          "task": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "duration": {
            "type": "number"
          },
          "words": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "word": {
                  "type": "string"
                },
                "start": {
                  "type": "number"
                },
                "end": {
                  "type": "number"
                }
              }
            }
          },
          "segments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "start": {
                  "type": "number"
                },
                "end": {
                  "type": "number"
                },
                "text": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "VideoGenerationRequest": {
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "maxLength": 10000,
            "description": "Video description, up to 10,000 characters."
          },
          "model": {
            "type": "string",
            "description": "Video model ID, for example veo3.1. Send it explicitly."
          },
          "operation": {
            "type": "string",
            "enum": [
              "text-to-video",
              "image-to-video",
              "reference-to-video",
              "start-end-to-video",
              "video-to-video",
              "video-extension",
              "audio-to-video",
              "motion-control"
            ],
            "description": "Requested video operation. If omitted, TokenLab infers the operation from the provided inputs. Send it explicitly: an operation the model does not support is rejected with 400 `unsupported_operation`."
          },
          "image": {
            "type": "string",
            "maxLength": 2000000,
            "description": "Inline image as a data URL (for example, data:image/png;base64,...), up to 2,000,000 characters. Prefer image_url for broader compatibility. For Seedance 2.0 models this field also accepts asset://asset-YYYYMMDDHHMMSS-xxxxx for an ACTIVE TokenLab material."
          },
          "image_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 8192,
            "description": "Publicly reachable image URL for image-to-video generation, up to 8,192 characters, or asset://asset-YYYYMMDDHHMMSS-xxxxx for an ACTIVE TokenLab Seedance 2.0 material used as the first frame. Ordinary HTTP(S) and data-URL images are passed through as inputs and do not create reusable materials. If an explicit material is still preparing, the API returns 409 seedance_material_preparing with inactive_asset_ids."
          },
          "video_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 8192,
            "description": "Public source video URL, for operations that take one."
          },
          "duration": {
            "type": "integer",
            "minimum": -1,
            "maximum": 60,
            "description": "Duration in seconds; allowed values depend on the model (400 invalid_duration). Seedance also accepts -1."
          },
          "aspect_ratio": {
            "type": "string",
            "description": "Aspect ratio, for example 16:9; allowed values depend on the model (400 invalid_aspect_ratio)."
          },
          "resolution": {
            "type": "string",
            "description": "Resolution, for example 720p; allowed values depend on the model (400 invalid_resolution)."
          },
          "output_format": {
            "type": "string",
            "enum": [
              "mp4",
              "mov",
              "webm"
            ],
            "description": "Video container format for models that list this field. Each model lists the values it accepts (for example Seedance 2.5 takes `mp4` or `mov`). Omit it for models that do not list it."
          },
          "width": {
            "type": "integer",
            "minimum": 1,
            "description": "Output width in pixels, for models that list width and height. Send it with height; the pair must be one of the model's listed sizes."
          },
          "height": {
            "type": "integer",
            "minimum": 1,
            "description": "Output height in pixels, for models that list width and height. Send it with width; the pair must be one of the model's listed sizes."
          },
          "output_audio": {
            "type": "boolean",
            "description": "Audio-output selector for operations that list it. Omit it to follow the model default. `false` asks for silent output only where the model allows it; some models always produce audio and accept only `true` (for example `veo3.1`)."
          },
          "fps": {
            "type": "integer",
            "minimum": 1,
            "maximum": 120,
            "description": "Frames per second, for models that list this field."
          },
          "negative_prompt": {
            "type": "string",
            "maxLength": 5000,
            "description": "What to avoid in the video, up to 5,000 characters, for models that list this field."
          },
          "seed": {
            "type": "integer",
            "minimum": -1,
            "maximum": 4294967295,
            "description": "Seed for reproducibility, for models that list this field. Seedance 2.0 models accept -1 for a random seed; Seedance 2.5 does not accept this field."
          },
          "cfg_scale": {
            "type": "number",
            "minimum": 0,
            "maximum": 20,
            "description": "Prompt adherence strength (0-20). Accepted only by models whose details list this field."
          },
          "motion_strength": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Motion intensity (0-1). Accepted only by models whose details list this field."
          },
          "start_image": {
            "type": "string",
            "description": "First frame image. With end_image, the request is start-end-to-video. Without end_image, it is image-to-video, and start_image works like image on models whose details list it. Accepts a public image URL or a data URL; Seedance 2.0 models also accept asset://asset-YYYYMMDDHHMMSS-xxxxx for an ACTIVE TokenLab material owned by your organization."
          },
          "end_image": {
            "type": "string",
            "description": "Last frame image for start-end-to-video. Send it with start_image. Accepts the same inputs as start_image."
          },
          "user": {
            "type": "string",
            "description": "End-user identifier."
          },
          "image_urls": {
            "type": "array",
            "description": "Image URLs for models that list this field. Seedance 2.5 accepts up to 30 image inputs in total across `image_urls` and `reference_images`. Seedance 2.0 models accept up to 9 image references in total, including material assets (more returns 400 `too_many_seedance_reference_images`). For other models see the model details; a request over a model's limit returns 400 `too_many_items`. Seedance 2.0 models also accept asset://asset-YYYYMMDDHHMMSS-xxxxx for an ACTIVE TokenLab material.",
            "minItems": 1,
            "maxItems": 30,
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "kling_elements": {
            "type": "array",
            "description": "Element references for image-conditioned requests on models that explicitly support this field. Define 1-3 elements and reference them in the prompt with @name. Each element requires 2-4 image URLs in element_input_urls. Do not combine kling_elements with output_audio=true; omit output_audio or set it to false for element-reference requests.",
            "minItems": 1,
            "maxItems": 3,
            "items": {
              "type": "object",
              "required": [
                "name",
                "element_input_urls"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Element name used in the prompt without the @ prefix.",
                  "minLength": 1,
                  "maxLength": 64
                },
                "description": {
                  "type": "string",
                  "description": "Optional short description of the element.",
                  "minLength": 1,
                  "maxLength": 500
                },
                "element_input_urls": {
                  "type": "array",
                  "description": "Reference image URLs for this element. Kling 3.0 expects 2-4 images per element.",
                  "minItems": 2,
                  "maxItems": 4,
                  "items": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              },
              "additionalProperties": false
            }
          },
          "reference_images": {
            "type": "array",
            "description": "Reference images for reference-to-video, as public image URLs or data URLs. The count limit depends on the model: Seedance 2.5 accepts up to 30 image inputs in total across `image_urls` and `reference_images`; Seedance 2.0 models accept up to 9 image references in total, including material assets; `grok-imagine-video` accepts up to 7 and caps `duration` at 10 seconds. `grok-imagine-video-1.5` and `grok-imagine-video-1.5-preview` take no reference images. Seedance 2.0 models also accept asset://asset-YYYYMMDDHHMMSS-xxxxx for an ACTIVE TokenLab material; if an explicit material is still preparing, the API returns 409 seedance_material_preparing with inactive_asset_ids.",
            "minItems": 1,
            "maxItems": 30,
            "items": {
              "type": "string"
            }
          },
          "material_asset_id": {
            "type": "string",
            "description": "TokenLab Seedance material asset ID returned by /v1/videos/assets or from a real-person group returned by GetVisualValidateResult. Accepted by the Seedance 2.0 models only (other models return 400 `unsupported_seedance_material_asset_model`). The asset must be ACTIVE and belong to the current account. This field is a generic reference input; to assign first-frame, last-frame, or reference-image semantics explicitly, put asset://<material_asset_id> in start_image, end_image, or reference_images."
          },
          "material_asset_ids": {
            "type": "array",
            "description": "TokenLab Seedance material asset IDs returned by /v1/videos/assets. Accepted by the Seedance 2.0 models only. They count toward the 9 image references of those models; all assets must belong to the current account and be ACTIVE.",
            "minItems": 1,
            "maxItems": 9,
            "items": {
              "type": "string"
            }
          },
          "reference_image_type": {
            "type": "string",
            "enum": [
              "asset",
              "style"
            ],
            "description": "Optional reference image role for models that distinguish between asset and style references. The camelCase alias referenceImageType is accepted for compatibility."
          },
          "audio_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 8192,
            "description": "Public audio URL for models that list this field: an audio reference or an audio-driven operation. It is an input, not an output-audio switch."
          },
          "task_id": {
            "type": "string",
            "description": "Earlier task in your workspace, for operations such as video-extension."
          },
          "extend_at": {
            "type": "integer",
            "minimum": 0,
            "description": "Second of the source video where a video-extension starts, for models that list this field. Required by `grok-imagine-video`."
          },
          "extend_times": {
            "type": "string",
            "description": "Seconds to add in a video-extension, for models that list this field. `grok-imagine-video` takes `6` or `10`."
          },
          "seconds": {
            "type": "integer",
            "minimum": -1,
            "maximum": 60,
            "description": "Alias of duration used by compatible request shapes. Seedance models also accept -1 to let the model choose within its supported duration range; duration and seconds must match when both are provided."
          },
          "size": {
            "type": "string",
            "description": "Model-specific size tier for compatible video models."
          },
          "watermark": {
            "type": "boolean",
            "description": "Watermark toggle for models that list this field (Seedance models)."
          },
          "effect_type": {
            "type": "string",
            "description": "Model-specific effect selector for specialized editing flows."
          },
          "video_urls": {
            "type": "array",
            "description": "Source or reference videos for models that list this field. Seedance 2.5 accepts up to 10 video inputs in total across `video_url` and `video_urls`, and reference audio plus video lasting at most 30 seconds combined. For other models see the model details; a request over a model's limit returns 400 `too_many_items`.",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "audio_urls": {
            "type": "array",
            "description": "Reference audio for models that list this field. Seedance 2.5 accepts up to 10 audio inputs in total across `audio_url` and `audio_urls`, allows a pure-audio reference request without a prompt, and limits reference audio plus video to 30 seconds combined. For other models see the model details; a request over a model's limit returns 400 `too_many_items`.",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "ratio": {
            "type": "string",
            "description": "Compatibility alias for aspect_ratio. If both ratio and aspect_ratio are provided, they must match (400 `conflicting_aspect_ratio`)."
          },
          "outputAudio": {
            "type": "boolean",
            "description": "Alias of output_audio; all audio toggles must match."
          },
          "generate_audio": {
            "type": "boolean",
            "description": "Compatibility alias for output_audio. If more than one audio toggle is provided, all values must match."
          },
          "execution_expires_after": {
            "type": "integer",
            "minimum": 3600,
            "maximum": 259200,
            "description": "Seconds the task may wait in the queue before it expires (3600 to 259200), for models that list this field (Seedance models)."
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9,
            "description": "Task priority from 0 to 9, for models that list this field (Seedance models)."
          },
          "safety_identifier": {
            "type": "string",
            "maxLength": 128,
            "description": "End-user safety identifier, for models that list this field (Seedance models). If omitted, TokenLab uses `user` when provided."
          },
          "service_tier": {
            "type": "string",
            "enum": [
              "default",
              "flex"
            ],
            "description": "Optional service tier for compatible video models. service_tier=default is accepted as a compatibility no-op for Seedance 2.0 and Seedance 2.5; service_tier=flex is rejected for both models."
          },
          "frames": {
            "type": "integer",
            "minimum": 1,
            "description": "Frame count, for models that list this field. Seedance models do not accept it."
          },
          "camera_fixed": {
            "type": "boolean",
            "description": "Optional fixed-camera selector for compatible video models. Seedance 2.0 and Seedance 2.5 do not support this field."
          },
          "return_last_frame": {
            "type": "boolean",
            "description": "Also return the last generated frame as `last_frame_url`, for models that list this field (Seedance models)."
          },
          "draft": {
            "type": "boolean",
            "description": "Draft workflow flag. Accepted only by models whose details list this field."
          },
          "draft_task_id": {
            "type": "string",
            "description": "ID of an earlier draft task to turn into the final video. Accepted only by models whose details list this field."
          },
          "audio": {
            "type": "boolean",
            "description": "Audio selector accepted by a few models, such as the Vidu models and `wan-2.6`. It must match `output_audio` when both are sent."
          },
          "bgm": {
            "type": "boolean",
            "description": "Optional audio control. Accepted only when declared by the selected model and operation; availability may differ by operation."
          },
          "audio_type": {
            "type": "string",
            "description": "Optional audio control. Accepted only when declared by the selected model and operation; availability may differ by operation."
          },
          "voice_id": {
            "type": "string",
            "description": "Optional audio control. Accepted only when declared by the selected model and operation; availability may differ by operation."
          },
          "tools": {
            "type": "array",
            "description": "Generation tools, for models that list it, e.g. {\"type\":\"web_search\"}.",
            "minItems": 1,
            "maxItems": 4,
            "items": {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "description": "Tool type, for example `web_search`."
                }
              },
              "additionalProperties": true
            }
          }
        }
      },
      "VideoGenerationResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Task ID. Identical to `task_id`."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "completed",
              "failed"
            ],
            "description": "Task status. A newly created task is normally `pending`."
          },
          "created": {
            "type": "integer",
            "description": "Unix timestamp"
          },
          "model": {
            "type": "string"
          },
          "video": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "duration": {
                "type": "number"
              },
              "width": {
                "type": "integer"
              },
              "height": {
                "type": "integer"
              }
            }
          },
          "error": {
            "$ref": "#/components/schemas/AsyncTaskError"
          },
          "error_details": {
            "$ref": "#/components/schemas/AsyncTaskErrorDetails"
          },
          "task_id": {
            "type": "string",
            "description": "Canonical async task identifier for polling. Treat this as the same identity as id when both are present."
          },
          "poll_url": {
            "type": "string",
            "description": "Status URL for this task, `/v1/tasks/{id}`. Call it with your API key until `status` is `completed` or `failed`."
          },
          "billing_transaction_id": {
            "type": "string",
            "description": "Billing transaction ID when settlement already completed. It is separate from the task ID."
          },
          "video_url": {
            "type": "string",
            "description": "Generated video URL. Present only when the create response already carries the result; normally you read it from the status response."
          },
          "last_frame_url": {
            "type": "string",
            "description": "Last generated frame URL when requested and supported by the selected model."
          },
          "content": {
            "type": "object",
            "properties": {
              "video_url": {
                "type": "string"
              },
              "last_frame_url": {
                "type": "string"
              },
              "file_url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "additionalProperties": true
          },
          "generate_audio": {
            "type": "boolean",
            "description": "Resolved audio output flag when returned by the adapter."
          },
          "draft": {
            "type": "boolean",
            "description": "Whether the Seedance draft workflow was used for this task, when returned."
          },
          "draft_task_id": {
            "type": "string",
            "description": "Draft task ID, when returned."
          },
          "media_retention": {
            "$ref": "#/components/schemas/MediaRetention"
          }
        },
        "required": [
          "id"
        ]
      },
      "VideoTaskResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "completed",
              "failed"
            ]
          },
          "progress": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Optional progress value returned only when a real progress value is available; use status to determine completion."
          },
          "created": {
            "type": "integer"
          },
          "updated": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "video": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "duration": {
                "type": "number"
              },
              "width": {
                "type": "integer"
              },
              "height": {
                "type": "integer"
              }
            }
          },
          "error": {
            "$ref": "#/components/schemas/AsyncTaskError"
          },
          "error_details": {
            "$ref": "#/components/schemas/AsyncTaskErrorDetails"
          },
          "task_id": {
            "type": "string"
          },
          "poll_url": {
            "type": "string",
            "description": "Status URL for this task, `/v1/tasks/{id}`."
          },
          "cancelled": {
            "type": "boolean",
            "description": "True when a queued async task was cancelled before execution. Cancelled tasks are represented with `status: failed` for compatibility with existing async task status values."
          },
          "cancellation_status": {
            "type": "string",
            "enum": [
              "cancelled"
            ],
            "description": "Cancellation marker for tasks cancelled through the public async task endpoint."
          },
          "billing_transaction_id": {
            "type": "string"
          },
          "video_url": {
            "type": "string",
            "description": "URL of the generated video once `status` is `completed`. It is a TokenLab media-result URL that stays valid for 30 days and needs no API key. Some results are delivered as `/v1/videos/generations/{id}/content` on `https://api.tokenlab.sh`; that URL needs your API key."
          },
          "last_frame_url": {
            "type": "string",
            "description": "Last generated frame URL, when you asked for it with `return_last_frame` and the model supports it."
          },
          "videos": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "audio_url": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "lyrics": {
            "type": "string"
          },
          "model_url": {
            "type": "string"
          },
          "glb_url": {
            "type": "string"
          },
          "fbx_url": {
            "type": "string"
          },
          "media_retention": {
            "$ref": "#/components/schemas/MediaRetention"
          }
        }
      },
      "SeedanceMaterialAssetCreateRequest": {
        "type": "object",
        "required": [
          "asset_url"
        ],
        "additionalProperties": false,
        "properties": {
          "asset_url": {
            "type": "string",
            "format": "uri",
            "description": "Publicly reachable source URL to import. TokenLab stores the material for later use; do not rely on this URL as the long-term material address."
          },
          "asset_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Optional display name stored with the material asset."
          },
          "asset_type": {
            "type": "string",
            "enum": [
              "Image",
              "Video",
              "Audio"
            ],
            "default": "Image"
          },
          "library_type": {
            "type": "string",
            "enum": [
              "aigc_avatar",
              "liveness_face"
            ],
            "default": "aigc_avatar",
            "description": "Material library class. aigc_avatar is for virtual-avatar materials. liveness_face is for verified real-person materials."
          },
          "group_id": {
            "type": "string",
            "description": "TokenLab material group ID. Required for liveness_face materials and whenever project_name is not default; optional for aigc_avatar, where TokenLab uses or creates the organization's default virtual-avatar group. The group must belong to the same project_name and library_type."
          },
          "project_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "default": "default",
            "description": "Project scope for the material asset. Assets and groups are isolated by project inside the authenticated organization."
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "Optional client metadata stored with the material asset."
          }
        }
      },
      "SeedanceMaterialAsset": {
        "type": "object",
        "required": [
          "id",
          "object",
          "status",
          "asset_type",
          "ready",
          "library_type"
        ],
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string",
            "description": "TokenLab material asset ID. Use this as material_asset_id after the asset becomes ACTIVE."
          },
          "object": {
            "type": "string",
            "enum": [
              "seedance.material_asset"
            ]
          },
          "group_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "TokenLab material group ID that owns this material asset."
          },
          "project_name": {
            "type": "string",
            "description": "Project scope for this material asset."
          },
          "library_type": {
            "type": "string",
            "enum": [
              "aigc_avatar",
              "liveness_face"
            ]
          },
          "asset_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "asset_type": {
            "type": "string",
            "enum": [
              "Image",
              "Video",
              "Audio"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PROCESSING",
              "ACTIVE",
              "FAILED",
              "DELETED"
            ]
          },
          "ready": {
            "type": "boolean",
            "description": "True when the asset is active and not deleted."
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Public-safe terminal processing error. Permanent source validation failures include the rejected dimension constraint."
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "created_at": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds when the material asset was created."
          },
          "updated_at": {
            "type": "integer",
            "description": "Unix timestamp in milliseconds when the material asset was last updated."
          }
        }
      },
      "SeedanceMaterialAssetList": {
        "type": "object",
        "required": [
          "assets"
        ],
        "properties": {
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SeedanceMaterialAsset"
            }
          },
          "next_page_token": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": true
      },
      "SeedanceMaterialAssetDeleteResponse": {
        "type": "object",
        "required": [
          "deleted",
          "id"
        ],
        "properties": {
          "deleted": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "ModelsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelListItem"
            }
          }
        },
        "required": [
          "object",
          "data"
        ],
        "additionalProperties": false
      },
      "CompactModelsResponse": {
        "type": "object",
        "description": "Compact model-selection response used by TokenLab MCP and other agent integrations.",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "view": {
            "type": "string",
            "enum": [
              "compact"
            ]
          },
          "count": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompactModelListItem"
            }
          }
        },
        "required": [
          "object",
          "view",
          "count",
          "data"
        ],
        "additionalProperties": false
      },
      "CompactModelListItem": {
        "type": "object",
        "description": "Fields needed to shortlist a model before calling get_model or get_model_pricing.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Model identifier"
          },
          "deliveryAvailability": {
            "type": "object",
            "description": "Current model availability by delivery tier; omitted when the source projection is unavailable.",
            "properties": {
              "verified": {
                "type": "boolean",
                "description": "Whether this model has eligible TokenLab Verified delivery supply."
              },
              "official": {
                "type": "boolean",
                "description": "Whether this model has eligible Official delivery supply."
              },
              "operations": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "verified": {
                      "type": "boolean"
                    },
                    "official": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "verified",
                    "official"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "verified",
              "official"
            ],
            "additionalProperties": false
          },
          "provider": {
            "type": "string",
            "description": "Public model provider"
          },
          "category": {
            "type": "string"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "max_input_tokens": {
            "type": [
              "number",
              "null"
            ]
          },
          "max_output_tokens": {
            "type": [
              "number",
              "null"
            ]
          },
          "pricing": {
            "type": "object",
            "properties": {
              "unit": {
                "type": "string"
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              },
              "input_per_1m": {
                "type": "string",
                "description": "TokenLab Verified price per 1M input tokens. Omitted when the model has no Verified supply (`deliveryAvailability.verified` is false)."
              },
              "output_per_1m": {
                "type": "string",
                "description": "TokenLab Verified price per 1M output tokens. Omitted when the model has no Verified supply (`deliveryAvailability.verified` is false)."
              },
              "per_request": {
                "type": "string",
                "description": "TokenLab Verified price per request. Omitted when the model has no Verified supply (`deliveryAvailability.verified` is false)."
              },
              "min_price": {
                "type": "string",
                "description": "Lowest TokenLab Verified price for a model with structured pricing. Omitted when the model has no Verified supply (`deliveryAvailability.verified` is false)."
              },
              "max_price": {
                "type": "string",
                "description": "Highest TokenLab Verified price for a model with structured pricing. Omitted when the model has no Verified supply (`deliveryAvailability.verified` is false)."
              },
              "official_input_per_1m": {
                "type": "string",
                "description": "Official price per 1M input tokens. Requests that Official delivers are billed at this price."
              },
              "official_output_per_1m": {
                "type": "string",
                "description": "Official price per 1M output tokens. Requests that Official delivers are billed at this price."
              },
              "official_per_request": {
                "type": "string",
                "description": "Official price per request. Requests that Official delivers are billed at this price."
              },
              "official_min_price": {
                "type": "string",
                "description": "Lowest Official price for a model with structured pricing."
              },
              "official_max_price": {
                "type": "string",
                "description": "Highest Official price for a model with structured pricing."
              },
              "has_complex_pricing": {
                "type": "boolean"
              }
            },
            "required": [
              "unit",
              "currency",
              "has_complex_pricing"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "description": "Public model lifecycle stage."
          },
          "latest": {
            "type": "boolean"
          },
          "supported_operations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "request_endpoint": {
            "type": "string"
          },
          "recommendation": {
            "type": "object",
            "properties": {
              "preferred_rank": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "success_rate_24h": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "sample_count_24h": {
                "type": "integer"
              },
              "status": {
                "type": "string",
                "enum": [
                  "ready",
                  "insufficient_samples"
                ]
              }
            },
            "required": [
              "preferred_rank",
              "success_rate_24h",
              "sample_count_24h",
              "status"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "provider",
          "category",
          "capabilities",
          "max_input_tokens",
          "max_output_tokens",
          "pricing",
          "status",
          "latest"
        ],
        "additionalProperties": false
      },
      "Model": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Model identifier",
            "example": "gpt-4o"
          },
          "object": {
            "type": "string",
            "enum": [
              "model"
            ]
          },
          "created": {
            "type": "integer",
            "description": "Unix timestamp"
          },
          "owned_by": {
            "type": "string",
            "description": "Model provider",
            "example": "openai"
          },
          "tokenlab": {
            "$ref": "#/components/schemas/ModelTokenLabExtension"
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "owned_by",
          "tokenlab"
        ],
        "additionalProperties": false
      },
      "ApiError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "description": "Error message"
              },
              "type": {
                "type": "string",
                "description": "Error type",
                "enum": [
                  "unauthorized",
                  "invalid_api_key",
                  "expired_api_key",
                  "permission_error",
                  "insufficient_balance",
                  "quota_exceeded",
                  "invalid_request_error",
                  "model_not_found",
                  "context_length_exceeded",
                  "unsupported_tool_choice",
                  "invalid_response_format_type",
                  "rate_limit_exceeded",
                  "server_error",
                  "upstream_error",
                  "all_channels_failed",
                  "timeout_error",
                  "not_found_error",
                  "no_contract_compatible_route",
                  "request_shape_channel_mismatch",
                  "upstream_contract_mismatch",
                  "platform_normalization_error",
                  "async_task_not_found",
                  "async_task_mapping_invalid",
                  "delivery_tier_unavailable"
                ]
              },
              "code": {
                "type": "string",
                "description": "Error code. Branch on this value, not on `message`. 400 codes include `invalid_request_error`, `missing_required_parameter`, `invalid_value`, `invalid_image_url`, `unsupported_model_capability`, `unpriceable_selection` and `invalid_response_format_type`. For `invalid_response_format_type` (`param`: `response_format`), send `response_format` as an object: a string, array, number or explicit `null` is rejected as not an object; set `response_format.type` to `text`, `json_object`, or `json_schema`; with `json_schema`, also send `json_schema` with `name` and `schema`."
              },
              "param": {
                "type": "string",
                "description": "Parameter that caused the error"
              },
              "model": {
                "type": "string",
                "description": "Model associated with the error"
              },
              "top_up_url": {
                "type": "string"
              },
              "min_top_up_usd": {
                "type": "number"
              },
              "did_you_mean": {
                "type": "string"
              },
              "suggestions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              },
              "alternatives": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "status",
                    "tags"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "additionalProperties": true
                }
              },
              "hint": {
                "type": "string"
              },
              "retry_after": {
                "type": "number"
              },
              "retryable": {
                "type": "boolean"
              },
              "balance_usd": {
                "type": "number"
              },
              "estimated_cost_usd": {
                "type": "number"
              },
              "supported_operations": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "supported_parameters": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "required_selectors": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "optional_selectors": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "allowed_resolutions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "allowed_durations": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "allowed_aspect_ratios": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "prompt_max_characters": {
                "type": "number"
              },
              "recommended_request": {
                "type": "object",
                "additionalProperties": true
              },
              "request_endpoint": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "request_shape_mode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status_mode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "request_id": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "type"
            ],
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "ValidationError": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiError"
          },
          {
            "type": "object",
            "properties": {
              "validation_errors": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "field": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "AnthropicMessagesRequest": {
        "type": "object",
        "required": [
          "model",
          "max_tokens",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "A model whose accepted_request_formats lists anthropic_messages.",
            "example": "claude-sonnet-4-6"
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "Maximum output tokens. Required; the maximum depends on the model."
          },
          "messages": {
            "type": "array",
            "description": "Messages in the conversation. Up to 100,000 messages.",
            "minItems": 1,
            "maxItems": 100000,
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "description": "Content blocks. Besides `text` and `image`, native blocks such as `tool_use`, `tool_result`, `thinking`, and `document` are accepted for models that support them.",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "required": [
                          "type"
                        ],
                        "properties": {
                          "type": {
                            "type": "string",
                            "description": "Content block type, for example `text`, `image`, `tool_use`, or `tool_result`."
                          },
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "type": {
                                "type": "string",
                                "description": "`base64` or `url`. Content that references an Anthropic `file_id` is not supported."
                              },
                              "media_type": {
                                "type": "string"
                              },
                              "data": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "system": {
            "description": "System prompt: a string, or an array of text content blocks.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true,
                  "required": [
                    "type"
                  ],
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    }
                  }
                }
              }
            ]
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Sampling temperature. Range and default depend on the model."
          },
          "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Nucleus sampling. Use temperature or top_p, not both."
          },
          "top_k": {
            "type": "integer",
            "minimum": 1,
            "description": "Sample from the top K tokens, where supported."
          },
          "stop_sequences": {
            "type": "array",
            "maxItems": 8191,
            "description": "Strings that stop generation.",
            "items": {
              "type": "string"
            }
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "Stream Anthropic server-sent events."
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "description": "Tool definitions available to the model. Support depends on the model."
          },
          "tool_choice": {
            "type": "object",
            "additionalProperties": true,
            "description": "Native tool-choice object, for example `{\"type\":\"auto\"}`. Supported types depend on the model."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "Request metadata in the Anthropic format. `user_id` is an opaque identifier for your end user."
          },
          "thinking": {
            "type": "object",
            "additionalProperties": true,
            "description": "Thinking configuration. Modes and budgets depend on the model."
          },
          "stream_options": {
            "type": "object",
            "additionalProperties": true,
            "description": "Streaming options such as usage chunk inclusion."
          },
          "service_tier": {
            "type": "string",
            "description": "Only auto and standard_only take effect."
          },
          "cache_control": {
            "type": "object",
            "additionalProperties": true,
            "description": "Prompt-caching marker, e.g. {\"type\":\"ephemeral\"}; add \"ttl\":\"1h\" for one hour."
          }
        }
      },
      "AnthropicMessagesResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "msg_01XFDUDYJgAACzvnptvVoYEL"
          },
          "type": {
            "type": "string",
            "enum": [
              "message"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "assistant"
            ]
          },
          "model": {
            "type": "string",
            "description": "Model that produced the response."
          },
          "content": {
            "type": "array",
            "description": "Content blocks, such as `text`, `thinking`, or `tool_use`.",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "type": {
                  "type": "string",
                  "description": "Block type, for example `text`, `thinking`, or `tool_use`."
                },
                "text": {
                  "type": "string"
                }
              }
            }
          },
          "stop_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why generation stopped: `end_turn`, `max_tokens`, `stop_sequence`, `tool_use`, or another value the model returns, such as `refusal`."
          },
          "stop_sequence": {
            "type": [
              "string",
              "null"
            ]
          },
          "usage": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "input_tokens": {
                "type": "integer"
              },
              "output_tokens": {
                "type": "integer"
              },
              "cache_creation_input_tokens": {
                "type": "integer",
                "description": "Input tokens written to the prompt cache, when the model reports them."
              },
              "cache_read_input_tokens": {
                "type": "integer",
                "description": "Input tokens read from the prompt cache, when the model reports them."
              }
            }
          }
        }
      },
      "GeminiRequest": {
        "type": "object",
        "description": "Native Gemini GenerateContent request. ProtoJSON lowerCamelCase and original proto snake_case names are both accepted and preserved, including mixed requests. If both spellings of one field are present, TokenLab does not merge them or choose a local precedence. Unknown fields are forwarded on a best-effort basis.",
        "required": [
          "contents"
        ],
        "properties": {
          "contents": {
            "type": "array",
            "description": "Conversation contents",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "user",
                    "model"
                  ]
                },
                "parts": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "inlineData": {
                            "type": "object",
                            "properties": {
                              "mimeType": {
                                "type": "string"
                              },
                              "data": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "inline_data": {
                            "type": "object",
                            "properties": {
                              "mime_type": {
                                "type": "string"
                              },
                              "data": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "fileData": {
                            "type": "object",
                            "properties": {
                              "mimeType": {
                                "type": "string"
                              },
                              "fileUri": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "file_data": {
                            "type": "object",
                            "properties": {
                              "mime_type": {
                                "type": "string"
                              },
                              "file_uri": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "videoMetadata": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "video_metadata": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "thought": {
                            "type": "boolean"
                          },
                          "thoughtSignature": {
                            "type": "string"
                          },
                          "thought_signature": {
                            "type": "string"
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "functionCall": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "functionResponse": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "executableCode": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "codeExecutionResult": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "function_call": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "function_response": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "executable_code": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "code_execution_result": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      }
                    ]
                  }
                }
              }
            }
          },
          "systemInstruction": {
            "type": "object",
            "properties": {
              "parts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "generationConfig": {
            "type": "object",
            "properties": {
              "temperature": {
                "type": "number",
                "minimum": 0
              },
              "topP": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "topK": {
                "type": "integer",
                "minimum": 1
              },
              "maxOutputTokens": {
                "type": "integer",
                "minimum": 1
              },
              "stopSequences": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "candidateCount": {
                "type": "integer",
                "minimum": 1,
                "description": "Requested number of response candidates. Support is determined by the selected service."
              },
              "responseModalities": {
                "type": "array",
                "description": "Requested output modalities for supported Gemini models.",
                "items": {
                  "type": "string"
                }
              },
              "responseMimeType": {
                "type": "string",
                "description": "Requested output MIME type, such as text/plain or application/json."
              },
              "responseSchema": {
                "type": "object",
                "description": "JSON schema for structured output when responseMimeType requests JSON.",
                "additionalProperties": true
              },
              "thinkingConfig": {
                "type": "object",
                "description": "Thinking budget options for compatible Gemini models.",
                "properties": {
                  "thinkingBudget": {
                    "type": "integer"
                  }
                },
                "additionalProperties": true
              },
              "thinking_config": {
                "type": "object",
                "description": "Snake-case thinking budget options for compatible Gemini models.",
                "properties": {
                  "thinking_budget": {
                    "type": "integer"
                  }
                },
                "additionalProperties": true
              }
            }
          },
          "safetySettings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "category": {
                  "type": "string"
                },
                "threshold": {
                  "type": "string"
                }
              }
            }
          },
          "tools": {
            "type": "array",
            "description": "Gemini tools. Tool types and combinations are interpreted by the selected service.",
            "items": {
              "type": "object",
              "properties": {
                "functionDeclarations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                },
                "function_declarations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                },
                "codeExecution": {
                  "type": "object",
                  "additionalProperties": true
                },
                "code_execution": {
                  "type": "object",
                  "additionalProperties": true
                },
                "googleSearch": {
                  "type": "object",
                  "additionalProperties": true
                },
                "google_search": {
                  "type": "object",
                  "additionalProperties": true
                },
                "googleSearchRetrieval": {
                  "type": "object",
                  "additionalProperties": true
                },
                "google_search_retrieval": {
                  "type": "object",
                  "additionalProperties": true
                },
                "urlContext": {
                  "type": "object",
                  "additionalProperties": true
                },
                "url_context": {
                  "type": "object",
                  "additionalProperties": true
                },
                "computerUse": {
                  "type": "object",
                  "additionalProperties": true
                },
                "computer_use": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "additionalProperties": true
            }
          },
          "toolConfig": {
            "type": "object",
            "description": "Gemini tool configuration such as functionCallingConfig.",
            "properties": {
              "functionCallingConfig": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string"
                  },
                  "allowedFunctionNames": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": true
              },
              "function_calling_config": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string"
                  },
                  "allowed_function_names": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": true
              }
            },
            "additionalProperties": true
          },
          "cachedContent": {
            "type": "string",
            "description": "Gemini cached content resource name for compatible models."
          },
          "system_instruction": {
            "type": "object",
            "additionalProperties": true,
            "description": "Original proto field-name spelling of systemInstruction."
          },
          "generation_config": {
            "type": "object",
            "additionalProperties": true,
            "description": "Original proto field-name spelling of generationConfig."
          },
          "safety_settings": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "description": "Original proto field-name spelling of safetySettings."
          },
          "tool_config": {
            "type": "object",
            "additionalProperties": true,
            "description": "Original proto field-name spelling of toolConfig."
          },
          "cached_content": {
            "type": "string",
            "description": "Original proto field-name spelling of cachedContent."
          }
        },
        "additionalProperties": true
      },
      "GeminiResponse": {
        "type": "object",
        "properties": {
          "candidates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "content": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string"
                    },
                    "parts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "finishReason": {
                  "type": "string"
                },
                "safetyRatings": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "category": {
                        "type": "string"
                      },
                      "probability": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "usageMetadata": {
            "type": "object",
            "properties": {
              "promptTokenCount": {
                "type": "integer"
              },
              "candidatesTokenCount": {
                "type": "integer"
              },
              "totalTokenCount": {
                "type": "integer"
              }
            }
          }
        }
      },
      "ManagementBalanceResponse": {
        "type": "object",
        "required": [
          "object",
          "organization_id",
          "balance",
          "balance_decimal",
          "total_recharge",
          "total_recharge_decimal",
          "total_used",
          "total_used_decimal"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "organization_balance"
            ]
          },
          "organization_id": {
            "type": "string",
            "description": "Organization associated with the current management token."
          },
          "balance": {
            "type": "number",
            "description": "Current organization balance in USD as a JSON number for display."
          },
          "total_recharge": {
            "type": "number",
            "description": "Total successful organization recharge amount in USD as a JSON number for display."
          },
          "total_used": {
            "type": "number",
            "description": "Total organization usage spend in USD as a JSON number for display."
          },
          "balance_decimal": {
            "type": "string",
            "description": "Exact current organization balance in USD as a decimal string for reconciliation."
          },
          "total_recharge_decimal": {
            "type": "string",
            "description": "Exact total successful organization recharge amount in USD as a decimal string for reconciliation."
          },
          "total_used_decimal": {
            "type": "string",
            "description": "Exact total organization usage spend in USD as a decimal string for reconciliation."
          }
        }
      },
      "ManagementApiKey": {
        "type": "object",
        "required": [
          "id",
          "name",
          "key_prefix",
          "status",
          "limit_amount",
          "limit_amount_decimal",
          "used_amount",
          "used_amount_decimal",
          "models",
          "expires_at",
          "last_used_at",
          "created_at",
          "delivery_policy"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "key_prefix": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive",
              "suspended",
              "revoked"
            ],
            "description": "Lifecycle status for the user API key: active, inactive, or revoked."
          },
          "limit_amount": {
            "type": [
              "number",
              "null"
            ],
            "description": "API key spending cap in USD as a JSON number for display. null means unlimited."
          },
          "used_amount": {
            "type": "number",
            "description": "Accumulated API key usage in USD as a JSON number for display."
          },
          "models": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "key": {
            "type": "string",
            "description": "Returned only on creation"
          },
          "limit_amount_decimal": {
            "type": [
              "string",
              "null"
            ],
            "description": "Exact API key spending cap in USD as a decimal string. null means unlimited."
          },
          "used_amount_decimal": {
            "type": "string",
            "description": "Exact accumulated API key usage in USD as a decimal string for reconciliation."
          },
          "delivery_policy": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "auto",
              "verified",
              "official",
              null
            ],
            "description": "Per-key Delivery policy. null inherits the Workspace default."
          }
        }
      },
      "ManagementApiKeyListResponse": {
        "type": "object",
        "required": [
          "object",
          "data",
          "pagination"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagementApiKey"
            }
          },
          "pagination": {
            "type": "object",
            "required": [
              "page",
              "limit",
              "total",
              "totalPages"
            ],
            "properties": {
              "page": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              },
              "totalPages": {
                "type": "integer"
              }
            }
          }
        }
      },
      "ManagementUsageItem": {
        "type": "object",
        "required": [
          "request_id",
          "billing_transaction_id",
          "model",
          "logical_model",
          "model_vendor",
          "scene",
          "usage_unit",
          "usage_quantity",
          "usage_quantity_decimal",
          "prompt_tokens",
          "completion_tokens",
          "total_tokens",
          "cache_read_tokens",
          "cache_write_tokens",
          "cache_write_tokens_5m",
          "cache_write_tokens_1h",
          "cost",
          "cost_decimal",
          "created_at",
          "requested_policy",
          "resolved_tier",
          "charged_price_basis"
        ],
        "properties": {
          "request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_transaction_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Settled billing transaction id for request-level reconciliation."
          },
          "model_vendor": {
            "type": [
              "string",
              "null"
            ]
          },
          "scene": {
            "type": [
              "string",
              "null"
            ]
          },
          "usage_unit": {
            "type": "string"
          },
          "usage_quantity": {
            "type": "number"
          },
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          },
          "cache_read_tokens": {
            "type": "integer"
          },
          "cache_write_tokens": {
            "type": "integer"
          },
          "cost": {
            "type": "number",
            "description": "Request cost in USD as a JSON number for display."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "model": {
            "type": "string"
          },
          "logical_model": {
            "type": "string"
          },
          "usage_quantity_decimal": {
            "type": "string",
            "description": "Exact usage quantity as a decimal string for non-token units."
          },
          "cache_write_tokens_5m": {
            "type": "integer"
          },
          "cache_write_tokens_1h": {
            "type": "integer"
          },
          "cost_decimal": {
            "type": "string",
            "description": "Exact request cost in USD as a decimal string for reconciliation."
          },
          "requested_policy": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "auto",
              "verified",
              "official",
              null
            ]
          },
          "resolved_tier": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "verified",
              "official",
              null
            ]
          },
          "charged_price_basis": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ChargedPriceBasis"
              }
            ]
          }
        }
      },
      "ManagementUsageSummary": {
        "type": "object",
        "required": [
          "total_requests",
          "total_cost",
          "total_cost_decimal",
          "total_prompt_tokens",
          "total_completion_tokens",
          "total_tokens",
          "usage_unit_breakdown"
        ],
        "properties": {
          "total_requests": {
            "type": "integer"
          },
          "total_cost": {
            "type": "number",
            "description": "Aggregated total cost in USD as a JSON number for display."
          },
          "total_prompt_tokens": {
            "type": "integer"
          },
          "total_completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          },
          "usage_unit_breakdown": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "usage_unit",
                "usage_quantity"
              ],
              "properties": {
                "usage_unit": {
                  "type": "string"
                },
                "usage_quantity": {
                  "type": "number"
                }
              }
            }
          },
          "total_cost_decimal": {
            "type": "string",
            "description": "Exact aggregated total cost in USD as a decimal string for reconciliation."
          }
        }
      },
      "ManagementModelVendorBreakdown": {
        "type": "object",
        "required": [
          "model_vendor",
          "requests",
          "cost"
        ],
        "properties": {
          "model_vendor": {
            "type": "string"
          },
          "requests": {
            "type": "integer"
          },
          "cost": {
            "type": "number",
            "description": "Cost in USD as a JSON number for display."
          }
        }
      },
      "ManagementSceneBreakdown": {
        "type": "object",
        "required": [
          "scene",
          "requests",
          "cost",
          "cost_decimal"
        ],
        "properties": {
          "scene": {
            "type": [
              "string",
              "null"
            ]
          },
          "requests": {
            "type": "integer"
          },
          "cost": {
            "type": "number",
            "description": "Cost in USD as a JSON number for display."
          },
          "cost_decimal": {
            "type": "string",
            "description": "Exact cost in USD as a decimal string for reconciliation."
          }
        }
      },
      "ManagementDailyCostBreakdown": {
        "type": "object",
        "required": [
          "date",
          "cost",
          "cost_decimal"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "cost": {
            "type": "number",
            "description": "Cost in USD as a JSON number for display."
          },
          "cost_decimal": {
            "type": "string",
            "description": "Exact cost in USD as a decimal string for reconciliation."
          }
        }
      },
      "ManagementBreakdowns": {
        "type": "object",
        "properties": {
          "by_model_vendor": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagementModelVendorBreakdown"
            }
          },
          "by_scene": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagementSceneBreakdown"
            }
          },
          "daily_cost": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagementDailyCostBreakdown"
            }
          },
          "by_model": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagementModelBreakdown"
            }
          },
          "by_logical_model": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagementModelBreakdown"
            }
          }
        }
      },
      "ManagementUsageResponse": {
        "type": "object",
        "required": [
          "api_key",
          "items",
          "pagination",
          "summary",
          "breakdowns"
        ],
        "properties": {
          "api_key": {
            "$ref": "#/components/schemas/ManagementApiKey"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagementUsageItem"
            }
          },
          "pagination": {
            "type": "object",
            "required": [
              "page",
              "limit",
              "total",
              "totalPages"
            ],
            "properties": {
              "page": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              },
              "totalPages": {
                "type": "integer"
              }
            }
          },
          "summary": {
            "$ref": "#/components/schemas/ManagementUsageSummary"
          },
          "breakdowns": {
            "$ref": "#/components/schemas/ManagementBreakdowns"
          }
        }
      },
      "ManagementBillingResponse": {
        "type": "object",
        "required": [
          "api_key",
          "summary",
          "breakdowns"
        ],
        "properties": {
          "api_key": {
            "$ref": "#/components/schemas/ManagementApiKey"
          },
          "summary": {
            "$ref": "#/components/schemas/ManagementUsageSummary"
          },
          "breakdowns": {
            "$ref": "#/components/schemas/ManagementBreakdowns"
          }
        }
      },
      "ModelListItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Model identifier",
            "example": "gpt-4o"
          },
          "object": {
            "type": "string",
            "enum": [
              "model"
            ]
          },
          "created": {
            "type": "integer",
            "description": "Unix timestamp"
          },
          "owned_by": {
            "type": "string",
            "description": "Model provider",
            "example": "openai"
          },
          "tokenlab": {
            "$ref": "#/components/schemas/ModelListTokenLabExtension"
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "owned_by",
          "tokenlab"
        ],
        "additionalProperties": false
      },
      "ModelPricingResponse": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "deliveryAvailability": {
            "type": "object",
            "description": "Current model availability by delivery tier; omitted when the source projection is unavailable.",
            "properties": {
              "verified": {
                "type": "boolean",
                "description": "Whether this model has eligible TokenLab Verified delivery supply."
              },
              "official": {
                "type": "boolean",
                "description": "Whether this model has eligible Official delivery supply."
              },
              "operations": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "verified": {
                      "type": "boolean"
                    },
                    "official": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "verified",
                    "official"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "verified",
              "official"
            ],
            "additionalProperties": false
          },
          "pricing_unit": {
            "type": "string"
          },
          "has_complex_pricing": {
            "type": "boolean"
          },
          "supported_operations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pricing_summary": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "pricing_provenance": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "pricing_details": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "scalar_pricing": {
            "$ref": "#/components/schemas/ScalarPricing",
            "description": "TokenLab Verified price. The price fields are null when the model has no Verified supply (`deliveryAvailability.verified` is false)."
          },
          "official_scalar_pricing": {
            "$ref": "#/components/schemas/ScalarPricing",
            "description": "Official price. Requests that Official delivers are billed at this price."
          }
        },
        "additionalProperties": true
      },
      "FileObject": {
        "type": "object",
        "required": [
          "id",
          "object",
          "bytes",
          "created_at",
          "filename",
          "purpose"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "file-abc123"
          },
          "object": {
            "type": "string",
            "enum": [
              "file"
            ]
          },
          "bytes": {
            "type": "integer",
            "example": 1234
          },
          "created_at": {
            "type": "integer",
            "example": 1741339200
          },
          "filename": {
            "type": "string",
            "example": "batch.jsonl"
          },
          "purpose": {
            "type": "string",
            "enum": [
              "batch",
              "batch_output",
              "user_data",
              "vision"
            ],
            "description": "File purpose. batch and batch_output are used by Batches; user_data and vision are used by file-backed image/reference requests."
          },
          "status": {
            "type": "string",
            "example": "processed",
            "description": "Batch file processing status. Image/reference file objects may omit this field."
          },
          "expires_at": {
            "type": [
              "integer",
              "null"
            ],
            "example": 1741425600
          }
        },
        "description": "File metadata. Batch files include status; image/reference files may omit status depending on the file purpose."
      },
      "FileListResponse": {
        "type": "object",
        "required": [
          "object",
          "data",
          "first_id",
          "last_id",
          "has_more"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FileObject"
            }
          },
          "first_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "has_more": {
            "type": "boolean"
          }
        }
      },
      "BatchRequestCounts": {
        "type": "object",
        "required": [
          "total",
          "completed",
          "failed"
        ],
        "properties": {
          "total": {
            "type": "integer"
          },
          "completed": {
            "type": "integer"
          },
          "failed": {
            "type": "integer"
          },
          "cancelled": {
            "type": "integer"
          }
        }
      },
      "BatchObject": {
        "type": "object",
        "required": [
          "id",
          "object",
          "endpoint",
          "input_file_id",
          "completion_window",
          "status",
          "created_at",
          "request_counts"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "batch_abc123"
          },
          "object": {
            "type": "string",
            "enum": [
              "batch"
            ]
          },
          "endpoint": {
            "type": "string",
            "enum": [
              "/v1/chat/completions",
              "/v1/embeddings"
            ]
          },
          "errors": {
            "type": [
              "object",
              "array",
              "null"
            ]
          },
          "input_file_id": {
            "type": "string"
          },
          "completion_window": {
            "type": "string",
            "enum": [
              "24h"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "validating",
              "queued",
              "in_progress",
              "finalizing",
              "completed",
              "failed",
              "cancelling",
              "cancelled",
              "expired"
            ]
          },
          "output_file_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_file_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "integer"
          },
          "in_progress_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "finalizing_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "completed_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "failed_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expired_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "cancelling_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "cancelled_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "request_counts": {
            "$ref": "#/components/schemas/BatchRequestCounts"
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ]
          }
        }
      },
      "BatchListResponse": {
        "type": "object",
        "required": [
          "object",
          "data",
          "has_more"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchObject"
            }
          },
          "first_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "has_more": {
            "type": "boolean"
          }
        }
      },
      "BatchOutputExpiresAfter": {
        "type": "object",
        "required": [
          "anchor",
          "seconds"
        ],
        "properties": {
          "anchor": {
            "type": "string",
            "enum": [
              "created_at",
              "completed_at"
            ]
          },
          "seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2592000
          }
        }
      },
      "BatchCreateRequest": {
        "type": "object",
        "required": [
          "input_file_id",
          "endpoint"
        ],
        "properties": {
          "input_file_id": {
            "type": "string",
            "description": "ID of an uploaded file with `purpose` set to `batch`."
          },
          "endpoint": {
            "type": "string",
            "enum": [
              "/v1/chat/completions",
              "/v1/embeddings"
            ]
          },
          "completion_window": {
            "type": "string",
            "enum": [
              "24h"
            ],
            "default": "24h"
          },
          "metadata": {
            "type": "object",
            "description": "Up to 16 string key-value pairs. Keys up to 64 characters, values up to 512 characters.",
            "additionalProperties": {
              "type": "string",
              "maxLength": 512
            }
          },
          "output_expires_after": {
            "$ref": "#/components/schemas/BatchOutputExpiresAfter",
            "description": "When the result files expire, up to 30 days after the anchor."
          }
        }
      },
      "PricingEntry": {
        "type": "object",
        "required": [
          "model",
          "provider",
          "is_lock_price",
          "capabilities",
          "aliases"
        ],
        "properties": {
          "model": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "deliveryAvailability": {
            "type": "object",
            "description": "Current model availability by delivery tier; omitted when the source projection is unavailable.",
            "properties": {
              "verified": {
                "type": "boolean",
                "description": "Whether this model has eligible TokenLab Verified delivery supply."
              },
              "official": {
                "type": "boolean",
                "description": "Whether this model has eligible Official delivery supply."
              },
              "operations": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "verified": {
                      "type": "boolean"
                    },
                    "official": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "verified",
                    "official"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "verified",
              "official"
            ],
            "additionalProperties": false
          },
          "is_lock_price": {
            "type": "boolean"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "aliases": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "input_per_1m_tokens": {
            "type": [
              "string",
              "null"
            ],
            "description": "TokenLab Verified price per 1M input tokens. Omitted when the model has no Verified supply (`deliveryAvailability.verified` is false)."
          },
          "output_per_1m_tokens": {
            "type": [
              "string",
              "null"
            ],
            "description": "TokenLab Verified price per 1M output tokens. Omitted when the model has no Verified supply (`deliveryAvailability.verified` is false)."
          },
          "lock_price_per_request": {
            "type": [
              "string",
              "null"
            ],
            "description": "TokenLab Verified price per request. Omitted when the model has no Verified supply (`deliveryAvailability.verified` is false)."
          },
          "official_input_per_1m_tokens": {
            "type": [
              "string",
              "null"
            ],
            "description": "Official price per 1M input tokens. Requests that Official delivers are billed at this price."
          },
          "official_output_per_1m_tokens": {
            "type": [
              "string",
              "null"
            ],
            "description": "Official price per 1M output tokens. Requests that Official delivers are billed at this price."
          },
          "official_lock_price_per_request": {
            "type": [
              "string",
              "null"
            ],
            "description": "Official price per request. Requests that Official delivers are billed at this price."
          },
          "has_complex_pricing": {
            "type": "boolean"
          },
          "supported_operations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pricing_summary": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "pricing_provenance": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "PricingResponse": {
        "type": "object",
        "required": [
          "object",
          "updated_at",
          "currency",
          "data"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "pricing"
            ]
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PricingEntry"
            }
          }
        },
        "additionalProperties": true
      },
      "TranslationRequest": {
        "type": "object",
        "required": [
          "model",
          "text",
          "target_language"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "ID of a model that lists the `translation` operation."
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "description": "Source text. Length limit depends on the model."
          },
          "source_language": {
            "type": "string",
            "description": "Optional source language hint, for example `zh`."
          },
          "target_language": {
            "type": "string",
            "minLength": 1,
            "description": "Target language, for example en."
          },
          "mime_type": {
            "type": "string",
            "enum": [
              "text/plain",
              "text/html"
            ],
            "default": "text/plain",
            "description": "Source text format, for models that list it."
          },
          "user": {
            "type": "string",
            "description": "End-user identifier, for models that list it."
          }
        },
        "additionalProperties": false
      },
      "TranslationResponse": {
        "type": "object",
        "required": [
          "text",
          "model",
          "target_language"
        ],
        "properties": {
          "text": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "source_language": {
            "type": [
              "string",
              "null"
            ]
          },
          "target_language": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "GeminiModelInfo": {
        "type": "object",
        "required": [
          "name",
          "baseModelId",
          "version"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "baseModelId": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "inputTokenLimit": {
            "type": "integer"
          },
          "outputTokenLimit": {
            "type": "integer"
          },
          "supportedGenerationMethods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "temperature": {
            "type": "number"
          },
          "maxTemperature": {
            "type": "number"
          },
          "topP": {
            "type": "number"
          },
          "topK": {
            "type": "number"
          }
        },
        "additionalProperties": true
      },
      "GeminiModelListResponse": {
        "type": "object",
        "required": [
          "models"
        ],
        "properties": {
          "models": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GeminiModelInfo"
            }
          },
          "nextPageToken": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "GeminiErrorResponse": {
        "type": "object",
        "additionalProperties": true
      },
      "AnthropicCountTokensRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "Model to count tokens for",
            "example": "claude-sonnet-4-6"
          },
          "messages": {
            "type": "array",
            "description": "Messages in the conversation",
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "type": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string"
                              },
                              "media_type": {
                                "type": "string"
                              },
                              "data": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "cache_control": {
            "type": "object",
            "additionalProperties": true,
            "description": "Top-level Anthropic cache control marker for count_tokens requests."
          },
          "output_config": {
            "type": "object",
            "additionalProperties": true,
            "description": "Anthropic output configuration fields that may affect token counting."
          },
          "system": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    }
                  }
                }
              }
            ],
            "description": "System prompt"
          },
          "thinking": {
            "type": "object",
            "additionalProperties": true,
            "description": "Anthropic extended thinking configuration for token counting."
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "description": "Tool definitions available to the model."
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "additionalProperties": true
              }
            ],
            "description": "Tool choice policy or explicit tool selection."
          }
        },
        "additionalProperties": true
      },
      "AnthropicCountTokensResponse": {
        "type": "object",
        "required": [
          "input_tokens"
        ],
        "properties": {
          "input_tokens": {
            "type": "integer",
            "description": "Number of input tokens in the supplied Anthropic messages request. An estimate for planning; it can differ from the usage of the real request.",
            "example": 1234
          }
        },
        "additionalProperties": true
      },
      "AnthropicErrorResponse": {
        "type": "object",
        "description": "Error body of the Anthropic-compatible endpoints (`/v1/messages` and its sub-resources).",
        "required": [
          "type",
          "error"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "error"
            ]
          },
          "error": {
            "type": "object",
            "required": [
              "type",
              "message"
            ],
            "properties": {
              "type": {
                "type": "string",
                "description": "One of `invalid_request_error`, `authentication_error`, `billing_error`, `permission_error`, `not_found_error`, `conflict_error`, `request_too_large`, `rate_limit_error`, `timeout_error`, `api_error`, `overloaded_error`."
              },
              "message": {
                "type": "string"
              },
              "code": {
                "type": "string",
                "description": "TokenLab error code, when one applies, for example `insufficient_balance`."
              }
            },
            "additionalProperties": true
          },
          "request_id": {
            "type": "string",
            "description": "TokenLab request ID. Also returned in the `request-id` and `X-Request-ID` response headers."
          }
        },
        "additionalProperties": true
      },
      "MultimodalEmbeddingRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "Model to use for multimodal embeddings",
            "example": "qwen3-vl-embedding"
          },
          "input": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MultimodalEmbeddingInputItem"
              },
              {
                "type": "array",
                "minItems": 1,
                "items": {
                  "$ref": "#/components/schemas/MultimodalEmbeddingInputItem"
                }
              }
            ]
          },
          "dimensions": {
            "type": "integer",
            "minimum": 1,
            "description": "Optional embedding dimensionality when supported by the selected model"
          }
        },
        "additionalProperties": false
      },
      "MultimodalEmbeddingInputItem": {
        "type": "object",
        "description": "A multimodal embedding input item. Send at least one of `text`, `image_url`, or `image_base64`. Only `text` is active; an image returns 400 `image_input_deferred`.",
        "properties": {
          "text": {
            "type": "string",
            "description": "Text to embed"
          },
          "image_base64": {
            "type": "string",
            "description": "Base64-encoded image content. Not active yet."
          },
          "image_mime_type": {
            "type": "string",
            "description": "MIME type for image_base64",
            "example": "image/png"
          },
          "image_url": {
            "type": "string",
            "description": "Public image URL to embed. Not active yet."
          }
        },
        "additionalProperties": false
      },
      "MultimodalEmbeddingResponse": {
        "type": "object",
        "required": [
          "object",
          "data",
          "model",
          "usage"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "object",
                "index"
              ],
              "properties": {
                "object": {
                  "type": "string",
                  "enum": [
                    "embedding"
                  ]
                },
                "index": {
                  "type": "integer"
                },
                "text_embedding": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  }
                },
                "image_embedding": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  }
                },
                "video_embedding": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  }
                },
                "audio_embedding": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  }
                }
              },
              "additionalProperties": true
            }
          },
          "model": {
            "type": "string"
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "ModelListTokenLabExtension": {
        "type": "object",
        "description": "TokenLab model discovery fields. Use the model details endpoint for the full supported request and pricing contract.",
        "properties": {
          "aliases": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "deliveryAvailability": {
            "type": "object",
            "description": "Current model availability by delivery tier; omitted when the source projection is unavailable.",
            "properties": {
              "verified": {
                "type": "boolean",
                "description": "Whether this model has eligible TokenLab Verified delivery supply."
              },
              "official": {
                "type": "boolean",
                "description": "Whether this model has eligible Official delivery supply."
              },
              "operations": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "verified": {
                      "type": "boolean"
                    },
                    "official": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "verified",
                    "official"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "verified",
              "official"
            ],
            "additionalProperties": false
          },
          "pricing": {
            "$ref": "#/components/schemas/ScalarPricing",
            "description": "TokenLab Verified price. The price fields are null when the model has no Verified supply (`deliveryAvailability.verified` is false)."
          },
          "official_pricing": {
            "$ref": "#/components/schemas/ScalarPricing",
            "description": "Official price. Requests that Official delivers are billed at this price."
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "providers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "max_input_tokens": {
            "type": [
              "number",
              "null"
            ]
          },
          "max_output_tokens": {
            "type": [
              "number",
              "null"
            ]
          },
          "category": {
            "type": "string"
          },
          "pricing_unit": {
            "type": "string"
          },
          "cache_pricing": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "TokenLab Verified prompt-cache prices. Null or omitted when the model has no Verified supply (`deliveryAvailability.verified` is false)."
          },
          "official_cache_pricing": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "Official prompt-cache prices. Null or omitted when none are published."
          },
          "has_complex_pricing": {
            "type": "boolean"
          },
          "pricing_summary": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "agent_preferences": {
            "type": "object",
            "additionalProperties": true
          },
          "lifecycle": {
            "type": "object",
            "required": [
              "stage",
              "reason",
              "replacement_model",
              "released_at",
              "deprecated_at",
              "retired_at",
              "sunset_at",
              "latest",
              "latest_source",
              "latest_window_days"
            ],
            "properties": {
              "stage": {
                "type": "string",
                "enum": [
                  "active",
                  "preview",
                  "deprecated",
                  "retired"
                ],
                "description": "Model lifecycle stage for public discovery and display."
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Short model lifecycle explanation."
              },
              "replacement_model": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Recommended replacement model when available."
              },
              "released_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Official release date when available."
              },
              "deprecated_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Official deprecation date when available."
              },
              "retired_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Official retirement date when the model is no longer public-discoverable."
              },
              "sunset_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Future sunset date for deprecated models."
              },
              "latest": {
                "type": "boolean",
                "description": "Whether the model should receive a latest badge."
              },
              "latest_source": {
                "type": "string",
                "enum": [
                  "auto",
                  "override",
                  "none"
                ],
                "description": "How the latest badge was derived."
              },
              "latest_window_days": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Window used for automatic latest badges."
              }
            },
            "additionalProperties": false
          },
          "commercial": {
            "type": "object",
            "required": [
              "user_charge_policy",
              "free_reason",
              "free_until"
            ],
            "properties": {
              "user_charge_policy": {
                "type": "string",
                "enum": [
                  "paid",
                  "free"
                ],
                "description": "User billing policy for this model."
              },
              "free_reason": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "platform",
                  "promotion",
                  null
                ],
                "description": "Reason a model is free to users, if applicable."
              },
              "free_until": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "End time for a temporary free policy, if applicable."
              }
            },
            "additionalProperties": false
          },
          "badges": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "key",
                "tone",
                "priority",
                "tooltip"
              ],
              "properties": {
                "key": {
                  "type": "string",
                  "enum": [
                    "free",
                    "latest",
                    "preview",
                    "deprecated",
                    "retired"
                  ]
                },
                "tone": {
                  "type": "string",
                  "enum": [
                    "green",
                    "blue",
                    "amber",
                    "red",
                    "slate"
                  ]
                },
                "priority": {
                  "type": "integer"
                },
                "tooltip": {
                  "type": "object",
                  "required": [
                    "key",
                    "values"
                  ],
                  "properties": {
                    "key": {
                      "type": "string"
                    },
                    "values": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              },
              "additionalProperties": false
            },
            "description": "Display badges derived from lifecycle and commercial metadata."
          },
          "request_format_summary": {
            "$ref": "#/components/schemas/ModelListRequestFormatSummary"
          }
        },
        "required": [
          "aliases",
          "pricing",
          "official_pricing",
          "capabilities",
          "max_input_tokens",
          "max_output_tokens",
          "category",
          "pricing_unit",
          "has_complex_pricing",
          "lifecycle",
          "commercial",
          "badges"
        ],
        "additionalProperties": false
      },
      "ModelTokenLabExtension": {
        "type": "object",
        "description": "TokenLab extension fields for the detail route, including pricing, capabilities, recommendation metadata, and detailed non-chat request metadata.",
        "properties": {
          "aliases": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "deliveryAvailability": {
            "type": "object",
            "description": "Current model availability by delivery tier; omitted when the source projection is unavailable.",
            "properties": {
              "verified": {
                "type": "boolean",
                "description": "Whether this model has eligible TokenLab Verified delivery supply."
              },
              "official": {
                "type": "boolean",
                "description": "Whether this model has eligible Official delivery supply."
              },
              "operations": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "verified": {
                      "type": "boolean"
                    },
                    "official": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "verified",
                    "official"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "verified",
              "official"
            ],
            "additionalProperties": false
          },
          "pricing": {
            "$ref": "#/components/schemas/ScalarPricing",
            "description": "TokenLab Verified price. The price fields are null when the model has no Verified supply (`deliveryAvailability.verified` is false)."
          },
          "official_pricing": {
            "$ref": "#/components/schemas/ScalarPricing",
            "description": "Official price. Requests that Official delivers are billed at this price."
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "providers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "max_input_tokens": {
            "type": [
              "number",
              "null"
            ]
          },
          "max_output_tokens": {
            "type": [
              "number",
              "null"
            ]
          },
          "category": {
            "type": "string"
          },
          "pricing_unit": {
            "type": "string"
          },
          "cache_pricing": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "TokenLab Verified prompt-cache prices. Null or omitted when the model has no Verified supply (`deliveryAvailability.verified` is false)."
          },
          "official_cache_pricing": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "Official prompt-cache prices. Null or omitted when none are published."
          },
          "has_complex_pricing": {
            "type": "boolean"
          },
          "supported_operations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pricing_summary": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "pricing_provenance": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "lifecycle": {
            "type": "object",
            "required": [
              "stage",
              "reason",
              "replacement_model",
              "released_at",
              "deprecated_at",
              "retired_at",
              "sunset_at",
              "latest",
              "latest_source",
              "latest_window_days"
            ],
            "properties": {
              "stage": {
                "type": "string",
                "enum": [
                  "active",
                  "preview",
                  "deprecated",
                  "retired"
                ],
                "description": "Model lifecycle stage for public discovery and display."
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Short model lifecycle explanation."
              },
              "replacement_model": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Recommended replacement model when available."
              },
              "released_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Official release date when available."
              },
              "deprecated_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Official deprecation date when available."
              },
              "retired_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Official retirement date when the model is no longer public-discoverable."
              },
              "sunset_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Future sunset date for deprecated models."
              },
              "latest": {
                "type": "boolean",
                "description": "Whether the model should receive a latest badge."
              },
              "latest_source": {
                "type": "string",
                "enum": [
                  "auto",
                  "override",
                  "none"
                ],
                "description": "How the latest badge was derived."
              },
              "latest_window_days": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Window used for automatic latest badges."
              }
            },
            "additionalProperties": false
          },
          "commercial": {
            "type": "object",
            "required": [
              "user_charge_policy",
              "free_reason",
              "free_until"
            ],
            "properties": {
              "user_charge_policy": {
                "type": "string",
                "enum": [
                  "paid",
                  "free"
                ],
                "description": "User billing policy for this model."
              },
              "free_reason": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "platform",
                  "promotion",
                  null
                ],
                "description": "Reason a model is free to users, if applicable."
              },
              "free_until": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "End time for a temporary free policy, if applicable."
              }
            },
            "additionalProperties": false
          },
          "badges": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "key",
                "tone",
                "priority",
                "tooltip"
              ],
              "properties": {
                "key": {
                  "type": "string",
                  "enum": [
                    "free",
                    "latest",
                    "preview",
                    "deprecated",
                    "retired"
                  ]
                },
                "tone": {
                  "type": "string",
                  "enum": [
                    "green",
                    "blue",
                    "amber",
                    "red",
                    "slate"
                  ]
                },
                "priority": {
                  "type": "integer"
                },
                "tooltip": {
                  "type": "object",
                  "required": [
                    "key",
                    "values"
                  ],
                  "properties": {
                    "key": {
                      "type": "string"
                    },
                    "values": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              },
              "additionalProperties": false
            },
            "description": "Display badges derived from lifecycle and commercial metadata."
          },
          "request_format_summary": {
            "$ref": "#/components/schemas/NonChatRequestFormatSummary"
          },
          "request_format_details": {
            "$ref": "#/components/schemas/NonChatRequestFormatDetails"
          },
          "accepted_request_formats": {
            "type": "array",
            "description": "Request formats accepted by this model.",
            "items": {
              "type": "string",
              "enum": [
                "openai_chat_completions",
                "openai_responses",
                "anthropic_messages",
                "gemini_generate_content"
              ]
            }
          }
        },
        "additionalProperties": true,
        "required": [
          "lifecycle",
          "commercial",
          "badges",
          "accepted_request_formats"
        ]
      },
      "SeedanceMaterialAssetGroupCreateRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "group_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Optional display name for the material group."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500
          },
          "library_type": {
            "type": "string",
            "enum": [
              "aigc_avatar",
              "liveness_face"
            ],
            "default": "aigc_avatar",
            "description": "Material library class. Direct creation supports aigc_avatar. Create liveness_face groups through CreateVisualValidateSession followed by GetVisualValidateResult."
          },
          "project_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "default": "default",
            "description": "Project scope for the material group."
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        }
      },
      "SeedanceMaterialAssetGroupUpdateRequest": {
        "type": "object",
        "properties": {
          "group_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500
          },
          "project_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "default": "default"
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        }
      },
      "SeedanceMaterialAssetGroup": {
        "type": "object",
        "required": [
          "id",
          "object",
          "status",
          "library_type"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "TokenLab material group ID. Use it as group_id when uploading materials."
          },
          "object": {
            "type": "string",
            "enum": [
              "seedance.material_asset_group"
            ]
          },
          "library_type": {
            "type": "string",
            "enum": [
              "aigc_avatar",
              "liveness_face"
            ]
          },
          "project_name": {
            "type": "string",
            "description": "Project scope for this material group."
          },
          "group_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp in milliseconds when the material group was created."
          },
          "updated_at": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp in milliseconds when the material group was last updated."
          }
        }
      },
      "SeedanceMaterialAssetGroupList": {
        "type": "object",
        "required": [
          "groups"
        ],
        "properties": {
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SeedanceMaterialAssetGroup"
            }
          },
          "next_page_token": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "SeedanceMaterialAssetUpdateRequest": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "asset_url": {
            "type": "string",
            "format": "uri",
            "description": "Replacement publicly reachable material asset URL."
          },
          "asset_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Updated display name stored with the material asset."
          },
          "asset_type": {
            "type": "string",
            "enum": [
              "Image",
              "Video",
              "Audio"
            ]
          },
          "project_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "default": "default"
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "Updated client metadata stored with the material asset."
          }
        },
        "additionalProperties": false,
        "description": "Update asset_name or metadata. The source URL and asset type cannot be changed; create a new asset instead."
      },
      "ManagementModelBreakdown": {
        "type": "object",
        "required": [
          "model",
          "logical_model",
          "model_vendor",
          "requests",
          "cost",
          "cost_decimal",
          "usage_quantity",
          "usage_quantity_decimal"
        ],
        "properties": {
          "model_vendor": {
            "type": [
              "string",
              "null"
            ]
          },
          "requests": {
            "type": "integer"
          },
          "cost": {
            "type": "number",
            "description": "Cost in USD as a JSON number for display."
          },
          "usage_quantity": {
            "type": "number"
          },
          "model": {
            "type": "string"
          },
          "logical_model": {
            "type": "string"
          },
          "cost_decimal": {
            "type": "string",
            "description": "Exact cost in USD as a decimal string for reconciliation."
          },
          "usage_quantity_decimal": {
            "type": "string"
          }
        }
      },
      "ModelListRequestFormatSummary": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "public_operations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "request_endpoint": {
            "type": [
              "string",
              "null"
            ]
          },
          "request_endpoint_by_operation": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        "additionalProperties": false
      },
      "NonChatOperationConstraint": {
        "type": "object",
        "properties": {
          "operation": {
            "type": "string"
          },
          "request_endpoint": {
            "type": [
              "string",
              "null"
            ]
          },
          "request_shape_mode": {
            "type": [
              "string",
              "null"
            ]
          },
          "status_mode": {
            "type": [
              "string",
              "null"
            ]
          },
          "supported_parameters": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "required_selectors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "optional_selectors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "documented_inputs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowed_resolutions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowed_durations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowed_aspect_ratios": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "parameter_options": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": [
                  "string",
                  "number",
                  "boolean"
                ]
              }
            }
          },
          "parameter_value_constraints": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "enum": {
                  "type": "array",
                  "items": {
                    "type": [
                      "string",
                      "boolean"
                    ]
                  }
                },
                "enumCaseInsensitive": {
                  "type": "boolean"
                },
                "maxItems": {
                  "type": "integer"
                },
                "maxInteger": {
                  "type": "integer"
                },
                "when": {
                  "type": "object",
                  "properties": {
                    "parameter": {
                      "type": "string"
                    },
                    "equals": {
                      "type": [
                        "string",
                        "boolean"
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              },
              "additionalProperties": false
            }
          },
          "parameter_ranges": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "minimum": {
                  "type": "number"
                },
                "maximum": {
                  "type": "number"
                }
              },
              "additionalProperties": false
            }
          },
          "compatibility_only_parameters": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "parameter_defaults": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            }
          },
          "parameter_notes": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "input_limits": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "minItems": {
                  "type": "integer"
                },
                "maxItems": {
                  "type": "integer"
                }
              },
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      },
      "NonChatRequestFormatSummary": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "public_operations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "supported_parameters": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "feature_flags": {
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            }
          },
          "output_formats": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "service_limits": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "online_rpm": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "concurrency": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "offline_inference": {
                "type": "boolean"
              },
              "offline_tpd": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "prompt_max_characters": {
                "type": [
                  "number",
                  "null"
                ]
              }
            },
            "additionalProperties": false
          },
          "required_selectors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "optional_selectors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "resolutions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "resolutions_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "durations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "durations_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "aspect_ratios": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "aspect_ratios_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "request_endpoint": {
            "type": [
              "string",
              "null"
            ]
          },
          "status_mode": {
            "type": [
              "string",
              "null"
            ]
          },
          "request_shape_mode": {
            "type": [
              "string",
              "null"
            ]
          },
          "recommended_request_summary": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "request_endpoint_by_operation": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "operation_constraints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NonChatOperationConstraint"
            }
          }
        },
        "additionalProperties": true
      },
      "NonChatRequestFormatDetails": {
        "allOf": [
          {
            "$ref": "#/components/schemas/NonChatRequestFormatSummary"
          },
          {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "documented_inputs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "documented_outputs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "fallback_status_endpoints": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "notes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "recommended_request": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": true
              }
            },
            "additionalProperties": true
          }
        ]
      },
      "FileDeletedObject": {
        "type": "object",
        "required": [
          "id",
          "object",
          "deleted"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "file-abc123"
          },
          "object": {
            "type": "string",
            "enum": [
              "file"
            ]
          },
          "deleted": {
            "type": "boolean",
            "example": true
          }
        },
        "additionalProperties": true
      },
      "ManagementCreatedApiKey": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ManagementApiKey"
          },
          {
            "type": "object",
            "required": [
              "key"
            ],
            "properties": {
              "key": {
                "type": "string",
                "description": "Full secret API key value returned only on creation. Store it immediately."
              }
            }
          }
        ]
      },
      "VolcSeedanceContentItem": {
        "type": "object",
        "description": "Volc-style content item. Use text, image_url, video_url, audio_url, or draft_task. For image_url, omitting role treats the image as first_frame; use role=reference_image for reference images.",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text",
              "image_url",
              "video_url",
              "audio_url",
              "draft_task"
            ]
          },
          "text": {
            "type": "string",
            "description": "Text prompt content. Required when type=text."
          },
          "role": {
            "type": "string",
            "enum": [
              "first_frame",
              "last_frame",
              "reference_image",
              "reference_video",
              "reference_audio"
            ],
            "description": "Media role. first_frame/last_frame inputs cannot be mixed with reference_image/reference_video/reference_audio inputs."
          },
          "image_url": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "Image reference in the official {\"url\":\"https://...\"} shape. TokenLab material URIs remain available as URL values without changing the request object shape."
          },
          "video_url": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "Video URL. Use role=reference_video."
          },
          "audio_url": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "Audio URL. Use role=reference_audio."
          },
          "draft_task": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "Draft task reference in the official {\"id\":\"cgt-...\"} shape."
          }
        },
        "additionalProperties": false
      },
      "VolcSeedanceCreateTaskRequest": {
        "type": "object",
        "required": [
          "model",
          "content"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "seedance-2.0",
            "description": "TokenLab model ID (seedance-2.0 or seedance-2.5), or the Volcengine model ID that existing clients already send for these models. The get-task response returns this value."
          },
          "content": {
            "type": "array",
            "minItems": 1,
            "maxItems": 51,
            "items": {
              "$ref": "#/components/schemas/VolcSeedanceContentItem"
            },
            "description": "Up to 16 items for Seedance 2.0 (1 text, 9 image_url, 3 video_url, 3 audio_url, 1 draft_task) and up to 51 for Seedance 2.5 (1 text, 30 image_url, 10 video_url, 10 audio_url, 1 draft_task). Model- and operation-specific combination rules still apply."
          },
          "ratio": {
            "type": "string",
            "enum": [
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16",
              "21:9",
              "adaptive"
            ],
            "default": "adaptive",
            "description": "Output aspect ratio. Defaults to adaptive when omitted."
          },
          "duration": {
            "oneOf": [
              {
                "type": "integer",
                "enum": [
                  -1
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 30
              }
            ],
            "example": 5,
            "description": "Video duration in seconds; -1 selects automatic duration. Seedance 2.0: 4-15 (default 5). Seedance 2.5: 4-30 (default -1)."
          },
          "resolution": {
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ],
            "example": "720p",
            "description": "Output resolution (default 720p). 1080p is available for Seedance 2.0 only; Seedance 2.5 supports 480p and 720p."
          },
          "generate_audio": {
            "type": "boolean",
            "description": "Whether to generate synchronized audio. Default: false for Seedance 2.0, true for Seedance 2.5."
          },
          "return_last_frame": {
            "type": "boolean",
            "default": false,
            "description": "Return the final frame URL when supported."
          },
          "watermark": {
            "type": "boolean",
            "default": false
          },
          "seed": {
            "type": "integer",
            "minimum": -1,
            "maximum": 4294967295,
            "default": -1,
            "description": "Random seed. -1 lets the model choose a seed. Seedance 2.0 only; Seedance 2.5 rejects this field."
          },
          "execution_expires_after": {
            "type": "integer",
            "minimum": 3600,
            "maximum": 259200,
            "default": 172800,
            "description": "Task execution expiration window in seconds."
          },
          "safety_identifier": {
            "type": "string",
            "maxLength": 64,
            "description": "Stable caller-side safety identifier."
          },
          "service_tier": {
            "type": "string",
            "enum": [
              "default",
              "flex"
            ],
            "default": "default",
            "description": "Only default is accepted. flex is rejected with 400 UnsupportedParameter."
          },
          "tools": {
            "type": "array",
            "maxItems": 1,
            "items": {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "web_search"
                  ]
                }
              },
              "additionalProperties": false
            },
            "description": "Optional. At most one item, {\"type\":\"web_search\"}."
          },
          "draft": {
            "type": "boolean",
            "description": "draft=true is not supported and is rejected."
          },
          "frames": {
            "type": "integer",
            "description": "Not supported. Use duration instead."
          },
          "camera_fixed": {
            "type": "boolean",
            "description": "camera_fixed=true is rejected. false is accepted as a no-op for Seedance 2.0; Seedance 2.5 rejects this field."
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9,
            "description": "Task priority. Seedance 2.5 only; Seedance 2.0 rejects this field."
          },
          "output_format": {
            "type": "string",
            "enum": [
              "mp4",
              "mov"
            ],
            "description": "Output container. Seedance 2.5 only; Seedance 2.0 rejects this field."
          },
          "callback_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "Public HTTP(S) endpoint notified by POST whenever status changes. The body is identical to the get-task response. queued, running, succeeded, failed, and expired are delivered. For succeeded and failed, a delivery without success within 5 seconds is retried up to three times."
          }
        },
        "additionalProperties": false
      },
      "VolcSeedanceCreateTaskResponse": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "cgt-20260102030405-a1b2c"
          }
        },
        "additionalProperties": false
      },
      "VolcSeedanceTask": {
        "type": "object",
        "required": [
          "id",
          "model",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "cgt-20260102030405-a1b2c"
          },
          "model": {
            "type": "string",
            "example": "seedance-2.0",
            "description": "The model value sent when the task was created."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "cancelled",
              "expired"
            ]
          },
          "content": {
            "type": "object",
            "properties": {
              "video_url": {
                "type": "string",
                "format": "uri"
              },
              "last_frame_url": {
                "type": "string",
                "format": "uri"
              }
            },
            "additionalProperties": false
          },
          "seed": {
            "type": "integer"
          },
          "resolution": {
            "type": "string"
          },
          "ratio": {
            "type": "string"
          },
          "duration": {
            "type": "string"
          },
          "frames": {
            "type": "integer"
          },
          "framespersecond": {
            "type": "integer"
          },
          "generate_audio": {
            "type": "boolean"
          },
          "tools": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "web_search"
                ]
              }
            },
            "additionalProperties": false
          },
          "safety_identifier": {
            "type": "string"
          },
          "draft": {
            "type": "boolean"
          },
          "draft_task_id": {
            "type": "string"
          },
          "service_tier": {
            "type": "string"
          },
          "execution_expires_after": {
            "type": "integer"
          },
          "usage": {
            "type": "object",
            "properties": {
              "completion_tokens": {
                "type": "integer",
                "minimum": 0
              },
              "total_tokens": {
                "type": "integer",
                "minimum": 0
              },
              "tool_usage": {
                "type": "object",
                "properties": {
                  "web_search": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "additionalProperties": false
          },
          "created_at": {
            "type": "integer",
            "description": "Unix timestamp in seconds."
          },
          "updated_at": {
            "type": "integer",
            "description": "Unix timestamp in seconds."
          }
        },
        "additionalProperties": false
      },
      "VolcSeedanceTaskListResponse": {
        "type": "object",
        "required": [
          "items",
          "total"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VolcSeedanceTask"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "VolcSeedanceError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "param",
              "type"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "param": {
                "type": "string"
              },
              "type": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "VolcVisualValidationResponseMetadata": {
        "type": "object",
        "required": [
          "RequestId",
          "Action",
          "Version",
          "Service",
          "Region"
        ],
        "properties": {
          "RequestId": {
            "type": "string",
            "description": "TokenLab request identifier."
          },
          "Action": {
            "type": "string",
            "enum": [
              "CreateVisualValidateSession",
              "GetVisualValidateResult"
            ]
          },
          "Version": {
            "type": "string",
            "enum": [
              "2024-01-01"
            ]
          },
          "Service": {
            "type": "string",
            "enum": [
              "ark"
            ]
          },
          "Region": {
            "type": "string",
            "enum": [
              "cn-beijing"
            ]
          }
        },
        "additionalProperties": false
      },
      "VolcCreateVisualValidateSessionRequest": {
        "type": "object",
        "required": [
          "CallbackURL"
        ],
        "properties": {
          "CallbackURL": {
            "type": "string",
            "format": "uri",
            "description": "Public HTTPS URL opened by the H5 flow after validation. Official callback query names are preserved."
          },
          "ProjectName": {
            "type": "string",
            "default": "default",
            "description": "Case-sensitive project name. Omit to use default."
          }
        },
        "additionalProperties": false
      },
      "VolcGetVisualValidateResultRequest": {
        "type": "object",
        "required": [
          "BytedToken"
        ],
        "properties": {
          "BytedToken": {
            "type": "string",
            "description": "Opaque token returned by CreateVisualValidateSession. It is valid for 30 minutes and scoped to the authenticated organization, actor, and ProjectName."
          },
          "ProjectName": {
            "type": "string",
            "default": "default",
            "description": "Must match the ProjectName used to create the token."
          }
        },
        "additionalProperties": false
      },
      "VolcCreateVisualValidateSessionResponse": {
        "type": "object",
        "required": [
          "ResponseMetadata",
          "Result"
        ],
        "properties": {
          "ResponseMetadata": {
            "$ref": "#/components/schemas/VolcVisualValidationResponseMetadata"
          },
          "Result": {
            "type": "object",
            "required": [
              "BytedToken",
              "H5Link",
              "CallbackURL"
            ],
            "properties": {
              "BytedToken": {
                "type": "string"
              },
              "H5Link": {
                "type": "string",
                "format": "uri"
              },
              "CallbackURL": {
                "type": "string",
                "format": "uri"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "VolcGetVisualValidateResultResponse": {
        "type": "object",
        "required": [
          "ResponseMetadata",
          "Result"
        ],
        "properties": {
          "ResponseMetadata": {
            "$ref": "#/components/schemas/VolcVisualValidationResponseMetadata"
          },
          "Result": {
            "type": "object",
            "required": [
              "GroupId"
            ],
            "properties": {
              "GroupId": {
                "type": "string",
                "pattern": "^group-[0-9]{14}-[a-z0-9]{5}$",
                "description": "TokenLab-mapped real-person Asset Group ID returned after successful validation."
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "VolcMaterialActionRequest": {
        "type": "object",
        "description": "PascalCase request body for the material Action selected by the Action query parameter. Required fields depend on the selected Action.",
        "properties": {
          "Id": {
            "type": "string",
            "description": "Asset or Asset Group identifier for get, update, and delete Actions."
          },
          "Name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "Description": {
            "type": "string",
            "maxLength": 300
          },
          "GroupType": {
            "type": "string",
            "enum": [
              "AIGC",
              "LivenessFace"
            ]
          },
          "GroupId": {
            "type": "string"
          },
          "URL": {
            "type": "string",
            "format": "uri"
          },
          "AssetType": {
            "type": "string",
            "enum": [
              "Image",
              "Video",
              "Audio"
            ]
          },
          "Filter": {
            "type": "object",
            "properties": {
              "GroupIds": {
                "type": "array",
                "maxItems": 100,
                "items": {
                  "type": "string"
                }
              },
              "GroupType": {
                "type": "string",
                "enum": [
                  "AIGC",
                  "LivenessFace"
                ]
              },
              "Statuses": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "Active",
                    "Processing",
                    "Failed"
                  ]
                }
              },
              "Name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              }
            },
            "additionalProperties": false
          },
          "PageNumber": {
            "type": "integer",
            "minimum": 1,
            "default": 1
          },
          "PageSize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 10
          },
          "SortBy": {
            "type": "string",
            "enum": [
              "CreateTime",
              "UpdateTime",
              "GroupId"
            ],
            "default": "CreateTime"
          },
          "SortOrder": {
            "type": "string",
            "enum": [
              "Desc",
              "Asc"
            ],
            "default": "Desc"
          },
          "ProjectName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "default": "default",
            "description": "Project isolation scope within the authenticated organization."
          }
        },
        "additionalProperties": false
      },
      "VolcMaterialResponseMetadata": {
        "type": "object",
        "required": [
          "RequestId",
          "Action",
          "Version",
          "Service",
          "Region"
        ],
        "properties": {
          "RequestId": {
            "type": "string"
          },
          "Action": {
            "type": "string",
            "enum": [
              "CreateAssetGroup",
              "ListAssetGroups",
              "GetAssetGroup",
              "UpdateAssetGroup",
              "DeleteAssetGroup",
              "CreateAsset",
              "ListAssets",
              "GetAsset",
              "UpdateAsset",
              "DeleteAsset"
            ]
          },
          "Version": {
            "type": "string",
            "enum": [
              "2024-01-01"
            ]
          },
          "Service": {
            "type": "string",
            "enum": [
              "ark"
            ]
          },
          "Region": {
            "type": "string",
            "enum": [
              "cn-beijing"
            ]
          }
        },
        "additionalProperties": false
      },
      "VolcMaterialActionResponse": {
        "type": "object",
        "required": [
          "ResponseMetadata",
          "Result"
        ],
        "properties": {
          "ResponseMetadata": {
            "$ref": "#/components/schemas/VolcMaterialResponseMetadata"
          },
          "Result": {
            "type": "object",
            "description": "Action-dependent result. List Actions return Items, TotalCount, PageNumber, and PageSize; create and update Actions return Id; delete Actions return an empty object.",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "VolcVisualValidationError": {
        "type": "object",
        "required": [
          "ResponseMetadata"
        ],
        "properties": {
          "ResponseMetadata": {
            "type": "object",
            "required": [
              "RequestId",
              "Action",
              "Version",
              "Service",
              "Region",
              "Error"
            ],
            "properties": {
              "RequestId": {
                "type": "string"
              },
              "Action": {
                "type": "string"
              },
              "Version": {
                "type": "string"
              },
              "Service": {
                "type": "string",
                "enum": [
                  "ark"
                ]
              },
              "Region": {
                "type": "string",
                "enum": [
                  "cn-beijing"
                ]
              },
              "Error": {
                "type": "object",
                "required": [
                  "Code",
                  "Message"
                ],
                "properties": {
                  "CodeN": {
                    "type": "integer"
                  },
                  "Code": {
                    "type": "string"
                  },
                  "Message": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "VolcSeedanceActionError": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/VolcSeedanceError"
          },
          {
            "$ref": "#/components/schemas/VolcVisualValidationError"
          }
        ]
      },
      "ChargedPriceBasis": {
        "type": "object",
        "required": [
          "version",
          "resolvedTier",
          "priceVersion",
          "measure",
          "effectiveUnitPrices"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "resolvedTier": {
            "type": "string",
            "enum": [
              "verified",
              "official"
            ]
          },
          "priceVersion": {
            "type": "string"
          },
          "measure": {
            "type": "object",
            "required": [
              "unit",
              "quantity",
              "dimensions"
            ],
            "properties": {
              "unit": {
                "type": "string"
              },
              "quantity": {
                "type": "string"
              },
              "dimensions": {
                "type": "object",
                "additionalProperties": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            },
            "additionalProperties": false
          },
          "effectiveUnitPrices": {
            "type": "object",
            "required": [
              "unit"
            ],
            "properties": {
              "unit": {
                "type": "string"
              },
              "input": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "output": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "cacheRead": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "cacheWrite": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "cacheWrite1h": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "cacheWrite12h": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fixed": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "webSearch": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "groundedPrompt": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "structured": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "object",
                    "additionalProperties": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "WebhookEndpoint": {
        "type": "object",
        "required": [
          "id",
          "object",
          "url",
          "events",
          "is_active",
          "description",
          "created_at",
          "updated_at",
          "last_delivered_at",
          "failure_count"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "webhook_endpoint"
            ]
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "task.completed",
                "task.failed",
                "task.timeout"
              ]
            }
          },
          "is_active": {
            "type": "boolean"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_delivered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "failure_count": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "CreatedWebhookEndpoint": {
        "type": "object",
        "required": [
          "id",
          "object",
          "url",
          "events",
          "is_active",
          "description",
          "created_at",
          "updated_at",
          "last_delivered_at",
          "failure_count",
          "secret"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "webhook_endpoint"
            ]
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "task.completed",
                "task.failed",
                "task.timeout"
              ]
            }
          },
          "is_active": {
            "type": "boolean"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_delivered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "failure_count": {
            "type": "integer"
          },
          "secret": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "WebhookDelivery": {
        "type": "object",
        "required": [
          "id",
          "webhook_id",
          "delivery_id",
          "event_type",
          "outcome",
          "http_status",
          "attempts",
          "delivered_at",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "webhook_id": {
            "type": "string"
          },
          "delivery_id": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "delivered",
              "failed"
            ]
          },
          "http_status": {
            "type": [
              "integer",
              "null"
            ]
          },
          "attempts": {
            "type": "integer"
          },
          "delivered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "WebhookEndpointList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "pagination"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "object",
                "url",
                "events",
                "is_active",
                "description",
                "created_at",
                "updated_at",
                "last_delivered_at",
                "failure_count"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "object": {
                  "type": "string",
                  "enum": [
                    "webhook_endpoint"
                  ]
                },
                "url": {
                  "type": "string"
                },
                "events": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "task.completed",
                      "task.failed",
                      "task.timeout"
                    ]
                  }
                },
                "is_active": {
                  "type": "boolean"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "updated_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "last_delivered_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "failure_count": {
                  "type": "integer"
                }
              },
              "additionalProperties": false
            }
          },
          "pagination": {
            "type": "object",
            "required": [
              "page",
              "limit",
              "total",
              "total_pages"
            ],
            "properties": {
              "page": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              },
              "total_pages": {
                "type": "integer"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "WebhookDeliveryList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "pagination"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "webhook_id",
                "delivery_id",
                "event_type",
                "outcome",
                "http_status",
                "attempts",
                "delivered_at",
                "created_at"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "webhook_id": {
                  "type": "string"
                },
                "delivery_id": {
                  "type": "string"
                },
                "event_type": {
                  "type": "string"
                },
                "outcome": {
                  "type": "string",
                  "enum": [
                    "delivered",
                    "failed"
                  ]
                },
                "http_status": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "attempts": {
                  "type": "integer"
                },
                "delivered_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "additionalProperties": false
            }
          },
          "pagination": {
            "type": "object",
            "required": [
              "page",
              "limit",
              "total",
              "total_pages"
            ],
            "properties": {
              "page": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              },
              "total_pages": {
                "type": "integer"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "DeletedWebhookEndpoint": {
        "type": "object",
        "required": [
          "id",
          "object",
          "deleted"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "webhook_endpoint"
            ]
          },
          "deleted": {
            "type": "boolean",
            "const": true
          }
        },
        "additionalProperties": false
      },
      "CreateWebhookEndpointRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "events"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Public HTTPS receiver URL. Credentials, query strings, fragments, private or reserved network targets and redirects are rejected."
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string",
              "enum": [
                "task.completed",
                "task.failed",
                "task.timeout"
              ]
            },
            "description": "Supported event subscriptions; duplicates are removed."
          },
          "description": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "UpdateWebhookEndpointRequest": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Public HTTPS receiver URL. Credentials, query strings, fragments, private or reserved network targets and redirects are rejected."
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string",
              "enum": [
                "task.completed",
                "task.failed",
                "task.timeout"
              ]
            },
            "description": "Supported event subscriptions; duplicates are removed."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200
          },
          "is_active": {
            "type": "boolean",
            "description": "Resume or pause delivery. Resuming resets the consecutive failure count."
          }
        }
      },
      "TaskTimeoutWebhook": {
        "type": "object",
        "required": [
          "id",
          "type",
          "created",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable event ID for deduplication at the receiving endpoint."
          },
          "type": {
            "type": "string",
            "enum": [
              "task.timeout"
            ]
          },
          "created": {
            "type": "integer",
            "description": "Event creation time in Unix seconds."
          },
          "data": {
            "type": "object",
            "required": [
              "taskType",
              "taskId",
              "expectedTimeoutMs",
              "actualWaitMs"
            ],
            "properties": {
              "taskType": {
                "type": "string",
                "enum": [
                  "video",
                  "music",
                  "3d",
                  "world",
                  "image",
                  "audio"
                ]
              },
              "taskId": {
                "type": "string"
              },
              "expectedTimeoutMs": {
                "type": "integer",
                "minimum": 0,
                "description": "Expected timeout threshold in milliseconds."
              },
              "actualWaitMs": {
                "type": "integer",
                "minimum": 0,
                "description": "Actual elapsed wait in milliseconds."
              },
              "refundIssued": {
                "type": "boolean",
                "description": "True if the refund succeeded or had already been issued. False does not rule out a later refund."
              },
              "resolutionSource": {
                "type": "string",
                "enum": [
                  "callback",
                  "status_query",
                  "background_poller",
                  "timeout_detector",
                  "create_response"
                ]
              },
              "refundOutcome": {
                "type": "string",
                "enum": [
                  "success",
                  "already_refunded",
                  "not_applicable",
                  "failed_persisted",
                  "failed_unrecoverable"
                ],
                "description": "Refund processing result at event creation."
              }
            },
            "description": "Timeout event data. This event does not contain durationMs."
          }
        }
      },
      "AsyncTaskUpstreamError": {
        "type": "object",
        "description": "The upstream service's own error, present only for a task that ran on an Official route. Its `code` values are defined by the upstream service and may change; branch on `error_details.code` and `error_details.type`.",
        "required": [
          "message"
        ],
        "properties": {
          "source": {
            "type": "string",
            "description": "Upstream service name, when known."
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "param": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "AsyncTaskErrorDetails": {
        "type": "object",
        "description": "Why a task failed. A status read returns HTTP 200 even for a failed task; `status` here is the status of the failure itself.",
        "required": [
          "status",
          "message",
          "type",
          "code",
          "retryable"
        ],
        "properties": {
          "projection_version": {
            "type": "integer",
            "description": "`2` means `message` is the final reason for the failure."
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599
          },
          "message": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "param": {
            "type": "string",
            "description": "The request field at fault, omitted when no specific field is known."
          },
          "retryable": {
            "type": "boolean"
          },
          "upstream": {
            "$ref": "#/components/schemas/AsyncTaskUpstreamError"
          }
        },
        "additionalProperties": false
      },
      "AsyncTaskError": {
        "description": "Why the task failed: a string, or an object with `message` and, when known, `type`, `code`, `param` and `retryable`.",
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "required": [
              "message"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "param": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        ]
      },
      "GeminiFileResource": {
        "type": "object",
        "description": "A Gemini file in the current Workspace. Fields are returned when available.",
        "properties": {
          "name": {
            "type": "string",
            "description": "File resource name such as files/{fileId}."
          },
          "displayName": {
            "type": "string",
            "description": "Human-readable file name."
          },
          "mimeType": {
            "type": "string",
            "description": "Media MIME type."
          },
          "sizeBytes": {
            "type": "string",
            "description": "File byte size as a decimal string."
          },
          "uri": {
            "type": "string",
            "description": "File URI to use in Gemini content parts."
          },
          "state": {
            "type": "string",
            "description": "Processing state reported by the service. Wait until the file is ready before generation."
          },
          "createTime": {
            "type": "string",
            "format": "date-time"
          },
          "updateTime": {
            "type": "string",
            "format": "date-time"
          },
          "expirationTime": {
            "type": "string",
            "format": "date-time"
          },
          "error": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "GeminiFileCreateRequest": {
        "type": "object",
        "description": "Gemini file metadata request. Supported fields and values are validated by the service. File bytes are uploaded through /upload/v1beta/files.",
        "properties": {
          "file": {
            "$ref": "#/components/schemas/GeminiFileResource"
          }
        },
        "additionalProperties": true
      },
      "GeminiFileRegisterRequest": {
        "type": "object",
        "description": "Gemini file registration request. Use only sources and fields accepted by the service; registration does not upload local bytes.",
        "additionalProperties": true
      },
      "GeminiCachedContentRequest": {
        "type": "object",
        "required": [
          "model"
        ],
        "properties": {
          "model": {
            "type": "string",
            "minLength": 1,
            "description": "Current TokenLab model ID that supports Gemini cached content."
          },
          "displayName": {
            "type": "string",
            "description": "Human-readable cache name."
          },
          "ttl": {
            "type": "string",
            "description": "Positive duration such as 3600s. Supported lifetime is validated by the service."
          },
          "expireTime": {
            "type": "string",
            "format": "date-time",
            "description": "Requested expiration time; use ttl or expireTime as supported by the service."
          },
          "contents": {
            "$ref": "#/components/schemas/GeminiRequest/properties/contents"
          },
          "systemInstruction": {
            "$ref": "#/components/schemas/GeminiRequest/properties/systemInstruction"
          },
          "tools": {
            "$ref": "#/components/schemas/GeminiRequest/properties/tools"
          },
          "toolConfig": {
            "$ref": "#/components/schemas/GeminiRequest/properties/toolConfig"
          }
        },
        "additionalProperties": true
      },
      "GeminiCachedContentResource": {
        "type": "object",
        "description": "Cached content belonging to the current Workspace. Use the returned name as cachedContent in Gemini generation.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Resource name such as cachedContents/{cacheId}."
          },
          "model": {
            "type": "string",
            "description": "TokenLab model ID associated with the cached content."
          },
          "displayName": {
            "type": "string",
            "description": "Human-readable cache name."
          },
          "createTime": {
            "type": "string",
            "format": "date-time"
          },
          "updateTime": {
            "type": "string",
            "format": "date-time"
          },
          "expireTime": {
            "type": "string",
            "format": "date-time"
          },
          "usageMetadata": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "GeminiCachedContentUpdateRequest": {
        "type": "object",
        "description": "Update cached content lifetime using the fields accepted by the service.",
        "properties": {
          "ttl": {
            "type": "string",
            "description": "Positive duration such as 3600s."
          },
          "expireTime": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": true
      },
      "MediaRetention": {
        "type": "object",
        "description": "Saving status of the media results in this response. Present when the status is known within the response time limit; when it is absent, the media URLs still work.",
        "required": [
          "days",
          "items"
        ],
        "properties": {
          "days": {
            "type": "integer",
            "description": "Days a media-result URL stays valid after the result is first recorded.",
            "example": 30
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "url",
                "kind",
                "status",
                "expires_at"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "image",
                    "video",
                    "audio",
                    "3d"
                  ]
                },
                "content_type": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "saving",
                    "saved",
                    "failed",
                    "expired"
                  ]
                },
                "expires_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      },
      "ScalarPricing": {
        "type": "object",
        "description": "One scalar price layer in USD. Token prices are per 1M tokens.",
        "properties": {
          "input_per_1m": {
            "type": [
              "string",
              "null"
            ],
            "description": "Price per 1M input tokens. Null for per-request pricing."
          },
          "output_per_1m": {
            "type": [
              "string",
              "null"
            ],
            "description": "Price per 1M output tokens. Null for per-request pricing."
          },
          "per_request": {
            "type": [
              "string",
              "null"
            ],
            "description": "Price per request. Null for per-token pricing."
          },
          "is_lock_price": {
            "type": "boolean",
            "description": "Whether the model is priced per request."
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          }
        },
        "required": [
          "input_per_1m",
          "output_per_1m",
          "per_request",
          "is_lock_price",
          "currency"
        ],
        "additionalProperties": true
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad Request - Invalid input",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "examples": {
              "validation": {
                "summary": "Invalid field",
                "value": {
                  "error": {
                    "message": "model: Model is required",
                    "type": "invalid_request_error",
                    "param": "model"
                  },
                  "validation_errors": [
                    {
                      "field": "model",
                      "message": "Model is required"
                    }
                  ]
                }
              },
              "missingRequiredParameter": {
                "summary": "Required field is missing",
                "value": {
                  "error": {
                    "message": "model is required",
                    "type": "invalid_request_error",
                    "code": "missing_required_parameter",
                    "param": "model"
                  }
                }
              },
              "invalidValue": {
                "summary": "Value the model does not accept",
                "value": {
                  "error": {
                    "message": "reasoning_effort \"max\" is not supported for this model. Supported values: low, medium, high.",
                    "type": "invalid_request_error",
                    "code": "invalid_value",
                    "param": "reasoning_effort"
                  }
                }
              },
              "invalidImageUrl": {
                "summary": "Image URL cannot be used",
                "value": {
                  "error": {
                    "message": "image_url could not be downloaded from the image URL: the connection to the image host timed out. The URL must be publicly reachable from the internet (hosts that serve only mainland China networks can be unreachable). Use a different image URL or send the image as a base64 data URL.",
                    "type": "invalid_request_error",
                    "code": "invalid_image_url",
                    "param": "image_url"
                  }
                }
              },
              "unsupportedModelCapability": {
                "summary": "No route of the Delivery tier supports a parameter",
                "value": {
                  "error": {
                    "message": "Model gpt-4.1-mini cannot serve this request for operation 'chat' on the routes this request can use: web_search_options is not supported. Change these parameters, or choose another model or Delivery tier.",
                    "type": "invalid_request_error",
                    "code": "unsupported_model_capability"
                  }
                }
              },
              "unpriceableSelection": {
                "summary": "Video request cannot be priced",
                "value": {
                  "error": {
                    "message": "This image-to-video request cannot be priced without resolution. Set resolution explicitly if the operation accepts it.",
                    "type": "invalid_request_error",
                    "code": "unpriceable_selection",
                    "param": "resolution"
                  }
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Unauthorized - Invalid or missing API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "example": {
              "error": {
                "message": "Invalid API key provided",
                "type": "invalid_api_key"
              }
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "Payment Required - Insufficient balance or quota exceeded",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "example": {
              "error": {
                "message": "Insufficient balance. Please top up your account.",
                "type": "insufficient_balance"
              }
            }
          }
        }
      },
      "RateLimitExceeded": {
        "description": "Rate Limit Exceeded",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "example": {
              "error": {
                "message": "Rate limit exceeded. Please slow down.",
                "type": "rate_limit_exceeded"
              }
            }
          }
        },
        "headers": {
          "X-RateLimit-Limit": {
            "description": "Request limit per minute",
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Remaining": {
            "description": "Remaining requests",
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Reset": {
            "description": "Unix timestamp when limit resets",
            "schema": {
              "type": "integer"
            }
          }
        }
      },
      "ServerError": {
        "description": "Internal Server Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "example": {
              "error": {
                "message": "An internal error occurred",
                "type": "server_error"
              }
            }
          }
        }
      },
      "UpstreamError": {
        "description": "Service Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "example": {
              "error": {
                "message": "The service could not complete the request",
                "type": "upstream_error"
              }
            }
          }
        }
      },
      "AllChannelsFailed": {
        "description": "Service Unavailable",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "example": {
              "error": {
                "message": "The service is temporarily unable to process this request",
                "type": "all_channels_failed"
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "Forbidden",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "example": {
              "error": {
                "message": "Organization is not active",
                "type": "invalid_request_error"
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "Not Found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "example": {
              "error": {
                "message": "API key not found",
                "type": "invalid_request_error"
              }
            }
          }
        }
      },
      "MaterialLibraryUnavailable": {
        "description": "Material library unavailable",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "example": {
              "error": {
                "message": "Seedance material library request failed",
                "type": "server_error",
                "code": "seedance_material_library_request_failed"
              }
            }
          }
        }
      },
      "DeliveryUnavailable": {
        "description": "The requested Delivery tier is temporarily unavailable.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "examples": {
              "requestedTierUnavailable": {
                "summary": "The requested Delivery tier is unavailable",
                "value": {
                  "error": {
                    "message": "The requested Delivery tier is temporarily unavailable for model gpt-5.4.",
                    "type": "all_channels_failed",
                    "code": "delivery_tier_unavailable",
                    "retryable": true,
                    "request_id": "req_01JEXAMPLE"
                  }
                }
              },
              "eligibleRoutesFailed": {
                "summary": "The requested Delivery tier could not complete this request",
                "value": {
                  "error": {
                    "message": "All available routes failed to process the request.",
                    "type": "all_channels_failed",
                    "retryable": true,
                    "request_id": "req_01JEXAMPLE"
                  }
                }
              },
              "pricingUnavailable": {
                "summary": "TokenLab cannot price this request",
                "value": {
                  "error": {
                    "message": "TokenLab cannot serve model gpt-image-2 with operation 'image-edit' right now because it cannot price this request on the routes this request can use. The request was not charged.",
                    "type": "all_channels_failed",
                    "code": "model_pricing_unavailable",
                    "retryable": false,
                    "request_id": "req_01JEXAMPLE"
                  }
                }
              }
            }
          }
        }
      },
      "AnthropicError": {
        "description": "Error in the Anthropic error format. `error.type` names the kind of error; `request_id` is the TokenLab request ID.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicErrorResponse"
            },
            "example": {
              "type": "error",
              "error": {
                "type": "invalid_request_error",
                "message": "max_tokens: Required. /v1/messages follows the native Anthropic contract and does not infer a default max_tokens value."
              },
              "request_id": "req_01JEXAMPLE"
            }
          }
        }
      },
      "GeminiResourceError": {
        "description": "Gemini-format resource error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/GeminiErrorResponse"
            }
          }
        }
      }
    },
    "parameters": {
      "DeliveryPolicy": {
        "name": "X-TokenLab-Delivery-Policy",
        "in": "header",
        "required": false,
        "description": "Per-request Delivery policy. Overrides the API key and Workspace defaults. Auto tries TokenLab Verified first and may switch once to Official only before output, request acceptance, or persistent resource creation.",
        "schema": {
          "type": "string",
          "enum": [
            "auto",
            "verified",
            "official"
          ]
        }
      },
      "IdempotencyKeySync": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Optional key that stops a second run of the same request. Send a new unique value, such as a UUID, for each request, and keep it for retries after a timeout. A retry with the same key does not run again: it returns `409` with `idempotency_replay_unavailable`, or usually `idempotency_conflict` when the body changed. Exception: when a non-stream result finished after the client disconnected, a retry with the same key and body within 24 hours returns that result (up to 1 MB) with the header `Idempotent-Replayed: true` and no second charge. A key longer than 255 characters is ignored, and the request then has no idempotency protection. See [Retry safely with an idempotency key](https://tokenlab.sh/docs/en/guides/error-handling#idempotency-key).",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "IdempotencyKeyTask": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Optional key that makes a create request safe to retry. Send a new unique value, such as a UUID, for each task. A retry with the same key and the same body returns the result of the original create request, usually the original task, and does not create, dispatch, or charge a second task. A different body with a key that was already accepted is rejected with `409`. A key longer than 255 characters is ignored, and the request then has no idempotency protection. See [Retry safely with an idempotency key](https://tokenlab.sh/docs/en/guides/error-handling#idempotency-key).",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "IdempotencyKeyImage": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Optional key that makes an image request safe to retry if the request created a task. Send a new unique value, such as a UUID, for each request. A retry with the same key and the same body then returns that task and does not create, dispatch, or charge a second task. For a request that returns the image directly, a retry with the same key can return a task status instead of the image, or `409` with `idempotent_response_not_replayable`. A different body with a key that was already accepted is rejected; the status code and error code for that case are not guaranteed. A key longer than 255 characters is ignored, and the request then has no idempotency protection. See [Retry safely with an idempotency key](https://tokenlab.sh/docs/en/guides/error-handling#idempotency-key).",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      }
    }
  },
  "webhooks": {
    "taskTimeout": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Task timeout notification",
        "description": "Sent to a configured webhook endpoint subscribed to task.timeout. Verify the HMAC-SHA256 signature over the timestamp, a period, and the raw request body using the signing secret. Return 2xx promptly and deduplicate by event ID. See https://tokenlab.sh/docs/en/guides/webhooks for signature verification and delivery recovery.",
        "operationId": "receiveTaskTimeoutWebhook",
        "security": [],
        "parameters": [
          {
            "in": "header",
            "name": "X-Webhook-ID",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Matches the event id in the request body."
          },
          {
            "in": "header",
            "name": "X-Webhook-Timestamp",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "Delivery attempt timestamp in Unix seconds."
          },
          {
            "in": "header",
            "name": "X-Webhook-Signature",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^sha256=[a-f0-9]{64}$"
            },
            "description": "HMAC-SHA256 signature using the complete whsec_ signing secret."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskTimeoutWebhook"
              },
              "example": {
                "id": "event-unique-id",
                "type": "task.timeout",
                "created": 1790000000,
                "data": {
                  "taskType": "image",
                  "taskId": "ldtask_0123456789abcdef0123456789abcdef",
                  "expectedTimeoutMs": 1800000,
                  "actualWaitMs": 1801000,
                  "refundIssued": true,
                  "resolutionSource": "timeout_detector",
                  "refundOutcome": "success"
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Notification accepted by the receiving endpoint."
          }
        }
      }
    }
  }
}
