Cognipeer Client SDK
Official JavaScript and TypeScript SDK for Cognipeer Studio. Connect applications to Studio conversations, channels, peers, users, and client-side tool execution from the browser or server.
Product and application teams integrating Cognipeer Studio into web apps, backends, and custom conversational experiences.
Key Features
Work with Studio conversations, channels, peers, and users through a typed JavaScript and TypeScript client.
Define JavaScript functions in your app and let the AI call them directly with structured arguments and retry-aware execution.
Run the same SDK in browser applications, Node.js services, and edge-compatible environments.
Authenticate with Studio-compatible credentials such as personal access tokens and hook-based integration flows.
Trigger structured workflows and automations with predictable request and response contracts.
Use full TypeScript types for requests, responses, pagination, and client tool contracts.
Reuse familiar function-calling schemas while keeping tool execution on your own client or infrastructure.
Quick Start
Use the Client SDK when you are integrating Cognipeer Studio concepts into your own product and want browser-safe, type-safe access to conversations, channels, peers, and client-side tools.
Installation
npm install @cognipeer/sdk
Initialize The Client
import { CognipeerClient } from '@cognipeer/sdk';
const client = new CognipeerClient({
token: process.env.COGNIPEER_PAT!,
hookId: 'your-channel-hook-id',
});Read Studio Context
const peer = await client.peers.get(); const user = await client.users.get(); const channel = await client.channels.get(); console.log(peer.name, user.email, channel.name);
Create A Conversation With Client Tools
const response = await client.conversations.create({
messages: [
{ role: 'user', content: 'What is the weather in Berlin?' },
],
clientTools: [
{
type: 'function',
function: {
name: 'getCurrentWeather',
description: 'Get current weather for a location',
parameters: {
type: 'object',
properties: {
location: { type: 'string' },
},
required: ['location'],
},
},
implementation: async ({ location }) => {
return { location, forecast: 'Sunny', temperatureC: 22 };
},
},
],
});
console.log(response.content);Cognipeer Client SDK vs Alternatives
| Product | Primary Role | Studio Auth | Client Tools | Browser Ready | Typed Resources | Conversation API | Flow Support | Pagination | Open Source |
|---|---|---|---|---|---|---|---|---|---|
Cognipeer Client SDK | Studio Integration SDK | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Direct REST Calls | Handwritten HTTP Client | △ | △ | ✓ | ✕ | △ | △ | ✕ | ✓ |
OpenAI Node SDK | Model Provider SDK | ✕ | △ | △ | ✓ | ✕ | ✕ | ✕ | ✓ |
Generic Fetch Wrapper | Custom API Helper | △ | ✕ | ✓ | △ | △ | △ | △ | ✓ |