Chat Completions
OpenAI-compatible chat API with full streaming support. Build conversational AI applications with ease.
Official TypeScript/JavaScript SDK for integrating with Cognipeer Console
Use the SDK when you are writing application code that talks to an existing Cognipeer Console deployment.
| Start with | Best for | What you get |
|---|---|---|
| Working with Console | Teams deciding how Console and the SDK fit together | Clear responsibility split between platform operations and app integration |
| Getting Started | Developers wiring the SDK into an app | Install, auth, base URL, first request |
| Console API Mapping | Teams migrating from raw HTTP calls or reviewing API ownership | Direct mapping between SDK methods and Console endpoints |
npm install @cognipeer/console-sdkyarn add @cognipeer/console-sdkpnpm add @cognipeer/console-sdkimport { ConsoleClient } from '@cognipeer/console-sdk';
const client = new ConsoleClient({
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 || '');
}📖 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.