Migrate from OpenAI or Anthropic

Change the base URL and the API key. In most projects that is the entire migration.

From the OpenAI SDK#

Before
const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
});
After
const client = new OpenAI({
  apiKey: process.env.XKIRO_API_KEY,
  baseURL: "https://api.xkiro.com/v1",
});
Python
client = OpenAI(
    api_key=os.environ["XKIRO_API_KEY"],
    base_url="https://api.xkiro.com/v1",
)

From the Anthropic SDK#

After
const client = new Anthropic({
  apiKey: process.env.XKIRO_API_KEY,
  baseURL: "https://api.xkiro.com",
});

The Anthropic base URL has no /v1

The Anthropic SDKs append /v1/messages themselves. Adding /v1 yourself produces /v1/v1/messages and a 404. The OpenAI SDKs are the opposite — they need it.

Update your model IDs#

This is the one real change. xKiro serves many vendors, so IDs carry a vendor prefix and are unambiguous.

Before and after
// Before
model: "gpt-4o"
model: "claude-sonnet-4-5"

// After
model: "openai/gpt-5.6-sol"
model: "anthropic/claude-sonnet-5"

Call GET /v1/models for the exact IDs your account can use, or browse the catalog in the dashboard. See Models.

What does not change#

  • Message and content shapes, including multi-part content with images.
  • Streaming, and the event format your SDK already parses.
  • Tool definitions, tool calls and tool results.
  • Error shapes — same fields, same places, so existing handlers keep working.
  • Usage accounting fields on the response.

Worth checking after you switch#

Reasoning defaults

If your code never set a reasoning parameter, each model applies its own default — which may differ from what you were used to. If you want it off, say so explicitly with "reasoning_effort": "none". See Reasoning.

Long blocking requests

Non-streaming requests are cut off at 95 seconds. If you have long generations that used to run for minutes, switch them to stream: true. See Streaming.

Proxy retry settings

If you sit behind nginx or a load balancer, make sure it does not retry POST requests on timeout — that runs and bills the request twice. See Idempotency & retries.

Migrating gradually#

You do not have to switch everything at once. Keep both clients and route a slice of traffic through xKiro until you are satisfied.

Route by percentage
import OpenAI from "openai";

const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const xkiro = new OpenAI({
  apiKey: process.env.XKIRO_API_KEY,
  baseURL: "https://api.xkiro.com/v1",
});

// Ramp this up as confidence grows.
const XKIRO_SHARE = Number(process.env.XKIRO_SHARE ?? "0.1");

function pickClient() {
  const useXkiro = Math.random() < XKIRO_SHARE;
  return {
    client: useXkiro ? xkiro : openai,
    model: useXkiro ? "openai/gpt-5.6-sol" : "gpt-4o",
  };
}

Compare on your own evaluations

Run both paths against the cases you actually care about before committing. Benchmarks published by anyone — including us — say nothing about your prompts.