env: stagingapi:
https://api-staging.c3pool.cn/api/v1portal: https://customer-staging.c3pool.cnbuild: API documentation
Authentication
All programmatic calls require an API key in the X-API-Key header. Create one on the API keys page.
X-API-Key: sk_alpha_REPLACE_ME_WITH_YOUR_KEYCreate image-generation job
POST/customer/jobs/image-api
curl example
curl -fsS -X POST 'https://api-staging.c3pool.cn/api/v1/customer/jobs/image-api' \
-H 'X-API-Key: sk_alpha_REPLACE_ME_WITH_YOUR_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "sd-1-5",
"tasks": [
{"prompt": "a serene mountain lake at dawn", "width": 512, "height": 512, "steps": 20}
]
}'JavaScript fetch example
const r = await fetch('https://api-staging.c3pool.cn/api/v1/customer/jobs/image-api', {
method: 'POST',
headers: {
'X-API-Key': 'sk_alpha_REPLACE_ME_WITH_YOUR_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'sd-1-5',
tasks: [
{ prompt: 'a serene mountain lake at dawn', width: 512, height: 512, steps: 20 }
],
}),
});
const body = await r.json();
console.log(body.data.job_id);Python requests example
import os, requests
r = requests.post(
"https://api-staging.c3pool.cn/api/v1/customer/jobs/image-api",
headers={"X-API-Key": os.environ["GPU_AGENT_API_KEY"]},
json={
"model": "sd-1-5",
"tasks": [
{"prompt": "a serene mountain lake at dawn", "width": 512, "height": 512, "steps": 20}
],
},
timeout=15,
)
r.raise_for_status()
print(r.json()["data"]["job_id"])List jobs
GET/customer/jobs?limit=50
Get job by id
GET/customer/jobs/:id
List artifacts
GET/customer/jobs/:id/artifacts
Refresh signed download URL
GET/customer/artifacts/:artifactId/signed-url
Get usage summary
GET/customer/usage/summary
GET/customer/usage/daily?days=30
GET/customer/credits/ledger?limit=100
Rate limits
- You can submit at most 10 jobs per minute (per customer).
- You can have at most 3 concurrent (running) jobs.
- A single job can request at most 4 images.
Credit rules
- Each completed task debits credits at the per-model rate.
- Failed / expired / validation-failed tasks do NOT debit credits.
- Duplicate completion events from outbox replay are de-duplicated by task id.
Error codes
| Code | Description |
|---|---|
| CUSTOMER_AUTH_REQUIRED | Sign in or supply API key |
| API_KEY_INVALID | X-API-Key not recognized |
| API_KEY_REVOKED | API key was revoked |
| CREDIT_INSUFFICIENT | Customer credit balance below projected cost |
| RATE_LIMITED | Too many requests / too many concurrent jobs |
| INVALID_IMAGE_PARAMETERS | Bad prompt / size / steps |
| MODEL_NOT_AVAILABLE | Use sd-1-5 or sdxl-base |
| JOB_NOT_FOUND | Job id absent or not yours |
| ARTIFACT_NOT_FOUND | Artifact id absent or not yours |
| SIGNED_URL_FAILED | Storage backend error |
| INTERNAL_ERROR | Unhandled server error |