eurouter-integration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEUrouter Integration Guide
EUrouter集成指南
You are helping a developer integrate EUrouter into their application. EUrouter is a drop-in replacement for the OpenAI API, purpose-built for EU customers requiring GDPR compliance. It routes AI requests to 10 providers through a single OpenAI-compatible API at .
https://api.eurouter.aiSupported providers: OpenAI, Anthropic, Mistral, Scaleway (FR), GreenPT, Microsoft Foundry, Nebius, IONOS (DE), OVHcloud (FR), AWS Bedrock.
When helping developers, always load the relevant reference files from the directory in this skill folder based on what they need. Do not load all references at once.
references/您正在协助开发者将EUrouter集成到他们的应用程序中。EUrouter是OpenAI API的直接替代工具,专为需要GDPR合规的欧盟客户量身打造。它通过这个统一的OpenAI兼容API,将AI请求路由至10家提供商。
https://api.eurouter.ai支持的提供商: OpenAI、Anthropic、Mistral、Scaleway(法国)、GreenPT、Microsoft Foundry、Nebius、IONOS(德国)、OVHcloud(法国)、AWS Bedrock。
在协助开发者时,请根据他们的需求从当前技能文件夹的目录中加载相关参考文件,不要一次性加载所有参考文件。
references/Authentication
身份验证
EUrouter uses API keys in the format .
eur_<publicId>.<secret>Send the key via either header:
Authorization: Bearer eur_...x-api-key: eur_...
For organization-scoped requests, add:
x-org-id: <uuid>Keys are created via and the full key is shown only once at creation. It cannot be retrieved later.
POST /api/v1/keysEUrouter使用格式为的API密钥。
eur_<publicId>.<secret>可通过以下任一请求头发送密钥:
Authorization: Bearer eur_...x-api-key: eur_...
若要发送组织范围的请求,请添加:
x-org-id: <uuid>密钥通过创建,完整密钥仅在创建时显示一次,后续无法找回。
POST /api/v1/keysDrop-in Migration from OpenAI
从OpenAI无缝迁移
EUrouter is designed as a drop-in replacement. Only two things change:
Python (openai SDK):
python
from openai import OpenAIEUrouter被设计为直接替代工具,仅需修改两处内容:
Python(openai SDK):
python
from openai import OpenAIBefore (OpenAI direct)
之前(直接调用OpenAI)
client = OpenAI(api_key="sk-...")
client = OpenAI(api_key="sk-...")
After (EUrouter) — change base_url and api_key
之后(使用EUrouter)—— 修改base_url和api_key
client = OpenAI(
base_url="https://api.eurouter.ai/api/v1",
api_key="eur_YOUR_KEY_HERE"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
**Node.js (openai SDK):**
```typescript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.eurouter.ai/api/v1",
apiKey: "eur_YOUR_KEY_HERE",
});
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello!" }],
});Important: All existing OpenAI model names work as-is (e.g., , , ). No model name changes needed when migrating.
gpt-4oclaude-3-5-sonnetmistral-largeclient = OpenAI(
base_url="https://api.eurouter.ai/api/v1",
api_key="eur_YOUR_KEY_HERE"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
**Node.js(openai SDK):**
```typescript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.eurouter.ai/api/v1",
apiKey: "eur_YOUR_KEY_HERE",
});
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello!" }],
});重要提示: 所有现有OpenAI模型名称可直接使用(例如、、),迁移时无需修改模型名称。
gpt-4oclaude-3-5-sonnetmistral-largeCore Endpoints
核心端点
All endpoints are prefixed with . Base URL:
/apihttps://api.eurouter.ai| Endpoint | Method | Auth | Description |
|---|---|---|---|
| POST | Yes | Chat completions (streaming, tools, vision, audio, reasoning) |
| POST | Yes | Legacy text completions |
| POST | Yes | Text embeddings |
| POST | Yes | OpenAI Responses API compatible |
| GET | No | List/filter model catalog |
| GET | No | List available providers |
| GET | Yes | Check credit balance (EUR) |
| CRUD | Yes | Manage API keys |
| CRUD | Yes | Manage named routing configs |
| GET | No | Health check |
For full endpoint schemas, load .
references/endpoints.md所有端点均以为前缀,基础URL:
/apihttps://api.eurouter.ai| 端点 | 请求方法 | 需要身份验证 | 描述 |
|---|---|---|---|
| POST | 是 | 聊天补全(流式传输、工具调用、视觉、音频、推理) |
| POST | 是 | 传统文本补全 |
| POST | 是 | 文本嵌入 |
| POST | 是 | 兼容OpenAI Responses API |
| GET | 否 | 列出/筛选模型目录 |
| GET | 否 | 列出可用提供商 |
| GET | 是 | 查看信用余额(欧元) |
| CRUD | 是 | 管理API密钥 |
| CRUD | 是 | 管理命名路由配置 |
| GET | 否 | 健康检查 |
如需完整的端点架构,请加载。
references/endpoints.mdEU/GDPR Compliance
欧盟/GDPR合规
This is EUrouter's key differentiator. Add a object to any generation request to enforce compliance:
providerjson
{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello"}],
"provider": {
"data_residency": "eu",
"eu_owned": true,
"data_collection": "deny",
"max_retention_days": 0
}
}| Field | Type | Description |
|---|---|---|
| | Region code — |
| | Only EU-headquartered providers (Scaleway, IONOS, OVHcloud, GreenPT, Mistral) |
| | |
| | Max data retention. |
Ready-to-use compliance profiles:
json
// Strict GDPR: EU owned, no training data, zero retention, EU hosted
{ "eu_owned": true, "data_collection": "deny", "max_retention_days": 0, "data_residency": "eu" }
// EU hosted, cheapest price
{ "data_residency": "eu", "sort": "price" }
// Specific EU providers only
{ "only": ["scaleway", "ionos", "ovhcloud"] }For all provider preference fields, load .
references/provider-preferences.md这是EUrouter的核心差异化优势。在任何生成请求中添加对象即可强制合规:
providerjson
{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello"}],
"provider": {
"data_residency": "eu",
"eu_owned": true,
"data_collection": "deny",
"max_retention_days": 0
}
}| 字段 | 类型 | 描述 |
|---|---|---|
| | 地区代码 — |
| | 仅选择欧盟总部的提供商(Scaleway、IONOS、OVHcloud、GreenPT、Mistral) |
| | |
| | 最大数据保留天数, |
即用型合规配置文件:
json
// 严格GDPR合规:欧盟所有、不用于训练数据、零保留、欧盟托管
{ "eu_owned": true, "data_collection": "deny", "max_retention_days": 0, "data_residency": "eu" }
// 欧盟托管、价格最优
{ "data_residency": "eu", "sort": "price" }
// 仅指定欧盟提供商
{ "only": ["scaleway", "ionos", "ovhcloud"] }如需查看所有提供商偏好字段,请加载。
references/provider-preferences.mdModel Fallback
模型降级回退
Pass a array to try multiple models in order. If all providers for the first model fail, EUrouter tries the next:
modelsjson
{
"models": ["claude-3-5-sonnet", "gpt-4o", "mistral-large"],
"messages": [{"role": "user", "content": "Hello"}],
"provider": { "data_residency": "eu" }
}Note: Model fallback is NOT supported for embeddings (vector dimensions differ between models). Only provider fallback (same model, different provider endpoint) works for embeddings.
传入数组可按顺序尝试多个模型。如果第一个模型的所有提供商都请求失败,EUrouter会尝试下一个模型:
modelsjson
{
"models": ["claude-3-5-sonnet", "gpt-4o", "mistral-large"],
"messages": [{"role": "user", "content": "Hello"}],
"provider": { "data_residency": "eu" }
}注意: 模型降级回退不适用于嵌入(不同模型的向量维度不同),嵌入仅支持提供商降级回退(同一模型,不同提供商端点)。
Routing Rules
路由规则
Create reusable routing configurations to avoid repeating provider preferences on every request:
json
// Create a rule once:
// POST /api/v1/routing-rules
{
"name": "gdpr-strict",
"provider": {
"eu_owned": true,
"data_collection": "deny",
"max_retention_days": 0,
"data_residency": "eu"
}
}
// Then reference it by name:
{
"model": "gpt-4o",
"rule_name": "gdpr-strict",
"messages": [{"role": "user", "content": "Hello"}]
}You can also reference by UUID with . Per-request preferences merge with the rule — request-level values take precedence.
rule_idproviderDry-run testing: Use to preview which providers satisfy a routing config without making a real request.
POST /api/v1/routing-rules/dry-runFor full routing rules API, load .
references/routing-rules.md创建可复用的路由配置,避免在每个请求中重复设置提供商偏好:
json
// 一次性创建规则:
// POST /api/v1/routing-rules
{
"name": "gdpr-strict",
"provider": {
"eu_owned": true,
"data_collection": "deny",
"max_retention_days": 0,
"data_residency": "eu"
}
}
// 之后通过名称引用:
{
"model": "gpt-4o",
"rule_name": "gdpr-strict",
"messages": [{"role": "user", "content": "Hello"}]
}您也可以通过UUID使用引用。请求级别的偏好会与规则合并,且请求级别的值优先级更高。
rule_idprovider试运行测试: 使用可预览哪些提供商符合路由配置,无需发起真实请求。
POST /api/v1/routing-rules/dry-run如需完整的路由规则API,请加载。
references/routing-rules.mdModel Discovery
模型发现
GET /api/v1/models
GET /api/v1/models?provider=scaleway
GET /api/v1/models?supported_parameters=tools,vision
GET /api/v1/models?category=embeddingPrices are returned as strings in the model's object with a field. Credits are in EUR.
pricingcurrencyGET /api/v1/models
GET /api/v1/models?provider=scaleway
GET /api/v1/models?supported_parameters=tools,vision
GET /api/v1/models?category=embedding价格会在模型的对象中以字符串形式返回,并包含字段,信用额度以欧元为单位。
pricingcurrencyResponse Headers
响应头
Every generation endpoint returns routing transparency headers:
| Header | Description |
|---|---|
| Internal provider UUID |
| Provider name (e.g., |
| Strategy used for routing |
| Actual model slug used |
| Variant suffix if applicable ( |
| Number of provider fallbacks (only present if > 0) |
| Number of model fallbacks (only present if > 0) |
每个生成端点都会返回路由透明性头信息:
| 响应头 | 描述 |
|---|---|
| 提供商内部UUID |
| 提供商名称(例如 |
| 所使用的路由策略 |
| 实际使用的模型标识 |
| 模型变体后缀(如有,例如 |
| 提供商降级回退次数(仅当次数>0时返回) |
| 模型降级回退次数(仅当次数>0时返回) |
Streaming
流式传输
Set for SSE streaming. Format is OpenAI-compatible:
"stream": truedata: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"delta":{"content":"Hello"},"index":0,"finish_reason":null}]}
data: [DONE]For usage stats in the final chunk, add .
"stream_options": { "include_usage": true }设置即可启用SSE流式传输,格式与OpenAI兼容:
"stream": truedata: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"delta":{"content":"Hello"},"index":0,"finish_reason":null}]}
data: [DONE]如需在最终分块中返回使用统计信息,请添加。
"stream_options": { "include_usage": true }Error Format
错误格式
All errors follow:
json
{
"error": {
"code": "NOT_FOUND",
"message": "Model not found"
},
"requestId": "uuid"
}Key error codes: (401), (403), (404), (400), (402), (503).
UNAUTHORIZEDFORBIDDENNOT_FOUNDBAD_REQUESTINSUFFICIENT_QUOTASERVICE_UNAVAILABLE所有错误均遵循以下格式:
json
{
"error": {
"code": "NOT_FOUND",
"message": "Model not found"
},
"requestId": "uuid"
}主要错误代码:(401)、(403)、(404)、(400)、(402)、(503)。
UNAUTHORIZEDFORBIDDENNOT_FOUNDBAD_REQUESTINSUFFICIENT_QUOTASERVICE_UNAVAILABLEReference Files
参考文件
Load these based on the developer's specific need:
| Need | File |
|---|---|
| Full endpoint request/response schemas | |
| All provider routing preference fields | |
| Routing rules CRUD + dry-run API | |
| Python code examples (openai SDK) | |
| Node.js/TypeScript code examples | |
| curl examples | |
根据开发者的具体需求加载以下文件:
| 需求 | 文件 |
|---|---|
| 完整的端点请求/响应架构 | |
| 所有提供商路由偏好字段 | |
| 路由规则CRUD及试运行API | |
| Python代码示例(openai SDK) | |
| Node.js/TypeScript代码示例 | |
| curl示例 | |