The DeepFA AI API,
OpenAI-compatible
GPT, Claude, Gemini, Grok and DeepSeek behind one address and one key. Because the API is exactly the OpenAI standard, the libraries and tools you already have — the official Python and JavaScript clients, VS Code extensions, Cursor — connect to DeepFA by changing one base URL, and run on rial credit.
Change one URL and it works everywhere
OpenAI-compatible means the request and response shape of our API is exactly the OpenAI standard — not that we only serve OpenAI models. So anything built for OpenAI — your own code, a server, a mobile app, an automation, the VS Code extensions, Cursor — connects by changing one base URL and runs GPT, Claude, Gemini, Grok and DeepSeek on a rial-denominated balance.
curl https://deepfa.ir/api/v1/chat/completions \ -H "Authorization: Bearer $DEEPFA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.4-mini", "messages": [{"role": "user", "content": "سلام"}] }'
from openai import OpenAI client = OpenAI( api_key="YOUR_DEEPFA_KEY", base_url="https://deepfa.ir/api/v1", ) answer = client.chat.completions.create( model="claude-sonnet-5", messages=[{"role": "user", "content": "سلام"}], ) print(answer.choices[0].message.content)
import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_DEEPFA_KEY", baseURL: "https://deepfa.ir/api/v1", }); const answer = await client.chat.completions.create({ model: "gemini-3-flash-preview", messages: [{ role: "user", content: "سلام" }], });
The endpoints
| POST | /chat/completions | Chat, with streaming and tool calling |
| GET | /models | The models your key may call |
| POST | /embeddings | Text to vectors, for search |
| POST | /images/generations | Image generation |
| POST | /audio/transcriptions | Speech to text |
| POST | /audio/speech | Text to speech |
Chat and embeddings spend writing credits, images spend media credits, transcription spends minutes and speech spends characters. What each call cost is returned in a response header and listed on your usage page.
What each model costs
Per million tokens. The same work can cost twenty times more on one model than another, so it is worth reading before you choose one.
| Model | Input | Output | 1M in + 1M out |
|---|---|---|---|
| text-embedding-3-small openai | 400,000 | 0 | 0.0261 USD |
| text-embedding-3-large openai | 2,600,000 | 0 | 0.17 USD |
| gpt-5.4-nano openai | 1,000,000 | 8,000,000 | 0.59 USD |
| gpt-4.1-nano openai | 2,000,000 | 8,000,000 | 0.65 USD |
| gpt-4o-mini openai | 3,000,000 | 12,000,000 | 0.98 USD |
| gpt-4o-mini-search-preview openai | 3,000,000 | 12,000,000 | 0.98 USD |
| deepseek-chat deepseek | 5,000,000 | 22,000,000 | 1.76 USD |
| gpt-5.6-luna openai | 4,000,000 | 24,000,000 | 1.82 USD |
| gemini-3.1-flash-lite google | 5,000,000 | 30,000,000 | 2.28 USD |
| deepseek-v4-flash deepseek | 9,000,000 | 26,000,000 | 2.28 USD |
| sonar perplexity | 20,000,000 | 20,000,000 | 2.61 USD |
| gpt-5.4-mini openai | 5,000,000 | 40,000,000 | 2.93 USD |
| deepseek-reasoner deepseek | 11,000,000 | 44,000,000 | 3.58 USD |
| gemini-2.5-flash google | 6,000,000 | 50,000,000 | 3.65 USD |
| gemini-3-flash-preview google | 6,000,000 | 50,000,000 | 3.65 USD |
| deepseek-v4-pro deepseek | 26,000,000 | 79,000,000 | 6.84 USD |
| o4-mini openai | 22,000,000 | 88,000,000 | 7.17 USD |
| sonar-reasoning perplexity | 20,000,000 | 100,000,000 | 7.82 USD |
| claude-haiku-4-5 anthropic | 20,000,000 | 100,000,000 | 7.82 USD |
| gemini-3.7-flash google | 30,000,000 | 150,000,000 | 11.73 USD |
| gemini-3.8-flash google | 30,000,000 | 150,000,000 | 11.73 USD |
| sonar-reasoning-pro perplexity | 40,000,000 | 160,000,000 | 13.03 USD |
| o3 openai | 40,000,000 | 160,000,000 | 13.03 USD |
| gemini-2.5-pro google | 25,000,000 | 200,000,000 | 14.66 USD |
| gpt-5.2 openai | 25,000,000 | 200,000,000 | 14.66 USD |
| gpt-5.3-codex openai | 25,000,000 | 200,000,000 | 14.66 USD |
| gpt-5.4 openai | 25,000,000 | 200,000,000 | 14.66 USD |
| gpt-4o-search-preview openai | 50,000,000 | 200,000,000 | 16.29 USD |
| gemini-3-pro-preview google | 40,000,000 | 240,000,000 | 18.24 USD |
| gemini-3.1-pro-preview google | 40,000,000 | 240,000,000 | 18.24 USD |
| gpt-5.6-terra openai | 40,000,000 | 240,000,000 | 18.24 USD |
| sonar-pro perplexity | 60,000,000 | 300,000,000 | 23.45 USD |
| claude-sonnet-4-6 anthropic | 60,000,000 | 300,000,000 | 23.45 USD |
| claude-sonnet-5 anthropic | 60,000,000 | 300,000,000 | 23.45 USD |
| gpt-5.6-sol openai | 80,000,000 | 400,000,000 | 31.27 USD |
| claude-opus-4-7 anthropic | 100,000,000 | 500,000,000 | 39.09 USD |
| claude-opus-5 anthropic | 100,000,000 | 500,000,000 | 39.09 USD |
| claude-opus-4-8 anthropic | 100,000,000 | 500,000,000 | 39.09 USD |
| gpt-5.5 openai | 100,000,000 | 600,000,000 | 45.60 USD |
| claude-fable-5 anthropic | 200,000,000 | 1,000,000,000 | 78.18 USD |
| gpt-6-astra openai | 200,000,000 | 1,000,000,000 | 78.18 USD |
| gpt-5.2-pro openai | 300,000,000 | 2,400,000,000 | 176 USD |
The input and output columns are credits per million tokens. The last column is the same amount in US dollars, priced from the cheapest API pack.
| Model | Unit | Credits | USD |
|---|---|---|---|
| gpt-image-1 Images | per image | 25 | 0.33 |
| dall-e-3 Images | per image | 4 | 0.052 |
| dall-e-2 Images | per image | 2 | 0.026 |
| tts-1 Text to speech | per 1,000 characters | 1,000 | 0.0195 |
| tts-1-hd Text to speech | per 1,000 characters | 2,000 | 0.039 |
| gpt-4o-mini-tts Text to speech | per 1,000 characters | 1,000 | 0.0195 |
| whisper-1 Transcription | per minute | 1 | 0.0078 |
| gpt-4o-transcribe Transcription | per minute | 1 | 0.0078 |
| gpt-4o-mini-transcribe Transcription | per minute | 0.5 | 0.0039 |
Images spend media credits, speech spends characters and transcription spends minutes. Each has its own API pack, and the dollar column is priced from the cheapest pack of that unit.
In your editor
{ "models": [{ "title": "DeepFA", "provider": "openai", "model": "claude-sonnet-5", "apiKey": "YOUR_DEEPFA_KEY", "apiBase": "https://deepfa.ir/api/v1" }] }
"github.copilot.chat.customOAIModels": [{ "modelId": "claude-sonnet-5", "displayName": "DeepFA Claude Sonnet 5", "endpoint": "https://deepfa.ir/api/v1", "apiKey": "YOUR_DEEPFA_KEY" }]
# Settings → Models → OpenAI API Base URL: https://deepfa.ir/api/v1 API Key: YOUR_DEEPFA_KEY Model: gpt-5.4 / claude-sonnet-5
Provider: OpenAI Compatible Base URL: https://deepfa.ir/api/v1 API Key: YOUR_DEEPFA_KEY Model ID: claude-sonnet-5
You create and revoke keys from your own dashboard, and can put a daily and a monthly credit ceiling on each one.
An OpenAI-compatible gateway, for developers and businesses
The DeepFA AI API is a gateway that speaks the OpenAI standard: the same /v1/chat/completions path, the same request body, the same response shape and the same error format. Any library, extension or service that works with OpenAI today connects to DeepFA by changing the base URL and the key — no rewrite, no bespoke SDK, no new contract to learn. Behind that one address sit GPT, Claude, Gemini, Grok and DeepSeek models, and switching between them means changing one string in the model field.
Beyond chat, the same address serves embeddings for semantic search and RAG, image generation, speech-to-text and text-to-speech. SSE streaming, tool calling, structured output and image input are all supported and behave exactly as they do upstream. The cost of every call comes back in a response header and is recorded on the API page of your dashboard, broken down by key and by model — failed requests included, so your credit is never a black hole.
For a developer in Iran the difference that matters most is payment: credit is bought in rial through a local gateway, no international card is needed, and bought credit never expires. Each key can carry a daily and monthly credit ceiling, a per-minute request limit and an allow-list of models, so a key handed to a script or a colleague cannot empty the account — and can be revoked in one click if it leaks.
Why the DeepFA AI API?
Built with developer needs in focus — easy to start, secure to use and scalable for growth.
OpenAI-compatible
The same paths, the same request body, the same response shape. The official OpenAI libraries and anything built on them connect to DeepFA by changing one base URL.
One key, every vendor
GPT, Claude, Gemini, Grok and DeepSeek behind one key and one address. Switching model means changing one string, not changing libraries, accounts and invoices.
Streaming, tools and vision
Token-by-token SSE streaming, tool calling, structured output and image input — none of it needing a change to code you have already written.
A spending ceiling per key
Set a daily and monthly ceiling, a per-minute request limit and an allow-list of models on each key. A key you hand to a script cannot empty the account.
What every call cost
The cost of each request comes back in a response header and is recorded on your usage page by key and by model — failures included. Your credit is not a black hole.
Pay in rial, no foreign card
Buy credit through a local gateway, and bought credit never expires. No international card, nothing to work around.
The endpoints you can call
All under one base URL, all with the same key, all in the request and response shape you know from OpenAI.
Quick Start in 6 Programming Languages
The same request in six languages. The only things that differ from OpenAI are the base URL and the key.
curl https://deepfa.ir/api/v1/chat/completions \
-H "Authorization: Bearer $DEEPFA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"messages": [{"role": "user", "content": "Hello"}]
}'
# pip install openai
from openai import OpenAI
client = OpenAI(
api_key="YOUR_DEEPFA_KEY",
base_url="https://deepfa.ir/api/v1",
)
completion = client.chat.completions.create(
model="claude-sonnet-5",
messages=[{"role": "user", "content": "Hello"}],
)
print(completion.choices[0].message.content)
print(completion.usage.total_tokens, "tokens")
// Any fetch, no SDK needed.
const res = await fetch('https://deepfa.ir/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${DEEPFA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'gpt-5.4',
messages: [{ role: 'user', content: 'Hello' }],
stream: false
})
});
const data = await res.json();
console.log(data.choices[0].message.content);
// What the call cost, straight off the response header.
console.log(res.headers.get('x-deepfa-credits'), 'credits');
// npm install openai
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.DEEPFA_API_KEY,
baseURL: 'https://deepfa.ir/api/v1'
});
// Streaming works exactly as it does upstream.
const stream = await client.chat.completions.create({
model: 'gemini-3.8-flash',
messages: [{ role: 'user', content: 'Write a haiku' }],
stream: true
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}
<?php
$ch = curl_init('https://deepfa.ir/api/v1/chat/completions');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('DEEPFA_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'model' => 'deepseek-chat',
'messages' => [['role' => 'user', 'content' => 'Hello']],
]),
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $result['choices'][0]['message']['content'];
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]any{
"model": "claude-haiku-4-5",
"messages": []map[string]string{
{"role": "user", "content": "Hello"},
},
})
req, _ := http.NewRequest("POST",
"https://deepfa.ir/api/v1/chat/completions",
bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("DEEPFA_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
var out map[string]any
json.NewDecoder(res.Body).Decode(&out)
fmt.Println(out["choices"])
}
{
"id": "chatcmpl-9f2c1a",
"object": "chat.completion",
"model": "claude-sonnet-5",
"choices": [{
"index": 0,
"message": { "role": "assistant", "content": "Hello!" },
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 306,
"total_tokens": 318
}
}
data: {"id":"chatcmpl-9f2c1a","object":"chat.completion.chunk",
"choices":[{"delta":{"content":"Hel"},"index":0}]}
data: [DONE]
{
"object": "list",
"model": "text-embedding-3-small",
"data": [{ "object": "embedding", "index": 0,
"embedding": [0.0021, -0.0134, 0.0075] }],
"usage": { "prompt_tokens": 8, "total_tokens": 8 }
}
{
"created": 1788115200,
"data": [{ "url": "https://.../img_x7k2m.png" }]
}
x-deepfa-request-id: 3f9a1c2e-... x-deepfa-credits: 318 x-deepfa-credit-unit: tokens
{
"error": {
"message": "You have run out of credit.",
"type": "insufficient_quota",
"param": null,
"code": "insufficient_quota"
}
}
Send your first request in four simple steps
From creating a key to the first answer in under a minute. No app registration, no OAuth dance.
Create an API key
Sign in, open the API page and create a key. The key is shown once, so copy it there and then.
Point the base URL at DeepFA
In whatever tool or library you already use, set the base URL to https://deepfa.ir/api/v1 and paste the key as the API key.
Choose a model
Put the model name in the same model field — claude-sonnet-5, gpt-5.4, gemini-3.8-flash or any other your key allows.
Watch what it costs
The cost of each call comes back in the x-deepfa-credits header and is recorded on the API page by key and by model.
A Look Inside the API Interface
Simple and practical interface — click any image to enlarge.
Frequently Asked Questions About the DeepFA AI API
Answers to common developer questions about using the API — contact support if you don't find your answer.
Get Your API Key and Start Building Today
Free sign-up, a key in seconds, and credit that never expires