Agent and CLI tools often save the API credentials you sign in with to a hidden folder in your home directory. If you have been using the openclaw tool and need to find the Anthropic API key or Bearer token it stored, for example to reuse it elsewhere or to rotate it, you can locate it in a few seconds with grep. This short tutorial shows how.
Note: "spi keys" in the URL is a typo for "api keys".
Step 1: Go to the config directory
openclaw keeps its per-agent configuration under a hidden .openclaw folder in your home directory:
cd ~/.openclaw/
Step 2: List what is there
List the contents, including hidden files, so you can see the agent folders:
ls -loa
Each agent typically has its own subfolder under agents/, and the credentials live in an auth-profiles.json file inside it.
Step 3: Search for the keys
Rather than opening each file by hand, recursively grep the whole directory for the two token formats. Anthropic keys begin with sk-ant-, and OAuth-style tokens are sent as a Bearer value:
grep -r "sk-ant\|Bearer" .
The output points you straight at the files that hold credentials, for example:
./agents/anthropic-claude-opus-4-6/agent/auth-profiles.json: ... ./agents/main/agent/auth-profiles.json: "key": "sk-ant-..."
Open the matching auth-profiles.json to read the full value:
cat ./agents/main/agent/auth-profiles.json
Security reminder
An API key is a password. Anyone who has it can spend against your account, so treat it accordingly: never paste a real key into a blog post, screenshot, issue, or chat; do not commit auth-profiles.json to a public repository; and if a key has ever been exposed, revoke and rotate it from the Anthropic Console rather than reusing it. The key values in this post are intentionally truncated for that reason.
Summary
Stored credentials for the openclaw agent tool live in ~/.openclaw/agents/*/agent/auth-profiles.json. A single grep -r "sk-ant\|Bearer" . from the config directory finds every file that contains a key or token, so you do not have to hunt through folders by hand.

No comments:
Post a Comment
Note: Only a member of this blog may post a comment.