RedLine

RedLine API

One gateway, two wire formats. Use the Anthropic Messages API or the OpenAI Chat Completions API with uncensored open-weight models.

Overview

FormatBase URLEndpoint
Anthropichttps://api.redlineinference.comPOST /v1/messages
OpenAIhttps://api.redlineinference.com/v1POST /chat/completions

Request and response bodies follow each provider's format, so official SDKs and tools work unchanged.

Quickstart

  1. Create an account and choose a plan. Every plan includes credits each month.
  2. Create an API key in Console → API keys. Copy it; it is shown only once.
  3. Point your client at RedLine.

Claude Code

# ~/.zshrc or ~/.bashrc
export ANTHROPIC_BASE_URL="https://api.redlineinference.com"
export ANTHROPIC_API_KEY="sk-rl-…"
export ANTHROPIC_MODEL="deepseek-v4-1-flash-1017-1m"
export ANTHROPIC_SMALL_FAST_MODEL="deepseek-v4-1-flash-1017-1m"

Codex CLI

# ~/.codex/config.toml
model = "deepseek-v4-1-flash-1017-1m"
model_provider = "redline"

[model_providers.redline]
name = "RedLine"
base_url = "https://api.redlineinference.com/v1"
env_key = "REDLINE_API_KEY"

Python (Anthropic SDK)

import anthropic

client = anthropic.Anthropic(base_url="https://api.redlineinference.com", api_key="sk-rl-…")
msg = client.messages.create(
    model="deepseek-v4-1-flash-1017-1m",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content)

Authentication

Send your key in either header. Both work on every endpoint.

x-api-key: sk-rl-…
Authorization: Bearer sk-rl-…
Keys are stored only as SHA-256 hashes. If you lose one, rotate it in the console. Revoked and rotated keys stop working immediately.

Models

Model IDContextInputOutputCache readCache write
deepseek-v4-1-flash-1017-1m1,048,576$8.00$16.00$0.80$8.00
glm-5-3-uncensored262,144$8.00$24.00$0.80$8.00

Prices are USD per million tokens. Any model ID starting with claude- is routed to deepseek-v4-1-flash-1017-1m, so clients with hard-coded Claude model names keep working.

Messages

POST /v1/messages

Anthropic Messages format. Supports system prompts, multi-turn conversations, tool use, prompt caching and streaming. The anthropic-version and anthropic-beta headers are passed through.

curl https://api.redlineinference.com/v1/messages \
  -H "x-api-key: $REDLINE_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "deepseek-v4-1-flash-1017-1m", "max_tokens": 1024,
       "messages": [{"role": "user", "content": "Hello"}]}'

Chat Completions

POST /v1/chat/completions

OpenAI Chat Completions format, including tools and streaming. Reasoning is returned in message.reasoning where the model provides it.

curl https://api.redlineinference.com/v1/chat/completions \
  -H "Authorization: Bearer $REDLINE_API_KEY" \
  -H "content-type: application/json" \
  -d '{"model": "glm-5-3-uncensored",
       "messages": [{"role": "user", "content": "Hello"}]}'

Streaming

Set "stream": true on either endpoint to receive server-sent events in that format. On Chat Completions, RedLine turns on stream_options.include_usage so the final chunk carries token usage; ignore chunks with an empty choices array if your client does not expect them.

If you disconnect mid-stream, you are billed only for the tokens generated up to that point.

Token counting

POST /v1/messages/count_tokens

Returns the input token count for a Messages request without running it. Free of charge.

List models

GET /v1/models

Returns the available model IDs in OpenAI list format.

Errors

Errors use the format of the endpoint you called: {"type": "error", "error": {…}} for Messages, {"error": {…}} for Chat Completions.

StatusTypeMeaning
400invalid_request_errorMalformed JSON or an unknown model ID.
401authentication_errorMissing, invalid, revoked or expired API key.
402billing_errorYour account is out of credits, your membership is inactive, or the key reached its spend limit.
403permission_errorThe key is not allowed to use the requested model.
429rate_limit_errorThe key exceeded its requests-per-minute limit.
502api_errorThe model did not respond after retries. Safe to retry.

Limits

Billing

RedLine has two parts:

Requests return 402 when your balance reaches $0 or your membership is inactive. Usage appears in the console within seconds.

Data handling

RedLine does not log or store prompts or responses. We record only metadata: time, key, model, token counts and cost. Read the Zero Data Retention Policy for details.