Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save gregoryfoster/c2e26d3fdbcd218d0f45b0cb432af6ee to your computer and use it in GitHub Desktop.

Select an option

Save gregoryfoster/c2e26d3fdbcd218d0f45b0cb432af6ee to your computer and use it in GitHub Desktop.
Using your own Anthropic API key with Shelley on exe.dev

Using your own Anthropic API key with Shelley on exe.dev

By default, Shelley on exe.dev VMs runs on exe.dev's managed LLM gateway. These steps switch the Anthropic provider to your own API key ("BYOK"). After the switch, you confirm it from inside a VM and check that it applies to every VM you own.

How it works: the key is stored in exe.dev's LLM integration, not on your VMs. VMs reach models at https://llm.int.exe.xyz, and exe.dev adds your key at the network edge. Code on a VM, including an agent, can use the key but can never read it.

References: Bring Your Own Key · LLM Integration · Attaching Integrations


1. Set the key

Pick one of these options.

Option A: Shelley UI

  1. Start a new conversation.
  2. Open the model drop-down and choose Add / Remove Models...
  3. Choose Anthropic and paste your key.

Option B: exe.dev web UI

  1. Open https://exe.dev/integrations and click LLM.
  2. Edit the llm integration and set Anthropic to API Key.
  3. Paste the key and, if you like, click Test.
  4. Make sure it's attached to auto:all, which means every VM.

Option C: SSH, from your local machine

Use - so the key is read from stdin. That keeps it out of shell history and the process list:

printf '%s' "$ANTHROPIC_API_KEY" | \
  ssh exe.dev integrations edit llm --anthropic=byok --anthropic-key=-

Editing the existing llm integration keeps its attachments. Out of the box, that's auto:all.

If the key is in a .env file, pipe it in without ever displaying it:

grep -E '^ANTHROPIC_API_KEY=' .env | cut -d= -f2- | tr -d '\n' | \
  ssh exe.dev integrations edit llm --anthropic=byok --anthropic-key=-

To switch back to exe.dev's managed credentials:

ssh exe.dev integrations edit llm --anthropic=gateway

2. Check it from inside a VM

Run these on a VM.

Provider mode: Anthropic should report byok.

curl -s https://llm.int.exe.xyz/models.json | jq '.providers | map_values(.mode)'

Expected output (other providers will still say managed unless you changed them too):

{
  "anthropic": "byok",
  "deepgram": "managed",
  "fireworks": "managed",
  "openai": "managed",
  "xai": "managed"
}

End-to-end call: this proves the key actually works. Model IDs use dashes and a provider prefix, for example anthropic/claude-haiku-5-5. List the available IDs with jq -r '.models[].id' on models.json.

curl -s https://llm.int.exe.xyz/v1/messages \
  -H 'content-type: application/json' \
  -H 'anthropic-version: 2023-06-01' \
  -d '{"model":"anthropic/claude-haiku-5-5","max_tokens":5,"messages":[{"role":"user","content":"hi"}]}' \
  | jq '{model, type, text: .content[0].text}'

An HTTP 200 with "type": "message" means your key is being used. A 401 or 403 from upstream usually means the key is invalid or has no credit.


3. Check that it applies to every VM

Do this from your local machine. A VM can't see account-wide integration settings.

# 1. The integration: look for anthropic=byok and an auto:all attachment.
#    Stored secrets appear as ***.
ssh exe.dev integrations list --json

# 2. Your VMs
ssh exe.dev ls

# 3. Spot-check any VM (should print "byok")
ssh <vm>.exe.xyz "curl -s https://llm.int.exe.xyz/models.json | jq -r .providers.anthropic.mode"

Optional loop over several VMs:

for vm in vm-one vm-two vm-three; do
  printf '%-20s ' "$vm"
  ssh "$vm.exe.xyz" "curl -s https://llm.int.exe.xyz/models.json | jq -r .providers.anthropic.mode"
done

The setting covers every VM only if:

  • The llm integration is attached to auto:all, not to one tag: or vm:. To fix it:
    ssh exe.dev integrations attach llm auto:all
  • No other LLM integration attached to a VM changes what that VM sees. Look in integrations list for extra LLM-type entries attached to a tag or to individual VMs.

Troubleshooting

Symptom Likely cause / fix
ssh exe.dev from a VM prints "Please complete registration" That VM isn't logged in to the exe.dev CLI. Run account-level commands from your local machine.
curl https://reflection.int.exe.xyz/ says "integration not found or not attached" The default reflection integration was removed. Reinstall it with ssh exe.dev int add reflection --default.
Model "..." is not in this exe.dev integration's model list Wrong model ID format. Use the ID from models.json, for example anthropic/claude-haiku-5-5.
/v1/models lists no Claude models That endpoint is the OpenAI-compatible list. Use /models.json to see all providers.
Anthropic shows managed on one VM llm isn't attached to that VM (see step 3), or a different LLM integration covers it.

Security notes

  • Never paste the key into a command argument. Always pipe it in and use --anthropic-key=-.
  • integrations list --json masks secrets as ***. If the key is ever exposed, revoke it in the Anthropic Console and run step 1 again with a new key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment