Documentation
Everything you need to integrate 1Relay into your app.
Quick start
Get up and running in 5 minutes. 1Relay lets your users bring their own AI keys to your app, with zero-knowledge encryption and per-app budget controls.
- Create an account at 1relay.dev and register your app to get a
client_idandclient_secret. - Install the SDKs:
Terminal
npm install @1relay/node-sdk @1relay/link-sdk- Create a Link session from your server, then open 1Relay Link in the browser.
- Exchange the public token for an access token, then make AI calls through the proxy.
Link SDK (Browser)
The Link SDK opens a modal where your users authorize your app to use their AI keys. It handles authentication, provider selection, and budget approval.
JavaScript (Browser)
import { OneRelay } from '@1relay/link-sdk';
const handler = OneRelay.create({
token: linkToken, // from your server
apiBaseUrl: 'https://1relay-api.omerbese.workers.dev',
onSuccess: ({ publicToken }) => {
// Send publicToken to your server to exchange
fetch('/api/1relay/exchange', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ publicToken }),
});
},
onExit: (error) => {
if (error) console.error('1Relay Link error:', error);
},
});
handler.open();Node SDK (Server)
The Node SDK handles session creation, token exchange, and proxied AI calls from your server.
TypeScript (Server)
import { OneRelayClient } from '@1relay/node-sdk';
const client = new OneRelayClient({
clientId: '1r_cid_...',
clientSecret: '1r_cs_...',
baseUrl: 'https://1relay-api.omerbese.workers.dev',
});
// 1. Create a link session
const session = await client.createLinkSession({
requestedProviders: ['openai', 'anthropic'],
budgetSuggestionCents: 1000, // $10/month suggestion
});
// Return session.linkToken to your frontend
// 2. Exchange public token for access token
const { accessToken } = await client.exchangePublicToken(publicToken);
// 3. Make AI calls through 1Relay
const response = await client.chatCompletion({
accessToken,
provider: 'openai',
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello!' }],
});Chrome extension
The 1Relay Chrome extension provides a key vault popup, auto-detects API keys on provider pages, and can proxy AI requests transparently.
Features
- check_circleKey vault popup — Log in, view, add, and delete API keys from any tab.
- check_circleAuto-detect — Detects API keys on OpenAI, Anthropic, Google, and Groq key pages. One-click save.
- check_circleProxy intercept — Transparently routes AI API calls through 1Relay so your keys never touch the page.
API reference
The 1Relay API is hosted at https://1relay-api.omerbese.workers.dev. All endpoints return JSON with the shape { success, data?, error? }.
POST
/v1/auth/registerPOST
/v1/auth/loginGET
/v1/keysPOST
/v1/keysDELETE
/v1/keys/:providerPOST
/v1/appsGET
/v1/appsPOST
/v1/link/sessionsPOST
/v1/link/authorizePOST
/v1/link/exchangePOST
/v1/proxy/chat/completionsPOST
/v1/proxy/passthrough/:provider/*GET
/v1/connectionsDELETE
/v1/connections/:idGET
/v1/usage