AIephant-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.

110
Stars
15
Forks
Rust
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/AlephantAI/AIephant-AI-Agent-Gateway

快速入门

使用 AIephant-AI-Agent-Gateway 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

Alephant logo Alephant AI Gateway

Open source, OpenAI-compatible AI Gateway for 50+ providers, 320+ models, and custom model backends.
Route traffic, adapt provider APIs, cache responses, enforce policy, and observe every request from one developer-friendly integration point.

License Edition Version Providers Models Rust edition

Follow X Discord Telegram

Hosted SaaS Self-hostable BYO keys Agent clients

Alephant Agent Gateway cover

Quickstart · Website · Features · IDE · Architecture · Screenshots · Comparison · Changelog · Community · Docs

Get started -> · Simplified Chinese

What is Alephant AI Gateway

Alephant AI Gateway is an OpenAI-compatible control layer for production AI applications, available as hosted SaaS or as a self-hosted gateway. It gives developers one stable API surface while the gateway handles provider-specific adaptation, model routing, policy enforcement, layered caching, retries, fallback, usage metadata, request logging, and audit trails.

Instead of wiring every application directly to every provider, teams connect once and route across 50+ providers, 320+ models, and custom model backends. Start with Alephant Cloud for a managed workspace, or self-host the gateway when you need private infrastructure, BYO keys, and direct operational control.

import OpenAI from "openai"

const openai = new OpenAI({
  baseURL: "https://ai.alephant.io/v1",
  defaultHeaders: {
    Authorization: `Bearer ${process.env.ALEPHANT_API_KEY}`,
    "Alephant-Session-Id": "session-xxx", // optional
  }
})

Project status

Alephant AI 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.


Why this exists

AI applications are moving from single-model prototypes to production systems that call many providers, agents, tools, and custom model backends. Without a gateway, every team ends up rebuilding the same operational layer: provider adapters, routing rules, key management, usage metadata, retries, caching, and request logs.

Alephant AI Gateway centralizes that layer behind one OpenAI-compatible API. It gives developers a stable integration surface while platform teams get policy before provider access, cache before repeated calls, fallback before outages, and audit trails before production incidents.

The goal is simple: make AI traffic observable, governable, and reliable without slowing developers down. Learn more ->

Features

