feat: provider presets (openai, openrouter, ollama, dahl, gonkarouter, custom), /api/info, provider display in Android settings

This commit is contained in:
OpenClaw Dev 2026-10-25 04:30:26 +01:00
parent d2ec0848c8
commit 7b92e259ad
14 changed files with 233 additions and 18 deletions

View file

@ -39,13 +39,26 @@ export BYTECLAW_LLM_API_KEY=sk-... # OpenAI / OpenRouter; für Ollama
make run # = go build + ./bin/byteclaw -config config.yaml
```
Provider-Beispiele (`llm.base_url` / `llm.model`):
Provider-Presets (`llm.provider` bzw. `BYTECLAW_LLM_PROVIDER`). Ein Preset füllt `base_url` und `model`, wenn sie leer sind; explizite Werte haben Vorrang. Der API-Key fällt auf die genannte Umgebungsvariable zurück. Alle nutzen `Authorization: Bearer <key>` und `/chat/completions`.
| Provider | base_url | model (Beispiel) |
|------------|---------------------------------|-------------------------|
| OpenAI | https://api.openai.com/v1 | gpt-4o-mini |
| OpenRouter | https://openrouter.ai/api/v1 | openai/gpt-4o-mini |
| Ollama | http://localhost:11434/v1 | llama3.1 (Tool-fähig) |
| provider | base_url | Default-Modell | Key-Env | Quelle |
|---------------|-----------------------------------|--------------------------|-----------------------|--------|
| `openai` | https://api.openai.com/v1 | gpt-4o-mini | OPENAI_API_KEY | platform.openai.com |
| `openrouter` | https://openrouter.ai/api/v1 | openai/gpt-4o-mini | OPENROUTER_API_KEY | openrouter.ai/docs |
| `ollama` | http://localhost:11434/v1 | llama3.1 | – | ollama docs |
| `dahl` | https://inference.dahl.global/v1 | MiniMaxAI/MiniMax-M2.7 | DAHL_API_KEY | https://docs.dahl.global/ |
| `gonkarouter` | https://api.gonkarouter.io/v1 | MiniMaxAI/MiniMax-M2.7 | GONKAROUTER_API_KEY | https://gonkarouter.io/docs |
| `custom` | (Pflicht) | (Pflicht) | – | – |
**Dahl** (dahl.global) und **GonkaRouter** sind OpenAI-kompatible Inferenz-Dienste für offene Modelle auf dem dezentralen Gonka-GPU-Netz. Weitere Modelle (Stand 25.10.2026): `zai-org/GLM-5.3-Flash`, `deepseek-ai/DeepSeek-V4-Flash-0731`. Aktuelle IDs immer über `GET <base_url>/models` prüfen. Bei Dahl braucht der Key ein zugewiesenes Token-Guthaben (sonst HTTP 402).
```yaml
llm:
provider: dahl # oder gonkarouter
model: zai-org/GLM-5.3-Flash # optional
```
`GET /api/info` liefert Provider, Modell und base_url des Servers (ohne Key); die Android-App zeigt das bei „Verbindung testen" an.
Test:
@ -59,6 +72,7 @@ curl -H "Authorization: Bearer $BYTECLAW_AUTH_TOKEN" -d '{"text":"Wie spät ist
| Methode | Pfad | Zweck |
|---------|------------------------------------|------------------------------------------|
| GET | /healthz | Health (ohne Auth) |
| GET | /api/info | Version, Provider, Modell (ohne Secrets) |
| GET | /api/sessions | Sessions (neueste zuerst) |
| POST | /api/sessions | Session anlegen `{"title":""}` |
| GET/PATCH/DELETE | /api/sessions/{id} | Lesen / umbenennen / löschen |