AI Docs
Adapters
- OpenAIUpdated
- Anthropic
- Google Gemini
- Google Vertex AI
- Ollama
- Grok (xAI)
- GroqUpdated
- Mistral
- Cohere
- TypeSafe
- Ollaya
- ElevenLabs
- fal.ai
- Reactor
- World Labs
- OpenRouter AdapterUpdated
- Perplexity Search
- Vercel AI Gateway
- Lovable AI Gateway
- OpenAI-CompatibleUpdated
- LLM Gateway
- CloudflareUpdated
- Claude Code
- Codex
- OpenCode
- Grok Build
- ACP-Compatible
- Amazon BedrockUpdated
- BytePlus
Community Adapters
AI/LLM: This documentation page is available in plain markdown format at/ai/latest/docs/community-adapters/cencori.md
Community Adapters
Cencori
The Cencori adapter provides access to 14+ AI providers (OpenAI, Anthropic, Google, xAI, and more) through a unified interface with built-in security, observability, and cost tracking.
Installation#
shell
npm i @cencori/ai-sdkshell
pnpm add @cencori/ai-sdkshell
yarn add @cencori/ai-sdkshell
bun add @cencori/ai-sdkBasic Usage#
ts
// ignore: @cencori/ai-sdk/tanstack is a subpath export; kiira's paths["*"] wildcard maps it
// to a flat directory lookup and does not consult the package.json exports field,
// so the subpath cannot be resolved until kiira.config.ts adds an explicit path entry.
import { chat } from "@tanstack/ai";
import { cencori } from "@cencori/ai-sdk/tanstack";
const adapter = cencori("o1");
for await (const chunk of chat({
adapter,
messages: [{ role: "user", content: "Hello!" }],
})) {
if (chunk.type === "TEXT_MESSAGE_CONTENT") {
console.log(chunk.delta);
}
}Configuration#
ts
// ignore: @cencori/ai-sdk/tanstack subpath not resolvable via kiira's paths["*"] wildcard.
import { createCencori } from "@cencori/ai-sdk/tanstack";
const myCencori = createCencori({
apiKey: process.env.CENCORI_API_KEY!,
baseUrl: "https://cencori.com", // Optional
});
const adapter = myCencori("o1");Streaming#
ts
// ignore: @cencori/ai-sdk/tanstack subpath not resolvable via kiira's paths["*"] wildcard.
import { chat } from "@tanstack/ai";
import { cencori } from "@cencori/ai-sdk/tanstack";
const adapter = cencori("claude-3-5-sonnet");
for await (const chunk of chat({
adapter,
messages: [{ role: "user", content: "Tell me a story" }],
})) {
if (chunk.type === "TEXT_MESSAGE_CONTENT") {
process.stdout.write(chunk.delta);
} else if (chunk.type === "RUN_FINISHED") {
console.log("\nDone");
}
}Tool Calling#
ts
// ignore: @cencori/ai-sdk/tanstack subpath not resolvable via kiira's paths["*"] wildcard.
import { chat, toolDefinition } from "@tanstack/ai";
import { cencori } from "@cencori/ai-sdk/tanstack";
import { z } from "zod";
const adapter = cencori("o1");
const getWeatherDef = toolDefinition({
name: "getWeather",
description: "Get weather for a location",
inputSchema: z.object({ location: z.string() }),
});
const getWeather = getWeatherDef.server(async ({ location }) => {
// Look up the weather for `location`
return { temperature: 72, conditions: "Sunny" };
});
for await (const chunk of chat({
adapter,
messages: [{ role: "user", content: "What's the weather in NYC?" }],
tools: [getWeather],
})) {
if (chunk.type === "TOOL_CALL_START") {
console.log("Tool call:", chunk.toolCallName);
} else if (chunk.type === "TOOL_CALL_END") {
console.log("Tool call finished:", chunk.toolCallId);
}
}Multi-Provider Support#
Switch between providers with a single parameter:
ts
// ignore: @cencori/ai-sdk/tanstack subpath not resolvable via kiira's paths["*"] wildcard.
import { cencori } from "@cencori/ai-sdk/tanstack";
// OpenAI-compatible
const openaiCompat = cencori("o1");
// Anthropic
const anthropic = cencori("claude-3-5-sonnet");
// Google
const google = cencori("gemini-2.5-flash");
// xAI
const grok = cencori("grok-3");
// DeepSeek
const deepseek = cencori("deepseek-v3.2");All responses use the same unified format regardless of provider.
Supported Models#
| Provider | Models |
|---|---|
| OpenAI | gpt-5, gpt-4o, gpt-4o-mini, o3, o1 |
| Anthropic | claude-opus-4, claude-sonnet-4, claude-3-5-sonnet |
| gemini-3-pro, gemini-2.5-flash, gemini-2.0-flash | |
| xAI | grok-4, grok-3 |
| Mistral | mistral-large, codestral, devstral |
| DeepSeek | deepseek-v3.2, deepseek-reasoner |
| + More | Groq, Cohere, Perplexity, Together, Qwen, OpenRouter |
Note: Cencori is an external package and its catalogue changes over time. Verify the model ids above against Cencori's current catalogue before relying on them.
Environment Variables#
shell
CENCORI_API_KEY=csk_your_api_key_hereGetting an API Key#
- Go to Cencori
- Create an account and generate an API key
- Add it to your environment variables
Why Cencori?#
- ๐ Security โ PII filtering, jailbreak detection, content moderation
- ๐ Observability โ Request logs, latency metrics, cost tracking
- ๐ฐ Cost Control โ Budgets, alerts, per-route analytics
- ๐ Multi-Provider โ One API key for 14+ AI providers
- ๐ ๏ธ Tool Calling โ Full support for function calling across providers
- ๐ Failover โ Automatic retry and fallback to alternative providers
API Reference#
cencori(model)#
Creates a Cencori adapter using environment variables.
Parameters:
- model - Model name (e.g., "gpt-4o", "claude-3-5-sonnet", "gemini-2.5-flash")
Returns: A Cencori TanStack AI adapter instance.
createCencori(config)#
Creates a custom Cencori adapter factory.
Parameters:
- config.apiKey - Your Cencori API key
- config.baseUrl? - Custom base URL (optional)
Returns: A function that creates adapter instances for specific models.
Next Steps#
- Cencori Dashboard โ View analytics, logs, and costs
- Documentation โ Complete API reference
- GitHub Repository โ SDK source code
- Streaming Guide โ Learn about streaming responses
- Tools Guide โ Learn about tool calling