{"id":46577882,"url":"https://github.com/kelaocai/anthro-env","last_synced_at":"2026-04-11T13:01:33.797Z","repository":{"id":342755189,"uuid":"1175052752","full_name":"kelaocai/anthro-env","owner":"kelaocai","description":"A macOS-first CLI for managing Anthropic/Claude Code environment profiles with one-command switching, Keychain-backed token storage, and zero-friction setup.","archived":false,"fork":false,"pushed_at":"2026-03-19T04:18:31.000Z","size":115,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-19T20:57:20.348Z","etag":null,"topics":["ai-tools","anthropic","anthropic-claude","claude-code","cli","developer-tools","kimi","llm","macos","minimax","shell-tools"],"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/kelaocai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-07T06:48:18.000Z","updated_at":"2026-03-19T04:18:29.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kelaocai/anthro-env","commit_stats":null,"previous_names":["kelaocai/anthro-env"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/kelaocai/anthro-env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelaocai%2Fanthro-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelaocai%2Fanthro-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelaocai%2Fanthro-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelaocai%2Fanthro-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kelaocai","download_url":"https://codeload.github.com/kelaocai/anthro-env/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelaocai%2Fanthro-env/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31681201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T08:18:19.405Z","status":"ssl_error","status_checked_at":"2026-04-11T08:17:08.892Z","response_time":54,"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":["ai-tools","anthropic","anthropic-claude","claude-code","cli","developer-tools","kimi","llm","macos","minimax","shell-tools"],"created_at":"2026-03-07T10:10:58.634Z","updated_at":"2026-04-11T13:01:33.778Z","avatar_url":"https://github.com/kelaocai.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# anthro-env\n\nEnglish | [中文](README.zh.md)\n\n[![Release](https://img.shields.io/github/v/release/kelaocai/anthro-env)](https://github.com/kelaocai/anthro-env/releases)\n[![Homebrew Tap](https://img.shields.io/badge/Homebrew-kelaocai%2Fhomebrew--tap-blue)](https://github.com/kelaocai/homebrew-tap)\n![Homebrew](https://img.shields.io/badge/homebrew-install-blue)\n\nA CLI-first macOS tool for switching Claude Code / Anthropic environment profiles.\nA CLI tool for managing Claude-compatible API environments and switching between AI providers.\nCompatible with Claude-compatible APIs.\n\n## Why this exists\n\nClaude Code is a great CLI coding assistant.\n\nBut in practice many developers need to switch between:\n\n- Anthropic API\n- proxy gateways\n- third-party providers\n- multiple API keys\n\nThis usually means repeatedly editing environment variables like:\n\n- `ANTHROPIC_BASE_URL`\n- `ANTHROPIC_API_KEY`\n- `ANTHROPIC_AUTH_TOKEN`\n\nManual shell edits quickly become messy.\n\n`anthro-env` provides a simple profile-based workflow for managing these environments.\n\n\n\u003cimg width=\"1536\" height=\"1024\" alt=\"banner (1)\" src=\"https://github.com/user-attachments/assets/8cbdc798-96ac-4a27-95a2-13667d942bcf\" /\u003e\n\n### screenshots\n\n\u003cimg width=\"676\" height=\"261\" alt=\"SCR-20260411-rcxo\" src=\"https://github.com/user-attachments/assets/3ddda67a-bde5-4218-8cbe-9b099eb7395c\" /\u003e\n\n\n## Install\n\n### Homebrew (recommended)\n\n```bash\nbrew tap kelaocai/homebrew-tap\nbrew install anthro-env\n```\n\nNo local Go toolchain is required for Homebrew users.\n\n### Build from source (optional)\n\n```bash\ngit clone https://github.com/kelaocai/anthro-env.git\ncd anthro-env\ngo test ./...\ngo build -o ./bin/anthro-env ./cmd/anthro-env\n./bin/anthro-env --help\n```\n\n## Profile Directory (How loading works)\n\n`anthro-env` loads profiles from:\n\n```text\n~/.config/anthropic/profiles/*.env\n```\n\nHow it works:\n- any `*.env` file in this directory is treated as a profile\n- file name (without `.env`) is the profile name\n- profiles are auto-discovered by `anthro-env ls` / `menu` / `use`\n\nExample:\n- `~/.config/anthropic/profiles/ai-router.env` -\u003e profile name: `ai-router`\n\n## Important Notes\n\n### SSH Environment Limitation\n\n`anthro-env` uses macOS Keychain to store sensitive API tokens. Since Keychain requires user interaction for authorization, **initialization operations (`init`, `add`, `edit`) must be run in a local terminal, not in SSH sessions**.\n\nIf you run these commands in an SSH session, you'll get an error:\n```\nError: save token to Keychain failed: exit status 36\n(security: SecKeychainItemCreateFromContent (\u003cdefault\u003e): User interaction is not allowed.)\n```\n\n**Solution:**\n1. Run `anthro-env init` or `anthro-env add` in your local Mac terminal (not via SSH) to complete initialization\n2. After initialization, you can use `anthro-env use`, `anthro-env menu`, and other commands in SSH sessions to switch environments\n\n## Quick Start\n\n```bash\nanthro-env add kimi\nanthro-env use kimi\nanthro-env current\n```\n\nOr use the menu:\n\n```bash\nanthro-env menu\n```\n\nIf you already have plaintext `ANTHROPIC_AUTH_TOKEN` or `ANTHROPIC_API_KEY` in old profile files:\n\n```bash\nanthro-env migrate-tokens\n```\n\n### Common commands\n\nThese are the most commonly used subcommands:\n\n```bash\nanthro-env init            # Initialize anthro-env (first-time setup)\nanthro-env menu            # Open the interactive menu\nanthro-env add \u003cname\u003e      # Add a new environment; \u003cname\u003e is the env name\nanthro-env edit \u003cname\u003e     # Edit an existing environment; \u003cname\u003e is the env name\nanthro-env use \u003cname\u003e      # Switch to and activate an environment; \u003cname\u003e is the env name\nanthro-env ls              # List all saved environments\nanthro-env current         # Show the currently active environment\nanthro-env rm \u003cname\u003e       # Remove an environment; \u003cname\u003e is the env name\nanthro-env hook \u003czsh|bash\u003e # Print shell integration snippet (also installed by init)\nanthro-env env             # Print eval-able exports for the active profile (alias: export)\nanthro-env doctor          # Run diagnostics (check config/dependencies)\nanthro-env -v              # Show version\n```\n\n### Detailed usage: `edit`\n\n```bash\nanthro-env edit \u003cname\u003e\n```\n\nDuring edit:\n- `ANTHROPIC_BASE_URL`: press Enter to keep current value\n- `ANTHROPIC_MODEL`: press Enter to keep, input `-` to clear (use gateway default)\n- `API credential`: press Enter to keep Keychain value, input `-` to delete token from Keychain, input new value to overwrite\n- `MiniMax` profiles are exported as `ANTHROPIC_API_KEY`; other providers default to `ANTHROPIC_AUTH_TOKEN`\n\nExample:\n\n```bash\nanthro-env edit ai-router\nanthro-env use ai-router\nanthro-env doctor\n```\n\n### Detailed usage: `migrate-tokens`\n\n```bash\nanthro-env migrate-tokens\n```\n\nWhat it does:\n- reads plaintext `ANTHROPIC_AUTH_TOKEN` or `ANTHROPIC_API_KEY` from profile files\n- writes token into macOS Keychain for each profile\n- removes plaintext token from profile files\n- prints migration summary (`migrated` / `skipped`)\n\nRecommended verification:\n\n```bash\nanthro-env doctor\n```\n\n## Profile Examples (redacted)\n\nThese examples are based on real-world provider setups, with API keys masked.\nKeep in mind: in `anthro-env`, token is recommended to be stored in Keychain.\n\n### Example 1: bailian-kimi-k2.5\n\n```bash\nANTHROPIC_AUTH_TOKEN=sk-********\nANTHROPIC_BASE_URL=https://coding.dashscope.aliyuncs.com/apps/anthropic\nCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1\nANTHROPIC_MODEL=kimi-k2.5\nANTHROPIC_SMALL_FAST_MODEL=kimi-k2.5\nANTHROPIC_DEFAULT_SONNET_MODEL=kimi-k2.5\nANTHROPIC_DEFAULT_OPUS_MODEL=kimi-k2.5\nANTHROPIC_DEFAULT_HAIKU_MODEL=kimi-k2.5\n```\n\n### Example 2: MiniMax-M2.7\n\n```bash\nANTHROPIC_API_KEY=sk-********\nANTHROPIC_BASE_URL=https://api.minimaxi.com/anthropic\nCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1\nANTHROPIC_MODEL=MiniMax-M2.7\nANTHROPIC_SMALL_FAST_MODEL=MiniMax-M2.7\nANTHROPIC_DEFAULT_SONNET_MODEL=MiniMax-M2.7\nANTHROPIC_DEFAULT_OPUS_MODEL=MiniMax-M2.7\nANTHROPIC_DEFAULT_HAIKU_MODEL=MiniMax-M2.7\n```\n\nMiniMax's Anthropic-compatible endpoint currently expects `ANTHROPIC_API_KEY` and the `api.minimaxi.com` base URL.\n\n### Example 3: ai-router (gateway default model routing)\n\n```bash\nANTHROPIC_AUTH_TOKEN=sk-********\nANTHROPIC_BASE_URL=https://ai-router.plugins-world.cn\nCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1\n# No ANTHROPIC_MODEL set here on purpose.\n# Model selection is handled by gateway-side default routing rules.\n```\n\n## Concepts\n\n- `profile`: a named environment config (base URL, model config, etc.)\n- `use`: switch active profile\n- `current`: show active profile\n- `doctor`: quick health check\n- `migrate-tokens`: move plaintext tokens from profile files into Keychain\n\nWhat makes this project different:\n\n- Keychain-backed token handling\n- CLI-first workflow\n- Homebrew distribution\n- low-friction setup for macOS users\n\n## Storage Layout\n\n- Profiles: `~/.config/anthropic/profiles/*.env`\n- Active profile pointer: `~/.config/anthropic/current`\n- Token storage: macOS Keychain (`service=anthro-env`)\n\nProfiles are auto-discovered from `~/.config/anthropic/profiles/*.env`.\nIf you manually add a new `xxx.env` file in that directory, it will be available in:\n- `anthro-env ls`\n- `anthro-env menu`\n- `anthro-env use xxx`\n\nIf that file contains plaintext `ANTHROPIC_AUTH_TOKEN` or `ANTHROPIC_API_KEY`, run:\n\n```bash\nanthro-env migrate-tokens\n```\n\n## Security\n\n- Tokens are stored in macOS Keychain.\n- Profile files store metadata/config only.\n- API keys are not intended to be stored in plain text profile files.\n- Token precedence rule: `Keychain \u003e .env`.\n  If both exist, the Keychain token is used.\n\n## Who It Is For\n\n- Developers switching between multiple Claude Code / Anthropic-compatible providers\n- Teams that want predictable profile switching on macOS\n- Users who want Homebrew install and fast onboarding\n\n## Roadmap\n\n- Linux keyring support\n- Windows credential manager support\n- Profile export/import\n- Team shared profile workflows\n\n## Contributing\n\nIssues and PRs are welcome.\nRelease mechanism details: [docs/release.md](docs/release.md)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelaocai%2Fanthro-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkelaocai%2Fanthro-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelaocai%2Fanthro-env/lists"}