Migrate a codebase's API keys to RelayKey in one call.
Built so Claude Code, Codex, Cursor, Replit Agent, and Devin can do the entire migration without a human clicking through a dashboard. POST a .env paste; get back proxy URLs, tokens, and per-SDK code snippets ready to apply.
Bulk-import a .env file
POST any .env contents to /api/v1/import. RelayKey detects the vendor for each key, creates a connection, issues a delegated credential, and returns the snippets you need to apply.
curl -X POST https://app.relaykey.ai/api/v1/import \
-H "Authorization: Bearer rk_mgmt_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"env": "OPENAI_API_KEY=sk-real\nANTHROPIC_API_KEY=sk-ant-real\nRESEND_API_KEY=re_real",
"default_ttl_seconds": 2592000
}'Each entry in the response includes a proxy_token, a proxy_base_url, and a snippets object with env, node, and python changes ready to paste in.
Four steps, every time
- 01
Find the keys
Grep .env files and source for vendor API keys. Any key the user is currently sending to a third party is a candidate.
bashgrep -RhoE '^[A-Z_]+_(API_KEY|TOKEN|SECRET)=.+' \ .env .env.local .env.production 2>/dev/null
- 02
POST to /api/v1/import
Send the keys as a .env paste. Get back proxy URLs and per-SDK snippets.
curlcurl -X POST https://app.relaykey.ai/api/v1/import \ -H "Authorization: Bearer rk_mgmt_xxxxxxxx" \ -H "Content-Type: application/json" \ --data-binary @- < .env
- 03
Apply the SDK snippets
For each imported key, replace the master key in .env with the proxy token, add the *_BASE_URL var, and pass baseURL to the SDK constructor. The pattern is the same for every SDK.
.env diff- OPENAI_API_KEY=sk-real-master-key + OPENAI_API_KEY=rk_proxy_xxxxxxxx + OPENAI_BASE_URL=https://proxy.relaykey.ai/conn_xxx
- 04
Verify with a single curl
Hit a known-safe upstream path through the proxy. Confirm the request appears in the audit log.
curlcurl -i https://proxy.relaykey.ai/conn_xxx/v1/models \ -H "Authorization: Bearer rk_proxy_..."
The exact one-line change, per SDK
new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
});new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: process.env.OPENAI_BASE_URL,
});new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
});new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
baseURL: process.env.ANTHROPIC_BASE_URL,
});new ElevenLabsClient({
apiKey: process.env.ELEVENLABS_API_KEY,
});new ElevenLabsClient({
apiKey: process.env.ELEVENLABS_API_KEY,
environment: process.env.ELEVENLABS_BASE_URL,
});new Resend(process.env.RESEND_API_KEY);
new Resend(process.env.RESEND_API_KEY, {
baseUrl: process.env.RESEND_BASE_URL,
});curl https://api.cloudflare.com/client/v4/zones \ -H "Authorization: Bearer $CF_TOKEN"
curl https://proxy.relaykey.ai/conn_xxx/client/v4/zones \ -H "Authorization: Bearer rk_proxy_..."
stripe.api_key = os.environ["STRIPE_SECRET_KEY"]
stripe.api_key = os.environ["STRIPE_SECRET_KEY"] stripe.api_base = os.environ["STRIPE_BASE_URL"]
Files an agent should read
- /llms.txtShort-form index. Start here.
- /llms-full.txtSelf-contained migration manual. Vendor catalog included.
- /api/openapi.yamlOpenAPI 3.1 spec for the Management API.
- AGENTS.mdRepo-root agent file. Run/build/test commands.
Ready to migrate a codebase?
Get a management API token and post a .env. The response is everything you need to finish the migration.
Get a management API token