What the Sunra API is
You need two things to start: a key, and money on an API balance that is not your Sunra credits. That catches people out — a full credit balance will not run a single API request. In exchange, the same call shape works for every model, so adding a new one to your product is a change of path and parameters rather than a new integration.
How it differs from Creative and MCP
Sunra has three doors onto the same models, and they are paid for differently:
| Who uses it | How it is paid for | |
|---|---|---|
| Sunra Creative | You, in the app | Credits, on a plan |
| Sunra MCP | Your AI agent, on your behalf | The same credits |
| Sunra API | Your own code | A prepaid US dollar balance, no subscription |
The API balance is separate from your credits: topping up one does not top up the other, and an API key cannot spend credits. API keys and billing covers that side.
When to use the API
Unless Sunra agrees otherwise in writing, use the API for independent production programs that repeatedly accept data or generation requests, scheduled or business-event-triggered workflows, and generation integrated into your apps, websites, bots, platforms or other software services. This applies to personal and internal use as well as customer-facing services. A manual start, or calling through an agent, MCP or CLI, does not turn a production workflow into Creative use.
A creative task you initiate in an assistant with a defined scope and end condition can use Creative MCP or CLI, including scripts and multiple outputs. See the examples and the Terms. API-key MCP remains an API connection and can be used for production workflows under the API rules.
What you can call
Image, video, audio and 3D models from OpenAI, Google, ByteDance, Kling, ElevenLabs, Black Forest Labs, xAI, Alibaba, MiniMax, Meshy and more, in one catalogue. The line-up moves constantly, so read it live rather than from any list in a document:
- In the product — Developer mode's Models page, where each model has a Playground tab to try it in the browser and an API tab with its schema and ready-made code.
- Over HTTP —
GET https://api.sunra.ai/v1/models, which needs no key. It is paged: followhas_more. - Per endpoint — a model's price card at
GET https://api.sunra.ai/v1/pricing/model/<model id>/endpoint/<endpoint>, so your code can check a price before it spends anything.
Each model is priced the way its maker prices it — per image, per second of video, per thousand characters of speech. Where the maker publishes an API price, Sunra charges that price with no fees on top. See the pricing page for the current comparison, and Contact sales for volume terms.
There is also an LLM endpoint for text, on api-llm.sunra.ai, which takes the same key as a Bearer token.
How a request works
Generation is queued, not held open on one long HTTP call. Three steps:
- Submit.
POST https://api.sunra.ai/v1/queue/<owner>/<model>/<endpoint>with your JSON body and the headerAuthorization: Key $SUNRA_KEY. The answer carries arequest_id. - Check.
GET https://api.sunra.ai/v1/queue/requests/<request_id>/statustells you whether it is still running. - Collect.
GET https://api.sunra.ai/v1/queue/requests/<request_id>returns the result, in the shape the endpoint's output schema describes.
The official clients — @sunra/client for JavaScript and sunra-client for Python — wrap those three steps in one subscribe call and read your key from the SUNRA_KEY environment variable. Call them from server-side code: a key in a browser bundle is a published key.
Rather than polling, you can pass a webhook URL when you submit, and Sunra posts the result to it when the request finishes, succeeded or failed. A failed delivery is retried, so the same result can arrive twice — answer quickly with a 2xx and use the id in the payload to skip repeats. Developer mode's Webhooks page and each endpoint's API tab carry the current delivery rules.
For file inputs, pass a publicly reachable URL or a base64 data URI, or upload the file to Sunra's own storage first and use the URL it returns. Large data URIs cost request time, so prefer an upload.
Start in Developer mode
Developer mode is the API's home in the product. Switch to it from the mode menu at the top of the left rail — Creative for the app, Developer for building on the models. It gives you:
- Dashboard — balance, spend and generations, plus a short set-up checklist
- API keys — create, rename and revoke
- Models and Pricing — the catalogue, the playground, and what each endpoint costs
- Generations, Completions and Usage — what you ran and what it cost
- Billing — balance, top-ups, cards and invoices
From a standing start: create a key, add funds, send one request. The quickstart does it in cURL, Python and JavaScript, and the Playground runs the same call from your browser before you write any code.
Let your coding agent set it up
If you work in an agent, you don't have to read the docs yourself. The Developer dashboard carries a prompt you can copy into your agent: it tells the agent which docs to read, how to store your key safely, and how to ask you before it spends anything on a test run. Every model's API tab has a Copy for your agent button too, which hands the agent that one endpoint's complete documentation in Markdown.
That is usually the fastest route to a working first call.