Skip to content

CG SDKCognipeerAI Gateway SDK

Official TypeScript/JavaScript SDK for AI services

CG SDK

Quick Start

bash
npm install @cognipeer/cgate-sdk
bash
yarn add @cognipeer/cgate-sdk
bash
pnpm add @cognipeer/cgate-sdk

Basic Usage

typescript
import { CGateClient } from '@cognipeer/cgate-sdk';

const client = new CGateClient({
  apiKey: 'your-api-key',
});

// Chat completion
const response = await client.chat.completions.create({
  model: 'gpt-4',
  messages: [
    { role: 'system', content: 'You are a helpful assistant.' },
    { role: 'user', content: 'Hello!' },
  ],
});

console.log(response.choices[0].message.content);

// Streaming
const stream = await client.chat.completions.create({
  model: 'gpt-4',
  messages: [{ role: 'user', content: 'Tell me a story' }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content || '');
}

Why CG SDK?

  • OpenAI Compatible: Drop-in replacement for OpenAI SDK with extended features
  • Multi-Provider: Support for multiple LLM and vector database providers
  • Enterprise Ready: Built for multi-tenant SaaS with complete data isolation
  • Production Tested: Used in production by CognipeerAI customers
  • Active Development: Regular updates and new features

Learn More

📖 Documentation

Check out the Getting Started Guide to learn more.

💡 Examples

Explore our Examples for common use cases and patterns.

🆘 Support

Need help? Open an issue on GitHub.

Released under the MIT License.