Skip to main content

1. Create an API key

Create a key in API Keys and set APIANY_API_KEY in your shell. Keep it out of browser code and source control. Send your API key as a Bearer token:

2. List available models

3. Check your available credits

Check balance and api_key.budget_remaining_credits before submitting. A null remaining key budget means there is no separate key budget. Account credits still apply.

4. Generate a PNG with GPT Image 2.6

Confirm gpt-image-2.6 appears in the model list. The sample uses one 1K PNG. Check the model page for the current per-request rate or set the same options in its Playground before running the command. Each separate generation request can consume credits.

5. Retrieve the result and check settlement

Save the returned task_id and request_id from the HTTP 202 response. Replace task_123 below with the returned task_id:
If the state is pending or processing, wait for retry_after_ms when present, then query the same task again. For a completed task, download result.data[0].url and check credits.charged for that task. Use the result URL while it is available. For failed or expired, inspect the task details before submitting a new job. See task states, image parameters, billing, and error handling. For text integration, follow the Chat Completions reference.