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.
- 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:claude-sonnet-4-20250514- Latest Sonnet (recommended)claude-3-5-sonnet-20241022- Sonnet 3.5claude-3-5-haiku-20241022- Fast, cost-effective
OpenAI (GPT)
Access GPT models:gpt-4o- Latest GPT-4 Optimizedgpt-4o-mini- Fast, cost-effectiveo3-mini- Reasoning model
Ollama (Local)
Run models locally:- Install Ollama from ollama.com
- Pull a model:
ollama pull llama3.2 - Start Ollama service (automatic on most systems)
- Configure IronClaw to use Ollama
llama3.2- Meta’s latestmistral- Fast and efficientcodellama- Code-specializeddeepseek-coder- Code understanding
OpenRouter
Access 300+ models through a single API:
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:
Features:
- Fast inference (optimized infrastructure)
- Competitive pricing
- Open-source model focus
Fireworks AI
High-performance inference with compound AI support:- Sub-second latency
- Compound AI system support (function calling, tool use)
- Multi-model support
vLLM / LiteLLM (Self-Hosted)
Run your own inference server:vLLM
LiteLLM
Proxy that forwards to any backend (Bedrock, Vertex, Azure, etc.):LM Studio (Local GUI)
User-friendly local model hosting:- Download LM Studio
- Download a model from the catalog
- Start the local server (tab in LM Studio)
- 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:
- Prompt for LLM backend selection
- Request API keys (securely masked)
- Test the connection
- Save configuration to
.env
- 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:OpenAI
Function Calling: Native OpenAI function calling:Ollama
Model Pull: Automatically pull models if missing:Testing Configuration
Connection Test
Completion Test
Troubleshooting
Authentication Errors
- Verify API key is correct
- Check API key has not expired
- Ensure API key has necessary permissions
- For NEAR AI, re-run
ironclaw onboardto refresh OAuth token
Rate Limiting
- Reduce request frequency
- Increase retry delay:
LLM_RETRY_DELAY=5000 - Switch to a different provider/model
- Upgrade API plan for higher limits
Connection Timeout
- Increase timeout:
LLM_TIMEOUT=300 - Check network connectivity
- Verify proxy configuration
- Try a different model (some are slower)
Model Not Found
- Check model name spelling
- Verify model is available for your API key
- List available models:
ironclaw llm models - For Ollama, pull the model:
ollama pull model-name
Invalid Response Format
- Check base URL is correct (must include
/v1for OpenAI-compatible) - Verify provider is actually OpenAI-compatible
- Enable debug logging:
RUST_LOG=ironclaw::llm=debug - Test endpoint directly with curl
Cost Optimization
Model Selection
Choose cost-effective models:Prompt Optimization
- Reduce context: Minimize system prompts and skill content
- Cache prompts: Use Anthropic prompt caching for repeated long prompts
- Batch requests: Group similar tasks together
- Output limiting: Set
max_tokensappropriately
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 abstractionsrc/llm/anthropic.rs- Anthropic implementationsrc/llm/openai.rs- OpenAI implementationsrc/llm/ollama.rs- Ollama implementationsrc/llm/nearai.rs- NEAR AI implementationdocs/LLM_PROVIDERS.md- Additional provider documentation