yym68686/uni-api
This is a project that unifies the management of LLM APIs. It can call multiple backend services through a unified API interface, convert them to the OpenAI format uniformly, and support load balancing. Currently supported backend services include: OpenAI, Anthropic, DeepBricks, OpenRouter, Gemini, Vertex, etc.
uni‑api – A unified, self‑hosted gateway for many LLM providers
What it is
- An open‑source server that exposes the standard OpenAI HTTP endpoints (e.g.,
/v1/chat/completions,/v1/images/generations,/v1/embeddings, etc.) but forwards the requests to a configurable list of backend LLM services. - It lets you run a single API surface while mixing and matching providers such as OpenAI, Anthropic, Gemini, Vertex AI, Azure, AWS Bedrock, Cohere, Groq, Cloudflare Workers AI, OpenRouter, and others.
- All configuration is done via a plain
api.yamlfile (or a URL supplied inCONFIG_URL), so no separate UI is required.
Key capabilities
- Provider‑agnostic routing – map any OpenAI‑style request to the appropriate backend URL and API key.
- Load‑balancing – three modes:
- Weighted per‑channel balancing.
- Round‑robin (sequential) per‑channel balancing.
- Automatic round‑robin across multiple API keys within a channel.
- Automatic retry & cooling – if a backend returns an error, the request is retried on the next channel; failing channels are temporarily “cooled” and excluded until the cooldown expires.
- Fine‑grained timeouts – set different request timeouts per model.
- Permission & rate‑limit controls – per‑API‑key model whitelists, wildcard patterns, and configurable request caps (e.g.,
2/min,5/hour). - Tool and image support – native tool‑calling and image‑generation endpoints are passed through for providers that support them (Anthropic, Gemini, Vertex, etc.).
- Moderation – optional OpenAI‑style content moderation that can block disallowed user messages before they reach the backend.
- Custom request tweaks – per‑model overrides for request body fields, header injection, proxy settings, and maximum payload size.
How to run it
- Prepare
api.yaml– list your providers, their base URLs, API keys, and the models you want to expose. The README includes a minimal example and a very detailed advanced example. - Deploy – either:
- Mount the file into the Docker container as
api.yaml, or - Set
CONFIG_URLto point at a remote YAML file; the container will download it on start.
- Mount the file into the Docker container as
- Start the container – the image is published on Docker Hub (
yym68686/uni-api). A one‑click “Deploy to Fugue” button is provided for quick cloud deployment. - Consume the API – call the usual OpenAI endpoints on the host (e.g.,
http://localhost:8000/v1/chat/completions) using any of the API keys you defined in theapi_keyssection.
Who it’s for
- Individuals or small teams who want a personal “proxy” that aggregates many paid LLM services without building a custom UI.
- Developers needing a consistent OpenAI‑compatible interface while experimenting with different providers or fallback strategies.
- Anyone looking for simple YAML‑based configuration of load‑balancing, rate‑limiting, and model‑specific tweaks.
Links
- Telegram discussion group: https://t.me/uni_api
- Docker Hub page (pull counts, tags): https://hub.docker.com/repository/docker/yym68686/uni-api
- One‑click deployment: https://fugue.pro/new/repository?repository-url=https%3A%2F%2Fgithub.com%2Fyym68686%2Funi-api
All details above are taken directly from the repository’s README; no additional features have been inferred.
Related
- Project
- Project
- Project
- Project
- Project