API Docs
Get Started

Migrate from Another Platform

Move from the official OpenAI API, the official Anthropic API or another OpenAI-compatible platform to UnioAPI — change the base URL, API key and model ID; keep your code and SDKs.

UnioAPI serves the official protocols as-is: request formats, response shapes, streaming events and error shapes all match the official APIs. A migration usually changes three things: the base URL, the API key and the model ID.

Before you switch

  • Create a new API key in the console and top up; see Console & top-up.
  • Confirm the models you need are listed by GET /v1/models or on the model pages.
  • Switch a test environment first, compare outputs and usage, then move production traffic.

From the official OpenAI API

SettingBeforeAfter
Base URLhttps://api.openai.com/v1https://api.unioapi.com/v1
API keysk-... (OpenAI)Your UnioAPI key
Model IDgpt-5.6-sol etc.Unchanged

Python:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.unioapi.com/v1",  # change this line
    api_key=os.environ["UNIO_API_KEY"],     # and this one
)

Many tools switch through environment variables, with no code change:

export OPENAI_BASE_URL=https://api.unioapi.com/v1
export OPENAI_API_KEY="$UNIO_API_KEY"

Both Chat Completions and Responses work. Differences to keep in mind:

  • Responses operations that depend on server-side storage (retrieve, delete, cancel by ID) return 404, and background: true returns 400. To continue a conversation, send the full input each time; see POST /v1/responses.
  • Embeddings, image and audio endpoints are not offered. Make sure your app only uses the chat-style endpoints.

From the official Anthropic API

SettingBeforeAfter
Base URLhttps://api.anthropic.comhttps://api.unioapi.com
API keysk-ant-...Your UnioAPI key
Model IDclaude-sonnet-5 etc.Unchanged
import os
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.unioapi.com",
    api_key=os.environ["UNIO_API_KEY"],
)

Keep sending the anthropic-version header. The base URL has no /v1; the SDK appends /v1/messages. Claude Code users only change two environment variables — see Claude Code setup.

From another OpenAI-compatible platform

Many aggregation platforms write model IDs as "vendor prefix + model", e.g. openai/gpt-5.6-sol or anthropic/claude-sonnet-5. When you move to UnioAPI:

  1. Set the base URL to https://api.unioapi.com/v1.
  2. Drop the vendor prefix and use the official ID: gpt-5.6-sol, claude-sonnet-5.
  3. For Claude models, prefer the official Anthropic protocol (POST /v1/messages) for the most complete fields and features. If you must stay on the OpenAI protocol, check the model's endpoint_capabilities in GET /v1/models first.
  4. Remove platform-specific extension fields (custom model fallback lists, per-platform preferences and so on). They have no meaning here and can return 400 unsupported_parameter.

Check after migrating

  • Send a few typical requests and compare outputs with the old platform.
  • Reconcile each call's model, tokens and charge in Request logs; see Usage & billing records.
  • Make sure your retry and timeout logic handles 429 and 503/529; see Errors.

FAQ

404 after migrating — usually the model ID still has a vendor prefix, or the /v1 part of the base URL is wrong. See FAQ & Troubleshooting.

Will my prompt cache still hit? — Caches are kept separately by each service. The first round after the switch writes the cache again; later requests hit as usual. See Prompt caching & TTL.

Next steps