Skip to content
Guides3 min read

What is an OpenAI-compatible API?

Learn what OpenAI API compatibility means, how to connect Xava Inference to your app, and which model capabilities to check before switching.

Quick answer

An OpenAI-compatible API accepts familiar OpenAI request formats through a different API endpoint. With Xava Inference, you can use one key to access models from multiple providers. Change your base URL, API key, and model ID, then check that the selected model supports the features your application needs.

An API should make trying a different model feel like a small change to your application. An OpenAI-compatible endpoint gives you a familiar starting point: a model ID, a list of messages, and an authenticated request.

Compatibility describes the request interface. The model still determines the quality of an answer, its supported inputs, and which optional features are available.

What does OpenAI compatibility mean?

An OpenAI-compatible service supports the shape of common OpenAI API requests. Your application sends JSON to an endpoint such as /v1/chat/completions, identifies a model, and includes an API key.

Xava Inference brings text, image, video, audio, and embedding models into one catalog. The API reference explains the endpoints for each task. The model catalog lists the models you can choose.

The practical benefit is a shared integration. You can evaluate another supported model without starting a separate account and integration for every provider. You still need to check the new model's parameters and behavior.

How do you connect an application?

Start with the quickstart. The three values you need are:

  1. Base URL: the API endpoint your client sends requests to.
  2. API key: a key created in your Xava Inference dashboard.
  3. Model ID: the exact identifier shown in the model catalog.

For OpenAI-compatible clients, the production base URL is https://xavainf.com/v1. Keep your API key in a server-side environment variable. An API key grants access to your account's prepaid balance; it should never appear in a public repository or browser bundle.

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["XINF_API_KEY"],
    base_url="https://xavainf.com/v1",
)

response = client.chat.completions.create(
    model=os.environ["XINF_MODEL_ID"],
    messages=[{"role": "user", "content": "Explain embeddings in two sentences."}],
)
print(response.choices[0].message.content)

Set XINF_MODEL_ID to a current text model from the catalog. This avoids making an example depend on a model that may later change or leave the catalog.

What should you check before switching models?

Compatibility is a useful starting point, but your application may depend on capabilities beyond basic text generation.

RequirementWhat to verify
Tool callingThe model supports tools and returns the structure your app expects.
Structured outputThe model supports the requested JSON or schema behavior.
Image inputsThe selected model accepts images in the format you send.
StreamingYour client handles streaming events and the final usage result.
Long promptsYour input and intended output fit within the model's context limits.

Test representative requests before changing your production model. Include difficult inputs, short and long requests, and the cases where your application should decline or ask for clarification.

Use the model catalog to compare supported capabilities. For request failures, use the errors reference.

How is usage paid for?

Xava Inference uses a prepaid balance. Check the current price and unit for your selected model in the catalog, then fund your account using the methods described in the billing guide.

Different tasks use different billing units. A text model may price input and output tokens separately; a media model may use images, duration, or another unit. Compare the cost of a completed task rather than assuming every model uses the same meter.

Frequently asked questions

Can I use an existing OpenAI SDK?

Yes, for supported OpenAI-compatible endpoints. Set the Xava Inference base URL and API key, choose an available model ID, and verify any optional features your application uses against the API documentation.

Does compatibility mean every model behaves the same way?

No. Models differ in supported parameters, context limits, output quality, and media capabilities. Use the catalog and API reference to check the specific model and test it on your actual workload.

Where should I start if I do not want to write code?

Use the Playground to try prompts, or follow the agent setup guide to connect a supported coding agent. Both paths help you explore models before integrating an application.

Put the ideas to work.

Explore the models. Try a prompt. Build something useful.

Open Playground