Skip to main content

Overview

IronClaw defaults to NEAR AI for model access but supports any OpenAI-compatible endpoint as well as Anthropic and Ollama directly. This guide covers configuration for all supported providers.

Provider Overview

Provider Configuration

NEAR AI (Default)

No additional configuration required. On first run, ironclaw onboard opens a browser for OAuth authentication. Credentials are saved to ~/.ironclaw/session.json.
Features:
  • OAuth authentication (no API key needed)
  • Multi-model support (Claude, GPT, Llama, etc.)
  • Usage tracking and billing through NEAR

Anthropic (Claude)

Direct access to Claude models:
Popular Models:
  • claude-sonnet-4-20250514 - Latest Sonnet (recommended)
  • claude-3-5-sonnet-20241022 - Sonnet 3.5
  • claude-3-5-haiku-20241022 - Fast, cost-effective
Configuration Options:

OpenAI (GPT)

Access GPT models:
Popular Models:
  • gpt-4o - Latest GPT-4 Optimized
  • gpt-4o-mini - Fast, cost-effective
  • o3-mini - Reasoning model
Configuration Options:

Ollama (Local)

Run models locally:
Setup:
  1. Install Ollama from ollama.com
  2. Pull a model: ollama pull llama3.2
  3. Start Ollama service (automatic on most systems)
  4. Configure IronClaw to use Ollama
Configuration Options:
Popular Models:
  • llama3.2 - Meta’s latest
  • mistral - Fast and efficient
  • codellama - Code-specialized
  • deepseek-coder - Code understanding

OpenRouter

Access 300+ models through a single API:
Popular Models: Browse all models at openrouter.ai/models. Features:
  • Unified API for all major model providers
  • Automatic fallback if primary model is unavailable
  • Usage analytics and cost tracking

Together AI

Fast inference for open-source models:
Popular Models: Features:
  • Fast inference (optimized infrastructure)
  • Competitive pricing
  • Open-source model focus

Fireworks AI

High-performance inference with compound AI support:
Features:
  • Sub-second latency
  • Compound AI system support (function calling, tool use)
  • Multi-model support

vLLM / LiteLLM (Self-Hosted)

Run your own inference server:

vLLM

Setup:

LiteLLM

Proxy that forwards to any backend (Bedrock, Vertex, Azure, etc.):
Setup:

LM Studio (Local GUI)

User-friendly local model hosting:
Setup:
  1. Download LM Studio
  2. Download a model from the catalog
  3. Start the local server (tab in LM Studio)
  4. Configure IronClaw to use the endpoint

Advanced Configuration

Model Metadata Override

Override context length and max output:

Streaming

Enable/disable streaming responses:

Retry Configuration

Request Headers

Add custom headers to LLM requests:

Proxy Configuration

Route LLM requests through HTTP proxy:

Setup Wizard

Instead of editing .env manually, run the onboarding wizard:
The wizard will:
  1. Prompt for LLM backend selection
  2. Request API keys (securely masked)
  3. Test the connection
  4. Save configuration to .env
Wizard Options:
  • NEAR AI (OAuth flow)
  • Anthropic (API key)
  • OpenAI (API key)
  • Ollama (model selection)
  • OpenAI-compatible (custom endpoint)

Provider-Specific Features

Anthropic

Tool Use (Function Calling): Anthropic’s native tool use format is fully supported:
Prompt Caching: Long prompts are automatically cached:

OpenAI

Function Calling: Native OpenAI function calling:
Response Format: Enforce JSON output:

Ollama

Model Pull: Automatically pull models if missing:
Keep Alive: Control model unloading:

Testing Configuration

Connection Test

Completion Test

Troubleshooting

Authentication Errors

Solutions:
  1. Verify API key is correct
  2. Check API key has not expired
  3. Ensure API key has necessary permissions
  4. For NEAR AI, re-run ironclaw onboard to refresh OAuth token

Rate Limiting

Solutions:
  1. Reduce request frequency
  2. Increase retry delay: LLM_RETRY_DELAY=5000
  3. Switch to a different provider/model
  4. Upgrade API plan for higher limits

Connection Timeout

Solutions:
  1. Increase timeout: LLM_TIMEOUT=300
  2. Check network connectivity
  3. Verify proxy configuration
  4. Try a different model (some are slower)

Model Not Found

Solutions:
  1. Check model name spelling
  2. Verify model is available for your API key
  3. List available models: ironclaw llm models
  4. For Ollama, pull the model: ollama pull model-name

Invalid Response Format

Solutions:
  1. Check base URL is correct (must include /v1 for OpenAI-compatible)
  2. Verify provider is actually OpenAI-compatible
  3. Enable debug logging: RUST_LOG=ironclaw::llm=debug
  4. Test endpoint directly with curl

Cost Optimization

Model Selection

Choose cost-effective models:

Prompt Optimization

  1. Reduce context: Minimize system prompts and skill content
  2. Cache prompts: Use Anthropic prompt caching for repeated long prompts
  3. Batch requests: Group similar tasks together
  4. Output limiting: Set max_tokens appropriately

Provider Comparison

Migration Guide

From OpenAI to Anthropic

From Cloud to Local (Ollama)

From Direct to OpenRouter

Source Code

Key files:
  • src/llm/mod.rs - LLM provider abstraction
  • src/llm/anthropic.rs - Anthropic implementation
  • src/llm/openai.rs - OpenAI implementation
  • src/llm/ollama.rs - Ollama implementation
  • src/llm/nearai.rs - NEAR AI implementation
  • docs/LLM_PROVIDERS.md - Additional provider documentation