OpenAI-compatible API setup guide

You can usually move an existing OpenAI SDK integration by changing the base URL, API key, and model name. Use a small test request first, then verify streaming, tool calls, and usage accounting for your workload.

The minimum configuration

Set the base URL to the provider endpoint, send the API key as a Bearer token, and use a model ID that is listed as available. Keep the key in an environment variable rather than source code.

Test before migrating traffic

Send one short non-streaming request, then test streaming and the response fields your application reads. Record the request ID so support can trace a failure.

Common compatibility gaps

Some routes differ in tool calling, JSON mode, vision inputs, context limits, or error formats. Treat those as explicit capabilities instead of assuming every model behaves identically.

Production checklist

Set timeouts, bound retries, log model and request IDs, redact prompts when required, and monitor both error rate and cost per successful task.