skip to content
Replace your provider key

Setup

Replace your provider key

Change one key and one base URL. Your client code stays as it is.

The gateway speaks the OpenAI chat wire, the OpenAI Responses wire and the Anthropic Messages wire, and takes the same key on all three. Point your client at https://api.conifer.build and give it $CONIFER_API_KEY in place of the provider key it uses now. Mint one at The API key. Keys start with sk-conifer-.

From OpenAI

terminal
export OPENAI_BASE_URL=https://api.conifer.build/v1
export OPENAI_API_KEY=$CONIFER_API_KEY

Note the /v1 on the end. Chat completions, Responses, embeddings and the model list work unchanged. Pick any model from GET /v1/models.

From Anthropic

terminal
export ANTHROPIC_BASE_URL=https://api.conifer.build
export ANTHROPIC_API_KEY=$CONIFER_API_KEY

No /v1 here. The Anthropic SDKs send the key as x-api-key, which the gateway reads, so nothing else changes. ANTHROPIC_AUTH_TOKEN works too.

From OpenRouter

Change the base URL and keep the provider, the model ids and the options.

ai-sdk
import { createOpenRouter } from "@openrouter/ai-sdk-provider";

export function conifer() {
  const apiKey = process.env.CONIFER_API_KEY;
  if (!apiKey) {
    throw new Error("CONIFER_API_KEY is missing. Set it before calling the gateway.");
  }
  const openrouter = createOpenRouter({
    baseURL: "https://api.conifer.build/v1",
    apiKey,
  });
  return openrouter("anthropic/claude-opus-5");
}

Namespaced ids keep working. anthropic/claude-opus-5 is served as the catalog’s claude-opus-5, and the response headers x-conifer-requested-model and x-conifer-effective-model carry both spellings. An id the catalog does not carry is refused by name rather than swapped for something close. OpenRouter-only body fields and the HTTP-Referer and X-Title headers are accepted and ignored, so an unmodified request is served. To name your own fallback chain, send x-conifer-fallback-models, described on Routing.

If you use the plain OpenAI SDK pointed at OpenRouter, the move is the same two variables.

terminal
export OPENAI_BASE_URL=https://api.conifer.build/v1
export OPENAI_API_KEY=$CONIFER_API_KEY

What to check

If your app usesWhat happens
/v1/embeddingsServed, with the same key and base URL. GET /v1/models lists the embedding models under caps "embeddings".
/v1/moderationsNot served. The gateway answers 404 with code unknown_url.
a non-Anthropic model on /v1/messages400 wire_upstream_mismatch. That wire serves Anthropic models only. Every other model is on the chat wire.
a model id outside the catalog404 model_not_found. No model is substituted. When your key can call something close, the body’s error.suggestions names it.
tools, images, or a reasoning trace on every modelModels differ. Check caps on GET /v1/models before sending tools or images. A capability the model does not declare is a clear 400, not a silent drop and not a 402. Reasoning fields are simply absent when the model produced none.

Legacy /v1/completions also carries over, as buffered JSON without streaming. The streaming wire is /v1/chat/completions.