agentkeyswitch 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentkeyswitch-0.1.0/.gitignore +6 -0
- agentkeyswitch-0.1.0/PKG-INFO +161 -0
- agentkeyswitch-0.1.0/README.md +141 -0
- agentkeyswitch-0.1.0/pyproject.toml +35 -0
- agentkeyswitch-0.1.0/src/agentkeyswitch/__init__.py +3 -0
- agentkeyswitch-0.1.0/src/agentkeyswitch/cli.py +499 -0
- agentkeyswitch-0.1.0/src/agentkeyswitch/core.py +771 -0
- agentkeyswitch-0.1.0/tests/test_cli.py +270 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentkeyswitch
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Linux CLI for switching Claude and Codex API profiles.
|
|
5
|
+
Author: zombie
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: api,claude,cli,codex,linux,profile
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Utilities
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Requires-Dist: tomlkit>=0.13.2
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# agentkeyswitch
|
|
22
|
+
|
|
23
|
+
`agentkeyswitch` is a Linux-first CLI for switching API profiles used by local AI agents such as Claude Code and Codex.
|
|
24
|
+
|
|
25
|
+
It keeps your reusable profiles in one local store and applies them to the real config files only when you run a switch command.
|
|
26
|
+
|
|
27
|
+
## Current scope
|
|
28
|
+
|
|
29
|
+
- Linux only
|
|
30
|
+
- Supported agents:
|
|
31
|
+
- `claude`
|
|
32
|
+
- `codex`
|
|
33
|
+
- Supported commands:
|
|
34
|
+
- `agswitch list`
|
|
35
|
+
- `agswitch status`
|
|
36
|
+
- `agswitch add <profile>`
|
|
37
|
+
- `agswitch import <profile>`
|
|
38
|
+
- `agswitch import-existing`
|
|
39
|
+
- `agswitch use <agent> <profile>`
|
|
40
|
+
- `agswitch remove <profile>`
|
|
41
|
+
- `agswitch help [command]`
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install agentkeyswitch
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For local development:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install -e .
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Profile store
|
|
56
|
+
|
|
57
|
+
Profiles are stored at:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
~/.config/agentkeyswitch/profiles.json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
You can override the runtime locations with environment variables:
|
|
64
|
+
|
|
65
|
+
- `AGSWITCH_HOME`
|
|
66
|
+
- `AGSWITCH_STORE`
|
|
67
|
+
- `XDG_CONFIG_HOME`
|
|
68
|
+
|
|
69
|
+
This is mainly useful for testing or migration.
|
|
70
|
+
|
|
71
|
+
## Examples
|
|
72
|
+
|
|
73
|
+
Add a profile interactively:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
agswitch add max
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Add a profile non-interactively:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
agswitch add taiji \
|
|
83
|
+
--agent all \
|
|
84
|
+
--claude-token 'xxx' \
|
|
85
|
+
--claude-base-url 'https://taijiai.online/v1' \
|
|
86
|
+
--claude-model 'opus' \
|
|
87
|
+
--codex-key 'xxx' \
|
|
88
|
+
--codex-base-url 'https://taijiai.online/v1' \
|
|
89
|
+
--codex-provider 'taiji'
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Import the current live configs into a reusable profile:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
agswitch import max --agent all
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Batch import your existing named files:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
agswitch import-existing
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Also include the current live config as `current`:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
agswitch import-existing --include-current
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Switch Claude only:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
agswitch use claude max
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Switch both Claude and Codex:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
agswitch use all taiji
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Check current live status:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
agswitch status
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Show detailed help:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
agswitch help
|
|
132
|
+
agswitch help use
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## What gets changed
|
|
136
|
+
|
|
137
|
+
`claude`
|
|
138
|
+
|
|
139
|
+
- `~/.claude/settings.json`
|
|
140
|
+
|
|
141
|
+
`codex`
|
|
142
|
+
|
|
143
|
+
- `~/.codex/auth.json`
|
|
144
|
+
- `~/.codex/config.toml`
|
|
145
|
+
|
|
146
|
+
Named files discovered by `import-existing`
|
|
147
|
+
|
|
148
|
+
- `~/.claude/settings - *.json`
|
|
149
|
+
- `~/.codex/auth - *.json`
|
|
150
|
+
|
|
151
|
+
The tool updates only the necessary fields and keeps unrelated settings intact. Before writing, it creates timestamped backups under:
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
~/.config/agentkeyswitch/backups/
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Notes
|
|
158
|
+
|
|
159
|
+
- Secrets are not bundled with the package.
|
|
160
|
+
- The package is designed so you can publish the code without publishing your tokens.
|
|
161
|
+
- For Codex, the tool updates both `auth.json` and `config.toml` so provider selection remains consistent.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# agentkeyswitch
|
|
2
|
+
|
|
3
|
+
`agentkeyswitch` is a Linux-first CLI for switching API profiles used by local AI agents such as Claude Code and Codex.
|
|
4
|
+
|
|
5
|
+
It keeps your reusable profiles in one local store and applies them to the real config files only when you run a switch command.
|
|
6
|
+
|
|
7
|
+
## Current scope
|
|
8
|
+
|
|
9
|
+
- Linux only
|
|
10
|
+
- Supported agents:
|
|
11
|
+
- `claude`
|
|
12
|
+
- `codex`
|
|
13
|
+
- Supported commands:
|
|
14
|
+
- `agswitch list`
|
|
15
|
+
- `agswitch status`
|
|
16
|
+
- `agswitch add <profile>`
|
|
17
|
+
- `agswitch import <profile>`
|
|
18
|
+
- `agswitch import-existing`
|
|
19
|
+
- `agswitch use <agent> <profile>`
|
|
20
|
+
- `agswitch remove <profile>`
|
|
21
|
+
- `agswitch help [command]`
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install agentkeyswitch
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
For local development:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install -e .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Profile store
|
|
36
|
+
|
|
37
|
+
Profiles are stored at:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
~/.config/agentkeyswitch/profiles.json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
You can override the runtime locations with environment variables:
|
|
44
|
+
|
|
45
|
+
- `AGSWITCH_HOME`
|
|
46
|
+
- `AGSWITCH_STORE`
|
|
47
|
+
- `XDG_CONFIG_HOME`
|
|
48
|
+
|
|
49
|
+
This is mainly useful for testing or migration.
|
|
50
|
+
|
|
51
|
+
## Examples
|
|
52
|
+
|
|
53
|
+
Add a profile interactively:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
agswitch add max
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Add a profile non-interactively:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
agswitch add taiji \
|
|
63
|
+
--agent all \
|
|
64
|
+
--claude-token 'xxx' \
|
|
65
|
+
--claude-base-url 'https://taijiai.online/v1' \
|
|
66
|
+
--claude-model 'opus' \
|
|
67
|
+
--codex-key 'xxx' \
|
|
68
|
+
--codex-base-url 'https://taijiai.online/v1' \
|
|
69
|
+
--codex-provider 'taiji'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Import the current live configs into a reusable profile:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
agswitch import max --agent all
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Batch import your existing named files:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
agswitch import-existing
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Also include the current live config as `current`:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
agswitch import-existing --include-current
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Switch Claude only:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
agswitch use claude max
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Switch both Claude and Codex:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
agswitch use all taiji
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Check current live status:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
agswitch status
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Show detailed help:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
agswitch help
|
|
112
|
+
agswitch help use
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## What gets changed
|
|
116
|
+
|
|
117
|
+
`claude`
|
|
118
|
+
|
|
119
|
+
- `~/.claude/settings.json`
|
|
120
|
+
|
|
121
|
+
`codex`
|
|
122
|
+
|
|
123
|
+
- `~/.codex/auth.json`
|
|
124
|
+
- `~/.codex/config.toml`
|
|
125
|
+
|
|
126
|
+
Named files discovered by `import-existing`
|
|
127
|
+
|
|
128
|
+
- `~/.claude/settings - *.json`
|
|
129
|
+
- `~/.codex/auth - *.json`
|
|
130
|
+
|
|
131
|
+
The tool updates only the necessary fields and keeps unrelated settings intact. Before writing, it creates timestamped backups under:
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
~/.config/agentkeyswitch/backups/
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Notes
|
|
138
|
+
|
|
139
|
+
- Secrets are not bundled with the package.
|
|
140
|
+
- The package is designed so you can publish the code without publishing your tokens.
|
|
141
|
+
- For Codex, the tool updates both `auth.json` and `config.toml` so provider selection remains consistent.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.26.0"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "agentkeyswitch"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Linux CLI for switching Claude and Codex API profiles."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "zombie" }
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"tomlkit>=0.13.2",
|
|
17
|
+
]
|
|
18
|
+
keywords = ["claude", "codex", "cli", "api", "profile", "linux"]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Environment :: Console",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Operating System :: POSIX :: Linux",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Topic :: Utilities",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
agswitch = "agentkeyswitch.cli:main"
|
|
33
|
+
|
|
34
|
+
[tool.hatch.build.targets.wheel]
|
|
35
|
+
packages = ["src/agentkeyswitch"]
|