Foundational Compute

Secrets

Let a sandbox use an API key that never enters the sandbox. The sandbox gets a placeholder. Our gateway, outside the sandbox, adds the real key on the way out.

One host eachEach secret works for one HTTPS host only. The gateway refuses every other host.
ServicesAnthropic (api.anthropic.com).

How it works

  1. You save your key once. We seal it with an AWS KMS key at once and keep only the sealed copy.
  2. A sandbox that uses the key gets a placeholder in ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL=https://llm.fdtn.dev.
  3. Claude Code and the Anthropic SDKs send their calls to our gateway.
  4. The gateway opens your key with AWS KMS, sends the call to api.anthropic.com and streams the answer back.

The real key never enters the sandbox or the computer that runs it. A prompt injection that prints the environment shows only the placeholder. The placeholder works only from that sandbox, and only while it runs.

1Save your key as a secret

Put the key in a file, not on the command line, so it stays out of shell history.

anthropic.json
{
  "name": "anthropic",
  "value": "sk-ant-...",
  "metadata": {
    "fdtn.hosts": "api.anthropic.com",
    "fdtn.header": "x-api-key",
    "fdtn.paths": "/v1",
    "fdtn.methods": "POST,GET"
  }
}
$ fdtn secrets create --input anthropic.json
$ rm anthropic.json
$ fdtn secrets ls                 # names and versions, never the value

The fdtn. keys say where the key may go. The gateway refuses every other host, path and method.

2Use it in a sandbox

Claude Code

$ fdtn claude --secret anthropic

From code

Set the variable to fdtn-secret:// and the key's name. Do not set ANTHROPIC_BASE_URL; we set it.

Python · TypeScript

agent.py
from fdtn import Sandbox

sbx = Sandbox.create("claude", envs={"ANTHROPIC_API_KEY": "fdtn-secret://anthropic"})
r = sbx.commands.run("claude -p 'Say hello'", timeout=300)
print(r.stdout)
sbx.kill()

A sandbox with a secret runs only on computers that we own.

3Rotate or delete

$ echo '{"value": "sk-ant-NEW..."}' > new.json
$ fdtn secrets rotate <id> --input new.json; rm new.json
$ fdtn secrets delete <id>
  • Rotate: running sandboxes use the new key on their next call.
  • Delete: running sandboxes lose access within about 15 seconds.
  • A killed sandbox loses access at once.

What the gateway sends

AllowedPOST /v1/messages (streaming too), POST /v1/messages/count_tokens, GET /v1/models
ToolsYour own tools, the bash, text editor and memory tools, and web search (at most 3 searches a call)
RefusedOther paths, file IDs and URL sources, base64 PDFs, server tools other than web search, MCP servers, priority tiers, and betas outside the list Claude Code uses
BillingAnthropic bills you for tokens, as usual. The gateway also enforces spend caps for your workspace.

Security

StorageSealed with an AWS KMS key (RSA-4096, us-west-2). We store only the sealed copy.
Who can open itOnly the gateway server's AWS role, from the gateway's own address. Our other servers can only seal.
When we see itOur API sees the key once, when you save or rotate it, and seals it at once.
Host computersNever get the key. Sandboxes with secrets run only on our own computers.
LogsAWS logs every use of the KMS key for 365 days, with alerts. No log holds the key.
Fails closedIf the key cannot be opened, the call stops. The placeholder never goes to Anthropic.

Code in the sandbox can still use the key through the gateway while the sandbox runs. Give a sandbox a secret only when its job needs it, and set a spend limit in your Anthropic account.

Errors

At create:

Statuserror_codeMeaning
400secret_not_foundNo saved key has that name.
400reserved_envRemove ANTHROPIC_BASE_URL from envs.
400secret_form_not_supportedUse one Anthropic key per sandbox, with no network rules.
409secrets_loadingWait Retry-After seconds and try again.
503secrets_unavailableNo computer can use the gateway now. Wait Retry-After seconds.

Inside the sandbox, the gateway answers in the Anthropic error format, with the reason in X-Fdtn-Gateway-Error:

StatusReasonMeaning
400beta_not_allowed, tool_not_allowed, source_not_allowed, document_not_allowedThe call uses a feature the gateway refuses. See What the gateway sends.
401invalid_keyThe placeholder is wrong, or the sandbox is not running.
404not_allowedA path or method the gateway does not send.
429rate_limited, spend_cap, token_capA cap is reached. Wait, or try the next UTC day for spend_cap.
502secret_unavailable, upstream_errorThe key could not be opened, or Anthropic failed. Try again.

Next