Supported LLM Providers
LEAI features a native, lightweight REST HTTP client, eliminating heavy external dependencies while connecting directly to industry-standard AI platforms.
🌐 Supported Providers & Environment Variables
| Provider | provider in leai.yml | Environment Variable | Recommended Models |
|---|---|---|---|
| Ollama (Local / Free) | ollama | None (requires local Ollama server) | qwen2.5-coder:latest, llama3.1, mistral |
| Local (LM Studio / vLLM) | local or custom | None (requires local running server) | qwen2.5, meta-llama-3.1-8b-instruct |
| Google Gemini | gemini | GEMINI_API_KEY | gemini-2.5-flash, gemini-1.5-pro |
| OpenAI | openai | OPENAI_API_KEY | gpt-4o, gpt-4o-mini, o3-mini |
| Anthropic Claude | claude / anthropic | ANTHROPIC_API_KEY | claude-3-5-sonnet-20241022, claude-3-5-haiku-20241022 |
| DeepSeek | deepseek | DEEPSEEK_API_KEY | deepseek-chat, deepseek-reasoner |
| Qwen (Alibaba) | qwen | DASHSCOPE_API_KEY | qwen-plus, qwen-max, qwen-turbo |
| Moonshot Kimi | kimi | MOONSHOT_API_KEY | moonshot-v1-8k, moonshot-v1-32k |
| Grok / xAI | grok or xai | GROK_API_KEY / XAI_API_KEY | grok-2-latest |
| Async AI Gateway | gateway (or any custom name with protocol: "async_gateway") | AI_GATEWAY_TOKEN | Configurable (e.g. gemma-4-e4b-it, default) |
⚙️ Configuration Examples in leai.yml
LEAI supports global defaults alongside granular per-provider overrides:
ai:
default_provider: "ollama" # Default active provider
temperature: 0.2 # Global temperature (0.0 to 1.0)
timeout: 300.0 # Global timeout in seconds
max_history_turns: 15 # History context memory window (turns)
max_agent_iterations: 10 # Max tool calling steps per agent turn
max_subagent_iterations: 5 # Max iterations for specialist subagents
providers:
# 1. Local Ollama
ollama:
base_url: "http://localhost:11434/v1"
model: "qwen2.5-coder:latest"
temperature: 0.1
timeout: 300.0
# 2. Local OpenAI-compatible server (LM Studio, vLLM, LocalAI)
local:
base_url: "http://localhost:1234/v1"
model: "qwen2.5"
temperature: 0.1
# 3. Google Gemini
gemini:
api_key: "${GEMINI_API_KEY}"
model: "gemini-2.5-flash"
# 4. OpenAI
openai:
api_key: "${OPENAI_API_KEY}"
model: "gpt-4o-mini"
temperature: 0.2
timeout: 120.0
# 5. Enterprise Async AI Gateway (any custom provider name can declare protocol: "async_gateway")
gateway:
protocol: "async_gateway"
base_url: "${AI_GATEWAY_URL}"
api_key: "${AI_GATEWAY_TOKEN}"
model: "${AI_GATEWAY_MODEL}"
temperature: 0.05
max_tokens: 3072
execution_mode: "auto" # "auto" (sync <= sync_char_limit, else async), "sync", or "async"
sync_char_limit: 8000
sync_timeout: 45.0
poll_interval: 2.5
max_poll_time: 900.0
max_retries: 5
tool_calling: "json_schema" # "json_schema", "prompt", or "disabled"
ssl_verify: true
ca_bundle: "${AI_GATEWAY_CA_BUNDLE:-}"
traceparent: true
endpoints:
sync_path: "/infer/completions"
async_submit_path: "/infer/async/generate"
async_progress_path: "/infer/progress/{request_id}"
async_results_path: "/infer/results/{request_id}"
async_cancel_path: "/infer/cancel/{request_id}"
async_gateway Protocol Capabilities
- Transparent Sync/Async Routing: Short prompts use
sync_path; requests abovesync_char_limit(or hitting synchronous limits) automatically route to the async queue with polling and timeout cancellation. - Structured Tool Calling (
json_schema): Fully compatible with LEAI's agentic loop (leai chat,leai ask,leai agent,leai workflow) via message sanitization and strictjson_schemaoutput. - Enterprise Resilience: Honors
Retry-Afteron HTTP429/503, safely handles non-JSON edge proxy errors, supports customca_bundleTLS verification, and emits W3Ctraceparentheaders. - RAG Archive Sync (
leai rag&leai update --rag): Supportsextractandragscopes for full/incremental loading ofRAWobjects (local or SeaweedFS S3) with SHA-256 JSON manifest checkpointing (.leai/rag_manifest.json).
🧪 Validating Models with leai models
Run the diagnostic command to test API connectivity and view available models:
```bash
List models for the default configured provider
leai models
List models for a specific provider
leai models -p gemini leai models -p ollama