{"openapi":"3.1.0","info":{"title":"Tracy Draw Image API","version":"1.0.0","description":"Create GPT-Image-2 generation tasks and retrieve their results. Generated result URLs are guaranteed for at least 72 hours."},"servers":[{"url":"https://api.leolovetracy.com/v1"}],"security":[{"ApiKeyAuth":[]}],"paths":{"/images/generations":{"post":{"summary":"Create an image generation task","operationId":"createImageGeneration","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":200},"description":"A caller-generated unique key. Replaying the same request does not consume credits twice."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageGenerationRequest"}}}},"responses":{"202":{"description":"Task accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/tasks/{task_id}":{"get":{"summary":"Get a generation task","operationId":"getImageGenerationTask","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","pattern":"^task_"}}],"responses":{"200":{"description":"Current task state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/models":{"get":{"summary":"List supported models and capabilities","operationId":"listModels","responses":{"200":{"description":"Supported models","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"const":true},"data":{"type":"object","properties":{"list":{"type":"array","items":{"$ref":"#/components/schemas/Model"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/credits":{"get":{"summary":"Get credit balance and effective image price","operationId":"getCredits","responses":{"200":{"description":"Account credits","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"const":true},"data":{"type":"object","properties":{"balance":{"type":"integer"},"model":{"const":"gpt-image-2"},"standard_unit_credits":{"type":"integer"},"actual_unit_credits":{"type":"integer"}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"td_live_ API key"}},"schemas":{"ImageGenerationRequest":{"type":"object","required":["model","prompt"],"additionalProperties":false,"properties":{"model":{"const":"gpt-image-2"},"prompt":{"type":"string","minLength":1,"maxLength":10000},"n":{"type":"integer","minimum":1,"maximum":9,"default":1},"size":{"type":"string","enum":["1:1","4:3","3:4","1:2","16:9","9:16"],"default":"1:1"},"image_urls":{"type":"array","maxItems":5,"items":{"type":"string","format":"uri","pattern":"^https://"}}}},"TaskResponse":{"type":"object","required":["ok","data"],"properties":{"ok":{"const":true},"data":{"$ref":"#/components/schemas/Task"}}},"Task":{"type":"object","properties":{"task_id":{"type":"string"},"object":{"const":"image.generation.task"},"status":{"type":"string","enum":["queued","processing","succeeded","partially_succeeded","failed"]},"model":{"const":"gpt-image-2"},"prompt":{"type":"string"},"n":{"type":"integer"},"size":{"type":"string"},"credits_reserved":{"type":"integer"},"created_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"results_expires_at":{"type":["string","null"],"format":"date-time"},"items":{"type":"array","items":{"$ref":"#/components/schemas/TaskItem"}}}},"TaskItem":{"type":"object","properties":{"item_id":{"type":"string"},"status":{"type":"string"},"image_url":{"type":["string","null"],"format":"uri"},"error":{"oneOf":[{"type":"null"},{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}]}}},"Model":{"type":"object","properties":{"id":{"const":"gpt-image-2"},"object":{"const":"model"},"sizes":{"type":"array","items":{"type":"string"}},"max_images":{"const":9},"max_reference_images":{"const":5}}},"Error":{"type":"object","properties":{"ok":{"const":false},"message":{"type":"string"},"businessCode":{"type":"string"}}}},"responses":{"BadRequest":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Invalid, revoked, or expired API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InsufficientCredits":{"description":"Insufficient credits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Conflict":{"description":"Idempotency conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}