OpenAI SDKs
Use EUrouter with the official OpenAI JavaScript and Python SDKs.
EUrouter implements the OpenAI-compatible chat completions API. Point an OpenAI SDK at EUrouter's base URL and keep the rest of your integration familiar.
Install the SDK:
npm install openaiThen create a client:
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.EUROUTER_API_KEY,
baseURL: "https://api.eurouter.ai/api/v1",
});
const response = await client.chat.completions.create({
model: "mistral-large-3",
messages: [{ role: "user", content: "Why is the sky blue?" }],
});
console.log(response.choices[0].message.content);Install the SDK:
pip install openaiThen create a client:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["EUROUTER_API_KEY"],
base_url="https://api.eurouter.ai/api/v1",
)
response = client.chat.completions.create(
model="mistral-large-3",
messages=[{"role": "user", "content": "Why is the sky blue?"}],
)
print(response.choices[0].message.content)Keep API keys on the server. Never expose one in browser or mobile application code.
What changes from OpenAI?
- Set
baseURLorbase_urltohttps://api.eurouter.ai/api/v1. - Use a model ID from the live model catalog.
- Use an EUrouter API key created in the dashboard.
Most chat-completions parameters work without other changes. Provider routing
controls are available through the request's provider field.