API Documentation
80% cheaper AI API with OpenAI-compatible endpoints. Premium models at a fraction of the cost.
⚡ Connect Any App in 3 Steps
Works with any app that supports OpenAI or OpenAI Compatible connection. Just 3 simple changes:
Change Base URL
Set your base URL to:
https://freeaiapikey.com/v1
Choose a Model
Pick from our available models:
🔍 Browse Models →Popular: gpt-5, claude-sonnet-4.5, gemini-3
✅ That's it! You're ready to go.
If the app has an "OpenAI" or "OpenAI Compatible" option, just switch the base URL and use your API key. No other changes needed.
Example: Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
base_url="https://freeaiapikey.com/v1", # ← Change this
api_key="your-api-key-here" # ← Your API key
)
response = client.chat.completions.create(
model="gpt-5", # ← Any model from /models
messages=[{"role": "user", "content": "Hello!"}]
)
Example: cURL
curl https://freeaiapikey.com/v1/chat/completions \
-H "Authorization: Bearer your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-5", "messages": [{"role": "user", "content": "Hello!"}]}'
🔧 Advanced Configuration
Detailed API reference and tool-specific integration guides below.
🚀 Quick Start
Our API is 100% OpenAI-compatible. Just change the base URL and you're ready.
Three Things You Need
| Base URL | https://freeaiapikey.com/v1 |
| API Key | Get yours at dashboard |
| Models | Browse available models |
30-Second Setup
# Install: pip install openai
from openai import OpenAI
client = OpenAI(
api_key="your-api-key-here",
base_url="https://freeaiapikey.com/v1"
)
response = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
🔑 Authentication
Get Your API Key
- Visit freeaiapikey.com/dashboard
- Sign up or log in
- Copy your API key from the dashboard
Using Your API Key
Include your API key in the Authorization header as a Bearer token:
curl https://freeaiapikey.com/v1/chat/completions \
-H "Authorization: Bearer your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-5", "messages": [{"role": "user", "content": "Hello!"}]}'
🌐 Base URL
All API requests should be made to:
https://freeaiapikey.com/v1
Endpoints
/chat/completions
Create chat completions
/models
List available models
/embeddings
Create embeddings
📋 Available Models
Browse all models at freeaiapikey.com/models
Model Catalog
| Model ID | Provider | Context | Input | Output | Savings |
|---|---|---|---|---|---|
gpt-5 |
OpenAI | 400K | $0.25/1M | $2.00/1M | 80% |
gpt-4o |
OpenAI | 128K | $0.30/1M | $0.90/1M | 88% |
claude-opus-4.5 |
Anthropic | 200K | $1.00/1M | $5.00/1M | 80% |
claude-sonnet-4.5 |
Anthropic | 1M | $0.60/1M | $3.00/1M | 80% |
gemini-3 |
1M | $0.40/1M | $2.50/1M | 79% | |
deepseek-v3.2 |
DeepSeek | 164K | $0.20/1M | $0.30/1M | 67% |
Model Aliases
Use short names for convenience:
| Short Name | Full Model ID |
|---|---|
gpt-5 |
openai/gpt-5 |
gpt-4o |
openai/gpt-4o |
claude-opus-4.5 |
anthropic/claude-opus-4.5 |
claude-sonnet-4.5 |
anthropic/claude-sonnet-4.5 |
gemini-3 |
google/gemini-3 |
List Models via API
curl https://freeaiapikey.com/v1/models \
-H "Authorization: Bearer your-api-key-here"
📖 Chat Completions
/v1/chat/completions
Request Body
{
"model": "gpt-5",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7,
"max_tokens": 4096,
"stream": false
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model |
string | Yes | Model ID to use |
messages |
array | Yes | Conversation messages |
temperature |
number | No | Sampling temperature (0-2) |
max_tokens |
integer | No | Maximum tokens to generate |
stream |
boolean | No | Enable streaming responses |
top_p |
number | No | Nucleus sampling parameter |
stop |
array | No | Stop sequences |
Response
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"created": 1234567890,
"model": "gpt-5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 20,
"total_tokens": 30
}
}
⚡ Streaming Responses
Enable streaming by setting stream: true:
response = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": "Write a poem"}],
stream=True
)
for chunk in response:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
🔌 Integrations
Our API works with any tool that supports OpenAI-compatible endpoints.
💻 Claude Code
Anthropic's official CLI tool. Use claude-code-router to connect it to FreeAIAPIKey for 80% cheaper access.
Powered by: This integration uses claude-code-router by musistudio. If you encounter any issues, check their Issues section.
Step 1: Install Claude Code & Router
npm install -g @anthropic-ai/claude-code
npm install -g @musistudio/claude-code-router
Step 2: Create Config File
Create the config file at:
- Windows:
C:\Users\YOUR_NAME\.claude-code-router\config.json - Mac/Linux:
~/.claude-code-router/config.json
{
"Providers": [{
"name": "freeaiapikey",
"api_base_url": "https://freeaiapikey.com/v1/chat/completions",
"api_key": "YOUR_API_KEY",
"models": ["gpt-5", "claude-sonnet-4.5", "claude-opus-4.5", "gemini-3", "deepseek-v3.2"]
}],
"Router": {
"default": "freeaiapikey,gpt-5",
"background": "freeaiapikey,deepseek-v3.2",
"think": "freeaiapikey,claude-sonnet-4.5",
"longContext": "freeaiapikey,gemini-3",
"longContextThreshold": 60000
}
}
Step 3: Start Coding
ccr code
Useful Commands
ccr code |
Start Claude Code with router |
ccr start |
Start router server in background |
ccr stop |
Stop router server |
ccr model |
Switch model interactively |
ccr ui |
Open web UI for config management |
ccr restart |
Restart router (after config changes) |
Model Switching
Switch models on-the-fly in Claude Code:
/model freeaiapikey,claude-opus-4.5
Router Config Options
default |
Default model for general tasks |
background |
Model for background tasks (cost-saving) |
think |
Model for reasoning-heavy tasks (Plan Mode) |
longContext |
Model for long contexts (>60K tokens) |
webSearch |
Model for web search tasks |
Tip: After modifying the config file, run ccr restart for changes to take effect.
🤖 Codex CLI
OpenAI's Codex CLI supports custom providers through environment variables.
Installation
npm install -g @openai/codex
Configuration
Mac/Linux:
export FREEAIAPIKEY_API_KEY="your-api-key-here"
export FREEAIAPIKEY_BASE_URL="https://freeaiapikey.com/v1"
Windows (PowerShell):
$env:FREEAIAPIKEY_API_KEY="your-api-key-here"
$env:FREEAIAPIKEY_BASE_URL="https://freeaiapikey.com/v1"
Run
codex --provider freeaiapikey "your prompt here"
🦘 Roo Code
VSCode extension for AI-assisted coding.
Installation
- Open VSCode
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "Roo Code"
- Click Install
Configuration
- Open Roo Code in VSCode
- Click Configure Provider
- Add an OpenAI Compatible provider
- Enter settings:
| OpenAI Base URL | https://freeaiapikey.com/v1 |
| API Key | Your API key |
| Model | gpt-5 or any model |
⚡ Kilo Code
Powerful VSCode extension for AI coding.
Installation
- Open VSCode
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "Kilo Code"
- Click Install
Configuration
Same as Roo Code - add an OpenAI Compatible provider with:
| OpenAI Base URL | https://freeaiapikey.com/v1 |
| API Key | Your API key |
| Model | gpt-5 |
🤖 Droid CLI
Terminal-based AI coding assistant from Factory AI.
Installation
macOS/Linux:
curl -fsSL https://app.factory.ai/cli | sh
Windows:
irm https://app.factory.ai/cli | iex
Configuration
Edit ~/.factory/config.json:
{
"custom_models": [
{
"model_display_name": "freeaiapikey-gpt5",
"model": "gpt-5",
"base_url": "https://freeaiapikey.com/v1",
"api_key": "YOUR_API_KEY",
"provider": "generic-chat-completion-api",
"max_tokens": 128000
}
]
}
🦞 OpenClaw
AI agent framework supporting Telegram, Discord, and more.
Download
Configuration
Config file location:
- Windows:
C:\Users\YOUR_NAME\.openclaw\openclaw.json - Mac/Linux:
~/.openclaw/openclaw.json
{
"models": {
"providers": {
"custom": {
"baseUrl": "https://freeaiapikey.com/v1",
"apiKey": "YOUR_API_KEY",
"api": "openai-completions",
"models": [
{
"id": "gpt-5",
"name": "GPT-5",
"contextWindow": 400000,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": { "primary": "custom/gpt-5" }
}
}
}
🔄 n8n
Workflow automation tool that supports OpenAI nodes.
Setup
- Open n8n workflow editor
- Add an OpenAI or AI Agent node
- Configure credentials:
| Base URL | https://freeaiapikey.com/v1 |
| API Key | Your API key |
💻 Code Examples
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="your-api-key-here",
base_url="https://freeaiapikey.com/v1"
)
# Basic completion
response = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
# Streaming
for chunk in client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": "Write a story"}],
stream=True
):
print(chunk.choices[0].delta.content or "", end="")
JavaScript/TypeScript
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'your-api-key-here',
baseURL: 'https://freeaiapikey.com/v1',
});
const response = await client.chat.completions.create({
model: 'gpt-5',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(response.choices[0].message.content);
cURL
curl https://freeaiapikey.com/v1/chat/completions \
-H "Authorization: Bearer your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5",
"messages": [{"role": "user", "content": "Hello!"}]
}'
LangChain (Python)
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="gpt-5",
openai_api_key="your-api-key-here",
openai_api_base="https://freeaiapikey.com/v1"
)
response = llm.invoke("Hello!")
print(response.content)
💰 Pricing
Pay as you go - no monthly fees, no minimum spend.
Compare and Save
| Model | Official Input | Our Input | Official Output | Our Output | Savings |
|---|---|---|---|---|---|
| GPT-5 | $1.25/1M | $0.25/1M | $10.00/1M | $2.00/1M | 80% |
| Claude Opus 4.5 | $5.00/1M | $1.00/1M | $25.00/1M | $5.00/1M | 80% |
| Claude Sonnet 4.5 | $3.00/1M | $0.60/1M | $15.00/1M | $3.00/1M | 80% |
| Gemini 3 | $2.00/1M | $0.40/1M | $12.00/1M | $2.50/1M | 79% |
| DeepSeek V3.2 | $0.50/1M | $0.20/1M | $0.90/1M | $0.30/1M | 67% |
Get $2 FREE credit on signup!
❓ FAQ
General Questions
Q: Is this API really OpenAI-compatible?
Yes! Our API uses the exact same request/response format as OpenAI. Any code or tool that works with OpenAI will work with FreeAIAPIKey.
Q: How are you able to offer 80% cheaper prices?
We use bulk purchasing, smart caching, community donations, and efficient infrastructure to keep costs low.
Q: Is there a rate limit?
No, we don't impose rate limits on our users.
Q: Do you store my data?
No long-term storage. We use temporary caching (minutes) for efficiency, then data is deleted.
Which tool should I use?
- Claude Code - Best for terminal-based coding
- Roo Code / Kilo Code - Best for VSCode users
- Codex CLI - Best for OpenAI ecosystem
- Droid CLI - Best for Factory AI users
- OpenClaw - Best for multi-channel AI agents
- n8n - Best for workflow automation
Which model should I use?
- gpt-5 - General purpose, best overall
- claude-opus-4.5 - Complex reasoning, coding
- claude-sonnet-4.5 - Fast, cost-efficient
- gemini-3 - Long context, multimodal
- deepseek-v3.2 - Code generation
🆘 Support
| Website | freeaiapikey.com |
| Dashboard | freeaiapikey.com/dashboard |
| Models | freeaiapikey.com/models |
| Contact | freeaiapikey.com/contact |
🚀 Get Started Now
- Get your API key at freeaiapikey.com/dashboard
- Set your base URL to
https://freeaiapikey.com/v1 - Start making requests!