metapi  by cita-777

AI API proxy aggregation and intelligent routing gateway

Created 1 month ago
1,967 stars

Top 21.9% on SourcePulse

GitHubView on GitHub
Project Summary

Metapi addresses the complexity of managing multiple AI API gateways (like New API, One API, etc.) by aggregating them into a single, unified gateway. It targets developers and users who leverage various AI services, offering a simplified API key management, automatic model discovery, intelligent cost-optimized routing, and enhanced availability through a meta-aggregation layer.

How It Works

Metapi functions as a meta-aggregation layer, providing a unified proxy gateway compatible with OpenAI and Claude API formats. It automatically discovers available models across configured upstream platforms, creating a unified model list. Its core is an intelligent routing engine that dynamically selects the optimal upstream API based on a weighted combination of real-time cost, account balance, and usage metrics. The system also incorporates automatic failover and retry mechanisms to ensure request resilience.

Quick Start & Requirements

  • Primary install/run command: Docker is the primary deployment method.
    docker run -d --name metapi -p 4000:4000 \
      -e AUTH_TOKEN=your-admin-token \
      -e PROXY_TOKEN=your-proxy-sk-token \
      -v ./data:/app/data --restart unless-stopped \
      1467078763/metapi:latest
    
  • Non-default prerequisites: Docker, and importantly, AUTH_TOKEN and PROXY_TOKEN environment variables must be changed from their default values.
  • Links: Online Docs, Quick Start, Deployment Guide, Configuration Guide, Client Access Guide, FAQ.

Highlighted Details

  • Unified Proxy Gateway: Compatible with OpenAI and Claude, supports SSE streaming, and handles automatic format conversion between upstream APIs.
  • Intelligent Routing Engine: Features automatic model discovery, a four-level cost signal system, weighted routing (cost, balance, usage), and automatic channel cooling/avoidance upon failure.
  • Multi-Platform Aggregation: Supports adapters for New API, One API, OneHub, DoneHub, Veloera, AnyRouter, and Sub2API, managing account login, balance queries, model enumeration, and token synchronization.
  • Model Plaza: Provides a cross-site overview of model availability, pricing comparisons, and real-world performance metrics.
  • Automated Management: Includes automatic daily sign-in for rewards, balance tracking with alerts, and a centralized dashboard for monitoring.

Maintenance & Community

The project is built by the "AI community" and provides contribution guidelines (CONTRIBUTING.md), a code of conduct (CODE_OF_CONDUCT.md), and security reporting procedures (SECURITY.md). Specific community channels like Discord or Slack are not explicitly mentioned.

Licensing & Compatibility

Metapi is released under the MIT License, permitting commercial use and integration into closed-source projects. It is designed for self-hosting with all data stored locally in an SQLite database, ensuring no third-party data transmission.

Limitations & Caveats

As a self-hosted solution, users are responsible for managing server uptime, resource allocation, and security. The system relies on the stability and availability of the configured upstream API providers. Detailed performance benchmarks or known bugs are not explicitly listed in the README.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
276
Issues (30d)
182
Star History
1,329 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.