docsAdding New Models

Adding New Models

Understanding the Models Configuration

Models are defined in the models.json file. Each model includes pricing and technical specifications.

Current Models Format

{
  "claude-sonnet-4-20250514": {
    "input": 3.0,
    "output": 15.0,
    "cacheWrite": 3.75,
    "cacheRead": 0.30,
    "contextWindow": 200000,
    "sessionQuota": 6.00,
    "description": "Claude Sonnet 4 (2025-05-14)"
  },
  "claude-opus-4": {
    "input": 15.0,
    "output": 75.0,
    "cacheWrite": 18.75,
    "cacheRead": 1.50,
    "contextWindow": 200000,
    "sessionQuota": 10.00,
    "description": "Claude Opus 4"
  },
  "grok-code": {
    "input": 0.0,
    "output": 0.0,
    "cacheWrite": 0.0,
    "cacheRead": 0.0,
    "contextWindow": 256000,
    "sessionQuota": 0.0,
    "description": "Grok Code (Free)"
  }
}

Adding a New Model

Step 1: Edit models.json

Add your new model to the models.json file:

{
  "existing-models": "...",
 
  "new-ai-model": {
    "input": 5.0,
    "output": 25.0,
    "cacheWrite": 6.25,
    "cacheRead": 0.50,
    "contextWindow": 128000,
    "sessionQuota": 15.0,
    "description": "New AI Model"
  },
 
  "another-model": {
    "input": 0.0,
    "output": 0.0,
    "cacheWrite": 0.0,
    "cacheRead": 0.0,
    "contextWindow": 100000,
    "sessionQuota": 0.0,
    "description": "Another Free Model"
  }
}

Step 2: Verify the Addition

Test that your new model is recognized:

# Check if the model appears in configuration
ocmonitor config show
 
# Test with session data that uses the new model
ocmonitor sessions /path/to/sessions

Step 3: Handle Fully Qualified Names

For models with provider prefixes (like provider/model-name), add both versions:

{
  "provider/model-name": {
    "input": 2.0,
    "output": 10.0,
    "cacheWrite": 2.5,
    "cacheRead": 0.20,
    "contextWindow": 150000,
    "sessionQuota": 8.0,
    "description": "Provider Model"
  },
  "model-name": {
    "input": 2.0,
    "output": 10.0,
    "cacheWrite": 2.5,
    "cacheRead": 0.20,
    "contextWindow": 150000,
    "sessionQuota": 8.0,
    "description": "Provider Model (short name)"
  }
}

Model Configuration Fields

FieldDescriptionRequiredExample
inputCost per 1M input tokens (USD)Yes3.0
outputCost per 1M output tokens (USD)Yes15.0
cacheWriteCost per 1M cache write tokens (USD)Yes3.75
cacheReadCost per 1M cache read tokens (USD)Yes0.30
contextWindowMaximum context window sizeYes200000
sessionQuotaMaximum session cost quota (USD)Yes6.00
descriptionHuman-readable model nameNo"Claude Sonnet 4"

Field Details

  • input: Base cost for processing input tokens (prompt tokens)
  • output: Cost for generating output tokens (response tokens)
  • cacheWrite: Cost for writing tokens to cache (context caching feature)
  • cacheRead: Cost for reading tokens from cache (much cheaper than input)
  • contextWindow: Maximum number of tokens the model can process in one request
  • sessionQuota: Maximum cost limit per session (0 = no limit)
  • description: Optional human-readable name for display purposes

Free Models

For free models, set all costs to 0.0:

{
  "free-model": {
    "input": 0.0,
    "output": 0.0,
    "cacheWrite": 0.0,
    "cacheRead": 0.0,
    "contextWindow": 100000,
    "sessionQuota": 0.0,
    "description": "Free AI Model"
  }
}

Pricing Examples

Premium Model (with caching support)

{
  "anthropic.claude-sonnet-4-20250514-v1:0": {
    "input": 3.0,
    "output": 15.0,
    "cacheWrite": 3.75,
    "cacheRead": 0.30,
    "contextWindow": 1000000,
    "sessionQuota": 10.0,
    "description": "Claude Sonnet 4 (2025-05-14)"
  }
}

Basic Model (no caching)

{
  "gpt-4o": {
    "input": 2.50,
    "output": 10.0,
    "cacheWrite": 0.0,
    "cacheRead": 0.0,
    "contextWindow": 128000,
    "sessionQuota": 0.0,
    "description": "GPT-4o"
  }
}