Codmir SDK packages for building AI-powered applications
Codmir Packages
The Codmir SDK is composed of several packages that you can use together or independently.
Installation
# Install the full SDK (recommended)
npm install @codmir/sdk
# Or install individual packages
npm install @codmir/client @codmir/events @codmir/typesAvailable Packages
| Package | Description |
|---|---|
@codmir/sdk | Main SDK bundle - unified API for all features |
codmir | Command-line interface for developers |
@codmir/client | API client for browser and Node.js |
@codmir/events | Event system for real-time updates |
@codmir/types | TypeScript type definitions |
@codmir/contracts | Contract definitions for workflows |
Quick Start
import { CodmirClient } from '@codmir/sdk';
// Initialize with your API key
const codmir = new CodmirClient({
apiKey: process.env.CODMIR_API_KEY,
});
// Send a chat message - chat() returns the raw Response and streams its
// reply rather than returning JSON; see the SDK reference for how to read it
const response = await codmir.chat({
messages: [{ role: 'user', content: 'Help me review this code' }],
});codmir (the @codmir/sdk client) has no events namespace. To publish or read
events, use the EventClient from @codmir/events
instead:
import { EventClient } from '@codmir/events';
const events = new EventClient({
serviceUrl: process.env.CODMIR_EVENTS_URL,
apiKey: process.env.CODMIR_TOKEN,
});
await events.publish({
type: 'custom.event',
data: { action: 'deploy' },
});
const recent = await events.getEvents('ci.workflow.completed', 100);Authentication
All API calls require authentication via a Codmir API key:
- Via GitHub App - Automatically provisioned when you install the Codmir GitHub App
- Via Dashboard - Create a token on the Account Settings page. The SDK sends it as a Bearer token in the
Authorizationheader.
# Set in environment - CodmirClient reads this automatically if `apiKey` isn't passed
export CODMIR_API_KEY=your_api_key_hereFramework Support
| Framework | Package |
|---|---|
| Node.js | @codmir/sdk |
| Browser | @codmir/client |
| React | @codmir/sdk + hooks |
| Next.js | @codmir/sdk (server) |
| CLI | codmir |
Next Steps
- SDK Reference - Full SDK documentation
- CLI Guide - Command-line usage
- Events - Event system guide
- API Reference - REST API documentation