Skip to main content

Overview

Forge supports 8 AI coding agents out of the box. Each agent needs proper configuration before use.
BYOL Architecture: Forge uses a “Bring Your Own LLM” model - you provide API keys, Forge handles orchestration.

Supported AI Agents

AgentTypeSetup Required
Claude CodeAPIAnthropic API key
Claude Code RouterAPIAny LLM API key (agnostic)
Cursor CLICLICursor account
GeminiAPIGoogle AI API key
OpenAI CodexAPIOpenAI API key
AmpAPISourcegraph token
OpenCodeLocalModel weights
Qwen CodeLocalModel weights

Configuration File

Forge stores LLM configuration in .forge/config.json:
.forge/config.json
{
  "llms": {
    "claude": {
      "apiKey": "sk-ant-...",
      "model": "claude-3-5-sonnet-20241022",
      "maxTokens": 4096
    },
    "gemini": {
      "apiKey": "AIza...",
      "model": "gemini-2.0-flash-exp"
    },
    "openai": {
      "apiKey": "sk-...",
      "model": "gpt-4-turbo",
      "organization": "org-..."
    }
  },
  "worktrees": {
    "enabled": true,
    "basePath": "./.forge/worktrees"
  }
}
Never commit .forge/config.json! Add it to .gitignore immediately:
echo ".forge/" >> .gitignore

Claude Code Setup

Get Your API Key

1

Create Anthropic Account

2

Generate API Key

Navigate to API Keys → Create Key
3

Configure Forge

{
  "llms": {
    "claude": {
      "apiKey": "sk-ant-api03-...",
      "model": "claude-3-5-sonnet-20241022",
      "maxTokens": 8192
    }
  }
}

Available Models

ModelContextBest For
claude-3-5-sonnet-20241022200KGeneral coding (recommended)
claude-3-opus-20240229200KComplex refactoring
claude-3-haiku-20240307200KFast iterations

Advanced Configuration

{
  "llms": {
    "claude": {
      "apiKey": "sk-ant-...",
      "model": "claude-3-5-sonnet-20241022",
      "maxTokens": 8192,
      "temperature": 0.7,
      "timeout": 60000,
      "retries": 3
    }
  }
}

Claude Code Router Setup

Claude Code Router is LLM-agnostic - use any model with an OpenAI-compatible API!

Configuration

{
  "llms": {
    "claude-router": {
      "apiKey": "your-api-key",
      "baseUrl": "https://api.openai.com/v1",  // Or any compatible endpoint
      "model": "gpt-4-turbo",
      "provider": "openai"  // openai, anthropic, custom
    }
  }
}

Supported Providers

  • OpenAI
  • Anthropic
  • Local (Ollama)
  • Custom
{
  "claude-router": {
    "apiKey": "sk-...",
    "baseUrl": "https://api.openai.com/v1",
    "model": "gpt-4-turbo",
    "provider": "openai"
  }
}

Gemini Setup

Get Your API Key

1

Go to Google AI Studio

2

Get API Key

Click “Get API Key” → Create API key
3

Configure Forge

{
  "llms": {
    "gemini": {
      "apiKey": "AIza...",
      "model": "gemini-2.0-flash-exp"
    }
  }
}

Available Models

ModelContextBest For
gemini-2.0-flash-exp1MFast iterations (recommended)
gemini-1.5-pro2MLarge codebases
gemini-1.5-flash1MQuick tasks

Cursor CLI Setup

Cursor CLI is separate from the Cursor IDE. You can use it independently!

Installation

# Install Cursor CLI
npm install -g @cursor/cli

# Authenticate
cursor auth login

Configuration

{
  "llms": {
    "cursor": {
      "enabled": true,
      "model": "claude-3.5-sonnet",
      "workingDirectory": "."
    }
  }
}
Cursor CLI respects your Cursor account subscription - no additional API keys needed!

OpenAI Codex Setup

Get Your API Key

1

Create OpenAI Account

2

Generate API Key

Navigate to API Keys → Create new secret key
3

Configure Forge

{
  "llms": {
    "openai": {
      "apiKey": "sk-...",
      "model": "gpt-4-turbo",
      "organization": "org-..."  // Optional
    }
  }
}

Available Models

ModelContextBest For
gpt-4-turbo128KGeneral coding
gpt-48KLegacy tasks
gpt-3.5-turbo16KSimple tasks

Open Source Agents

OpenCode (Local)

# Download model
ollama pull opencode

# Configure Forge
{
  "llms": {
    "opencode": {
      "enabled": true,
      "model": "opencode:latest",
      "endpoint": "http://localhost:11434"
    }
  }
}

Qwen Code (Local)

# Download model
ollama pull qwen2.5-coder:32b

# Configure Forge
{
  "llms": {
    "qwen": {
      "enabled": true,
      "model": "qwen2.5-coder:32b",
      "endpoint": "http://localhost:11434"
    }
  }
}

Configuration Best Practices

Start Simple

Begin with one agent (Claude or Gemini), add more later

Test Each Agent

Create a test task to verify configuration

Secure API Keys

Never commit .forge/config.json to version control

Monitor Usage

Track API costs per agent to optimize spending

Validation

Test your configuration:
# Start Forge
forge start

# Create test task
forge task create \
  --title "Test configuration" \
  --description "Print 'Hello from Forge!'" \
  --llm claude

# Should execute successfully

Troubleshooting

Symptoms: Authentication errors when running tasksSolutions:
  • Verify API key is correct (no extra spaces)
  • Check API key has proper permissions
  • Ensure API key isn’t expired
  • Confirm you have credits/quota remaining
Symptoms: “Model not available” errorsSolutions:
  • Check model name spelling (case-sensitive)
  • Verify model is available in your region
  • Ensure your API tier has access to the model
Symptoms: Tasks fail with timeoutSolutions:
  • Increase timeout value in config
  • Check network connectivity
  • Try a faster model (e.g., Haiku, Flash)
Symptoms: Cursor tasks fail immediatelySolutions:
# Re-authenticate
cursor auth logout
cursor auth login

Cost Optimization

Model Selection Strategy

1

Use Fast Models for Iteration

Start with fast, cheap models:
  • Claude Haiku
  • Gemini Flash
  • GPT-3.5 Turbo
2

Use Powerful Models for Complex Tasks

Switch to stronger models for:
  • Large refactoring
  • Architecture changes
  • Critical bug fixes
3

Compare Results

Run the same task with multiple models to find the sweet spot for each task type

Cost Comparison

ModelInputOutputSweet Spot
Claude Haiku$0.25/MTok$1.25/MTokQuick iterations
Gemini FlashFree tierFree tierExperimentation
GPT-3.5 Turbo$0.50/MTok$1.50/MTokSimple tasks
Claude Sonnet$3/MTok$15/MTokGeneral work
GPT-4 Turbo$10/MTok$30/MTokComplex tasks

Advanced: Multiple Configurations

Create environment-specific configs:
# Development
.forge/config.dev.json

# Production
.forge/config.prod.json

# CI/CD
.forge/config.ci.json
Switch between them:
FORGE_CONFIG=.forge/config.prod.json forge start

Next Steps