Skip to main content
Docs
API Overview

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

EndpointMethodDescription
/v1/chat/completionsPOSTChat completions (recommended)
/v1/completionsPOSTText completions
/v1/embeddingsPOSTText 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 POST method
  • Include Content-Type: application/json header
  • 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:

TierRequests/minTokens/min
Free2040,000
Standard100200,000
Premium5001,000,000
EnterpriseCustomCustom

Interactive Documentation

Explore the API interactively at api.elyxir.ai with Swagger UI:

  • Browse endpoints
  • Try requests directly
  • View request/response schemas

API Reference

API Overview | elyxir