Skip to content

Commit 75d5027

Browse files
committed
feat(config): add multi-AI model support with ai[0-9]- slots
- Support for up to 11 AI models simultaneously (1 primary + 10 slots) - Added ai[0-9]-{provider,model,api-key} configuration options (30 new options) - Enhanced generate_config() to create multiple auth profiles with unique IDs - Enhanced validate_config() to validate all AI model slots comprehensively - Updated documentation with multi-AI model examples and troubleshooting Configuration: - Primary model: ai-provider, ai-model, ai-api-key (unchanged) - Additional slots: ai0-provider through ai9-provider (and model/api-key) - Each slot requires all 3 parameters if any is configured Implementation: - Auth profiles generated with IDs like 'google:manual' (primary) and 'anthropic:slot0' (additional) - Validation ensures complete configuration per slot - Detects partial configurations and invalid providers - Supports anthropic, openai, google, bedrock, ollama providers Testing: ✓ Successfully generated auth-profiles.json with 3 models (google + anthropic + openai) ✓ Validation correctly rejects partial configurations ✓ Validation correctly rejects invalid provider names ✓ All profiles appear in auth-profiles.json with correct structure Files modified: - config.yaml: Added 30 new config options for ai0-ai9 slots - hooks/common.sh: Updated generate_config() and validate_config() - README.md: Added multi-AI model configuration section - FAQ.md: Added multi-AI model FAQ entry - docs/index.html: Updated web documentation with multi-model support
1 parent 9fa9ae9 commit 75d5027

5 files changed

Lines changed: 346 additions & 18 deletions

File tree

FAQ.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,39 @@ juju config openclaw \
359359

360360
---
361361

362+
### How do I configure multiple AI models?
363+
364+
OpenClaw Charm supports up to 11 AI models simultaneously (1 primary + 10 additional slots):
365+
366+
```bash
367+
# Configure primary AI model
368+
juju config openclaw \
369+
ai-provider="anthropic" \
370+
ai-api-key="sk-ant-xxx" \
371+
ai-model="claude-opus-4-5"
372+
373+
# Add additional models in slots 0-9
374+
juju config openclaw \
375+
ai0-provider="openai" \
376+
ai0-model="gpt-4" \
377+
ai0-api-key="sk-xxx"
378+
379+
juju config openclaw \
380+
ai1-provider="google" \
381+
ai1-model="gemini-2.0-flash" \
382+
ai1-api-key="YOUR-GEMINI-KEY"
383+
```
384+
385+
**Important:** Each slot requires all three parameters (provider, model, api-key). Partial configuration will fail validation.
386+
387+
**Verify configuration:**
388+
```bash
389+
# Check all configured models
390+
juju ssh openclaw/0 'cat /home/ubuntu/.openclaw/agents/main/agent/auth-profiles.json | jq .'
391+
```
392+
393+
---
394+
362395
## Troubleshooting
363396

