Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

#### LLM Support
- 3 native LLM drivers: Anthropic, Google Gemini, OpenAI-compatible
- 27 providers: Anthropic, Gemini, OpenAI, Groq, OpenRouter, DeepSeek, Together, Mistral, Fireworks, Cohere, Perplexity, xAI, AI21, Cerebras, SambaNova, Hugging Face, Replicate, Ollama, vLLM, LM Studio, and more
- 28 providers: Anthropic, Gemini, OpenAI, Groq, OpenRouter, DeepSeek, Together, Mistral, Fireworks, Cohere, Perplexity, xAI, AI21, Cerebras, SambaNova, Hugging Face, Replicate, Ollama, vLLM, LM Studio, Lemonade, and more
- Model catalog with 130+ built-in models, 23 aliases, tier classification
- Intelligent model routing with task complexity scoring
- Fallback driver for automatic failover between providers
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ Each adapter supports per-channel model overrides, DM/group policies, rate limit

---

## 27 LLM Providers — 123+ Models
## 28 LLM Providers — 123+ Models

3 native drivers (Anthropic, Gemini, OpenAI-compatible) route to 27 providers:
3 native drivers (Anthropic, Gemini, OpenAI-compatible) route to 28 providers:

Anthropic, Gemini, OpenAI, Groq, DeepSeek, OpenRouter, Together, Mistral, Fireworks, Cohere, Perplexity, xAI, AI21, Cerebras, SambaNova, HuggingFace, Replicate, Ollama, vLLM, LM Studio, Qwen, MiniMax, Zhipu, Moonshot, Qianfan, Bedrock, and more.
Anthropic, Gemini, OpenAI, Groq, DeepSeek, OpenRouter, Together, Mistral, Fireworks, Cohere, Perplexity, xAI, AI21, Cerebras, SambaNova, HuggingFace, Replicate, Ollama, vLLM, LM Studio, Lemonade, Qwen, MiniMax, Zhipu, Moonshot, Qianfan, Bedrock, and more.

Intelligent routing with task complexity scoring, automatic fallback, cost tracking, and per-model pricing.

Expand Down
28 changes: 22 additions & 6 deletions crates/openfang-runtime/src/drivers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Contains drivers for Anthropic Claude, Google Gemini, OpenAI-compatible APIs, and more.
//! Supports: Anthropic, Gemini, OpenAI, Groq, OpenRouter, DeepSeek, Together,
//! Mistral, Fireworks, Ollama, vLLM, and any OpenAI-compatible endpoint.
//! Mistral, Fireworks, Ollama, vLLM, Lemonade, and any OpenAI-compatible endpoint.

pub mod anthropic;
pub mod claude_code;
Expand All @@ -14,13 +14,14 @@ pub mod openai;
use crate::llm_driver::{DriverConfig, LlmDriver, LlmError};
use openfang_types::model_catalog::{
AI21_BASE_URL, ANTHROPIC_BASE_URL, CEREBRAS_BASE_URL, COHERE_BASE_URL, DEEPSEEK_BASE_URL,
FIREWORKS_BASE_URL, GEMINI_BASE_URL, GROQ_BASE_URL, HUGGINGFACE_BASE_URL, LMSTUDIO_BASE_URL,
MINIMAX_BASE_URL, MISTRAL_BASE_URL, MOONSHOT_BASE_URL, OLLAMA_BASE_URL, OPENAI_BASE_URL,
OPENROUTER_BASE_URL, PERPLEXITY_BASE_URL, QIANFAN_BASE_URL, QWEN_BASE_URL,
FIREWORKS_BASE_URL, GEMINI_BASE_URL, GROQ_BASE_URL, HUGGINGFACE_BASE_URL, LEMONADE_BASE_URL,
LMSTUDIO_BASE_URL, MINIMAX_BASE_URL, MISTRAL_BASE_URL, MOONSHOT_BASE_URL, OLLAMA_BASE_URL,
OPENAI_BASE_URL, OPENROUTER_BASE_URL, PERPLEXITY_BASE_URL, QIANFAN_BASE_URL, QWEN_BASE_URL,
REPLICATE_BASE_URL, SAMBANOVA_BASE_URL, TOGETHER_BASE_URL, VLLM_BASE_URL,
VOLCENGINE_BASE_URL, VOLCENGINE_CODING_BASE_URL, XAI_BASE_URL, ZAI_BASE_URL,
ZAI_CODING_BASE_URL, ZHIPU_BASE_URL, ZHIPU_CODING_BASE_URL,
};

