Cencori
Cencori Provider for the AI SDK
Cencori is the unified infrastructure layer for AI applications. It provides built-in security, observability, and multi-provider support through a single API.
With Cencori, you get:
- Multi-Provider Gateway: Access OpenAI, Anthropic, Google Gemini, Mistral, DeepSeek, and more through one API
- Built-in Security: Automatic PII detection, prompt injection protection, and content filtering
- Full Observability: Complete audit logs, analytics, and cost tracking for every request
- Transparent Pricing: Credits-based billing with real-time cost visibility
Setup
The Cencori provider is available in the cencori module. You can install it with:
$ pnpm add cencori
$ npm install cencori
$ yarn add cencori
$ bun add cencori
Provider Instance
To create a Cencori provider instance, use the createCencori function:
You can obtain your Cencori API key from the Cencori Dashboard.
Environment Variable
Alternatively, you can set the CENCORI_API_KEY environment variable and use the default provider:
Language Models
Cencori provides access to language models from multiple providers. Use the provider function directly to create a model:
You can find the full list of available models in the Cencori Documentation.
Examples
Here are examples of using Cencori with the AI SDK:
generateText
streamText
Tool Calling
Cencori supports tool calling with all compatible models:
Next.js Route Handler
useChat Hook
Advanced Features
Cencori offers several advanced features to enhance your AI applications:
-
Built-in Security: Every request passes through automatic safety filters including PII detection, prompt injection protection, and harmful content filtering. Requests that violate safety policies are blocked before reaching the model.
-
Multi-Provider Routing: Switch between 15+ AI providers (OpenAI, Anthropic, Google, Mistral, DeepSeek, xAI, and more) without changing your code. Cencori handles the routing automatically.
-
Cost Tracking: Real-time cost tracking and analytics for every request. View detailed breakdowns by model, provider, and project in your dashboard.
-
Complete Audit Logs: Every request is logged with full payloads, token usage, costs, and safety scores for compliance and debugging.
-
Bring Your Own Keys (BYOK): Use your own API keys for each provider while still benefiting from Cencori's security and observability layer.
-
Provider Failover: Automatic failover to backup providers if your primary provider is unavailable.
For more information about these features and advanced configuration options, visit the Cencori Documentation.
Provider Options
You can customize the provider with additional options:
Model-Specific Options
You can also pass model-specific options: