Commit 886168a
fix: set CLAUDE_CODE_API_KEY_HELPER env var for credential isolation (#851)
* Initial plan
* fix: set CLAUDE_CODE_API_KEY_HELPER env var for credential isolation
When api-proxy is enabled with an Anthropic key, set the
CLAUDE_CODE_API_KEY_HELPER environment variable to point to the
get-claude-key.sh script. This ensures Claude Code CLI properly uses
the API key helper for credential isolation.
Previously, only ANTHROPIC_BASE_URL was set, but Claude Code requires
either a config file with apiKeyHelper or the environment variable
to actually use the helper script. Without this, Claude Code would
not read the config and authentication would fail.
This fix:
- Sets CLAUDE_CODE_API_KEY_HELPER=/usr/local/bin/get-claude-key.sh when
api-proxy is enabled with Anthropic key
- Adds comprehensive tests for the new environment variable
- Updates type documentation to reflect the new env var
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
---------
Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>1 parent eefeff9 commit 886168a
3 files changed
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1568 | 1568 | | |
1569 | 1569 | | |
1570 | 1570 | | |
| 1571 | + | |
1571 | 1572 | | |
1572 | 1573 | | |
1573 | 1574 | | |
| |||
1577 | 1578 | | |
1578 | 1579 | | |
1579 | 1580 | | |
| 1581 | + | |
1580 | 1582 | | |
1581 | 1583 | | |
1582 | 1584 | | |
| |||
1586 | 1588 | | |
1587 | 1589 | | |
1588 | 1590 | | |
| 1591 | + | |
1589 | 1592 | | |
1590 | 1593 | | |
1591 | 1594 | | |
| |||
1614 | 1617 | | |
1615 | 1618 | | |
1616 | 1619 | | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
1617 | 1636 | | |
1618 | 1637 | | |
1619 | 1638 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
997 | 997 | | |
998 | 998 | | |
999 | 999 | | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
1000 | 1005 | | |
1001 | 1006 | | |
1002 | 1007 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
| 401 | + | |
401 | 402 | | |
402 | 403 | | |
403 | 404 | | |
| |||
0 commit comments