Tracy Draw logoTracy Draw
PricingAPI DocsContact UsPrivacyTerms
Tracy Draw Developer API

Image Generation API

Use an asynchronous task API to access Tracy Draw GPT-Image-2 generation with the same account credit balance.

Manage API keys Download OpenAPI JSON
EndpointsPOST/images/generationsGET/tasks/:task_idGET/modelsGET/credits

Quick start

Authenticate with a Bearer API key. Create a generation, then poll its task until it reaches succeeded, partially_succeeded, or failed.

Base URLhttps://api.leolovetracy.com/v1
bash
curl https://api.leolovetracy.com/v1/images/generations \
  -H "Authorization: Bearer td_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: generation-20260729-001" \
  -d '{"model":"gpt-image-2","prompt":"A quiet reading room","n":1,"size":"1:1"}'

Authentication

Send Authorization: Bearer td_live_... with every request. Revoked and expired keys stop working immediately. Store and use keys only on your server.

http
Authorization: Bearer td_live_YOUR_API_KEY

Idempotency

Idempotency-Key is required. Repeating the same key and request body returns the same task; changing the body returns 409.

POST/v1/images/generations

Create a generation

n defaults to 1 and supports up to 9. image_urls accepts up to 5 public HTTPS image URLs; localhost, private networks, and credential-bearing URLs are rejected.

Request example

bash
curl https://api.leolovetracy.com/v1/images/generations \
  -H "Authorization: Bearer td_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: generation-20260729-001" \
  -d '{"model":"gpt-image-2","prompt":"A quiet reading room","n":1,"size":"1:1"}'

Response example

json
{
  "ok": true,
  "data": {
    "task_id": "task_q1w2e3...",
    "object": "image.generation.task",
    "status": "queued",
    "model": "gpt-image-2",
    "n": 1,
    "size": "1:1",
    "credits_reserved": 20,
    "results_expires_at": "2026-08-01T08:00:00.000Z",
    "items": []
  }
}
GET/v1/tasks/{task_id}

Retrieve a task

Poll every 2 to 5 seconds. Any active API key belonging to the same user can retrieve tasks created through the API.

Request example

bash
curl https://api.leolovetracy.com/v1/tasks/task_q1w2e3... \
  -H "Authorization: Bearer td_live_YOUR_API_KEY"

Response example

json
{
  "ok": true,
  "data": {
    "task_id": "task_q1w2e3...",
    "status": "succeeded",
    "items": [{
      "item_id": "task_q1w2e3..._1",
      "status": "succeeded",
      "image_url": "https://cdn.example.com/result.png",
      "error": null
    }]
  }
}
GET/v1/models

Model capabilities

Retrieve the current model, supported sizes, maximum image count, and reference image limit.

Request example

bash
curl https://api.leolovetracy.com/v1/models \
  -H "Authorization: Bearer td_live_YOUR_API_KEY"

Response example

json
{
  "ok": true,
  "data": { "list": [{
    "id": "gpt-image-2",
    "sizes": ["1:1", "4:3", "3:4", "1:2", "16:9", "9:16"],
    "max_images": 9,
    "max_reference_images": 5
  }] }
}
GET/v1/credits

Credits and pricing

Retrieve the balance and effective per-image price after role benefits. API and web calls share credits, role pricing, and failed-image refunds.

Request example

bash
curl https://api.leolovetracy.com/v1/credits \
  -H "Authorization: Bearer td_live_YOUR_API_KEY"

Response example

json
{
  "ok": true,
  "data": {
    "balance": 980,
    "model": "gpt-image-2",
    "standard_unit_credits": 20,
    "actual_unit_credits": 16
  }
}

Result retention

Returned image URLs are guaranteed for at least 72 hours. Download them to your own storage within that period.

Status codes

400Invalid parameters or headers
401Invalid, revoked, or expired API key
402Insufficient credits
404Task not found or not owned by this user
409Idempotency conflict or request currently busy
500Internal service error

V1 has no frequency or concurrency limits. The policy may change as usage develops, with documentation updated in advance.

draw.leolovetracy.com
PricingAPI DocsContact UsPrivacyTerms