From 8ad5b6146ba3efc959bd5d7e9d09d3dd3159b96b Mon Sep 17 00:00:00 2001 From: beee003 <135258985+beee003@users.noreply.github.com> Date: Tue, 17 Feb 2026 08:22:38 -0500 Subject: [PATCH] feat: add Astrai as a named provider (#486) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Astrai (https://as-trai.com) as a first-class OpenAI-compatible provider. Astrai is an AI inference router with built-in cost optimization, PII stripping, and compliance logging. - Register ASTRAI_API_KEY env var in resolve_api_key - Add "astrai" entry in provider factory → as-trai.com/v1 - Add factory_astrai unit test - Add Astrai to compatible provider test list - Update README provider count (22+ → 23+) and list Co-authored-by: Maya Walcher Co-authored-by: Claude Opus 4.6 --- README.md | 4 ++-- src/providers/compatible.rs | 1 + src/providers/mod.rs | 13 +++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2613929..2bdd205 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Fast, small, and fully autonomous AI assistant infrastructure — deploy anywhere, swap anything. ``` -~3.4MB binary · <10ms startup · 1,017 tests · 22+ providers · 8 traits · Pluggable everything +~3.4MB binary · <10ms startup · 1,017 tests · 23+ providers · 8 traits · Pluggable everything ``` ### ✨ Features @@ -191,7 +191,7 @@ Every subsystem is a **trait** — swap implementations with a config change, ze | Subsystem | Trait | Ships with | Extend | |-----------|-------|------------|--------| -| **AI Models** | `Provider` | 22+ providers (OpenRouter, Anthropic, OpenAI, Ollama, Venice, Groq, Mistral, xAI, DeepSeek, Together, Fireworks, Perplexity, Cohere, Bedrock, etc.) | `custom:https://your-api.com` — any OpenAI-compatible API | +| **AI Models** | `Provider` | 23+ providers (OpenRouter, Anthropic, OpenAI, Ollama, Venice, Groq, Mistral, xAI, DeepSeek, Together, Fireworks, Perplexity, Cohere, Bedrock, Astrai, etc.) | `custom:https://your-api.com` — any OpenAI-compatible API | | **Channels** | `Channel` | CLI, Telegram, Discord, Slack, iMessage, Matrix, WhatsApp, Webhook | Any messaging API | | **Memory** | `Memory` | SQLite with hybrid search (FTS5 + vector cosine similarity), Lucid bridge (CLI sync + SQLite fallback), Markdown | Any persistence backend | | **Tools** | `Tool` | shell, file_read, file_write, memory_store, memory_recall, memory_forget, browser_open (Brave + allowlist), browser (agent-browser / rust-native), composio (optional) | Any capability | diff --git a/src/providers/compatible.rs b/src/providers/compatible.rs index e21d284..cdb0f0e 100644 --- a/src/providers/compatible.rs +++ b/src/providers/compatible.rs @@ -894,6 +894,7 @@ mod tests { make_provider("Groq", "https://api.groq.com/openai", None), make_provider("Mistral", "https://api.mistral.ai", None), make_provider("xAI", "https://api.x.ai", None), + make_provider("Astrai", "https://as-trai.com/v1", None), ]; for p in providers { diff --git a/src/providers/mod.rs b/src/providers/mod.rs index 66e653b..07c427d 100644 --- a/src/providers/mod.rs +++ b/src/providers/mod.rs @@ -138,6 +138,7 @@ fn resolve_provider_credential(name: &str, credential_override: Option<&str>) -> "opencode" | "opencode-zen" => vec!["OPENCODE_API_KEY"], "vercel" | "vercel-ai" => vec!["VERCEL_API_KEY"], "cloudflare" | "cloudflare-ai" => vec!["CLOUDFLARE_API_KEY"], + "astrai" => vec!["ASTRAI_API_KEY"], _ => vec![], }; @@ -313,6 +314,11 @@ pub fn create_provider_with_url( ), )), + // ── AI inference routers ───────────────────────────── + "astrai" => Ok(Box::new(OpenAiCompatibleProvider::new( + "Astrai", "https://as-trai.com/v1", key, AuthStyle::Bearer, + ))), + // ── Bring Your Own Provider (custom URL) ─────────── // Format: "custom:https://your-api.com" or "custom:http://localhost:1234" name if name.starts_with("custom:") => { @@ -651,6 +657,13 @@ mod tests { assert!(create_provider("build.nvidia.com", Some("nvapi-test")).is_ok()); } + // ── AI inference routers ───────────────────────────────── + + #[test] + fn factory_astrai() { + assert!(create_provider("astrai", Some("sk-astrai-test")).is_ok()); + } + // ── Custom / BYOP provider ───────────────────────────── #[test]