Docs/API

Images from chat

How do I generate a picture, and where does it come back?

Checked against the code on

There is no images endpoint. Some chat models answer with a picture, and on askr those pictures come back inside the chat completion. Ask in words, get an image URL.

The models that do this are the chat models whose output includes image in the catalog: today the three Gemini image models (the ones the internet calls Nano Banana). The GPT image models are listed upstream but on the refused list, and catalog entries of type image that are not chat models are refused with 404.

curl https://heyaskr.ai/v1/chat/completions \
  -H "Authorization: Bearer $ASKR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-3.1-flash-image",
    "messages": [{"role": "user", "content": "A red fox in a snowy forest, cinematic light."}]
  }'
200
{
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "",
      "images": [{ "type": "image_url", "image_url": { "url": "https://..." } }]
    },
    "finish_reason": "stop"
  }],
  "usage": { "prompt_tokens": 18, "completion_tokens": 1290, "total_tokens": 1308 },
  "askr": { "credits_charged": 83 }
}

What a picture costs

These models publish per-token rates that do not describe what a picture costs, because most of the output tokens are the picture. So the reservation uses a measured floor per model (41 to 163 credits on the Gemini image models, 200 for any we have not measured) and the charge is settled to the gateway's real figure. The cost is in askr.credits_charged as always. What you are charged when.

Streaming

Works. The picture arrives as delta.images on a chunk. If you want the simple path, do not stream for images: one response, one URL.

Keeping the picture

Download it. The URL is a temporary address on the model gateway and lives for up to 24 hours. Pictures made in the workspace are kept in your library; pictures made through the API are not.