Skip to content

Use Claude Code with your ChatGPT, Kimi, Cursor or Grok subscription via a local Anthropic-compatible proxy

Rust

windows: keep state fallback local

Raine Virtaeb111b984529
diff --git a/README.md b/README.md
index 904e298..1a2cec3 100644
--- a/README.md
+++ b/README.md
@@ -508,8 +508,8 @@ affecting other keys.
- `proxy.log` — JSON-lines log, rotated at 20 MiB. It lives at
`$XDG_STATE_HOME/claude-code-proxy/proxy.log` on macOS/Linux and at
`%LOCALAPPDATA%\claude-code-proxy\proxy.log` on Windows (falling back to
- `%APPDATA%`). Secrets (`authorization`, `access`, `refresh`, `id_token`,
- `ChatGPT-Account-Id`, …) are redacted before write.
+ `%USERPROFILE%\AppData\Local`). Secrets (`authorization`, `access`,
+ `refresh`, `id_token`, `ChatGPT-Account-Id`, …) are redacted before write.
- `config.json` — optional configuration file (see table above). It lives at
`~/.config/claude-code-proxy/config.json` on macOS,
`${XDG_CONFIG_HOME:-$HOME/.config}/claude-code-proxy/config.json` on Linux,
diff --git a/src/paths.test.ts b/src/paths.test.ts
index 4088bd4..682b90f 100644
--- a/src/paths.test.ts
+++ b/src/paths.test.ts
@@ -73,14 +73,14 @@ describe("resolveStateDir", () => {
).toBe("C:\\Users\\u\\AppData\\Local\\claude-code-proxy")
})
- it("falls back to APPDATA on windows without LOCALAPPDATA", () => {
+ it("falls back to $HOME/AppData/Local on windows without LOCALAPPDATA", () => {
expect(
resolveStateDir({
platform: "win32",
env: { APPDATA: "C:\\Users\\u\\AppData\\Roaming" },
home: "C:\\Users\\u",
}),
- ).toBe("C:\\Users\\u\\AppData\\Roaming\\claude-code-proxy")
+ ).toBe("C:\\Users\\u\\AppData\\Local\\claude-code-proxy")
})
})
diff --git a/src/paths.ts b/src/paths.ts
index 78cf833..5d346d0 100644
--- a/src/paths.ts
+++ b/src/paths.ts
@@ -20,7 +20,7 @@ function windowsRoamingAppData(deps: DirResolverEnv): string {
}
function windowsLocalAppData(deps: DirResolverEnv): string {
- return deps.env.LOCALAPPDATA || windowsRoamingAppData(deps)
+ return deps.env.LOCALAPPDATA || win32.join(deps.home, "AppData", "Local")
}
// macOS deliberately uses ~/.config/<app> rather than honoring XDG_CONFIG_HOME