Skip to content
Docs

Get started

Quickstart

Three steps: create a key, add credits, and send a request with the OpenAI or Anthropic SDK you already use.

1. Create an API key

Create an account, then create a key on the API keys page. It starts with sk-libremodel- and is shown only once, so save it as an environment variable.

export LIBREMODEL_API_KEY="sk-libremodel-..."

2. Add credits

Requests are paid from prepaid credits: without credits, they get a 402. Add them on the Billing page by card or crypto. See Billing and credits.

3. Send a request

Set the base URL to https://api.libremodel.ai/v1 and pick a model from Models.

Text
Set up this project to use the Libremodel API with the model deepseek-v4.1-flash-1017.

Libremodel serves the OpenAI and Anthropic API formats:
- Base URL: https://api.libremodel.ai/v1
- Chat: POST /chat/completions (also served: OpenAI Responses at POST /responses and Anthropic Messages at POST /messages)
- Auth: read the API key from the LIBREMODEL_API_KEY environment variable. Never hard-code or commit it.

Model deepseek-v4.1-flash-1017: 1,048,576 tokens of context, up to 262,144 output tokens. Tool calling and streaming are supported.
Reasoning effort (reasoning_effort): off, low, high, max (default high).

1. Use the OpenAI SDK if this project already has it; otherwise add the official one for its language.
2. Add a small client that sends a chat request to deepseek-v4.1-flash-1017 and returns the reply text.
3. Add LIBREMODEL_API_KEY to the example env file if there is one, then show me how to send one test request.

Full API reference: https://libremodel.ai/llms.txt

With the Anthropic SDK, pass the base URL without /v1 (https://api.libremodel.ai). The SDK adds /v1/messages itself.

curl https://api.libremodel.ai/v1/messages \
  -H "x-api-key: $LIBREMODEL_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash-1017",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello, Libremodel"}]
  }'

Endpoints

EndpointURL / Method
Base URLhttps://api.libremodel.ai/v1
Chat CompletionsPOST /chat/completions
ResponsesPOST /responses
Anthropic MessagesPOST /messages
List modelsGET /models
AuthenticationAuthorization: Bearer $LIBREMODEL_API_KEY or x-api-key: $LIBREMODEL_API_KEY

Every path is relative to the base URL, which ends in /v1. A path without /v1 returns 404.