Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

281 Commits

Repository files navigation

eyrie

Universal LLM Provider Runtime

One interface for every model. Authentication, routing, streaming, retries, caching — handled.

GoLicenseCIReleaseGoDoc

Quick Start · Features · Docs · Examples · Providers · Architecture · Contributing


What is eyrie

eyrie is the LLM provider runtime that powers the hawk coding agent. It handles everything between your application and LLM APIs — authentication, model resolution, streaming, retries, rate limiting, and caching.

When your app calls a model, eyrie figures out which provider to use, how to talk to it, and how to stream the response back. Switch from Anthropic to Ollama? eyrie handles the translation. API returns 529? eyrie retries with backoff. Response hits max_tokens? eyrie continues automatically.

Your app never talks to an LLM API directly. eyrie does.

Hawk is the product face: it owns UX, agent orchestration, tools, permissions, sessions, and product semantics. Eyrie is the provider engine: it owns credentials, catalog and route resolution, provider transports, normalized streams, retry/fallback, usage, and provider telemetry. Hawk integrates through the stable engine facade rather than assembling Eyrie's internal provider packages.

Ecosystem Boundaries

eyrie is a Hawk support engine. Keep the dependency edge one-way:

  • host-facing DTOs and the Provider port live in hawk-core-contracts/llm; engine/ re-exports them as aliases (*Engine implements llm.Provider)
  • internal provider/transport types stay eyrie-scoped (not shared contracts)
  • do not import hawk/internal/*
  • do not import removed legacy path hawk/shared/types
  • do not import other engines (yaad, tok, trace, sight, inspect) — engines are peers, not dependencies

Quick Start

go get github.com/GrayCodeAI/eyrie

Requires Go 1.26+. Minimal dependencies (UUID, OpenTelemetry, SQLite, keyring).

import"github.com/GrayCodeAI/eyrie/client"// Create a client — provider auto-detected from environmentc:=client.NewEyrieClient(&client.EyrieConfig{
Provider: client.DetectProvider(),
})
// Stream a responsesr, err:=c.StreamChat(ctx, messages, client.ChatOptions{
Model: "claude-sonnet-4-6",
})
defersr.Close()
forevt:=rangesr.Events {
switchevt.Type {
case"content": // stream textcase"tool_call": // execute toolcase"done": // response complete
}
}

Features

Provider Routing

Automatically detects and routes to the right provider based on environment variables, config files, or explicit selection.

Model Resolution

Maps abstract tiers (opus/sonnet/haiku) to concrete model IDs per provider. Ships with an embedded catalog of pricing, context windows, and capabilities.

Streaming

Parses SSE for Anthropic and OpenAI formats — text, tool calls, and thinking blocks.

Reliability

  • Retries on 429/500/529 with exponential backoff and Retry-After support
  • Auto-continuation when stop_reason == max_tokens
  • Provider fallback chains for high availability

Rate Limiting

Token bucket rate limiter per provider — prevents hitting API limits before they happen.

Caching

  • Response caching with configurable TTL
  • Semantic similarity caching for repeated prompts
  • Anthropic prompt caching breakpoints on system prompt and conversation prefix

Cost Tracking

Built-in cost estimation per call, with per-provider pricing from the embedded model catalog.

Reasoning Controls

Passes reasoning_effort and Anthropic extended-thinking thinking_budget_tokens through to capable models — omitted when unset.

Keyless CI Auth

GitHub OIDC keyless authentication for cloud deployments — mints a short-lived token in GitHub Actions and exchanges it for AWS Bedrock (STS AssumeRoleWithWebIdentity) or GCP Vertex (Workload Identity Federation) credentials, no stored secrets.

OpenAI-Compatible Proxy

Serves POST /v1/chat/completions so existing OpenAI SDK clients can talk to eyrie unchanged.

Load-Balancing Strategies

Named routing strategies beyond weighted random: simple-shuffle, least-busy, latency-based, cost-based, and usage-based.

Pluggable Cache & Audit Sinks

Distributed CacheBackend interface (in-memory default, RESP/Redis-capable) and an AuditSink interface (no-op default, JSONL file sink) for privacy-preserving call metadata.

Model Role Slots

Named primary / weak / editor model slots with fallback to primary, plus an LLM summarizing condenser that shrinks long conversation histories using the weak model.

Rerank & Readiness

POST /rerank endpoint (provider-backed with lexical fallback) and a GET /ready readiness probe alongside the existing health check.

gRPC Skeleton

Dependency-free gRPC API skeleton behind the grpc build tag — wired when generated stubs are available.

Documentation

Detailed documentation is available in the docs/ directory:

Examples

Runnable examples are in the examples/ directory:

Run any example with:

ANTHROPIC_API_KEY=sk-... go run ./examples/basic/

Supported Providers

22 provider gateways in catalog/registry/providers.go (hawk /config uses the same list), listed in registry SortOrder:

ProviderIDEnv variable
AnthropicanthropicANTHROPIC_API_KEY
OpenAIopenaiOPENAI_API_KEY
Google GeminigeminiGEMINI_API_KEY
DeepSeekdeepseekDEEPSEEK_API_KEY
xAI (Grok)grokXAI_API_KEY
Kimi (Moonshot)kimiMOONSHOT_API_KEY
Z.AI — Coding Planzai_codingZAI_CODING_API_KEY
Z.AI — Pay-as-you-gozai_paygZAI_API_KEY
Xiaomi (MiMo) Token Planxiaomi_mimo_token_planXIAOMI_MIMO_TOKEN_PLAN_API_KEY (+ region cn / sgp / ams)
Xiaomi (MiMo) Pay-as-you-goxiaomi_mimo_paygXIAOMI_MIMO_PAYG_API_KEY
MiniMax — Token Planminimax_token_planMINIMAX_TOKEN_PLAN_API_KEY
MiniMax — Pay-as-you-gominimax_paygMINIMAX_PAYG_API_KEY
Azure OpenAIazureAZURE_OPENAI_API_KEY (+ AZURE_OPENAI_ENDPOINT)
Amazon BedrockbedrockAWS_SECRET_ACCESS_KEY (+ AWS_ACCESS_KEY_ID, AWS_SESSION_TOKEN)
Vertex AIvertexVERTEX_ACCESS_TOKEN (or GOOGLE_OAUTH_ACCESS_TOKEN)
OpenRouteropenrouterOPENROUTER_API_KEY
CanopyWavecanopywaveCANOPYWAVE_API_KEY
PoolsidepoolsidePOOLSIDE_API_KEY
GroqgroqGROQ_API_KEY
ClinePassclinepassCLINE_API_KEY
OpenCode GoopencodegoOPENCODEGO_API_KEY
OllamaollamaOLLAMA_BASE_URL (local; no API key)

Runtime auto-detection uses a separate priority order for chat when no deployment is pinned; see config profiles.

Usage

Basic Chat

resp, err:=c.Chat(ctx, messages, client.ChatOptions{
Model: "gpt-4o",
})

Streaming with Continuation

// Auto-continues when max_tokens is hitresp, err:=client.ChatWithContinuation(ctx, provider, messages,
client.ChatOptions{Model: model},
client.DefaultContinuationConfig(),
)

Mock Provider for Testing

mock:=client.NewMockProvider(client.MockModeFixed)
mock.Response="Here is the code you asked for..."resp, _:=mock.Chat(ctx, messages, opts)
// No real API calls — perfect for tests

Model Catalog

cat:=catalog.DefaultModelCatalog()
// Get the best model for a tiermodel:=catalog.GetPreferredProviderModel("anthropic", catalog.TierSonnet, &cat)
// → "claude-sonnet-4-6"// Check deprecation warningswarn:=catalog.GetModelDeprecationWarning("claude-3-7-sonnet", "anthropic")

Provider Configuration

cfg:=config.LoadProviderConfig("") // load from diskconfig.ApplyProviderConfigToEnv(cfg, false, nil) // apply to environmentconfig.SaveProviderConfig(cfg, "") // save changes

Architecture

eyrie/
├── engine/ # Stable host-facing facade and provider-neutral DTOs
├── client/ # Backwards-compatible public client facade
│ ├── core/ # Provider-neutral wire, stream, retry, and transport primitives
│ ├── adapters/ # Provider protocol adapters and construction registry
│ └── embeddings/ # Embedding clients, cache, and defaults
├── config/ # Provider configuration & routing
│ └── credential/ # Credential file management
├── catalog/ # Model catalog & tier system
│ ├── discover/ # Model discovery
│ ├── legacy/ # Legacy model support
│ ├── live/ # Live model data
│ └── registry/ # Model registry
├── codeagent/ # Code agent retry & fallback strategies
├── conversation/ # Conversation engine with branching
├── credentials/ # Credential management
├── docs/ # Documentation & guides
├── examples/ # Runnable code examples
├── router/ # Provider routing strategies
├── operationsgraph/ # Privacy-safe route and generation telemetry projection
├── runtime/ # Runtime manifest & routing policies
├── storage/ # SQLite conversation DAG store
├── types/ # Branded types & API errors
├── errors/ # Error message constants
├── constants/ # API limits
├── utils/ # Error utilities
├── internal/
│ ├── api/ # HTTP API handlers
│ ├── cache/ # Response cache warmer
│ ├── health/ # Provider health checker
│ ├── observability/ # OpenTelemetry spans & metrics
│ ├── sdk/ # Go, Python, TypeScript client SDKs
│ └── version/ # Version information
└── assets/ # Logo and branding

See docs/ARCHITECTURE.md for detailed system design and data flows.

operationsgraph.Build projects resolved routes and normalized usage into eyrie.graph/v1 operations nodes. Provider, model, request ID, and generated content are represented only by SHA-256 digests; token counts, finish reason, tool-call count, and deployment-routing state remain queryable.

Ecosystem

eyrie is part of the hawk-eco:

ComponentRepositoryPurpose
hawkGrayCodeAI/hawkAI coding agent
eyrieThis repoLLM provider runtime
tokGrayCodeAI/tokTokenizer & compression
yaadGrayCodeAI/yaadGraph-based memory
traceGrayCodeAI/traceSession capture

Development

Prerequisites

  • Go 1.26+

Build & Test

go build ./... # Verify the library compiles
go test -race ./... # Run all tests with race detector
make ci # Run full CI suite (lint, test, security)
make cover # Generate coverage report

Contributing

We welcome contributions! Please see CONTRIBUTING.md for development setup, commit conventions, and the PR process.

Quick start:

  1. Fork and create a branch: git checkout -b feat/short-description
  2. Make changes in small, focused commits
  3. Run make ci locally
  4. Open a pull request

Use Conventional Commits for commit messages — release-please uses them for versioning.

License

MIT — see LICENSE for details.

© 2026 GrayCode AI

About

Universal LLM provider runtime — one interface for 75+ models. Authentication, routing, streaming, retries, rate limiting, and semantic caching.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages