What is OpenAI SDK?
The OpenAI SDK is the official client library for accessing OpenAI's API. It's available for Python and Node.js and covers chat completions, embeddings, image generation, function calling, and structured outputs. If you've built anything with GPT-4o, GPT-4, or GPT-3.5, you've probably used it.
The SDK has a `base_url` parameter that lets you point requests at any OpenAI-compatible endpoint. That's what makes it work with EUrouter: you change one line, and your requests flow through EU infrastructure instead of going directly to OpenAI's US servers. Your code, your prompts, your response handling, all of it stays exactly the same.
Quick to integrate
A few lines of code is all it takes. Swap your base URL and you are routed through EUrouter.
1from openai import OpenAI
2
3client = OpenAI(
4 api_key="eur-...",
5 base_url="https://api.eurouter.ai/v1",
6)
7
8response = client.chat.completions.create(
9 model="gpt-4o",
10 messages=[{"role": "user", "content": "Hello"}],
11)
12print(response.choices[0].message.content)Get started in minutes
Follow these steps to connect your application to EUrouter.
Install the OpenAI SDK
Install the official OpenAI package for Python or Node.js.
1pip install openaiSet the base URL
Point the client to EUrouter by adding the base_url parameter.
1from openai import OpenAI
2
3client = OpenAI(
4 api_key="eur-...",
5 base_url="https://api.eurouter.ai/v1",
6)Use it like normal
Call completions, embeddings, or any other endpoint. Requests route through EU infrastructure automatically.
1response = client.chat.completions.create(
2 model="gpt-4o",
3 messages=[{"role": "user", "content": "Hello"}],
4)
5print(response.choices[0].message.content)Why use OpenAI SDK with EUrouter
One-line migration
The OpenAI SDK already has a base_url parameter. Set it to EUrouter and every call goes through EU infrastructure. No wrappers, no monkey-patching, no forked SDK to maintain.
- Works with Python, Node.js, and any language with an OpenAI-compatible client
- Chat completions, embeddings, image generation, and structured outputs all supported
- Streaming, function calling, and tool use work without any changes
- You can also set the OPENAI_BASE_URL environment variable instead of changing code
Access every model through one key
With EUrouter, one API key gives you access to OpenAI, Anthropic, Mistral, and more. You switch models by changing the model parameter. No separate accounts, no extra API keys, no juggling billing dashboards.
- Switch between GPT-4o, Claude, Mistral, and others by changing the model string
- One API key, one bill, one dashboard for all your model usage
- Smart routing can automatically pick the best provider for each request
- Try new models without signing up for another service
EU data residency built in
Your prompts and completions pass through EUrouter servers hosted in the EU. For teams subject to GDPR, this matters: you can prove that no data processing happened outside European jurisdiction.
- All traffic routed through EU-based servers
- Compliant with GDPR Article 44 requirements on data transfers
- No US data processing for European workloads
- Full audit trail available for compliance reporting and DPO reviews