Skip to main content
This is a compatibility endpoint for existing Anthropic-style integrations. For new integrations, use the OpenAI-compatible API.
POST https://api.freemodel.app/v1/messages Choose a Claude-compatible model ID returned by GET /v1/models.

Create a message

FreeModel accepts a standard Bearer key. Integrations that send an x-api-key header can also use a FreeModel sk-... key.
curl https://api.freemodel.app/v1/messages \
  -H "Authorization: Bearer sk-xxxx" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<claude-model-id>",
    "max_tokens": 128,
    "messages": [
      {
        "role": "user",
        "content": "Explain what an API gateway does in one sentence."
      }
    ]
  }'
Response
{
  "id": "msg_01HXYZ",
  "type": "message",
  "role": "assistant",
  "model": "<claude-model-id>",
  "content": [
    {
      "type": "text",
      "text": "An API gateway gives clients one interface for routing requests to backend services."
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 12,
    "output_tokens": 15
  }
}

Request body

FieldTypeRequiredDescription
modelstringYesA Claude-compatible model ID available to your key.
messagesarrayYesAnthropic-style conversation messages.
max_tokensintegerYesMaximum tokens to generate.
streambooleanNoSet to true when your client expects an event stream.
temperaturenumberNoSampling variation when supported by the selected model.
With an Anthropic SDK, set its base URL to https://api.freemodel.app. See Anthropic SDK.