Anthropic API
FreeGate exposes POST /v1/messages with the Anthropic Messages shape. Anthropic
clients can point their base URL at FreeGate and use any model in the catalog.
Authentication
Use the same FreeGate key as the OpenAI endpoints. Anthropic clients send it as
x-api-key. Bearer authentication is also accepted.
Request
curl https://api.firesafety.men/v1/messages \
-H "x-api-key: $FREEGATE_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "oss-20b",
"max_tokens": 256,
"messages": [{ "role": "user", "content": "Say hello in five words." }]
}' SDK
Set baseURL to https://api.firesafety.men. The SDK appends
/v1/messages automatically.
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.firesafety.men",
apiKey: process.env.FREEGATE_API_KEY,
});
const message = await client.messages.create({
model: "oss-20b",
max_tokens: 256,
messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(message.content); Supported models
Every model in GET /v1/models works on this endpoint. FreeGate translates
between Anthropic Messages and the model's OpenAI-compatible upstream, including streaming
and tool calls. Usage draws from the same weekly API budget as every other request.
Claude Desktop
Claude Desktop can use FreeGate through its third-party inference mode. Enable Developer Mode first: open Help, then Troubleshooting, then Enable Developer Mode.
Open Developer, then Configure Third-Party Inference. Choose Gateway and enter:
- Gateway base URL:
https://api.firesafety.men - Gateway API key: your
fg_live_key - Auth scheme:
bearer - Credential kind: Static API key
Apply the settings, fully quit Claude Desktop, and reopen it. Choose
Continue with Gateway. The model picker shows the real FreeGate model
behind each Claude slot: by default Muse Spark 1.3 Contributor, GLM 5.3 Flash, DeepSeek V4
Flash, and Kimi K2.7 Code. The operator can remap each slot in the admin console. If the picker is empty, confirm the base URL has no /v1 suffix,
then fully quit and reopen Claude Desktop. The manual configuration below is the fallback.
Claude Desktop manual configuration
If the model picker does not accept the gateway, use Claude Desktop's manual gateway
files. Locate the Claude-3p directory:
- macOS:
~/Library/Application Support/Claude-3p/ - Linux:
~/.config/Claude-3p/ - Windows:
%LOCALAPPDATA%\Claude-3p\ - Windows Store:
%LOCALAPPDATA%\Packages\Claude_*\LocalCache\Roaming\Claude-3p\
Create claude_desktop_config.json inside that directory:
{
"deploymentMode": "3p"
}
Create configLibrary/00000000-0000-4000-8000-000000000114.json:
{
"inferenceProvider": "gateway",
"inferenceCredentialKind": "static",
"inferenceGatewayApiKey": "fg_live_your_key",
"inferenceGatewayAuthScheme": "bearer",
"inferenceGatewayBaseUrl": "https://api.firesafety.men",
"claudeAiImport": {
"enabled": true
},
"inferenceModels": [
{
"name": "claude-sonnet-4-5",
"labelOverride": "Claude Sonnet 4.5 via FreeGate"
}
]
}
Create configLibrary/_meta.json:
{
"appliedId": "00000000-0000-4000-8000-000000000114",
"entries": [
{
"id": "00000000-0000-4000-8000-000000000114",
"name": "claude-sonnet-4-5"
}
]
}
The local configuration file also controls Claude import. If Settings shows that import
is disabled, add claudeAiImport.enabled to the active
configLibrary file, fully quit Claude Desktop, and reopen it.
Fully quit Claude Desktop, then reopen it. Select the gateway model from the picker.
To revert, remove deploymentMode and delete the configLibrary
directory.
Claude Desktop model ids such as claude-sonnet-4-5,
claude-sonnet-4-20250514, claude-3-5-sonnet-20241022,
claude-3-opus-20240229, claude-sonnet-4-6,
claude-sonnet-5, claude-sonnet-5-5, and
claude-opus-5-5 resolve to their slot's mapped FreeGate model: by default
claude-sonnet-4-5 → muse-spark-13,
claude-sonnet-5 → glm-53-flash,
claude-sonnet-5-5 → dd-v4-flash, and
claude-opus-5-5 → kimi-k27. Use the FreeGate model id directly if
your client accepts it.
Claude Desktop's embedded Claude Code may cap context at 200,000 tokens. Web search, billing, and other Anthropic-cloud features are unavailable in gateway mode.
Compatibility
- Streaming is translated to Anthropic message events with usage preserved.
- Tool use, tool results, images and system blocks are translated to the model's API.
- Prompt cache reads are billed at the model's cache rate.
- Models without vision reject image blocks with a validation error.