Skip to main content
Docs
Client Libraries

Client Libraries

Use any OpenAI client library against the Elyxir API.

There is no separate Elyxir SDK to install. The API is OpenAI-compatible, so you use your language's official OpenAI client and change two things: the base URL and the key.

JavaScript / TypeScript

Bun

bun add openai

npm / Node.js

npm install openai

Usage

import OpenAI from "openai";
 
const client = new OpenAI({
  apiKey: "your-elyxir-api-key",
  baseURL: "https://api.elyxir.ai/v1",
});
 
const response = await client.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Hello!" }],
});
 
console.log(response.choices[0].message.content);

Python

pip install openai

Usage

from openai import OpenAI
 
client = OpenAI(
    api_key="your-elyxir-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)

Getting Your API Key

  1. Go to Settings > API Keys in Studio
  2. Click Create Key
  3. Copy the key and store it securely — it is shown once

Or provision one programmatically with the API keys endpoint.

What carries over from OpenAI, and what doesn't

Chat completions, streaming, tool calling, vision and the Responses API all behave as they do against OpenAI. Two things differ:

  • No /v1/completions or /v1/embeddings. The legacy completions helpers in the OpenAI SDKs will not work. Use chat completions instead.
  • Model IDs are ours. Pass any model from GET /v1/models — including models from Anthropic, Google and others — or elyxir-alvin to let Alvin route.
Client Libraries | Alvin