364397
### The gateway service won't start

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,50 @@ juju config openclaw \
115115
ai-model="llama3"
116116
```
117117

118+
### Multi-AI Model Support
119+
120+
OpenClaw Charm supports configuring up to 11 AI models simultaneously (1 primary + 10 additional slots). This enables model switching, fallback, and specialized model usage for different tasks.
121+
122+
**Configure Additional AI Models**
123+
```bash
124+
# Configure primary AI model
125+
juju config openclaw \
126+
ai-provider="anthropic" \
127+
ai-api-key="sk-ant-xxx" \
128+
ai-model="claude-opus-4-5"
129+
130+
# Add additional models in slots 0-9
131+
juju config openclaw \
132+
ai0-provider="openai" \
133+
ai0-model="gpt-4" \
134+
ai0-api-key="sk-xxx"
135+
136+
juju config openclaw \
137+
ai1-provider="google" \
138+
ai1-model="gemini-2.0-flash" \
139+
ai1-api-key="YOUR-GEMINI-API-KEY"
140+
141+
juju config openclaw \
142+
ai2-provider="anthropic" \
143+
ai2-model="claude-sonnet-4" \
144+
ai2-api-key="sk-ant-yyy"
145+
```
146+
147+
**All AI Slots**
148+
- Primary: `ai-provider`, `ai-model`, `ai-api-key`
149+
- Slot 0: `ai0-provider`, `ai0-model`, `ai0-api-key`
150+
- Slot 1: `ai1-provider`, `ai1-model`, `ai1-api-key`
151+
- Slot 2: `ai2-provider`, `ai2-model`, `ai2-api-key`
152+
- Slot 3: `ai3-provider`, `ai3-model`, `ai3-api-key`
153+
- Slot 4: `ai4-provider`, `ai4-model`, `ai4-api-key`
154+
- Slot 5: `ai5-provider`, `ai5-model`, `ai5-api-key`
155+
- Slot 6: `ai6-provider`, `ai6-model`, `ai6-api-key`
156+
- Slot 7: `ai7-provider`, `ai7-model`, `ai7-api-key`
157+
- Slot 8: `ai8-provider`, `ai8-model`, `ai8-api-key`
158+
- Slot 9: `ai9-provider`, `ai9-model`, `ai9-api-key`
159+
160+
Each slot requires all three parameters (provider, model, api-key) to be configured. Partially configured slots will trigger validation errors.
161+
118162
### Messaging Channels
119163

120164
**Enable Telegram**
@@ -181,6 +225,9 @@ juju config openclaw log-level="debug"
181225
| `ai-provider` | string | - | AI provider: anthropic, openai, google, bedrock, ollama |
182226
| `ai-model` | string | - | AI model name |
183227
| `ai-api-key` | string | - | API key for selected provider |
228+
| `ai0-provider` ... `ai9-provider` | string | - | Additional AI provider slots (0-9) |
229+
| `ai0-model` ... `ai9-model` | string | - | Additional AI model name slots (0-9) |
230+
| `ai0-api-key` ... `ai9-api-key` | string | - | Additional AI API key slots (0-9) |
184231
| `telegram-bot-token` | string | - | Telegram bot token from @BotFather |
185232
| `discord-bot-token` | string | - | Discord bot token |
186233
| `slack-bot-token` | string | - | Slack bot token (xoxb-...) |

config.yaml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,157 @@ options:
3636
For OpenAI: OpenAI API key
3737
For Google: Google Gemini API key
3838
39+
# Additional AI models (ai0 through ai9) for multi-model support
40+
ai0-provider:
41+
type: string
42+
default: ""
43+
description: AI provider for model slot 0 (anthropic, openai, google, bedrock, ollama)
44+
45+
ai0-model:
46+
type: string
47+
default: ""
48+
description: AI model name for slot 0
49+
50+
ai0-api-key:
51+
type: string
52+
default: ""
53+
description: API key for AI model slot 0
54+
55+
ai1-provider:
56+
type: string
57+
default: ""
58+
description: AI provider for model slot 1 (anthropic, openai, google, bedrock, ollama)
59+
60+
ai1-model:
61+
type: string
62+
default: ""
63+
description: AI model name for slot 1
64+
65+
ai1-api-key:
66+
type: string
67+
default: ""
68+
description: API key for AI model slot 1
69+
70+
ai2-provider:
71+
type: string
72+
default: ""
73+
description: AI provider for model slot 2 (anthropic, openai, google, bedrock, ollama)
74+
75+
ai2-model:
76+
type: string
77+
default: ""
78+
description: AI model name for slot 2
79+
80+
ai2-api-key:
81+
type: string
82+
default: ""
83+
description: API key for AI model slot 2
84+
85+
ai3-provider:
86+
type: string
87+
default: ""
88+
description: AI provider for model slot 3 (anthropic, openai, google, bedrock, ollama)
89+
90+
ai3-model:
91+
type: string
92+
default: ""
93+
description: AI model name for slot 3
94+
95+
ai3-api-key:
96+
type: string
97+
default: ""
98+
description: API key for AI model slot 3
99+
100+
ai4-provider:
101+
type: string
102+
default: ""
103+
description: AI provider for model slot 4 (anthropic, openai, google, bedrock, ollama)
104+
105+
ai4-model:
106+
type: string
107+
default: ""
108+
description: AI model name for slot 4
109+
110+
ai4-api-key:
111+
type: string
112+
default: ""
113+
description: API key for AI model slot 4
114+
115+
ai5-provider:
116+
type: string
117+
default: ""
118+
description: AI provider for model slot 5 (anthropic, openai, google, bedrock, ollama)
119+
120+
ai5-model:
121+
type: string
122+
default: ""
123+
description: AI model name for slot 5
124+
125+
ai5-api-key:
126+
type: string
127+
default: ""
128+
description: API key for AI model slot 5
129+
130+
ai6-provider:
131+
type: string
132+
default: ""
133+
description: AI provider for model slot 6 (anthropic, openai, google, bedrock, ollama)
134+
135+
ai6-model:
136+
type: string
137+
default: ""
138+
description: AI model name for slot 6
139+
140+
ai6-api-key:
141+
type: string
142+
default: ""
143+
description: API key for AI model slot 6
144+
145+
ai7-provider:
146+
type: string
147+
default: ""
148+
description: AI provider for model slot 7 (anthropic, openai, google, bedrock, ollama)
149+
150+
ai7-model:
151+
type: string
152+
default: ""
153+
description: AI model name for slot 7
154+
155+
ai7-api-key:
156+
type: string
157+
default: ""
158+
description: API key for AI model slot 7
159+
160+
ai8-provider:
161+
type: string
162+
default: ""
163+
description: AI provider for model slot 8 (anthropic, openai, google, bedrock, ollama)
164+
165+
ai8-model:
166+
type: string
167+
default: ""
168+
description: AI model name for slot 8
169+
170+
ai8-api-key:
171+
type: string
172+
default: ""
173+
description: API key for AI model slot 8
174+
175+
ai9-provider:
176+
type: string
177+
default: ""
178+
description: AI provider for model slot 9 (anthropic, openai, google, bedrock, ollama)
179+
180+
ai9-model:
181+
type: string
182+
default: ""
183+
description: AI model name for slot 9
184+
185+
ai9-api-key:
186+
type: string
187+
default: ""
188+
description: API key for AI model slot 9
189+
39190
telegram-bot-token:
40191
type: string
41192
default: ""

docs/index.html

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,19 @@ <h1>Juju Charm for<br><span class="gradient-text">OpenClaw</span></h1>
503503
juju deploy openclaw
504504

505505
# Configure with your AI provider
506-
juju config openclaw anthropic-api-key="your-key-here"
506+
juju config openclaw \
507+
ai-provider="anthropic" \
508+
ai-api-key="your-key-here" \
509+
ai-model="claude-opus-4-5"
507510

508511
# Enable messaging platforms
509-
juju config openclaw telegram-bot-token="your-token"</code></pre>
512+
juju config openclaw telegram-bot-token="your-token"
513+
514+
# Optional: Configure additional AI models (up to 11 total)
515+
juju config openclaw \
516+
ai0-provider="openai" \
517+
ai0-model="gpt-4" \
518+
ai0-api-key="your-openai-key"</code></pre>
510519
</div>
511520
</div>
512521
</section>
@@ -532,7 +541,7 @@ <h3>Multi-Platform Messaging</h3>
532541
<div class="feature-card">
533542
<div class="feature-icon">🤖</div>
534543
<h3>AI Provider Flexibility</h3>
535-
<p>Works with Anthropic Claude, OpenAI, AWS Bedrock, or local models via Ollama.</p>
544+
<p>Configure up to 11 AI models simultaneously. Works with Anthropic Claude, OpenAI, Google Gemini, AWS Bedrock, or local models via Ollama.</p>
536545
</div>
537546

538547
<div class="feature-card">
@@ -593,8 +602,8 @@ <h3>Deploy the Charm</h3>
593602
<div class="step-number">2</div>
594603
<div class="step-content">
595604
<h3>Configure AI Provider</h3>
596-
<p>Set up your AI model credentials (Anthropic, OpenAI, etc.)</p>
597-
<code>juju config openclaw \<br> anthropic-api-key="sk-ant-xxx" \<br> ai-model="claude-opus-4-5"</code>
605+
<p>Set up your AI model credentials (Anthropic, OpenAI, Google, etc.)</p>
606+
<code>juju config openclaw \<br> ai-provider="anthropic" \<br> ai-api-key="sk-ant-xxx" \<br> ai-model="claude-opus-4-5"</code>
598607
</div>
599608
</div>
600609

@@ -630,19 +639,27 @@ <h3>🤖 AI Configuration</h3>
630639
<dl>
631640
<div class="config-option">
632641
<dt>ai-provider</dt>
633-
<dd>Primary AI provider: anthropic, openai, bedrock, ollama</dd>
642+
<dd>Primary AI provider: anthropic, openai, google, bedrock, ollama</dd>
634643
</div>
635644
<div class="config-option">
636645
<dt>ai-model</dt>
637646
<dd>Model to use (e.g., claude-opus-4-5, gpt-4)</dd>
638647
</div>
639648
<div class="config-option">
640-
<dt>anthropic-api-key</dt>
641-
<dd>Anthropic API key for Claude models</dd>
649+
<dt>ai-api-key</dt>
650+
<dd>API key for the selected AI provider</dd>
651+
</div>
652+
<div class="config-option">
653+
<dt>ai[0-9]-provider</dt>
654+
<dd>Additional AI provider slots (0-9) for multi-model support</dd>
655+
</div>
656+
<div class="config-option">
657+
<dt>ai[0-9]-model</dt>
658+
<dd>Model name for additional AI slots (0-9)</dd>
642659
</div>
643660
<div class="config-option">
644-
<dt>openai-api-key</dt>
645-
<dd>OpenAI API key</dd>
661+
<dt>ai[0-9]-api-key</dt>
662+
<dd>API key for additional AI slots (0-9)</dd>
646663
</div>
647664
</dl>
648665
</div>

0 commit comments

Comments
 (0)