Skip to content
OpenAI + Anthropic compatible

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.

~/projects/quickstart.py
python
# 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.

STEP 01

Change base URL

Point your OpenAI client at our endpoint instead of api.openai.com.

https://api.freeaiapikey.com/v1
STEP 02

Add your API key

Generate one for free in your dashboard. No card required, $2 in starter credit.

Open dashboard
STEP 03

Choose 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

See all models

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.

Claude Code CLI
1-line setup with your API key.
setup=1-line script

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.

Codex CLI CLI
OpenAI's Codex CLI with custom providers via Responses API.
setup=1-line script

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"
Roo Code Editor
VS Code extension for AI-assisted coding.
base_url=https://api.freeaiapikey.com/v1

Best for VS Code users. Install the extension, add an OpenAI Compatible provider.

1. Install

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for Roo Code and click Install

2. Configure provider

  1. Open Roo Code in VS Code
  2. Click Configure Provider
  3. Add an OpenAI Compatible provider
OpenAI Base URLhttps://api.freeaiapikey.com/v1
API KeyYour API key
Modelany model from /models
Cline CLI CLI
Autonomous AI software engineer.
setup=1-line script

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
OpenCode CLI CLI
Terminal AI workspace.
setup=1-line script

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
KiloCode CLI CLI
Fast Terminal AI Agent.
setup=1-line script

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
Hermes Agent CLI
Multi-modal AI agent CLI.
setup=1-line script

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
OpenClaw CLI
Multi-channel AI agent framework.
setup=1-line script

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
Kilo Code Editor
Powerful VS Code extension for AI coding.
base_url=https://api.freeaiapikey.com/v1

Same as Roo Code. Add an OpenAI Compatible provider.

1. Install

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for Kilo Code and click Install

2. Configure

OpenAI Base URLhttps://api.freeaiapikey.com/v1
API KeyYour API key
Modelany model from /models
Droid CLI CLI
Terminal-based AI assistant from Factory AI.
base_url=https://api.freeaiapikey.com/v1

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"
  }]
}
OpenClaw Agent
AI agent framework for Telegram, Discord, and more.
baseUrl=https://api.freeaiapikey.com/v1

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"
      }
    }
  }
}
n8n Automation
Workflow automation with OpenAI nodes.
base_url=https://api.freeaiapikey.com/v1

Best for workflow automation.

Setup

  1. Open n8n workflow editor
  2. Add an OpenAI or AI Agent node
  3. Configure credentials:
Base URLhttps://api.freeaiapikey.com/v1
API KeyYour 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

  1. Visit freeaiapikey.com/dashboard
  2. Sign up or log in
  3. 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

POST /chat/completions Create chat completions
POST /v1/responses OpenAI Responses API
GET /models List available models
POST /embeddings Create embeddings

Chat Completions

POST /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.

POST /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 four tool types in Responses requests:

  • function: Standard OpenAI function declaration with name, description, and parameters JSON 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.
{
  "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, and store: true are not stored server-side. Pass previous turns as items in the input array.
  • Hosted Server Tools: Server-hosted tools (OpenAI file search, code interpreter, image generation, web search) are not supported. For coding agents, use client-executed local tools (function or local_shell). Set web_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.

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.

Verified Account Required

Free models need a verified account.

Answer the two setup questions on the setup page (it also gives you $5 in credit) or verify your Discord membership on your dashboard. You only do this once. Unverified accounts that call a free model get a 403 error with type telegram_verification_required (the name is kept so existing clients keep working).

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!"}]
)

Rate Limits

Free models are subject to per-user rate limits to ensure fair access for everyone. These limits apply to all users without an active paid plan.

Limit Value Description
Requests per minute 20 RPM Maximum 20 requests per minute per user
Concurrent requests 1 One request at a time per user
Daily request cap 50 / day Maximum 50 requests per day, resets at midnight UTC

Paid plan subscribers are not subject to free-model rate limits. Upgrade to a plan for unlimited access.

Non-Priority Processing

Free model requests are processed on a non-priority basis. During periods of high server load, streaming responses on free models may experience slower token delivery compared to paid models. This is because paid requests are prioritized in the processing queue.

If you need consistent, low-latency responses, we recommend switching to a paid model or subscribing to a plan for priority processing.

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

Q 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.

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?

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: 20 requests per minute, 1 concurrent request, and 50 requests per day. See Free Models for details.

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
  • 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

Get started in 30 seconds

Free $2 credit on signup. No card, no rate limits, no monthly fees.