Spaces:
Sleeping
Sleeping
File size: 6,306 Bytes
116524e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | # Setup
Configure your LLM provider and model selection for ACE.
## Guided Setup (Recommended)
The `ace setup` command walks you through configuration interactively — it validates the connection first, and only asks for credentials if needed.
```bash
ace setup
```
```
ACE Setup
Step 1: Choose your model
Examples: gpt-4o-mini, claude-sonnet-4-20250514, ollama/llama2
Search models: ace models <query>
Default model: gpt-4o-mini
v Connected! (gpt-4o-mini via openai, 203ms)
Using OPENAI_API_KEY
Step 2: Role assignment
ACE uses three roles. You can assign a different model to each,
or use the same model for all (recommended to start).
Use this model for all roles? [Y/n]: n
Agent (executes tasks) [gpt-4o-mini]: claude-sonnet-4-20250514
! No credentials found for anthropic
ANTHROPIC_API_KEY: sk-ant-...
v Connected! (claude-sonnet-4-20250514 via anthropic, 347ms)
v Saved credentials to .env
Reflector (analyses results) [gpt-4o-mini]:
Skill Manager (updates skillbook) [gpt-4o-mini]:
v Saved model config to ace.toml
Configuration summary:
default: gpt-4o-mini
agent: claude-sonnet-4-20250514
```
The wizard tries the connection immediately — if your credentials are already in the environment (via `.env`, exported variables, or cloud auth like AWS), it just works. It only prompts for keys when the connection actually fails.
This creates two files:
| File | Contains | Commit to git? |
|------|----------|----------------|
| `.env` | API keys only | No (gitignore it) |
| `ace.toml` | Model names per role | Yes (no secrets) |
Then in your code:
```python
from ace import ACELiteLLM
ace = ACELiteLLM.from_setup()
answer = ace.ask("What is 2+2?")
```
## Manual Setup
If you prefer not to use the CLI, set environment variables directly.
### 1. Set API keys
=== "Shell"
```bash
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
```
=== ".env file"
```bash
# .env (add to .gitignore)
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
```
### 2. Use in code
```python
from ace import ACELiteLLM
# Single model for all roles
ace = ACELiteLLM.from_model("gpt-4o-mini")
```
```python
from ace import ACELiteLLM, ACEModelConfig, ModelConfig
# Different models per role
ace = ACELiteLLM.from_config(ACEModelConfig(
default=ModelConfig(model="gpt-4o-mini"),
agent=ModelConfig(model="claude-sonnet-4-20250514"),
))
```
## Per-Role Model Selection
ACE has three roles, each making LLM calls. You can assign different models to optimise cost vs quality:
| Role | What it does | Recommendation |
|------|-------------|----------------|
| **Agent** | Executes tasks, produces answers | Strong reasoning model |
| **Reflector** | Analyses results, extracts lessons | Good analysis, lower cost OK |
| **Skill Manager** | Updates the skillbook | Structured output reliability |
Example `ace.toml`:
```toml
[default]
model = "gpt-4o-mini"
[agent]
model = "claude-sonnet-4-20250514"
max_tokens = 4096
[reflector]
model = "gpt-4o-mini"
```
Roles without an explicit section use `[default]`.
## Discovering Models
### Search available models
Use multiple terms to narrow results — all terms must match:
```bash
ace models claude # All Claude models
ace models haiku us # Only US-region Haiku models
ace models gpt 4o # GPT-4o variants
ace models --provider openai # All OpenAI models
```
Output shows model name, provider, pricing, and whether your API key is configured:
```
Model Provider Input $/M Output $/M Key
------------------------------------------------------------------------------------------
us.anthropic.claude-haiku-4-5-20251001-v1:0 bedrock_converse $1.10 $5.50 v
claude-haiku-4-5-20251001 anthropic $1.00 $5.00 x
Showing 20 of 40 models. Narrow your search: ace models <query> or use --limit 40
```
### Validate a specific model
```bash
ace validate us.anthropic.claude-haiku-4-5-20251001-v1:0
```
Makes a tiny test call (3 tokens) to confirm the key, model, and network all work.
## Supported Providers
ACE uses [LiteLLM](https://docs.litellm.ai/) for model access. Any model string LiteLLM supports will work:
| Provider | Model Example | Env Variable |
|----------|--------------|--------------|
| OpenAI | `gpt-4o-mini` | `OPENAI_API_KEY` |
| Anthropic | `claude-sonnet-4-20250514` | `ANTHROPIC_API_KEY` |
| AWS Bedrock | `us.anthropic.claude-haiku-4-5-20251001-v1:0` | `AWS_ACCESS_KEY_ID` + `AWS_SECRET_ACCESS_KEY` + `AWS_REGION_NAME` |
| Google Gemini | `gemini/gemini-2.0-flash` | `GEMINI_API_KEY` |
| DeepSeek | `deepseek/deepseek-chat` | `DEEPSEEK_API_KEY` |
| Groq | `groq/llama-3.1-70b` | `GROQ_API_KEY` |
| Ollama (local) | `ollama/llama2` | --- |
| Azure OpenAI | `azure/gpt-4` | `AZURE_API_KEY` |
| OpenRouter | `openrouter/anthropic/claude-3.5-sonnet` | `OPENROUTER_API_KEY` |
100+ providers supported. Run `ace models` to search the full catalog.
## Troubleshooting
### "No ace.toml found"
Run `ace setup` or use `ACELiteLLM.from_model("gpt-4o-mini")` instead of `from_setup()`.
### "Invalid API key"
```bash
# Re-validate
ace validate gpt-4o-mini
# Re-run setup to fix
ace setup
```
### "Model not found"
The model string may have a typo. `ace validate` and `ace setup` suggest alternatives:
```bash
ace validate claud-sonnet
# x Model 'claud-sonnet' not found at the provider.
# Did you mean:
# - claude-sonnet-4-20250514
# - claude-3-5-sonnet-20241022
```
### "Could not detect a provider"
Use the `provider/model-name` format:
```bash
# Instead of just "llama2":
ollama/llama2
groq/llama-3.1-70b
```
Search for the correct model string: `ace models llama`
## What to Read Next
- [Quick Start](quick-start.md) --- build your first self-learning agent
- [How ACE Works](../concepts/overview.md) --- understand the three-role architecture
- [Integrations](../integrations/index.md) --- LangChain, Browser-Use, Claude Code
|