Provider Setup
Sol supports 10 AI provider adapters through a behaviour-based system. Each provider implements a common interface for model listing, completions, and streaming. Providers are configured in sys.config and registered at boot time.
Configuration Overview
Providers are defined in server/config/sys.config under the sol application environment:
{sol, [
{providers, [
{anthropic, #{api_key => "sk-ant-..."}},
{openai, #{api_key => "sk-..."}},
{zai, #{api_key => "..."}},
{ollama, #{base_url => "http://localhost:11434"}}
]}
]}API keys can also be set via environment variables to avoid storing secrets in config files.
Anthropic (Claude)
| Property | Value |
|---|---|
| Adapter | sol_provider_anthropic |
| API | Anthropic Messages API |
| Streaming | Yes |
| Vision | Yes |
{anthropic, #{
api_key => "sk-ant-api03-..."
}}Model IDs
claude-sonnet-4-20250514claude-3-5-sonnet-20241022claude-3-5-haiku-20241022claude-3-opus-20240229
Environment Variable
export ANTHROPIC_API_KEY="sk-ant-api03-..."OpenAI (GPT)
| Property | Value |
|---|---|
| Adapter | sol_provider_openai |
| API | OpenAI Chat Completions |
| Streaming | Yes |
| Function Calling | Yes |
{openai, #{
api_key => "sk-...",
base_url => "https://api.openai.com/v1"
}}Model IDs
gpt-4ogpt-4o-minigpt-4-turbogpt-3.5-turbo
Environment Variable
export OPENAI_API_KEY="sk-..."z.ai (GLM-5.1)
| Property | Value |
|---|---|
| Adapter | sol_provider_zai |
| API | OpenAI-compatible |
| Streaming | Yes |
| Vision | Yes |
{zai, #{
api_key => "...",
base_url => "https://api.z.ai/v1"
}}Model IDs
glm-5.1glm-4-plusglm-4-flash
Environment Variable
export ZAI_API_KEY="..."Ollama (Local)
| Property | Value |
|---|---|
| Adapter | sol_provider_ollama |
| API | Ollama REST API |
| Streaming | Yes |
| Local | Yes |
{ollama, #{
base_url => "http://localhost:11434"
}}No API key required. Ensure Ollama is running:
ollama serve
ollama pull llama3Model IDs
Use whatever models you have pulled locally:
llama3mistralcodellamaphi3
Gemini (Google AI)
| Property | Value |
|---|---|
| Adapter | sol_provider_gemini |
| API | Google Generative AI |
| Streaming | Yes |
{gemini, #{
api_key => "AIza...",
base_url => "https://generativelanguage.googleapis.com/v1beta"
}}Model IDs
gemini-2.0-flashgemini-1.5-progemini-1.5-flash
Environment Variable
export GEMINI_API_KEY="AIza..."DeepSeek
| Property | Value |
|---|---|
| Adapter | sol_provider_deepseek |
| API | OpenAI-compatible |
| Streaming | Yes |
{deepseek, #{
api_key => "sk-...",
base_url => "https://api.deepseek.com/v1"
}}Model IDs
deepseek-chatdeepseek-coderdeepseek-reasoner
Environment Variable
export DEEPSEEK_API_KEY="sk-..."Alibaba (Qwen)
| Property | Value |
|---|---|
| Adapter | sol_provider_alibaba |
| API | DashScope (OpenAI-compatible) |
| Streaming | Yes |
{alibaba, #{
api_key => "sk-...",
base_url => "https://dashscope.aliyuncs.com/compatible-mode/v1"
}}Model IDs
qwen-maxqwen-plusqwen-turboqwen-coder-plus
Environment Variable
export ALIBABA_API_KEY="sk-..."Bedrock (AWS)
| Property | Value |
|---|---|
| Adapter | sol_provider_bedrock |
| API | AWS Bedrock Runtime |
| Streaming | Yes |
{bedrock, #{
region => "us-east-1",
access_key_id => "AKIA...",
secret_access_key => "...",
model_id => "anthropic.claude-3-sonnet-20240229-v1:0"
}}Model IDs
anthropic.claude-3-sonnet-20240229-v1:0anthropic.claude-3-haiku-20240307-v1:0meta.llama3-70b-instruct-v1:0
Environment Variables
export AWS_ACCESS_KEY_ID="AKIA..."
export AWS_SECRET_ACCESS_KEY="..."
export AWS_REGION="us-east-1"Declarative Provider
The declarative adapter allows registering custom endpoints without writing Erlang code:
{declarative, #{
providers => [
#{
id => "my-llm",
format => openai,
base_url => "http://my-llm:8080/v1",
api_key => "optional-key",
models => ["my-model-v1"],
alias => "my-model"
}
]
}}Supported formats: openai, anthropic.
Provider Health
Check provider connectivity:
curl -H "Authorization: Bearer $TOKEN" \
https://api.nonsense.ws/api/v1/providers/health
curl -H "Authorization: Bearer $TOKEN" \
https://api.nonsense.ws/api/v1/providers/health/anthropicCross-Provider Switching
Sol provides bidirectional message transformation between Anthropic and OpenAI formats. Clients can switch providers mid-conversation:
curl -X POST https://api.nonsense.ws/api/v1/chat/completions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-20250514",
"messages": [{"role": "user", "content": "Hello"}],
"stream": true
}'The same endpoint works with any configured provider model.