The 1xAi MCP server, in Claude Code and Cursor
Put one URL and your own API key in the settings of Claude Code, Cursor or Claude Desktop. From then on the model inside that app sees 1xAi's models and their prices, your balance and your usage, and chats with any model. Connecting is free; only a chat with a model is billed, as always.
What MCP is
MCP is the common language AI apps use to connect to outside tools, like a socket any device plugs into. 1xAi's own MCP server is one URL, https://1xai.ir/v1/mcp: you add it once, with your API key, to the app's settings, and then ask in plain words. The model calls the right tool itself and answers from your own account.
1xAi is among the first Iranian AI gateways with a remote MCP server: it runs on 1xAi itself, so Claude Code and Cursor need nothing installed.
What the model gets
- list_models
- The models this key can call, with each one's vendor, kind and Toman price per thousand input and output tokens; at most 200 rows an answer. Cost: Free.
- estimate_cost
- The cost of a request in Toman before it is sent, at your own account's rates; nothing is charged. Cost: Free.
- get_balance
- The spendable balance, the wallet and the gift credit. Cost: Free.
- get_usage
- Calls, tokens and Toman by day and by model, up to the last 90 days. Cost: Free.
- chat
- One answer from any model on the list: an ordinary API call, at the same price and with the same usage record. Cost: The usual API price.
Three steps
- Make an API key in the dashboard; a key of its own for this app, with a spend cap if the app chats.
- Put the URL and the key in the app's MCP settings, as in the snippets below.
- Ask the model in the app which models there are, what your balance is, or what a task would cost.
claude mcp add --transport http 1xai https://1xai.ir/v1/mcp \ --header "Authorization: Bearer 1xai-..." # for every project claude mcp add --transport http 1xai --scope user https://1xai.ir/v1/mcp \ --header "Authorization: Bearer 1xai-..."
In a project's .mcp.json, which lives in the repository, do not write the key: put it in the ONEXAI_API_KEY environment variable.
{
"mcpServers": {
"1xai": {
"type": "http",
"url": "https://1xai.ir/v1/mcp",
"headers": {
"Authorization": "Bearer ${ONEXAI_API_KEY}"
}
}
}
}{
"mcpServers": {
"1xai": {
"url": "https://1xai.ir/v1/mcp",
"headers": {
"Authorization": "Bearer ${env:ONEXAI_API_KEY}"
}
}
}
}{
"mcpServers": {
"1xai": {
"command": "npx",
"args": ["-y", "mcp-remote@0.16.7", "https://1xai.ir/v1/mcp", "--transport", "http-only", "--header", "Authorization:${ONEXAI_AUTH}"],
"env": { "ONEXAI_AUTH": "Bearer 1xai-..." }
}
}
}Claude Desktop takes no key directly: the snippet runs the open-source mcp-remote@0.16.7 bridge with npx on your own computer (it needs Node.js). Restart Claude Desktop after saving the file. Any other client that speaks remote MCP over Streamable HTTP works with the URL and the header Authorization: Bearer 1xai-...; one that knows only an OAuth sign-in cannot connect. Every detail, from the protocol to the errors, is in the MCP server reference.
The API's rules, nothing more
- Connecting and the four read tools cost nothing.
- A chat is an ordinary API call: the same price, paid from plan credit first, then gift credit, then the wallet; its record is in the dashboard's logs.
- The key's scope, model list, address list, rate limit and spend cap all apply. An inference key never sees the account's balance or usage.
- For an app that should only read, make a usage key: even if it leaks, it cannot spend.
- A request from a web page is refused, and no tool fetches a URL or a file from outside.
Limits: 200 rows per model list, 90 days of usage, 64 messages and 16,384 output tokens per chat.
What is MCP?
MCP (the Model Context Protocol) is the common language AI apps such as Claude Code, Cursor and Claude Desktop use to connect to outside tools. 1xAi's MCP server gives the model inside those apps tools to see the models and their prices, estimate a cost, read your balance and usage, and chat with any model.
Does the MCP server cost anything?
Connecting and the four read tools (models, cost estimate, balance and usage) cost nothing. Only the chat tool is billed, like any API call: at the same price, from plan credit first, then gift credit, then the wallet.
Which apps does it work with?
Claude Code and Cursor connect directly. Claude Desktop connects through the open-source mcp-remote bridge, which runs on your own computer and needs Node.js. Any other app that speaks remote MCP over Streamable HTTP and can send an Authorization header works too; an app that knows only an OAuth sign-in cannot connect.
Is my key safe?
The key stays in your own app's settings, and every control you set on it applies. For an app that should only read, make a key with the usage scope; if the app chats, give its key a spend cap. Revoke the key from the dashboard whenever you like.
How is it different from the API?
The API is for a program you write. The MCP server is for when you work in a ready-made app such as Claude Code or Cursor and want the model inside it to see your 1xAi account. Both use one key and one wallet.
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.
- API documentation
The index of every docs topic: quickstart, auth, rate limits, errors, billing, models, endpoints, keys and teams.
- Changelog
What changed in the API and the product, release by release.
- Terms of Service
Billing, refunds, availability, liability and termination.
- Privacy Policy
What we collect, what never leaves, and what the model provider receives.
- Contact
Business enquiries, large top-ups, and anything the docs did not answer.
- Models and prices
Every callable model with live Toman rates, context windows and endpoints.
- Overview
What 1xAi is, who it is for, and what it costs — the English entry point.
- ChatGPT API from Iran
Whether the OpenAI API can be called from an Iranian network, and how.
- Claude API from Iran
Anthropic's Messages API from Iran, including the native passthrough route.
- OpenAI-compatible endpoint
The base URL, the auth header, every supported route, streaming and errors.
- Pricing
How billing works: list price plus a 15–30% markup by model, paid in Toman.
- Service status
Per-vendor success rates and latency from real traffic, with sample sizes, plus the raw dataset.
- Benchmark
The published latency figures, and an open script that times any OpenAI-compatible gateway with your own key.
- Service credit
The monthly success-rate commitment per vendor family, the credit tiers, and each closed month's measured rates.
- AI API providers in Iran compared
1xAi next to six Iranian AI API gateways, cell by cell, each cell with its source and the day it was read, and where others are ahead.
- AI tutor for the Konkur
The learning panel for Iran's university entrance exam, compared with Zerang, Andarz, ChatGPT and Gemini, with sources.