Migrate from OpenAI

Move an OpenAI Chat Completions integration to OpenGateway by changing the API key and base URL, then selecting a creator-prefixed model ID. Keep the OpenAI SDK.

Move an existing Chat Completions integration by updating its OpenGateway credentials and model ID. The OpenAI SDK can continue to call the Chat Completions API.

What changes#

  1. Base URL: set the SDK base URL to https://apis.opengateway.ai/v1.
  2. API key: use an OpenGateway API key in place of the OpenAI key.
  3. Model ID: choose a creator-prefixed ID from the OpenGateway catalog. For example, use openai/gpt-5-mini instead of the bare gpt-5-mini.

OpenGateway keys and OpenAI keys are separate credentials. Create and manage the OpenGateway key using the API keys guide.

What stays the same#

For Chat Completions, keep using the OpenAI SDK and its chat.completions.create method with the Chat Completions request format. Support for features such as streaming, tools, and image input depends on the selected model and the endpoint support shown in the catalog; do not assume every model supports every feature.

Python example#

Python
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["OPENGATEWAY_API_KEY"],
base_url="https://apis.opengateway.ai/v1",
)
response = client.chat.completions.create(
model="openai/gpt-5-mini",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)

TypeScript example#

TypeScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.OPENGATEWAY_API_KEY,
baseURL: "https://apis.opengateway.ai/v1",
});
const response = await client.chat.completions.create({
model: "openai/gpt-5-mini",
messages: [{ role: "user", content: "Hello" }],
});
console.log(response.choices[0].message.content);

Selecting models#

Model IDs use the creator/model pattern. The current catalog includes IDs such as openai/gpt-5-mini, anthropic/claude-sonnet-4-6, and google/gemini-2.5-flash. Use GET /v1/models to check available IDs and endpoint support; the endpoint is public and does not require a key. The model catalog shows current model details and pricing.

To use a different API format, such as Anthropic Messages or Decisions, see the API reference and confirm that the chosen model lists that endpoint.

Next steps#

Migrate from OpenAI — OpenGateway