IranRouter
Docs contents

Docs

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/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/responses, /v1/batches not offered yet.
  • /v1/batchesnot implemented.
If you depend on one of these, talk to us before you buy — we would rather you knew first.