Guide
Switch from the OpenAI API to Nicrron
Nicrron speaks the OpenAI API, so moving an app over takes three changes: the base URL, the key and the model ids. Your requests, streaming loop and tool handling stay as they are.
Then the same key calls Claude, Grok, DeepSeek, Kimi, GLM and Mistral too, next to the GPT models.
The three changes
from openai import OpenAI
client = OpenAI() # reads OPENAI_API_KEY
reply = client.chat.completions.create(
model="gpt-6.2-sol",
messages=[{"role": "user", "content": "Hello!"}],
)import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.nicrron.ai/v1", # 1. the base URL
api_key=os.environ["NICRRON_API_KEY"], # 2. the key
)
reply = client.chat.completions.create(
model="openai/gpt-6.2-sol", # 3. maker/model ids
messages=[{"role": "user", "content": "Hello!"}],
)Model ids are maker/model: openai/gpt-6.2-sol. Every id is on the models page and in GET /v1/models.
No code change: environment variables
If your SDK or tool reads the standard OpenAI variables, set them and leave the code alone. You still need the maker prefix in model ids.
# Many OpenAI SDKs and tools read these two variables.
export OPENAI_BASE_URL="https://api.nicrron.ai/v1"
export OPENAI_API_KEY="$NICRRON_API_KEY"What works the same
- Chat completions
- POST /v1/chat/completions, with streaming, tools, JSON mode and images in messages.
- Embeddings
- POST /v1/embeddings.
- Speech and transcription
- POST /v1/audio/speech and /v1/audio/transcriptions.
- Moderation
- POST /v1/moderations.
- Model list
- GET /v1/models.
What is different
- Responses and Assistants APIs
- Use chat completions. Nicrron keeps the conversation in your messages, not on the server.
- Image generation
- Images (and video) run as jobs: POST /v1/images/generations answers 202 with a job id, then you poll for the result. See the media docs.
- Files, batch, fine-tuning, realtime
- Not served. Keep those calls on OpenAI if you use them.
Errors use the OpenAI shape. Two are Nicrron's own: 402 when the key's paid balance is used up, and 502 when every model and provider in the fallback chain failed. All codes are in the API reference.
Then try another model
With the switch done, comparing models is one line. Run your own prompts on a few and keep the one that works, or let Nicrron fall back to a second model when the first fails.
reply = client.chat.completions.create(
model="anthropic/claude-sonnet-5-5", # same code, a different maker
messages=[{"role": "user", "content": "Hello!"}],
)Questions
- Is Nicrron compatible with the OpenAI API?
- Yes, for chat completions, embeddings, speech, transcription, moderation and the model list. Requests and answers have the OpenAI shape, so the official OpenAI SDKs work with a different base URL and key. The Responses, Assistants, files, batch, fine-tuning and realtime APIs are not served.
- Do I need to change my code to switch?
- Usually three things: the base URL (https://api.nicrron.ai/v1), the API key, and the model ids, which gain a maker prefix ("gpt-6.2-sol" becomes "openai/gpt-6.2-sol").
- Does it cost more than calling OpenAI directly?
- Models cost the provider's list price per token. Requests paid from Nicrron credit add a 5% platform fee; with your own provider key, the provider bills you and Nicrron charges 5% of the list price.
- Can I call Claude and other models with the same key?
- Yes. Change the model id, for example to "anthropic/claude-sonnet-5-5". One key and one balance cover every model on Nicrron.