Models → Pricing → Docs → Blog → Changelog → Contact → Status →
Get started freeLog in

Image Generation API Guide: Studio and Code

One engine, two doors: Image Studio for clicking, /v1/images/generations for code. What a request looks like, what it costs, and how billing protects your balance.

FreeModel can create and edit images, not just text. There are two ways in, and they run on the same engine with the same models and the same price:

  • Image Studio in your dashboard — type an idea or add a photo, pick a shape and quality, click create.
  • The Images API — POST /v1/images/generations and /v1/images/edits, in the OpenAI Images format, so the official OpenAI SDKs work.

The most important thing to know before you start: images are paid per image from your account balance, not from plan tokens.

How billing works

Each image model has a price per image. For sunburst-2.5 it is $0.0018 per image, and every resolution — 1K, 2K or 4K — costs the same. The live price of every model is in GET /v1/images/models.

  1. When a request starts, the price of the images you asked for is held from your balance.
  2. When it finishes, you are charged only for the images you received. The rest goes straight back.
  3. A failed request is fully refunded.

Parallel requests cannot spend the same money twice: if your balance covers three images, at most three are created, however fast you send requests. Every response carries the exact cost in usage.cost_usd and in the X-FreeModel-Cost-Usd header.

To add balance, use Dashboard → Billing → Add balance with UPI or USDT on BEP-20. A free account can create images too, once it is verified with Telegram and has balance.

Option 1: Image Studio

Open Image Studio from the dashboard. Describe the image, or add your own photo to edit or restyle it. Under settings you choose the model, a style, the shape (square, wide, tall and more) and the quality. A request takes about 25–45 seconds; 4K takes the longest.

Everything you make is kept in Gallery and History, with the prompt, size and cost of each request, on any device you sign in from. The bottom of the page also shows the same request as cURL and Python, ready to copy.

Option 2: the API

The smallest working request:

curl https://freemodel.in/v1/images/generations \
  -H "Authorization: Bearer $FREEMODEL_API_KEY" \
  -H "Content-Type: application/json" \
  --max-time 300 \
  -d '{
    "model": "sunburst-2.5",
    "prompt": "A red fox sitting in fresh snow, golden hour, photoreal",
    "size": "1792x1024"
  }'

The response holds the image as base64 by default, plus the cost:

{
  "created": 1793981265,
  "data": [{ "b64_json": "iVBORw0KGgo…", "revised_prompt": "A red fox sitting in fresh snow…" }],
  "usage": { "images": 1, "requested": 1, "cost_usd": 0.0018, "tokens": 0 },
  "model": "sunburst-2.5",
  "size": "1792x1024",
  "id": "img_3f1c9a0b7d2e4c5a61"
}

The same with the OpenAI Python SDK, saving the file:

import base64, os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["FREEMODEL_API_KEY"],
    base_url="https://freemodel.in/v1",
    timeout=300,
)

img = client.images.generate(
    model="sunburst-2.5",
    prompt="A cozy wooden cabin in snowy mountains at night, northern lights above",
    size="3840x2160",
    n=1,
)
with open("cabin.png", "wb") as f:
    f.write(base64.b64decode(img.data[0].b64_json))

Set the client timeout high: a single image can take well over the default timeouts of many HTTP libraries.

Request fields

FieldRequiredNotes
promptYes3–4000 characters
modelNoe.g. sunburst-2.5; defaults to the first available model
nNo1–4 images, each billed separately
sizeNoe.g. 1024x1024, 1792x1024, 3840x2160; other sizes snap to the closest supported shape
qualityNohigh (default) or standard
response_formatNob64_json (default) or url — a signed link valid for 7 days
fm_styleNoOptional style: photo, cinematic, anime, 3d, neon, fantasy, watercolor, product, logo, pixel

To edit a picture, send 1–4 reference images (JPG, PNG or WEBP, up to 10 MB each) to /v1/images/edits with a prompt. The image generation docs have the edit examples and the full size table.

Limits worth planning for

  • Up to 4 images per request and 4 requests running at once per account.
  • A daily image limit per account, which resets at midnight IST.
  • Set your HTTP timeout to at least 300 seconds. Short default timeouts are the most common reason a working request looks broken.
  • Image models are listed at /v1/images/models, not in /v1/models.

Errors you may see

HTTPCodeWhat it means
400IMG_REJECTEDThe prompt cannot be turned into an image; change the wording. Not charged.
402IMG_NO_BALANCEBalance too low for one image; add balance.
404IMG_MODEL_OFFUnknown or paused model; the message lists the models you can use.
429IMG_TOO_MANY / IMG_DAILY_LIMITToo many requests running at once, or the daily limit reached.
502–504IMG_UNAVAILABLE, IMG_BUSY, IMG_TIMEOUTTemporary; not charged. Retry shortly.

Errors use the OpenAI shape {"error": {"message", "type", "code"}}, so existing error handling keeps working.

What about video?

Video works the same way: Video Studio in the dashboard and /v1/videos from code, paid per video from your balance. See the video generation docs.

FAQ

Do images use my plan tokens?

No. Images are paid per image from your account balance. Plan tokens are only used by chat and text requests.

Can a free account create images?

Yes, once the account is verified with Telegram and has balance to pay for the images. The free plan tokens cannot be used for images.

Am I charged if an image fails?

No. The price is held when the request starts, and you are charged only for images you actually receive. A failed request is fully refunded to your balance.

Why is my image model missing from /v1/models?

Image models are listed at /v1/images/models, not in /v1/models. The /v1/models list is for chat models, so chat apps never pick an image model by mistake.

Ready to build?

Grab a free API key — 1M tokens on 8 free models after a one-time Telegram verification, no card. Every model from $1.20.