RedLine API
One gateway, two wire formats. Use the Anthropic Messages API or the OpenAI Chat Completions API with uncensored open-weight models.
Overview
| Format | Base URL | Endpoint |
|---|---|---|
| Anthropic | https://api.redlineinference.com | POST /v1/messages |
| OpenAI | https://api.redlineinference.com/v1 | POST /chat/completions |
Request and response bodies follow each provider's format, so official SDKs and tools work unchanged.
Quickstart
- Create an account and choose a plan. Every plan includes credits each month.
- Create an API key in Console → API keys. Copy it; it is shown only once.
- 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-…
Models
| Model ID | Context | Input | Output | Cache read | Cache write |
|---|---|---|---|---|---|
deepseek-v4-1-flash-1017-1m | 1,048,576 | $8.00 | $16.00 | $0.80 | $8.00 |
glm-5-3-uncensored | 262,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/messagesAnthropic 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/completionsOpenAI 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_tokensReturns the input token count for a Messages request without running it. Free of charge.
List models
GET /v1/modelsReturns 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.
| Status | Type | Meaning |
|---|---|---|
| 400 | invalid_request_error | Malformed JSON or an unknown model ID. |
| 401 | authentication_error | Missing, invalid, revoked or expired API key. |
| 402 | billing_error | Your account is out of credits, your membership is inactive, or the key reached its spend limit. |
| 403 | permission_error | The key is not allowed to use the requested model. |
| 429 | rate_limit_error | The key exceeded its requests-per-minute limit. |
| 502 | api_error | The model did not respond after retries. Safe to retry. |
Limits
- Rate limit: 60 requests per minute per key. Use more keys for more throughput.
- Keys: up to 10 active keys per account.
- Per-key controls: optional spend limit, expiration and allowed models, set when you create the key.
- Retries: RedLine retries transient upstream errors for you before returning a response.
Billing
RedLine has two parts:
- Plans: Starter $50/month with $30 in credits, Pro $100/month with $75 and Scale $250/month with $200. Each monthly charge adds the plan's credits to your balance, and unused credits roll over. Change or cancel your plan from Console → Credits: upgrades take effect immediately with a new monthly period, downgrades at the end of the current one.
- Credits: extra credits can be added at any amount. Each request is charged from your prepaid balance using the token counts the model reports (input, output including reasoning, cache reads and cache writes) at the prices above. All keys share one balance.
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.