Model

Gemini 3.1 Flash Image API

The useful thing about this model is the price ladder: four output resolutions, each with its own published price. You can generate thumbnails at 0.5K and only pay for 4K when the asset actually needs it.

Price

Output sizePrice per image
0.5K$0.0112
1K$0.0168
2K$0.0253
4K$0.0377

Billed per generated image from your prepaid balance. Prices come from the gateway’s live price list and refresh every five minutes.

What it is good for

  • Assets that need a specific output resolution
  • Images with text or typography inside them
  • Cost control: pick the smallest tier that works

Where to be careful

  • 4K is roughly 3× the 0.5K price
  • Verify text rendering on your own prompts before shipping

Prompt examples

  • A minimalist poster for a coffee brand, cream background, bold black serif headline, lots of negative space
  • A clean product label mockup on a white bottle, soft studio light, readable small text
  • A wide banner illustrating an AI gateway, abstract nodes and lines, blue and orange accents

Call it from the command line

curl https://api.tokwork.com/v1/images/generations \
  -H "Authorization: Bearer $TOKWORK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-image",
    "prompt": "your prompt here",
    "size": "1024x1024"
  }'

Or with the OpenAI SDK

import OpenAI from 'openai'

const client = new OpenAI({
  apiKey: process.env.TOKWORK_API_KEY,
  baseURL: 'https://api.tokwork.com/v1',
})

const image = await client.images.generate({
  model: 'gemini-3.1-flash-image',
  prompt: 'your prompt here',
  size: '1024x1024',
})

Questions

How is this model priced?
Per image, with a different price for each output resolution. The table above reads the live prices from the gateway.
Which resolution should I pick?
Use the smallest tier that satisfies the final placement. Generating 4K for a 400px thumbnail costs more for no visible benefit.

Start with one key

Create an account, top up any amount, and send your first request in a few minutes.