IranRouter docs

Everything about calling IranRouter — from your first request to production agents.

IranRouter speaks the OpenAI API. Any SDK, library or tool that works with OpenAI connects here by changing two values — the base URL and the key. Nothing in your code needs rewriting.

Python
client = OpenAI(
    api_key="ir-...",                    # ← your IranRouter key
    base_url="https://iranrouter.com/v1",   # ← instead of api.openai.com
)

Billing is in Rial, an official invoice is issued, and no foreign card is required. You are charged for tokens actually consumed, not a monthly subscription.

Where to start

What is supported

CapabilityStatus
POST /v1/chat/completionsFully supported, streaming and non-streaming
POST /v1/responsesOpenAI Responses API, streaming included
POST /v1/videosVideo generation — polled to completion in the request
POST /v1/async/{verb}The async twin of every verb: 202 and poll
WSS /v1/realtimeOpenAI's Realtime protocol, one hold per session
POST /v1/ocrDocument OCR, priced per page
POST /v1/files · /v1/batchesA JSONL file of requests, run in the background
POST /v1/messagesAnthropic-format compatible
Tools / function callingOn both surfaces
Vision / image inputOn models that support it
Prompt cachingSupported and priced separately
GET /v1/models · /v1/key · /v1/creditsSupported
POST /v1/embeddingsSupported, non-streaming
POST /v1/messages/count_tokensSupported — an estimate, free
POST /v1/rerank · /v1/moderations · /v1/completionsSupported, non-streaming
POST /v1/images/generationsSupported — billed per image, max 10 per request
POST /v1/audio/speechSupported — the response is audio; cost in the x-cost-rial header
POST /v1/audio/transcriptions · /translationsSupported — multipart, the file is forwarded untouched
POST /genai/v1beta/models/…Google GenAI SDK compatible
A base URL per SDKThe same surface under four prefixes: /v1 (default), /openai, /anthropic and /genai

Leave your SDK alone and change only its base URL: /anthropic for the Anthropic SDK (it appends /v1/messages itself), /genai for the Google GenAI SDK, and /openai or /v1 for the OpenAI SDK. All four are one engine; the prefix exists so migrating is one line of config, not a code change.

What we do not have yet

Stated plainly so nobody buys on a wrong assumption:

  • /v1/batches, /v1/files — offered; a batch carries no discount and starts at once.
  • /v1/responses — offered, without previous_response_id and without built-in tools (web_search, …).
If you depend on one of these, talk to us before you buy — we would rather you knew first.