Get started

Quickstart

Nicrron speaks the OpenAI API, so the official OpenAI SDKs work with two changes: the base URL and the key. Then add routing and fallbacks when you want them.

1. Point the OpenAI SDK at Nicrron

Make a key in the dashboard, then pass it with the Nicrron base URL. The same two settings work in the Python SDK and in cURL; see SDKs.

TypeScript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.nicrron.ai/v1",
  apiKey: process.env.NICRRON_API_KEY, // sk-af-...
});

2. Let a routing slug pick the model

Instead of naming a model, pass a routing slug such as nicrron/auto. The gateway expands it to an ordered list of models and tries them in turn.

Routing slug
const completion = await client.chat.completions.create({
  model: "nicrron/auto", // or nicrron/fastest, nicrron/cheapest, ...
  messages: [{ role: "user", content: "Optimize this SQL query for high concurrency" }],
});

console.log(completion.choices[0].message.content);
  • nicrron/auto

    Picks by prompt length: over 2,000 characters goes to Claude Opus 5.5, Claude Sonnet 5.5, GPT-6 Sol or DeepSeek V4 Pro; shorter prompts to Claude Haiku 5.5, GPT-6 Luna or DeepSeek Flash.

  • nicrron/reasoning

    DeepSeek V4 Pro, GPT-6 Sol and Claude Opus 5.5, then Kimi K3 and GLM 5.3, for multi-step logic.

  • nicrron/coding

    Claude Opus 5.5, Claude Sonnet 5.5 and Kimi K2.7 Code, then GLM 5.3, Codestral and GPT-6 Sol.

  • nicrron/fastest

    Claude Haiku 5.5, GPT-6 Luna and DeepSeek Flash for the lowest latency.

  • nicrron/cheapest

    Every chat model, cheapest list price first, so the first one that answers is the cheapest available.

3. List fallback models

Keep a workflow running when a model or provider is down: list fallback models in models, in order. Nicrron moves to the next one when a provider rate-limits or fails before answering.

Fallback models
const completion = await client.chat.completions.create({
  model: "anthropic/claude-sonnet-5-5",
  messages: [{ role: "user", content: "Summarize this technical specification." }],
  // A Nicrron field, tried in order after model. Not in the OpenAI types:
  // @ts-expect-error
  models: ["openai/gpt-6-sol", "deepseek/deepseek-flash"],
});

4. Embeddings

Embeddings from OpenAI, Mistral and Voyage go through client.embeddings.create(), with the same fallback rules as chat.

Embeddings
const embedding = await client.embeddings.create({
  model: "openai/text-embedding-3-small",
  input: "Semantic vector search with Nicrron",
});

5. Exact-match caching

Requests with temperature: 0, or with the header x-nicrron-cache: true, are cached for up to 24 hours, only for your account. Repeating the identical request returns in about 12 ms, costs nothing and carries x-nicrron-cache: HIT. Send x-nicrron-cache: false to skip the cache.