Skip to main content
Official client libraries for integrating Case.dev into your application, generated with Stainless.

Available SDKs

We provide official SDKs for the following languages:
  • TypeScript / JavaScript - For Node.js, Deno, Bun, and browsers
  • Python - Synchronous and async support
  • Go - Full type-safe Go SDK
  • CLI - Full-featured command-line interface
All SDKs are type-safe, well-documented, and maintained automatically from our OpenAPI specification.

TypeScript

npm

Installation

npm install casedev

Quick Start

import Casedev from 'casedev';

const client = new Casedev({
  apiKey: process.env.CASEDEV_API_KEY,
  environment: 'production' // or 'local' for development
});

// Create a vault
const vault = await client.vault.create({
  name: 'My Documents',
  description: 'Legal document repository'
});

// Chat with an LLM
const response = await client.llm.v1.chat.createCompletion({
  model: 'anthropic/claude-3-5-sonnet-20241022',
  messages: [
    { role: 'user', content: 'Summarize this contract...' }
  ]
});

Features

  • ✅ Full TypeScript support with type inference
  • ✅ Promise-based async API
  • ✅ Automatic retries with exponential backoff
  • ✅ Streaming support for real-time responses
  • ✅ Works in Node.js, Deno, Bun, and browsers

Repository

github.com/CaseMark/casedev-typescript

Python

PyPI

Installation

pip install casedev

Quick Start

from casedev import Casedev

client = Casedev(
    api_key="sk_case_...",
    environment="production"  # or "local"
)

# Create a vault
vault = client.vault.create(
    name="My Documents",
    description="Legal document repository"
)

# Chat with an LLM
response = client.llm.v1.chat.create_completion(
    model="anthropic/claude-3-5-sonnet-20241022",
    messages=[
        {"role": "user", "content": "Summarize this contract..."}
    ]
)

print(response.choices[0].message.content)

Async Support

from casedev import AsyncCasedev
import asyncio

async def main():
    async with AsyncCasedev(api_key="sk_case_...") as client:
        response = await client.llm.v1.chat.create_completion(
            messages=[{"role": "user", "content": "Hello!"}]
        )
        print(response.choices[0].message.content)

asyncio.run(main())

Features

  • ✅ Full type hints with modern Python
  • ✅ Synchronous and asynchronous clients
  • ✅ aiohttp support for better async performance
  • ✅ Automatic retries and error handling
  • ✅ Python 3.9+ support

Repository

github.com/CaseMark/casedev-python

Go

Installation

go get -u github.com/CaseMark/casedev-go
Requires Go 1.22+.

Quick Start

package main

import (
	"context"
	"fmt"

	casedev "github.com/CaseMark/casedev-go"
	"github.com/CaseMark/casedev-go/option"
)

func main() {
	client := casedev.NewClient(
		option.WithAPIKey("sk_case_YOUR_API_KEY"),        // or set CASEDEV_API_KEY env var
		option.WithEnvironmentProduction(),                // default
	)

	// Create a vault
	vault, _ := client.Vault.New(context.TODO(), casedev.VaultNewParams{
		Name:        casedev.F("My Documents"),
		Description: casedev.F("Legal document repository"),
	})

	// Chat with an LLM
	resp, _ := client.Llm.V1.Chat.NewCompletion(context.TODO(), casedev.LlmV1ChatNewCompletionParams{
		Model: casedev.F("anthropic/claude-sonnet-4.5"),
		Messages: casedev.F([]casedev.LlmV1ChatNewCompletionParamsMessage{{
			Role:    casedev.F(casedev.LlmV1ChatNewCompletionParamsMessagesRoleUser),
			Content: casedev.F("Summarize this contract..."),
		}}),
	})

	fmt.Println(resp.Choices[0].Message.Content)
}

Features

  • Full type safety with Go generics
  • Automatic retries with exponential backoff (2 retries by default)
  • Configurable via option.With* helpers
  • Environment variable auto-detection (CASEDEV_API_KEY)
  • Raw HTTP response access via option.WithResponseInto

Repository

github.com/CaseMark/casedev-go

CLI

Installation

# Homebrew (recommended)
brew tap CaseMark/casedev
brew install casedev

# Or via Go
go install github.com/CaseMark/casedev-cli/cmd/casedev@latest
Pre-built binaries for macOS, Linux, and Windows are available on GitHub Releases.

Quick Start

# Set your API key
export CASEDEV_API_KEY=sk_case_YOUR_API_KEY

# Chat with an LLM
casedev llm:v1:chat create-completion \
  --model anthropic/claude-sonnet-4.5 \
  --message '{role: user, content: "Summarize this contract..."}'

# Search a vault
casedev vault search \
  --id vault_abc123 \
  --query "termination clauses"

# List available models
casedev llm:v1 list-models

Features

  • All API operations available as CLI commands
  • JSON, YAML, and interactive output formats (--format json|yaml|explore)
  • File upload via @ prefix (--arg @file.pdf)
  • Pipe-friendly: reads JSON/YAML from stdin
  • Shell completions for bash, zsh, and fish
  • Debug mode with full HTTP logging (--debug)

Command Structure

Commands follow a resource:version:sub action pattern:
casedev llm:v1:chat create-completion    # LLM chat
casedev vault search                     # Vault search
casedev ocr:v1 process                   # OCR processing
casedev voice:transcription create       # Voice transcription
casedev legal:v1 find                    # Legal research
casedev search:v1 answer                 # Web search AI answer

Repositories


Authentication

All SDKs require an API key from the Case.dev dashboard.
# Set as environment variable
export CASEDEV_API_KEY=sk_case_...
The Go SDK and CLI automatically read the CASEDEV_API_KEY environment variable. No additional configuration is needed. API keys starting with sk_case_ are production keys. Development keys are available for testing.

Scoped Permissions

API keys can be scoped to specific services with read or write access. If your key lacks permission for a service, you’ll receive a 403 Forbidden error. Check your key’s permissions in the dashboard.

Error Handling

All SDKs provide typed error classes for handling API errors: TypeScript:
try {
  await client.vault.retrieve('invalid-id');
} catch (error) {
  if (error instanceof Casedev.NotFoundError) {
    console.log('Vault not found:', error.status);
  }
}
Python:
from casedev import NotFoundError

try:
    client.vault.retrieve('invalid-id')
except NotFoundError as e:
    print(f'Vault not found: {e.status}')
Go:
import (
	"errors"
	casedev "github.com/CaseMark/casedev-go"
)

vault, err := client.Vault.Get(context.TODO(), "invalid-id")
if err != nil {
	var apierr *casedev.Error
	if errors.As(err, &apierr) {
		fmt.Println("Status:", apierr.StatusCode) // 404
	}
}
CLI:
# Errors are printed to stderr with status codes
casedev vault retrieve --id invalid-id
# Error: 404 Not Found

Rate Limits

All API requests are subject to rate limits based on your plan. SDKs automatically handle rate limit responses with exponential backoff retries.

Support

Open Source

All SDKs are open source under the Apache 2.0 license. Contributions are welcome!

Next Steps