Quickstart

TokenPortal is OpenAI-compatible. Change the base URL to access 150+ models instantly.

1
Sign up & log in
Create an account by email and get free credits.
2
Create an API key
Generate an sk- key on the API Keys page in your workspace.
3
Swap the base URL
Point your SDK's baseURL to https://api.tokenportal.ai/v1 and call with your key.
API Base URL
https://api.tokenportal.ai/v1

Make your first call

Python (openai SDK)
from openai import OpenAI

client = OpenAI(
    base_url="https://api.tokenportal.ai/v1",
    api_key="sk-your-tokenportal-key",
)

resp = client.chat.completions.create(
    model="openai/gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
Node.js (openai SDK)
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.tokenportal.ai/v1",
  apiKey: process.env.TOKENPORTAL_API_KEY,
});

const res = await client.chat.completions.create({
  model: "openai/gpt-4o",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(res.choices[0].message.content);
cURL
curl https://api.tokenportal.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-tokenportal-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'