Build with 30 AI models through one API
Generate images and videos with Nano Banana, Seedream, GPT Image, Kling, Veo and Seedance from your own product. One key, one credit balance, the same prices as the studio.
- ✓Pay per use, no API fee
- ✓Failed jobs are refunded automatically
- ✓Keys stored only as a secure hash
curl -X POST https://www.charaly.com/api/v1/generate \
-H "Authorization: Bearer $CHARALY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"modelKey":"nano_pro","prompt":"A golden retriever astronaut, studio light","aspect":"1:1"}'Authentication
Create a key in Settings → API keys and send it in the Authorization: Bearer chy_… header on every request. Keys are shown once, can be revoked at any time and must only be used from your server.
Endpoints
| GET | /api/v1/models | Every available model with its credit price and supported options. |
| GET | /api/v1/balance | Your current credit balance. |
| POST | /api/v1/uploads | Upload reference images or videos (multipart, field file). Returns asset ids. |
| POST | /api/v1/generate | Start a generation. Returns job ids and the credits reserved. |
| GET | /api/v1/jobs?ids=… | Job status and output links. Without ids: your latest jobs. |
Generate parameters
| Field | Type | Description |
|---|---|---|
| modelKey | string, required | Model key from /api/v1/models, for example nano_pro or kling_3_0. |
| prompt | string | What to create. Up to the model's prompt limit. Use @Name to attach a saved character. |
| aspect | string | Aspect ratio such as 1:1, 9:16 or 16:9, if the model supports it. |
| count | 1 to 4 | Number of images to create in one call (image models). |
| duration | seconds | Video length, within the model's range. |
| resolution | string | Output resolution, for example 2K or 1080p, if the model supports it. |
| audio | boolean | Generate sound on video models that support it. |
| selected | asset ids | Reference images for image models (from /api/v1/uploads). |
| firstFrame / lastFrame | asset id | Start and end frame for image-to-video models. |
| video | asset id | Input video for motion control and video-to-video models. |
| enhance | boolean | Let Charaly rewrite your prompt for better results. |
Unknown fields are rejected. Job status is one of queued, running, success or failed; failed jobs refund their credits automatically.
const KEY = process.env.CHARALY_API_KEY;
const base = "https://www.charaly.com/api/v1";
const h = { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" };
const start = await fetch(`${base}/generate`, {
method: "POST", headers: h,
body: JSON.stringify({ modelKey: "kling_3_0", prompt: "Slow orbit around a red sports car at night", duration: 5 }),
}).then((r) => r.json());
let job;
do {
await new Promise((r) => setTimeout(r, 4000));
({ jobs: [job] } = await fetch(`${base}/jobs?ids=${start.jobs[0]}`, { headers: h }).then((r) => r.json()));
} while (job.status === "queued" || job.status === "running");
console.log(job.status, job.outputs.map((o) => o.download));import os, time, requests
base = "https://www.charaly.com/api/v1"
h = {"Authorization": f"Bearer {os.environ['CHARALY_API_KEY']}"}
asset = requests.post(f"{base}/uploads", headers=h, files={"file": open("me.jpg", "rb")}).json()["assets"][0]
start = requests.post(f"{base}/generate", headers=h, json={
"modelKey": "nano_pro", "prompt": "Turn this photo into a 3D figurine on a desk", "selected": [asset["id"]],
}).json()
while True:
time.sleep(4)
job = requests.get(f"{base}/jobs", headers=h, params={"ids": start["jobs"][0]}).json()["jobs"][0]
if job["status"] in ("success", "failed"):
break
print(job["status"], [o["download"] for o in job["outputs"]])Errors
Errors return JSON like {"error":"…"} with an HTTP status:
400
Invalid input. The message names the field.
401
Missing, malformed or revoked API key.
402
Not enough credits for this generation.
403
Account suspended.
422
The prompt was blocked by the content filter.
429
Too many requests. Back off and retry.
FAQ
Frequently asked questions
Still stuck? Write to support@charaly.com and a human replies within a day.
01How much does the Charaly API cost?
There is no API fee or subscription. Each call spends credits at exactly the same price as the studio (100 credits = $1). Call /api/v1/models to see live prices.
02How do I get an API key?
Sign in, open Settings and create a key in the API keys section. The key is shown once; store it in an environment variable on your server. You can have up to five active keys and revoke any of them at any time.
03Are there rate limits?
Yes. Each key can make 120 requests per minute, and each account can start 30 generations per minute. Poll job status every 3 to 5 seconds rather than in a tight loop.
04Can I call the API from a browser or mobile app?
No. Your key gives access to your credits, so keep it on your own server. Call Charaly from your backend and pass results to your app.
05How long do output links last?
Output links are signed and valid for about an hour. Download files you want to keep, or request the job again to get fresh links.
06Is adult content available through the API?
No. The API always runs with the standard content filter, and the Acceptable Use Policy applies to every request.
07Can I use my saved characters?
Yes. Characters saved in your Charaly library can be referenced with @Name in the prompt, exactly like in the studio.
08What happens to my credits if a job fails?
Failed, timed-out or blocked jobs are refunded to your balance automatically. The job shows status "failed" with a short error message you can log.
09Which models can I call?
Every model in the studio: Nano Banana, Seedream, GPT Image, Kling, Veo, Seedance, Wan, Hailuo and more. /api/v1/models returns the live list with keys, options and prices.
10Can I upload my own reference images?
Yes. POST an image to /api/v1/uploads, then pass the returned asset id in the selected array of /api/v1/generate. Uploads are private to your account.
11Is there a sandbox or test mode?
Use the cheapest model (nano_2_lite, 4 credits) while you build. New accounts start with 30 free credits, which is enough for several test calls.
12What if my key leaks?
Revoke it in Settings straight away; it stops working at once. Create a new key and update your server. Keys are stored only as a hash on our side.