Guides · Migrate from OpenAI
Migrating from OpenAI to the inference.eu API: a practical guide
If your application already uses the OpenAI API, moving to open-weight models processed in European data centres is mostly a configuration change. This guide covers the three lines you change, how to pick replacement models, which features to test before you switch production traffic, and how to roll the change out without surprises.
- 01API format: OpenAI
- 02EU data centres
- 03Covered by one DPA
import os
from openai import OpenAI
# Before: client = OpenAI() # api.openai.com, OPENAI_API_KEY
client = OpenAI(
base_url="https://api.inference.eu/v1",
api_key=os.environ["INFERENCE_EU_API_KEY"],
)
reply = client.chat.completions.create(
model="gpt-oss-120b", # was "gpt-4o"
messages=[{"role": "user", "content": "Draft a polite reminder for an unpaid invoice."}],
)
print(reply.choices[0].message.content)The three changes
Point the client at the inference.eu base URL, use your inference.eu key, and change the model name. In the OpenAI Python and JavaScript SDKs that means passing base_url (or baseURL) and api_key when you create the client, or setting the OPENAI_BASE_URL and OPENAI_API_KEY environment variables, which the SDKs read automatically.
Everything else stays: the same SDK version, the same client.chat.completions.create and client.responses.create calls, the same streaming loop and the same error classes. Frameworks such as LangChain, LlamaIndex, the Vercel AI SDK and the OpenAI Agents SDK take the same two settings. Keep the model id in configuration, so the migration is a deployment setting you can roll back.
Choosing replacement models
Map each use to a model rather than looking for one model that replaces everything. For general chat and agent work, a large open model such as gpt-oss-120b is a common starting point. For high-volume classification or extraction, a smaller and faster model often does the job. For embeddings, qwen3-embedding-8b covers multilingual text, and whisper-large-v3-turbo replaces OpenAI's transcription models.
Embeddings are the one place where you cannot mix: vectors from OpenAI models are not comparable with vectors from open models, so re-embed your collection with the new model before you switch search over. Run the batch API for that, then swap the index in one step.
What to test before switching
Build a small evaluation set from real traffic: 50 to 200 prompts with the answers you consider good. Run it against the old and the new setup and compare quality, length and format, not just whether the request succeeds.
Check the features you rely on. Tool calling should produce the same function names and valid arguments. Structured outputs should pass your JSON schema. Streaming should end with a final chunk and usage. Vision prompts need a vision-capable model. Prompts tuned heavily for one model sometimes need small edits, such as a clearer instruction about output format or language, to get the best from another.
Rolling out and edge cases
Move traffic gradually. Send a small share of requests to inference.eu, compare error rates and user feedback, then increase. Because the request format is the same, a feature flag that chooses the base URL and model is usually enough.
Some OpenAI-only features have no direct equivalent: OpenAI's own model names, its hosted assistants and vector stores, and settings tied to specific OpenAI models. Fields a model does not support are ignored or rejected with a clear 400 error, so watch your logs during the first days. Check rate limits for your plan before moving peak traffic, and ask us to raise them in good time.
Migrate from OpenAI: common questions
The questions buyers, developers and legal teams ask us most. Something missing? Ask us directly.
Related
- Chat completionsSend chat messages to open-weight models with the OpenAI chat completions format. Requests are processed in EU data centres and never used for training.Endpoints
- List modelsList the open-weight models your inference.eu key can use with GET /v1/models, in the OpenAI format. Pick model ids for chat, embeddings, speech and more.Endpoints
- Rate limits and errorsHow rate limits and errors work on the inference.eu API. HTTP status codes, the error object, rate-limit headers and a retry pattern that holds up.Guides
- Structured outputsGet valid JSON that matches your schema from open models with OpenAI-compatible structured outputs. JSON mode, json_schema, strict mode and pitfalls.Guides
Move your AI workloads to EU infrastructure
Tell us which models you use and roughly how much traffic you have. We reply within one working day with pricing and next steps.
- Reply within one working day
- Pricing for your volume
- DPA ready to sign