aiway简介
aiway (API and AI Gateway) 是一个基于 Rust 开发的轻量、高性能 API + AI 网关,致力于提供稳定、高效、可扩展的请求转发与管理解决方案。
凭借 Rust 的内存安全特性和零成本抽象优势,aiway 在保证高性能的同时,提供了卓越的安全性和稳定性。
与其他网关不同,aiway无需复杂的配置和环境依赖,网关节点可动态扩容/缩容,轻松应对百万并发连接。
如果对你有帮助,欢迎点个⭐支持一下 😊
支持的系统
- Linux (x86_64 / arm64)
- macOS (arm64)
- openEuler (x86_64)
- UOS Server (x86_64)
- KylinOS (x86_64)
支持的协议
- HTTP(IPv4/IPv6)
- SSE
- WebSocket
- MCP
文档
详细文档请访问:aiway.coderbox.cn/doc.html
快速开始
方式一:使用预编译版本
# 下载并解压
curl -L https://github.com/xgpxg/aiway/releases/latest/download/aiway-linux-amd64-standalone.tar.gz | tar -zxvf - -C .
# 启动服务
./aiway
注意:预编译版本基于 glibc 2.34 构建,如果您的系统glibc版本低于 2.34,请从源码构建。
方式二:从源码构建
# 构建 Gateway
cargo build --bin gateway
# 构建 Console
cargo build --bin console
# 构建 Logg
cargo build --bin logg
# 运行
cargo run --bin aiway
访问服务
- 管理控制台: http://127.0.0.1:7000
- 网关入口: http://127.0.0.1:7001
- 默认账号:
admin/admin
启动参数
./aiway -h
Usage: aiway [OPTIONS]
Options:
-a, --address <ADDRESS> Listen address, like 127.0.0.1 [default: 127.0.0.1]
-p, --port <PORT> Port [default: 7000]
--gateway-port <GATEWAY_PORT> Gateway port [default: 7001]
-h, --help Print help
-V, --version Print version
核心功能
- 动态路由
- 服务管理
- 插件系统
- 安全防护
- API Key 管理
- 日志监控
- 可视化面板
- AI 模型代理
- MCP 集成
- 多域名支持
插件生态
官方插件
我们提供了一系列常用插件,访问 aiway-plugins 获取更多信息。
自定义插件
如需开发自定义插件,请参考 插件开发文档。
界面预览
性能
当前
- 通过
access接入点访问
wrk https://aiway-test-1.coderbox.cn:7443/api/hello -t 12 -c 100
Running 10s test @ http://aiway-test-1.coderbox.cn:7080/api/hello
12 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 0.99ms 810.80us 34.97ms 96.17%
Req/Sec 8.43k 1.23k 16.35k 78.69%
1012287 requests in 10.10s, 253.90MB read
Requests/sec: 100224.67
Transfer/sec: 25.14MB
2026/05/24 前
- Ubuntu 24.04, Intel i7-12700K, 12 Cores, 16 GB RAM
wrk http://127.0.0.1:7001/api/hello -t 12 -c 100
Running 10s test @ http://127.0.0.1:7001/api/hello
12 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 0.89ms 780.09us 28.66ms 95.87%
Req/Sec 9.54k 1.12k 18.36k 93.70%
1144556 requests in 10.10s, 287.07MB read
Requests/sec: 113330.59
Transfer/sec: 28.43MB
- Ubuntu 22.04, 4 Cores, 8 GB RAM
wrk http://127.0.0.1:7001/hello -t 4 -c 100
Running 10s test @ http://127.0.0.1:7001/hello
4 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 6.70ms 3.05ms 36.85ms 73.84%
Req/Sec 7.61k 770.50 9.22k 64.50%
302860 requests in 10.01s, 75.96MB read
Requests/sec: 30265.20
Transfer/sec: 7.59MB
2026/03/26 前
- openEuler 24.03 (LTS-SP3), Intel(R) Xeon(R) 6982P-C, 4 Cores, 8 GB RAM
wrk http://127.0.0.1:7001/hello -t 4 -c 100
Running 10s test @ http://127.0.0.1:7001/hello
4 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 3.80ms 1.22ms 13.60ms 70.35%
Req/Sec 6.62k 380.06 7.43k 62.75%
263639 requests in 10.01s, 74.67MB read
Requests/sec: 26332.11
Transfer/sec: 7.46MB
- UOS Server 20, Intel(R) Xeon(R) Platinum, 4 Cores, 8 GB RAM
wrk http://127.0.0.1:7001/hello -t 4 -c 100
Running 10s test @ http://127.0.0.1:7001/hello
8 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 3.61ms 2.48ms 84.71ms 93.78%
Req/Sec 3.47k 452.12 11.40k 83.88%
276965 requests in 10.06s, 78.45MB read
Requests/sec: 27518.91
Transfer/sec: 7.79MB