Skip to content

Images and reranking

The endpoints that are billed per unit rather than per token.

5 min read

Per-unit pricing

Some models are not billed on tokens at all. Every catalogue row carries a price_unit: token means the per-token prices beside it are real, and anything else — image, second, document — means those are zero placeholders and unit_price_micros is what you will be charged.

Check the unit before you budget
GET /models reports price_unit and pricing.per_unit on every row, so a cost estimate can be built without knowing in advance which models are token-priced.

Images

POST https://api.multigrid.ai/v1/images/generations, in OpenAI’s shape. The response adds a multigrid object naming the provider, how many images were billed and the per-image rate.

bash
curl https://api.multigrid.ai/v1/images/generations \
  -H "Authorization: Bearer $MULTIGRID_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "black-forest-labs/flux-1-schnell",
    "prompt": "A cross-section diagram of a suspension bridge, technical illustration",
    "n": 1
  }'

Two image models are in the catalogue today — openai/gpt-image-1 and black-forest-labs/flux-1-schnell — and GET /models?modality=image is the list that cannot go stale.

Reranking

POST https://api.multigrid.ai/v1/rerank scores a list of documents against a query and is billed per document scored. It is the second half of a retrieval pipeline: /embeddings finds candidates cheaply, this orders them accurately. Indices and scores are passed straight through from the provider.

bash
curl https://api.multigrid.ai/v1/rerank \
  -H "Authorization: Bearer $MULTIGRID_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "baai/bge-reranker-v2-m3",
    "query": "how do I cap spending on one key",
    "documents": ["…", "…", "…"],
    "top_n": 3
  }'

Video

There is a POST /video/generations endpoint on the same pipeline, billed per second of output. No video model is in the catalogue at the moment, so nothing can currently be routed to it — GET /models?modality=video returns an empty list, and that is the check worth making rather than taking this paragraph’s word for it.

Sending images in, not out

Attaching an image or a PDF to a chat request is a different thing and lives on /chat/completions. Use OpenAI’s image_url content parts. Limits are enforced before anything is sent upstream: 20 MB per image, 32 MB per PDF, 48 MB and 24 attachments across the whole request. A model that cannot read what you attached is dropped from the route list rather than being sent it — and if your fallback chain contains a VisionThe model can look at images and PDFs you attach, not just read text. model, that is precisely what the chain gets used for.

Something here disagrees with what the API actually did? That is a bug in this page, and worth reporting.

Report it