[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-80535":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":39,"readmeContent":40,"aiSummary":41,"trendingCount":16,"starSnapshotCount":16,"syncStatus":42,"lastSyncTime":43,"discoverSource":44},80535,"AIephant-AI-Agent-Gateway","AlephantAI\u002FAIephant-AI-Agent-Gateway","AlephantAI","Alephant is an open-source AI Agent Gateway for routing, tracking, and controlling LLM usage across AI agents, members, and workflows, and for publishing agent capabilities as paid endpoints with x402 and MPP payment rails.","https:\u002F\u002Falephant.io",null,"Rust",84,13,4,1,0,23,45.74,"GNU General Public License v3.0",false,"main",[23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"agent","ai","ai-agent","ai-gateways","claude","cost-optimization","deepseek","hermes","llm","n8n-workflow","observability","openai","openclaw","rate-limiting","skills","zapier","2026-06-12 04:01:29","\u003Ch1 align=\"center\">\n  \u003Cimg src=\"docs\u002Fimages\u002Freadme\u002Falephant-logo.png\" alt=\"Alephant logo\" width=\"42\" \u002F>\n  Alephant Agent Gateway\n\u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n  \u003Cstrong>Open-source Agent Gateway for AI agents and workflows.\u003C\u002Fstrong>\u003Cbr \u002F>\n  Alephant provides an OpenAI-compatible gateway for 50+ providers, 320+ models, and custom model backends. It routes traffic, adapts provider APIs, caches responses, enforces policy, and observes every request from one developer-friendly integration point.\n  \n  Beyond standard AI Gateway routing, Alephant is built for agents: agent identity, runtime policies, budget guardrails, session tracing, token and API spend control, paid endpoints, and per-call margin visibility.\n\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"LICENSE\">\u003Cimg alt=\"License\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-GPL%20v3-blue.svg?style=flat-square\" \u002F>\u003C\u002Fa>\n  \u003Cimg alt=\"Edition\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fbuild-external%20%7C%20internal-black?style=flat-square\" \u002F>\n  \u003Cimg alt=\"Version\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fversion-0.2.0--beta.30-orange?style=flat-square\" \u002F>\n  \u003Cimg alt=\"Providers\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fproviders-50%2B-teal?style=flat-square\" \u002F>\n  \u003Cimg alt=\"Models\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fmodels-320%2B-0052FF?style=flat-square\" \u002F>\n  \u003Cimg alt=\"Rust edition\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Frust-edition%202024-dea584?style=flat-square&logo=rust&logoColor=white\" \u002F>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fx.com\u002Falephantai\" rel=\"noopener noreferrer\" target=\"_blank\">\u003Cimg alt=\"Follow X\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FFollow%20X-000000?style=flat-square&logo=x&logoColor=white\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FtRQghcXhaH\" rel=\"noopener noreferrer\" target=\"_blank\">\u003Cimg alt=\"Discord\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDiscord-5865F2?style=flat-square&logo=discord&logoColor=white\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Ft.me\u002Falephantai\" rel=\"noopener noreferrer\" target=\"_blank\">\u003Cimg alt=\"Telegram\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FTelegram-26A5E4?style=flat-square&logo=telegram&logoColor=white\" \u002F>\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg alt=\"Hosted SaaS\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fhosted%20SaaS-ready-00C853?style=flat-square\" \u002F>\n  \u003Cimg alt=\"Self-hostable\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fself--hostable-yes-00C853?style=flat-square\" \u002F>\n  \u003Cimg alt=\"BYO keys\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FBYO%20keys-ready-00C853?style=flat-square\" \u002F>\n  \u003Cimg alt=\"Agent clients\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fagent%20clients-supported-00C853?style=flat-square\" \u002F>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Fimages\u002Freadme\u002Fai-gateway-cover.png\" alt=\"Alephant Agent Gateway cover\" width=\"900\" \u002F>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"#quickstart\">Quickstart\u003C\u002Fa> ·\n  \u003Ca href=\"https:\u002F\u002Falephant.io\u002F\">Website\u003C\u002Fa> ·\n  \u003Ca href=\"#features\">Features\u003C\u002Fa> ·\n  \u003Ca href=\"#ide-integration\">IDE\u003C\u002Fa> ·\n  \u003Ca href=\"#architecture\">Architecture\u003C\u002Fa> ·\n  \u003Ca href=\"#screenshots\">Screenshots\u003C\u002Fa> ·\n  \u003Ca href=\"#comparison\">Comparison\u003C\u002Fa> ·\n  \u003Ca href=\"#community\">Community\u003C\u002Fa> ·\n  \u003Ca href=\"https:\u002F\u002Fdevelopers.alephant.io\u002F\">Docs\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Falephant.io\u002F\">\u003Cb>Get started ->\u003C\u002Fb>\u003C\u002Fa> ·\n  \u003Ca href=\"README.zh-CN.md\">Simplified Chinese\u003C\u002Fa>\n\u003C\u002Fp>\n\n## What is Alephant Agent Gateway\n\nAlephant Agent Gateway is an open-source gateway for AI agents, coding agents, and LLM-powered workflows.\n\nIt provides an OpenAI-compatible gateway for 50+ providers, 320+ models, and custom model backends. It routes traffic, adapts provider APIs, caches responses, enforces policy, and observes every request from one developer-friendly integration point.\n\nUnlike a standard AI Gateway, Alephant is designed around agents as first-class runtime actors. Each agent can have its own identity, virtual keys, model access, budget limits, runtime policies, sessions, request traces, and financial ledger.\n\nAlephant helps teams control token and API spend, prevent runaway agent behavior, and turn agents or workflows into paid endpoints with clear revenue, cost, and margin tracking.\n\n```typescript\nimport OpenAI from \"openai\"\n\nconst openai = new OpenAI({\n  baseURL: \"https:\u002F\u002Fai.alephant.io\u002Fv1\",\n  defaultHeaders: {\n    Authorization: `Bearer ${process.env.ALEPHANT_API_KEY}`,\n    \"Alephant-Session-Id\": \"session-xxx\", \u002F\u002F optional\n  }\n})\n```\n\n## Project status\n\nAlephant Agent Gateway is currently in beta (`0.2.0-beta.30`). Alephant Cloud is the hosted SaaS path, and this repository provides the gateway runtime for self-hosted and platform-connected deployments. Public APIs, configuration fields, and internal build modes may evolve before a stable `1.0` release.\n\n---\n\n## Why this exists\n\nAI agents are not simple model calls.\n\nThey run multi-step sessions, call tools, retry failed steps, loop unexpectedly, use different models, trigger APIs, and sometimes expose capabilities as paid services. A standard AI Gateway can route requests and collect logs, but it usually does not understand the agent as the operating unit.\n\nAlephant exists to make agents governable.\n\nEvery agent needs an identity, a budget, runtime policies, request traces, and a clear financial record. Teams should know which agent created the spend, which session caused the spike, which model or tool was used, and whether a paid agent call was profitable.\n\nAlephant provides the gateway layer for that agent lifecycle: route the model call, enforce policy, track cost, observe the session, control spend, and connect revenue back to the agent that generated it. [Learn more ->](https:\u002F\u002Falephant.io\u002F)\n\n\u003Ca id=\"features\">\u003C\u002Fa>\n\n## Features\n\n| Capability | What Alephant Agent Gateway provides |\n| --- | --- |\n| Agent-first gateway | A gateway designed for AI agents, coding agents, and LLM-powered workflows, not just single LLM requests |\n| One API surface | OpenAI-compatible `\u002Fv1\u002F*` and `\u002Fai\u002F*` routes for chat, responses, embeddings, images, and provider-style model names |\n| Provider and model coverage | 50+ providers, 320+ models, local runtimes, OpenRouter-style catalogs, and custom\u002Fprivate model backends |\n| Provider adaptation | Request, tool, streaming, error, usage, finish-reason, and response normalization across provider APIs |\n| Agent client compatibility | OpenAI-compatible formats for Cursor, Codex, opencode, Antigravity, OpenClaw, Hermes, and custom agent clients |\n| IDE and coding-agent integration | Cursor, opencode, Codex, and agent workflow-ready with client adapters, workflow guides, implementation skills, and task management; Claude Code adapter in progress |\n| Agent identity | Attribute requests to workspace, project, agent, user\u002Fmember, virtual key, session, prompt, model, and provider |\n| Runtime policies | Configure per-agent limits for model access, retries, tokens, session cost, timeouts, fallback behavior, and kill-switch controls |\n| Budget guardrails | Enforce hard-dollar spend policies across workspace, project, agent, member, session, model, provider, and endpoint dimensions |\n| Policy-aware routing | Route by agent identity, model policy, budget state, latency target, provider health, cost preference, and fallback strategy |\n| Routing and resilience | Direct provider paths, policy routers, retries, fallback, health checks, provider 429 handling, and fail-open cache paths |\n| Policy and key control | Virtual keys, master key resolution, model policy, workspace provider allowlists, endpoint policies, and concurrency controls |\n| Caching | Gateway-side LLM KV cache and semantic cache to avoid repeated upstream calls and reduce token spend |\n| Agent observability | Request logs, session traces, model usage, latency, errors, token spend, policy decisions, and optional body archival |\n| Cost attribution | Track token cost by agent, workflow, user, session, request, prompt, model, provider, and virtual key |\n| Paid endpoints | Turn agents, workflows, and HTTP services into paid endpoints with payment verification, request forwarding, and revenue tracking |\n| Agent ledger | Connect buyer revenue, AI token cost, external API spend, fees, policy decisions, and known margin per paid call |\n| Live operations | Route, virtual key, provider key, policy, and endpoint refresh from database changes without restarting the gateway |\n| Deployment | Hosted SaaS through Alephant Cloud, or self-hosted Rust gateway with PostgreSQL, Redis, Qdrant, and S3-compatible integrations |\n\n## Developer surface\n\n| Surface | Purpose |\n| --- | --- |\n| `\u002Fv1\u002F*` | Drop-in OpenAI-compatible API for existing SDKs and agent clients |\n| `\u002Frouter\u002F{id}\u002F*` | Policy-driven routing through a configured router |\n| `\u002F{provider}\u002F*` | Direct provider passthrough when you want explicit upstream control |\n| `model=provider\u002Fmodel_id` | Select a provider and model without changing application code |\n| Custom backends | Put private models or self-hosted runtimes behind the same gateway contract |\n\n\u003Ch2 id=\"architecture\">Architecture & request lifecycle\u003C\u002Fh2>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Fimages\u002Freadme\u002Fai-gateway-architecture.png\" alt=\"Architecture & request lifecycle\" width=\"900\" \u002F>\n\u003C\u002Fp>\n\nEvery request passes through the same gateway lifecycle: global middleware, routing, provider mapping, dispatch, cache, fallback, and async logging. The entry path depends on how much control you want:\n\n| Path | Use it for |\n| --- | --- |\n| `\u002Fv1\u002F*` | Unified OpenAI-style access with `model=provider\u002Fmodel_id` |\n| `\u002Frouter\u002F{id}\u002F*` | Policy-driven routing through a configured router |\n| `\u002F{provider}\u002F*` | Direct provider passthrough when you want an explicit upstream |\n\n## Multi-provider adaptation\n\nUse one OpenAI-style request shape across 50+ providers and 320+ models, including OpenAI-compatible APIs, Anthropic Messages, Gemini, Bedrock, Ollama, OpenRouter-style catalogs, and custom backends. The client selects a runtime with `model=provider\u002Fmodel_id`; Alephant resolves the provider, applies the right adapter, maps provider-specific fields, and returns a normalized OpenAI-style response.\n\nInstead of listing every model in the README, this section focuses on the contract: one request format in, one consistent response out. The provider and model catalog can evolve independently without forcing application code changes.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Fimages\u002Freadme\u002Fai-gateway-multi-provider.png\" alt=\"Multi-provider adaptation\" width=\"900\" \u002F>\n\u003C\u002Fp>\n\n\u003Cblockquote>\n  \u003Ctable>\n    \u003Ctr>\n      \u003Ctd>\u003Cstrong>Mainstream models\u003C\u002Fstrong>\u003C\u002Ftd>\n      \u003Ctd>GPT-4o · GPT-4.1 · o3 · Claude 3.5\u002F3.7 Sonnet · Claude Opus · Gemini 1.5\u002F2.0 · Llama 3\u002F4 · Mistral Large · Command R+\u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Ctd>\u003Cstrong>Provider ecosystem\u003C\u002Fstrong>\u003C\u002Ftd>\n      \u003Ctd>OpenAI · Anthropic · Google Gemini · AWS Bedrock · Azure OpenAI · OpenRouter · Together AI · Fireworks · Groq · Cohere · Mistral · Perplexity · DeepSeek · xAI · Ollama\u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Ctd>\u003Cstrong>Agent client compatibility\u003C\u002Fstrong>\u003C\u002Ftd>\n      \u003Ctd>Cursor · Codex · opencode · Antigravity\u003C\u002Ftd>\n    \u003C\u002Ftr>\n  \u003C\u002Ftable>\n\u003C\u002Fblockquote>\n\n\u003Ca id=\"ide-integration\">\u003C\u002Fa>\n\n## IDE integration\n\nAlephant AI Gateway ships repository-level tooling for AI-assisted development inside supported IDEs.\n\n| IDE \u002F Agent Client | Status | What's included |\n| --- | --- | --- |\n| Cursor | Ready | Project architecture & code-convention rules, development & API workflow guides, gated-module-implementation skill (Skill), file-based task management (Task Magic) — see the `.cursor` directory; also configure the gateway in Agent Settings → Models |\n| opencode | Ready | OpenAI-compatible agent client adaptation and gateway configuration support |\n| Codex | Ready | Codex CLI \u002F VS Code client detection, Responses API adaptation, and gateway configuration support |\n| Claude Code | In progress | Adapter and configuration under development |\n\n\u003Ca id=\"quickstart\">\u003C\u002Fa>\n\n## Quickstart\n\n### Use Alephant Cloud (hosted SaaS)\n\nKeep your existing OpenAI SDK and change only the base URL plus authorization header. Your app keeps using familiar OpenAI-style calls while Alephant Cloud gives you the managed workspace, hosted gateway endpoint, provider resolution, routing, caching, logging, and fallback.\n\nSet your gateway key:\n\n```bash\nexport ALEPHANT_API_KEY=\"vk-...\"\n```\n\nSmoke-test with `curl`:\n\n```bash\ncurl https:\u002F\u002Fai.alephant.io\u002Fv1\u002Fchat\u002Fcompletions \\\n  -H \"Authorization: Bearer $ALEPHANT_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"model\": \"openai\u002Fgpt-4o\",\n    \"messages\": [\n      { \"role\": \"user\", \"content\": \"Explain Alephant AI Gateway in one sentence.\" }\n    ]\n  }'\n```\n\nOr use the OpenAI SDK:\n\n```typescript\nimport OpenAI from \"openai\"\n\nconst openai = new OpenAI({\n  baseURL: \"https:\u002F\u002Fai.alephant.io\u002Fv1\",\n  defaultHeaders: {\n    Authorization: `Bearer ${process.env.ALEPHANT_API_KEY}`,\n    \"Alephant-Session-Id\": \"demo-session\", \u002F\u002F optional: group requests into a trace\u002Fsession\n  }\n})\n\nconst response = await openai.chat.completions.create({\n  model: \"openai\u002Fgpt-4o\",\n  messages: [\n    { role: \"user\", content: \"Explain Alephant AI Gateway in one sentence.\" }\n  ]\n})\n\nconsole.log(response.choices[0]?.message?.content)\n```\n\n[Get started ->](https:\u002F\u002Falephant.io\u002F)\n\n## Self-host from source\n\nAlephant AI Gateway can run as an independent self-hosted Rust service. You can point your own applications at the local gateway, connect it to your own PostgreSQL\u002FRedis\u002FQdrant\u002FS3-compatible infrastructure, and control provider keys, router configuration, cache behavior, and logging destinations from your deployment.\n\nSelf-hosting is useful when you need the gateway inside your own network, want full control over upstream provider credentials, or need to test provider adaptation and routing behavior before connecting to Alephant Cloud.\n\n### Prerequisites\n\n| Dependency | Required | Used for |\n| --- | --- | --- |\n| Rust toolchain | Yes | Build and run the gateway service |\n| PostgreSQL | Yes | Router, key, workspace, and runtime configuration |\n| Redis | Recommended | Shared runtime state, concurrency controls, and cache-related paths |\n| Qdrant | Optional | Semantic cache |\n| S3-compatible storage | Optional | Large request\u002Fresponse body archival |\n\nBuild `ai-gateway` with exactly one of `--features external` or `--features internal`.\n\n### Build\n\n```bash\ncargo build -p ai-gateway --features external\n```\n\nUse `external` for the public\u002Fopen deployment mode, or `internal` when running with the internal KV\u002Fbackend assumptions used by your environment. Only enable one of these feature sets at a time.\n\n### Run locally\n\n```bash\ncargo run -p ai-gateway --features external -- -c .\u002Fai-gateway\u002Fconfig\u002Flocal.yaml\n```\n\nThe config file controls database connections, provider settings, cache services, observability, and runtime behavior. For local development, start with `ai-gateway\u002Fconfig\u002Flocal.yaml` and adjust it to match your services.\n\n### Configuration\n\nThe gateway reads a YAML config file and supports environment overrides for sensitive values. Keep secrets such as provider keys, S3 credentials, and Redis URLs out of committed YAML whenever possible.\n\nUseful starting points:\n\n| File | Purpose |\n| --- | --- |\n| `ai-gateway\u002Fconfig\u002Flocal.yaml` | Local development defaults |\n| `ai-gateway\u002Fconfig\u002Flocal-cloud.yaml` | Local cloud-style integration |\n| `ai-gateway\u002Fconfig\u002Falephant-cloud.yaml` | Alephant platform-connected deployment shape |\n\nEnvironment overrides follow the `AI_GATEWAY__...` pattern used by the config loader, for example `AI_GATEWAY__S3__ACCESS_KEY`, `AI_GATEWAY__S3__SECRET_KEY`, and `AI_GATEWAY__REQUEST_LOG__LOG_QUEUE_REDIS_URL`.\n\n### Verify\n\nKeep the local gateway process running. The smoke harness targets the default local gateway URL, `http:\u002F\u002Flocalhost:8080`.\n\n```bash\ncargo run -p test\n```\n\nYou can also point an OpenAI-compatible SDK at your self-hosted gateway:\n\n```typescript\nimport OpenAI from \"openai\"\n\nconst openai = new OpenAI({\n  baseURL: \"http:\u002F\u002Flocalhost:8080\u002Fv1\",\n  defaultHeaders: {\n    Authorization: `Bearer ${process.env.ALEPHANT_VIRTUAL_KEY}`,\n  }\n})\n```\n\n### Integration tests\n\n```bash\ncargo test -p ai-gateway --tests --features \"external integration\"\n```\n\n## Security & privacy\n\nAlephant AI Gateway is designed for both managed SaaS usage and self-hosted deployments where teams need control over provider credentials, request metadata, and deployment boundaries.\n\n| Area | Gateway behavior |\n| --- | --- |\n| BYO provider keys | Provider credentials can stay under your control through gateway configuration and key resolution |\n| Virtual key isolation | Application-facing keys can be separated from upstream provider keys |\n| Optional body archival | Request\u002Fresponse body storage is configurable rather than mandatory |\n| SaaS or self-host | Use Alephant Cloud for managed operations, or run the gateway inside your own infrastructure |\n| Policy gates | Model policy, provider allowlists, and concurrency controls can be enforced before upstream dispatch |\n\n## Runtime internals\n\n| Capability | Why it matters |\n| --- | --- |\n| DB listener-driven hot reload | Route and key changes can be picked up without restarting the gateway |\n| S3-compatible body storage | Request and response bodies can be archived outside the hot request path when enabled |\n| Downstream request-log delivery | Structured gateway logs can be pushed to Alephant or another downstream system |\n| Content-filter integration | Optional gRPC filter path with fail-open reconnect behavior |\n| Workspace concurrency guard | Redis-backed controls help protect shared upstream capacity |\n| Provider 429 monitoring | Provider rate-limit signals can feed discovery and routing decisions |\n\n## Screenshots\n\nExplore the Alephant workspace experience around the gateway: usage overview, request logs, sessions, cache visibility, insights, and governance controls.\n\n| Overview | Request logs |\n| --- | --- |\n| ![Alephant AI Gateway overview dashboard](docs\u002Fimages\u002Freadme\u002Fscreenshots\u002Foverview.png)\u003Cbr \u002F>\u003Csub>Workspace-level usage, request volume, latency, tokens, and cache health.\u003C\u002Fsub> | ![Alephant AI Gateway request logs](docs\u002Fimages\u002Freadme\u002Fscreenshots\u002Frequests.png)\u003Cbr \u002F>\u003Csub>Request-level inspection for status, model, source, tokens, cost, and upstream outcome.\u003C\u002Fsub> |\n\n| Sessions | Cache |\n| --- | --- |\n| ![Alephant AI Gateway sessions](docs\u002Fimages\u002Freadme\u002Fscreenshots\u002Fsessions.png)\u003Cbr \u002F>\u003Csub>Trace agent and application journeys across steps, duration, spend, and status.\u003C\u002Fsub> | ![Alephant AI Gateway cache dashboard](docs\u002Fimages\u002Freadme\u002Fscreenshots\u002Fcache.png)\u003Cbr \u002F>\u003Csub>Monitor cache hits, savings, repeated prompts, and frequently reused responses.\u003C\u002Fsub> |\n\n| Insights | Governance |\n| --- | --- |\n| ![Alephant AI insights dashboard](docs\u002Fimages\u002Freadme\u002Fscreenshots\u002Finsights.png)\u003Cbr \u002F>\u003Csub>Surface reliability, spend, and efficiency signals from gateway traffic.\u003C\u002Fsub> | ![Alephant AI governance controls](docs\u002Fimages\u002Freadme\u002Fscreenshots\u002Fgovernance.png)\u003Cbr \u002F>\u003Csub>Configure usage limits, budget controls, rate limits, and policy rules.\u003C\u002Fsub> |\n\n\u003Ca id=\"comparison\">\u003C\u002Fa>\n\n## Comparison\n\nPortkey, Helicone, LiteLLM, and Alephant are all useful infrastructure projects, but they start from different centers of gravity.\n\nPortkey is gateway and enterprise guardrails-first. Helicone is observability-first. LiteLLM is provider proxy and SDK-first. Alephant is agent-first: it is built for teams running AI agents, coding agents, and LLM-powered workflows that need identity, runtime control, cost guardrails, paid endpoints, and per-call margin visibility.\n\n| Project | Best known for | Best fit |\n| --- | --- | --- |\n| Portkey | AI gateway, guardrails, observability, governance, prompt management, and enterprise control workflows | Teams that want a managed AI control plane for LLM traffic and policy enforcement |\n| Helicone | LLM observability, request analytics, sessions, traces, and cost visibility | Teams whose primary need is logging, analytics, debugging, and usage visibility |\n| LiteLLM | Broad OpenAI-compatible proxy, Python SDK, provider abstraction, virtual keys, and spend controls | Teams that want maximum provider coverage and a flexible proxy\u002FSDK stack |\n| Alephant Agent Gateway | Agent identity, runtime policies, token\u002FAPI spend control, paid endpoints, and agent margin ledger | Teams building production agents and workflows that need cost guardrails, request traceability, BYO keys, monetization, and per-call margin tracking |\n\n| Capability | Portkey | Helicone | LiteLLM | Alephant Agent Gateway |\n| --- | --- | --- | --- | --- |\n| OpenAI-compatible API | Yes | Yes | Yes | Yes |\n| SaaS + self-host path | Enterprise and self-host options | Hosted and self-host options | Self-hosted proxy, hosted options vary | Alephant Cloud plus self-hosted Rust gateway |\n| Provider\u002Fmodel coverage | Broad | Broad observability\u002Fproxy coverage | Very broad provider abstraction | 50+ providers, 320+ models, local runtimes, and custom backends |\n| Provider adaptation | Gateway configs, routing, retries, guardrails | Proxy and observability pipeline | Strong provider abstraction | Explicit normalization for requests, tools, streaming, errors, usage, finish reasons, and responses |\n| Routing and resilience | Routing, retries, fallbacks, load balancing, circuit breakers | Request forwarding and observability-focused workflows | Router, fallback, budgets, rate limits | Direct paths, policy routers, fallback, health checks, provider 429 handling, and fail-open cache paths |\n| Caching | Simple and semantic caching | Cache visibility\u002Fintegrations | Cache integrations | LLM KV cache plus semantic cache |\n| Observability | Logs, policy events, traces, metrics | Core strength: request logs, sessions, analytics, costs | Callback\u002Flogging integrations | Requests, sessions, traces, metrics, usage metadata, cost, policy decisions, and optional body archival |\n| Key and access control | Key vault, configs, access controls | Proxy keys and request controls | Virtual keys, teams, budgets, self-hosted keys | Virtual keys, BYO provider keys, master-key resolution, workspace allowlists, model policy, and endpoint policy |\n| Budget and spend controls | Budget limits and gateway guardrails | Cost visibility and analytics | Budgets and spend controls | Agent\u002Fsession-aware budget guardrails across workspace, project, agent, member, model, provider, and endpoint |\n| Agent identity | Supports agent framework integrations | Can trace sessions and users | Can be used by agent clients | First-class agent registry: workspace, project, agent, user, session, prompt, model, provider, and virtual key attribution |\n| Runtime agent policies | General gateway policy and guardrails | Primarily observability-driven | Budgets, keys, routing, rate limits | Per-agent model access, token limits, retries, session budgets, fallback behavior, timeout controls, and kill-switch rules |\n| Agent client compatibility | General SDK\u002Fproxy compatibility | General SDK\u002Fproxy compatibility | General OpenAI-compatible compatibility | Cursor, Codex, opencode, Antigravity, OpenClaw, Hermes, LangChain, LlamaIndex, and custom OpenAI-compatible agents |\n| Agent workflow support | Can support agent traffic through gateway patterns | Strong tracing for agent\u002Fsession workflows | Works well as a proxy for agent frameworks | Built for agents, coding agents, n8n workflows, Activepieces, Zapier, Pipedream, Make, and custom workflow endpoints |\n| Paid endpoints | Not the primary product center | Not the primary product center | Not the primary product center | Turn agents, workflows, and HTTP services into paid endpoints |\n| Agent ledger and margin | Not the primary product center | Cost visibility, not revenue\u002Fcost margin ledger | Spend tracking, not paid-agent margin ledger | Tracks buyer revenue, AI token cost, external API spend, fees, policy decisions, and known margin per paid call |\n\nAlephant's differentiator is not only provider routing. It is the combination of an OpenAI-compatible gateway, agent identity, runtime control, budget guardrails, BYO-key governance, paid endpoints, and an agent ledger that connects revenue, token cost, external API spend, and known margin.\n\n```text\nStandard AI gateways route model calls.\nAlephant governs agents at runtime and tracks the margin of every paid call.\n\n## Repository structure\n\n```text\nalephant-ai-gateway\u002F\n├── ai-gateway\u002F                 # Gateway service crate\n├── crates\u002F                     # Shared libraries and harnesses\n├── docs\u002F                       # In-repo notes; curated docs at https:\u002F\u002Fapi.alephant.io\u002F\n├── scripts\u002F                    # CI and local automation\n├── infrastructure\u002F             # Deployment and observability infra\n├── test\u002F                       # Integration and runtime test helpers\n├── AGENTS.md                   # Agent collaboration conventions\n├── CLAUDE.md                   # Command and architecture reference\n└── CHANGELOG.md                # Project changelog\n```\n\n\u003Ca id=\"community\">\u003C\u002Fa>\n\n## Community\n\n- Website: [alephant.io](https:\u002F\u002Falephant.io\u002F)\n- Docs: [developers.alephant.io](https:\u002F\u002Fdevelopers.alephant.io\u002F)\n- Discord: [discord.gg\u002FtRQghcXhaH](https:\u002F\u002Fdiscord.gg\u002FtRQghcXhaH)\n- Telegram: [t.me\u002Falephantai](https:\u002F\u002Ft.me\u002Falephantai)\n- X: [x.com\u002Falephantai](https:\u002F\u002Fx.com\u002Falephantai)\n\n## Contributing\n\nContributions are welcome through issues and pull requests.\n\nHelpful contribution areas:\n\n- Provider adapter correctness and API mapping.\n- Routing, fallback, and resilience behavior.\n- Observability and diagnostics quality.\n- Test harness coverage and documentation clarity.\n\nFor substantial changes, include reproducible validation steps and feature-flag context (`external` or `internal`).\n\n## License\n\nLicensed under the [GPL License 3.0](LICENSE).\nUpstream license continuity is preserved where applicable.\n\n## Star History\n\n\u003Ca href=\"https:\u002F\u002Fwww.star-history.com\u002F?repos=AlephantAI%2FAIephant-AI-Gateway&type=date&legend=top-left\">\n \u003Cpicture>\n   \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"https:\u002F\u002Fapi.star-history.com\u002Fchart?repos=AlephantAI\u002FAIephant-AI-Gateway&type=date&theme=dark&legend=top-left\" \u002F>\n   \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"https:\u002F\u002Fapi.star-history.com\u002Fchart?repos=AlephantAI\u002FAIephant-AI-Gateway&type=date&legend=top-left\" \u002F>\n   \u003Cimg alt=\"Star History Chart\" src=\"https:\u002F\u002Fapi.star-history.com\u002Fchart?repos=AlephantAI\u002FAIephant-AI-Gateway&type=date&legend=top-left\" \u002F>\n \u003C\u002Fpicture>\n\u003C\u002Fa>\n","Alephant 是一个开源的AI代理网关，用于路由、跟踪和控制跨AI代理、成员和工作流的LLM使用，并支持通过x402和MPP支付轨道发布付费端点。该项目采用Rust语言开发，能够兼容50多个提供商和320多种模型，包括自定义模型后端。它提供流量路由、API适配、响应缓存、策略执行以及全面的请求观察功能，同时针对代理场景特别设计了身份管理、运行时策略、预算控制、会话追踪等功能。适用于需要高效管理和优化AI服务成本的企业或开发者，无论是托管还是自部署环境都能良好运行。",2,"2026-06-11 04:01:08","CREATED_QUERY"]