abr5 Docs
The abr5 AI Gateway uses request and response formats compatible with OpenAI. If you have worked with the official OpenAI library, just change base_url and replace the key.
Full platform docs, the cloud service, and all products in Persian at docs.abr5.com . This page is only the API reference for the AI gateway.
Quickstart
1) Create an account and use the Account panel to get an API key. 2) Set the base URL to abr5. 3) Send your first request.
curl https://llm.abr5.com/v1/chat/completions \
-H "Authorization: Bearer $ABR5_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "abr5-chat",
"messages": [{"role": "user", "content": "سلام!"}]
}'
from openai import OpenAI
client = OpenAI(
base_url="https://llm.abr5.com/v1",
api_key="abr5_...",
)
res = client.chat.completions.create(
model="abr5-chat",
messages=[{"role": "user", "content": "سلام!"}],
)
print(res.choices[0].message.content)
Authentication
All requests must include the header Authorization on every request. Create the key in the account panel and protect it like a password; never put the key in browser-side code.
Authorization: Bearer abr5_xxxxxxxxxxxxxxxx
Base URL: https://llm.abr5.com/v1
Endpoints
| Method | Path | Usage |
|---|---|---|
| POST | /v1/chat/completions | Chat and text generation |
| POST | /v1/embeddings | Text to embeddings |
| GET | /v1/models | List of available models |
| GET | /v1/usage | Account quota usage |
Streaming responses
By setting stream: true The response comes back in chunks. In the browser, use fetch and ReadableStream for that.
const res = await fetch("https://llm.abr5.com/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer abr5_..."
},
body: JSON.stringify({
model: "abr5-chat",
stream: true,
messages: [{ role: "user", content: "سلام!" }]
})
});
Error codes
| Code | Meaning | Action |
|---|---|---|
| 401 | Invalid or expired key | Regenerate the key in the account panel |
| 403 | Access to the model or service is not permitted | Check your account plan |
| 429 | Rate limit exceeded | Retry with exponential backoff |
| 500 | Temporary server error | Status page for details. |
Libraries
The official OpenAI libraries and any tool where base_url can be configured will work:
- Python:
pip install openai - Node.js:
npm i openai - Any HTTP client that supports the header
Authorization
Support
If you see an unexpected error, include the request ID (x-request-id) and the error text to info@abr5.com and send it. For enterprise sales matters, use sales@abr5.com for that.