ai-cc-router 0.1.2 → 0.1.3

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.
@@ -11,7 +11,7 @@ const CLAUDE_CODE_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
11
11
  * Primary OAuth token endpoint.
12
12
  * Alternative: https://claude.ai/v1/oauth/token
13
13
  */
14
- const TOKEN_ENDPOINT = "https://console.anthropic.com/api/oauth/token";
14
+ const TOKEN_ENDPOINT = "https://claude.ai/v1/oauth/token";
15
15
  /** Refresh 10 minutes before expiry */
16
16
  const REFRESH_BUFFER_MS = 10 * 60 * 1000;
17
17
  /** Check every 5 minutes */
@@ -37,14 +37,15 @@ export async function refreshAccountToken(account) {
37
37
  }
38
38
  async function _doRefresh(account) {
39
39
  try {
40
+ const body = new URLSearchParams({
41
+ grant_type: "refresh_token",
42
+ refresh_token: account.tokens.refreshToken,
43
+ client_id: CLAUDE_CODE_CLIENT_ID,
44
+ });
40
45
  const res = await fetch(TOKEN_ENDPOINT, {
41
46
  method: "POST",
42
- headers: { "Content-Type": "application/json" },
43
- body: JSON.stringify({
44
- grant_type: "refresh_token",
45
- refresh_token: account.tokens.refreshToken,
46
- client_id: CLAUDE_CODE_CLIENT_ID,
47
- }),
47
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
48
+ body: body.toString(),
48
49
  });
49
50
  if (!res.ok) {
50
51
  const body = await res.text();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-cc-router",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Round-robin proxy for Claude Max OAuth tokens — use multiple Claude Max accounts with Claude Code",
5
5
  "type": "module",
6
6
  "bin": {