API Reference
Set the LLM provider
Configure and validate the active chat model.
POST
/config/llmadminis_local: true targets a local Ollama instance; is_local: false requires provider_data.key and validates connectivity. Validation probes the exact provider_data.model given — an invalid or retired remote model is rejected with 400 and nothing is saved.
Body
is_localbooleanrequiredTrue for Ollama (local); false for remote providers.
provider_data.provider_nameenumrequiredopenai | anthropic | ollama.
provider_data.modelstringrequiredThe model id, e.g. qwen2.5-coder:latest or gpt-4o-mini.
provider_data.keystringAPI key (empty for local providers).
Request
cURL — local Ollama
bash
curl -X POST localhost:8000/config/llm \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"is_local":true,"provider_data":{"provider_name":"ollama","model":"qwen2.5-coder:latest"}}'cURL — remote OpenAI
bash
curl -X POST localhost:8000/config/llm \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"is_local":false,"provider_data":{"provider_name":"openai","model":"gpt-4o-mini","key":"sk-..."}}'Responses
200Active configuration
json
{
"is_local": true,
"provider_name": "ollama",
"model": "qwen2.5-coder:latest",
"has_key": false,
"base_url": null
}400Invalid config / validation failed
json
{ "detail": "provider validation failed" }