Skip to main content
This SDK uses the compatibility endpoint. For new applications, prefer the OpenAI SDKs and the OpenAI-compatible API.
Install the Anthropic SDK.
pip install anthropic
Set base_url to https://api.freemodel.app. The SDK adds the /v1/messages path.
from anthropic import Anthropic

client = Anthropic(
    api_key="sk-xxxx",
    base_url="https://api.freemodel.app",
)

message = client.messages.create(
    model="<claude-model-id>",
    max_tokens=128,
    messages=[
        {"role": "user", "content": "Give me one API reliability tip."}
    ],
)

print(message.content[0].text)
Replace <claude-model-id> with an available model ID from GET /v1/models. FreeModel accepts the SDK’s x-api-key authentication with a FreeModel sk-... key. See Claude messages for the request format.