Skip to content

[BUG] CLAUDE_CODE_API_KEY_HELPER_TTL_MS not working from settings.json #7660

Closed as not planned

Description

@shearic

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When running claude in Node v24.6.0, setting CLAUDE_CODE_API_KEY_HELPER_TTL_MS in settings.json to any value does not work, it continues to behave with the default of 5 minutes. When running claude in Node v20.10.0 it works as expected.

eg:

{
    "env": {
        "CLAUDE_CODE_API_KEY_HELPER_TTL_MS": "900000",
        "ANTHROPIC_BASE_URL": "https://localhost:9876/anthropic-proxy"
    },
    "apiKeyHelper": "get-token"
}

Setting this value from the calling environment does work however:

$ CLAUDE_CODE_API_KEY_HELPER_TTL_MS=900000 claude

This will behave with the expected timeout of 15 minutes.

This problem may be a regression in the last few versions - I can't guarantee but I think 1.0.105 did not have this problem, but by 1.0.112 this problem existed and does in current 1.0.113.

What Should Happen?

The value of CLAUDE_CODE_API_KEY_HELPER_TTL_MS in settings.json should work so it is not required to be inherited from the calling environment.

Error Messages/Logs

Steps to Reproduce

  1. Run claude against an endpoint with a token to be used via apiKeyHelper
  2. Set up settings.json with "CLAUDE_CODE_API_KEY_HELPER_TTL_MS": "900000"
  3. See that claude calls the helper at >= 5 minutes from last fetch instead of >= 15 minutes

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

1.0.113
Node v24.6.0

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

Activity

  1. github-actions commented on Sep 15, 2025

    @github-actions

    Found 1 possible duplicate issue:

    1. [BUG] Monitoring not working since v1.0.111 #7639

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. shearic commented on Sep 15, 2025

    @shearic
    Author

    I've discovered that the errant behavior is happening in my node v24.6.0 environment but claude does not exhibit this problem running in my node v20.10.0 environment.

  3. github-actions commented on Dec 5, 2025

    @github-actions

    This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

  4. vladhietala commented on Dec 30, 2025

    @vladhietala

    This issue is still occurring and affects Windows as well (not just macOS/Bedrock).

    Confirming the problem on Windows (v2.0.37):

    • ✅ CLAUDE_CODE_API_KEY_HELPER_TTL_MS is being read from settings.json and passed to the script correctly
    • ❌ Cache mechanism still doesn't work - apiKeyHelper is called every ~5 minutes regardless of TTL setting
    • Same session, no terminal restarts, yet helper invoked repeatedly

    Evidence:

    14:52:10 | CacheTTL: 3600000
    14:53:37 | CacheTTL: 3600000 (1min 27s later)
    14:58:37 | CacheTTL: 3600000 (5min later)
    15:04:02 | CacheTTL: 3600000 (5min 25s later)
    

    Workaround that proves Claude Code cache is broken:

    Implementing manual caching within the apiKeyHelper script using Windows DPAPI encryption successfully caches for the configured TTL. This confirms the issue is with Claude Code's cache implementation.

    This is a core authentication feature that has been broken for 3+ months across multiple platforms. Please prioritize a fix - users with interactive auth methods (1Password, AWS SSO, hardware keys) are severely impacted."

  5. github-actions commented on Jan 31, 2026

    @github-actions

    This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

  6. marcindulak commented on Jan 31, 2026

    @marcindulak

    This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at #16497. Please upvote that issue, so maybe it gets noticed.

  7. github-actions commented on Feb 7, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  8. locked as resolved and limited conversation to collaborators on Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api:bedrockIssue relates to AWS Bedrockarea:authbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions