Skip to main content

OpenAI-compatible API migration guide for Python, Node.js, and curl

An OpenAI-compatible API lets your application keep the same request style while sending traffic through a different base URL. This is the fastest way to test another AI provider, AI gateway, or model marketplace without rewriting your application. OpenAI-compatible migration diagram showing developers keeping the OpenAI SDK and changing the base URL and API key Rock API exposes an OpenAI-compatible API at:

Python example

Node.js example

Migration checklist

FAQ

Is an OpenAI-compatible API the same as OpenAI?

No. It means the API follows the OpenAI request and response shape closely enough for OpenAI-style SDKs and clients. The upstream model may be OpenAI, Anthropic, Google, or another supported provider.

Can I use Claude with the OpenAI SDK?

Yes, when the gateway exposes Claude models through an OpenAI-compatible interface. Your application keeps the OpenAI-style client and selects the Claude model name supported by the gateway.

Can I use Gemini with the OpenAI API format?

Yes, if the gateway provides Gemini models through an OpenAI-compatible endpoint. Test model-specific behavior before production, especially tool calls and streaming edge cases.

Next step

For a broader model selection guide, read AI model API comparison.