ai-gateway-api

command module
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

README

License Go

English | 简体中文

AI Gateway API

AI Gateway API is the control-plane core component of AI Gateway. It provides APIs for creating, storing, and distributing policies/configurations. Built on top of the open-source BFE project, it offers unified traffic gateway management for AI scenarios.

Architecture Overview

Architecture

AI Gateway consists of the following core components:

Component Role Description Repository
AI Gateway API Control plane Exposes Open APIs to manage policies/configurations and distribute them This repo
Dashboard Admin console Web UI for visual management rainway-ai-gateway/ai-gateway-web
BFE Data plane Traffic forwarding and access control bfenetworks/bfe
Conf Agent Config agent Fetches the latest config and triggers BFE hot reload bfenetworks/conf-agent
Service Controller Service discovery Discovers and syncs Kubernetes backend services bfenetworks/service-controller

Key Features

  • AI route management: Route configuration for multiple AI model providers (OpenAI, DeepSeek, Anthropic, Google Gemini, etc.)
  • API key management: Create/delete/validate API keys for AI services
  • Domain management: Bind domains and configure routing rules
  • Certificate management: Upload and manage TLS certificates
  • Cluster/sub-cluster management: Manage backend service clusters
  • Traffic management: Traffic allocation and scheduling
  • Dashboard integration: Container image bundles the Web console UI
  • Config export: Export configuration for BFE data plane and Conf Agent

Quick Start

Prerequisites
  • Go 1.22 or later
  • MySQL 8
  • Redis 6.2
Build from source
# Clone repo
git clone https://github.com/rainway-ai-gateway/ai-gateway-api.git
cd ai-gateway-api

# Download deps and build
make

# Artifacts are in output/
Initialize database
mysql -u{user} -p{password} < db_ddl.sql
Configure

Edit conf/ai_gateway_api.toml. At minimum, update the database connection:

[Databases.bfe_db]
DBName               = "open_bfe"
Addr                 = "127.0.0.1:3306"
User                 = "{user}"
Passwd               = "{password}"

For detailed configuration parameters, see 配置文件说明.

Start the service
./ai-gateway-api -c ./conf -sc ai_gateway_api.toml -l ./log

After startup:

  • API port: 8183 (default)
  • Monitoring port: 8284 (default)
  • Dashboard: open http://localhost:8183 (default username/password: admin / admin)

Container Images & Kubernetes Deployment Example

See the ai-gateway-demo repository:

Contributing

Contributions are welcome! See CONTRIBUTING.md for the development workflow and guidelines.

License

AI Gateway API is released under the Apache License 2.0.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
innerapi_v1/epp_data
Package epp_data exposes the InnerAPI export endpoint of the merged EPP data config (epp_config + assignment, see design-docs/api-define/ InnerAPI接口定义/epp-data.md).
Package epp_data exposes the InnerAPI export endpoint of the merged EPP data config (epp_config + assignment, see design-docs/api-define/ InnerAPI接口定义/epp-data.md).
openapi_v1/epp_assignments
Package epp_assignments exposes the OpenAPI endpoints of the EPP cluster to instance-group assignment view and its manual override (design-docs/api-define/OpenAPI接口定义/epp-assignments.md).
Package epp_assignments exposes the OpenAPI endpoints of the EPP cluster to instance-group assignment view and its manual override (design-docs/api-define/OpenAPI接口定义/epp-assignments.md).
openapi_v1/epp_pool
Package epp_pool exposes the OpenAPI endpoints of the singleton EPP instance pool (design-docs/api-define/OpenAPI接口定义/epp-pool.md).
Package epp_pool exposes the OpenAPI endpoints of the singleton EPP instance pool (design-docs/api-define/OpenAPI接口定义/epp-pool.md).
lib
model
epp_pool
Package epp_pool implements the EPP instance pool, the cluster to instance-group assignment model and the epp_data export generator.
Package epp_pool implements the EPP instance pool, the cluster to instance-group assignment model and the epp_data export generator.
storage
rdb/epp_pool
Package epp_pool implements model/epp_pool.EppPoolStorager on top of the relational DAO layer (MySQL/SQLite).
Package epp_pool implements model/epp_pool.EppPoolStorager on top of the relational DAO layer (MySQL/SQLite).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL