feat: add Avian as an LLM provider (#7561)

Signed-off-by: Kyle D <deximia@hotmail.com>
This commit is contained in:
avianion
2026-03-07 09:53:11 +00:00
committed by GitHub
parent ffa2f155cd
commit 472f3bfdfd
4 changed files with 64 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
use super::api_client::{ApiClient, AuthMethod};
use super::base::{ConfigKey, ProviderDef, ProviderMetadata};
use super::openai_compatible::OpenAiCompatibleProvider;
use crate::model::ModelConfig;
use anyhow::Result;
use futures::future::BoxFuture;
const AVIAN_PROVIDER_NAME: &str = "avian";
pub const AVIAN_API_HOST: &str = "https://api.avian.io/v1";
pub const AVIAN_DEFAULT_MODEL: &str = "deepseek/deepseek-v3.2";
pub const AVIAN_KNOWN_MODELS: &[&str] = &[
"deepseek/deepseek-v3.2",
"moonshotai/kimi-k2.5",
"z-ai/glm-5",
"minimax/minimax-m2.5",
];
pub const AVIAN_DOC_URL: &str = "https://avian.io/docs";
pub struct AvianProvider;
impl ProviderDef for AvianProvider {
type Provider = OpenAiCompatibleProvider;
fn metadata() -> ProviderMetadata {
ProviderMetadata::new(
AVIAN_PROVIDER_NAME,
"Avian",
"Cost-effective inference API with DeepSeek, Kimi, GLM, and MiniMax models",
AVIAN_DEFAULT_MODEL,
AVIAN_KNOWN_MODELS.to_vec(),
AVIAN_DOC_URL,
vec![
ConfigKey::new("AVIAN_API_KEY", true, true, None, true),
ConfigKey::new("AVIAN_HOST", false, false, Some(AVIAN_API_HOST), false),
],
)
}
fn from_env(
model: ModelConfig,
_extensions: Vec<crate::config::ExtensionConfig>,
) -> BoxFuture<'static, Result<OpenAiCompatibleProvider>> {
Box::pin(async move {
let config = crate::config::Config::global();
let api_key: String = config.get_secret("AVIAN_API_KEY")?;
let host: String = config
.get_param("AVIAN_HOST")
.unwrap_or_else(|_| AVIAN_API_HOST.to_string());
let api_client = ApiClient::new(host, AuthMethod::BearerToken(api_key))?;
Ok(OpenAiCompatibleProvider::new(
AVIAN_PROVIDER_NAME.to_string(),
api_client,
model,
String::new(),
))
})
}
}
+2
View File
@@ -2,6 +2,7 @@ use std::sync::{Arc, RwLock};
use super::{
anthropic::AnthropicProvider,
avian::AvianProvider,
azure::AzureProvider,
base::{Provider, ProviderMetadata},
bedrock::BedrockProvider,
@@ -46,6 +47,7 @@ static REGISTRY: OnceCell<RwLock<ProviderRegistry>> = OnceCell::const_new();
async fn init_registry() -> RwLock<ProviderRegistry> {
let mut registry = ProviderRegistry::new().with_providers(|registry| {
registry.register::<AnthropicProvider>(true);
registry.register::<AvianProvider>(false);
registry.register::<AzureProvider>(false);
registry.register::<BedrockProvider>(false);
registry.register::<LocalInferenceProvider>(false);
+1
View File
@@ -1,6 +1,7 @@
pub mod anthropic;
pub mod api_client;
pub mod auto_detect;
pub mod avian;
pub mod azure;
pub mod azureauth;
pub mod base;
@@ -25,6 +25,7 @@ goose is compatible with a wide range of LLM providers, allowing you to choose a
| [Amazon Bedrock](https://aws.amazon.com/bedrock/) | Offers a variety of foundation models, including Claude, Jurassic-2, and others. **AWS environment variables must be set in advance, not configured through `goose configure`** | Credential auth: `AWS_PROFILE`, or `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`<br /><br />Bearer token auth: `AWS_BEARER_TOKEN_BEDROCK` and `AWS_REGION`, `AWS_DEFAULT_REGION`, or `AWS_PROFILE` |
| [Amazon SageMaker TGI](https://docs.aws.amazon.com/sagemaker/latest/dg/realtime-endpoints.html) | Run Text Generation Inference models through Amazon SageMaker endpoints. **AWS credentials must be configured in advance.** | `SAGEMAKER_ENDPOINT_NAME`, `AWS_REGION` (optional), `AWS_PROFILE` (optional) |
| [Anthropic](https://www.anthropic.com/) | Offers Claude, an advanced AI model for natural language tasks. | `ANTHROPIC_API_KEY`, `ANTHROPIC_HOST` (optional) |
| [Avian](https://avian.io/) | Cost-effective inference API with DeepSeek, Kimi, GLM, and MiniMax models. OpenAI-compatible with streaming and function calling support. | `AVIAN_API_KEY`, `AVIAN_HOST` (optional) |
| [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/) | Access Azure-hosted OpenAI models, including GPT-4 and GPT-3.5. Supports both API key and Azure credential chain authentication. | `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_DEPLOYMENT_NAME`, `AZURE_OPENAI_API_KEY` (optional) |
| [ChatGPT Codex](https://chatgpt.com/codex) | Access GPT-5 Codex models optimized for code generation and understanding. **Requires a ChatGPT Plus/Pro subscription.** | No manual key. Uses browser-based OAuth authentication for both CLI and Desktop. |
| [Databricks](https://www.databricks.com/) | Unified data analytics and AI platform for building and deploying models. | `DATABRICKS_HOST`, `DATABRICKS_TOKEN` |