use std::sync::Arc;

/// Provider metadata: base URL and env var name for the API key.
Expand Down Expand Up @@ -189,6 +190,11 @@ fn provider_defaults(provider: &str) -> Option<ProviderDefaults> {
api_key_env: "VOLCENGINE_API_KEY",
key_required: true,
}),
"lemonade" => Some(ProviderDefaults {
base_url: LEMONADE_BASE_URL,
api_key_env: "LEMONADE_API_KEY",
key_required: false,
}),
"volcengine_coding" => Some(ProviderDefaults {
base_url: VOLCENGINE_CODING_BASE_URL,
api_key_env: "VOLCENGINE_API_KEY",
Expand Down Expand Up @@ -345,7 +351,7 @@ pub fn create_driver(config: &DriverConfig) -> Result<Arc<dyn LlmDriver>, LlmErr
"Unknown provider '{}'. Supported: anthropic, gemini, openai, groq, openrouter, \
deepseek, together, mistral, fireworks, ollama, vllm, lmstudio, perplexity, \
cohere, ai21, cerebras, sambanova, huggingface, xai, replicate, github-copilot, \
codex, claude-code. Or set base_url for a custom OpenAI-compatible endpoint.",
codex, claude-code, lemonade. Or set base_url for a custom OpenAI-compatible endpoint.",
provider
),
})
Expand Down Expand Up @@ -384,6 +390,7 @@ pub fn known_providers() -> &'static [&'static str] {
"volcengine",
"codex",
"claude-code",
"lemonade",
]
}

Expand Down Expand Up @@ -480,7 +487,16 @@ mod tests {
assert!(providers.contains(&"volcengine"));
assert!(providers.contains(&"codex"));
assert!(providers.contains(&"claude-code"));
assert_eq!(providers.len(), 30);
assert!(providers.contains(&"lemonade"));
assert_eq!(providers.len(), 31);
}

#[test]
fn test_provider_defaults_lemonade() {
let d = provider_defaults("lemonade").unwrap();
assert_eq!(d.base_url, "http://127.0.0.1:8000");
assert_eq!(d.api_key_env, "LEMONADE_API_KEY");
assert!(!d.key_required);
}

