|

Installation

Install the Cencori SDK in your project.

Install the official Cencori SDK for your preferred language. The SDK is designed to run on the server since it uses your project's secret key.

1

Install the SDK

Add the Cencori SDK to your project using your preferred package manager.

pnpm add cencori
2

Set up your environment variables

Add your Cencori project key to your environment file. Never expose a csk_... key through NEXT_PUBLIC_* variables or any browser-side code.

# .env.local for Next.js, .env for most Node apps
CENCORI_API_KEY=csk_...
3

Initialize the client

Import and instantiate the client. The SDK automatically reads CENCORI_API_KEY from your environment — no explicit configuration needed in most cases.

import { Cencori } from 'cencori';
 
const cencori = new Cencori();

You can also pass options explicitly:

const cencori = new Cencori({
  apiKey: process.env.CENCORI_API_KEY,
  baseUrl: 'https://cencori.com', // optional; this is the default
  headers: {
    'X-Trace-ID': 'req_123',
  },
});

OpenAI-Compatible Base URL

For tools that already speak the OpenAI API, install nothing from Cencori and set:

Base URL: https://api.cencori.com/v1
API key:  your Cencori project key

In most OpenAI-compatible clients, the base URL should stop at /v1; the client appends /chat/completions.

Requirements

  • Node.js 18+ for the TypeScript SDK.
  • Python 3.9+ for the Python SDK.
  • Go 1.21+ for the Go SDK.
  • PHP 8.1+ for the PHP SDK.
  • Rust 1.70+ for the Rust SDK.
  • A Cencori project key from Project > API Keys.
  • Provider access for the model you want to call. Use managed access if enabled, or add your own provider key in Project > Providers.

Next Steps

See Add Cencori to an Existing Product for dashboard-to-code setup, or Making Your First Request to send a request with the SDK.