From 3903ce000855d0f267df8e0c3a2d4df8573ef4fb Mon Sep 17 00:00:00 2001 From: Bola Banjo Date: Tue, 13 Jan 2026 10:20:36 -0800 Subject: [PATCH 1/5] docs: Add Cencori as community adapter - Add docs/community-adapters/cencori.md with usage examples - Update docs/config.json to include Cencori in sidebar Cencori provides access to 14+ AI providers (OpenAI, Anthropic, Google, xAI, DeepSeek, etc.) through a unified interface with built-in security, observability, and cost tracking. npm package: @cencori/ai-sdk --- docs/community-adapters/cencori.md | 180 +++++++++++++++++++++++++++++ docs/config.json | 6 +- 2 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 docs/community-adapters/cencori.md diff --git a/docs/community-adapters/cencori.md b/docs/community-adapters/cencori.md new file mode 100644 index 00000000..c7a5112a --- /dev/null +++ b/docs/community-adapters/cencori.md @@ -0,0 +1,180 @@ +--- +title: Cencori +id: cencori-adapter +order: 3 +--- + +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 + +```bash +npm install @cencori/ai-sdk +``` + +## Basic Usage + +```typescript +import { text } from "@tanstack/ai"; +import { cencori } from "@cencori/ai-sdk/tanstack"; + +const adapter = cencori("gpt-4o"); + +for await (const chunk of text({ + adapter, + messages: [{ role: "user", content: "Hello!" }], +})) { + if (chunk.type === "content") { + console.log(chunk.delta); + } +} +``` + +## Configuration + +```typescript +import { createCencori } from "@cencori/ai-sdk/tanstack"; + +const cencori = createCencori({ + apiKey: process.env.CENCORI_API_KEY!, + baseUrl: "https://cencori.com", // Optional +}); + +const adapter = cencori("gpt-4o"); +``` + +## Streaming + +```typescript +import { text } from "@tanstack/ai"; +import { cencori } from "@cencori/ai-sdk/tanstack"; + +const adapter = cencori("claude-3-5-sonnet"); + +for await (const chunk of text({ + adapter, + messages: [{ role: "user", content: "Tell me a story" }], +})) { + if (chunk.type === "content") { + process.stdout.write(chunk.delta); + } else if (chunk.type === "done") { + console.log("\nDone:", chunk.finishReason); + } +} +``` + +## Tool Calling + +```typescript +import { text } from "@tanstack/ai"; +import { cencori } from "@cencori/ai-sdk/tanstack"; + +const adapter = cencori("gpt-4o"); + +for await (const chunk of adapter.chatStream({ + messages: [{ role: "user", content: "What's the weather in NYC?" }], + tools: { + getWeather: { + name: "getWeather", + description: "Get weather for a location", + inputSchema: { + type: "object", + properties: { location: { type: "string" } }, + }, + }, + }, +})) { + if (chunk.type === "tool_call") { + console.log("Tool call:", chunk.toolCall); + } +} +``` + +## Multi-Provider Support + +Switch between providers with a single parameter: + +```typescript +import { cencori } from "@cencori/ai-sdk/tanstack"; + +// OpenAI +const openai = cencori("gpt-4o"); + +// 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` | +| Google | `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 | + +## Environment Variables + +```bash +CENCORI_API_KEY=csk_your_api_key_here +``` + +## Getting an API Key + +1. Go to [Cencori](https://cencori.com) +2. Create an account and generate an API key +3. 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](https://cencori.com) — View analytics, logs, and costs +- [Documentation](https://cencori.com/docs) — Complete API reference +- [GitHub Repository](https://github.com/cencori/cencori) — SDK source code +- [Streaming Guide](../guides/streaming) — Learn about streaming responses +- [Tools Guide](../guides/tools) — Learn about tool calling diff --git a/docs/config.json b/docs/config.json index b38c0240..3a0ee9e0 100644 --- a/docs/config.json +++ b/docs/config.json @@ -161,6 +161,10 @@ "label": "Community Adapters Guide", "to": "community-adapters/guide" }, + { + "label": "Cencori", + "to": "community-adapters/cencori" + }, { "label": "Decart", "to": "community-adapters/decart" @@ -599,4 +603,4 @@ ] } ] -} +} \ No newline at end of file From 5b524d9d01afc72ed9cc0bb8c6b3885769eda987 Mon Sep 17 00:00:00 2001 From: Bola Banjo Date: Tue, 13 Jan 2026 10:47:07 -0800 Subject: [PATCH 2/5] fix: Remove unused text import from tool calling example --- docs/community-adapters/cencori.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/community-adapters/cencori.md b/docs/community-adapters/cencori.md index c7a5112a..bd586ef3 100644 --- a/docs/community-adapters/cencori.md +++ b/docs/community-adapters/cencori.md @@ -66,7 +66,6 @@ for await (const chunk of text({ ## Tool Calling ```typescript -import { text } from "@tanstack/ai"; import { cencori } from "@cencori/ai-sdk/tanstack"; const adapter = cencori("gpt-4o"); From d2368fdda99bdb255eec30271b7eb5b3f5e567ae Mon Sep 17 00:00:00 2001 From: Bola Banjo Date: Wed, 14 Jan 2026 08:57:52 -0800 Subject: [PATCH 3/5] fix: use chat instead of text per review feedback --- docs/community-adapters/cencori.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/community-adapters/cencori.md b/docs/community-adapters/cencori.md index bd586ef3..d26c8780 100644 --- a/docs/community-adapters/cencori.md +++ b/docs/community-adapters/cencori.md @@ -46,12 +46,12 @@ const adapter = cencori("gpt-4o"); ## Streaming ```typescript -import { text } from "@tanstack/ai"; +import { chat } from "@tanstack/ai"; import { cencori } from "@cencori/ai-sdk/tanstack"; const adapter = cencori("claude-3-5-sonnet"); -for await (const chunk of text({ +for await (const chunk of chat({ adapter, messages: [{ role: "user", content: "Tell me a story" }], })) { @@ -63,6 +63,7 @@ for await (const chunk of text({ } ``` + ## Tool Calling ```typescript From 15743ccfcbaad4d0eb0eb8e6374a393a735e8bc7 Mon Sep 17 00:00:00 2001 From: Bola Banjo Date: Fri, 16 Jan 2026 03:59:11 -0800 Subject: [PATCH 4/5] fix: use chat() from @tanstack/ai for tool calling example --- docs/community-adapters/cencori.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/community-adapters/cencori.md b/docs/community-adapters/cencori.md index d26c8780..f1f3c075 100644 --- a/docs/community-adapters/cencori.md +++ b/docs/community-adapters/cencori.md @@ -67,11 +67,13 @@ for await (const chunk of chat({ ## Tool Calling ```typescript +import { chat } from "@tanstack/ai"; import { cencori } from "@cencori/ai-sdk/tanstack"; const adapter = cencori("gpt-4o"); -for await (const chunk of adapter.chatStream({ +for await (const chunk of chat({ + adapter, messages: [{ role: "user", content: "What's the weather in NYC?" }], tools: { getWeather: { @@ -90,6 +92,7 @@ for await (const chunk of adapter.chatStream({ } ``` + ## Multi-Provider Support Switch between providers with a single parameter: From 0a8b8f5600579e592e4c64f0317a595c32b37076 Mon Sep 17 00:00:00 2001 From: Alem Tuzlak Date: Wed, 21 Jan 2026 12:16:14 +0100 Subject: [PATCH 5/5] fixup docs --- docs/community-adapters/cencori.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/community-adapters/cencori.md b/docs/community-adapters/cencori.md index f1f3c075..8bbaf93f 100644 --- a/docs/community-adapters/cencori.md +++ b/docs/community-adapters/cencori.md @@ -15,12 +15,12 @@ npm install @cencori/ai-sdk ## Basic Usage ```typescript -import { text } from "@tanstack/ai"; +import { chat } from "@tanstack/ai"; import { cencori } from "@cencori/ai-sdk/tanstack"; const adapter = cencori("gpt-4o"); -for await (const chunk of text({ +for await (const chunk of chat({ adapter, messages: [{ role: "user", content: "Hello!" }], })) {