{% extends "base.html" %} {% block title %}{% if is_new %}Key Created{% else %}Token Rotated{% endif %} — Tourniquet{% endblock %} {% block content %} {% set proxy_url = request.url.scheme ~ "://" ~ request.url.netloc %} {% set ds = default_shell | default("bash") %}
⚠️ This token is shown once only. Copy it now — it cannot be recovered.
{{ token }}
🔒 Only the bcrypt hash of this token is stored in the local SQLite DB. Even Tourniquet can't recover the plaintext — that's why we show it once.
Each block below already has your token + the Tourniquet URL filled in. Click Copy, paste, and you're routing through Tourniquet.
export ANTHROPIC_BASE_URL={{ proxy_url }}
export ANTHROPIC_API_KEY={{ token }}
Add these two lines to ~/.zshrc or ~/.bashrc to make them persist, or paste before launching an agent.
$env:ANTHROPIC_BASE_URL = "{{ proxy_url }}"
$env:ANTHROPIC_API_KEY = "{{ token }}"
To persist across sessions, add to your $PROFILE file.
set ANTHROPIC_BASE_URL={{ proxy_url }}
set ANTHROPIC_API_KEY={{ token }}
Use setx instead of set to persist to user environment permanently.
curl -s -N -X POST {{ proxy_url }}/v1/messages \
-H "authorization: Bearer {{ token }}" \
-H "content-type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{"model":"claude-haiku-4-5-20251001","max_tokens":50,"messages":[{"role":"user","content":"say hi in 5 words"}]}'
curl.exe -s -X POST {{ proxy_url }}/v1/messages `
-H "authorization: Bearer {{ token }}" `
-H "content-type: application/json" `
-H "anthropic-version: 2023-06-01" `
-d '{"model":"claude-haiku-4-5-20251001","max_tokens":50,"messages":[{"role":"user","content":"say hi in 5 words"}]}'
curl.exe ships with Windows 10+. Use backtick (`) for line continuation in PowerShell.
import anthropic
client = anthropic.Anthropic(
api_key="{{ token }}",
base_url="{{ proxy_url }}",
)
resp = client.messages.create(
model="claude-haiku-4-5-20251001",
max_tokens=100,
messages=[{"role": "user", "content": "hi"}],
)
print(resp.content[0].text)
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: "{{ token }}",
baseURL: "{{ proxy_url }}",
});
const resp = await client.messages.create({
model: "claude-haiku-4-5-20251001",
max_tokens: 100,
messages: [{ role: "user", content: "hi" }],
});
console.log(resp.content[0].text);
export ANTHROPIC_BASE_URL={{ proxy_url }}
export ANTHROPIC_API_KEY={{ token }}
claude
Any claude session in this shell now routes through Tourniquet. Heads-up: switches Claude Code from subscription to API metered billing. The cap protects you from runaway, but usage still costs money. unset ANTHROPIC_BASE_URL ANTHROPIC_API_KEY to revert.
$env:ANTHROPIC_BASE_URL = "{{ proxy_url }}"
$env:ANTHROPIC_API_KEY = "{{ token }}"
claude
To revert: Remove-Item Env:ANTHROPIC_BASE_URL, Env:ANTHROPIC_API_KEY
set ANTHROPIC_BASE_URL={{ proxy_url }}
set ANTHROPIC_API_KEY={{ token }}
claude
To revert: set ANTHROPIC_BASE_URL= and set ANTHROPIC_API_KEY= (empty assignment unsets).
export ANTHROPIC_BASE_URL={{ proxy_url }}
export ANTHROPIC_API_KEY={{ token }}
Paste at the top of your launcher script, or add to the env block of your systemd / launchd unit.
$env:ANTHROPIC_BASE_URL = "{{ proxy_url }}"
$env:ANTHROPIC_API_KEY = "{{ token }}"
set ANTHROPIC_BASE_URL={{ proxy_url }}
set ANTHROPIC_API_KEY={{ token }}
unset ANTHROPIC_BASE_URL ANTHROPIC_API_KEYRemove-Item Env:ANTHROPIC_BASE_URL, Env:ANTHROPIC_API_KEYset ANTHROPIC_BASE_URL= & set ANTHROPIC_API_KEY=