{
  "openapi": "3.1.0",
  "info": {
    "title": "DarkGen v2 Creative Studio API",
    "version": "2.0.0",
    "summary": "Wholesale multi-modal AI media generation gateway & native MCP 2025-06-18 studio server",
    "description": "DarkGen v2 provides an OpenAI-compatible headless REST gateway (/v1/*) and a native Model Context Protocol (MCP 2025-06-18) Streamable HTTP server (/mcp) covering 42 tools across Image, Video, Sound & 5-Stem DAW, Voice, 4K/8K Upscaler, 3D PBR Meshes, Multi-Track Timeline NLE, and Node Flow DAGs. All paid operations are protected by Fail=$0 atomic escrow (failed upstream jobs automatically refund 100% of balance and API key caps), pre-flight dry_run cost quotes, Idempotency-Key replay protection, and zero-KYC crypto rails.",
    "contact": {
      "name": "DarkGen Labs",
      "url": "https://darkgen.ai/docs"
    },
    "license": {
      "name": "DarkGen Terms of Service",
      "url": "https://darkgen.ai/terms"
    }
  },
  "servers": [
    {
      "url": "https://api.darkgen.ai",
      "description": "DarkGen v2 API & MCP Gateway"
    },
    {
      "url": "https://darkgen.ai",
      "description": "DarkGen v2 Web & Same-Origin Gateway"
    }
  ],
  "tags": [
    {
      "name": "System",
      "description": "Health, readiness, and discovery probes"
    },
    {
      "name": "Models",
      "description": "Live frontier model catalog and wholesale retail pricing"
    },
    {
      "name": "Images",
      "description": "OpenAI-compatible 4K image generation and editing"
    },
    {
      "name": "Videos",
      "description": "Frontier T2V and I2V video synthesis"
    },
    {
      "name": "Audio",
      "description": "Neural voice speech synthesis and full-arrangement music composition"
    },
    {
      "name": "Jobs",
      "description": "Generation job status, telemetry, and signed outputs"
    },
    {
      "name": "Agent",
      "description": "Bounded headless autonomous creative agent execution"
    },
    {
      "name": "MCP",
      "description": "Native Streamable HTTP Model Context Protocol (2025-06-18)"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "dg_live_*",
        "description": "Scoped DarkGen Personal Access Token (dg_live_...) minted at https://darkgen.ai/studio/keys."
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Alternative header for scoped dg_live_* Personal Access Tokens."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Client-generated idempotency key preventing duplicate charges on retry.",
        "schema": {
          "type": "string",
          "maxLength": 128
        }
      },
      "DryRunHeader": {
        "name": "X-DarkGen-Dry-Run",
        "in": "header",
        "required": false,
        "description": "Set to \"true\" to return a $0.00 pre-flight cost quote without spending balance.",
        "schema": {
          "type": "string",
          "enum": [
            "true",
            "false"
          ]
        }
      }
    },
    "schemas": {
      "ModelId": {
        "type": "string",
        "description": "Live enabled DarkGen model ID (35 active models).",
        "enum": [
          "tripo/tripo-h3.1",
          "bfl/flux-2-pro",
          "bfl/flux-3-klein",
          "openai/gpt-image-2.6",
          "google/nano-banana-2",
          "google/nano-banana-pro",
          "bytedance/seedream-5.5",
          "local/dark-daw-synth",
          "mureka/mureka-o2",
          "suno/suno-v6",
          "topaz/image-upscale-4k",
          "topaz/starlight-video-4k",
          "xai/grok-imagine-video-1.5",
          "kuaishou/kling-3.0",
          "bytedance/seedance-2.5",
          "google/veo-3.1",
          "google/veo-3.1-fast",
          "elevenlabs/multilingual-v2",
          "hunyuan/hunyuan-3d-v3.1",
          "fal/trellis-2",
          "google/imagen-4-ultra",
          "kuaishou/kling-image-4.0",
          "qwen/qwen-image-edit",
          "recraft/recraft-v3",
          "fal/ace-step-v2",
          "fal/htdemucs-6s",
          "stability/stable-audio-2",
          "local/dark-cas-upscale",
          "fal/seedvr2-upscale",
          "minimax/hailuo-2.3-pro",
          "runway/gen-4-aleph",
          "sync/lipsync-2-pro",
          "alibaba/wan-3.0",
          "local/dark-voice-fx",
          "qwen/qwen-tts-pro"
        ]
      },
      "ImageModelId": {
        "type": "string",
        "description": "Enabled DarkGen image generation model ID.",
        "enum": [
          "bfl/flux-2-pro",
          "bfl/flux-3-klein",
          "openai/gpt-image-2.6",
          "google/nano-banana-2",
          "google/nano-banana-pro",
          "bytedance/seedream-5.5",
          "google/imagen-4-ultra",
          "kuaishou/kling-image-4.0",
          "qwen/qwen-image-edit",
          "recraft/recraft-v3"
        ]
      },
      "VideoModelId": {
        "type": "string",
        "description": "Enabled DarkGen video generation model ID.",
        "enum": [
          "xai/grok-imagine-video-1.5",
          "kuaishou/kling-3.0",
          "bytedance/seedance-2.5",
          "google/veo-3.1",
          "google/veo-3.1-fast",
          "minimax/hailuo-2.3-pro",
          "runway/gen-4-aleph",
          "sync/lipsync-2-pro",
          "alibaba/wan-3.0"
        ]
      },
      "SoundModelId": {
        "type": "string",
        "description": "Enabled DarkGen music/audio generation model ID.",
        "enum": [
          "local/dark-daw-synth",
          "mureka/mureka-o2",
          "suno/suno-v6",
          "fal/ace-step-v2",
          "fal/htdemucs-6s",
          "stability/stable-audio-2"
        ]
      },
      "VoiceModelId": {
        "type": "string",
        "description": "Enabled DarkGen neural speech model ID.",
        "enum": [
          "elevenlabs/multilingual-v2",
          "local/dark-voice-fx",
          "qwen/qwen-tts-pro"
        ]
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "failZeroRefunded": {
                "type": "boolean"
              }
            },
            "required": [
              "message",
              "code"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "ModelSummary": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/ModelId"
          },
          "object": {
            "type": "string",
            "const": "model"
          },
          "created": {
            "type": "integer"
          },
          "owned_by": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "sound",
              "voice",
              "upscale",
              "3d",
              "text"
            ]
          },
          "display_name": {
            "type": "string"
          },
          "billing_unit": {
            "type": "string"
          },
          "retail_unit_usd": {
            "type": "number"
          },
          "official_unit_usd": {
            "type": "number"
          },
          "savings_pct": {
            "type": "number"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "MediaAsset": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "studio": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri-reference"
          },
          "signedUrl": {
            "type": "string",
            "format": "uri-reference"
          },
          "downloadUrl": {
            "type": "string",
            "format": "uri"
          },
          "mimeType": {
            "type": "string"
          },
          "modelId": {
            "type": [
              "string",
              "null"
            ]
          },
          "costUsd": {
            "type": "number"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "GenerationJob": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "studio": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "modelId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "progress": {
            "type": "integer"
          },
          "costUsd": {
            "type": "number"
          },
          "failZeroRefunded": {
            "type": "boolean"
          },
          "latencyMs": {
            "type": "integer"
          },
          "outputAssetIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "outputAssets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MediaAsset"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "JsonRpcRequest": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "integer",
              "null"
            ]
          },
          "method": {
            "type": "string",
            "description": "MCP JSON-RPC method (initialize, ping, tools/list, tools/call, resources/list, resources/read, prompts/list, prompts/get)."
          },
          "params": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "jsonrpc",
          "method"
        ]
      },
      "JsonRpcResponse": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "integer",
              "null"
            ]
          },
          "result": {
            "type": "object",
            "additionalProperties": true
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              },
              "data": {}
            }
          }
        },
        "required": [
          "jsonrpc",
          "id"
        ]
      }
    }
  },
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Liveness health probe",
        "operationId": "getHealth",
        "responses": {
          "200": {
            "description": "Service is healthy and database probe succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "service": {
                      "type": "string"
                    },
                    "time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Database probe failed."
          }
        }
      }
    },
    "/ready": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Readiness probe",
        "operationId": "getReady",
        "responses": {
          "200": {
            "description": "Service is ready to serve traffic.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "ready": {
                      "type": "boolean"
                    },
                    "service": {
                      "type": "string"
                    },
                    "modelsCount": {
                      "type": "integer"
                    },
                    "ffmpegVersion": {
                      "type": "string"
                    },
                    "sandboxMode": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service is shutting down or database is unavailable."
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "List enabled frontier AI models and wholesale retail pricing",
        "operationId": "listV1Models",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "image",
                "video",
                "sound",
                "voice",
                "upscale",
                "3d",
                "text"
              ]
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "featured",
                "cheapest",
                "fastest",
                "stability",
                "savings"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OpenAI-compatible list of enabled models with retail vs official pricing.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ModelSummary"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "API key RPM limit exceeded."
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "tags": [
          "Images"
        ],
        "summary": "Generate 1–4 high-resolution images (OpenAI-compatible)",
        "operationId": "createImageGeneration",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DryRunHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "prompt"
                ],
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "Visual prompt describing the target image."
                  },
                  "negative_prompt": {
                    "type": "string"
                  },
                  "model": {
                    "$ref": "#/components/schemas/ImageModelId"
                  },
                  "size": {
                    "type": "string",
                    "example": "1024x1024"
                  },
                  "aspect_ratio": {
                    "type": "string",
                    "enum": [
                      "1:1",
                      "16:9",
                      "9:16",
                      "4:5",
                      "3:2",
                      "2:3",
                      "4:3",
                      "21:9"
                    ]
                  },
                  "resolution": {
                    "type": "string",
                    "enum": [
                      "1K",
                      "2K",
                      "4K"
                    ]
                  },
                  "quality": {
                    "type": "string",
                    "enum": [
                      "standard",
                      "hd"
                    ]
                  },
                  "n": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 4,
                    "default": 1
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "url",
                      "b64_json"
                    ],
                    "default": "url"
                  },
                  "seed": {
                    "type": "integer"
                  },
                  "presets": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "reference_asset_id": {
                    "type": "string"
                  },
                  "persona_id": {
                    "type": "string"
                  },
                  "dry_run": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated image URLs and DarkGen job/asset metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "created": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "asset_id": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri"
                          },
                          "revised_prompt": {
                            "type": "string"
                          },
                          "b64_json": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "darkgen": {
                      "type": "object",
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "costUsd": {
                          "type": "number"
                        },
                        "job": {
                          "$ref": "#/components/schemas/GenerationJob"
                        },
                        "assets": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/MediaAsset"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient USD balance."
          }
        }
      }
    },
    "/v1/videos/generations": {
      "post": {
        "tags": [
          "Videos"
        ],
        "summary": "Generate cinema-grade T2V or I2V video clips",
        "operationId": "createVideoGeneration",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DryRunHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "prompt"
                ],
                "properties": {
                  "prompt": {
                    "type": "string"
                  },
                  "model": {
                    "$ref": "#/components/schemas/VideoModelId"
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "t2v",
                      "i2v"
                    ],
                    "default": "t2v"
                  },
                  "aspect_ratio": {
                    "type": "string",
                    "default": "16:9"
                  },
                  "resolution": {
                    "type": "string",
                    "enum": [
                      "480p",
                      "720p",
                      "1080p"
                    ],
                    "default": "720p"
                  },
                  "duration": {
                    "type": "integer",
                    "minimum": 2,
                    "maximum": 12,
                    "default": 5
                  },
                  "camera": {
                    "type": "string",
                    "default": "dolly_in"
                  },
                  "with_audio": {
                    "type": "boolean",
                    "default": false
                  },
                  "start_frame_asset_id": {
                    "type": "string"
                  },
                  "end_frame_asset_id": {
                    "type": "string"
                  },
                  "seed": {
                    "type": "integer"
                  },
                  "dry_run": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated video assets with HMAC-signed download URLs."
          },
          "401": {
            "description": "Unauthorized."
          },
          "402": {
            "description": "Insufficient USD balance."
          }
        }
      }
    },
    "/v1/audio/speech": {
      "post": {
        "tags": [
          "Audio"
        ],
        "summary": "Synthesize studio neural speech (OpenAI-compatible TTS)",
        "operationId": "createSpeech",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DryRunHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "input"
                ],
                "properties": {
                  "input": {
                    "type": "string",
                    "description": "Text script to synthesize into speech."
                  },
                  "model": {
                    "$ref": "#/components/schemas/VoiceModelId"
                  },
                  "voice": {
                    "type": "string",
                    "default": "onyx",
                    "description": "OpenAI alias (alloy, echo, fable, onyx, nova, shimmer, adam, rachel) or DarkGen voiceId (v_*)."
                  },
                  "speed": {
                    "type": "number",
                    "minimum": 0.5,
                    "maximum": 2,
                    "default": 1
                  },
                  "fx_preset": {
                    "type": "string",
                    "default": "broadcast_studio"
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "json",
                      "wav",
                      "audio"
                    ],
                    "default": "json"
                  },
                  "dry_run": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Synthesized audio asset JSON metadata or raw audio/wav stream when response_format=\"wav\".",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized."
          }
        }
      }
    },
    "/v1/audio/generations": {
      "post": {
        "tags": [
          "Audio"
        ],
        "summary": "Compose music, stems, or SFX tracks (see also /v1/audio/music)",
        "description": "Music and audio generation contract backed by DarkGen Sound Studio (`sound_compose`; also exposed at POST /v1/audio/music and POST /v1/sound/compose).",
        "operationId": "createAudioGeneration",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DryRunHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "prompt"
                ],
                "properties": {
                  "prompt": {
                    "type": "string"
                  },
                  "model": {
                    "$ref": "#/components/schemas/SoundModelId"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "song",
                      "loop",
                      "sfx",
                      "ambient"
                    ],
                    "default": "song"
                  },
                  "genre": {
                    "type": "string",
                    "default": "industrial techno"
                  },
                  "mood": {
                    "type": "string",
                    "default": "dark"
                  },
                  "bpm": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 190,
                    "default": 128
                  },
                  "musical_key": {
                    "type": "string",
                    "default": "A minor"
                  },
                  "duration": {
                    "type": "integer",
                    "minimum": 2,
                    "maximum": 180,
                    "default": 8
                  },
                  "generate_stems": {
                    "type": "boolean",
                    "default": false
                  },
                  "seamless_loop": {
                    "type": "boolean",
                    "default": false
                  },
                  "lyrics": {
                    "type": "string"
                  },
                  "seed": {
                    "type": "integer"
                  },
                  "dry_run": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Composed audio asset with optional 5-stem split and LUFS analysis."
          },
          "401": {
            "description": "Unauthorized."
          }
        }
      }
    },
    "/v1/audio/music": {
      "post": {
        "tags": [
          "Audio"
        ],
        "summary": "Compose full-arrangement music & optional 5-stem separation",
        "operationId": "createAudioMusic",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DryRunHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "prompt"
                ],
                "properties": {
                  "prompt": {
                    "type": "string"
                  },
                  "model": {
                    "$ref": "#/components/schemas/SoundModelId"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "song",
                      "loop",
                      "sfx",
                      "ambient"
                    ],
                    "default": "song"
                  },
                  "genre": {
                    "type": "string",
                    "default": "industrial techno"
                  },
                  "mood": {
                    "type": "string",
                    "default": "dark"
                  },
                  "bpm": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 190,
                    "default": 128
                  },
                  "musical_key": {
                    "type": "string",
                    "default": "A minor"
                  },
                  "duration": {
                    "type": "integer",
                    "minimum": 2,
                    "maximum": 180,
                    "default": 8
                  },
                  "generate_stems": {
                    "type": "boolean",
                    "default": false
                  },
                  "seamless_loop": {
                    "type": "boolean",
                    "default": false
                  },
                  "lyrics": {
                    "type": "string"
                  },
                  "seed": {
                    "type": "integer"
                  },
                  "dry_run": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Composed music asset, stems, and audio QA metrics."
          },
          "401": {
            "description": "Unauthorized."
          }
        }
      }
    },
    "/v1/jobs/{id}": {
      "get": {
        "tags": [
          "Jobs"
        ],
        "summary": "Inspect a generation job, Fail=$0 billing state, and signed output assets",
        "operationId": "getJobById",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job details and signed output assets.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "job": {
                      "$ref": "#/components/schemas/GenerationJob"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized."
          },
          "404": {
            "description": "Generation job not found."
          }
        }
      }
    },
    "/v1/agent/run": {
      "post": {
        "tags": [
          "Agent"
        ],
        "summary": "Run bounded headless multi-studio autonomous creative agent",
        "operationId": "runHeadlessAgent",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "Natural-language creative objective."
                  },
                  "goal": {
                    "type": "string",
                    "description": "Alias for prompt."
                  },
                  "steps": {
                    "type": "array",
                    "description": "Optional explicit tool chain overriding planner.",
                    "items": {
                      "type": "object",
                      "required": [
                        "tool"
                      ],
                      "properties": {
                        "tool": {
                          "type": "string"
                        },
                        "args": {
                          "type": "object",
                          "additionalProperties": true
                        },
                        "reason": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "budgetUsd": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 25,
                    "default": 1.5
                  },
                  "maxSteps": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 8,
                    "default": 4
                  },
                  "dryRun": {
                    "type": "boolean",
                    "default": false
                  },
                  "autoApprove": {
                    "type": "boolean",
                    "default": false
                  },
                  "studioContext": {
                    "type": "string",
                    "example": "video"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent execution summary with per-step cost and collected signed assets."
          },
          "409": {
            "description": "Paused awaiting explicit spend confirmation (set autoApprove: true or confirm step)."
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "tags": [
          "MCP"
        ],
        "summary": "MCP 2025-06-18 Streamable HTTP JSON-RPC 2.0 endpoint",
        "description": "Executes MCP JSON-RPC 2.0 requests (initialize, tools/list, tools/call, resources/list, resources/read, prompts/list, prompts/get) across 42 studio tools.",
        "operationId": "postMcpJsonRpc",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "MCP-Protocol-Version",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "2025-06-18",
                "2025-03-26",
                "2024-11-05"
              ],
              "default": "2025-06-18"
            }
          },
          {
            "name": "Mcp-Session-Id",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/JsonRpcRequest"
                  },
                  {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/JsonRpcRequest"
                    },
                    "minItems": 1,
                    "maxItems": 25
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC 2.0 response or SSE event stream.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "202": {
            "description": "JSON-RPC notification accepted."
          },
          "401": {
            "description": "Missing or invalid Bearer dg_live_* PAT."
          }
        }
      },
      "get": {
        "tags": [
          "MCP"
        ],
        "summary": "Open MCP Streamable HTTP SSE notification stream",
        "operationId": "openMcpSseStream",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "Accept",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "const": "text/event-stream"
            }
          },
          {
            "name": "Mcp-Session-Id",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Live Server-Sent Events stream.",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized."
          },
          "405": {
            "description": "Requires Accept: text/event-stream."
          }
        }
      },
      "delete": {
        "tags": [
          "MCP"
        ],
        "summary": "Terminate an active MCP session",
        "operationId": "terminateMcpSession",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "Mcp-Session-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Session terminated."
          },
          "404": {
            "description": "Session not found."
          }
        }
      }
    }
  }
}