EU GPT logo
EU GPT

Public preview — This API is in public preview. Endpoints, schemas, and limits may change before general availability.

API

Using the OpenAI SDK

Point the official `openai` SDK at EU GPT and reuse your existing code.

There is no EU GPT-specific SDK. The official OpenAI SDKs already speak the Responses API, and EU GPT implements it — so configuration is one line.

Install the SDK#

npm install openai
bun add openai
pip install openai
uv add openai

Configure the base URL#

Override baseURL (JS) / base_url (Python) to point at the EU GPT environment. Use your EU GPT API key — not an OpenAI key.

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.EUGPT_API_KEY,
  baseURL: "https://chat.eugpt.ai/v1",
});
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["EUGPT_API_KEY"],
    base_url="https://chat.eugpt.ai/v1",
)

That is the entire configuration. Every call to client.responses.create now goes to EU GPT.

What works#

The SDK’s responses API is fully supported:

  • client.responses.create(...) — both stream: true and stream: false.
  • The async iterator pattern in JavaScript (for await (const event of stream)).
  • The Python generator pattern (for event in stream:).
  • Typed events — the SDK parses the data: JSON for you.

What does not work (yet)#

The following surfaces are part of the OpenAI SDK but not implemented in EU GPT today:

  • client.chat.completions.* — use client.responses.* instead.
  • client.assistants.*, client.threads.* — the Assistants API is a separate product line.
  • client.embeddings.* — embeddings are an internal RAG concern; no public endpoint.
  • client.images.*, client.audio.* — image and audio generation are not exposed publicly.
  • previous_response_id on responses.create — use conversation_id instead.

The SDK call will fail with a 404 against EU GPT if you call an unsupported surface.

A reusable client#

Create the client once at module load. The SDK reuses HTTP connections.

// lib/eugpt.js
import OpenAI from "openai";

export const eugpt = new OpenAI({
  apiKey: process.env.EUGPT_API_KEY,
  baseURL: process.env.EUGPT_BASE_URL ?? "https://chat.eugpt.ai/v1",
});
# app/eugpt.py
import os
from openai import OpenAI

eugpt = OpenAI(
    api_key=os.environ["EUGPT_API_KEY"],
    base_url=os.getenv("EUGPT_BASE_URL", "https://chat.eugpt.ai/v1"),
)

Parameterising the base URL lets your CI run against staging without code changes.

Switching providers#

If your code already uses OpenAI and you want to add EU GPT alongside, instantiate two clients:

import OpenAI from "openai";

const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const eugpt = new OpenAI({
  apiKey: process.env.EUGPT_API_KEY,
  baseURL: "https://chat.eugpt.ai/v1",
});

// Route per-call:
const client = featureFlag("use-eu-gpt", user) ? eugpt : openai;

Common pitfalls#

  • Forgetting /v1: the base URL must end in /v1, not /v1/ and not bare https://chat.eugpt.ai. The SDK appends responses to it.
  • OpenAI key vs EU GPT key: keys are not interchangeable. EU GPT keys start with eugpt_.
  • Calling Chat Completions: client.chat.completions.create returns 404. Use client.responses.create.
  • Trying to pin a model name: model selection is automatic on EU GPT. Always pass "auto" — any concrete model name (OpenAI’s or EU GPT’s) is accepted for SDK compatibility but ignored, so pinning has no effect. The response reports the model that ran.