docs: add CLI method for retrieving session token (#21875)

Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>
Co-authored-by: Atif Ali <atif@coder.com>
This commit is contained in:
blinkagent[bot]
2026-02-03 17:02:32 +05:00
committed by GitHub
co-authored by blink-so[bot] Atif Ali
parent 24b20df7d5
commit 72e89d3901
+5 -2
View File
@@ -28,13 +28,16 @@ Again, the exact environment variable or setting naming may differ from tool to
### Retrieving your session token
[Generate a long-lived API token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself) via the Coder dashboard and use it to configure your AI coding tool:
If you're logged in with the Coder CLI, you can retrieve your current session
token using [`coder login token`](../../../reference/cli/login_token.md):
```sh
export ANTHROPIC_API_KEY="your-coder-session-token"
export ANTHROPIC_API_KEY=$(coder login token)
export ANTHROPIC_BASE_URL="https://coder.example.com/api/v2/aibridge/anthropic"
```
Alternatively, [generate a long-lived API token](../../../admin/users/sessions-tokens.md#generate-a-long-lived-api-token-on-behalf-of-yourself) via the Coder dashboard.
## Compatibility
The table below shows tested AI clients and their compatibility with AI Bridge.