Docs
Quickstart
Your first successful response in under five minutes, with curl, Python or Node.
1. Get a key
- Sign in with an Iranian mobile number — sign in (SMS code; no foreign card needed).
- In Keys, create one. It starts with
ir-. - Top up your wallet, or start on the free plan.
The key is shown in full exactly once. We store only its fingerprint and cannot show it again — copy it there and then.
2. Your first call
cURL
bash
curl https://iranrouter.com/v1/chat/completions \
-H "Authorization: Bearer ir-..." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "سلام! خودت را معرفی کن."}]
}'Python
python
from openai import OpenAI
client = OpenAI(
api_key="ir-...",
base_url="https://iranrouter.com/v1",
)
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "سلام! خودت را معرفی کن."}],
)
print(resp.choices[0].message.content)Node.js
javascript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "ir-...",
baseURL: "https://iranrouter.com/v1",
});
const resp = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "سلام! خودت را معرفی کن." }],
});
console.log(resp.choices[0].message.content);3. Confirm it actually went through us
After your first successful call, open Usage in the dashboard. You should see that exact request with the model name, token counts and cost. If nothing is there, the request did not pass through IranRouter — most likely base_url was not actually changed.
Or without opening the dashboard:
bash
curl https://iranrouter.com/v1/credits -H "Authorization: Bearer ir-..."