APIrove

Home / Docs / Gateway migration

MIGRATION GUIDE · OPENAI COMPATIBLE

Migrate an existing AI API gateway client: verify before cutover

With an OpenAI-compatible client, the visible configuration changes are usually the base URL, API key, and model ID. Actual compatibility also depends on endpoints, parameters, output, and account access. Keep a tested rollback path.

For development teams with an authorized APIrove account assessing a migration of existing text calls. Register or sign in to check access and balance.

Step 1: Inventory the current calls

For each critical path, record its model ID, endpoint, SDK version, parameters, streaming mode, expected output fields, timeout, and retry policy. Select one redacted, repeatable request as a baseline. Never reuse the old provider’s API key with a new provider.

RecordReason
Responses or Chat CompletionsThe request and response structures differ
Model ID and account accessAn old model name may not be enabled on the new account
Streaming, tools, JSON, other parametersCompatibility does not guarantee feature parity
Usage and latency baselineNeeded to compare charge and user experience

Step 2: Verify the destination account

Sign in to APIrove, inspect the model directory and models enabled for your account, and confirm the target endpoint. Follow the pricing guide to check your actual rate, balance, and limits. If a required model or endpoint is unconfirmed, do not change production yet. Create a separate test key and keep it in a server-side environment variable or secret manager.

Step 3: Configure a separate client

Keep both clients behind an application configuration switch. The APIrove base URL is https://apirove.com/v1; do not put the complete /responses route into the SDK base URL, or send the old provider’s key to the new address. This Python OpenAI SDK example configures only the client. Use a model ID enabled for your account.

import os
from openai import OpenAI

candidate = OpenAI(
    api_key=os.environ["APIROVE_API_KEY"],
    base_url="https://apirove.com/v1",
)
model_id = os.environ["APIROVE_MODEL_ID"]  # Confirm in your account

This does not transfer balance, conversation history, permissions, or provider-specific parameters. Preserve the previous client and rollback switch.

Step 4: Send one low-usage request

If your enabled model supports Responses, use:

export APIROVE_API_KEY='YOUR_API_KEY'
export APIROVE_MODEL_ID='YOUR_ENABLED_MODEL_ID'

curl https://apirove.com/v1/responses \
  -H "Authorization: Bearer $APIROVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"'"$APIROVE_MODEL_ID"'","input":"Reply with OK.","max_output_tokens":16}'

If the target model supports only Chat Completions, use its route and messages shape; see the API docs. Record the HTTP status, response, usage, and request ID if present, while keeping keys and customer data out of public logs. For 401, 404, or 429, follow the error isolation guide.

Step 5: Check application behavior

Run the same redacted sample against both services. Check whether the real task succeeds, not just whether HTTP returns 200: inspect response fields, streaming completion, tool arguments, errors, timeouts, latency, and account usage. Models and sampling settings may change wording, so judge against your application’s acceptance criteria. Reconcile the actual charge in the account console.

Set a pass threshold before cutover, such as all critical paths working, usage being explainable, and latency meeting an internal target. Your team defines the threshold; this guide makes no uptime or performance promise.

Step 6: Ramp traffic with rollback ready

  1. Route internal or noncritical requests through the new configuration first; verify monitoring and usage.
  2. Increase traffic in observable stages and compare errors, latency, and billed usage, especially 429s and 5xx.
  3. When a predeclared stop condition occurs, switch back to the original configuration and retain redacted evidence and timestamps.
  4. Only revoke unused test keys after the new path is accepted; do not delete rollback configuration early.
Next step: Confirm an enabled model and account pricing, then run one low-usage request. Obtain explicit support information for any feature not verified in the public docs.