#[test]
Expand Down
11 changes: 10 additions & 1 deletion crates/openfang-runtime/src/model_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use openfang_types::model_catalog::{
AuthStatus, ModelCatalogEntry, ModelTier, ProviderInfo, AI21_BASE_URL, ANTHROPIC_BASE_URL,
BEDROCK_BASE_URL, CEREBRAS_BASE_URL, COHERE_BASE_URL, DEEPSEEK_BASE_URL, FIREWORKS_BASE_URL,
GEMINI_BASE_URL, GITHUB_COPILOT_BASE_URL, GROQ_BASE_URL, HUGGINGFACE_BASE_URL,
LMSTUDIO_BASE_URL, MINIMAX_BASE_URL, MISTRAL_BASE_URL, MOONSHOT_BASE_URL, OLLAMA_BASE_URL,
LEMONADE_BASE_URL, LMSTUDIO_BASE_URL, MINIMAX_BASE_URL, MISTRAL_BASE_URL, MOONSHOT_BASE_URL, OLLAMA_BASE_URL,
OPENAI_BASE_URL, OPENROUTER_BASE_URL, PERPLEXITY_BASE_URL, QIANFAN_BASE_URL, QWEN_BASE_URL,
REPLICATE_BASE_URL, SAMBANOVA_BASE_URL, TOGETHER_BASE_URL, VLLM_BASE_URL,
VOLCENGINE_BASE_URL, VOLCENGINE_CODING_BASE_URL, XAI_BASE_URL, ZAI_BASE_URL,
Expand Down Expand Up @@ -499,6 +499,15 @@ fn builtin_providers() -> Vec<ProviderInfo> {
auth_status: AuthStatus::NotRequired,
model_count: 0,
},
ProviderInfo {
id: "lemonade".into(),
display_name: "Lemonade".into(),
api_key_env: "LEMONADE_API_KEY".into(),
base_url: LEMONADE_BASE_URL.into(),
key_required: false,
auth_status: AuthStatus::NotRequired,
model_count: 0,
},
// ── New providers (8) ──────────────────────────────────────
ProviderInfo {
id: "perplexity".into(),
Expand Down
2 changes: 1 addition & 1 deletion crates/openfang-runtime/src/provider_health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct ProbeResult {
pub fn is_local_provider(provider: &str) -> bool {
matches!(
provider.to_lowercase().as_str(),
"ollama" | "vllm" | "lmstudio"
"ollama" | "vllm" | "lmstudio" | "lemonade"
)
}

Expand Down
1 change: 1 addition & 0 deletions crates/openfang-types/src/model_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub const SAMBANOVA_BASE_URL: &str = "https://api.sambanova.ai/v1";
pub const HUGGINGFACE_BASE_URL: &str = "https://api-inference.huggingface.co/v1";
pub const XAI_BASE_URL: &str = "https://api.x.ai/v1";
pub const REPLICATE_BASE_URL: &str = "https://api.replicate.com/v1";
pub const LEMONADE_BASE_URL: &str = "http://127.0.0.1:8000/v1";

// ── GitHub Copilot ──────────────────────────────────────────────
pub const GITHUB_COPILOT_BASE_URL: &str = "https://api.githubcopilot.com";
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ api_key_env = "ANTHROPIC_API_KEY"

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `provider` | string | `"anthropic"` | Provider name. Supported: `anthropic`, `gemini`, `openai`, `groq`, `openrouter`, `deepseek`, `together`, `mistral`, `fireworks`, `ollama`, `vllm`, `lmstudio`, `perplexity`, `cohere`, `ai21`, `cerebras`, `sambanova`, `huggingface`, `xai`, `replicate`. |
| `provider` | string | `"anthropic"` | Provider name. Supported: `anthropic`, `gemini`, `openai`, `groq`, `openrouter`, `deepseek`, `together`, `mistral`, `fireworks`, `ollama`, `vllm`, `lmstudio`, `perplexity`, `cohere`, `ai21`, `cerebras`, `sambanova`, `huggingface`, `xai`, `replicate`, `lemonade`. |
| `model` | string | `"claude-sonnet-4-20250514"` | Model identifier. Aliases like `sonnet`, `haiku`, `gpt-4o`, `gemini-flash` are resolved by the model catalog. |
| `api_key_env` | string | `"ANTHROPIC_API_KEY"` | Name of the environment variable holding the API key. The actual key is read from this env var at runtime, never stored in config. |
| `base_url` | string or null | `null` | Override the API base URL. Useful for proxies or self-hosted endpoints. When `null`, the provider's default URL from the model catalog is used. |
Expand Down
2 changes: 1 addition & 1 deletion openfang.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# api_listen = "127.0.0.1:50051" # HTTP API bind address (use 0.0.0.0 for public)

[default_model]
provider = "anthropic" # "anthropic", "gemini", "openai", "groq", "ollama", etc.
provider = "anthropic" # "anthropic", "gemini", "openai", "groq", "ollama", "lemonade", etc.
model = "claude-sonnet-4-20250514" # Model identifier
api_key_env = "ANTHROPIC_API_KEY" # Environment variable holding API key
# base_url = "https://api.anthropic.com" # Optional: override API endpoint
Expand Down