KEY=VALUE and can repeat.
- Environment variables are stored in plain text and visible when you inspect the sandbox.
- Secrets are encrypted at rest, never returned in API responses, and obfuscated in CLI output. Use them for API keys, passwords, and anything you wouldn’t want in logs.
Inject secrets into request headers
Give a sandbox a credential that it can use without ever being able to see it. Store the credential once as a secret. Then add a header rule for a host to the sandbox’s network policy. The platform adds the secret to HTTPS request headers for that host, outside the sandbox. The value never goes into the sandbox’s environment, files, or configuration.${prime.secrets.INFERENCE_KEY}. When the sandbox sends an HTTPS request to api.pinference.ai, the platform resolves the reference outside the sandbox, sets the header, and sends the request on. If the sandbox sends a header with the same name, the platform replaces it.
A header rule does not give network access. The sandbox’s allowlist or denylist must also allow the rule host.
Which secrets you can use
Header rules use your global secrets: the secrets that you create withprime secret create or under Keys & Secrets. These are the same secrets that you can link to Environments Hub environments, so one secret can serve both. Secrets set directly on one environment are not available to header rules.
The secret must belong to the same user or team as the sandbox.
Rule syntax and limits
- A rule host is an exact host name (
api.pinference.ai) or a wildcard for one label (*.example.com).*.example.commatchesapi.example.com, but notexample.comora.b.example.com. Ports, paths, and IP addresses are not permitted. - Host names are not case-sensitive. An exact host has priority over a wildcard. The platform does not combine rules.
- A header value is text that contains zero or more
${prime.secrets.<NAME>}references. Other${...}forms are not permitted. - Header names are not case-sensitive. A rule cannot set the same header two times, for example
Authorizationandauthorization. - You cannot set these headers:
Host,:authority,Content-Length,Transfer-Encoding,Connection,Upgrade,Keep-Alive,TE,Trailer, and headers that start withProxy-.
Update rules on a running sandbox
Header rules are part of the network policy. Each update replaces the full policy, as for allowlists and denylists.--network-policy. You can use it when you create or update a sandbox:
rules, the platform removes all header rules.
Errors
If the platform cannot add a secret, it does not send the request. The sandbox gets a502 response with the body request blocked: header substitution unavailable. A partial credential never goes to the destination.
Requests to hosts without a rule are not affected.
TLS trust inside the sandbox
To add headers, the platform must terminate TLS for rule hosts. Clients in the sandbox must therefore trust the Prime Intellect root certificate. The sandbox includes this certificate at/mnt/sandboxd/platform-ca.pem.
- Most clients work with no changes. At boot, the platform adds the root to the sandbox’s system trust store. It also sets
SSL_CERT_FILE,REQUESTS_CA_BUNDLE, andNODE_EXTRA_CA_CERTS, unless you set them. This coverscurl,openssl, Pythonrequestsandurllib, and Node.js. - If the image does not include the
ca-certificatespackage, install it in the image. You can also install it while the sandbox runs. - If a client uses its own trust store, add the root to that store, as in the example below.
Known limits
- Clients that use certificate pinning cannot connect to rule hosts.
- Clients that use Encrypted Client Hello (ECH) cannot connect to rule hosts. Browsers that send GREASE ECH, such as Chromium, work normally.