[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74654":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},74654,"codex2api","james-6-23\u002Fcodex2api","james-6-23","Codex2API 是一个基于 Go + Gin + React\u002FVite 的 Codex 反向代理与管理后台项目","https:\u002F\u002Fcodex2api-latest-vu8j.onrender.com",null,"Go",1501,266,1,14,0,58,142,416,174,102.28,false,"main",true,[],"2026-06-12 04:01:15","\u003Cp align=\"center\">\n  \u003Cimg src=\"assets\u002Fbanner.svg\" alt=\"Codex2API\" width=\"100%\">\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cb>English\u003C\u002Fb> | \u003Ca href=\"README.zh-CN.md\">中文\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FGo-1.26-00ADD8?style=for-the-badge&logo=go&logoColor=white\" alt=\"Go\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FGin-1.12-00ACD7?style=for-the-badge\" alt=\"Gin\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FReact-19-61DAFB?style=for-the-badge&logo=react&logoColor=111827\" alt=\"React\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FVite-8-646CFF?style=for-the-badge&logo=vite&logoColor=white\" alt=\"Vite\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDB-PostgreSQL%20%7C%20SQLite-4169E1?style=for-the-badge&logo=postgresql&logoColor=white\" alt=\"Database\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCache-Redis%20%7C%20Memory-DC382D?style=for-the-badge&logo=redis&logoColor=white\" alt=\"Cache\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAPI-OpenAI%20%7C%20Anthropic-10A37F?style=for-the-badge\" alt=\"API\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDocker-Ready-2496ED?style=for-the-badge&logo=docker&logoColor=white\" alt=\"Docker\">\n\u003C\u002Fp>\n\n**Turn a Codex account pool into an observable, schedulable, operations-ready OpenAI \u002F Anthropic compatible gateway.** Codex2API is not a thin forwarding proxy. It is a long-running Codex access hub: it exposes `\u002Fv1\u002Fchat\u002Fcompletions`, `\u002Fv1\u002Fresponses`, `\u002Fv1\u002Fmessages`, Images, and Models endpoints while managing Refresh Token \u002F Access Token accounts, health scoring, dynamic concurrency, rate-limit recovery, usage tracking, and admin operations behind the scenes.\n\nRun it as a full **PostgreSQL + Redis** production stack or as a single-container **SQLite + in-memory cache** deployment. Point Codex CLI, Claude Code, the OpenAI SDK, or any compatible client at one Base URL, then manage accounts, proxies, API keys, prompt filtering, image workflows, and runtime settings from the built-in dashboard.\n\n\u003Ctable>\n\u003Ctr>\u003Ctd width=\"210\">\u003Cb>One compatible gateway\u003C\u002Fb>\u003C\u002Ftd>\u003Ctd>OpenAI-style Chat Completions \u002F Responses \u002F Images, Anthropic Messages, prefixless compatibility routes, and native Codex Responses forwarding are all exposed through one service.\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Cb>Account-pool scheduler\u003C\u002Fb>\u003C\u002Ftd>\u003Ctd>Selection is driven by account status, health tier, scheduler score, dynamic concurrency, cooldown recovery, and recent usage so unhealthy accounts are avoided automatically.\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Cb>Visual admin console\u003C\u002Fb>\u003C\u002Ftd>\u003Ctd>The embedded React \u002F Vite dashboard covers account import and testing, API keys, proxy pools, image studio, prompt filtering, usage analytics, operations, scheduler board, and system settings.\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Cb>Two deployment shapes\u003C\u002Fb>\u003C\u002Ftd>\u003Ctd>Use PostgreSQL + Redis for production or SQLite + Memory for lightweight single-node deployments; Docker images, source builds, local development, and the interactive deploy script are ready to use.\u003C\u002Ftd>\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n---\n\n## Live Demo\n\n- Demo URL: [https:\u002F\u002Fcodex2api-latest-vu8j.onrender.com](https:\u002F\u002Fcodex2api-latest-vu8j.onrender.com)\n- Demo password: `codex2api`\n\n> The demo is only for trying the admin dashboard and basic UI flows. Do not upload real Refresh Tokens, Access Tokens, API keys, or any other sensitive data.\n\n---\n\n## Screenshots\n\n> Screenshots use demo data. The actual dashboard depends on your account pool, request logs, and runtime environment.\n\n![CodexProxy Dashboard](docs\u002Fscreenshots\u002Fdashboard.png)\n\n\u003Cdetails>\n\u003Csummary>More admin dashboard screenshots\u003C\u002Fsummary>\n\n| Accounts | Dashboard Trends |\n| --- | --- |\n| ![Accounts](docs\u002Fscreenshots\u002Faccounts.png) | ![Dashboard Trends](docs\u002Fscreenshots\u002Fdashboard-trends.png) |\n\n| Image Studio | Prompt Filter |\n| --- | --- |\n| ![Image Studio](docs\u002Fscreenshots\u002Fimage-studio.png) | ![Prompt Filter](docs\u002Fscreenshots\u002Fprompt-filter.png) |\n\n| Operations | Usage |\n| --- | --- |\n| ![Operations](docs\u002Fscreenshots\u002Foperations.png) | ![Usage](docs\u002Fscreenshots\u002Fusage.png) |\n\n| Usage Guide | API Reference |\n| --- | --- |\n| ![Usage Guide](docs\u002Fscreenshots\u002Fguide.png) | ![API Reference](docs\u002Fscreenshots\u002Fapi-reference.png) |\n\n\u003C\u002Fdetails>\n\n---\n\n## Contents\n\n- [Live Demo](#live-demo)\n- [Screenshots](#screenshots)\n- [Sponsors](#sponsors)\n- [Quick Start](#quick-start)\n- [Documentation](#documentation)\n- [Upgrade and Local Development](#upgrade-and-local-development)\n- [Configuration](#configuration)\n- [Public API](#public-api)\n  - [Token Upload and Account Management](#token-upload-and-account-management)\n- [Admin Dashboard](#admin-dashboard)\n- [Core Capabilities](#core-capabilities)\n- [Project Structure](#project-structure)\n- [Notes](#notes)\n- [Disclaimer and License](#disclaimer-and-license)\n- [Star History](#star-history)\n- [Links](#links)\n\n---\n\n## Sponsors\n\n> Want to appear here? Open an issue on GitHub.\n\n\u003Ctable>\n\u003Ctr>\n\u003Ctd width=\"180\" align=\"center\" valign=\"middle\">\u003Ca href=\"https:\u002F\u002Fai.centos.hk\">\u003Cb>星辰·AI\u003C\u002Fb>\u003C\u002Fa>\u003C\u002Ftd>\n\u003Ctd valign=\"middle\">Thanks to \u003Cb>\u003Ca href=\"https:\u002F\u002Fai.centos.hk\">星辰·AI\u003C\u002Fa>\u003C\u002Fb> for sponsoring this project! 星辰·AI provides stable and high-speed relay services for Claude Code \u002F Codex \u002F Gemini, suitable for both individual developers and teams.\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n---\n\n## Quick Start\n\n> For detailed deployment instructions, see [DEPLOYMENT.md](docs\u002FDEPLOYMENT.md).\n\n### Deployment Modes\n\n| Mode | File | Use Case |\n| --- | --- | --- |\n| Docker image deployment | `docker-compose.yml` | Recommended for servers and test environments using the prebuilt image |\n| Local source container build | `docker-compose.local.yml` | Full container verification after local source changes |\n| SQLite lightweight deployment | `docker-compose.sqlite.yml` | Single-node deployment without PostgreSQL or Redis |\n| SQLite local source build | `docker-compose.sqlite.local.yml` | Local source verification for the lightweight SQLite mode |\n| Local development | `go run .` + `npm run dev` | Backend and frontend development |\n\n### Commands\n\nStandard image mode:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fjames-6-23\u002Fcodex2api.git\ncd codex2api\ncp .env.example .env\ndocker compose pull\ndocker compose up -d\ndocker compose logs -f codex2api\n```\n\nStandard local build mode:\n\n```bash\ncp .env.example .env\ndocker compose -f docker-compose.local.yml up -d --build\ndocker compose -f docker-compose.local.yml logs -f codex2api\n```\n\nSQLite image mode:\n\n```bash\ncp .env.sqlite.example .env\ndocker compose -f docker-compose.sqlite.yml pull\ndocker compose -f docker-compose.sqlite.yml up -d\ndocker compose -f docker-compose.sqlite.yml logs -f codex2api\n```\n\nSQLite local build mode:\n\n```bash\ncp .env.sqlite.example .env\ndocker compose -f docker-compose.sqlite.local.yml up -d --build\ndocker compose -f docker-compose.sqlite.local.yml logs -f codex2api\n```\n\nAfter startup:\n\n- Admin dashboard: `http:\u002F\u002Flocalhost:8080\u002Fadmin\u002F`\n- Health check: `http:\u002F\u002Flocalhost:8080\u002Fhealth`\n\nNotes:\n\n- Standard and SQLite modes both read `.env`.\n- Before switching deployment modes, replace `.env` with the matching example file.\n- The SQLite lightweight mode runs a single `codex2api` container and stores data at `\u002Fdata\u002Fcodex2api.db`.\n- The image studio library is stored under `\u002Fdata\u002Fimages`; Docker configurations persist `\u002Fdata`.\n- `docker compose down` does not delete named volumes by default. Data is removed only by commands such as `docker compose down -v`, `docker volume rm`, or `docker volume prune`.\n\n---\n\n## Documentation\n\n| Document | Description | Path |\n| --- | --- | --- |\n| [Chinese README](README.zh-CN.md) | Main Chinese project overview | `README.zh-CN.md` |\n| [API Documentation](docs\u002FAPI.md) | API endpoints, request and response examples, error codes | `docs\u002FAPI.md` |\n| [Deployment Guide](docs\u002FDEPLOYMENT.md) | Deployment modes, upgrade guide, backup and restore | `docs\u002FDEPLOYMENT.md` |\n| [Configuration Guide](docs\u002FCONFIGURATION.md) | Environment variables, system settings, configuration priority | `docs\u002FCONFIGURATION.md` |\n| [Architecture](docs\u002FARCHITECTURE.md) | System architecture, scheduling algorithm, storage design | `docs\u002FARCHITECTURE.md` |\n| [Troubleshooting](docs\u002FTROUBLESHOOTING.md) | Common issues, diagnostic scripts, fixes | `docs\u002FTROUBLESHOOTING.md` |\n| [Contributing](docs\u002FCONTRIBUTING.md) | Development rules, PR workflow, code standards | `docs\u002FCONTRIBUTING.md` |\n\n---\n\n## Upgrade and Local Development\n\nUpgrade the standard image deployment:\n\n```bash\ngit pull && docker compose pull && docker compose up -d && docker compose logs -f codex2api\n```\n\nBack up the database before upgrading:\n\n```bash\ndocker exec codex2api-postgres pg_dump -U codex2api codex2api > backup_$(date +%Y%m%d_%H%M%S).sql\n```\n\nRestore from a backup if needed:\n\n```bash\ndocker exec -i codex2api-postgres psql -U codex2api codex2api \u003C backup_xxx.sql\n```\n\nUnless you explicitly need to recreate resources, avoid `docker compose down` during upgrades. `pull + up -d` keeps existing containers and named volumes.\n\n### Local Development\n\nBackend:\n\n```bash\ncp .env.example .env\ncd frontend && npm ci && npm run build && cd ..\ngo run .\n```\n\nThe frontend must be built before the first backend run because Go embeds `frontend\u002Fdist` through `go:embed`.\n\nFrontend dev server:\n\n```bash\ncd frontend && npm ci && npm run dev\n```\n\nVite proxies `\u002Fapi` and `\u002Fhealth` to the backend. During development, open `http:\u002F\u002Flocalhost:5173\u002Fadmin\u002F`.\n\n---\n\n## Configuration\n\n### Environment Variables\n\n> For the full configuration reference, see [CONFIGURATION.md](docs\u002FCONFIGURATION.md).\n\n| Variable | Description |\n| --- | --- |\n| `CODEX_PORT` | HTTP port, default `8080` |\n| `ADMIN_SECRET` | Admin dashboard secret. When set, `\u002Fadmin` prompts for authentication |\n| `DATABASE_DRIVER` | Database driver: `postgres` or `sqlite` |\n| `DATABASE_PATH` | SQLite database file path, used when `DATABASE_DRIVER=sqlite` |\n| `DATABASE_HOST` | PostgreSQL host |\n| `DATABASE_PORT` | PostgreSQL port, default `5432` |\n| `DATABASE_USER` | PostgreSQL user |\n| `DATABASE_PASSWORD` | PostgreSQL password |\n| `DATABASE_NAME` | PostgreSQL database name |\n| `DATABASE_SSLMODE` | PostgreSQL SSL mode, default `disable` |\n| `CACHE_DRIVER` | Cache driver: `redis` or `memory` |\n| `REDIS_ADDR` | Redis address, for example `redis:6379`, `redis:\u002F\u002Fdefault:pass@host:6379\u002F0`, or `rediss:\u002F\u002Fdefault:pass@host:6379\u002F0` |\n| `REDIS_USERNAME` | Optional Redis ACL username |\n| `REDIS_PASSWORD` | Redis password |\n| `REDIS_DB` | Redis database number |\n| `REDIS_TLS` | Enable TLS for `host:port` Redis addresses |\n| `REDIS_INSECURE_SKIP_VERIFY` | Skip Redis TLS certificate verification, default `false` |\n| `TZ` | Timezone, for example `Asia\u002FShanghai` |\n\nCloud Redis providers such as Aiven and Upstash often require TLS. Prefer a `rediss:\u002F\u002F...` URL when your provider gives one.\n\nThe standard `.env.example` declares `DATABASE_DRIVER=postgres` and `CACHE_DRIVER=redis`. For the lightweight SQLite mode, use `.env.sqlite.example`.\n\n### Runtime Settings\n\nRuntime business settings are stored in the database `SystemSettings` table and can be updated from the admin settings page.\n\nExamples include `MaxConcurrency`, `GlobalRPM`, `TestModel`, `TestConcurrency`, `ProxyURL`, `PgMaxConns`, `RedisPoolSize`, `AdminSecret`, and auto-cleanup switches.\n\nDefault settings are written automatically on first startup.\n\n### API Keys and Admin Secret\n\n- Public API keys come from the database API Keys table. If no key is configured, `\u002Fv1\u002F*` skips API key authentication.\n- Admin Secret priority:\n  - If `ADMIN_SECRET` is set in `.env`, the environment variable wins.\n  - Otherwise, the database `AdminSecret` value is used.\n  - After login, the frontend sends `X-Admin-Key` when calling `\u002Fapi\u002Fadmin\u002F*`.\n\n---\n\n## Public API\n\n| Endpoint | Description |\n| --- | --- |\n| `POST \u002Fv1\u002Fchat\u002Fcompletions` | Chat Completions style endpoint |\n| `POST \u002Fv1\u002Fresponses` | Responses style endpoint |\n| `POST \u002Fv1\u002Fimages\u002Fgenerations` | OpenAI Images generation endpoint |\n| `POST \u002Fv1\u002Fimages\u002Fedits` | OpenAI Images edit endpoint |\n| `GET \u002Fv1\u002Fmodels` | List available models |\n| `GET \u002Fhealth` | Health check |\n\nSee [API.md](docs\u002FAPI.md) for full request formats, response formats, and error codes.\n\n### Token Upload and Account Management\n\nThe following admin endpoints require the `X-Admin-Key` header.\n\n#### Add Refresh Token Accounts\n\n```bash\n# Single account\ncurl -X POST http:\u002F\u002Flocalhost:8080\u002Fapi\u002Fadmin\u002Faccounts \\\n  -H \"X-Admin-Key: your-admin-secret\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"name\": \"my-account\", \"refresh_token\": \"rt_xxxxxxxxxxxx\"}'\n\n# Batch import, newline separated, up to 100 tokens per request\ncurl -X POST http:\u002F\u002Flocalhost:8080\u002Fapi\u002Fadmin\u002Faccounts \\\n  -H \"X-Admin-Key: your-admin-secret\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"name\": \"batch\", \"refresh_token\": \"rt_xxx1\\nrt_xxx2\\nrt_xxx3\"}'\n```\n\n#### Add Access Token Accounts\n\n```bash\n# Single AT-only account\ncurl -X POST http:\u002F\u002Flocalhost:8080\u002Fapi\u002Fadmin\u002Faccounts\u002Fat \\\n  -H \"X-Admin-Key: your-admin-secret\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"name\": \"my-at\", \"access_token\": \"eyJhbGciOiJSUzI1NiIs...\"}'\n\n# Batch import, newline separated\ncurl -X POST http:\u002F\u002Flocalhost:8080\u002Fapi\u002Fadmin\u002Faccounts\u002Fat \\\n  -H \"X-Admin-Key: your-admin-secret\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"access_token\": \"eyJtoken1...\\neyJtoken2...\\neyJtoken3...\"}'\n```\n\n#### File Import\n\n```bash\n# Import Refresh Tokens from TXT, one token per line\ncurl -X POST http:\u002F\u002Flocalhost:8080\u002Fapi\u002Fadmin\u002Faccounts\u002Fimport \\\n  -H \"X-Admin-Key: your-admin-secret\" \\\n  -F \"file=@tokens.txt\" \\\n  -F \"format=txt\"\n\n# Import Refresh Tokens from JSON\ncurl -X POST http:\u002F\u002Flocalhost:8080\u002Fapi\u002Fadmin\u002Faccounts\u002Fimport \\\n  -H \"X-Admin-Key: your-admin-secret\" \\\n  -F \"file=@credentials.json\" \\\n  -F \"format=json\"\n\n# Import Access Tokens from TXT, one token per line\ncurl -X POST http:\u002F\u002Flocalhost:8080\u002Fapi\u002Fadmin\u002Faccounts\u002Fimport \\\n  -H \"X-Admin-Key: your-admin-secret\" \\\n  -F \"file=@access_tokens.txt\" \\\n  -F \"format=at_txt\"\n```\n\nImport endpoints deduplicate tokens automatically. Existing tokens are not inserted again.\n\n---\n\n## Admin Dashboard\n\nOpen `\u002Fadmin\u002F` in a browser.\n\n| Page | Path | Description |\n| --- | --- | --- |\n| Dashboard | `\u002Fadmin\u002F` | Overview metrics, request trends, latency trends, token breakdown, model ranking |\n| Accounts | `\u002Fadmin\u002Faccounts` | Import, test, batch actions, scheduler state |\n| API Keys | `\u002Fadmin\u002Fapi-keys` | API key creation, inspection, deletion, and credential management |\n| Proxies | `\u002Fadmin\u002Fproxies` | Proxy pool management, account proxy assignment, connectivity checks |\n| Image Studio | `\u002Fadmin\u002Fimages\u002Fstudio` | Text-to-image, prompt templates, task history, server-side image library |\n| Prompt Filter | `\u002Fadmin\u002Fprompt-filter\u002Foverview` | Rules, hit logs, testing, and handling mode configuration |\n| Usage | `\u002Fadmin\u002Fusage` | Request logs, metric cards, charts, log cleanup |\n| Operations | `\u002Fadmin\u002Fops` | Runtime monitoring and system overview |\n| Scheduler Board | `\u002Fadmin\u002Fops\u002Fscheduler` | Scheduler health, penalties, and score breakdown |\n| Settings | `\u002Fadmin\u002Fsettings` | Runtime parameters and admin secret settings |\n| Usage Guide | `\u002Fadmin\u002Fdocs` | Codex CLI and Claude Code integration examples |\n| API Reference | `\u002Fadmin\u002Fapi-reference` | OpenAI-style endpoints and admin API reference |\n\n---\n\n## Core Capabilities\n\n### Positioning\n\nCodex2API is not just a forwarding proxy. It is a long-running Codex gateway with a full admin dashboard:\n\n- Exposes a unified OpenAI-style API surface.\n- Maintains a Refresh Token account pool and Access Token lifecycle.\n- Coordinates persistence and runtime state through PostgreSQL + Redis or SQLite + in-memory cache.\n- Provides operational observability through the `\u002Fadmin` dashboard.\n\n### Request Flow\n\nPublic request flow:\n\n```text\nClient -> Gin RPM limiter -> proxy.Handler API key check -> auth.Store scheduler -> upstream request -> response + usage logging\n```\n\nAdmin flow:\n\n```text\nBrowser -> embedded \u002Fadmin frontend -> \u002Fapi\u002Fadmin\u002F* -> database \u002F account pool \u002F cache layer\n```\n\n### Scheduler\n\nThe scheduler lives in `auth.Store`. It evaluates availability, health tier, dynamic concurrency, historical errors, and recent usage before selecting an account.\n\nRuntime state:\n\n- `Status`: `ready`, `cooldown`, `error`\n- `HealthTier`: `healthy`, `warm`, `risky`, `banned`\n- `SchedulerScore`: real-time scheduling score based on a baseline of 100\n- `DynamicConcurrencyLimit`: concurrency limit adjusted by health tier\n\nSelection strategy:\n\n1. Filter unavailable accounts, including `error`, `banned`, cooldown accounts, and accounts without an Access Token.\n2. Recompute health tier, scheduler score, and dynamic concurrency.\n3. Exclude accounts that have reached their concurrency limit.\n4. Prefer `healthy > warm > risky > banned`; within the same tier, prefer higher score and lower concurrency.\n5. Apply a 15% random shuffle to reduce hotspots and starvation.\n\nConcurrency rules:\n\n| Tier | Concurrency Limit |\n| --- | --- |\n| `healthy` | System `MaxConcurrency` |\n| `warm` | Base concurrency \u002F 2, at least 1 |\n| `risky` | Fixed at 1 |\n| `banned` | Fixed at 0, not schedulable |\n\nObservability:\n\n- `GET \u002Fapi\u002Fadmin\u002Faccounts` shows health tier, scheduler score, and penalty details.\n- `GET \u002Fapi\u002Fadmin\u002Fops\u002Foverview` shows runtime and connection pool state.\n- `\u002Fadmin\u002Fops\u002Fscheduler` provides the scheduler board.\n\n---\n\n## Project Structure\n\n```text\ncodex2api\u002F\n|- main.go                      # Application entrypoint\n|- Dockerfile                   # Multi-stage image build\n|- docker-compose.yml           # Image deployment template\n|- docker-compose.local.yml     # Local source build template\n|- .env.example                 # Environment variable example\n|- admin\u002F                       # Admin API\n|- auth\u002F                        # Account pool, scheduler, token management\n|- cache\u002F                       # Redis and cache wrappers\n|- config\u002F                      # Environment loading\n|- database\u002F                    # Database access layer\n|- proxy\u002F                       # Public proxy, forwarding, rate limiting\n`- frontend\u002F                    # React + Vite admin dashboard\n   |- src\u002Fpages\u002F                # Dashboard \u002F Accounts \u002F API Keys \u002F Proxies \u002F Images \u002F Prompt Filter \u002F Ops \u002F Usage \u002F Settings \u002F Docs\n   |- src\u002Fcomponents\u002F           # UI components\n   |- src\u002Flocales\u002F              # zh\u002Fen locales\n   `- vite.config.js            # Vite config\n```\n\n---\n\n## Notes\n\n- `docker-compose.yml` pulls the GHCR image for deployment. `docker-compose.local.yml` uses `build: .` for local source builds.\n- The frontend base path is fixed at `\u002Fadmin\u002F` for both local development and production.\n- Before manually building the Go binary, run `npm run build` in `frontend\u002F`.\n- `.env` controls physical runtime settings such as port, database, and Redis. Business settings are stored in the database and managed from the admin dashboard.\n- API keys are stored in the database and configured through the admin dashboard.\n\n---\n\n## Disclaimer and License\n\n- This project is for learning, research, and technical discussion only.\n- This project is released under the `MIT License`.\n- The project provides no warranty for direct or indirect consequences. Production use is at your own risk.\n\n---\n\n## Star History\n\n\u003Cpicture>\n  \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=james-6-23\u002Fcodex2api&type=Date&theme=dark\" \u002F>\n  \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=james-6-23\u002Fcodex2api&type=Date\" \u002F>\n  \u003Cimg alt=\"Star History Chart\" src=\"https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=james-6-23\u002Fcodex2api&type=Date\" \u002F>\n\u003C\u002Fpicture>\n\n---\n\n## Links\n\n- [LINUX DO](https:\u002F\u002Flinux.do\u002F)\n","Codex2API 是一个基于 Go + Gin + React\u002FVite 的 Codex 反向代理与管理后台项目，旨在将 Codex 账号池转化为可观察、可调度且操作就绪的 OpenAI \u002F Anthropic 兼容网关。该项目不仅限于简单的请求转发，还提供了包括账号管理、健康评分、动态并发控制、速率限制恢复、使用追踪等在内的丰富功能，并通过统一的 API 接口对外提供服务。适用于需要集中管理和优化多个 Codex 账号资源的应用场景，如企业级 AI 服务集成或大规模自动化任务处理环境。支持 PostgreSQL + Redis 生产部署和 SQLite + 内存缓存轻量级单节点部署两种模式，易于通过 Docker 快速启动。",2,"2026-06-11 03:50:18","high_star"]