Overview
KeyGPT gives you a unified OpenAI-compatible endpoint for multiple models and providers. You keep your app logic simple while KeyGPT handles routing, quota tracking, metering, and request logging.
Authentication
Create an API key from your dashboard, then send it as a Bearer token with every request.
Authorization: Bearer keygpt-your-api-keyYou can manage API keys at /dashboard/keys. New keys are only shown once when created.
Quickstart
Set your environment variables and make your first request.
export OPENAI_API_KEY="keygpt-your-api-key"
export OPENAI_BASE_URL="https://keygpt.net/v1"
curl $OPENAI_BASE_URL/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"messages": [
{"role": "user", "content": "Hello from KeyGPT"}
]
}'Claude CLI Provider Switch
Want Claude CLI to use KeyGPT as the provider? Copy one command below, replace YOUR_KEYGPT_KEY, and run it in your terminal.
- • Haiku (Fast) →
gpt-5.3-codex-xhigh - • Sonnet (Default) →
gpt-5.4 - • Opus (Powerful) →
gpt-5.5
curl -fsSL https://keygpt.net/install/claude.sh | bashOne-line installer. It only asks for your API key, then automatically configures all 3 Claude models and creates helper commands: claude-haiku, claude-sonnet, claude-opus.
irm https://keygpt.net/install/claude.ps1 | iexOne-line installer. It only asks for your API key, then automatically configures all 3 Claude models and creates helper commands: claude-haiku, claude-sonnet, claude-opus.
powershell -ExecutionPolicy Bypass -Command "irm https://keygpt.net/install/claude.ps1 | iex"For CMD users, this launches the same PowerShell installer in one line.
# macOS / Linux
curl -fsSL https://keygpt.net/install/claude-uninstall.sh | bash
# Windows PowerShell
irm https://keygpt.net/install/claude-uninstall.ps1 | iex
# Windows CMD
powershell -ExecutionPolicy Bypass -Command "irm https://keygpt.net/install/claude-uninstall.ps1 | iex"Removes all environment variables and helper commands created by the installer, restoring your Claude terminal setup to its previous/default state after reopening terminal or VSCode.
Codex for VSCode
Configure Codex/OpenAI-compatible tools in VSCode to use your keygpt.net API key. This uses a separate installer from Claude.
- • Default →
gpt-5.5 - • Fast helper →
gpt-5.4 - • Base URL →
https://keygpt.net/v1
curl -fsSL https://keygpt.net/install/codex-vscode.sh | bashOne-line installer for macOS/Linux. It asks for your API key, sets OpenAI-compatible variables for Codex in VSCode, and creates helper commands.
irm https://keygpt.net/install/codex-vscode.ps1 | iexOne-line installer. It asks for your API key, sets OpenAI-compatible environment variables, and creates helper commands: codex-keygpt and codex-fast.
powershell -ExecutionPolicy Bypass -Command "irm https://keygpt.net/install/codex-vscode.ps1 | iex"# macOS / Linux
curl -fsSL https://keygpt.net/install/codex-vscode-uninstall.sh | bash
# Windows PowerShell
irm https://keygpt.net/install/codex-vscode-uninstall.ps1 | iex
# Windows CMD
powershell -ExecutionPolicy Bypass -Command "irm https://keygpt.net/install/codex-vscode-uninstall.ps1 | iex"Removes Codex/OpenAI environment variables and helper commands created by this installer. Close and reopen VSCode after install/uninstall.
Claude VSCode Integration
If you use Claude CLI/Claude Code inside VSCode integrated terminal, run the Claude installer first, then completely close and reopen VSCode so the terminal picks up the new environment variables.
- • macOS/Linux:
curl -fsSL https://keygpt.net/install/claude.sh | bash - • Windows PowerShell:
irm https://keygpt.net/install/claude.ps1 | iex - • Then fully close VSCode and open it again.
- • Open a new integrated terminal and use:
claude-haiku,claude-sonnet, orclaude-opus.
# Check env inside VSCode terminal
# macOS / Linux
printf "%s
" "$OPENAI_BASE_URL" "$AIGATE_MODEL"
# PowerShell
$env:OPENAI_BASE_URL
$env:ANTHROPIC_BASE_URL
$env:AIGATE_MODELExpected base URL for OpenAI and Anthropic envs: https://keygpt.net/v1. If values are empty, restart VSCode completely and open a new terminal tab.
List Models
Query the available models for the current API key.
curl $OPENAI_BASE_URL/models \
-H "Authorization: Bearer $OPENAI_API_KEY"See the visual catalog on the models page.
SDK Examples
from openai import OpenAI
client = OpenAI(
api_key="keygpt-your-api-key",
base_url="https://keygpt.net/v1"
)
resp = client.chat.completions.create(
model="gpt-5.5",
messages=[{"role": "user", "content": "Hi!"}]
)
print(resp.choices[0].message.content)import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'keygpt-your-api-key',
baseURL: 'https://keygpt.net/v1',
});
const resp = await client.chat.completions.create({
model: 'gpt-5.5',
messages: [{ role: 'user', content: 'Hi!' }],
});
console.log(resp.choices[0].message.content);Integration Notes
- • Generate API keys from
/dashboard/keys. - • Use
/v1/modelsto dynamically discover what is enabled. - • Request logs and token usage appear in your dashboard after each call.
- • Admins can configure upstream providers and model mappings in
/admin.