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/types

Available Packages

PackageDescription
@codmir/sdkMain SDK bundle - unified API for all features
codmirCommand-line interface for developers
@codmir/clientAPI client for browser and Node.js
@codmir/eventsEvent system for real-time updates
@codmir/typesTypeScript type definitions
@codmir/contractsContract 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:

  1. Via GitHub App - Automatically provisioned when you install the Codmir GitHub App
  2. Via Dashboard - Create a token on the Account Settings page. The SDK sends it as a Bearer token in the Authorization header.
# Set in environment - CodmirClient reads this automatically if `apiKey` isn't passed
export CODMIR_API_KEY=your_api_key_here

Framework Support

FrameworkPackage
Node.js@codmir/sdk
Browser@codmir/client
React@codmir/sdk + hooks
Next.js@codmir/sdk (server)
CLIcodmir

Next Steps