Build on-brand ads into your product with one API.
One key runs image, video and voice models on your brand kit, reads your library and offers, and searches the ads your competitors run. A generation that fails costs nothing.
import { Sandstorm } from 'ads.dev'
const sandstorm = new Sandstorm()
const generation = await sandstorm.generations.run(
'nano-banana-pro',
{
prompt: 'A ceramic mug on a sunlit bench',
aspect_ratio: '4:5',
},
)
console.log(generation.output[0]?.url){
"id": "gen_6c1f0e9a7b2d4c55a1e3f08b9d2c4e71",
"model": "nano-banana-pro",
"status": "succeeded",
"output": [{
"type": "image",
"url": "https://cdn.sandstormapp.com/…/9c1e77aa.png",
"width": 1856,
"height": 2304
}],
"credits": 6
}What you can build on
Everything Sandstorm knows about a brand, and every model it runs, over HTTP.
Every model, priced per generation
Images, edits and upscales; video from text, images or references; voiceovers, music and sound effects. Name the model and it spends the same credits as the app.
Your first image in three steps
A key, one request, and a link to the finished file.
- 1Make a key in Sandstorm under Settings → API keys, or run the one-line login. Either way you get an sk_live_ key.
- 2POST /v1/generations with a model and its input. Send Prefer: wait=60 and the finished generation comes back in the same response.
- 3Use the output. Each one has a permanent link and an id you can pass straight into the next model.
curl -fsSL https://ads.dev/login.mjs -o sandstorm-login.mjs && node sandstorm-login.mjsQuestions
Do I need a Sandstorm account?
Yes. A key belongs to your Sandstorm team and acts on one of its brands, or on the brand each request names. Make one in Settings → API keys, or run the one-line login, which signs you in and saves the key to .env.
How is it billed?
Each generation spends your team's credits at $0.05 a credit, charged once it succeeds. Credits are held while it runs and released if it fails, or if you cancel it before the model starts. The API reference lists every model's price.
Which languages does it work with?
Any language that speaks HTTP. There are SDKs for TypeScript (npm install ads.dev) and Python (pip install ads_dev), and the OpenAPI document is at https://ads.dev/openapi.json.
How do I know when a video is done?
Wait for it in the same request with Prefer: wait, poll the generation, or pass a webhook_url and get generation.succeeded, generation.failed or generation.canceled, signed with your key's secret.
Can an AI agent use it?
Yes. https://ads.dev/llms.txt describes the API for agents, and the login command lets an agent make a key once you sign in. To work in Claude itself, the Sandstorm MCP server needs no key at all.
Build with Sandstorm.
Book a demo to plan your integration with the team, or read the API reference and make a key today.


