# API reference

Source: https://docs.sociaro.com/api-reference/

Use `https://api.sociaro.com` as the origin. For an OpenAI-compatible SDK, set its base URL to `https://api.sociaro.com/v1`. Send your Sociaro key in `Authorization: Bearer <key>` on the API requests below. Public catalogues, file downloads and outgoing webhook deliveries have their own access rules, described alongside them.

[Models and balance](https://docs.sociaro.com/api-reference/#models-and-balance) · [Text, images and audio](https://docs.sociaro.com/api-reference/#text-images-and-audio) · [Jobs](https://docs.sociaro.com/api-reference/#jobs) · [Files](https://docs.sociaro.com/api-reference/#files-and-downloads) · [Provider generation APIs](https://docs.sociaro.com/api-reference/#provider-generation-apis) · [Seedance and Seedream](https://docs.sociaro.com/api-reference/#seedance-and-seedream) · [Kling libraries](https://docs.sociaro.com/api-reference/#kling-elements-and-voices)

## Models and balance

| Method and path | What it returns |
| --- | --- |
| `GET /public/model_hub` | Public model groups, capabilities and publication flags. This read-only endpoint works without a key. |
| `GET /v1/models` | Model IDs visible to your key, in the OpenAI list format. Also available at `GET /models`. |
| `GET /model/info` | Model metadata and supported parameter names. `GET /v1/model/info` serves the same format. `GET /v2/model/info` offers a paginated model-information response. |
| `GET /model_group/info` | Group-level capabilities and metadata. Pass the optional `model_group` query parameter to select a group. |
| `GET /v2/models` | Jobs models available to your key, with input schemas, supported options and pricing. |
| `GET /v1/balance` | Remaining organisation balance in USD. Running work is billed when it finishes. An exhausted balance returns HTTP 429. |

The [model directory](https://docs.sociaro.com/models/index.md) links each published model to its request fields. The [public model hub](https://api.sociaro.com/public/model_hub) and [published USD price list](https://docs.sociaro.com/prices.json) can be read without a key. For the price of a particular Jobs request, use the [estimate](https://docs.sociaro.com/api-reference/#jobs). Manage your organisation’s keys in the [console](https://my.sociaro.com/).

## Text, images and audio

Choose a model that supports the operation. The chat and Responses APIs accept different request bodies. [Chat guide](https://docs.sociaro.com/chat/index.md)

| Method and path | Input and result |
| --- | --- |
| `POST /v1/chat/completions` | Send JSON with `model` and `messages`. Read the assistant's reply from `choices`. Set `stream: true` for server-sent events. |
| `POST /v1/completions` | Send a text prompt using the legacy completions format on a compatible model. |
| `POST /v1/responses` | Send `model` and `input` using the Responses format. Read the response's `output` items. |
| `POST /v1/messages` | Send an Anthropic-format request with `model`, `messages` and `max_tokens` for a compatible model. |
| `POST /utils/token_counter` | Count tokens for the supplied model and a `prompt` or `messages`. |
| `POST /v1/messages/count_tokens` | Count the input tokens in an Anthropic-format message request for a supported model. |
| `POST /v1/images/generations` | Send JSON with a supported image model and its prompt. The response format depends on the model. |
| `POST /v1/audio/speech` | Send JSON with the speech model, `input` text and its supported voice options. The response contains the audio bytes. |
| `POST /v1/audio/transcriptions` | Send a multipart form with `model` and a binary `file`. The default response contains the transcript. |

The SDK routes for chat, completions, Responses, speech, transcription, image generation and image editing also accept their paths without the leading `/v1`. For image editing, use the endpoint on the [chosen model’s page](https://docs.sociaro.com/models/index.md). The OpenAI multipart edit interface and other model-dependent compatibility methods are listed [below](https://docs.sociaro.com/api-reference/#additional-compatibility-methods).

## Jobs

Use these methods for models listed by `GET /v2/models`. Send JSON with the model ID and its `input` object. Available output controls and optional features are listed in that model's schema. [Job lifecycle](https://docs.sociaro.com/jobs/index.md) · [Model inputs](https://docs.sociaro.com/jobs/inputs/index.md) · [Failures and retries](https://docs.sociaro.com/jobs/failures/index.md)

| Method and path | What it does |
| --- | --- |
| `POST /v2/jobs/estimate` | Quote a proposed request. Read `estimated_cost_usd` and `estimate_kind`. This creates no job and incurs no charge. |
| `POST /v2/jobs` | Submit the request with a required `Idempotency-Key` header. Keep the returned job ID and reuse the same idempotency key if retrying the same submission. |
| `GET /v2/jobs/{job_id}` | Read the job's state and final outputs or error. While it runs, observe `Retry-After`. |
| `GET /v2/jobs?idempotency_key={key}` | Recover a single submission using the same API key and idempotency value, including after a lost submit response. |
| `POST /v2/jobs/{job_id}/cancel` | Request cancellation of a cancellable job. The returned job object shows its actual state. |
| `GET /v2/openapi.json` | Download the machine-readable Jobs and Files contract using your gateway key. |

For push delivery, set `callback_url` to a public HTTPS endpoint you control. Sociaro sends a signed **POST to your endpoint** when the job ends. Verify the signature using your organisation's webhook signing secret from the console. [Webhook headers, verification and retries](https://docs.sociaro.com/jobs/webhooks/index.md)

## Files and downloads

| Method and path | What it does |
| --- | --- |
| `POST /v2/files` | Upload raw bytes. Set the file's MIME type in `Content-Type`, optionally add `X-Filename`, then use the returned `url` in model input. |
| `GET /v2/files` | List the caller's uploads and job outputs. Filter by `source` or `job_id`. Paginate with `limit` and `after`. |
| `GET /v2/files/{file_id}` | Read a file's metadata and download URL. |
| `DELETE /v2/files/{file_id}` | Delete an upload or a job output that belongs to the caller. |
| `GET /v1/media/{media_id}` | Download the result of a provider generation using the exact `media_url` from the poll response. The opaque URL grants access until expiry. |

Download a Jobs result from the exact `outputs[].url`. Anyone holding a returned public CDN link can fetch its bytes without an API key. Keep your bearer key on the gateway origin. Older Jobs results served through an authenticated gateway media URL use that job owner's key. [File types, limits and retention](https://docs.sociaro.com/files/index.md) · [Provider result links](https://docs.sociaro.com/media/results/#results)

## Provider generation APIs

Each pair uses **POST to submit** and **GET to poll**. The model's page describes its request body. Poll with the same gateway key and the ID returned by that provider route. A poll can return HTTP 200 with a failed generation, so check the result's status. [Generation request and response formats](https://docs.sociaro.com/generations-api/index.md)

| Provider | Submit | Poll |
| --- | --- | --- |
| Alibaba | `POST /v1/alibaba/generations` | `GET /v1/alibaba/generations/{task_id}` |
| ClarityAI | `POST /v1/clarityai/generations` | `GET /v1/clarityai/generations/{task_id}` |
| Ideogram | `POST /v1/ideogram/generations` | `GET /v1/ideogram/generations/{task_id}` |
| Kling | `POST /v1/kling/generations` | `GET /v1/kling/generations/{task_id}` |
| PixVerse | `POST /v1/pixverse/generations` | `GET /v1/pixverse/generations/{task_id}` |
| Pruna | `POST /v1/pruna/generations` | `GET /v1/pruna/generations/{task_id}` |
| Recraft | `POST /v1/recraft/generations` | `GET /v1/recraft/generations/{task_id}` |
| Sand AI | `POST /v1/sand-ai/generations` | `GET /v1/sand-ai/generations/{job_id}` |
| Sonilo | `POST /v1/sonilo/generations` | `GET /v1/sonilo/generations/{task_id}` |

## Seedance and Seedream

### Seedance video

Use the BytePlus route for standard Seedance tasks. ModelArk adds reference-file preparation and requires your organisation’s reference feature. Use that same route for listing, polling or canceling it. Each list is scoped to the calling key and route and accepts `page_num` and `page_size`. [Seedance formats and examples](https://docs.sociaro.com/generations-api/native/#byteplus-and-modelark-tasks)

| Action | BytePlus | ModelArk |
| --- | --- | --- |
| Submit | `POST /v1/byteplus/contents/generations/tasks` | `POST /v1/modelark/contents/generations/tasks` |
| List | `GET /v1/byteplus/contents/generations/tasks` | `GET /v1/modelark/contents/generations/tasks` |
| Poll | `GET /v1/byteplus/contents/generations/tasks/{task_id}` | `GET /v1/modelark/contents/generations/tasks/{task_id}` |
| Cancel a queued task | `DELETE /v1/byteplus/contents/generations/tasks/{task_id}` | `DELETE /v1/modelark/contents/generations/tasks/{task_id}` |

For the [reference workflow](https://docs.sociaro.com/reference-images/index.md), use `POST /v1/generations/refs` to submit supported reference pictures, clips or sounds and `GET /v1/generations/{job_id}` to poll. Submitting through this route requires the reference feature on your organisation.

### Seedream images

| Method and path | What it does |
| --- | --- |
| `GET /v1/byteplus/models` | Discover the supported Seedance video and Seedream image models on these routes. |
| `POST /v1/byteplus/images/generations` | Generate an image synchronously on models that offer this mode. |
| `POST /v1/byteplus/images/async` | Submit a Seedream image job, including async-only models. |
| `GET /v1/byteplus/images/async/{job_id}` | Poll the submitted image job and collect its output. |

## Kling elements and voices

Create reusable subjects and voices and pass their resulting IDs to a compatible Kling generation. Creating an item returns a task ID. Listing the library returns the available items. [Request formats, presets and costs](https://docs.sociaro.com/generations-api/native/#kling-elements-and-voices)

| Action | Elements | Voices |
| --- | --- | --- |
| Create | `POST /v1/kling/elements` | `POST /v1/kling/voices` |
| Poll creation | `GET /v1/kling/elements/{task_id}` | `GET /v1/kling/voices/{task_id}` |
| List created items | `GET /v1/kling/elements` | `GET /v1/kling/voices` |
| List presets | `GET /v1/kling/elements/presets` | `GET /v1/kling/voices/presets` |

## Additional compatibility methods

These methods are exposed by the gateway for compatible deployments. Response storage and cancellation depend on model support. Choose the endpoint documented on the model’s page for production integrations.

| Method and path | When to use it |
| --- | --- |
| `GET /v1/responses/{response_id}` | Retrieve an existing stored Response where the model supports retrieval. |
| `GET /v1/responses/{response_id}/input_items` | Read the input items of a retrievable Response. |
| `DELETE /v1/responses/{response_id}` | Delete a stored Response where deletion is supported. |
| `POST /v1/responses/{response_id}/cancel` | Cancel a background Response where the model supports background generation and cancellation. |
| `POST /v1/images/edits` | OpenAI multipart image-edit format. Published models with their own edit routes use the provider endpoint on their model page. |
| `POST /v1/embeddings` | Create vectors with an embedding model. The public catalogue currently lists no embedding model. |
| `POST /v1/moderations` | Classify content with a moderation model. The public catalogue currently lists no dedicated moderation model. |
| `POST /v2/rerank` | Rerank documents with a reranking model. The public catalogue currently lists no reranking model. The proxy also accepts `POST /v1/rerank` and `POST /rerank`. |
| `GET /v1/images/async/models` | Discover models enabled for the legacy webhook image interface. An empty list means this interface has no available model. |
| `POST /v1/images/async` | For a model in that legacy list, send `model`, `prompt` and a required HTTPS `webhook`. The result is delivered to that URL. |
