{"openapi":"3.1.0","info":{"title":"Terramind API","version":"1.0.0","summary":"100+ AI models behind one API key.","description":"The Terramind API gives programmatic access to 100+ AI models from Anthropic, OpenAI, Google, xAI, DeepSeek, and more — plus Terramind's in-house Carbon, Helium, and Titanium models — through a single endpoint. Credits are deducted from your organization's balance.\n\nAuthentication: Bearer token (`sk-tm-*`). Create keys in Settings → API Keys or via `POST /api/v1/api-keys` (max 10 keys per user). Rate limit: 60 requests/minute per key; 429 responses carry `Retry-After`.\n\nHuman-readable reference: https://terramind.com/docs/api · This spec: https://terramind.com/openapi.json","contact":{"name":"Terramind","email":"contact@terramind.com"}},"servers":[{"url":"https://terramind.com","description":"Production"}],"tags":[{"name":"Chat","description":"Chat completions across every model"},{"name":"Models","description":"Model catalog"},{"name":"API Keys","description":"Programmatic key management"},{"name":"Usage","description":"Credit balance and usage history"},{"name":"Storage","description":"Signed upload URLs"},{"name":"Studio","description":"Image, video, music, voice, and audio generation"}],"paths":{"/api/v1/chat":{"post":{"operationId":"createChat","summary":"Create a chat completion","description":"Primary Terramind chat endpoint. Send `stream: true` for a streaming response, omit it (or set `false`) for a single JSON result. Credits are deducted from your organization balance.","tags":["Chat"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"200":{"description":"Completion. JSON body when stream=false, SSE stream when stream=true.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}},"text/event-stream":{"schema":{"type":"string"},"description":"Server-sent events delta stream"}}},"400":{"description":"Invalid request body or unknown model","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"402":{"description":"Insufficient credits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/chat/completions":{"post":{"operationId":"createChatCompletions","summary":"Create a chat completion (OpenAI-compatible path)","description":"Drop-in alias of POST /api/v1/chat that also accepts the OpenAI `chat.completions` request shape and can return the OpenAI-style envelope `{ choices: [...] }`. Use either path with the OpenAI SDK by setting baseURL to https://terramind.com/api/v1.","tags":["Chat"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"200":{"description":"Completion. Shape depends on the request style used (Terramind or OpenAI-compatible).","content":{"application/json":{"schema":{"type":"object"}},"text/event-stream":{"schema":{"type":"string"},"description":"Server-sent events delta stream"}}},"400":{"description":"Invalid request body or unknown model","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"402":{"description":"Insufficient credits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/models":{"get":{"operationId":"listModels","summary":"List available models","description":"Returns every model available through the API. Entries carry both the OpenAI shape (`{ id, object, created, owned_by }`) and the Anthropic shape (`{ type: \"model\", id, display_name, created_at }`) so both official SDKs iterate `data` unchanged. A legacy top-level `models` array is kept for older Terramind SDKs.","tags":["Models"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Model catalog","headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"},"description":"Maximum requests per minute (60)"},"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Remaining requests in the current window"},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix timestamp (seconds) when the window resets"},"X-Request-Id":{"schema":{"type":"string"},"description":"Unique request identifier for debugging"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelList"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/models/{id}":{"get":{"operationId":"getModel","summary":"Get a single model","tags":["Models"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Model id, e.g. claude-haiku-4-5"}],"responses":{"200":{"description":"Dual-shaped model entry (OpenAI + Anthropic fields)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelEntry"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown model id (Anthropic-style error envelope)","content":{"application/json":{"example":{"type":"error","error":{"type":"not_found_error","message":"Model \"nope\" not found"}}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/api-keys":{"get":{"operationId":"listApiKeys","summary":"List your API keys","tags":["API Keys"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Keys on the authenticated user","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyMeta"}}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}},"post":{"operationId":"createApiKey","summary":"Create an API key","description":"Max 10 keys per user. The full key is returned once — store it immediately.","tags":["API Keys"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":64,"description":"Display name for the key"},"expiresAt":{"type":"integer","format":"int64","description":"Optional expiry, Unix ms in the future"}}}}}},"responses":{"200":{"description":"Created key (shown only this once)","content":{"application/json":{"schema":{"type":"object","required":["key","keyId"],"properties":{"key":{"type":"string","example":"sk-tm-..."},"keyId":{"type":"string"},"keyPrefix":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"integer"}}}}}},"400":{"description":"Invalid name/expiry or key quota reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/api-keys/{keyId}":{"delete":{"operationId":"deleteApiKey","summary":"Revoke an API key","tags":["API Keys"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"keyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Revoked","content":{"application/json":{"example":{"success":true,"keyId":"abc123"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Key not found or not owned by you","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/usage":{"get":{"operationId":"getUsage","summary":"Credit balance and recent API usage","tags":["Usage"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"after","in":"query","schema":{"type":"string","format":"date-time"},"description":"Only usage after this ISO 8601 timestamp"},{"name":"limit","in":"query","schema":{"type":"integer","default":20}}],"responses":{"200":{"description":"Balance and recent usage records","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/storage/upload-url":{"post":{"operationId":"createUploadUrl","summary":"Mint a signed upload URL","description":"Returns a short-lived signed URL for uploading a file directly to blob storage, plus the public URL to read it back from.","tags":["Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Signed upload URL","headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"},"description":"Maximum requests per minute (60)"},"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Remaining requests in the current window"},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix timestamp (seconds) when the window resets"},"X-Request-Id":{"schema":{"type":"string"},"description":"Unique request identifier for debugging"}},"content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/image/generate":{"post":{"summary":"Generate images","description":"Text-to-image generation. Returns media URL(s) and credits consumed.","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string"},"model":{"type":"string"},"resolution":{"type":"string"},"imageUrls":{"type":"string"},"async":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/image/batch":{"post":{"summary":"Batch-generate images","description":"Queue multiple image generations in one call.","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompts"],"properties":{"prompts":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/image/edit":{"post":{"summary":"Edit an image","description":"Instruction-based image editing against source image(s).","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt","imageUrls"],"properties":{"prompt":{"type":"string"},"imageUrls":{"type":"string"},"model":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/image/upscale":{"post":{"summary":"Upscale an image","description":"","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["imageUrl"],"properties":{"imageUrl":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/image/remove-background":{"post":{"summary":"Remove an image background","description":"","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["imageUrl"],"properties":{"imageUrl":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/video/generate":{"post":{"summary":"Generate video","description":"Text/image-to-video generation. Long-running; supports async polling.","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string"},"model":{"type":"string"},"imageUrl":{"type":"string"},"async":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/video/upscale":{"post":{"summary":"Upscale a video","description":"","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["videoUrl"],"properties":{"videoUrl":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/video/remove-background":{"post":{"summary":"Remove a video background","description":"","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["videoUrl"],"properties":{"videoUrl":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/music/plan":{"post":{"summary":"Plan a music generation","description":"Produce a structured music plan (sections, style) without generating audio.","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/music/generate":{"post":{"summary":"Generate music","description":"","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string"},"plan":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/sfx/generate":{"post":{"summary":"Generate a sound effect","description":"","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/voiceover/generate":{"post":{"summary":"Generate a voiceover","description":"Text-to-speech narration.","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string"},"voice":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/dialogue/generate":{"post":{"summary":"Generate multi-speaker dialogue","description":"","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["inputs"],"properties":{"inputs":{"type":"array","items":{"type":"object","required":["text"],"properties":{"text":{"type":"string"},"voiceId":{"type":"string"}}}},"title":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}},"/api/v1/studio/audio/transcribe":{"post":{"summary":"Transcribe audio","description":"Speech-to-text with word-level timestamps. Accepts JSON with `fileId` or `audioUrl`, or a direct multipart/form-data upload (`file`, ≤ 4.5 MB).","tags":["Studio"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"fileId":{"type":"string"},"audioUrl":{"type":"string","format":"uri"},"language":{"type":"string"},"fileName":{"type":"string"}}}}}},"responses":{"200":{"description":"Generation result (media URLs, credits consumed)","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Unauthorized"}}}},"403":{"description":"Key valid but not allowed for this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (60 req/min per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded. Please slow down."}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Internal server error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"bearer","bearerFormat":"sk-tm-*"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Machine-readable error code or short message"},"message":{"type":"string","description":"Human-readable detail, present on some errors"}}},"ChatMessage":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["system","user","assistant"]},"content":{"oneOf":[{"type":"string"},{"type":"array","description":"Multimodal parts (text / image_url)","items":{"type":"object"}}]}}},"ChatRequest":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string","description":"Any id from GET /api/v1/models","example":"claude-haiku-4-5"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/ChatMessage"}},"stream":{"type":"boolean","default":false,"description":"true returns an SSE delta stream"},"temperature":{"type":"number"},"max_tokens":{"type":"integer"}}},"ChatResponse":{"type":"object","properties":{"id":{"type":"string"},"model":{"type":"string"},"content":{"type":"string"},"usage":{"type":"object","properties":{"inputTokens":{"type":"integer"},"outputTokens":{"type":"integer"},"totalTokens":{"type":"integer"}}},"creditsConsumed":{"type":"number"}}},"ModelEntry":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","example":"model"},"created":{"type":"integer"},"owned_by":{"type":"string"},"display_name":{"type":"string"}}},"ModelList":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ModelEntry"}},"models":{"type":"array","description":"Legacy array kept for older Terramind SDKs","items":{"type":"object"}}}},"ApiKeyMeta":{"type":"object","properties":{"keyId":{"type":"string"},"keyPrefix":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"integer"},"expiresAt":{"type":["integer","null"]},"lastUsedAt":{"type":["integer","null"]}}}}}}