CapabilityWhat Alephant AI Gateway provides
One API surfaceOpenAI-compatible /v1/* and /ai/* routes for chat, responses, embeddings, images, and provider-style model names
Provider and model coverage50+ providers, 320+ models, local runtimes, OpenRouter-style catalogs, and custom/private backends
Provider adaptationRequest, tool, streaming, error, usage, finish-reason, and response normalization across provider APIs
Routing and resilienceDirect provider paths, policy routers, retries, fallback, health checks, provider 429 handling, and fail-open cache paths
Agent client compatibilityOpenAI-compatible formats for Cursor, Codex, opencode, and Antigravity workflows
IDE integrationCursor-ready with architecture rules, workflow guides, implementation skills, and task management; opencode, Codex, and Claude Code adapters in progress
Policy and key controlVirtual keys, master key resolution, model policy, workspace provider allowlists, and concurrency controls
CachingGateway-side LLM KV cache and semantic cache to avoid repeated upstream calls
ObservabilityRequest logs, traces, metrics, usage metadata, optional body archival, and downstream log delivery
Live operationsRoute, virtual key, and provider key refresh from database changes without restarting the gateway
DeploymentHosted SaaS through Alephant Cloud, or self-hosted Rust gateway with PostgreSQL, Redis, Qdrant, and S3-compatible integrations

Developer surface

SurfacePurpose
/v1/*Drop-in OpenAI-compatible API for existing SDKs and agent clients
/router/{id}/*Policy-driven routing through a configured router
/{provider}/*Direct provider passthrough when you want explicit upstream control
model=provider/model_idSelect a provider and model without changing application code
Custom backendsPut private models or self-hosted runtimes behind the same gateway contract

Architecture & request lifecycle

Architecture & request lifecycle

Every 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:

PathUse it for
/v1/*Unified OpenAI-style access with model=provider/model_id
/router/{id}/*Policy-driven routing through a configured router
/{provider}/*Direct provider passthrough when you want an explicit upstream

Multi-provider adaptation

Use 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/model_id; Alephant resolves the provider, applies the right adapter, maps provider-specific fields, and returns a normalized OpenAI-style response.

Instead 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.

Multi-provider adaptation

Mainstream modelsGPT-4o · GPT-4.1 · o3 · Claude 3.5/3.7 Sonnet · Claude Opus · Gemini 1.5/2.0 · Llama 3/4 · Mistral Large · Command R+
Provider ecosystemOpenAI · Anthropic · Google Gemini · AWS Bedrock · Azure OpenAI · OpenRouter · Together AI · Fireworks · Groq · Cohere · Mistral · Perplexity · DeepSeek · xAI · Ollama
Agent client compatibilityCursor · Codex · opencode · Antigravity

IDE integration

Alephant AI Gateway ships repository-level tooling for AI-assisted development inside supported IDEs.

IDE / Agent ClientStatusWhat's included
CursorReadyProject 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
opencodeIn progressAdapter and configuration under development
CodexIn progressAdapter and configuration under development
Claude CodeIn progressAdapter and configuration under development

Quickstart

Use Alephant Cloud (hosted SaaS)

Keep 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.

Set your gateway key:

export ALEPHANT_API_KEY="vk-..."

Smoke-test with curl:

curl https://ai.alephant.io/v1/chat/completions \
  -H "Authorization: Bearer $ALEPHANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [
      { "role": "user", "content": "Explain Alephant AI Gateway in one sentence." }
    ]
  }'

Or use the OpenAI SDK:

import OpenAI from "openai"

const openai = new OpenAI({
  baseURL: "https://ai.alephant.io/v1",
  defaultHeaders: {
    Authorization: `Bearer ${process.env.ALEPHANT_API_KEY}`,
    "Alephant-Session-Id": "demo-session", // optional: group requests into a trace/session
  }
})

const response = await openai.chat.completions.create({
  model: "openai/gpt-4o",
  messages: [
    { role: "user", content: "Explain Alephant AI Gateway in one sentence." }
  ]
})

console.log(response.choices[0]?.message?.content)

Get started ->

Self-host from source

Alephant 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/Redis/Qdrant/S3-compatible infrastructure, and control provider keys, router configuration, cache behavior, and logging destinations from your deployment.

Self-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.

Prerequisites

DependencyRequiredUsed for
Rust toolchainYesBuild and run the gateway service
PostgreSQLYesRouter, key, workspace, and runtime configuration
RedisRecommendedShared runtime state, concurrency controls, and cache-related paths
QdrantOptionalSemantic cache
S3-compatible storageOptionalLarge request/response body archival

Build ai-gateway with exactly one of --features external or --features internal.

Build

cargo build -p ai-gateway --features external

Use external for the public/open deployment mode, or internal when running with the internal KV/backend assumptions used by your environment. Only enable one of these feature sets at a time.

Run locally

cargo run -p ai-gateway --features external -- -c ./ai-gateway/config/local.yaml

The config file controls database connections, provider settings, cache services, observability, and runtime behavior. For local development, start with ai-gateway/config/local.yaml and adjust it to match your services.

Configuration

The 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.

Useful starting points:

FilePurpose
ai-gateway/config/local.yamlLocal development defaults
ai-gateway/config/local-cloud.yamlLocal cloud-style integration
ai-gateway/config/alephant-cloud.yamlAlephant platform-connected deployment shape

Environment 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.

Verify

Keep the local gateway process running. The smoke harness targets the default local gateway URL, http://localhost:8080.

cargo run -p test

You can also point an OpenAI-compatible SDK at your self-hosted gateway:

import OpenAI from "openai"

const openai = new OpenAI({
  baseURL: "http://localhost:8080/v1",
  defaultHeaders: {
    Authorization: `Bearer ${process.env.ALEPHANT_VIRTUAL_KEY}`,
  }
})

Integration tests

cargo test -p ai-gateway --tests --features "external integration"

Security & privacy

Alephant 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.

AreaGateway behavior
BYO provider keysProvider credentials can stay under your control through gateway configuration and key resolution
Virtual key isolationApplication-facing keys can be separated from upstream provider keys
Optional body archivalRequest/response body storage is configurable rather than mandatory
SaaS or self-hostUse Alephant Cloud for managed operations, or run the gateway inside your own infrastructure
Policy gatesModel policy, provider allowlists, and concurrency controls can be enforced before upstream dispatch

Runtime internals

CapabilityWhy it matters
DB listener-driven hot reloadRoute and key changes can be picked up without restarting the gateway
S3-compatible body storageRequest and response bodies can be archived outside the hot request path when enabled
Downstream request-log deliveryStructured gateway logs can be pushed to Alephant or another downstream system
Content-filter integrationOptional gRPC filter path with fail-open reconnect behavior
Workspace concurrency guardRedis-backed controls help protect shared upstream capacity
Provider 429 monitoringProvider rate-limit signals can feed discovery and routing decisions

Screenshots

Explore the Alephant workspace experience around the gateway: usage overview, request logs, sessions, cache visibility, insights, and governance controls.

OverviewRequest logs
Alephant AI Gateway overview dashboard
Workspace-level usage, request volume, latency, tokens, and cache health.
Alephant AI Gateway request logs
Request-level inspection for status, model, source, tokens, cost, and upstream outcome.
SessionsCache
Alephant AI Gateway sessions
Trace agent and application journeys across steps, duration, spend, and status.
Alephant AI Gateway cache dashboard
Monitor cache hits, savings, repeated prompts, and frequently reused responses.
InsightsGovernance
Alephant AI insights dashboard
Surface reliability, spend, and efficiency signals from gateway traffic.
Alephant AI governance controls
Configure usage limits, budget controls, rate limits, and policy rules.

Comparison

Portkey, Alephant, and LiteLLM are excellent projects, but they start from different centers of gravity. Alephant is built for teams shipping agentic AI products: a hosted SaaS workspace plus a self-hosted gateway path for agent development, cost control, provider routing, governance, and operational visibility.

ProjectBest known forBest fit
PortkeyEnterprise AI gateway controls, guardrails, and managed policy workflowsTeams that want a managed AI control plane
AlephantLLM observability, request analytics, sessions, and cost visibilityTeams whose primary need is tracing and analytics
LiteLLMBroad Python proxy/SDK ecosystem for many providersTeams that want maximum provider breadth through a Python stack
Alephant AI GatewayAgent development infrastructure, cost control, governance, provider routing, and SaaS + self-host deploymentTeams building production agents that need cost guardrails, request traceability, BYO keys, and multi-provider control
CapabilityPortkeyAlephantLiteLLMAlephant AI Gateway
OpenAI-compatible APIYesYesYesYes
SaaS + self-hostEnterprise/self-host optionsHosted and self-host optionsSelf-hosted proxyYes: Alephant Cloud plus self-hosted Rust gateway
Provider/model coverageBroadBroad logging/proxy coverageVery broad50+ providers, 320+ models, custom backends
Agent coding clientsNo dedicated compatibility layerNo dedicated compatibility layerNo dedicated compatibility layerCursor, Codex, opencode, Antigravity workflows
Agent cost controlGuardrails and policy controlsCost analytics and request visibilityBudgets and spend controlsAgent/session-aware usage visibility, cache savings, budget controls, and governance workflows
Provider adaptationGateway policies and routingProxy plus observability pipelineStrong provider abstractionExplicit mappers for requests, streaming, errors, usage, and responses
Routing and resilienceRouting, retries, fallbacksGateway controls plus observabilityRouter, fallback, budgetsDirect paths, policy routers, fallback, health checks, provider 429 handling
BYO key controlKey vault / enterprise controlsBYO keys with proxy controlsVirtual keys and self-hosted keysBYO provider keys, master-key resolution, workspace allowlists
CacheGateway cachingCache tracking/integrationsCache integrationsLLM KV cache plus semantic cache
ObservabilityLogs and policy eventsCore strengthCallback/logging integrationsLogs, traces, metrics, usage metadata, optional body archival
Governance pathStrong enterprise guardrailsWorkspace controls around observabilityTeams, budgets, rate limitsAgent/session governance, model policy, provider allowlists, concurrency controls, and workspace-level controls

Alephant's differentiator is the combination: hosted SaaS, self-hosted Rust gateway, agent-first developer compatibility, cost-control workflows, BYO-key governance, explicit provider adaptation, and workspace-level AI FinOps.

Repository structure

alephant-ai-gateway/
├── ai-gateway/                 # Gateway service crate
├── crates/                     # Shared libraries and harnesses
├── docs/                       # In-repo notes; curated docs at https://developers.alephant.io/
├── scripts/                    # CI and local automation
├── infrastructure/             # Deployment and observability infra
├── test/                       # Integration and runtime test helpers
├── AGENTS.md                   # Agent collaboration conventions
├── CLAUDE.md                   # Command and architecture reference
└── CHANGELOG.md                # Project changelog

Community

Contributing

Contributions are welcome through issues and pull requests.

Helpful contribution areas:

  • Provider adapter correctness and API mapping.
  • Routing, fallback, and resilience behavior.
  • Observability and diagnostics quality.
  • Test harness coverage and documentation clarity.

For substantial changes, include reproducible validation steps and feature-flag context (external or internal).

Change logs

CHANGELOG.md

License

Licensed under the GPL License 3.0. Upstream license continuity is preserved where applicable.

Star History

Star History Chart

常见问题

What is AIephant-AI-Agent-Gateway?

AIephant-AI-Agent-Gateway is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by 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. It has 110 GitHub stars.

Is AIephant-AI-Agent-Gateway safe to use?

Yes. AIephant-AI-Agent-Gateway passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install AIephant-AI-Agent-Gateway?

Clone the repository with "git clone https://github.com/AlephantAI/AIephant-AI-Agent-Gateway" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is AIephant-AI-Agent-Gateway written in?

AIephant-AI-Agent-Gateway is primarily written in Rust. It is open-source under AlephantAI on GitHub, so you can review or fork the full source.

Are there alternatives to AIephant-AI-Agent-Gateway?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh AIephant-AI-Agent-Gateway against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情