{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/beatra-ai/json-schema/beatra-ai-voice-activation-response-schema.json",
  "title": "VoiceActivationResponse",
  "description": "A started activation (202, with the task) or a voice that needs nothing or a quote (200).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/beatra-ai-voices-api-openapi.yml#/components/schemas/VoiceActivationResponse",
  "properties": {
    "task_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Task Id"
    },
    "status": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Status"
    },
    "terminal": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Terminal"
    },
    "resolved_model": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Resolved Model"
    },
    "billing": {
      "anyOf": [
        {
          "$ref": "#/$defs/TaskBilling"
        },
        {
          "type": "null"
        }
      ]
    },
    "task": {
      "anyOf": [
        {
          "$ref": "#/$defs/TaskEnvelope"
        },
        {
          "type": "null"
        }
      ]
    },
    "voice": {
      "anyOf": [
        {
          "$ref": "#/$defs/Voice"
        },
        {
          "type": "null"
        }
      ]
    },
    "charged_credits": {
      "type": "string",
      "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
      "title": "Charged Credits",
      "description": "Credits this activation charged in the end: net of any refund (task.billing.net_charged_credits); 0 for a quote or a voice that needed no activation.",
      "default": "0"
    },
    "quote": {
      "anyOf": [
        {
          "$ref": "#/$defs/VoiceActivationQuote"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "$defs": {
    "SocialTaskIdentity": {
      "properties": {
        "platform": {
          "type": "string",
          "title": "Platform"
        },
        "operation_key": {
          "type": "string",
          "title": "Operation Key"
        },
        "operation_name": {
          "type": "string",
          "title": "Operation Name"
        },
        "schema_hash": {
          "type": "string",
          "title": "Schema Hash"
        }
      },
      "type": "object",
      "required": [
        "platform",
        "operation_key",
        "operation_name",
        "schema_hash"
      ],
      "title": "SocialTaskIdentity"
    },
    "TaskBilling": {
      "properties": {
        "charged_credits": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Charged Credits",
          "description": "Credits charged to wallet for this Task. Populated by PR-2/3."
        },
        "refunded_credits": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Refunded Credits",
          "description": "Credits refunded for this Task. Populated by PR-3."
        },
        "granted_credits": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Granted Credits",
          "description": "Credits on this Task covered by a directed grant rather than by the wallet, net of any revocation. Absent when no grant applied."
        },
        "grant_source": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Grant Source",
          "description": "Which grant covered it. Present exactly when granted_credits is."
        },
        "net_charged_credits": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Net Charged Credits",
          "description": "Final customer charge: charged_credits minus refunded_credits minus granted_credits. This is the number to report as what the Task cost."
        }
      },
      "type": "object",
      "title": "TaskBilling"
    },
    "TaskCallback": {
      "properties": {
        "url": {
          "type": "string",
          "title": "Url"
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "dispatching",
            "delivered",
            "retrying",
            "failed"
          ],
          "title": "Status"
        },
        "attempt_count": {
          "type": "integer",
          "title": "Attempt Count"
        },
        "delivered_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Delivered At"
        },
        "last_error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Error",
          "description": "Stable Beatra-owned callback delivery failure summary."
        }
      },
      "type": "object",
      "required": [
        "url",
        "status",
        "attempt_count"
      ],
      "title": "TaskCallback"
    },
    "TaskEnvelope": {
      "properties": {
        "object": {
          "type": "string",
          "const": "task",
          "title": "Object",
          "default": "task"
        },
        "task_id": {
          "type": "string",
          "title": "Task Id"
        },
        "status": {
          "type": "string",
          "enum": [
            "queued",
            "running",
            "succeeded",
            "failed",
            "canceled"
          ],
          "title": "Status"
        },
        "capability": {
          "type": "string",
          "title": "Capability"
        },
        "workload_type": {
          "type": "string",
          "enum": [
            "model",
            "social_operation"
          ],
          "title": "Workload Type",
          "default": "model"
        },
        "model": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Model",
          "description": "Caller-requested model verbatim (may be 'auto'). Null for social_operation tasks."
        },
        "resolved_model": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Resolved Model",
          "description": "Actual model that ran (null until execution starts; equals model for explicit-model calls)"
        },
        "model_selection_reason": {
          "type": "null",
          "title": "Model Selection Reason",
          "description": "Deprecated. Always null.",
          "deprecated": true
        },
        "social": {
          "anyOf": [
            {
              "$ref": "#/$defs/SocialTaskIdentity"
            },
            {
              "type": "null"
            }
          ]
        },
        "metadata": {
          "anyOf": [
            {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Metadata"
        },
        "input": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Input"
        },
        "progress": {
          "anyOf": [
            {
              "$ref": "#/$defs/app__api__v1__schemas__common__TaskProgress"
            },
            {
              "type": "null"
            }
          ]
        },
        "output": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Output"
        },
        "warnings": {
          "items": {
            "$ref": "#/$defs/TaskWarning"
          },
          "type": "array",
          "title": "Warnings"
        },
        "error": {
          "anyOf": [
            {
              "$ref": "#/$defs/app__api__v1__schemas__common__TaskError"
            },
            {
              "type": "null"
            }
          ]
        },
        "usage": {
          "anyOf": [
            {
              "$ref": "#/$defs/UsageObject"
            },
            {
              "type": "null"
            }
          ]
        },
        "billing": {
          "anyOf": [
            {
              "$ref": "#/$defs/TaskBilling"
            },
            {
              "type": "null"
            }
          ]
        },
        "callback": {
          "anyOf": [
            {
              "$ref": "#/$defs/TaskCallback"
            },
            {
              "type": "null"
            }
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        },
        "started_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Started At"
        },
        "deadline_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Deadline At"
        },
        "completed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Completed At"
        },
        "cancel_requested_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cancel Requested At"
        },
        "links": {
          "$ref": "#/$defs/TaskLinks"
        }
      },
      "type": "object",
      "required": [
        "task_id",
        "status",
        "capability",
        "created_at",
        "links"
      ],
      "title": "TaskEnvelope",
      "description": "Standard Task envelope.\n\nReturned by every async-creation endpoint, GET /v1/tasks/{id}, and\nthe body of customer callback POSTs."
    },
    "TaskLinks": {
      "properties": {
        "self": {
          "type": "string",
          "title": "Self"
        },
        "cancel": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cancel"
        },
        "assets": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Assets",
          "description": "Absolute customer-console URL for viewing and managing the generated artifacts."
        }
      },
      "type": "object",
      "required": [
        "self"
      ],
      "title": "TaskLinks"
    },
    "TaskWarning": {
      "properties": {
        "code": {
          "type": "string",
          "title": "Code",
          "description": "e.g. option_clamped / auto_routed"
        },
        "message": {
          "type": "string",
          "title": "Message"
        },
        "field": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Field"
        }
      },
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "title": "TaskWarning"
    },
    "UsageLine": {
      "properties": {
        "meter": {
          "type": "string",
          "title": "Meter",
          "description": "e.g. input_token / output_token / image_count / input_video_second / output_video_second"
        },
        "quantity": {
          "type": "string",
          "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
          "title": "Quantity",
          "description": "Decimal — number of meter units consumed"
        },
        "unit": {
          "type": "string",
          "title": "Unit",
          "description": "Display unit, e.g. 'token' / 'image' / 'second'"
        },
        "billed_amount_credits": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Billed Amount Credits",
          "description": "Credits charged for this usage line. Populated by PR-2/3."
        }
      },
      "type": "object",
      "required": [
        "meter",
        "quantity",
        "unit"
      ],
      "title": "UsageLine"
    },
    "UsageObject": {
      "properties": {
        "input_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Input Tokens"
        },
        "output_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Output Tokens"
        },
        "cache_read_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cache Read Tokens"
        },
        "cache_creation_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cache Creation Tokens"
        },
        "reasoning_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reasoning Tokens"
        },
        "image_count": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Image Count"
        },
        "image_pixels": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Image Pixels"
        },
        "video_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Video Seconds"
        },
        "input_video_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Input Video Seconds",
          "description": "Authoritative input-video seconds included in settled video usage."
        },
        "output_video_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Output Video Seconds",
          "description": "Authoritative generated/output-video seconds included in settled video usage."
        },
        "audio_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Audio Seconds"
        },
        "characters": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Characters"
        },
        "lines": {
          "items": {
            "$ref": "#/$defs/UsageLine"
          },
          "type": "array",
          "title": "Lines"
        },
        "credits": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Credits",
          "description": "Credits charged for this Task. Populated by PR-2 / PR-3."
        }
      },
      "type": "object",
      "title": "UsageObject"
    },
    "Voice": {
      "properties": {
        "voice_id": {
          "type": "string",
          "title": "Voice Id",
          "description": "Opaque beatra voice handle"
        },
        "display_name": {
          "type": "string",
          "title": "Display Name"
        },
        "category": {
          "type": "string",
          "enum": [
            "preset",
            "cloned"
          ],
          "title": "Category"
        },
        "language": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Language"
        },
        "languages_supported": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Languages Supported"
        },
        "gender": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "male",
                "female",
                "neutral"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Gender"
        },
        "age_group": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Age Group",
          "description": "Age group: child, youth, adult, or senior"
        },
        "accent": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Accent"
        },
        "use_case": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Use Case"
        },
        "persona": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Persona",
          "description": "Short description of how the voice sounds and where it fits"
        },
        "preview_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Preview Url"
        },
        "preview_url_scene": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Preview Url Scene",
          "description": "Scene sample URL. Null until a sample has been published"
        },
        "compatible_models": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Compatible Models",
          "description": "Models this voice currently resolves on (informational; 'auto' always works)"
        },
        "status": {
          "type": "string",
          "enum": [
            "processing",
            "ready",
            "failed",
            "pending_activation",
            "expired"
          ],
          "title": "Status",
          "default": "ready"
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Created At"
        },
        "preview": {
          "anyOf": [
            {
              "$ref": "#/$defs/VoicePreview"
            },
            {
              "type": "null"
            }
          ]
        },
        "activation": {
          "anyOf": [
            {
              "$ref": "#/$defs/VoiceActivation"
            },
            {
              "type": "null"
            }
          ]
        },
        "expires_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Expires At"
        },
        "clone_model": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Clone Model"
        }
      },
      "type": "object",
      "required": [
        "voice_id",
        "display_name",
        "category"
      ],
      "title": "Voice"
    },
    "VoiceActivation": {
      "properties": {
        "required": {
          "type": "boolean",
          "title": "Required"
        },
        "price_credits": {
          "type": "integer",
          "title": "Price Credits"
        },
        "quote": {
          "anyOf": [
            {
              "$ref": "#/$defs/VoiceActivationQuote"
            },
            {
              "type": "null"
            }
          ],
          "description": "The activation quote, on the clone task's result. Show the price and terms to the user and, with their consent, call activate once with quote.confirmation_token and confirm_credits = price_credits (valid for 24 hours; without a token, activate returns a new quote)."
        }
      },
      "type": "object",
      "required": [
        "required",
        "price_credits"
      ],
      "title": "VoiceActivation",
      "description": "What it costs to make a preview voice usable for speech."
    },
    "VoiceActivationQuote": {
      "properties": {
        "voice_id": {
          "type": "string",
          "title": "Voice Id"
        },
        "price_credits": {
          "type": "integer",
          "title": "Price Credits"
        },
        "balance_credits": {
          "type": "string",
          "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
          "title": "Balance Credits"
        },
        "sufficient_balance": {
          "type": "boolean",
          "title": "Sufficient Balance"
        },
        "preview": {
          "anyOf": [
            {
              "$ref": "#/$defs/VoicePreview"
            },
            {
              "type": "null"
            }
          ]
        },
        "confirmation_token": {
          "type": "string",
          "title": "Confirmation Token"
        },
        "token_expires_at": {
          "type": "string",
          "format": "date-time",
          "title": "Token Expires At"
        },
        "terms_version": {
          "type": "string",
          "title": "Terms Version"
        },
        "terms": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "type": "object",
          "title": "Terms",
          "description": "The activation terms in zh, en and ja"
        },
        "message": {
          "type": "string",
          "title": "Message"
        }
      },
      "type": "object",
      "required": [
        "voice_id",
        "price_credits",
        "balance_credits",
        "sufficient_balance",
        "confirmation_token",
        "token_expires_at",
        "terms_version",
        "terms",
        "message"
      ],
      "title": "VoiceActivationQuote",
      "description": "The price of activating one preview voice. Nothing is charged until it is confirmed."
    },
    "VoicePreview": {
      "properties": {
        "url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Url"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Text"
        },
        "language": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Language"
        },
        "version": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Version"
        }
      },
      "type": "object",
      "title": "VoicePreview",
      "description": "The stored preview of a cloned voice that is not yet activated."
    },
    "app__api__v1__schemas__common__TaskError": {
      "properties": {
        "code": {
          "type": "string",
          "title": "Code",
          "description": "Stable machine-readable public error code."
        },
        "type": {
          "type": "string",
          "title": "Type",
          "description": "Stable public error family."
        },
        "message": {
          "type": "string",
          "title": "Message",
          "description": "Human-readable safe failure reason."
        },
        "retryable": {
          "type": "boolean",
          "title": "Retryable",
          "description": "Whether the same logical request may succeed when retried unchanged."
        },
        "param": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Param",
          "description": "JSON Pointer to the relevant request or output field."
        },
        "details": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Details",
          "description": "Provider-neutral expected, received, supported, or candidate failure facts."
        },
        "request_id": {
          "type": "string",
          "title": "Request Id",
          "description": "Request trace identifier for support and correlation."
        }
      },
      "type": "object",
      "required": [
        "code",
        "type",
        "message",
        "retryable",
        "request_id"
      ],
      "title": "TaskError"
    },
    "app__api__v1__schemas__common__TaskProgress": {
      "properties": {
        "percent": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 100.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Percent"
        },
        "stage": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Stage"
        },
        "message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Message"
        }
      },
      "type": "object",
      "title": "TaskProgress"
    }
  }
}