{"repo":"timcsy/ai-api","free":true,"listed":false,"github":"https://github.com/timcsy/ai-api","clone":"git clone https://github.com/timcsy/ai-api.git","description":"Self-hosted, OpenAI-compatible AI gateway for organizations — multi-provider (Azure/OpenAI/Anthropic/Gemini), revocable per-allocation credentials, usage & cost tracking, and an OpenAI Codex–ready /v1/responses endpoint.","language":"Python","stars":15,"topics":["ai-gateway","anthropic","api-gateway","azure-openai","fastapi","gemini","helm","kubernetes","litellm","llm-gateway"],"license":"MIT","category":"deployment-docker-iac","readme_excerpt":"AI API Manager 組織內部 AI API 的 單一分流入口 ：用一套 OpenAI 相容的閘道，把多家 AI 供應商 （Azure OpenAI / OpenAI / Anthropic / Gemini）統一對成員開放，並以 可撤回的分配憑證 管控誰能用、用多少、花多少——用量與成本全部統一歸戶。 核心理念： 分享就是資源的分配 。每一筆 AI 存取都是一份有對象、有額度、可調整、 可收回的資源，而不是一次性把 key 發出去。 功能總覽 - OpenAI 相容代理 - POST /v1/chat/completions （Chat Completions） - POST /v1/responses （Responses API， 支援 SSE streaming、工具呼叫、reasoning ） — 讓 OpenAI Codex 等 agent CLI 用平台憑證即可使用 - 多供應商 ：經 litellm （library form）統一抽象；OpenAI/Azure 原生高保真、其他家自動橋接 - 可撤回分配憑證 ：每筆分配發行獨立 token；撤回後即時生效（不等過期），也可 暫停 / 恢復 - 身份與成員管理 ：Google Workspace SSO + 本機密碼；白名單 / 自動註冊規則 / 來源限制 - 模型目錄 ：以「模型」為第一公民，多面向 filter；可見性 = 已配置 credential ∩ 存取政策 - Tag-based 存取規則 ：用 tag 批次授權；新成員可依規則自動貼 tag - 自助領取憑證 ：被授權的成員可對開放的 model 一鍵領取；亦可自助暫停/恢復自己的憑證 - 用量觀測與計費 ：point-in-time 計費，分項記錄 input / output / reasoning / cached token； 月度配額、自適應配額池、CSV/JSON 匯出 - 管理員 Web UI ：成員、分配、用量、配額、價目、Provider 憑證、稽核紀錄 - 安全加固 ：Provider key 以 Fernet 加密落 DB（金鑰由 K8s Secret 提供，pod 啟動即驗證）、 K8s NetworkPolicy、CI Trivy 掃描 + SBOM、distroless runtime 架構 - 後端 ：FastAPI（Python 3.11+）+ SQLAlchemy 2.x async + Alembic；上游經 litellm library form - 前端 ：React 19 + Vite 6 + TypeScript（strict）+ shadcn/ui + TanStack Query - 資料庫 ：PostgreSQL（生產）/ SQLite（dev、CI） - 部署 ：Kubernetes + Helm chart（ deploy/helm/ai-api ）；前端為單一來源 nginx 反向代理到後端 - 映像 ：後端 distroless、前端 unprivileged nginx；CI 以 GitHub Actions build + Trivy 把關 對外 API 把 $TOKEN 換成你分配到的憑證，放在 Authorization: Bearer 。 搭配 OpenAI Codex 支援 responses 能力的模型可在後台「模型目錄 → 如何呼叫 → Codex」分頁 下載 config.toml 並依各作業系統步驟設定。基本設定： 本機開發 需要","default_branch":null,"files":null,"tree":[],"storefront":"/r/timcsy","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/timcsy/ai-api/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}