Setup
Replace your provider key
One key, one base URL. Your client stays as it is.
Conifer speaks the OpenAI chat wire, the OpenAI Responses wire and the Anthropic Messages wire, and takes the same credential on all three. Point your client at https://api.conifer.build and give it $CONIFER_API_KEY in place of the provider key it has now. Mint one at the API key.
From OpenAI
export OPENAI_BASE_URL=https://api.conifer.build/v1
export OPENAI_API_KEY=$CONIFER_API_KEYChat completions, Responses and the model list work unchanged. Pick a model from GET /v1/models.
From Anthropic
export ANTHROPIC_BASE_URL=https://api.conifer.build
export ANTHROPIC_API_KEY=$CONIFER_API_KEYThe gateway reads the key from x-api-key, which is where the Anthropic SDKs put it, so no code change is needed. ANTHROPIC_AUTH_TOKEN also works and takes precedence when both are set.
From OpenRouter
One line: the base URL. Keep the provider, keep the model ids, keep the options.
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
const openrouter = createOpenRouter({
baseURL: "https://api.conifer.build/v1", // <- the only change
apiKey: process.env.CONIFER_API_KEY,
});
const model = openrouter("anthropic/claude-opus-5");Namespaced ids keep working for every model we serve: anthropic/claude-opus-5 resolves to the catalog’s claude-opus-5, and the response headers x-conifer-requested-model and x-conifer-effective-model name both spellings. An id we do not serve is refused by name, never served as something near it. OpenRouter-only body fields — provider, route, transforms, models — and the HTTP-Referer / X-Title headers are accepted and ignored, so an unmodified request is served rather than refused.
The plain OpenAI SDK pointed at OpenRouter moves the same way:
export OPENAI_BASE_URL=https://api.conifer.build/v1
export OPENAI_API_KEY=$CONIFER_API_KEYWhat doesn’t carry over
| If your app uses | What happens |
|---|---|
/v1/embeddings | Not served. Keep your provider key for embeddings; the two coexist fine. |
legacy /v1/completions, /v1/moderations | Not served. |
a non-Anthropic model on /v1/messages | 400 wire_upstream_mismatch. That wire serves Anthropic ids only; every other model is on the chat wire. |
| a model id outside the catalog | 404 model_not_found, naming the id you sent. Nothing is ever substituted. |