One base URL. Every model. 80% cheaper.
FreeAIapiKey is a drop-in replacement for the OpenAI and Anthropic APIs. Switch the base URL, keep your code, and ship premium models at a fraction of the cost.
# Drop-in replacement for OpenAI
from openai import OpenAI
client = OpenAI(
base_url="https://api.freeaiapikey.com/v1", # <- change this
api_key="your-api-key" # <- from dashboard
)
response = client.chat.completions.create(
model="openai/gpt-5",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)Connect Any App in 3 Steps
Works with any app that supports OpenAI or OpenAI Compatible connections. Three small changes and you are live.
Change base URL
Point your OpenAI client at our endpoint instead of api.openai.com.
https://api.freeaiapikey.com/v1
Add your API key
Generate one for free in your dashboard. No card required, $2 in starter credit.
Open dashboardChoose a model
Pick from GPT-5, Claude, Gemini, and more. Switch per request, no separate keys.
openai/gpt-5 · anthropic/claude-sonnet-4.5 · gemini-3
That is it. You are 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://api.freeaiapikey.com/v1", # change this
api_key="your-api-key-here" # your API key
)
response = client.chat.completions.create(
model="openai/gpt-5", # any model from /models
messages=[{"role": "user", "content": "Hello!"}]
)
Example: Python (Anthropic SDK)
We fully support native Anthropic SDKs and prompt caching.
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.freeaiapikey.com", # no /v1
api_key="your-api-key-here" # your API key
)
response = client.messages.create(
model="anthropic/claude-sonnet-4.5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}]
)
Example: cURL
curl https://api.freeaiapikey.com/v1/chat/completions \
-H "Authorization: Bearer your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"model": "openai/gpt-5", "messages": [{"role": "user", "content": "Hello!"}]}'
Integrations
Our API works with any tool that supports OpenAI-compatible endpoints. Pick yours.
Best for terminal-based coding. Run one command, enter your FreeAIapikey key once — the script installs Claude Code if missing and wires our endpoint automatically.
macOS / Linux / WSL:
curl -sL https://freeaiapikey.com/claude-code-setup.sh | bash
Windows PowerShell:
irm https://freeaiapikey.com/claude-code-setup.ps1 | iex
Grab your key from the dashboard, paste it when prompted, then just run claude.
Manual setup instead
1. Install (curl -fsSL https://claude.ai/install.sh | bash, or irm https://claude.ai/install.ps1 | iex on Windows, or npm install -g @anthropic-ai/claude-code).
2. Edit settings.json (%APPDATA%\.claude\settings.json on Windows, ~/.claude/settings.json on Mac / Linux):
{
"env": {
"ANTHROPIC_API_KEY": "<your FreeAIapiKey>",
"ANTHROPIC_AUTH_TOKEN": "",
"ANTHROPIC_BASE_URL": "https://api.freeaiapikey.com"
}
}
3. Run claude.
Run one command, enter your FreeAIapiKey key once — the script installs Codex CLI if missing and wires our endpoint (Responses API, wire_api = "responses") automatically.
macOS / Linux / WSL:
curl -sL https://freeaiapikey.com/codex-setup.sh | bash
Windows PowerShell:
irm https://freeaiapikey.com/codex-setup.ps1 | iex
Grab your key from the dashboard, paste it when prompted, then just run codex.
Manual setup instead
1. Install
npm install -g @openai/codex
2. Configure (~/.codex/config.toml)
Add the FreeAIAPIKey provider to your ~/.codex/config.toml:
model = "openai/gpt-5"
model_provider = "freeaiapikey"
web_search = "disabled"
model_context_window = 128000
[features]
multi_agent = false
[model_providers.freeaiapikey]
name = "FreeAIAPIKey"
base_url = "https://api.freeaiapikey.com/v1"
env_key = "FREEAIAPIKEY_API_KEY"
wire_api = "responses"
3. Set Environment Variable
Mac / Linux:
export FREEAIAPIKEY_API_KEY="your-api-key"
Windows PowerShell:
$env:FREEAIAPIKEY_API_KEY="your-api-key"
4. Run
codex "your prompt here"
Best for VS Code users. Install the extension, add an OpenAI Compatible provider.
1. Install
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for Roo Code and click Install
2. Configure provider
- Open Roo Code in VS Code
- Click Configure Provider
- Add an OpenAI Compatible provider
| OpenAI Base URL | https://api.freeaiapikey.com/v1 |
| API Key | Your API key |
| Model | any model from /models |
Run one command, enter your FreeAIAPIKey key once — the script installs Cline if missing, wires our endpoint automatically, and launches straight to the coding agent.
macOS / Linux / WSL:
curl -sL https://freeaiapikey.com/cline-setup.sh | bash
Windows PowerShell:
irm https://freeaiapikey.com/cline-setup.ps1 | iex
Grab your key from the dashboard, paste it when prompted, then Cline launches straight to the coding agent — no login screen.
Reasoning & Thinking:
The script configures xhigh thinking by default. You can change this at runtime:
cline --thinking high
# Options: none | low | medium | high | xhigh
Run one command, enter your FreeAIAPIKey key once — the script installs OpenCode if missing, fetches all models live, and wires reasoning variants for every model automatically.
macOS / Linux / WSL:
curl -sL https://freeaiapikey.com/opencode-setup.sh | bash
Windows PowerShell:
irm https://freeaiapikey.com/opencode-setup.ps1 | iex
Grab your key from the dashboard, paste it when prompted, then run opencode.
Reasoning Variants:
All models are configured with reasoning variants. Use them at runtime like this:
opencode run --variant xhigh "your prompt"
# Options: low | medium | high | xhigh | max
Run one command, enter your FreeAIAPIKey key once — the script installs KiloCode if missing, fetches all models live, and wires reasoning variants for every model automatically.
macOS / Linux / WSL:
curl -sL https://freeaiapikey.com/kilocode-setup.sh | bash
Windows PowerShell:
irm https://freeaiapikey.com/kilocode-setup.ps1 | iex
Grab your key from the dashboard, paste it when prompted, then run kilo.
Reasoning Variants:
All models are configured with reasoning variants. Use them at runtime like this:
kilo run --variant xhigh "your prompt"
# Options: low | medium | high | xhigh | max
Run one command, enter your FreeAIAPIKey key once — the script installs Hermes if missing, wires our endpoint automatically, and launches with deep reasoning enabled.
macOS / Linux / WSL:
curl -sL https://freeaiapikey.com/hermes-setup.sh | bash
Windows PowerShell:
irm https://freeaiapikey.com/hermes-setup.ps1 | iex
Grab your key from the dashboard, paste it when prompted, then run hermes chat.
Reasoning:
The script configures xhigh reasoning by default. You can change this at runtime:
hermes chat --reasoning high
# Options: none | minimal | low | medium | high | xhigh | max | ultra
Run one command, enter your FreeAIAPIKey key once — the script installs OpenClaw if missing, fetches all models live, patches the config automatically, and launches with reasoning enabled.
macOS / Linux / WSL:
curl -sL https://freeaiapikey.com/openclaw-setup.sh | bash
Windows PowerShell:
irm https://freeaiapikey.com/openclaw-setup.ps1 | iex
Grab your key from the dashboard, paste it when prompted, then run openclaw chat.
Reasoning:
The script configures xhigh thinking by default. You can change this at runtime:
openclaw chat --thinking high
# Options: none | minimal | low | medium | high | xhigh | max | ultra
Same as Roo Code. Add an OpenAI Compatible provider.
1. Install
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for Kilo Code and click Install
2. Configure
| OpenAI Base URL | https://api.freeaiapikey.com/v1 |
| API Key | Your API key |
| Model | any model from /models |
Best for Factory AI users. Configure via ~/.factory/config.json.
1. Install
macOS / Linux:
curl -fsSL https://app.factory.ai/cli | sh
Windows:
irm https://app.factory.ai/cli | iex
2. Configure ~/.factory/config.json
{
"custom_models": [{
"model_display_name": "freeaiapikey",
"model": "<model from /models>",
"base_url": "https://api.freeaiapikey.com/v1",
"api_key": "YOUR_API_KEY",
"provider": "generic-chat-completion-api"
}]
}
Best for multi-channel AI agents. Download from openclaw.ai.
Config file
- Windows:
C:\Users\YOUR_NAME\.openclaw\openclaw.json - Mac / Linux:
~/.openclaw/openclaw.json
Configuration
{
"models": {
"providers": {
"custom": {
"baseUrl": "https://api.freeaiapikey.com/v1",
"apiKey": "YOUR_API_KEY",
"api": "openai-completions"
}
}
}
}
Best for workflow automation.
Setup
- Open n8n workflow editor
- Add an OpenAI or AI Agent node
- Configure credentials:
| Base URL | https://api.freeaiapikey.com/v1 |
| API Key | Your API key |
Don't see your tool? Our endpoint works with any OpenAI-compatible client. Set the base URL to https://api.freeaiapikey.com/v1 and use your API key.
Advanced Configuration
Detailed API reference and tool-specific integration guides below.
Quick Start
Our API is 100% OpenAI-compatible. Change the base URL and you are ready.
Three Things You Need
| Base URL |
https://api.freeaiapikey.com/v1 (OpenAI)https://api.freeaiapikey.com (Anthropic)
|
| 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://api.freeaiapikey.com/v1"
)
response = client.chat.completions.create(
model="openai/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://api.freeaiapikey.com/v1/chat/completions \
-H "Authorization: Bearer your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"model": "openai/gpt-5", "messages": [{"role": "user", "content": "Hello!"}]}'
Base URL
All OpenAI-compatible API requests should be made to:
https://api.freeaiapikey.com/v1
Anthropic Endpoints
For native Anthropic SDKs, use the root domain. Prompt caching is fully supported automatically.
https://api.freeaiapikey.com
Endpoints
/chat/completions
Create chat completions
/v1/responses
OpenAI Responses API
/models
List available models
/embeddings
Create embeddings
Chat Completions
/v1/chat/completions
Create chat completions
Request Body
{
"model": "openai/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": "openai/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
}
}
Responses API
The /v1/responses endpoint provides full support for the modern OpenAI Responses API wire format, powering agentic clients like Codex CLI as well as OpenAI SDK applications.
/v1/responses
Create a response
cURL (Non-Streaming)
curl https://api.freeaiapikey.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $FREEAIAPIKEY_API_KEY" \
-d '{
"model": "openai/gpt-5",
"input": "Explain quantum computing in one sentence."
}'
cURL (Streaming)
curl -N https://api.freeaiapikey.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $FREEAIAPIKEY_API_KEY" \
-d '{
"model": "openai/gpt-5",
"input": "Write a short poem about code.",
"stream": true
}'
Supported Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model |
string | Yes | Frontend model ID to execute (e.g. openai/gpt-5) |
input |
string | array | Yes | User input text or conversation item array (messages, tool calls, tool outputs) |
instructions |
string | No | System instructions guiding model behavior |
stream |
boolean | No | Stream response as Server-Sent Events (SSE) |
max_output_tokens |
integer | No | Maximum output tokens to generate |
temperature |
number | No | Sampling temperature (0-2) |
top_p |
number | No | Nucleus sampling probability |
tools |
array | No | Array of client tools available to the model |
tool_choice |
string | object | No | Controls tool selection (auto, none, required, or specific tool) |
parallel_tool_calls |
boolean | No | Whether to allow parallel tool invocations |
reasoning.effort |
string | No | Reasoning effort level: low, medium, or high |
text.format |
object | No | Structured output configuration: {"type": "json_object"} or {"type": "json_schema", ...} |
Tool Calling & Supported Types
The gateway supports the following tool types in Responses requests.
function: Standard OpenAI function declaration withname,description, andparametersJSON schema.namespace: Namespaced tool declarations grouped by domain or service.custom: Freeform tool contracts (e.g.apply_patch) with unstructured or custom schema definitions.local_shell: Shell execution tools used by CLI coding agents.image_generationgenerates a PNG for eligible accounts. See Image Generation.
{
"model": "openai/gpt-5",
"input": "What is the weather in Tokyo?",
"tools": [
{
"type": "function",
"name": "get_weather",
"description": "Get current weather conditions for a location.",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"}
},
"required": ["location"]
}
}
]
}
Constraints & Notes
- Stateless Bridge: The gateway operates statelessly. State-preserving parameters like
previous_response_id,conversation, andstore: trueare not stored server-side. Pass previous turns as items in theinputarray. - Hosted Server Tools: File search, code interpreter, and web search are unavailable. For coding agents, use client-executed local tools (
functionorlocal_shell). Setweb_search = "disabled"in client configs. - Reasoning Tokens: Reasoning encrypted content tokens are opaque, tamper-evident platform tokens preserving reasoning continuity across turns.
- Background Responses: Asynchronous execution (
background: true) is not supported; requests are processed synchronously with streaming or direct response.
Image Generation
Use your FreeAIapikey API key with https://api.freeaiapikey.com/v1. For a new integration, call POST /v1/images/generations with gpt-image-2 and a text prompt. Each call produces one base64-encoded PNG. Your account or workspace needs image generation access.
Save your first image
Install the Python SDK with pip install openai, then set FREEAI_API_KEY in your environment. This example saves lighthouse.png in the directory where you run it.
import base64
import os
from pathlib import Path
from openai import OpenAI
client = OpenAI(
base_url="https://api.freeaiapikey.com/v1",
api_key=os.environ["FREEAI_API_KEY"],
max_retries=0,
)
image = client.images.generate(
model="gpt-image-2",
prompt="A red lighthouse on a rocky coast in morning fog",
size="1024x1024",
quality="low",
)
Path("lighthouse.png").write_bytes(base64.b64decode(image.data[0].b64_json))
For HTTP clients, send the API key as Authorization: Bearer YOUR_API_KEY and read data[0].b64_json from the JSON response.
Use image generation from an existing integration
- Responses at
POST /v1/responsesaccepts{"model":"gpt-image-2","input":"A red lighthouse","quality":"high"}. You can also send{"type":"image_generation","quality":"high"}as a tool with a text model ID. If you supply other tools, explicitly select{"type":"image_generation"}astool_choice. Read the base64 PNG fromoutput[0].result. - Chat Completions at
POST /v1/chat/completionsaccepts{"model":"gpt-image-2","messages":[{"role":"user","content":"A red lighthouse"}],"quality":"low"}. Read the PNG data URL fromchoices[0].message.images[0].image_url.url. In the Python SDK, pass image options such asqualityinextra_body.
For SSE, set stream: true on Chat Completions or Responses. Read the finished image from choices[0].delta.images in Chat Completions or item.result in the Responses response.output_item.done event. Partial previews and image editing are unavailable. Image generation is unavailable through Anthropic Messages.
Quality, limits, and errors
highrequests are sent asmedium.low,medium,auto, and omitted quality are sent aslow. Use the returned image metadata for the applied quality and dimensions.- Daily and weekly image limits apply across endpoints and API keys on your account or workspace. Daily limits reset at midnight UTC. Weekly limits reset Monday at midnight UTC.
- A
403can indicate your plan or workspace lacks access. For429, check the error message andRetry-After. The gateway allows up to three retries within one three-minute deadline for upstream rate limits, confirmed capacity rejections, and connection failures before sending the request. Timeouts and uncertain outcomes return immediately with the available error details. A manual retry after a timeout can generate a second image.
Streaming Responses
Enable streaming by setting stream: true:
response = client.chat.completions.create(
model="openai/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="")
Free Models
We offer a selection of free models so you can explore the API without spending credits. Free models are identified by the :free suffix in their model ID.
Limited Time
Free models are available for a limited time.
We can end or change them at any time. Every free model on the models page carries a Limited time tag.
Bonus Credit Expiry
Bonus credit (the $5 setup credit, the Discord bonus and achievement rewards) expires 30 days after you claim it.
How to Use Free Models
Pass the full model ID (including the :free suffix) in your request:
response = client.chat.completions.create(
model="openai/gpt-4.1-nano:free",
messages=[{"role": "user", "content": "Hello!"}]
)
Daily Limits
Free models have a daily request cap that depends on your account. Nobody is blocked: an unverified account simply has the smallest cap.
| Account | Free-model requests per day |
|---|---|
| Active plan (Free plan included) | 1000 / day |
| Verified Discord member | 250 / day |
| Everyone else | 50 / day |
The day resets at midnight UTC. To verify Discord, join our server and verify your membership on your dashboard; it takes one minute and you only do it once.
Accounts without an active plan are also limited to 20 RPM and 1 request at a time. Plan holders keep their plan's own per-minute and concurrency limits. When you reach the daily cap you get a 429 with code daily_cap_reached.
Processing priority
For personal requests, active paid subscriptions receive subscription priority, ahead of PAYG requests using purchased credits. Free-plan allowance and other free usage use standard priority, followed by PAYG requests funded only by promotional bonus credits. Organization requests have a separate, higher priority.
PAYG priority follows the credits used for each request. Bonus credits are used first where available; an unused purchased-credit balance does not elevate a bonus-only request. A request using both purchased and bonus credits receives PAYG priority. A paid subscription keeps subscription priority when using its plan bonus tokens or wallet-funded overage.
Priority affects queue waiting when provider capacity is busy. It does not guarantee a response time or a token-generation speed; the model, request size and provider availability also affect latency. See the processing-priority comparison for a quick overview.
Availability
Free models may be removed or deactivated at any time.
We reserve the right to add, remove, or temporarily disable any free model without prior notice. Free models are provided on a best-effort basis and are not guaranteed to remain available. Check the models page for the current list of available free models.
Code Examples
Pick a language. Same response shape, same auth, same models.
from openai import OpenAI
client = OpenAI(
api_key="your-api-key-here",
base_url="https://api.freeaiapikey.com/v1"
)
# Basic completion
response = client.chat.completions.create(
model="openai/gpt-5",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
# Streaming
for chunk in client.chat.completions.create(
model="openai/gpt-5",
messages=[{"role": "user", "content": "Write a story"}],
stream=True
):
print(chunk.choices[0].delta.content or "", end="")
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'your-api-key-here',
baseURL: 'https://api.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 https://api.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!"}]
}'
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="openai/gpt-5",
openai_api_key="your-api-key-here",
openai_api_base="https://api.freeaiapikey.com/v1"
)
response = llm.invoke("Hello!")
print(response.content)
Pricing
Pay as you go. No monthly fees, no minimum spend. See live pricing for every model.
How much do you save?
| Tier | Examples | Typical savings |
|---|---|---|
| Flagship | GPT-5, Claude Opus 4.5 | ~80% |
| Standard | Claude Sonnet 4.5, Gemini 3 | ~80% |
| Budget | DeepSeek, GPT-4o | ~70-90% |
Get $2 free credit on signup. No card required. View live per-model pricing.
FAQ
General Questions
Is this API really OpenAI-compatible?
Yes. Our API uses the exact same request and response format as OpenAI. Any code or tool that works with OpenAI will work with FreeAIapiKey.
How are you able to offer 80% cheaper prices?
We use bulk purchasing, smart caching, community donations, and efficient infrastructure to keep costs low.
Is there a rate limit?
Pay-as-you-go accounts have no rate limits. Plan subscribers have limits on requests per minute and concurrent requests: Starter 100 per minute and 3 at a time, Pro 200 and 5, Max no per-minute cap and 10 at a time, Power 40 and 3. Token allowances are per 5-hour session and per week. Free models (identified by the :free suffix) are subject to fair-use limits: 50 requests per day (250 once you verify Discord, 1000 with an active plan), and 20 requests per minute with 1 concurrent request when you have no plan. See Free Models for details.
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
- Cline CLI: autonomous AI software engineer in your terminal
- OpenCode CLI: powerful open-source terminal AI workspace
- KiloCode CLI: fast terminal AI agent
- Hermes Agent: multi-modal AI agent with ultra-deep reasoning
- OpenClaw: best for multi-channel AI agents
- Roo Code / Kilo Code: best for VS Code users
- Codex CLI: best for the OpenAI ecosystem
- Droid CLI: best for Factory AI users
- n8n: best for workflow automation
Which model should I use?
- gpt-5: general purpose, best overall
- claude-opus-4.5: complex reasoning and coding
- claude-sonnet-4.5: fast and cost-efficient
- gemini-3: long context and multimodal
- deepseek-v3.2: code generation
Support
| Website | freeaiapikey.com |
| Dashboard | freeaiapikey.com/dashboard |
| Models | freeaiapikey.com/models |
| Contact | freeaiapikey.com/contact |
| Discord | discord.gg/DwSAEjP9RG |