{"id":48437501,"url":"https://github.com/bnema/openai-accounts-cli","last_synced_at":"2026-04-25T05:05:58.738Z","repository":{"id":338450156,"uuid":"1157735906","full_name":"bnema/openai-accounts-cli","owner":"bnema","description":"OpenAI Accounts CLI (oa): fetch and list usage limits across multiple accounts.","archived":false,"fork":false,"pushed_at":"2026-04-05T18:34:30.000Z","size":8871,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-05T20:28:23.508Z","etag":null,"topics":["account-management","accounts","cli","cobra","golang","openai","opencode","rotate","usage-tracking"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bnema.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-02-14T07:58:34.000Z","updated_at":"2026-04-05T18:34:34.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bnema/openai-accounts-cli","commit_stats":null,"previous_names":["bnema/openai-accounts-cli"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/bnema/openai-accounts-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnema%2Fopenai-accounts-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnema%2Fopenai-accounts-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnema%2Fopenai-accounts-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnema%2Fopenai-accounts-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bnema","download_url":"https://codeload.github.com/bnema/openai-accounts-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnema%2Fopenai-accounts-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31475202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T08:36:52.050Z","status":"ssl_error","status_checked_at":"2026-04-06T08:36:51.267Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["account-management","accounts","cli","cobra","golang","openai","opencode","rotate","usage-tracking"],"created_at":"2026-04-06T14:01:05.563Z","updated_at":"2026-04-25T05:05:58.733Z","avatar_url":"https://github.com/bnema.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# openai-accounts-cli (oa)\n\n**oa** manages OpenAI account auth, usage, and local tool sync from one CLI.\n\nUse it to keep multiple OpenAI accounts in one place, inspect their ChatGPT limits, choose a usable account, and sync ChatGPT OAuth credentials into OpenCode, Codex, and Pi.\n\n## What it does\n\n- Stores account metadata and secret references in `~/.codex/accounts.toml`\n- Stores secrets via `pass`, with file fallback at `~/.codex/secrets`\n- Supports API key and ChatGPT OAuth auth\n- Fetches 5-hour and weekly ChatGPT usage limits from OpenAI\n- Recommends accounts by usage pressure before subscription end, weekly reset, and 5-hour reset\n- Shows subscription renewal countdowns\n- Syncs ChatGPT OAuth credentials into OpenCode, Codex, and Pi\n- Groups local tool commands under stable top-level verbs: `install`, `handle`, and `sync`\n\n## Install\n\n```bash\ngo install github.com/bnema/openai-accounts-cli/cmd/oa@latest\n# or from a clone\nmake install\n```\n\n## Commands\n\n```text\noa\n|- account                         Manage accounts\n|  |- list                         List configured accounts\n|  `- remove \u003cid\u003e                  Remove an account and its credentials\n|- auth                            Manage account authentication\n|  |- check [--account \u003cid\u003e]       Verify authentication for one or all ChatGPT accounts\n|  |- login                        Start account login flows\n|  |  |- browser [--account \u003cid\u003e]  Start browser login flow\n|  |  `- device [--account \u003cid\u003e]   Start device login flow (not implemented)\n|  |- remove --account \u003cid\u003e        Remove account authentication\n|  `- set [--account \u003cid\u003e]         Set account authentication (`--method`, `--secret-key`, `--secret-value`)\n|- handle                          Handle local tool integration callbacks\n|  `- opencode --json              Handle OpenCode requests via JSON stdin/stdout\n|- install                         Install local tool integrations\n|  |- opencode                     Install OpenCode integration\n|  `- pi                           Install Pi auth hot-reload extension\n|- opencode                        Manage OpenCode integration\n|  |- doctor                       Check OpenCode integration\n|  `- install-systemd              Install a systemd user timer for OpenCode sync\n|- sync [--all] [--evenly]         Sync ChatGPT OAuth auth into local tools\n|  |- codex                        Sync Codex auth\n|  |- opencode                     Sync OpenCode auth\n|  `- pi                           Sync Pi auth (alias: `pi-mono`)\n|- usage [--account \u003cid\u003e] [--json] Fetch and display account usage limits (alias: `status`)\n`- version                         Print version information\n```\n\n## Command migration\n\nSince v1.9, tool integration commands use stable top-level verbs. If you used the old OpenCode-only commands, switch to these forms:\n\n| Old command | Current command |\n|-------------|-----------------|\n| `oa opencode install` | `oa install opencode` |\n| `oa opencode handle --json` | `oa handle opencode --json` |\n| `oa opencode sync` | `oa sync opencode` |\n\n`oa opencode sync` still exists as a hidden deprecated alias. Use `oa sync opencode` in scripts.\n\n## Tool integrations\n\n### OpenCode\n\nInstall the OpenCode plugin:\n\n```bash\noa install opencode\n```\n\nThe plugin adds an `oa-sync` tool that runs `oa sync opencode` from OpenCode.\n\nHandle OpenCode recovery requests from JSON stdin/stdout:\n\n```bash\noa handle opencode --json\n```\n\nSync the best eligible ChatGPT OAuth account into OpenCode:\n\n```bash\noa sync opencode\n```\n\nOptional systemd timer:\n\n```bash\noa opencode install-systemd\n```\n\n### Codex and Pi\n\nSync the best eligible ChatGPT OAuth account into Codex, Pi, or every supported target:\n\n```bash\noa sync codex\noa sync pi\noa sync --all\n```\n\nInstall the Pi extension once to let active Pi sessions pick up `oa sync pi` changes without restarting:\n\n```bash\noa install pi\n# then run /reload in already-open Pi sessions\n```\n\nThe installed extension watches `~/.pi/agent/auth.json`, reloads Pi auth in memory before the next provider call, and tries `oa sync pi --evenly` after OpenAI Codex HTTP 401/429 responses.\n\n## Account selection\n\nSelection prefers the account whose remaining weekly capacity is most at risk of being wasted:\n\n1. before the subscription period ends;\n2. before the current weekly window resets;\n3. before the 5-hour window resets.\n\nAdd `--evenly` to rotate among comparable top candidates using recent selection history. It only rebalances accounts with similar pressure, so a low-risk account will not jump ahead of an account that needs usage now:\n\n```bash\noa sync --all --evenly\n```\n\n## Configuration\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `OA_AUTH_ISSUER` | `https://auth.openai.com` | Auth issuer endpoint |\n| `OA_AUTH_CLIENT_ID` | Embedded in source | OAuth client ID |\n| `OA_AUTH_LISTEN` | `127.0.0.1:1455` | Local callback listener |\n| `OA_USAGE_BASE_URL` | `https://chatgpt.com/backend-api` | Usage API base URL |\n\n## Development\n\n```bash\ngo test ./...\nmake build\nmake install\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnema%2Fopenai-accounts-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbnema%2Fopenai-accounts-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnema%2Fopenai-accounts-cli/lists"}