Access from Iran: which hostname to use, and what an internet cut does
From inside Iran use https://api.1xai.ir, and from abroad https://1xai.ir; the key, the paths, the prices and the account are the same on both. The models and our main servers are outside Iran, and our server in Iran only carries the connection to them, so when Iran's international connection is cut completely, API calls stop on both hostnames.
Last updated:
Two hostnames, one service
| Hostname | Where your connection goes first | What it serves |
|---|---|---|
https://1xai.ir | Where your connection goes first:Straight to our main servers outside Iran | What it serves:The website, the dashboard and the API: /v1, /anthropic and /gemini |
https://api.1xai.ir | Where your connection goes first:A server of ours in Iran, which passes the encrypted connection on to the main servers without opening it | What it serves:The API only: /v1, /anthropic, /gemini and realtime voice; any other path is redirected to https://1xai.ir |
1xAi's main servers are outside Iran. The api.1xai.ir hostname passes through a server of ours in Iran that does not open the encrypted connection; both hostnames reach the same service and are reachable from Iran without a VPN. The key, the paths, the prices and the account are the same on both; only the base URL differs (base URLs).
import os
from openai import OpenAI
client = OpenAI(
# https://api.1xai.ir/v1 from inside Iran, https://1xai.ir/v1 from abroad
base_url=os.environ.get("ONEXAI_BASE_URL", "https://api.1xai.ir/v1"),
api_key=os.environ["ONEXAI_API_KEY"],
)Which one to use
- From inside Iran, use
https://api.1xai.ir. Your connection ends at an address inside Iran, and carrying it abroad is our server's job. This hostname was set up for the days when Iranian networks slow down or filter connections to foreign addresses. - From abroad, use
https://1xai.ir:https://api.1xai.irwould carry your request into Iran and back out again. - Opening a new connection through
https://api.1xai.irtakes a little longer, because the encryption handshake goes all the way to our servers abroad. SDKs keep connections open and reuse them, so that time is paid once per connection, not per request. - Make the base URL a setting of your program rather than a constant in its code, so you can switch hostnames without a release.
- A key with an IP address list works on
https://1xai.ironly (key controls).
When Iran's international connection is cut
The models run in their vendors' data centres outside Iran, and our main servers are outside Iran too. Our server in Iran only carries connections: no model runs on it, and it cannot answer by itself. 1xAi runs no model inside Iran.
So when Iran's connection to the international internet is cut completely, API calls stop on both hostnames, and the website and the dashboard are out of reach as well. A call then ends in your program with a connection error or a timeout, not with an HTTP answer, because nothing on our side can be reached to give one.
- A request that never reached our servers is not billed: there is nothing to bill.
- A request that had reached our servers before the cut is completed there, and is billed as when you close the connection during an answer (billing). Once you are connected again,
GET /v1/usageshows what was billed. - When the international connection is slow or partly filtered rather than cut, retry with a growing wait between tries, and if one hostname keeps failing, try the other.
We make no promise of service during a cut of the international connection. Each vendor's success rate, measured at the gateway, is on the status page.
Checking from your own network
for host in https://api.1xai.ir https://1xai.ir; do
curl -sS -o /dev/null \
-w "$host %{http_code} connect=%{time_connect}s total=%{time_total}s\n" \
"$host/v1/models" -H "Authorization: Bearer 1xai-..."
doneGET /v1/models costs nothing and counts toward the key's rate limit like any request. 200 on both means both paths work from your network. The benchmark has a script that calls two base URLs alternately and compares their times.
1xAi is an independent gateway. It is not affiliated with, endorsed by, or a reseller for OpenAI, Anthropic, Google, DeepSeek, xAI, Moonshot AI, Z.ai, Alibaba Qwen, MiniMax or Tencent Hunyuan. Requests are relayed upstream rather than answered by models of our own, so each provider's own usage policies apply to what their models will and will not do, and their model availability is theirs to change. Current reachability is published on the status page.