{"openapi":"3.1.0","info":{"title":"Sunbird AI API","description":"\nWelcome to the Sunbird AI API documentation. The Sunbird AI API provides access to\nSunbird's language models and AI services for Ugandan languages.\n\n## Supported Languages\n**English**, **Acholi**, **Ateso**, **Luganda**, **Lugbara**, **Runyankole**, **Swahili**\nand **20+** more Ugandan languages supported via sunflower.\n\n## Getting Started\nYou can checkout the [usage guide](https://docs.sunbird.ai/api-reference/introduction) for a full tutorial.\n\nFor quickstart tutorials, visit our\n[GitHub repository](https://github.com/SunbirdAI/sunbird-ai-api/blob/main/docs/tutorial.md)\n\n### Authentication\n\n#### Signing Up\nIf you don't already have an account, use the `/auth/register` endpoint to create one.\n\n#### Getting an Access Token\nAuthentication is done via a Bearer token. Use the `/auth/token` endpoint to get your\naccess token. This token lasts for 7 days.\n\nUse the `Authorize` button below to login and access the protected endpoints.\n\n## API Endpoints\n\n### Translation\n- **`POST /tasks/translate`** - Translate text between **67 African languages**\n  (plus English) using the `sunflower-9b` model. Languages are accepted as ISO\n  codes (`lug`) or full names (`Luganda`); `source_language` is optional\n  (auto-detected when omitted). Translation works between any pair of supported\n  languages; quality varies by language (see the model's good/moderate/basic tiers).\n\n### Language Detection\n- **`POST /tasks/language_id`** - Auto-detect the language of text input\n  (supports Acholi, Ateso, English, Luganda, Lugbara, Runyankole)\n\n### Speech-to-Text (STT)\n- **`POST /tasks/audio/transcriptions`** - STT endpoint, powered by\n  Sunbird's faster-whisper ASR model covering **51 African languages**\n  (`Sunbird/faster-whisper-51-african-languages`, a Whisper large-v3 fine-tune).\n  - `audio`: the audio file to transcribe (**required**). Supports WAV, MP3,\n    OGG, M4A, and more.\n  - `language`: ISO 639-3 code (**required**). The model reuses Whisper's\n    language-token slots for African languages, so automatic detection is\n    unreliable — always pass a language explicitly.\n  - `timestamps`: set `true` to also receive per-segment start/end times in the\n    `segments` field. Defaults to `false`.\n  - **51 supported languages**: Acholi (`ach`), Afrikaans (`afr`), Akan (`aka`),\n    Amharic (`amh`), Ateso (`teo`), Bambara (`bam`), Bemba (`bem`),\n    Berber (`ber`), Chichewa (`nya`), Dagaare (`dga`), Dagbani (`dag`),\n    English (`eng`), Ewe (`ewe`), French (`fra`), Fulani (`ful`), Hausa (`hau`),\n    Igbo (`ibo`), Ikposo (`kpo`), Kabyle (`kab`), Kalenjin (`kln`),\n    Kanuri (`kau`), Kikuyu (`kik`), Kinyarwanda (`kin`), Kwamba (`rwm`),\n    Lendu (`led`), Lingala (`lin`), Lugbara (`lgg`), Luganda (`lug`),\n    Luhya (`luy`), Lumasaba (`myx`), Luo (`luo`), Lusoga (`xog`),\n    Malagasy (`mlg`), Ndebele (`nbl`), Nigerian Pidgin (`pcm`), Oromo (`orm`),\n    Rukiga (`cgg`), Rukonjo (`koo`), Runyankole (`nyn`), Ruruuli (`ruc`),\n    Rutooro (`ttj`), Shona (`sna`), Somali (`som`), Sotho (`sot`),\n    Swahili (`swa`), Thur (`lth`), Tswana (`tsn`), Wolof (`wol`),\n    Xhosa (`xho`), Yoruba (`yor`), Zulu (`zul`).\n  - **Removed parameters** (previously accepted, now rejected): `platform`,\n    `adapter`, `whisper`, `recognise_speakers`, `org`, `gcs_blob_name`. Speaker\n    diarization and the organization workflow remain on the legacy routes below.\n  - **Deprecated** → use `POST /tasks/audio/transcriptions`:\n    - `POST /tasks/stt`, `POST /tasks/stt_from_gcs`, `POST /tasks/org/stt`,\n      `POST /tasks/modal/stt`\n\n### Text-to-Speech (TTS)\nAll TTS is served by the **RunPod Orpheus-3B** deployment\n(`sunbird-orpheus-tts`, 19 African languages / 44 named speakers) running as a\nqueue-based serverless endpoint: each utterance is a job a worker picks up when\nfree, so bursts wait in the queue instead of failing. The earlier\nmodel/platform matrix (spark-tts, Modal) and the per-provider TTS routes were\nremoved — **breaking change**.\n- **`POST /tasks/audio/speech`** - Single-synthesis endpoint.\n  - `voice`: speaker name (e.g. `Namuli`), scoped by `language` (required when\n    `voice` is a name; the same name can exist in several languages). If omitted,\n    a speaker is chosen for `language` (Luganda by default). Legacy speaker ids\n    such as `salt_lug_0001` still work but return `Deprecation`/`Warning` headers\n    and a `warnings` field naming the speaker name to use instead.\n  - `response_mode`: `url` (default — signed GCP Storage URL), `stream` (raw audio\n    bytes, no storage), or `both` (raw audio bytes with the signed URL in\n    the `X-Audio-Url` response header).\n  - Tuning: `language`, `temperature`, `top_p`, `repetition_penalty`,\n    `max_tokens`, `seed`.\n  - **Removed parameters** (previously accepted, now rejected): `model`,\n    `platform`, `max_new_audio_tokens`.\n- **`POST /tasks/audio/speech/batch`** - Batch synthesis, 1-16 items (one queue job\n  each, run concurrently; a failed item is reported per-item with `status=\"error\"`).\n- **`GET /tasks/voice/speakers`** - List Orpheus voices by name, with gender\n  (`voices`), optionally for one `language`.\n  - **sunbird-orpheus-tts** covers 19 African languages: Acholi (`ach`), Afrikaans (`afr`),\n    English (`eng`), Ewe (`ewe`), Fulah (`ful`), Hausa (`hau`), Igbo (`ibo`), Kikuyu (`kik`),\n    Kinyarwanda (`kin`), Lugbara (`lgg`), Lingala (`lin`), Luganda (`lug`),\n    Runyankole (`nyn`), Sesotho (`sot`), Swahili (`swa`), Ateso (`teo`), Setswana (`tsn`),\n    Xhosa (`xho`), Yoruba (`yor`). A few (`lgg`, `sot`, `tsn`) are in the training mix but\n    expose no individual voices yet. Luo (`luo`) is temporarily unavailable for TTS while\n    its data is being cleaned up. Full per-speaker catalog: see the\n    [tutorial](https://github.com/SunbirdAI/sunbird-ai-api/blob/main/docs/tutorial.md)\n    or call `GET /tasks/voice/speakers`.\n- **`GET /tasks/audio/speech/url`** - Refresh an expired signed URL for a stored audio object.\n  - **Removed** → use the unified endpoints above:\n    - `POST /tasks/modal/tts`, `POST /tasks/runpod/tts`,\n      `POST /tasks/modal/orpheus/tts`, `POST /tasks/tts` → `POST /tasks/audio/speech`\n    - `POST /tasks/modal/tts/stream` → `/tasks/audio/speech` (`response_mode=stream`)\n    - `POST /tasks/modal/tts/stream-with-url` → `/tasks/audio/speech` (`response_mode=both`)\n    - `POST /tasks/modal/orpheus/tts/batch` → `POST /tasks/audio/speech/batch`\n    - `GET /tasks/modal/tts/speakers`, `GET /tasks/modal/orpheus/speakers`,\n      `GET /tasks/modal/orpheus/speakers/{language}` → `GET /tasks/voice/speakers`\n    - `GET /tasks/modal/tts/refresh-url` → `GET /tasks/audio/speech/url`\n\n### Inference (Sunflower Chat)\n- **`POST /tasks/chat/completions`** - OpenAI-compatible chat completions (Sunflower models).\n  Supports single instructions, multi-turn conversations, and SSE streaming (`stream: true`).\n  - Model (`model` field): **`sunflower-9b`** (default) — broad pan-African\n    coverage: **67 African languages** (plus English) across good/moderate/basic\n    tiers. Optimized for translation, instruction-following, and multi-turn chat.\n    The model's system prompt is injected when the request does not include one.\n  - **Deprecated model `sunflower-14b`** — still accepted, but every such request\n    is **served by `sunflower-9b`** and will be removed soon. The response reports\n    `\"model\": \"sunflower-9b\"`, carries `Deprecation: true`, `Warning` and `Link`\n    headers (JSON and SSE), and the non-streaming body includes a top-level\n    `warning` string. Update clients to send `\"model\": \"sunflower-9b\"`.\n  - The old identifier `Sunbird/Sunflower-14B` is **no longer accepted** —\n    requests using it return `400` with a message to use `sunflower-9b` instead.\n  - **Deprecated** → superseded by the unified endpoint above:\n    - `POST /tasks/sunflower_inference` → `POST /tasks/chat/completions`\n    - `POST /tasks/sunflower_simple` → `POST /tasks/chat/completions` (send the instruction as a single user message)\n\n### File Upload\n- **`POST /tasks/generate-upload-url`** - Generate signed URLs for direct client uploads to GCP Storage\n  - Supports audio files, images, and other content types\n  - Includes path traversal protection and input validation\n  - Returns temporary signed URL valid for 30 minutes\n\n### WhatsApp Integration (Webhooks)\n- **`POST /tasks/webhook`** - Handle incoming WhatsApp Business API messages\n- **`GET /tasks/webhook`** - Verify webhook endpoint ownership for WhatsApp\n\n### Legacy Endpoints\n- **`POST /tasks/summarise`** - *(Deprecated)* Anonymized text summarization (use Sunflower inference instead)\n\n## MCP Server (AI agents)\nAI agents and coding assistants (Claude Code, Cursor, or any\n[Model Context Protocol](https://modelcontextprotocol.io) client) can use this API\nas tools through the hosted **Sunbird AI MCP server**, with no install.\n\n- **Endpoint**: `https://mcp.sunbird.ai/mcp` (Streamable HTTP).\n- **Authentication**: your own Sunbird API token from\n  [api.sunbird.ai/keys](https://api.sunbird.ai/keys), sent as\n  `Authorization: Bearer <token>`. There is no separate sign-up; usage is billed\n  and rate-limited on your account.\n- **Guide and tool reference**: [mcp.sunbird.ai](https://mcp.sunbird.ai) ·\n  **Source**: [SunbirdAI/sunbird-mcp](https://github.com/SunbirdAI/sunbird-mcp) ·\n  **MCP Registry**: `ai.sunbird/sunbird-mcp`.\n\nConnect from Claude Code:\n\n```bash\nclaude mcp add --transport http sunbird https://mcp.sunbird.ai/mcp   --header \"Authorization: Bearer YOUR_SUNBIRD_TOKEN\"\n```\n\nTools (each wraps an endpoint documented above; *billed* tools run inference):\n\n| Tool | Endpoint | Billed |\n| --- | --- | --- |\n| `sunbird_translate_text` | `POST /tasks/translate` | yes |\n| `sunbird_chat_completion` | `POST /tasks/chat/completions` | yes |\n| `sunbird_identify_language` | `POST /tasks/language_id` | yes |\n| `sunbird_transcribe_audio` | `POST /tasks/audio/transcriptions` | yes |\n| `sunbird_generate_speech` | `POST /tasks/audio/speech` | yes |\n| `sunbird_generate_speech_batch` | `POST /tasks/audio/speech/batch` | yes |\n| `sunbird_refresh_speech_url` | `GET /tasks/audio/speech/url` | no |\n| `sunbird_list_voices` | `GET /tasks/voice/speakers` | no |\n| `sunbird_list_languages` | local catalog | no |\n| `sunbird_list_models` | local catalog | no |\n| `sunbird_check_connection` | `GET /auth/me` | no |\n\nThe same information is published in machine-readable form under\n`info.x-mcp-server` in [`/openapi.json`](/openapi.json). See the\n[tutorial](https://github.com/SunbirdAI/sunbird-ai-api/blob/main/docs/tutorial.md)\nfor Cursor, Python and MCP Inspector examples.\n\n## Rate Limiting\nAPI endpoints are rate-limited to ensure fair usage. Authentication is required for most endpoints.\n","version":"0.1.0","x-mcp-server":{"name":"ai.sunbird/sunbird-mcp","title":"Sunbird AI MCP server","description":"African-language translation, chat, speech-to-text and text-to-speech from Sunbird AI, exposed as Model Context Protocol tools for AI agents.","url":"https://mcp.sunbird.ai/mcp","transport":"streamable-http","documentationUrl":"https://mcp.sunbird.ai","serverCardUrl":"https://mcp.sunbird.ai/mcp/server-card","repository":"https://github.com/SunbirdAI/sunbird-mcp","registryName":"ai.sunbird/sunbird-mcp","authentication":{"type":"http","scheme":"bearer","header":"Authorization","value":"Bearer {sunbird_api_token}","description":"Your own Sunbird AI API token, created at https://api.sunbird.ai/keys. Usage is billed to that account.","tokenUrl":"https://api.sunbird.ai/keys"},"tools":[{"name":"sunbird_translate_text","description":"Translate between English and 67 African languages with Sunflower.","endpoint":{"method":"POST","path":"/tasks/translate"},"billable":true},{"name":"sunbird_chat_completion","description":"Chat and question answering in African languages (sunflower-9b).","endpoint":{"method":"POST","path":"/tasks/chat/completions"},"billable":true},{"name":"sunbird_identify_language","description":"Detect which language a text is written in.","endpoint":{"method":"POST","path":"/tasks/language_id"},"billable":true},{"name":"sunbird_transcribe_audio","description":"Speech-to-text in 51 African languages from a public URL, a local file or inline audio.","endpoint":{"method":"POST","path":"/tasks/audio/transcriptions"},"billable":true},{"name":"sunbird_generate_speech","description":"Text-to-speech with named voices, chosen by speaker name and language.","endpoint":{"method":"POST","path":"/tasks/audio/speech"},"billable":true},{"name":"sunbird_generate_speech_batch","description":"Synthesise up to 16 texts in one request.","endpoint":{"method":"POST","path":"/tasks/audio/speech/batch"},"billable":true},{"name":"sunbird_refresh_speech_url","description":"Get a fresh download link for audio generated earlier.","endpoint":{"method":"GET","path":"/tasks/audio/speech/url"},"billable":false},{"name":"sunbird_list_voices","description":"Speaker names with gender, grouped by language or filtered to one.","endpoint":{"method":"GET","path":"/tasks/voice/speakers"},"billable":false},{"name":"sunbird_list_languages","description":"Language codes per capability (translation, chat, transcription, speech).","endpoint":null,"billable":false},{"name":"sunbird_list_models","description":"Available models and what each is for.","endpoint":null,"billable":false},{"name":"sunbird_check_connection","description":"Confirm the token and show the account it belongs to.","endpoint":{"method":"GET","path":"/auth/me"},"billable":false}]}},"paths":{"/auth/register":{"post":{"tags":["Authentication Endpoints"],"summary":"Register","operationId":"register_auth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserRegister"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/verify-email":{"get":{"tags":["Authentication Endpoints"],"summary":"Verify Email","description":"Landing endpoint for the emailed verification link. Always redirects\nto the frontend; never leaks whether an account exists.\n\nRedirects are same-origin relative URLs: the SPA is served by this API\n(spa.py), and the FRONTEND_*_URL env vars point at the reset-password\npage rather than the site root, so they must not be used here.","operationId":"verify_email_auth_verify_email_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/resend-verification":{"post":{"tags":["Authentication Endpoints"],"summary":"Resend Verification","operationId":"resend_verification_auth_resend_verification_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendVerificationResponse"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/auth/admin/send-verification-emails":{"post":{"tags":["Authentication Endpoints"],"summary":"Send Verification Emails Backfill","description":"One-time (re-runnable) backfill: email unverified users a verification\nlink + tutorial pointer. Idempotent — only targets users not yet emailed.\nRun daily with the default batch size until remaining_unverified stops\nshrinking (Resend free tier caps at 100 emails/day).\n\nRuns SYNCHRONOUSLY inside the request (~1.2s per email; batch_size is\ncapped so a full batch fits inside Cloud Run's request timeout).\nBackground tasks lose CPU on Cloud Run once the response returns and die\non instance shutdown — a killed run used to strand users marked as\nemailed. Each user is now stamped only AFTER their email is accepted by\nResend, so a crashed or failed run is resumed exactly by running again.","operationId":"send_verification_emails_backfill_auth_admin_send_verification_emails_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackfillVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackfillVerificationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/auth/admin/verification-stats":{"get":{"tags":["Authentication Endpoints"],"summary":"Verification Stats","description":"Counts backing the admin dashboard's email-verification card.","operationId":"verification_stats_auth_admin_verification_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerificationStatsResponse"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/auth/token":{"post":{"tags":["Authentication Endpoints"],"summary":"Login For Access Token","operationId":"login_for_access_token_auth_token_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_login_for_access_token_auth_token_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/refresh-token":{"post":{"tags":["Authentication Endpoints"],"summary":"Refresh Token","description":"Rotate the caller's API key.\n\nBumps the user's token version (revoking the previous key) and issues a\nnew token carrying the user's *current* account type. Rate limits are\nkeyed by user, not token, so refreshing never resets a quota.","operationId":"refresh_token_auth_refresh_token_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/auth/me":{"get":{"tags":["Authentication Endpoints"],"summary":"Read Users Me","operationId":"read_users_me_auth_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/auth/forgot-password":{"post":{"tags":["Authentication Endpoints"],"summary":"Request Password Reset","operationId":"request_password_reset_auth_forgot_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgotPassword"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/reset-password":{"post":{"tags":["Authentication Endpoints"],"summary":"Reset Password","operationId":"reset_password_auth_reset_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPassword"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/change-password":{"post":{"tags":["Authentication Endpoints"],"summary":"Change Password","operationId":"change_password_auth_change_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePassword"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/auth/profile":{"put":{"tags":["Authentication Endpoints"],"summary":"Update Profile","operationId":"update_profile_auth_profile_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/auth/profile/status":{"get":{"tags":["Authentication Endpoints"],"summary":"Profile Status","operationId":"profile_status_auth_profile_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileCompletionStatus"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/auth/google/login":{"get":{"tags":["Authentication Endpoints"],"summary":"Auth:Google Login","operationId":"auth_google_login_auth_google_login_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/google/callback":{"get":{"tags":["Authentication Endpoints"],"summary":"Auth:Google Callback","operationId":"auth_google_callback_auth_google_callback_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/tasks/stt_from_gcs":{"post":{"tags":["legacy/deprecated"],"summary":"Speech To Text From Gcs","description":"RETIRED — use POST /tasks/audio/transcriptions.\n\nRemoved because it re-signed/transcribed any caller-supplied GCS object\nwith no ownership check (F14, BOLA).","operationId":"speech_to_text_from_gcs_tasks_stt_from_gcs_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"deprecated":true}},"/tasks/stt":{"post":{"tags":["legacy/deprecated"],"summary":"Speech To Text","description":"Upload an audio file and receive its transcription.\n\n**Deprecated** — use `POST /tasks/audio/transcriptions` instead.\n\nSupports MP3, WAV, OGG, M4A and AAC. Send the file and parameters as\n`multipart/form-data`.\n\n**Limitations**\n\n- Audio longer than 10 minutes is trimmed; only the first 10 minutes are transcribed.\n- Requests larger than 100 MB are rejected — split the audio or use a signed upload URL.\n\n**Errors**\n\n- `400` — file validation failed or the audio could not be processed\n- `502` — the transcription service failed","operationId":"speech_to_text_tasks_stt_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_speech_to_text_tasks_stt_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/STTTranscript"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"deprecated":true,"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/org/stt":{"post":{"tags":["legacy/deprecated"],"summary":"Speech To Text Org","description":"Upload an audio file for transcription with automatic language detection.\n\n**Deprecated** — use `POST /tasks/audio/transcriptions` instead.\n\nA simplified variant of `POST /tasks/stt` for organisation use cases: the\nlanguage is detected automatically, and speaker diarization is optional.\n\n**Errors**\n\n- `400` — the audio could not be processed\n- `502` — the transcription service failed\n- `503` — the transcription service timed out","operationId":"speech_to_text_org_tasks_org_stt_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_speech_to_text_org_tasks_org_stt_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/STTTranscript"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"deprecated":true,"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/modal/stt":{"post":{"tags":["legacy/deprecated"],"summary":"Transcribe Audio via Modal Whisper ASR","description":"Upload an audio file and get transcription using the Modal-hosted Whisper model. Optionally specify a language to improve accuracy.","operationId":"modal_speech_to_text_tasks_modal_stt_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_modal_speech_to_text_tasks_modal_stt_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/STTTranscript"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"deprecated":true,"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/audio/transcriptions":{"post":{"tags":["Speech-to-Text"],"summary":"Transcribe audio (unified STT endpoint)","description":"Unified Speech-to-Text endpoint, powered by Sunbird's faster-whisper ASR model covering 51 African languages. Accepts an uploaded audio file and a required language code; set timestamps=true to also receive per-segment timings. Replaces /stt, /stt_from_gcs, /org/stt, and /modal/stt.","operationId":"create_transcription_tasks_audio_transcriptions_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_transcription_tasks_audio_transcriptions_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/STTTranscript"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/audio/speech":{"post":{"tags":["Text-to-Speech"],"summary":"Generate speech (unified TTS endpoint)","description":"Unified Text-to-Speech endpoint, served by the RunPod Orpheus-3B deployment. response_mode='url' (default) returns a signed GCS audio URL; 'stream' returns raw audio bytes with no storage; 'both' returns raw audio bytes with the signed URL in the X-Audio-Url header. Replaces /tasks/modal/tts, /tasks/runpod/tts, and /tasks/modal/orpheus/tts.","operationId":"create_speech_tasks_audio_speech_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpeechRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpeechResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/audio/speech/batch":{"post":{"tags":["Text-to-Speech"],"summary":"Batch-generate speech (unified, sunbird-orpheus-tts only)","description":"Unified batch Text-to-Speech endpoint. Synthesizes 1-128 items in a single sunbird-orpheus-tts pass and uploads each result to GCS. Per-item failures are reported with status='error'; the request returns 200 if at least one item succeeds, 502 if every item fails. Replaces /tasks/modal/orpheus/tts/batch.","operationId":"create_speech_batch_tasks_audio_speech_batch_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpeechBatchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpeechBatchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/voice/speakers":{"get":{"tags":["Text-to-Speech"],"summary":"List speakers/voices (unified)","description":"List available Orpheus-3B speakers. Returns the catalog grouped by language (OrpheusSpeakersResponse); add 'language' to get one language's voices (OrpheusLanguageSpeakersResponse). Replaces /tasks/modal/orpheus/speakers, /tasks/modal/orpheus/speakers/{language}, and /tasks/modal/tts/speakers.","operationId":"list_voices_tasks_voice_speakers_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"language","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 639-3 code (e.g. 'lug') to filter to one language.","title":"Language"},"description":"ISO 639-3 code (e.g. 'lug') to filter to one language."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tasks/audio/speech/url":{"get":{"tags":["Text-to-Speech"],"summary":"Refresh a signed audio URL (unified)","description":"Generate a fresh signed URL for an existing audio object in GCS (e.g. a previously synthesized speech file whose signed URL has expired). Replaces /tasks/modal/tts/refresh-url.","operationId":"refresh_speech_url_tasks_audio_speech_url_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"gcs_object","in":"query","required":true,"schema":{"type":"string","description":"GCS object name to re-sign (e.g. 'orpheus_tts/.../x.wav').","title":"Gcs Object"},"description":"GCS object name to re-sign (e.g. 'orpheus_tts/.../x.wav')."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshedUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tasks/translate":{"post":{"tags":["Translation"],"summary":"Translate","description":"Translate text between supported languages using the sunflower-9b model.\n\nLanguages are accepted as ISO 639-3 codes (e.g. `lug`) or full names\n(e.g. `Luganda`), case-insensitively. `source_language` is optional — when\nomitted, Sunflower infers the source language from the text. Translation\nworks between any pair of supported languages.\n\n**Supported languages** — English plus the 67 African languages\n`sunflower-9b` supports. Quality varies by language; see the model's\ngood/moderate/basic tiers.\n\nAcholi (`ach`), Afrikaans (`afr`), Akan (`aka`), Alur (`alz`), Amharic (`amh`),\nAringa (`luc`), Ateso (`teo`), Bambara (`bam`), Bari (`bfa`), Bemba (`bem`),\nBerber (`ber`), Chichewa (`nya`), Dagaare (`dga`), Dagbani (`dag`),\nDinka (`din`), English (`eng`), Ewe (`ewe`), Fulani (`ful`), Hausa (`hau`),\nIgbo (`ibo`), Ik (`ikx`), Jopadhola (`adh`), Kabyle (`kab`), Kakwa (`keo`),\nKalenjin (`kln`), Kanuri (`kau`), Karamojong (`kdj`), Kikuyu (`kik`),\nKinyarwanda (`kin`), Kirundi (`run`), Kumam (`kdi`), Kupsabiny (`kpz`),\nKwamba (`rwm`), Lango (`laj`), Lendu (`led`), Lingala (`lin`), Lubwisi (`tlj`),\nLuganda (`lug`), Lugbara (`lgg`), Lugungu (`rub`), Lugwere (`gwr`),\nLuhya (`luy`), Lumasaba (`myx`), Lunyole (`nuj`), Luo (`luo`), Lusoga (`xog`),\nMa'di (`mhi`), Malagasy (`mlg`), Ndebele (`nbl`), Nigerian Pidgin (`pcm`),\nOromo (`orm`), Pokot (`pok`), Rukiga (`cgg`), Rukonjo (`koo`),\nRunyankole (`nyn`), Runyoro (`nyo`), Ruruuli (`ruc`), Rutooro (`ttj`),\nSamia (`lsm`), Shona (`sna`), Somali (`som`), Sotho (`sot`), Swahili (`swa`),\nTswana (`tsn`), Wolof (`wol`), Xhosa (`xho`), Yoruba (`yor`), Zulu (`zul`).\n\n**Example request**\n\n```json\n{\n  \"source_language\": \"eng\",\n  \"target_language\": \"lug\",\n  \"text\": \"Hello, how are you?\"\n}\n```\n\n**Example response**\n\n```json\n{\n  \"id\": \"trans-1a2b3c...\",\n  \"status\": \"COMPLETED\",\n  \"output\": {\n    \"translated_text\": \"Oli otya?\",\n    \"source_language\": \"eng\",\n    \"target_language\": \"lug\"\n  }\n}\n```\n\n**Errors**\n\n- `400` — unsupported language, or `source_language` equals `target_language`\n- `502` — the model returned empty output or failed unexpectedly\n- `503` — the model is still loading or inference timed out","operationId":"translate_tasks_translate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SunflowerTranslationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkerTranslationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/language_id":{"post":{"tags":["Language"],"summary":"Language Id","description":"Identify the language of a piece of text.\n\nBacked by a classification model covering 64 languages, mostly African\nplus English and French. A language is only reported when its\nprobability clears the confidence threshold (default `0.35`); below\nthat the response is `\"language not detected\"`, which is more useful\nthan a confident guess at a language the model does not actually\nsupport.\n\n**Example request**\n\n```json\n{ \"text\": \"Oli otya?\" }\n```\n\n**Example response**\n\n```json\n{ \"language\": \"lug\", \"confidence\": 0.97 }\n```\n\nWhen confidence is below the threshold:\n\n```json\n{ \"language\": \"language not detected\", \"confidence\": null }\n```\n\n**Errors**\n\n- `502` — the language identification service failed\n- `503` — the language identification service timed out","operationId":"language_id_tasks_language_id_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LanguageIdRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LanguageIdResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/auto_detect_audio_language":{"post":{"tags":["Language"],"summary":"Auto Detect Audio Language","description":"Detect the language spoken in an audio file.\n\nUpload the audio as `multipart/form-data`. The file is stored in cloud\nstorage for processing and the detected language code is returned.\n\n**Example response**\n\n```json\n{ \"detected_language\": \"lug\" }\n```\n\n**Errors**\n\n- `502` — the language detection service failed or could not be reached\n- `503` — the language detection service timed out","operationId":"auto_detect_audio_language_tasks_auto_detect_audio_language_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_auto_detect_audio_language_tasks_auto_detect_audio_language_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudioDetectedLanguageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/sunflower_inference":{"post":{"tags":["legacy/deprecated"],"summary":"Sunflower Inference","description":"Multilingual chat completion with Sunbird AI's Sunflower model.\n\n**Deprecated** — use `POST /tasks/chat/completions` instead.\n\nSunflower specialises in:\n\n- Multilingual conversation in Ugandan languages (Luganda, Acholi, Ateso, …)\n- Cross-lingual translation and explanation\n- Cultural context and educational content in local languages\n\nThe endpoint retries transient failures with exponential backoff, tracks\nusage, and accepts a custom system message plus the running message history.\n\n**Example request**\n\n```json\n{\n  \"messages\": [\n    {\"role\": \"system\", \"content\": \"You are Sunflower...\"},\n    {\"role\": \"user\", \"content\": \"Translate 'How are you?' to Luganda.\"},\n    {\"role\": \"assistant\", \"content\": \"In Luganda, 'How are you?' is 'Oli otya?'.\"},\n    {\"role\": \"user\", \"content\": \"How do I say 'Good morning' in Acholi?\"}\n  ],\n  \"model_type\": \"qwen\",\n  \"temperature\": 0.3\n}\n```\n\n**Example response**\n\n```json\n{\n  \"content\": \"In Acholi, 'Good morning' is 'Icwiny atir'.\",\n  \"model_type\": \"qwen\",\n  \"usage\": {\"completion_tokens\": 15, \"prompt_tokens\": 50, \"total_tokens\": 65},\n  \"processing_time\": 2.5,\n  \"inference_time\": 2.0,\n  \"message_count\": 5\n}\n```\n\n**Errors**\n\n- `400` — invalid request or message format\n- `502` — the model returned an empty response or failed unexpectedly\n- `503` — the model is still loading or the request timed out","operationId":"sunflower_inference_tasks_sunflower_inference_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SunflowerChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SunflowerChatResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"deprecated":true,"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/sunflower_simple":{"post":{"tags":["legacy/deprecated"],"summary":"Sunflower Simple Inference","description":"Single-instruction Sunflower inference using form fields.\n\n**Deprecated** — use `POST /tasks/chat/completions` instead.\n\nA simplified interface for clients that want to send one instruction\nrather than manage a conversation history. Send the fields as\n`application/x-www-form-urlencoded` or `multipart/form-data`.\n\n**Example form data**\n\n- `instruction`: `Translate 'hello' to Luganda`\n- `model_type`: `qwen`\n- `temperature`: `0.3`\n\n**Example response**\n\n```json\n{\n  \"response\": \"In Luganda, 'hello' is 'Gyebaleko' or 'Wasuze otya' (Good morning).\",\n  \"model_type\": \"qwen\",\n  \"processing_time\": 1.5,\n  \"usage\": {\"completion_tokens\": 20, \"prompt_tokens\": 10, \"total_tokens\": 30},\n  \"success\": true\n}\n```\n\n**Errors**\n\n- `400` — invalid request or unknown `model_type`\n- `502` — the model failed unexpectedly\n- `503` — the model is still loading or the request timed out","operationId":"sunflower_simple_inference_tasks_sunflower_simple_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_sunflower_simple_inference_tasks_sunflower_simple_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Sunflower Simple Inference Tasks Sunflower Simple Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"deprecated":true,"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/chat/completions":{"post":{"tags":["Chat"],"summary":"OpenAI-compatible chat completion (Sunflower)","description":"OpenAI-compatible chat completion powered by Sunbird's Sunflower model.\n\nSingle-instruction usage is a request with one user message; conversational\nusage passes the running message history. Set `stream: true` for\nServer-Sent Events in OpenAI `chat.completion.chunk` format, terminated\nby `data: [DONE]`.","operationId":"chat_completions_tasks_chat_completions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/generate-upload-url":{"post":{"tags":["Upload"],"summary":"Generate Upload URL","description":"Generate a signed URL for direct upload to Google Cloud Storage.","operationId":"generate_upload_url_tasks_generate_upload_url_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/tasks/webhook/":{"post":{"tags":["Webhooks"],"summary":"Webhook","description":"Receive WhatsApp Business webhook events.\n\nProcesses incoming WhatsApp messages and status events. Text messages get\na fast reply (typically 2–4 s); heavier work (audio, translation, TTS) is\nhanded to background processing. Duplicate deliveries are detected and\nignored, and each user's language preferences are respected.\n\nThe raw body is read before JSON parsing so the `X-Hub-Signature-256`\nheader can be verified over the exact signed bytes. Verification is\ncontrolled by `WHATSAPP_SIGNATURE_MODE` (`off` | `log` | `enforce`).\n\n**Response status codes**\n\n- `200` — event accepted and processed\n- `403` (configurable via `WHATSAPP_SIGNATURE_REJECT_STATUS`) — invalid signature in `enforce` mode\n- `500` — internal error\n\n**Example payload**\n\n```json\n{\n  \"entry\": [{\n    \"changes\": [{\n      \"value\": {\n        \"messages\": [{\"from\": \"1234567890\", \"text\": {\"body\": \"Hello\"}}],\n        \"contacts\": [{\"profile\": {\"name\": \"John\"}}],\n        \"metadata\": {\"phone_number_id\": \"9876543210\"}\n      }\n    }]\n  }]\n}\n```\n\n**Example response**\n\n```json\n{ \"status\": \"success\", \"processing_time\": 2.5 }\n```","operationId":"webhook_tasks_webhook__post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookResponse"}}}}}},"get":{"tags":["Webhooks"],"summary":"Verify Webhook","description":"Verify webhook ownership for WhatsApp.\n\nWhatsApp calls this endpoint once when you register the webhook URL. The\nendpoint checks that `hub.mode` is `subscribe` and that `hub.verify_token`\nmatches the configured token, then echoes `hub.challenge` back as plain\ntext to complete registration.\n\n**Example request**\n\n```\nGET /tasks/webhook?hub.mode=subscribe&hub.challenge=12345&hub.verify_token=mytoken\n```\n\n**Example response** (`text/plain`)\n\n```\n12345\n```\n\n**Errors**\n\n- `400` — a required query parameter is missing\n- `403` — the verify token does not match","operationId":"verify_webhook_tasks_webhook__get","parameters":[{"name":"hub_mode","in":"query","required":false,"schema":{"type":"string","title":"Hub Mode"}},{"name":"hub_challenge","in":"query","required":false,"schema":{"type":"string","title":"Hub Challenge"}},{"name":"hub_verify_token","in":"query","required":false,"schema":{"type":"string","title":"Hub Verify Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tasks/webhook":{"post":{"tags":["Webhooks"],"summary":"Webhook","description":"Receive WhatsApp Business webhook events.\n\nProcesses incoming WhatsApp messages and status events. Text messages get\na fast reply (typically 2–4 s); heavier work (audio, translation, TTS) is\nhanded to background processing. Duplicate deliveries are detected and\nignored, and each user's language preferences are respected.\n\nThe raw body is read before JSON parsing so the `X-Hub-Signature-256`\nheader can be verified over the exact signed bytes. Verification is\ncontrolled by `WHATSAPP_SIGNATURE_MODE` (`off` | `log` | `enforce`).\n\n**Response status codes**\n\n- `200` — event accepted and processed\n- `403` (configurable via `WHATSAPP_SIGNATURE_REJECT_STATUS`) — invalid signature in `enforce` mode\n- `500` — internal error\n\n**Example payload**\n\n```json\n{\n  \"entry\": [{\n    \"changes\": [{\n      \"value\": {\n        \"messages\": [{\"from\": \"1234567890\", \"text\": {\"body\": \"Hello\"}}],\n        \"contacts\": [{\"profile\": {\"name\": \"John\"}}],\n        \"metadata\": {\"phone_number_id\": \"9876543210\"}\n      }\n    }]\n  }]\n}\n```\n\n**Example response**\n\n```json\n{ \"status\": \"success\", \"processing_time\": 2.5 }\n```","operationId":"webhook_tasks_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookResponse"}}}}}},"get":{"tags":["Webhooks"],"summary":"Verify Webhook","description":"Verify webhook ownership for WhatsApp.\n\nWhatsApp calls this endpoint once when you register the webhook URL. The\nendpoint checks that `hub.mode` is `subscribe` and that `hub.verify_token`\nmatches the configured token, then echoes `hub.challenge` back as plain\ntext to complete registration.\n\n**Example request**\n\n```\nGET /tasks/webhook?hub.mode=subscribe&hub.challenge=12345&hub.verify_token=mytoken\n```\n\n**Example response** (`text/plain`)\n\n```\n12345\n```\n\n**Errors**\n\n- `400` — a required query parameter is missing\n- `403` — the verify token does not match","operationId":"verify_webhook_tasks_webhook_get","parameters":[{"name":"hub_mode","in":"query","required":false,"schema":{"type":"string","title":"Hub Mode"}},{"name":"hub_challenge","in":"query","required":false,"schema":{"type":"string","title":"Hub Challenge"}},{"name":"hub_verify_token","in":"query","required":false,"schema":{"type":"string","title":"Hub Verify Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tasks/summarise":{"post":{"tags":["legacy/deprecated"],"summary":"Summarise","description":"This endpoint does anonymised summarisation of a given text. The text languages\nsupported for now are English (eng) and Luganda (lug).","operationId":"summarise_tasks_summarise_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SummarisationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SummarisationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/dashboard/usage":{"get":{"tags":["Dashboard"],"summary":"Get Usage Stats","description":"Get usage statistics for the current user","operationId":"get_usage_stats_api_dashboard_usage_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/dashboard/usage-metrics":{"get":{"tags":["Dashboard"],"summary":"Get Usage Metrics","description":"Aggregated AI usage (tokens, audio seconds, characters, bytes) for the\ncurrent user, per capability.","operationId":"get_usage_metrics_api_dashboard_usage_metrics_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageMetricsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/overview":{"get":{"tags":["Billing"],"summary":"Get Billing Overview","description":"Credit balance, total granted, and month-to-date spend.","operationId":"get_billing_overview_api_billing_overview_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingOverviewResponse"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/billing/history":{"get":{"tags":["Billing"],"summary":"Get Billing History","description":"Bucketed usage-cost series per capability for the range.","operationId":"get_billing_history_api_billing_history_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"30d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/transactions":{"get":{"tags":["Billing"],"summary":"Get Billing Transactions","description":"Grant/adjustment history, newest first.","operationId":"get_billing_transactions_api_billing_transactions_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Page Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/rates":{"get":{"tags":["Billing"],"summary":"Get Billing Rates","description":"The current price card (updated_by is admin-only and omitted here).","operationId":"get_billing_rates_api_billing_rates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RatesResponse"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/admin/analytics/filters":{"get":{"tags":["Admin Analytics"],"summary":"Get Filter Options","description":"Return available filter values for admin analytics dropdowns.","operationId":"get_filter_options_api_admin_analytics_filters_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/admin/analytics/overview":{"get":{"tags":["Admin Analytics"],"summary":"Get Overview","description":"Get overall usage analytics across all users.","operationId":"get_overview_api_admin_analytics_overview_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/by-organization":{"get":{"tags":["Admin Analytics"],"summary":"Get By Organization","description":"Get usage analytics filtered by organization, with per-user breakdown.","operationId":"get_by_organization_api_admin_analytics_by_organization_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"organization","in":"query","required":true,"schema":{"type":"string","title":"Organization"}},{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/by-organization-type":{"get":{"tags":["Admin Analytics"],"summary":"Get By Organization Type","description":"Get usage analytics filtered by organization type.","operationId":"get_by_organization_type_api_admin_analytics_by_organization_type_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"organization_type","in":"query","required":true,"schema":{"type":"string","title":"Organization Type"}},{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/by-sector":{"get":{"tags":["Admin Analytics"],"summary":"Get By Sector","description":"Get usage analytics filtered by sector.","operationId":"get_by_sector_api_admin_analytics_by_sector_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"sector","in":"query","required":true,"schema":{"type":"string","title":"Sector"}},{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/users":{"get":{"tags":["Admin Analytics"],"summary":"Get Users List","description":"Get all registered users with their usage totals for the range.","operationId":"get_users_list_api_admin_analytics_users_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/users/{username}/account-type":{"patch":{"tags":["Admin Analytics"],"summary":"Update Account Type","description":"Change a user's account type (Free/Premium) from the admin dashboard.\n\nAdmin accounts (including your own) cannot be modified here — the\nrequest schema also refuses to assign the Admin type.","operationId":"update_account_type_api_admin_analytics_users__username__account_type_patch","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"username","in":"path","required":true,"schema":{"type":"string","title":"Username"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountTypeUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/users/{username}/suspend":{"post":{"tags":["Admin Analytics"],"summary":"Suspend User Account","description":"Suspend a user from the admin dashboard.\n\nThe user is moved to the zero-quota \"Suspended\" tier, every issued API\nkey is revoked immediately, and login is refused until an admin\nreinstates the account. Admin accounts cannot be suspended here.","operationId":"suspend_user_account_api_admin_analytics_users__username__suspend_post","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"username","in":"path","required":true,"schema":{"type":"string","title":"Username"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuspendUserRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSuspensionStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/suspended-users/report":{"get":{"tags":["Admin Analytics"],"summary":"Suspended Users Report","description":"Download the suspended-accounts PDF report (stakeholder hand-out).\n\nLists every currently suspended user with email, organisation, when\nand by whom they were suspended, and the recorded reason. An empty\nlist still yields a valid one-page report.","operationId":"suspended_users_report_api_admin_analytics_suspended_users_report_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/admin/analytics/users/{username}/reinstate":{"post":{"tags":["Admin Analytics"],"summary":"Reinstate User Account","description":"Lift a suspension, restoring the user's previous account type.\n\nExisting keys stay revoked; the user logs in again to get a new one.","operationId":"reinstate_user_account_api_admin_analytics_users__username__reinstate_post","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"username","in":"path","required":true,"schema":{"type":"string","title":"Username"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSuspensionStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/users/{username}/pause":{"post":{"tags":["Admin Analytics"],"summary":"Pause User Account","description":"Pause a user's API access for a set number of hours, days or weeks.\n\nUntil the pause runs out (or an admin unpauses), every /tasks/* call\nfrom the account returns 403 ``ACCOUNT_PAUSED``. The user can still\nsign in and sees when the pause ends; their API key is not revoked and\nworks again afterwards. Calling this on an already-paused user replaces\nthe end time, counted from now. Admin and suspended accounts cannot be\npaused.","operationId":"pause_user_account_api_admin_analytics_users__username__pause_post","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"username","in":"path","required":true,"schema":{"type":"string","title":"Username"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PauseUserRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserPauseStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/users/{username}/unpause":{"post":{"tags":["Admin Analytics"],"summary":"Unpause User Account","description":"End a pause early. The user's existing API key works again at once.","operationId":"unpause_user_account_api_admin_analytics_users__username__unpause_post","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"username","in":"path","required":true,"schema":{"type":"string","title":"Username"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserPauseStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/users/{username}/pauses":{"get":{"tags":["Admin Analytics"],"summary":"User Pause History","description":"A user's pause history, newest first (last 50).","operationId":"user_pause_history_api_admin_analytics_users__username__pauses_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"username","in":"path","required":true,"schema":{"type":"string","title":"Username"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccountPauseEntry"},"title":"Response User Pause History Api Admin Analytics Users  Username  Pauses Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/by-user":{"get":{"tags":["Admin Analytics"],"summary":"Get By User","description":"Get usage analytics filtered to a single user (drill-down).","operationId":"get_by_user_api_admin_analytics_by_user_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"username","in":"query","required":true,"schema":{"type":"string","title":"Username"}},{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/user-usage-metrics":{"get":{"tags":["Admin Analytics"],"summary":"Get User Usage Metrics","description":"Aggregated AI usage for one user (admin drill-down).","operationId":"get_user_usage_metrics_api_admin_analytics_user_usage_metrics_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"username","in":"query","required":true,"schema":{"type":"string","title":"Username"}},{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageMetricsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/user-gpu-spend":{"get":{"tags":["Admin Analytics"],"summary":"Get User Gpu Spend","description":"Runpod GPU spend attributed to one user (admin drill-down).\n\nSplits each Runpod endpoint's per-bucket bill among the users who used\nit, in proportion to processing time. See\ndocs/admin-gpu-spend-and-monitor-link.md.","operationId":"get_user_gpu_spend_api_admin_analytics_user_gpu_spend_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"username","in":"query","required":true,"schema":{"type":"string","title":"Username"}},{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GpuSpendResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/export":{"get":{"tags":["Admin Analytics"],"summary":"Export Csv","description":"Export aggregated analytics data as CSV.","operationId":"export_csv_api_admin_analytics_export_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"view","in":"query","required":false,"schema":{"type":"string","default":"overview","title":"View"}},{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}},{"name":"organization","in":"query","required":false,"schema":{"type":"string","title":"Organization"}},{"name":"organization_type","in":"query","required":false,"schema":{"type":"string","title":"Organization Type"}},{"name":"sector","in":"query","required":false,"schema":{"type":"string","title":"Sector"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/billing/summary":{"get":{"tags":["Admin Billing Analytics"],"summary":"Get Summary","operationId":"get_summary_api_admin_analytics_billing_summary_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"provider","in":"query","required":false,"schema":{"type":"string","default":"all","title":"Provider"}},{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"inference","title":"Category"}},{"name":"range","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":"last_30_days","title":"Range"}},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start"}},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End"}},{"name":"resolution","in":"query","required":false,"schema":{"type":"string","default":"day","title":"Resolution"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SummaryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/billing/timeseries":{"get":{"tags":["Admin Billing Analytics"],"summary":"Get Timeseries","operationId":"get_timeseries_api_admin_analytics_billing_timeseries_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"provider","in":"query","required":false,"schema":{"type":"string","default":"all","title":"Provider"}},{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"inference","title":"Category"}},{"name":"range","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":"last_30_days","title":"Range"}},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start"}},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End"}},{"name":"resolution","in":"query","required":false,"schema":{"type":"string","default":"day","title":"Resolution"}},{"name":"group_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Group By"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TimeseriesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/billing/providers":{"get":{"tags":["Admin Billing Analytics"],"summary":"Get Providers","operationId":"get_providers_api_admin_analytics_billing_providers_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"inference","title":"Category"}},{"name":"range","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":"last_30_days","title":"Range"}},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start"}},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End"}},{"name":"resolution","in":"query","required":false,"schema":{"type":"string","default":"day","title":"Resolution"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvidersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/billing/breakdown":{"get":{"tags":["Admin Billing Analytics"],"summary":"Get Breakdown","operationId":"get_breakdown_api_admin_analytics_billing_breakdown_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"group_by","in":"query","required":false,"schema":{"type":"string","default":"provider","title":"Group By"}},{"name":"provider","in":"query","required":false,"schema":{"type":"string","default":"all","title":"Provider"}},{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"inference","title":"Category"}},{"name":"range","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":"last_30_days","title":"Range"}},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start"}},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End"}},{"name":"resolution","in":"query","required":false,"schema":{"type":"string","default":"day","title":"Resolution"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BreakdownResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/billing/table":{"get":{"tags":["Admin Billing Analytics"],"summary":"Get Table","operationId":"get_table_api_admin_analytics_billing_table_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"provider","in":"query","required":false,"schema":{"type":"string","default":"all","title":"Provider"}},{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"inference","title":"Category"}},{"name":"range","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":"last_30_days","title":"Range"}},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start"}},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End"}},{"name":"resolution","in":"query","required":false,"schema":{"type":"string","default":"day","title":"Resolution"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Page Size"}},{"name":"sort","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":"cost","title":"Sort"}},{"name":"sort_dir","in":"query","required":false,"schema":{"type":"string","default":"desc","title":"Sort Dir"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TableResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/billing/export":{"get":{"tags":["Admin Billing Analytics"],"summary":"Export Csv","operationId":"export_csv_api_admin_analytics_billing_export_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"provider","in":"query","required":false,"schema":{"type":"string","default":"all","title":"Provider"}},{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"inference","title":"Category"}},{"name":"range","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":"last_30_days","title":"Range"}},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start"}},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End"}},{"name":"resolution","in":"query","required":false,"schema":{"type":"string","default":"day","title":"Resolution"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/billing/ai":{"post":{"tags":["Admin Billing Analytics"],"summary":"Billing Ai","description":"Reserved for the AI Analytics Assistant phase (not yet implemented).","operationId":"billing_ai_api_admin_analytics_billing_ai_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/admin/credits/user":{"get":{"tags":["Admin Credits"],"summary":"Get User Credits","description":"One user's balance, spend, and recent grants (admin drill-down).","operationId":"get_user_credits_api_admin_credits_user_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"username","in":"query","required":true,"schema":{"type":"string","title":"Username"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserCreditsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/credits/grants":{"post":{"tags":["Admin Credits"],"summary":"Grant Credits","description":"Grant credits to a user (audited via created_by).","operationId":"grant_credits_api_admin_credits_grants_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantCreditsRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserCreditsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/admin/credits/rates":{"get":{"tags":["Admin Credits"],"summary":"Get Rates","description":"Full rate card including the updated_by audit field.","operationId":"get_rates_api_admin_credits_rates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RatesResponse"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"put":{"tags":["Admin Credits"],"summary":"Update Rates","description":"Tune usage rates. Affects FUTURE usage only (cost is snapshotted).","operationId":"update_rates_api_admin_credits_rates_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RatesUpdateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RatesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/admin/google-analytics/properties":{"get":{"tags":["Admin Google Analytics"],"summary":"List Properties","operationId":"list_properties_api_admin_google_analytics_properties_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PropertiesListResponse"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/admin/google-analytics/overview":{"get":{"tags":["Admin Google Analytics"],"summary":"Get Overview","operationId":"get_overview_api_admin_google_analytics_overview_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"property_id","in":"query","required":true,"schema":{"type":"string","title":"Property Id"}},{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PropertyOverviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/google-analytics/refresh":{"post":{"tags":["Admin Google Analytics"],"summary":"Refresh Overview","operationId":"refresh_overview_api_admin_google_analytics_refresh_post","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"property_id","in":"query","required":true,"schema":{"type":"string","title":"Property Id"}},{"name":"time_range","in":"query","required":false,"schema":{"type":"string","default":"7d","title":"Time Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PropertyOverviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/{full_path}":{"get":{"tags":["Dashboard"],"summary":"Serve Spa","description":"Serve the React Single Page Application.\nAny route not matched by other API routers will fall back to this,\nreturning index.html so React Router can handle the routing.","operationId":"serve_spa__full_path__get","parameters":[{"name":"full_path","in":"path","required":true,"schema":{"type":"string","title":"Full Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ASRLanguage":{"type":"string","enum":["ach","afr","aka","amh","bam","bem","ber","cgg","dag","dga","eng","ewe","fra","ful","hau","ibo","kab","kau","kik","kin","kln","koo","kpo","led","lgg","lin","lth","lug","luo","luy","mlg","myx","nbl","nya","nyn","orm","pcm","ruc","rwm","sna","som","sot","swa","teo","tsn","ttj","wol","xho","xog","yor","zul"],"title":"ASRLanguage","description":"Languages supported by the Sunbird 51-African-language ASR model.\n\nValues are the ISO 639-3 codes accepted by\n`Sunbird/faster-whisper-51-african-languages` and are passed through\nverbatim to the deployment.\n\nThe fine-tune reuses Whisper's built-in language-token slots for African\nlanguages, which makes automatic language detection meaningless — a\nlanguage must always be supplied explicitly."},"AccountPauseEntry":{"properties":{"id":{"type":"integer","title":"Id"},"paused_by":{"type":"string","title":"Paused By"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"paused_at":{"type":"string","format":"date-time","title":"Paused At"},"paused_until":{"type":"string","format":"date-time","title":"Paused Until"},"lifted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lifted At"},"lifted_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lifted By"},"is_active":{"type":"boolean","title":"Is Active"}},"type":"object","required":["id","paused_by","paused_at","paused_until","is_active"],"title":"AccountPauseEntry","description":"One row of a user's pause history (admin view)."},"AccountType":{"type":"string","enum":["Free","Premium","Admin","Suspended"],"title":"AccountType"},"AccountTypeUpdateRequest":{"properties":{"account_type":{"$ref":"#/components/schemas/AssignableAccountType"}},"type":"object","required":["account_type"],"title":"AccountTypeUpdateRequest"},"AdminUserCreditsResponse":{"properties":{"username":{"type":"string","title":"Username"},"overview":{"$ref":"#/components/schemas/BillingOverviewResponse"},"transactions":{"items":{"$ref":"#/components/schemas/CreditTransactionItem"},"type":"array","title":"Transactions"}},"type":"object","required":["username","overview","transactions"],"title":"AdminUserCreditsResponse"},"AssignableAccountType":{"type":"string","enum":["Free","Premium"],"title":"AssignableAccountType","description":"Account types an admin may assign from the dashboard.\n\n\"Admin\" is deliberately absent: promoting a user to Admin stays a\ndeliberate out-of-band action, never a dropdown click."},"AudioDetectedLanguageResponse":{"properties":{"detected_language":{"type":"string","title":"Detected Language","description":"The detected language code from the audio"}},"type":"object","required":["detected_language"],"title":"AudioDetectedLanguageResponse","description":"Language detected in the submitted audio."},"AudioUsage":{"properties":{"type":{"type":"string","enum":["duration","tokens"],"title":"Type","description":"Which usage variant this object carries","default":"duration"},"seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Seconds","description":"Duration of the transcribed audio in seconds"},"input_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Input Tokens","description":"Input tokens, when the ASR backend reports them"},"output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Output Tokens","description":"Output tokens, when the ASR backend reports them"},"total_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Tokens","description":"Total tokens, when the ASR backend reports them"}},"type":"object","title":"AudioUsage","description":"Usage for speech-to-text requests (OpenAI transcription shape)."},"BackfillVerificationRequest":{"properties":{"batch_size":{"type":"integer","maximum":200.0,"minimum":1.0,"title":"Batch Size","default":90},"resend_before":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resend Before"}},"type":"object","title":"BackfillVerificationRequest"},"BackfillVerificationResponse":{"properties":{"sent":{"type":"integer","title":"Sent"},"failed":{"type":"integer","title":"Failed"},"remaining_unverified":{"type":"integer","title":"Remaining Unverified"}},"type":"object","required":["sent","failed","remaining_unverified"],"title":"BackfillVerificationResponse"},"BillingHistoryResponse":{"properties":{"time_range":{"type":"string","title":"Time Range"},"start":{"type":"string","title":"Start"},"end":{"type":"string","title":"End"},"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"total_cost":{"items":{"type":"number"},"type":"array","title":"Total Cost"},"translation":{"items":{"type":"number"},"type":"array","title":"Translation"},"chat_completion":{"items":{"type":"number"},"type":"array","title":"Chat Completion"},"stt":{"items":{"type":"number"},"type":"array","title":"Stt"},"tts":{"items":{"type":"number"},"type":"array","title":"Tts"}},"type":"object","required":["time_range","start","end","labels","total_cost","translation","chat_completion","stt","tts"],"title":"BillingHistoryResponse"},"BillingOverviewResponse":{"properties":{"balance":{"type":"number","title":"Balance"},"total_granted":{"type":"number","title":"Total Granted"},"spend_this_month":{"type":"number","title":"Spend This Month"},"currency":{"type":"string","title":"Currency","default":"USD"}},"type":"object","required":["balance","total_granted","spend_this_month"],"title":"BillingOverviewResponse"},"BillingRecord":{"properties":{"provider":{"type":"string","enum":["runpod","modal","vastai","aws"],"title":"Provider"},"object_id":{"type":"string","title":"Object Id"},"object_name":{"type":"string","title":"Object Name"},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"cost":{"type":"number","title":"Cost"},"runtime_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Runtime Ms"},"storage_gb":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Storage Gb"},"gpu":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gpu"},"environment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Environment"},"tags":{"additionalProperties":{"type":"string"},"type":"object","title":"Tags"},"resource_breakdown":{"additionalProperties":{"type":"number"},"type":"object","title":"Resource Breakdown"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"}},"type":"object","required":["provider","object_id","object_name","timestamp","cost"],"title":"BillingRecord","description":"One normalized billing bucket-row from a provider."},"Body_auto_detect_audio_language_tasks_auto_detect_audio_language_post":{"properties":{"audio":{"type":"string","format":"binary","title":"Audio","description":"Audio file to analyse"}},"type":"object","required":["audio"],"title":"Body_auto_detect_audio_language_tasks_auto_detect_audio_language_post"},"Body_create_transcription_tasks_audio_transcriptions_post":{"properties":{"audio":{"type":"string","format":"binary","title":"Audio","description":"Audio file to transcribe."},"language":{"$ref":"#/components/schemas/ASRLanguage","description":"Language of the audio (ISO 639-3). Required: this model reuses Whisper's language-token slots, so auto-detection is unreliable."},"timestamps":{"type":"boolean","title":"Timestamps","description":"Return per-segment start/end timestamps in 'segments'.","default":false}},"type":"object","required":["audio","language"],"title":"Body_create_transcription_tasks_audio_transcriptions_post"},"Body_login_for_access_token_auth_token_post":{"properties":{"grant_type":{"anyOf":[{"type":"string","pattern":"password"},{"type":"null"}],"title":"Grant Type"},"username":{"type":"string","title":"Username"},"password":{"type":"string","title":"Password"},"scope":{"type":"string","title":"Scope","default":""},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"},"client_secret":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Secret"}},"type":"object","required":["username","password"],"title":"Body_login_for_access_token_auth_token_post"},"Body_modal_speech_to_text_tasks_modal_stt_post":{"properties":{"audio":{"type":"string","format":"binary","title":"Audio","description":"Audio file to transcribe"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language","description":"Optional language hint for better transcriptions especially in local languages. Accepts a 3-letter ISO 639-2 code (e.g. 'eng', 'lug') or a full language name (e.g. 'english', 'luganda'). If omitted, the model auto-detects the language."}},"type":"object","required":["audio"],"title":"Body_modal_speech_to_text_tasks_modal_stt_post"},"Body_speech_to_text_org_tasks_org_stt_post":{"properties":{"audio":{"type":"string","format":"binary","title":"Audio","description":"Audio file to transcribe"},"recognise_speakers":{"type":"boolean","title":"Recognise Speakers","default":false}},"type":"object","required":["audio"],"title":"Body_speech_to_text_org_tasks_org_stt_post"},"Body_speech_to_text_tasks_stt_post":{"properties":{"audio":{"type":"string","format":"binary","title":"Audio","description":"Audio file to transcribe"},"language":{"$ref":"#/components/schemas/SttbLanguage","description":"Language of the audio","default":"lug"},"adapter":{"$ref":"#/components/schemas/SttbLanguage","description":"Language adapter to use","default":"lug"},"recognise_speakers":{"type":"boolean","title":"Recognise Speakers","description":"Enable speaker diarization","default":false},"whisper":{"type":"boolean","title":"Whisper","description":"Use the Whisper model for transcription","default":false}},"type":"object","required":["audio"],"title":"Body_speech_to_text_tasks_stt_post"},"Body_sunflower_simple_inference_tasks_sunflower_simple_post":{"properties":{"instruction":{"type":"string","title":"Instruction","description":"The instruction or question for the AI"},"model_type":{"type":"string","title":"Model Type","description":"Model type (qwen or gemma)","default":"qwen"},"temperature":{"type":"number","maximum":2.0,"minimum":0.0,"title":"Temperature","description":"Sampling temperature","default":0.3},"system_message":{"type":"string","title":"System Message","description":"Custom system message"}},"type":"object","required":["instruction"],"title":"Body_sunflower_simple_inference_tasks_sunflower_simple_post"},"BreakdownResponse":{"properties":{"group_by":{"type":"string","title":"Group By"},"rows":{"items":{"$ref":"#/components/schemas/BreakdownRow"},"type":"array","title":"Rows"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"}},"type":"object","required":["group_by","rows"],"title":"BreakdownResponse"},"BreakdownRow":{"properties":{"key":{"type":"string","title":"Key"},"cost":{"type":"number","title":"Cost"},"runtime_ms":{"type":"integer","title":"Runtime Ms"},"storage_gb":{"type":"number","title":"Storage Gb"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["key","cost","runtime_ms","storage_gb","count"],"title":"BreakdownRow"},"ChangePassword":{"properties":{"old_password":{"type":"string","title":"Old Password"},"new_password":{"type":"string","title":"New Password"}},"type":"object","required":["old_password","new_password"],"title":"ChangePassword"},"ChatCompletionChoice":{"properties":{"index":{"type":"integer","title":"Index","default":0},"message":{"$ref":"#/components/schemas/ChatCompletionResponseMessage"},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Finish Reason","default":"stop"}},"type":"object","required":["message"],"title":"ChatCompletionChoice","description":"A single completion choice."},"ChatCompletionRequest":{"properties":{"model":{"type":"string","title":"Model","description":"Model to use. Supported: sunflower-9b","default":"sunflower-9b"},"messages":{"items":{"$ref":"#/components/schemas/ChatMessage"},"type":"array","minItems":1,"title":"Messages","description":"Conversation messages"},"temperature":{"type":"number","maximum":2.0,"minimum":0.0,"title":"Temperature","description":"Sampling temperature","default":0.3},"max_tokens":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Max Tokens","description":"Maximum tokens to generate"},"top_p":{"anyOf":[{"type":"number","maximum":1.0,"exclusiveMinimum":0.0},{"type":"null"}],"title":"Top P","description":"Nucleus sampling probability"},"stop":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Stop","description":"Stop sequence(s)"},"stream":{"type":"boolean","title":"Stream","description":"Stream the response as Server-Sent Events","default":false}},"type":"object","required":["messages"],"title":"ChatCompletionRequest","description":"Request body for POST /tasks/chat/completions (OpenAI format)."},"ChatCompletionResponse":{"properties":{"id":{"type":"string","title":"Id"},"object":{"type":"string","const":"chat.completion","title":"Object","default":"chat.completion"},"created":{"type":"integer","title":"Created"},"model":{"type":"string","title":"Model"},"choices":{"items":{"$ref":"#/components/schemas/ChatCompletionChoice"},"type":"array","title":"Choices"},"usage":{"$ref":"#/components/schemas/ChatCompletionUsage"},"warning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Warning","description":"Deprecation notice when a deprecated model was requested"}},"type":"object","required":["id","created","model","choices"],"title":"ChatCompletionResponse","description":"Non-streaming response body, OpenAI `chat.completion` object."},"ChatCompletionResponseMessage":{"properties":{"role":{"type":"string","const":"assistant","title":"Role","default":"assistant"},"content":{"type":"string","title":"Content"}},"type":"object","required":["content"],"title":"ChatCompletionResponseMessage","description":"The assistant message inside a completion choice."},"ChatCompletionUsage":{"properties":{"prompt_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Prompt Tokens"},"completion_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completion Tokens"},"total_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Tokens"}},"type":"object","title":"ChatCompletionUsage","description":"Token usage statistics, OpenAI field names."},"ChatMessage":{"properties":{"role":{"type":"string","enum":["system","user","assistant"],"title":"Role","description":"Message role"},"content":{"type":"string","title":"Content","description":"Message content"}},"type":"object","required":["role","content"],"title":"ChatMessage","description":"A single message in the conversation, OpenAI format."},"CreditTransactionItem":{"properties":{"id":{"type":"integer","title":"Id"},"amount":{"type":"number","title":"Amount"},"transaction_type":{"type":"string","title":"Transaction Type"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","amount","transaction_type","created_at"],"title":"CreditTransactionItem"},"EventRow":{"properties":{"name":{"type":"string","title":"Name"},"count":{"type":"integer","title":"Count"},"users":{"type":"integer","title":"Users"}},"type":"object","required":["name","count","users"],"title":"EventRow"},"ForgotPassword":{"properties":{"email":{"type":"string","format":"email","title":"Email"}},"type":"object","required":["email"],"title":"ForgotPassword"},"GeoRow":{"properties":{"country":{"type":"string","title":"Country"},"city":{"type":"string","title":"City"},"users":{"type":"integer","title":"Users"},"sessions":{"type":"integer","title":"Sessions"}},"type":"object","required":["country","city","users","sessions"],"title":"GeoRow"},"GpuSpendEndpoint":{"properties":{"endpoint_id":{"type":"string","title":"Endpoint Id"},"label":{"type":"string","title":"Label"},"service":{"type":"string","title":"Service"},"attributed_usd":{"type":"number","title":"Attributed Usd"},"metered_usd":{"type":"number","title":"Metered Usd"},"endpoint_bill_usd":{"type":"number","title":"Endpoint Bill Usd"},"active_bill_usd":{"type":"number","title":"Active Bill Usd"},"share_of_bill":{"type":"number","title":"Share Of Bill"},"work_ms":{"type":"number","title":"Work Ms"}},"type":"object","required":["endpoint_id","label","service","attributed_usd","metered_usd","endpoint_bill_usd","active_bill_usd","share_of_bill","work_ms"],"title":"GpuSpendEndpoint"},"GpuSpendResponse":{"properties":{"time_range":{"type":"string","title":"Time Range"},"start":{"type":"string","title":"Start"},"end":{"type":"string","title":"End"},"granularity":{"type":"string","title":"Granularity"},"buckets":{"type":"integer","title":"Buckets"},"metered_available":{"type":"boolean","title":"Metered Available"},"attributed_usd":{"type":"number","title":"Attributed Usd"},"metered_usd":{"type":"number","title":"Metered Usd"},"endpoints":{"items":{"$ref":"#/components/schemas/GpuSpendEndpoint"},"type":"array","title":"Endpoints"},"timeseries":{"$ref":"#/components/schemas/GpuSpendTimeseries"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"}},"type":"object","required":["time_range","start","end","granularity","buckets","metered_available","attributed_usd","metered_usd","endpoints","timeseries"],"title":"GpuSpendResponse"},"GpuSpendTimeseries":{"properties":{"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"attributed_usd":{"items":{"type":"number"},"type":"array","title":"Attributed Usd"},"metered_usd":{"items":{"type":"number"},"type":"array","title":"Metered Usd"}},"type":"object","required":["labels","attributed_usd","metered_usd"],"title":"GpuSpendTimeseries"},"GrantCreditsRequest":{"properties":{"username":{"type":"string","minLength":1,"title":"Username"},"amount":{"anyOf":[{"type":"number","maximum":10000.0,"exclusiveMinimum":0.0},{"type":"string"}],"title":"Amount"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description"}},"type":"object","required":["username","amount"],"title":"GrantCreditsRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HighestCost":{"properties":{"name":{"type":"string","title":"Name"},"cost":{"type":"number","title":"Cost"}},"type":"object","required":["name","cost"],"title":"HighestCost"},"LanguageIdRequest":{"properties":{"text":{"type":"string","maxLength":200,"minLength":3,"title":"Text","description":"The text to identify the language of"}},"type":"object","required":["text"],"title":"LanguageIdRequest","description":"Text to identify the language of."},"LanguageIdResponse":{"properties":{"language":{"type":"string","title":"Language","description":"The identified language code"},"confidence":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Confidence","description":"Model confidence in the identified language, 0-1. Omitted when the model does not report one. Callers wanting a stricter bar than the server's own threshold can filter on this."}},"type":"object","required":["language"],"title":"LanguageIdResponse","description":"Identified language of the submitted text."},"OAuthType":{"type":"string","enum":["Credentials","Google","GitHub"],"title":"OAuthType"},"PauseDurationUnit":{"type":"string","enum":["hours","days","weeks"],"title":"PauseDurationUnit"},"PauseUserRequest":{"properties":{"duration_value":{"type":"integer","minimum":1.0,"title":"Duration Value"},"duration_unit":{"$ref":"#/components/schemas/PauseDurationUnit","default":"hours"},"reason":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Reason"}},"type":"object","required":["duration_value"],"title":"PauseUserRequest","description":"Pause an account for ``duration_value`` hours, days or weeks."},"PlatformRow":{"properties":{"label":{"type":"string","title":"Label"},"users":{"type":"integer","title":"Users"},"sessions":{"type":"integer","title":"Sessions"}},"type":"object","required":["label","users","sessions"],"title":"PlatformRow"},"PlatformsBreakdown":{"properties":{"device":{"items":{"$ref":"#/components/schemas/PlatformRow"},"type":"array","title":"Device"},"os":{"items":{"$ref":"#/components/schemas/PlatformRow"},"type":"array","title":"Os"},"browser":{"items":{"$ref":"#/components/schemas/PlatformRow"},"type":"array","title":"Browser"}},"type":"object","required":["device","os","browser"],"title":"PlatformsBreakdown"},"ProfileCompletionStatus":{"properties":{"is_complete":{"type":"boolean","title":"Is Complete"},"missing_fields":{"items":{"type":"string"},"type":"array","title":"Missing Fields"}},"type":"object","required":["is_complete","missing_fields"],"title":"ProfileCompletionStatus"},"ProfileUpdate":{"properties":{"full_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Name"},"organization":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Organization"},"organization_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Organization Type"},"sector":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Sector"}},"type":"object","title":"ProfileUpdate"},"PropertiesListResponse":{"properties":{"properties":{"items":{"$ref":"#/components/schemas/PropertyInfo"},"type":"array","title":"Properties"}},"type":"object","required":["properties"],"title":"PropertiesListResponse"},"PropertyInfo":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"}},"type":"object","required":["id","name"],"title":"PropertyInfo"},"PropertyOverviewResponse":{"properties":{"property_id":{"type":"string","title":"Property Id"},"property_name":{"type":"string","title":"Property Name"},"time_range":{"type":"string","title":"Time Range"},"cached_until":{"type":"string","title":"Cached Until","description":"ISO-8601 timestamp when the oldest cached report expires."},"traffic":{"$ref":"#/components/schemas/TrafficTimeSeries"},"top_pages":{"items":{"$ref":"#/components/schemas/TopPageRow"},"type":"array","title":"Top Pages"},"platforms":{"$ref":"#/components/schemas/PlatformsBreakdown"},"geography":{"items":{"$ref":"#/components/schemas/GeoRow"},"type":"array","title":"Geography"},"events":{"items":{"$ref":"#/components/schemas/EventRow"},"type":"array","title":"Events"},"partial":{"type":"boolean","title":"Partial","default":false},"failed_reports":{"items":{"type":"string"},"type":"array","title":"Failed Reports"}},"type":"object","required":["property_id","property_name","time_range","cached_until","traffic","top_pages","platforms","geography","events"],"title":"PropertyOverviewResponse"},"ProvidersResponse":{"properties":{"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"cost":{"items":{"type":"number"},"type":"array","title":"Cost"},"runtime_ms":{"items":{"type":"number"},"type":"array","title":"Runtime Ms"},"storage_gb":{"items":{"type":"number"},"type":"array","title":"Storage Gb"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"}},"type":"object","required":["labels","cost","runtime_ms","storage_gb"],"title":"ProvidersResponse"},"RateItem":{"properties":{"task_type":{"type":"string","title":"Task Type"},"unit_size":{"type":"integer","title":"Unit Size"},"rate_usd":{"type":"number","title":"Rate Usd"},"updated_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["task_type","unit_size","rate_usd"],"title":"RateItem"},"RateUpdateItem":{"properties":{"task_type":{"type":"string","minLength":1,"title":"Task Type"},"rate_usd":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string"}],"title":"Rate Usd"}},"type":"object","required":["task_type","rate_usd"],"title":"RateUpdateItem"},"RatesResponse":{"properties":{"rates":{"items":{"$ref":"#/components/schemas/RateItem"},"type":"array","title":"Rates"}},"type":"object","required":["rates"],"title":"RatesResponse"},"RatesUpdateRequest":{"properties":{"rates":{"items":{"$ref":"#/components/schemas/RateUpdateItem"},"type":"array","minItems":1,"title":"Rates"}},"type":"object","required":["rates"],"title":"RatesUpdateRequest"},"RefreshedUrlResponse":{"properties":{"audio_url":{"type":"string","title":"Audio Url","description":"Freshly signed URL to the stored audio."},"audio_url_expires_at":{"type":"string","format":"date-time","title":"Audio Url Expires At","description":"When the new signed URL expires."},"gcs_object":{"type":"string","title":"Gcs Object","description":"The GCS object that was re-signed."}},"type":"object","required":["audio_url","audio_url_expires_at","gcs_object"],"title":"RefreshedUrlResponse","description":"Response for GET /tasks/audio/speech/url (a re-signed audio URL)."},"ResendVerificationResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"ResendVerificationResponse"},"ResetPassword":{"properties":{"token":{"type":"string","title":"Token"},"new_password":{"type":"string","title":"New Password"}},"type":"object","required":["token","new_password"],"title":"ResetPassword"},"STTTranscript":{"properties":{"audio_transcription":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Audio Transcription","description":"The transcribed text from the audio"},"diarization_output":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Diarization Output","description":"Speaker diarization data"},"formatted_diarization_output":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Formatted Diarization Output","description":"Human-readable diarization output"},"audio_transcription_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Audio Transcription Id","description":"Database ID of the saved transcription"},"audio_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Audio Url","description":"URL or path to the processed audio file"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language","description":"The language code used for transcription"},"was_audio_trimmed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Was Audio Trimmed","description":"Whether the audio was trimmed to max duration","default":false},"original_duration_minutes":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Original Duration Minutes","description":"Original duration in minutes if audio was trimmed"},"segments":{"anyOf":[{"items":{"$ref":"#/components/schemas/TranscriptionSegment"},"type":"array"},{"type":"null"}],"title":"Segments","description":"Timestamped segments. Only populated when the request sets timestamps=true"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration Seconds","description":"Duration of the transcribed audio in seconds"},"usage":{"anyOf":[{"$ref":"#/components/schemas/AudioUsage"},{"type":"null"}],"description":"Usage for this transcription (audio duration in seconds)"}},"type":"object","title":"STTTranscript","description":"Result of a speech-to-text request: transcribed text, optional diarization and timestamps, and metadata."},"SpeechBatchItem":{"properties":{"text":{"type":"string","minLength":1,"title":"Text","description":"Text to synthesize."},"voice":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice","description":"Speaker name (see GET /tasks/voice/speakers); requires `language`. If omitted, a speaker is chosen for `language` (Luganda by default). Legacy speaker ids are still accepted with a deprecation warning."},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language","description":"orpheus ISO 639-3 code (e.g. 'lug')."},"temperature":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Temperature"},"top_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top P"},"repetition_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Repetition Penalty"},"max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Tokens"},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed"}},"type":"object","required":["text"],"title":"SpeechBatchItem","description":"One item in a batch speech request (sunbird-orpheus-tts only).","example":{"language":"eng","max_tokens":1200,"repetition_penalty":1.1,"seed":42,"temperature":0.6,"text":"I am a nurse who takes care of many people.","top_p":0.95,"voice":"Grace"}},"SpeechBatchItemResponse":{"properties":{"index":{"type":"integer","title":"Index","description":"Zero-based position in the request's items."},"status":{"type":"string","enum":["ok","error"],"title":"Status","description":"'ok' if this item synthesized, 'error' if it failed."},"voice":{"type":"string","title":"Voice","description":"Speaker name actually served for this item."},"audio_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Audio Url"},"audio_url_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Audio Url Expires At"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language"},"sample_rate":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sample Rate"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration Seconds"},"audio_size_bytes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Audio Size Bytes"},"gcs_object":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gcs Object"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Id"},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code","description":"Machine-readable failure code (error items only)."},"error_detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Detail","description":"Human-readable failure detail (error items only)."}},"type":"object","required":["index","status","voice"],"title":"SpeechBatchItemResponse","description":"Per-item batch result (mirrors SpeechResponse + status/error)."},"SpeechBatchRequest":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SpeechBatchItem"},"type":"array","maxItems":16,"minItems":1,"title":"Items","description":"1-16 items (one RunPod job each)."}},"type":"object","required":["items"],"title":"SpeechBatchRequest","description":"Batch TTS request (RunPod Orpheus-3B)."},"SpeechBatchResponse":{"properties":{"model":{"type":"string","title":"Model","description":"Model used (always 'sunbird-orpheus-tts')."},"platform":{"type":"string","title":"Platform","description":"Platform used (always 'runpod')."},"results":{"items":{"$ref":"#/components/schemas/SpeechBatchItemResponse"},"type":"array","title":"Results","description":"Per-item results, in request order."},"request_id":{"type":"string","title":"Request Id","description":"Unique id for this batch request."},"timings_ms":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Timings Ms"},"warnings":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Warnings","description":"Deprecation notices, one per item that passed a legacy speaker id (prefixed 'item index N:'). Absent when none."}},"type":"object","required":["model","platform","results","request_id"],"title":"SpeechBatchResponse","description":"Normalized batch response."},"SpeechRequest":{"properties":{"text":{"type":"string","minLength":1,"title":"Text","description":"Text to synthesize."},"voice":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice","description":"Speaker name (see GET /tasks/voice/speakers); requires `language`, since names are scoped per language. If omitted, a speaker is chosen for `language` (Luganda by default). Legacy speaker ids (e.g. 'salt_lug_0001') are still accepted with a deprecation warning."},"response_mode":{"$ref":"#/components/schemas/TTSResponseMode","description":"url (signed GCS URL), stream (raw audio bytes from RunPod), or both (raw audio bytes with the signed URL in the X-Audio-Url header).","default":"url"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language","description":"ISO 639-3 code (e.g. 'lug')."},"temperature":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Temperature","description":"Sampling knob."},"top_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top P","description":"Sampling knob."},"repetition_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Repetition Penalty","description":"Sampling knob."},"max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Tokens","description":"Max tokens per chunk."},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed","description":"Deterministic seed."}},"type":"object","required":["text"],"title":"SpeechRequest","description":"Text-to-speech request for the RunPod Orpheus-3B endpoint.","example":{"language":"eng","max_tokens":1200,"repetition_penalty":1.1,"response_mode":"url","seed":42,"temperature":0.6,"text":"I am a nurse who takes care of many people.","top_p":0.95,"voice":"Grace"}},"SpeechResponse":{"properties":{"audio_url":{"type":"string","title":"Audio Url","description":"Signed URL to the generated audio."},"model":{"type":"string","title":"Model","description":"Model used."},"platform":{"type":"string","title":"Platform","description":"Platform used."},"voice":{"type":"string","title":"Voice","description":"Speaker name actually served."},"audio_url_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Audio Url Expires At"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language"},"sample_rate":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sample Rate"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration Seconds"},"gcs_object":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gcs Object"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Id"},"timings_ms":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Timings Ms"},"usage":{"anyOf":[{"$ref":"#/components/schemas/SpeechUsage"},{"type":"null"}],"description":"Usage for this synthesis (characters, bytes, seconds)."},"warnings":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Warnings","description":"Deprecation notices for this request (e.g. a legacy speaker id was passed as `voice`). Absent when there is nothing to warn about."}},"type":"object","required":["audio_url","model","platform","voice"],"title":"SpeechResponse","description":"Normalized response for response_mode='url' across all providers."},"SpeechUsage":{"properties":{"input_characters":{"type":"integer","title":"Input Characters","description":"Number of characters in the synthesized text"},"output_audio_bytes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Output Audio Bytes","description":"Size of the generated audio in bytes"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration Seconds","description":"Duration of the generated audio in seconds"}},"type":"object","required":["input_characters"],"title":"SpeechUsage","description":"Usage for text-to-speech requests (character-count convention)."},"SttCapabilityUsage":{"properties":{"requests":{"type":"integer","title":"Requests"},"audio_seconds":{"type":"number","title":"Audio Seconds"},"avg_seconds_per_request":{"type":"number","title":"Avg Seconds Per Request"},"models":{"items":{"$ref":"#/components/schemas/SttModelUsage"},"type":"array","title":"Models"},"languages":{"items":{"$ref":"#/components/schemas/SttLanguageUsage"},"type":"array","title":"Languages"},"timeseries":{"$ref":"#/components/schemas/SttTimeseries"}},"type":"object","required":["requests","audio_seconds","avg_seconds_per_request","models","timeseries"],"title":"SttCapabilityUsage"},"SttLanguageUsage":{"properties":{"language":{"type":"string","title":"Language"},"requests":{"type":"integer","title":"Requests"},"audio_seconds":{"type":"number","title":"Audio Seconds"}},"type":"object","required":["language","requests","audio_seconds"],"title":"SttLanguageUsage"},"SttModelUsage":{"properties":{"model":{"type":"string","title":"Model"},"requests":{"type":"integer","title":"Requests"},"audio_seconds":{"type":"number","title":"Audio Seconds"}},"type":"object","required":["model","requests","audio_seconds"],"title":"SttModelUsage"},"SttTimeseries":{"properties":{"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"requests":{"items":{"type":"integer"},"type":"array","title":"Requests"},"audio_seconds":{"items":{"type":"number"},"type":"array","title":"Audio Seconds"}},"type":"object","required":["labels","requests","audio_seconds"],"title":"SttTimeseries"},"SttbLanguage":{"type":"string","enum":["ach","teo","eng","lug","lgg","nyn","swa","kin","xog","myx"],"title":"SttbLanguage","description":"ISO 639-3 language codes supported by the legacy STT endpoints."},"SummarisationRequest":{"properties":{"text":{"type":"string","title":"Text"}},"type":"object","required":["text"],"title":"SummarisationRequest"},"SummarisationResponse":{"properties":{"summarized_text":{"type":"string","title":"Summarized Text"}},"type":"object","required":["summarized_text"],"title":"SummarisationResponse"},"SummaryResponse":{"properties":{"start":{"type":"string","title":"Start"},"end":{"type":"string","title":"End"},"total_spend":{"type":"number","title":"Total Spend"},"runtime_available":{"type":"boolean","title":"Runtime Available"},"storage_available":{"type":"boolean","title":"Storage Available"},"avg_daily_spend":{"type":"number","title":"Avg Daily Spend"},"total_runtime_ms":{"type":"integer","title":"Total Runtime Ms"},"avg_daily_runtime_ms":{"type":"number","title":"Avg Daily Runtime Ms"},"total_storage_gb":{"type":"number","title":"Total Storage Gb"},"avg_storage_gb":{"type":"number","title":"Avg Storage Gb"},"active_endpoints":{"type":"integer","title":"Active Endpoints"},"active_modal_apps":{"type":"integer","title":"Active Modal Apps"},"active_instances":{"type":"integer","title":"Active Instances","default":0},"active_services":{"type":"integer","title":"Active Services","default":0},"highest_cost_endpoint":{"anyOf":[{"$ref":"#/components/schemas/HighestCost"},{"type":"null"}]},"highest_cost_platform":{"anyOf":[{"$ref":"#/components/schemas/HighestCost"},{"type":"null"}]},"num_days":{"type":"integer","title":"Num Days"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"}},"type":"object","required":["start","end","total_spend","runtime_available","storage_available","avg_daily_spend","total_runtime_ms","avg_daily_runtime_ms","total_storage_gb","avg_storage_gb","active_endpoints","active_modal_apps","num_days"],"title":"SummaryResponse"},"SunflowerChatMessage":{"properties":{"role":{"type":"string","title":"Role","description":"Message role: 'system', 'user', or 'assistant'"},"content":{"type":"string","title":"Content","description":"Message content"}},"type":"object","required":["role","content"],"title":"SunflowerChatMessage","description":"A single message in the chat conversation."},"SunflowerChatRequest":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/SunflowerChatMessage"},"type":"array","title":"Messages","description":"List of conversation messages"},"model_type":{"type":"string","title":"Model Type","description":"Model type: 'qwen'","default":"qwen"},"temperature":{"type":"number","maximum":2.0,"minimum":0.0,"title":"Temperature","description":"Sampling temperature","default":0.3},"stream":{"type":"boolean","title":"Stream","description":"Whether to stream the response","default":false},"system_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Message","description":"Custom system message"}},"type":"object","required":["messages"],"title":"SunflowerChatRequest","description":"Request body for Sunflower chat inference."},"SunflowerChatResponse":{"properties":{"content":{"type":"string","title":"Content","description":"The AI's response"},"model_type":{"type":"string","title":"Model Type","description":"Model used for inference"},"usage":{"$ref":"#/components/schemas/SunflowerUsageStats","description":"Token usage statistics"},"processing_time":{"type":"number","title":"Processing Time","description":"Total processing time in seconds"},"inference_time":{"type":"number","title":"Inference Time","description":"Model inference time in seconds","default":0.0},"message_count":{"type":"integer","title":"Message Count","description":"Number of messages processed","default":0}},"type":"object","required":["content","model_type","usage","processing_time"],"title":"SunflowerChatResponse","description":"Response from Sunflower chat inference."},"SunflowerTranslationRequest":{"properties":{"source_language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Language","description":"Source language ISO code or full name (optional; auto-detected when omitted)"},"target_language":{"type":"string","title":"Target Language","description":"Target language ISO code or full name"},"text":{"type":"string","minLength":1,"title":"Text","description":"The text to translate"}},"type":"object","required":["target_language","text"],"title":"SunflowerTranslationRequest","description":"Request body for Sunflower-backed text translation.\n\nLanguages may be given as ISO 639-3 codes (e.g. `lug`) or full names\n(e.g. `Luganda`), case-insensitively. Unsupported languages are rejected\nwith a `400` that lists the supported set."},"SunflowerUsageStats":{"properties":{"completion_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completion Tokens","description":"Number of tokens in the completion"},"prompt_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Prompt Tokens","description":"Number of tokens in the prompt"},"total_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Tokens","description":"Total number of tokens used"}},"type":"object","title":"SunflowerUsageStats","description":"Token usage statistics from the inference."},"SuspendUserRequest":{"properties":{"reason":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Reason"}},"type":"object","title":"SuspendUserRequest"},"TTSResponseMode":{"type":"string","enum":["url","stream","both"],"title":"TTSResponseMode","description":"How the TTS endpoint returns audio.\n\n- `url` — return a signed URL once generation completes\n- `stream` — stream audio chunks directly to the client\n- `both` — stream audio chunks and return a signed URL at the end"},"TableResponse":{"properties":{"rows":{"items":{"$ref":"#/components/schemas/BillingRecord"},"type":"array","title":"Rows"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"}},"type":"object","required":["rows","total","page","page_size"],"title":"TableResponse"},"TimeseriesResponse":{"properties":{"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"cost":{"items":{"type":"number"},"type":"array","title":"Cost"},"runtime_ms":{"items":{"type":"number"},"type":"array","title":"Runtime Ms"},"storage_gb":{"items":{"type":"number"},"type":"array","title":"Storage Gb"},"cost_by_group":{"additionalProperties":{"items":{"type":"number"},"type":"array"},"type":"object","title":"Cost By Group"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"}},"type":"object","required":["labels","cost","runtime_ms","storage_gb"],"title":"TimeseriesResponse"},"Token":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type"}},"type":"object","required":["access_token","token_type"],"title":"Token"},"TokenCapabilityUsage":{"properties":{"requests":{"type":"integer","title":"Requests"},"prompt_tokens":{"type":"integer","title":"Prompt Tokens"},"completion_tokens":{"type":"integer","title":"Completion Tokens"},"total_tokens":{"type":"integer","title":"Total Tokens"},"models":{"items":{"$ref":"#/components/schemas/TokenModelUsage"},"type":"array","title":"Models"},"timeseries":{"$ref":"#/components/schemas/TokenTimeseries"}},"type":"object","required":["requests","prompt_tokens","completion_tokens","total_tokens","models","timeseries"],"title":"TokenCapabilityUsage"},"TokenModelUsage":{"properties":{"model":{"type":"string","title":"Model"},"requests":{"type":"integer","title":"Requests"},"total_tokens":{"type":"integer","title":"Total Tokens"}},"type":"object","required":["model","requests","total_tokens"],"title":"TokenModelUsage"},"TokenTimeseries":{"properties":{"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"requests":{"items":{"type":"integer"},"type":"array","title":"Requests"},"total_tokens":{"items":{"type":"integer"},"type":"array","title":"Total Tokens"}},"type":"object","required":["labels","requests","total_tokens"],"title":"TokenTimeseries"},"TokenUsage":{"properties":{"prompt_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Prompt Tokens","description":"Tokens in the prompt/input"},"completion_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completion Tokens","description":"Tokens in the generated completion"},"total_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Tokens","description":"Total tokens consumed"}},"type":"object","title":"TokenUsage","description":"Token usage statistics, OpenAI field names."},"TopPageRow":{"properties":{"path":{"type":"string","title":"Path"},"title":{"type":"string","title":"Title"},"views":{"type":"integer","title":"Views"},"users":{"type":"integer","title":"Users"},"avg_duration":{"type":"number","title":"Avg Duration"}},"type":"object","required":["path","title","views","users","avg_duration"],"title":"TopPageRow"},"TrafficTimeSeries":{"properties":{"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"active_users":{"items":{"type":"integer"},"type":"array","title":"Active Users"},"new_users":{"items":{"type":"integer"},"type":"array","title":"New Users"},"sessions":{"items":{"type":"integer"},"type":"array","title":"Sessions"},"engaged_sessions":{"items":{"type":"integer"},"type":"array","title":"Engaged Sessions"},"engagement_rate":{"items":{"type":"number"},"type":"array","title":"Engagement Rate"},"avg_session_duration":{"items":{"type":"number"},"type":"array","title":"Avg Session Duration"},"bounce_rate":{"items":{"type":"number"},"type":"array","title":"Bounce Rate"}},"type":"object","required":["labels","active_users","new_users","sessions","engaged_sessions","engagement_rate","avg_session_duration","bounce_rate"],"title":"TrafficTimeSeries","description":"All lists are aligned to `labels` (one entry per date)."},"TransactionsResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CreditTransactionItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["items","total","page","page_size"],"title":"TransactionsResponse"},"TranscriptionSegment":{"properties":{"start":{"type":"number","title":"Start","description":"Segment start time in seconds"},"end":{"type":"number","title":"End","description":"Segment end time in seconds"},"text":{"type":"string","title":"Text","description":"Text transcribed for this segment"}},"type":"object","required":["start","end","text"],"title":"TranscriptionSegment","description":"A single timestamped span of transcribed audio."},"TtsCapabilityUsage":{"properties":{"requests":{"type":"integer","title":"Requests"},"input_characters":{"type":"integer","title":"Input Characters"},"output_audio_bytes":{"type":"integer","title":"Output Audio Bytes"},"avg_characters_per_request":{"type":"number","title":"Avg Characters Per Request"},"avg_bytes_per_request":{"type":"number","title":"Avg Bytes Per Request"},"models":{"items":{"$ref":"#/components/schemas/TtsModelUsage"},"type":"array","title":"Models"},"languages":{"items":{"$ref":"#/components/schemas/TtsLanguageUsage"},"type":"array","title":"Languages"},"timeseries":{"$ref":"#/components/schemas/TtsTimeseries"}},"type":"object","required":["requests","input_characters","output_audio_bytes","avg_characters_per_request","avg_bytes_per_request","models","timeseries"],"title":"TtsCapabilityUsage"},"TtsLanguageUsage":{"properties":{"language":{"type":"string","title":"Language"},"requests":{"type":"integer","title":"Requests"},"input_characters":{"type":"integer","title":"Input Characters"},"output_audio_bytes":{"type":"integer","title":"Output Audio Bytes"}},"type":"object","required":["language","requests","input_characters","output_audio_bytes"],"title":"TtsLanguageUsage"},"TtsModelUsage":{"properties":{"model":{"type":"string","title":"Model"},"requests":{"type":"integer","title":"Requests"},"input_characters":{"type":"integer","title":"Input Characters"},"output_audio_bytes":{"type":"integer","title":"Output Audio Bytes"}},"type":"object","required":["model","requests","input_characters","output_audio_bytes"],"title":"TtsModelUsage"},"TtsTimeseries":{"properties":{"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"requests":{"items":{"type":"integer"},"type":"array","title":"Requests"},"input_characters":{"items":{"type":"integer"},"type":"array","title":"Input Characters"},"output_audio_bytes":{"items":{"type":"integer"},"type":"array","title":"Output Audio Bytes"}},"type":"object","required":["labels","requests","input_characters","output_audio_bytes"],"title":"TtsTimeseries"},"UploadRequest":{"properties":{"file_name":{"type":"string","maxLength":255,"minLength":1,"title":"File Name","description":"Name of the file to upload","example":"recording.wav"},"content_type":{"type":"string","maxLength":100,"minLength":1,"title":"Content Type","description":"MIME type of the file","example":"audio/wav"}},"type":"object","required":["file_name","content_type"],"title":"UploadRequest","description":"Request body for generating a signed upload URL."},"UploadResponse":{"properties":{"upload_url":{"type":"string","title":"Upload Url","description":"Pre-signed URL for direct upload to GCS"},"file_id":{"type":"string","title":"File Id","description":"Unique identifier for tracking the upload"},"expires_at":{"type":"string","format":"date-time","title":"Expires At","description":"When the upload URL expires"}},"type":"object","required":["upload_url","file_id","expires_at"],"title":"UploadResponse","description":"Signed upload URL plus the identifier and expiry of the upload."},"UsageMetricsResponse":{"properties":{"time_range":{"type":"string","title":"Time Range"},"start":{"type":"string","title":"Start"},"end":{"type":"string","title":"End"},"translation":{"$ref":"#/components/schemas/TokenCapabilityUsage"},"chat_completion":{"$ref":"#/components/schemas/TokenCapabilityUsage"},"stt":{"$ref":"#/components/schemas/SttCapabilityUsage"},"tts":{"$ref":"#/components/schemas/TtsCapabilityUsage"}},"type":"object","required":["time_range","start","end","translation","chat_completion","stt","tts"],"title":"UsageMetricsResponse"},"User":{"properties":{"username":{"type":"string","title":"Username"},"email":{"type":"string","format":"email","title":"Email"},"organization":{"type":"string","title":"Organization"},"account_type":{"$ref":"#/components/schemas/AccountType","default":"Free"},"oauth_type":{"$ref":"#/components/schemas/OAuthType","default":"Credentials"},"full_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Name"},"organization_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Organization Type"},"sector":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Sector"},"email_verified":{"type":"boolean","title":"Email Verified","default":false},"id":{"type":"integer","title":"Id"},"paused_until":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paused Until"},"pause_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pause Reason"}},"type":"object","required":["username","email","organization","id"],"title":"User"},"UserPauseStatus":{"properties":{"username":{"type":"string","title":"Username"},"account_type":{"type":"string","title":"Account Type"},"is_paused":{"type":"boolean","title":"Is Paused"},"paused_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paused At"},"paused_until":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paused Until"},"paused_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paused By"},"pause_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pause Reason"}},"type":"object","required":["username","account_type","is_paused"],"title":"UserPauseStatus","description":"Admin-facing view of a user's pause state."},"UserRegister":{"properties":{"username":{"type":"string","title":"Username"},"email":{"type":"string","format":"email","title":"Email"},"password":{"type":"string","title":"Password"},"organization":{"type":"string","title":"Organization"},"full_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Name"},"organization_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Organization Type"},"sector":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Sector"}},"type":"object","required":["username","email","password","organization"],"title":"UserRegister","description":"Public self-registration payload.\n\nDeliberately omits `account_type`, `oauth_type`, and `email_verified`:\nthose are always set server-side in the register endpoint, never taken\nfrom client input (mass-assignment / privilege-escalation guard)."},"UserSuspensionStatus":{"properties":{"username":{"type":"string","title":"Username"},"account_type":{"type":"string","title":"Account Type"},"suspended_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Suspended At"},"suspended_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Suspended By"},"suspension_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Suspension Reason"},"previous_account_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Previous Account Type"}},"type":"object","required":["username","account_type"],"title":"UserSuspensionStatus","description":"Admin-facing view of a user's suspension state."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VerificationStatsResponse":{"properties":{"unverified_users":{"type":"integer","title":"Unverified Users"},"not_yet_emailed":{"type":"integer","title":"Not Yet Emailed"}},"type":"object","required":["unverified_users","not_yet_emailed"],"title":"VerificationStatsResponse"},"WebhookResponse":{"properties":{"status":{"type":"string","title":"Status","description":"Status of the webhook processing","example":"success"},"processing_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Processing Time","description":"Time taken to process the webhook in seconds"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Additional information about the processing"}},"type":"object","required":["status"],"title":"WebhookResponse","description":"Result of processing a WhatsApp webhook event."},"WorkerTranslationOutput":{"properties":{"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text","description":"Translated text output"},"translated_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Translated Text","description":"Alternative translated text field"},"source_language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Language","description":"Source language code if returned"},"target_language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Language","description":"Target language code if returned"},"Error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message if translation failed"}},"additionalProperties":true,"type":"object","title":"WorkerTranslationOutput","description":"Output returned by the translation worker.\n\nWorkers differ in the field they use for the translated text, so both\n`text` and `translated_text` are accepted."},"WorkerTranslationResponse":{"properties":{"delayTime":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Delaytime","description":"Time spent waiting in queue (ms)"},"executionTime":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Executiontime","description":"Time spent executing the job (ms)"},"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id","description":"Unique job identifier"},"output":{"anyOf":[{"$ref":"#/components/schemas/WorkerTranslationOutput"},{"type":"null"}],"description":"The translation output data"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status","description":"Job status (e.g., COMPLETED, FAILED)"},"workerId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workerid","description":"Identifier of the worker that processed the job"},"usage":{"anyOf":[{"$ref":"#/components/schemas/TokenUsage"},{"type":"null"}],"description":"Token usage for the Sunflower translation call"}},"additionalProperties":true,"type":"object","title":"WorkerTranslationResponse","description":"Translation worker output wrapped with job-execution metadata."}},"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"/auth/token"}}}}},"tags":[{"name":"Authentication Endpoints","description":"Operations for authentication, including user registration and login. Get access tokens to use protected endpoints."},{"name":"Speech-to-Text","description":"Convert speech audio to text. The unified /tasks/audio/transcriptions endpoint is powered by Sunbird's faster-whisper ASR model covering 51 African languages. It takes an uploaded audio file plus a required ISO 639-3 language code, and optionally returns per-segment timestamps (timestamps=true). Speaker diarization and the organization workflow remain on the deprecated /tasks/stt* routes."},{"name":"Text-to-Speech","description":"Synthesize speech from text via the RunPod Orpheus-3B deployment (19 African languages, 44 named speakers; voices are per-language speaker names with gender). Endpoints: single (/tasks/audio/speech), batch up to 16 items (/tasks/audio/speech/batch), voice listing (/tasks/voice/speakers), and signed-URL refresh (/tasks/audio/speech/url). response_mode='url' returns a signed GCS URL; 'stream'/'both' return raw audio bytes."},{"name":"Translation","description":"Translate text using the sunflower-9b model. Supports 67 African languages plus English (e.g. Luganda, Acholi, Swahili, Kinyarwanda, Yoruba, Hausa, Zulu, Amharic) accepted as ISO codes or full names; source language is optional and translation works between any supported pair."},{"name":"Language","description":"Language identification and detection. Automatically detect the language of text input from supported languages."},{"name":"Chat","description":"OpenAI-compatible chat completions powered by Sunbird's Sunflower model `sunflower-9b` (default; 67 African languages plus English). `sunflower-14b` is deprecated: requests using it are served by `sunflower-9b` with a deprecation notice and it will be removed soon. The old `Sunbird/Sunflower-14B` identifier is no longer accepted — use `sunflower-9b`. Supports single instructions, multi-turn conversations, and SSE streaming."},{"name":"Upload","description":"File upload utilities. Generate signed URLs for direct client uploads to GCP Storage with security validation."},{"name":"Webhooks","description":"WhatsApp Business API webhook integration. Handle incoming messages and verify webhook endpoints for WhatsApp chatbot functionality."},{"name":"MCP Server","description":"Use this API from AI agents through the hosted Sunbird AI MCP server (Model Context Protocol) at https://mcp.sunbird.ai/mcp. It exposes translation, chat, language identification, speech-to-text and text-to-speech as 11 typed tools over Streamable HTTP, authenticated with your own Sunbird API token as a bearer token. This tag groups no HTTP operations of this API; connection details are also published under info.x-mcp-server.","externalDocs":{"description":"Sunbird AI MCP server guide","url":"https://mcp.sunbird.ai/"}},{"name":"legacy/deprecated","description":"Deprecated endpoints retained for backward compatibility. Each is superseded by a unified endpoint — see its Deprecation/Sunset/Link response headers — and will be removed after the sunset date. Do not build new integrations against these."}]}