Installation

Install and configure the Cencori SDK for your preferred language.

Requirements

  • Node.js: Version 18.0.0 or higher
  • Package Manager: npm 8+, yarn 1.22+, or pnpm 7+
  • TypeScript: Version 4.5+ (optional but recommended)

Installation

terminal

Vercel AI SDK Integration

Using Vercel AI SDK? Install the Cencori provider for seamless integration with streamText(), generateText(), and useChat():

terminal
app/api/chat/route.ts

Same benefits: Safety filtering, analytics, cost tracking, and multi-provider support — all through the familiar Vercel AI SDK patterns.

TanStack AI Integration

Using TanStack AI? Install the Cencori adapter with TanStack AI:

terminal
chat.ts

Full features: Streaming, structured output, and tool calling — all routed through Cencori's unified gateway.

SDK Initialization

lib/cencori.ts

Basic Usage

example.ts

Streaming Responses

streaming.ts

Error Handling

errors.ts

Environment Setup

Store your API key securely using environment variables:

.env

Security: Never commit your .env file to version control. Add it to your .gitignore.

Supported Providers & Models

All SDKs support 14+ providers with 50+ models:

ProviderKey Models
OpenAIgpt-5, gpt-4o, gpt-4o-mini, o3, o1
Anthropicclaude-opus-4, claude-sonnet-4, claude-3-5-sonnet
Googlegemini-3-pro, gemini-2.5-flash, gemini-2.0-flash
xAIgrok-4, grok-4.1, grok-3
Mistralmistral-large, codestral, devstral
DeepSeekdeepseek-v3.2, deepseek-reasoner
Metallama-4-maverick, llama-3.3-70b
+ 7 moreGroq, Cohere, Perplexity, Together, Qwen, OpenRouter, HuggingFace

Troubleshooting

JavaScript: Module Not Found

If you see Cannot find module 'cencori', verify installation:

terminal

Python: ModuleNotFoundError

If you see ModuleNotFoundError: No module named 'cencori':

terminal

Authentication Errors

If you receive authentication errors, verify your API key is correct and the environment variable is loaded properly.

Next Steps