Access LLMs directly from your browser. Simple, secure, and scalable.
Log in Playgroundimport { getProfile } from "https://aipipe.org/aipipe.js";
const { token, email } = getProfile();
if (!token) window.location = `https://aipipe.org/login?redirect=${window.location.href}`;
const response = await fetch("https://aipipe.org/openrouter/v1/chat/completions", {
method: "POST",
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
body: JSON.stringify({
"model": "openai/gpt-4.1-nano",
"messages": [{ "role": "user", "content": "What is 2 + 2?" }]
})
}).then(r => r.json());
Built-in user authentication and token management for secure API access.
Track API usage and costs with detailed analytics and budget controls.
Connect to various LLM providers through a single unified interface.
import { getProfile } from "https://aipipe.org/aipipe.js";
const { token, email } = getProfile();
if (!token) window.location = `https://aipipe.org/login?redirect=${window.location.href}`;
const response = await fetch("https://aipipe.org/openrouter/v1/chat/completions", {
method: "POST",
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
body: JSON.stringify({
"model": "openai/gpt-4.1-nano",
"messages": [{ "role": "user", "content": "What is 2 + 2?" }]
})
}).then(r => r.json());
This will:
getProfile()
sets token
to null
since it doesn't know the user.window.location
redirects the user to https://aipipe.org/login
with ?redirect=
as your app URL?aipipe_token=...&aipipe_email=...
with the user's token and emailgetProfile()
fetches these, stores them for future reference, and returns token
and email
https://openrouter.ai/api/v1
with https://aipipe.org/openrouter/v1
Authorization: Bearer ${TOKEN}
as a header.You can also use an OpenAI model directly with the Chat Completion or Responses API:
import { getProfile } from "https://aipipe.org/aipipe.js";
const { token, email } = getProfile();
if (!token) window.location = `https://aipipe.org/login?redirect=${window.location.href}`;
const response = await fetch("https://aipipe.org/openrouter/v1/responses", {
method: "POST",
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
body: JSON.stringify({ "model": "openai/gpt-4.1-nano", "input": "What is 2 + 2?" })
}).then(r => r.json());