Quickstart
This walks through one path end to end: deploy the broker to your Cloudflare account, add an OpenRouter key, and call OpenRouter with a grant instead of the key. It needs nothing from Beachside, so it works with any sandbox or orchestrator.
You need Bun 1.4.4, Node.js 22 or later, a Cloudflare account that can deploy Workers and SQLite Durable Objects, and an OpenRouter API key.
1. Deploy the broker
Section titled “1. Deploy the broker”git clone https://github.com/beachside-compute/credential-broker.gitcd credential-brokerbun install --frozen-lockfilebun run --cwd services/credential-broker wrangler loginOn a remote machine without a browser, add --device --browser=false to the login and open the printed URL. Wrangler sign-in options.
deploy:setup deploys the broker for the first time. It generates the admin, issuer and encryption keys, uploads them with the Worker, and saves the broker’s URL to .env.deploy.
bun run deploy:setupSetup prints the admin and issuer keys once. Save both in your password manager, then point .env.deploy at them so later commands can read them. This example uses 1Password; bws://<secret-id>, pass://<path> and env:NAME work too.
echo 'BROKER_ADMIN_KEY=op://Private/beachside-broker/admin' >> .env.deployecho 'BROKER_ISSUER_KEY=op://Private/beachside-broker/issuer' >> .env.deployThe encryption key never leaves the Worker. Later updates run bun run deploy, which never touches the keys.
The default workers.dev hostname works. To use your own domain, see custom hostnames.
2. Add OpenRouter
Section titled “2. Add OpenRouter”The checkout runs the broker’s command line as bun run broker, with the URL from .env.deploy and the keys it references. Without a reference, it asks for the key at the prompt.
bun run broker statusbun run broker integration setupstatus confirms the URL and that the admin key works. In setup, choose OpenRouter, press Enter to keep the ID openrouter, and paste your OpenRouter key at the masked prompt. The broker stores the key encrypted and lets the issuer key grant openrouter.
3. Issue a grant and call OpenRouter
Section titled “3. Issue a grant and call OpenRouter”bun run broker grant issue openrouter --ttl 15m --label quickstartThe output shows the grant ID, its expiry, a base URL for openrouter and the token. The base URL is your broker standing in for https://openrouter.ai/api/v1, and the token is the API key to send it. Check that OpenRouter accepts it. This calls OpenRouter’s current key endpoint, which uses no model tokens, and prints the HTTP status.
export OPENROUTER_BASE_URL=https://beachside-credential-broker.your-subdomain.workers.dev/gateway/openrouterexport OPENROUTER_API_KEY=bsg_... # the token from the outputcurl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer $OPENROUTER_API_KEY" "$OPENROUTER_BASE_URL/key"A 200 means the broker swapped the grant for your real key. Put the same two variables in a sandbox’s environment and any OpenAI-compatible client there reaches OpenRouter without ever holding the key. When the work is done, cut the grant off early:
bun run broker grant revoke <grant-id>Use it from somewhere else
Section titled “Use it from somewhere else”bun run broker works inside the checkout. Elsewhere, use one of these. Both take the same commands, such as grant issue and integration setup.
Another machine, script or CI job: install the standalone beachside-broker command and give it the URL and a key, as a value or a reference. A machine that only issues grants needs just the issuer key.
npm install -g @beachside/credential-clientexport BEACHSIDE_BROKER_URL=https://beachside-credential-broker.your-subdomain.workers.devexport BEACHSIDE_BROKER_ISSUER_KEY=op://Private/beachside-broker/issuerbeachside-broker grant issue openrouter --ttl 1hAlready using the beachside CLI: save the broker once, then create sandboxes with grants. rm destroys the sandbox and revokes its grant. See use from the CLI.
beachside broker add work --deployment .env.deploybeachside create --name agent --network internet --grant openrouterbeachside rm agentNext steps
Section titled “Next steps”- Use from the CLI: longer grants for always-on agents, renewal, and other integrations.
- Use from the SDK.
- GitHub access for
gitandghin sandboxes. - Model gateway recipes for Kilo, Cloudflare, Vercel, OpenAI and Anthropic.
© 2026 Beachside Compute · Made by humans & in Texas