Skip to content

Commit 7a2c843

Browse files
committed
fix: clear cached region when api_key changes via config set
Previously, switching API key with `mmx config set --key api_key` kept the old cached region, causing requests to hit the wrong endpoint. Now setting api_key deletes the cached region so it gets auto-detected on the next command. Bump version to 1.0.10.
1 parent 2f7909c commit 7a2c843

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mmx-cli",
3-
"version": "1.0.9",
3+
"version": "1.0.10",
44
"description": "CLI for the MiniMax AI Platform",
55
"type": "module",
66
"engines": {

src/commands/config/set.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ export default defineCommand({
8585

8686
const existing = readConfigFile() as Record<string, unknown>;
8787
existing[resolvedKey] = resolvedKey === 'timeout' ? Number(value) : value;
88+
89+
// When API key changes, clear cached region so it gets re-detected
90+
if (resolvedKey === 'api_key') {
91+
delete existing.region;
92+
}
93+
8894
await writeConfigFile(existing);
8995

9096
if (!config.quiet) {

0 commit comments

Comments
 (0)