API Overview
The Elyxir API provides OpenAI-compatible endpoints for chat completions, completions, and embeddings.
The Elyxir API is an OpenAI-compatible interface that gives you programmatic access to 2,000+ AI models. Use your existing OpenAI SDKs with minimal changes.
Base URL
https://api.elyxir.ai
Endpoints
| Endpoint | Method | Description |
|---|---|---|
/v1/chat/completions | POST | Chat completions (recommended) |
/v1/completions | POST | Text completions |
/v1/embeddings | POST | Text embeddings |
Quick Start
curl -X POST https://api.elyxir.ai/v1/chat/completions \
-H "Authorization: Bearer elyxir_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'OpenAI SDK Compatibility
Use the official OpenAI SDK with Elyxir:
from openai import OpenAI
client = OpenAI(
api_key="elyxir_your_api_key",
base_url="https://api.elyxir.ai/v1"
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)Authentication
All API requests require a Bearer token in the Authorization header:
Authorization: Bearer elyxir_your_api_key
Get your API key from Studio Settings > API Keys.
Learn more about authentication
Request Format
All requests should:
- Use
POSTmethod - Include
Content-Type: application/jsonheader - Include
Authorization: Bearer <token>header - Send JSON body with required parameters
Response Format
Successful responses return JSON with the standard OpenAI format:
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1234567890,
"model": "gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 15,
"total_tokens": 25
}
}Error Responses
Errors return appropriate HTTP status codes with JSON details:
{
"error": {
"message": "Invalid API key",
"type": "authentication_error",
"code": "invalid_api_key"
}
}Learn more about error handling
Rate Limits
Rate limits depend on your subscription tier and can be configured per virtual key:
| Tier | Requests/min | Tokens/min |
|---|---|---|
| Free | 20 | 40,000 |
| Standard | 100 | 200,000 |
| Premium | 500 | 1,000,000 |
| Enterprise | Custom | Custom |
Interactive Documentation
Explore the API interactively at api.elyxir.ai with Swagger UI:
- Browse endpoints
- Try requests directly
- View request/response schemas