Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ fn preferences(spec: &ProviderSpec, codex_oauth: bool) -> &'static [&'static str
| provider_id::OPENCODE
| provider_id::AIHUBMIX
| provider_id::CHERRYIN
| provider_id::CHEAPERINFERENCE
| provider_id::ATLASCLOUD
| provider_id::SILICONFLOW
| provider_id::MODELSCOPE
Expand Down
3 changes: 3 additions & 0 deletions src-tauri/crates/agent-core/src/core/providers/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ fn api_key_model_type_for_spec(spec: &ProviderSpec) -> Option<ModelType> {
provider_id::MODELSCOPE => Some(ModelType::ModelscopeApi),
provider_id::AIHUBMIX => Some(ModelType::AihubmixApi),
provider_id::CHERRYIN => Some(ModelType::CherryinApi),
provider_id::CHEAPERINFERENCE => Some(ModelType::CheaperinferenceApi),
provider_id::BEDROCK => Some(ModelType::BedrockApi),
provider_id::CUSTOM => Some(ModelType::CustomApi),
provider_id::OPENROUTER => Some(ModelType::OpenrouterApi),
Expand Down Expand Up @@ -402,6 +403,7 @@ fn spec_for_model_type(model_type: &ModelType) -> Option<&'static ProviderSpec>
ModelType::ModelscopeApi => provider_id::MODELSCOPE,
ModelType::AihubmixApi => provider_id::AIHUBMIX,
ModelType::CherryinApi => provider_id::CHERRYIN,
ModelType::CheaperinferenceApi => provider_id::CHEAPERINFERENCE,
ModelType::BedrockApi => provider_id::BEDROCK,
ModelType::CustomApi => provider_id::CUSTOM,
ModelType::OpenrouterApi => provider_id::OPENROUTER,
Expand Down Expand Up @@ -1390,6 +1392,7 @@ mod tests {
ModelType::ModelscopeApi,
ModelType::AihubmixApi,
ModelType::CherryinApi,
ModelType::CheaperinferenceApi,
ModelType::BedrockApi,
ModelType::CustomApi,
ModelType::AtlascloudApi,
Expand Down
12 changes: 12 additions & 0 deletions src-tauri/crates/agent-core/src/core/providers/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub mod provider_id {
pub const OPENCODE: &str = "opencode";
pub const AIHUBMIX: &str = "aihubmix";
pub const CHERRYIN: &str = "cherryin";
pub const CHEAPERINFERENCE: &str = "cheaperinference";

// Standard providers
pub const ANTHROPIC: &str = "anthropic";
Expand Down Expand Up @@ -128,6 +129,17 @@ pub static PROVIDERS: &[ProviderSpec] = &[
is_local: false,
env_key: Some("CHERRYIN_API_KEY"),
},
ProviderSpec {
name: provider_id::CHEAPERINFERENCE,
display_name: "Cheaper Inference",
keywords: &[],
litellm_prefix: None,
skip_prefixes: &["cheaperinference/"],
default_api_base: Some("https://api.cheaperinference.com/v1"),
default_anthropic_api_base: Some("https://api.cheaperinference.com"),
is_local: false,
env_key: Some("CHEAPERINFERENCE_API_KEY"),
},
// ===== Standard Providers =====
ProviderSpec {
name: provider_id::ANTHROPIC,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,17 @@ pub(crate) fn api_provider_registry() -> Vec<ApiProviderEntry> {
popular: false,
supports_rust_agents: true,
},
ApiProviderEntry {
name: "cheaperinference_api",
display_name: "Cheaper Inference",
description: "OpenAI-compatible LLM gateway with models from several labs",
brand_color: "#64748B",
docs_url: "https://cheaperinference.com/docs",
icon_provider: "custom",
paired_cli_agent: None,
popular: false,
supports_rust_agents: true,
},
ApiProviderEntry {
name: "bedrock_api",
display_name: "AWS Bedrock",
Expand Down
5 changes: 3 additions & 2 deletions src-tauri/crates/key-vault/src/commands/validate/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ pub async fn run_validate_key(
"atlascloud_api" | "deepseek_api" | "groq_api" | "xai_api" | "zhipu_api" | "dashscope_api"
| "moonshot_api" | "minimax_api" | "longcat_api" | "openrouter_api" | "zenmux_api"
| "siliconflow_api" | "modelscope_api" | "aihubmix_api" | "cherryin_api"
| "bedrock_api" | "custom_api" | "vllm_api" | "orgii_orchestrator" | "orgii" => {
| "cheaperinference_api" | "bedrock_api" | "custom_api" | "vllm_api"
| "orgii_orchestrator" | "orgii" => {
if protocol_lower.as_deref() == Some("anthropic") {
let effective_url = base_url
.clone()
Expand All @@ -169,7 +170,7 @@ pub async fn run_validate_key(
}

_ => Err(format!(
"Unknown agent type: {}. Supported: copilot, cursor_cli, openai, anthropic, google, codex, claude_code, kiro, opencode, openai_api, atlascloud_api, anthropic_api, gemini_api, deepseek_api, groq_api, xai_api, zhipu_api, dashscope_api, moonshot_api, minimax_api, longcat_api, openrouter_api, zenmux_api, siliconflow_api, modelscope_api, aihubmix_api, cherryin_api, bedrock_api, custom_api, vllm_api, azure_openai_api, azure_anthropic_api",
"Unknown agent type: {}. Supported: copilot, cursor_cli, openai, anthropic, google, codex, claude_code, kiro, opencode, openai_api, atlascloud_api, anthropic_api, gemini_api, deepseek_api, groq_api, xai_api, zhipu_api, dashscope_api, moonshot_api, minimax_api, longcat_api, openrouter_api, zenmux_api, siliconflow_api, modelscope_api, aihubmix_api, cherryin_api, cheaperinference_api, bedrock_api, custom_api, vllm_api, azure_openai_api, azure_anthropic_api",
agent_type
)),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ pub async fn fetch_key_quota(
| "openai_api"
| "anthropic_api"
| "atlascloud_api"
| "cheaperinference_api"
| "gemini_api"
| "groq_api"
| "xai_api"
Expand Down
4 changes: 4 additions & 0 deletions src-tauri/crates/key-vault/src/key_store/agent_env_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ impl KeyService {
| ModelType::ModelscopeApi
| ModelType::AihubmixApi
| ModelType::CherryinApi
| ModelType::CheaperinferenceApi
| ModelType::BedrockApi
| ModelType::CustomApi
| ModelType::OpenrouterApi
Expand Down Expand Up @@ -458,6 +459,7 @@ impl KeyService {
ModelType::ModelscopeApi => "MODELSCOPE_API_KEY",
ModelType::AihubmixApi => "AIHUBMIX_API_KEY",
ModelType::CherryinApi => "CHERRYIN_API_KEY",
ModelType::CheaperinferenceApi => "CHEAPERINFERENCE_API_KEY",
ModelType::BedrockApi => "AWS_BEARER_TOKEN_BEDROCK",
ModelType::CustomApi => "CUSTOM_API_KEY",
ModelType::OpenrouterApi => "OPENROUTER_API_KEY",
Expand Down Expand Up @@ -598,6 +600,7 @@ impl KeyService {
| ModelType::ModelscopeApi
| ModelType::AihubmixApi
| ModelType::CherryinApi
| ModelType::CheaperinferenceApi
| ModelType::BedrockApi
| ModelType::CustomApi
| ModelType::OpenrouterApi
Expand Down Expand Up @@ -630,6 +633,7 @@ impl KeyService {
ModelType::ModelscopeApi => "MODELSCOPE_API_KEY",
ModelType::AihubmixApi => "AIHUBMIX_API_KEY",
ModelType::CherryinApi => "CHERRYIN_API_KEY",
ModelType::CheaperinferenceApi => "CHEAPERINFERENCE_API_KEY",
ModelType::BedrockApi => "AWS_BEARER_TOKEN_BEDROCK",
ModelType::CustomApi => "CUSTOM_API_KEY",
ModelType::OpenrouterApi => "OPENROUTER_API_KEY",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fn api_providers_are_api_key_providers() {
ModelType::AnthropicApi,
ModelType::OpenaiApi,
ModelType::AtlascloudApi,
ModelType::CheaperinferenceApi,
ModelType::DeepseekApi,
ModelType::GeminiApi,
ModelType::GroqApi,
Expand Down Expand Up @@ -132,6 +133,7 @@ fn as_str_round_trips_through_from_str() {
ModelType::AnthropicApi,
ModelType::OpenaiApi,
ModelType::AtlascloudApi,
ModelType::CheaperinferenceApi,
ModelType::DeepseekApi,
ModelType::GeminiApi,
ModelType::GroqApi,
Expand Down
3 changes: 3 additions & 0 deletions src-tauri/crates/key-vault/src/key_store/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ pub enum ModelType {
ModelscopeApi,
AihubmixApi,
CherryinApi,
CheaperinferenceApi,
/// AWS Bedrock via the `bedrock-mantle` OpenAI/Anthropic-compatible
/// surface, authenticated with a Bedrock API key rather than SigV4.
BedrockApi,
Expand Down Expand Up @@ -198,6 +199,7 @@ impl ModelType {
ModelType::ModelscopeApi => "modelscope_api",
ModelType::AihubmixApi => "aihubmix_api",
ModelType::CherryinApi => "cherryin_api",
ModelType::CheaperinferenceApi => "cheaperinference_api",
ModelType::BedrockApi => "bedrock_api",
ModelType::CustomApi => "custom_api",
ModelType::AzureOpenaiApi => "azure_openai_api",
Expand Down Expand Up @@ -261,6 +263,7 @@ impl ModelType {
"modelscope_api" | "modelscope" => Some(ModelType::ModelscopeApi),
"aihubmix_api" | "aihubmix" => Some(ModelType::AihubmixApi),
"cherryin_api" | "cherryin" => Some(ModelType::CherryinApi),
"cheaperinference_api" | "cheaperinference" => Some(ModelType::CheaperinferenceApi),
"bedrock_api" | "bedrock" => Some(ModelType::BedrockApi),
"custom_api" | "custom" => Some(ModelType::CustomApi),
"azure_openai_api" | "azure_openai" | "azure" => Some(ModelType::AzureOpenaiApi),
Expand Down
17 changes: 17 additions & 0 deletions src-tauri/crates/key-vault/src/provider_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ const CHERRYIN_ENDPOINTS: &[ProviderEndpointSpec] = &[ProviderEndpointSpec {
anthropic_base_url: Some("https://open.cherryin.net"),
}];

const CHEAPERINFERENCE_ENDPOINTS: &[ProviderEndpointSpec] = &[ProviderEndpointSpec {
id: "default",
label: "Cheaper Inference",
base_url: "https://api.cheaperinference.com/v1",
anthropic_base_url: Some("https://api.cheaperinference.com"),
}];

/// AWS Bedrock via the `bedrock-mantle` endpoint, which serves both an
/// OpenAI-compatible (`/openai/v1`) and an Anthropic-compatible (`/anthropic`)
/// surface authenticated with a Bedrock API key as a bearer / `x-api-key`
Expand Down Expand Up @@ -483,6 +490,15 @@ pub fn get_provider_config(model_type: &str) -> ProviderConfig {
"openai",
)
.with_endpoints(CHERRYIN_ENDPOINTS),
"cheaperinference_api" => ProviderConfig::with_protocols(
"CHEAPERINFERENCE_API_KEY",
None,
true,
None,
&["openai", "anthropic"],
"openai",
)
.with_endpoints(CHEAPERINFERENCE_ENDPOINTS),
"bedrock_api" => ProviderConfig::with_protocols(
"AWS_BEARER_TOKEN_BEDROCK",
None,
Expand Down Expand Up @@ -562,6 +578,7 @@ pub fn get_all_provider_configs() -> Vec<(String, ProviderConfig)> {
"modelscope_api",
"aihubmix_api",
"cherryin_api",
"cheaperinference_api",
"bedrock_api",
"custom_api",
"vllm_api",
Expand Down
1 change: 1 addition & 0 deletions src-tauri/crates/key-vault/src/provider_config_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ fn new_aggregators_are_openai_and_anthropic_capable() {
"aihubmix_api",
"modelscope_api",
"cherryin_api",
"cheaperinference_api",
"siliconflow_api",
] {
let config = get_provider_config(model_type);
Expand Down
1 change: 1 addition & 0 deletions src/api/tauri/rpc/schemas/validationEnums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export const ApiProviderTypeSchema = z.union([
z.literal("modelscope_api"),
z.literal("aihubmix_api"),
z.literal("cherryin_api"),
z.literal("cheaperinference_api"),
z.literal("bedrock_api"),
z.literal("custom_api"),
z.literal("vllm_api"),
Expand Down
1 change: 1 addition & 0 deletions src/assets/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const API_KEY_PROVIDER_LIST: ApiProviderType[] = [
"atlascloud_api", // Atlas Cloud
"azure_anthropic_api", // Azure Anthropic
"azure_openai_api", // Azure OpenAI
"cheaperinference_api", // Cheaper Inference
"deepseek_api", // DeepSeek
"gemini_api", // Google Gemini
"groq_api", // Groq
Expand Down
1 change: 1 addition & 0 deletions src/components/ModelIcon/modelTypeIcons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const MODEL_TYPE_TO_ICON: Record<ModelType, IconProvider> = {
modelscope_api: "modelscope",
aihubmix_api: "aihubmix",
cherryin_api: "cherryin",
cheaperinference_api: "custom",
bedrock_api: "aws",
custom_api: "custom",
moonshot_api: "kimi",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ const PRIMARY_PROVIDER_KEYS = new Set([
"modelscope_api",
"aihubmix_api",
"cherryin_api",
"cheaperinference_api",
"atlascloud_api",
"bedrock_api",
"custom_api",
Expand Down
Loading