Guide

Migrate OpenAI to the EU Router

A practical step-by-step guide to move your existing OpenAI integration to the EU in minutes.

On this page

Why migrate to the EU Router

The EU Router is an OpenAI- and Anthropic-compatible inference gateway that runs open models on European GPUs. Your prompts and answers never leave the EU, there is no US cloud provider in the chain, and you pay per token from one prepaid credit balance. Because the API is drop-in compatible, nothing changes in your application code except the base URL and the API key.

What you need

  • A HostYourAI account with some credit
  • An API key in the hyai-... format, created under Router in your dashboard
  • Your existing OpenAI or Anthropic SDK, no new library to install
Je app
OpenAI · Anthropic
EU Router
één base URL
Qwen3-8B
warm
Loes (NL)
soeverein
Llama-3.3
warm

Step 1, Create an API key

In your dashboard, go to Router and create a new key. Copy the hyai- key right away; you only see it once. This key replaces your OpenAI key.

Step 2, Point your client at the Router

Set the base URL to https://hostyourai.com/api/v1 and use your HostYourAI key. In Python with the OpenAI SDK, the rest of your code is unchanged:

from openai import OpenAI

client = OpenAI(
    base_url="https://hostyourai.com/api/v1",
    api_key="hyai-...",   # your HostYourAI key
)

resp = client.chat.completions.create(
    model="llama-3.3-70b",
    messages=[{"role": "user", "content": "Summarise this contract."}],
)
print(resp.choices[0].message.content)

In Node.js with the same SDK:

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://hostyourai.com/api/v1",
  apiKey: process.env.HOSTYOURAI_API_KEY,
});

const resp = await client.chat.completions.create({
  model: "llama-3.3-70b",
  messages: [{ role: "user", content: "Summarise this contract." }],
});
console.log(resp.choices[0].message.content);

Or straight from curl to test quickly:

curl https://hostyourai.com/api/v1/chat/completions \
  -H "Authorization: Bearer hyai-..." \
  -H "Content-Type: application/json" \
  -d '{"model":"llama-3.3-70b","messages":[{"role":"user","content":"Hello"}]}'

Step 3, Pick an open model

Where you would use gpt-4o on OpenAI, pick an open model from the Model Garden here, for example a Llama, Qwen, Mistral or DeepSeek variant. Use the model slug exactly as it appears in the Model Garden as the value for model. Streaming works identically: set stream=True and you get server-sent events back.

Using the Anthropic SDK?

That works too. The Router exposes a /v1/messages shim. Set the base URL to https://hostyourai.com and pass your hyai- key as x-api-key:

from anthropic import Anthropic

client = Anthropic(
    base_url="https://hostyourai.com",
    api_key="hyai-...",
)

msg = client.messages.create(
    model="llama-3.3-70b",
    max_tokens=512,
    messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content[0].text)

Step 4, Verify and go live

Test your first request in the Playground or from your code and track usage, tokens and latency per request in your activity log. Two things to watch when migrating: model names differ (use open-model slugs, not gpt-*), and you pay per token instead of via an OpenAI subscription.

Need predictable performance?

The shared Router is ideal to start with. If you want isolation or guaranteed capacity, promote a model to a dedicated instance on your own EU GPU. Your code stays identical, only the model slug or endpoint changes.

Reference: what exactly changes

This table puts the settings side by side. For more background on the gateway itself, see the EU Inference Router page.

SettingOn OpenAIOn the EU Router
Base URLhttps://api.openai.com/v1https://hostyourai.com/api/v1
API keysk-...hyai-...
Modelgpt-4o, gpt-4o-miniOpen models such as Llama, Qwen, Mistral, DeepSeek or Gemma
Streamingstream=true, SSEIdentical, stream=true with server-sent events
Anthropic routeNot applicable/v1/messages shim, buffered streaming, text only
BillingSubscription or usage billingPay-as-you-go per token, see pricing

Troubleshooting

I get 401 Unauthorized

Check that your key starts with hyai- and was copied in full. An OpenAI key (sk-...) does not work on the Router. Create a fresh key under Router if needed.

My requests return 404 or never arrive

Almost always the base URL is wrong. It must be exactly https://hostyourai.com/api/v1. Make sure your SDK does not append another /v1 to the URL on its own.

The model responds slowly or seems unavailable

Not every model is permanently warm. The Model Garden shows per model whether it is warm or still warming up. Pick a warm model or wait a moment; after that, responses are fast as usual.

Streaming behaves differently through the Anthropic SDK

The /v1/messages shim uses buffered streaming and supports text only. If you need token-by-token streaming, use the OpenAI route on /api/v1/chat/completions.

Questions about this guide

Do I have to rewrite my application code?

No. You only change the base URL and the API key. Everything else, including streaming and the message structure, stays the same.

Which models can I use after migrating?

Open models such as Llama, Qwen, Mistral, DeepSeek and Gemma. The current catalogue with live status is in the Model Garden.

What does using the Router cost?

You pay per token, pay-as-you-go, from one prepaid credit balance, with no subscription. See the pricing page.

Does my data stay inside Europe?

Yes. The models run on GPUs in European datacenters and your prompts and answers never leave the EU.

Can I move to my own hardware later?

Yes. For isolation or guaranteed capacity, move a model to a dedicated GPU instance. Your key and base URL keep working.

Everything you need for AI

From model hosting to a customer-facing API, it is built for developers and businesses who want their AI running on infrastructure they actually control, inside the EU.

100%
EU-hosted

Your data and your models stay on European GPUs. GDPR-friendly by design.

200+
Verified models, ready to serve

Llama, Qwen, DeepSeek, Mistral, FLUX and plenty more. Pick one and it is warm in minutes, with no DevOps on your end.

2 SDK
OpenAI & Anthropic compatible

Point your existing client at the Router and keep your tools. No rewrite, no lock-in.

From zero to a warm endpoint in minutes

No infra to manage. Pick a model, get an OpenAI-compatible URL, ship.

1

Pick a model

Choose from the Model Garden or paste any HuggingFace ID. Set the VRAM and pick an EU GPU.

2

Get your endpoint

We deploy vLLM, run readiness probes, and hand you a warm OpenAI- and Anthropic-compatible URL plus an API key.

3

Route and ship

Point your client at the Router. It auto-routes to a warm instance, idles GPUs when nobody is online, and logs every request.

Works with the tools you already use

The Router speaks the OpenAI and Anthropic APIs, so it drops straight into the clients and SDKs your team already runs. Just change the base URL.

Try HostYourAI for free
docker
anthropic
huggingface
langchain
python
nodedotjs
curl
ollama
jetbrains
jupyter
vercel
zapier
postman
n8n

Built for teams that can't send data away

If a US cloud is off the table, HostYourAI gives you the same developer experience on European infrastructure.

Public sector & government

Citizen data that legally has to stay in the EU, with full auditability.

Regulated enterprise

Finance, healthcare and legal teams under GDPR, DORA and the AI Act.

EU SaaS & scale-ups

Ship AI features your customers trust, without a US sub-processor.

Agencies & integrators

Deliver private AI for clients on infrastructure you can stand behind.

Model garden

Works with 390+ open models

Text and image models on dedicated EU GPUs. Every model tested on our own hardware.

Related pages

Explore more about EU-hosted AI on HostYourAI.

Host. Route. Ship.

No credit card required. Pay as you go, cancel anytime.

Start Hosting Free Today