Documentation

API reference

ForgeAPI exposes an OpenAI-compatible API. If your code already talks to OpenAI, pointing it at ForgeAPI takes one line.

Quickstart

Every request needs an API key. Create one free in the console โ€” no credit card required.

Base URL

Base URL
https://api.forgeapi.dev/v1

curl

curl
curl https://api.forgeapi.dev/v1/chat/completions \
  -H "Authorization: Bearer $FORGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [{"role": "user", "content": "Explain APIs in one sentence."}],
    "max_tokens": 64
  }'

Python (OpenAI SDK)

python
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["FORGE_API_KEY"],
    base_url="https://api.forgeapi.dev/v1",
)

resp = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)

Node.js (OpenAI SDK)

node
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.FORGE_API_KEY,
  baseURL: "https://api.forgeapi.dev/v1",
});

const resp = await client.chat.completions.create({
  model: "deepseek-v4-flash",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);

Authentication

Authenticate with a bearer token in the Authorization header. Keys are created in the console and never exposed again after creation.

Header
Authorization: Bearer sk-forge-<your-key>
๐Ÿ’ก Use separate keys per environment or per product. Set a spend limit per key in the console so one leaked key can never drain your balance.

Endpoints

POST/v1/chat/completionsChat completions (streaming & non-streaming)
POST/v1/completionsLegacy text completions
POST/v1/embeddingsEmbeddings
GET/v1/modelsList available models
GET/v1/models/{id}Get model details
GET/v1/billing/usageCurrent account balance & usage

Request and response bodies follow the OpenAI chat completions schema exactly, including stream: true (SSE) support.

Models

Use GET /v1/models for the live list. Current catalog:

Model IDContextNotes
deepseek-v4-flash128KDefault recommendation for most apps
deepseek-v4-pro128KReasoning-heavy tasks
kimi-3256KLong-document understanding
qwen-3-235b256KTop-tier open-weight general model
llama-3.3-70b128KSolid workhorse with tool-calling
qwen-3-8b32KFree tier, rate-limited

Migration guide

Migrating from OpenAI or Anthropic is a base-URL change in most cases:

OpenAI SDK โ†’ ForgeAPI

python โ€” before / after
# Before (OpenAI)
client = OpenAI(api_key=OPENAI_KEY)
# โ†’ model: gpt-4o

# After (ForgeAPI)
client = OpenAI(api_key=FORGE_API_KEY, base_url="https://api.forgeapi.dev/v1")
# โ†’ model: deepseek-v4-flash

Anthropic SDK โ†’ ForgeAPI

python โ€” Anthropic โ†’ OpenAI format
from anthropic import Anthropic

# Map your anthropic calls to the OpenAI-compatible endpoint:
client = OpenAI(
    api_key=os.environ["FORGE_API_KEY"],
    base_url="https://api.forgeapi.dev/v1",
)
# system: "You are..."   โ†’  messages: [{"role": "system", ...}]
# max_tokens: 4096       โ†’  max_tokens: 4096  (unchanged)
๐Ÿšง Anthropic-format endpoints (/v1/messages) are on the roadmap โ€” get in touch if you need it before the public release.

Errors

ForgeAPI uses OpenAI-compatible error responses: {"error": {"type": ..., "message": ...}}

CodeTypeMeaning
400invalid_request_errorMalformed request or unknown parameter
401authentication_errorMissing or invalid API key
402insufficient_quotaBalance depleted or key spend limit reached
404model_not_foundModel ID doesn't exist in the catalog
429rate_limit_errorFree tier rate limit or too many requests
503server_errorUpstream inference node unavailable โ€” retry with backoff

All calls return a Retry-After header on 429, and we send a warning header when you approach a spend limit.