Updated · SiAPI.ai

DEVELOPER GUIDES

Image API setup

Generate and edit images with your existing SiAPI.ai key, fixed per-image prices and shared Coding Plan points.

Use your existing API key and endpoint

Create and edit images through https://siapi.ai/v1 with your SiAPI.ai API key. Image generation uses asynchronous tasks.

Image prices and shared Plan points

Get a quote

curl https://siapi.ai/v1/image-quotes \
  -H "Authorization: Bearer $SIAPI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model":"gpt-image-2.5-flare","prompt":"A quiet coastal village at sunrise","resolution":"1K","aspect_ratio":"16:9"}'

The quote expires after five minutes. It includes the model, resolution, USD price and Plan points. Review the quote before creating a task.

Example response fields

{
  "quoteId": "00000000-0000-4000-8000-000000000001",
  "model": "gpt-image-2.5-flare",
  "resolution": "1K",
  "currency": "USD",
  "count": 1,
  "pricePico": 39000000000,
  "points": 3900000
}

Examples show response fields, not a live quote. Use the quoteId and expiresAt from your own response. Divide pricePico by 1,000,000,000,000 to get the USD price.

Create a task and check its result

curl https://siapi.ai/v1/image-tasks \
  -H "Authorization: Bearer $SIAPI_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: your-unique-request-id' \
  -d '{"quoteId":"QUOTE_ID"}'

curl https://siapi.ai/v1/image-tasks/TASK_ID \
  -H "Authorization: Bearer $SIAPI_API_KEY"

Creation returns HTTP 202 and a task ID. Reuse the same idempotency key if the response is lost. Poll the existing task; a timeout does not mean generation failed.

When the task succeeds, download the image using its temporary output URL. Refresh the task to obtain a new download link.

{
  "id": "00000000-0000-4000-8000-000000000002",
  "state": "succeeded",
  "model": "gpt-image-2.5-flare",
  "resolution": "1K",
  "count": 1,
  "billingMode": "plan",
  "outputs": [
    {
      "url": "DOWNLOAD_URL",
      "contentType": "image/png",
      "size": 12345
    }
  ],
  "error": null,
  "retryAfter": 3
}

Task states and safe retries

  • reserving / queued / submitting / running — The request is being reserved, queued or generated. Keep polling the same task.
  • archiving / settling / closing — Delivery or billing is being finalized. Keep the task ID and wait for its final state.
  • succeeded — Download outputs from the returned temporary URLs.
  • failed — Read the error field before deciding whether to submit a new request.
  • submission_unknown / review — The supplier outcome needs reconciliation. Do not create a replacement task or assume a refund because time has passed.

Edit an image

Request an upload link with POST /v1/assets/uploads and contentType plus size. Upload the file directly with PUT, then confirm it with POST /v1/assets/ASSET_ID/complete. Include the returned asset ID in the assets array of your image quote.

This macOS/Linux example uploads reference.png. Set SIAPI_API_KEY locally first. The upload URL is temporary; send only the required content type when uploading the file.

SIZE=$(wc -c < reference.png | tr -d "[:space:]")
curl --fail-with-body https://siapi.ai/v1/assets/uploads \
  -H "Authorization: Bearer $SIAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"contentType\":\"image/png\",\"size\":$SIZE}" > upload.json
UPLOAD_URL=$(python3 -c 'import json; print(json.load(open("upload.json"))["upload"]["url"])')
ASSET_ID=$(python3 -c 'import json; print(json.load(open("upload.json"))["assetId"])')
curl --fail-with-body -X PUT "$UPLOAD_URL" \
  -H "Content-Type: image/png" --data-binary @reference.png
curl --fail-with-body -X POST "https://siapi.ai/v1/assets/$ASSET_ID/complete" \
  -H "Authorization: Bearer $SIAPI_API_KEY"
curl --fail-with-body https://siapi.ai/v1/image-quotes \
  -H "Authorization: Bearer $SIAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"model\":\"nano-banana-2\",\"prompt\":\"Turn the scene into a watercolor\",\"resolution\":\"1K\",\"assets\":[\"$ASSET_ID\"]}"

Use gpt-image-2, gpt-image-2.5-flare, gpt-image-2.5-sunburst or nano-banana-2. Each task produces one image at 1K, 2K or 4K.

Image API errors

Read error.code in API errors; request validation can return HTTP 422 with detail instead. A task can return HTTP 200 while its state is still pending or failed.

  • 401 ACCESS_DENIED / 403 MODEL_DENIED — Check the API key and its allowed models.
  • 409 QUOTE_EXPIRED — Request a fresh quote before creating a new task.
  • 409 IDEMPOTENCY_CONFLICT — An existing request ID is bound to different parameters. Resume the original task; use a new ID only for a separate intended image.
  • 429 MEDIA_RATE_LIMIT / MEDIA_QUEUE_FULL — Wait before retrying. Retain the same request ID if task creation may already have succeeded.
  • 409 UPLOAD_SIZE_MISMATCH / 400 INVALID_IMAGE_CONTENT — Check the file type and exact byte size, then upload and confirm the reference again.
  • 503 IMAGE_SERVICE_UNAVAILABLE — Generation is temporarily unavailable. Check existing tasks before trying again.

Generate images from Codex

Install the SiAPI.ai image Skill and set SIAPI_API_KEY locally. Ask Codex to generate or edit an image with SiAPI.ai. The Skill handles quotes, stable request IDs and resumable polling.

Download the image Skill

Install the image Skill in Codex

The chat configuration above selects coding models. Add the image Skill to generate and edit with GPT Image or Nano Banana using your existing SiAPI.ai key.

Download the image Skill

macOS / Linux

curl -fsS https://siapi.ai/assets/setup/siapi-media.zip -o siapi-media.zip
mkdir -p "$HOME/.codex/skills"
unzip -q siapi-media.zip -d "$HOME/.codex/skills"
export SIAPI_API_KEY="YOUR_SIAPI_API_KEY"
codex

Windows PowerShell

Invoke-WebRequest https://siapi.ai/assets/setup/siapi-media.zip -OutFile siapi-media.zip
Expand-Archive siapi-media.zip -DestinationPath "$HOME/.codex/skills"
$env:SIAPI_API_KEY="YOUR_SIAPI_API_KEY"
codex

Requires Python 3.11 or later. Replace the key placeholder locally, then start a new Codex session. Keep the API key out of chat messages.

Ask Codex for a quote first. Name the model, resolution and any local reference images; approve the quoted USD and Plan points before generation.

Image API setup →