EdgeQuake LLM
edgequake-llm is a Rust AI runtime with a single abstraction over cloud APIs,
local gateways, enterprise deployments, and testing backends. It ships
first-class support for chat, streaming, tool calling, embeddings, image
generation, caching, retries, rate limiting, cost tracking, and release-grade
CI/CD.
Python users should use edgequake-litellm, the LiteLLM-compatible package backed by this crate.
What It Covers
- One trait-based surface for LLMs, embeddings, and Rust image generation.
- Production backends: OpenAI, Azure OpenAI, Anthropic, Gemini, Vertex AI, xAI, OpenRouter, NVIDIA NIM, Mistral, AWS Bedrock.
- Local and gateway backends: Ollama, LM Studio, GitHub Copilot direct mode (proxy optional), generic OpenAI-compatible APIs.
- Additional embedding backend: Jina.
- Image generation backends in the Rust crate: Gemini image generation, Vertex Imagen, FAL, mock image generation.
- Model Discovery — programmatic capability discovery across 11 providers with zero heuristics.
- Operational layers: caching, retry, rate limiting, cost tracking, tracing, reranking, mock providers.
Install
[]
= "0.8.0"
= { = "1", = ["macros", "rt-multi-thread"] }
bedrock is feature-gated:
[]
= { = "0.8.0", = ["bedrock"] }
Note: the repository is now pinned to Rust 1.95.0, and the Bedrock integration is verified against the latest published AWS SDK crate set, including the current Bedrock runtime release.
Provider compatibility highlights in this release:
- Anthropic-compatible adapters now preserve final streamed tool-call deltas even when the upstream SSE stream ends without a trailing newline.
- Provider-side schema normalization now aligns Anthropic, Bedrock, and Gemini tool declarations with the stricter subsets those APIs actually accept.
- Normalized usage reporting distinguishes cache writes from cache hits where the upstream provider reports both.
- Gemini provider now preserves function-call IDs across assistant tool calls, streamed deltas, and tool-result follow-ups.
- Mistral provider now includes native audio (
speech,transcriptions,voices) and OCR endpoint wrappers.
New capabilities in this release:
- Structured Outputs —
CompletionOptions::json_schema(schema)for JSON Schema-constrained responses - OpenRouter fallback models —
with_fallback_models()for sequential model failover - Azure Managed Identity —
AzureCredential::BearerTokenfor Entra ID auth - Vertex AI ADC — automatic GCE metadata token refresh
- Mistral variable embedding dimensions —
with_embed_dimensions(dim) - Ollama truncate parameter in embedding requests
- Bedrock Nova 2 multimodal embeddings
- NVIDIA vision model detection improvements
Latest model IDs validated on 2026-07-04 from official provider documentation:
- OpenAI (docs):
gpt-5.5,gpt-5.4,gpt-4.1,gpt-4.1-mini,gpt-4.1-nano,gpt-4o,o3,o4-mini - Anthropic (docs):
claude-fable-5,claude-opus-4-8,claude-sonnet-5,claude-opus-4-7,claude-sonnet-4-6 - Gemini (docs):
gemini-3.5-flash,gemini-2.5-flash(default),gemini-2.5-pro,gemini-3.1-pro-preview - Mistral (docs):
mistral-small-latest(default),mistral-large-latest,codestral-latest,magistral-medium-latest - xAI (docs):
grok-4,grok-3,grok-3-mini
Quick Start
use ;
async
Environment:
Provider Matrix
| Provider | Prefix / Type | Chat | Stream | Tools | Embeddings | Notes |
|---|---|---|---|---|---|---|
| OpenAI | openai |
Yes | Yes | Yes | Yes | GPT, o-series, vision |
| Azure OpenAI | azure |
Yes | Yes | Yes | Yes | Deployment-based |
| Anthropic | anthropic |
Yes | Yes | Yes | No | Claude thinking + caching |
| Gemini | gemini |
Yes | Yes | Yes | Yes | Google AI Studio |
| Vertex AI | vertexai |
Yes | Yes | Yes | Yes | Gemini on GCP auth |
| xAI | xai |
Yes | Yes | Yes | No | Grok models |
| OpenRouter | openrouter |
Yes | Yes | Yes | No | Multi-provider gateway |
| Mistral | mistral |
Yes | Yes | Yes | Yes | La Plateforme |
| NVIDIA NIM | nvidia |
Yes | Yes | Yes | Yes | OpenAI-compatible + dynamic model listing + 202 polling |
| AWS Bedrock | bedrock |
Yes | Yes | Yes | Yes | Feature-gated |
| HuggingFace | huggingface |
Yes | Yes | Limited | No | Inference API |
| OpenAI Compatible | openai-compatible |
Yes | Yes | Yes | Yes | Groq, Together, DeepSeek, custom |
| Ollama | ollama |
Yes | Yes | Yes | Yes | Local runtime, vision model-dependent |
| LM Studio | lmstudio |
Yes | Yes | Yes | Yes | Local OpenAI-compatible |
| VSCode Copilot | vscode-copilot |
Yes | Yes | Yes | Yes | Direct auth by default, proxy optional |
| Jina | embedding only | No | No | No | Yes | Dedicated embeddings |
| Mock | mock |
Yes | No | Yes | Yes | Tests and offline dev |
Image Generation Providers
Rust-only image generation support is exposed through ImageGenProvider and
ImageGenFactory:
| Provider | Type | Auth / Environment | Notes |
|---|---|---|---|
| Gemini image generation | GeminiImageGenProvider |
GEMINI_API_KEY or Vertex AI auth |
Default model: gemini-2.5-flash-image |
| Vertex Imagen | VertexAIImageGen |
GOOGLE_CLOUD_PROJECT and ADC / GOOGLE_ACCESS_TOKEN |
Default model: imagen-4.0-generate-001 |
| FAL | FalImageGen |
FAL_KEY |
Default model: fal-ai/flux/dev |
| Mock | MockImageGenProvider |
none | Tests and offline development |
| Azure OpenAI DALL-E | AzureImageGen |
AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY, AZURE_OPENAI_IMAGE_DEPLOYMENT |
Default model: dall-e-3 |
| NVIDIA NIM | NvidiaImageGen |
NVIDIA_API_KEY |
Default model: stabilityai/stable-diffusion-3.5-large |
| Bedrock Stability | BedrockStabilityImageGen |
AWS credential chain | Feature-gated (bedrock), Stability AI models |
Common Setup
| Provider | Required environment |
|---|---|
| OpenAI | OPENAI_API_KEY |
| Azure OpenAI | AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY, AZURE_OPENAI_DEPLOYMENT_NAME |
| Anthropic | ANTHROPIC_API_KEY |
| Gemini | GEMINI_API_KEY or GOOGLE_API_KEY |
| Vertex AI | GOOGLE_CLOUD_PROJECT and ADC / GOOGLE_ACCESS_TOKEN |
| xAI | XAI_API_KEY |
| OpenRouter | OPENROUTER_API_KEY |
| Mistral | MISTRAL_API_KEY |
| NVIDIA NIM | NVIDIA_API_KEY |
| AWS Bedrock | standard AWS credential chain plus AWS_REGION |
| HuggingFace | HF_TOKEN or HUGGINGFACE_TOKEN |
| OpenAI Compatible | OPENAI_COMPATIBLE_BASE_URL, optional OPENAI_COMPATIBLE_API_KEY |
| Ollama | optional OLLAMA_HOST |
| LM Studio | optional LMSTUDIO_HOST |
| VSCode Copilot | optional VSCODE_COPILOT_PROXY_URL; otherwise reuses the official VS Code Copilot auth cache or a fresh device login |
| Jina | JINA_API_KEY |
GitHub Copilot direct mode
Use vscode-copilot/auto unless you have a strong reason to pin a specific model.
Why this is now the default:
- GitHub's live Auto routing knows which chat-capable model family is actually available for the current account and session.
- Some Copilot catalog entries are responses-only or temporarily throttled; Auto avoids hard-coding a brittle premium path.
- Reusing the real VS Code auth cache keeps parity with the official extension instead of depending on stale local token copies.
Legacy proxy setups still work through VSCODE_COPILOT_PROXY_URL, but no proxy is required for the normal path anymore.
Image generation environment:
| Provider | Required environment |
|---|---|
| Gemini image generation | GEMINI_API_KEY or Vertex AI auth |
| Vertex Imagen | GOOGLE_CLOUD_PROJECT and ADC / GOOGLE_ACCESS_TOKEN |
| FAL | FAL_KEY |
| Azure OpenAI DALL-E | AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY, AZURE_OPENAI_IMAGE_DEPLOYMENT |
| NVIDIA NIM | NVIDIA_API_KEY |
| Bedrock Stability | AWS credential chain plus AWS_REGION |
Factory Usage
ProviderFactory is the fastest way to wire environments or provider/model routing:
use ;
let = from_env?;
println!;
let = create_with_model?;
let custom = create_llm_provider?;
For generic OpenAI-compatible routing, set:
For Rust image generation, use:
use ;
async
Header Propagation
All five major providers support caller-supplied HTTP headers for B2B/multi-tenant deployments (closes edgequake#132):
| Provider | Since |
|---|---|
OpenAICompatibleProvider |
0.6.16 |
MistralProvider |
0.6.16 |
AnthropicProvider |
0.6.17 |
GeminiProvider |
0.6.17 |
NvidiaProvider |
0.6.17 |
Use with_extra_headers() to inject custom headers — trace IDs, tenant identifiers, HMAC
tokens, or traceparent — into every outgoing LLM API call:
use ;
// Anthropic
let provider = from_env?
.with_extra_headers;
// Gemini (Google AI or VertexAI)
let provider = from_env?
.with_extra_headers;
// Mistral
let provider = from_env?
.with_extra_headers;
Reserved headers (authorization, x-api-key, anthropic-version, content-type,
content-length, host, user-agent) are silently dropped to prevent accidental credential
overrides. All other headers pass through to every request made by that provider instance.
Python Package
edgequake-litellm is the Python package in this repo. It is a drop-in LiteLLM replacement backed by the Rust runtime:
=
Install:
See edgequake-litellm/README.md for provider routing, migration notes, wheel coverage, and release instructions.
The Python package does not expose the Rust image-generation APIs yet.
Model Discovery
Programmatic model discovery across all providers — no hardcoded model IDs, no name-pattern heuristics:
use ;
let service = new;
// Find all reasoning models with 100K+ context
let filter = CapabilityFilter ;
let models = service.find_models.await?;
Python:
# Find vision-capable models
=
Features:
- 11 providers with dynamic, hybrid, or static discovery strategies
- Per-provider caching with configurable TTL and stale-on-error fallback
- Capability filtering — vision, tools, thinking, context length, cost, deprecation
- Zero heuristics — capabilities from API responses or cited documentation only
- Static registry — 30+ models with verified data for offline/fallback use
See docs/discovery.md for full documentation.
Development
Local validation:
Python package validation:
Documentation
| Document | Description |
|---|---|
docs/discovery.md |
Model discovery system architecture and usage |
docs/providers.md |
Provider-by-provider setup and model tables |
docs/architecture.md |
System design and trait architecture |
docs/caching.md |
Response caching (prompt + completion) |
docs/cost-tracking.md |
Session-level cost tracking and budgets |
docs/rate-limiting.md |
Per-provider rate limiting |
docs/observability.md |
OpenTelemetry integration |
docs/reranking.md |
BM25, RRF, and cross-encoder reranking |
docs/testing.md |
Testing guide (mock providers, e2e) |
docs/security.md |
API key management and security |
docs/migration-guide.md |
Version migration guide |
docs/faq.md |
Troubleshooting and FAQ |
Specifications
Design specifications are tracked in specs/001-edgequake-llm/:
| # | Document | Purpose |
|---|---|---|
| 01 | 5-WHY Analysis | Root-cause analysis |
| 02 | Provider Conformance Audit | Gap analysis per provider |
| 03 | Model Discovery API | Core discovery API design |
| 04 | Provider Discovery Approaches | Per-provider strategy |
| 05 | Architecture & Implementation | DRY/SOLID plan |
| 06 | Model Capability Registry | Type system design |
| 07 | Edge Cases & Migration | Compatibility and edge cases |
| 08 | Research Findings | Ground-truth corrections |
| 09 | Implementation Plan | Phased plan with roadblocks |
Release
Release guides:
docs/releasing.md: release checklist, tags, registry setupdocs/release-cycle.md: end-to-end CI/CD flowCHANGELOG.md: release notes for the Rust crateedgequake-litellm/CHANGELOG.md: release notes for the Python package
Tag conventions:
Both publish workflows validate versions before publishing and attach release artifacts to GitHub Releases.
License
Apache-2.0. See LICENSE-APACHE.