Skip to main content

Anthropic-compatible API

Beta

Use Anthropic SDKs and Anthropic-native tools with Nebula through the Messages API. In beta.

On this page

The Messages API accepts Anthropic’s request format and returns Anthropic’s responses and stream events. It runs on the same gateway as chat completions, so scopes, rate limits, the credit check, idempotency and metering behave identically.

POST /api/v1/llm/v1/messages Beta
Create a message. Supports stream and Idempotency-Key.

Scope: llm:access or llm:chat

POST /api/v1/llm/v1/messages/count_tokens Beta
Estimate input tokens. Free, rate limited like chat.

Scope: llm:access or llm:chat

Configure a client

Anthropic SDKs take the base URL without the trailing /v1; they add /v1/messages themselves.

Setting Value
Base URL https://api.breachline.io/api/v1/llm
API key Your bl_live_ key, sent as x-api-key (or Authorization: Bearer)
Model nebula-4.5

Python

Python (Anthropic SDK)
import os
import anthropic

client = anthropic.Anthropic(
    api_key=os.environ["BREACHLINE_API_KEY"],
    base_url="https://api.breachline.io/api/v1/llm",
)

message = client.messages.create(
    model="nebula-4.5",
    max_tokens=1024,
    system="You are a concise security assistant.",
    messages=[{"role": "user", "content": "Summarise the risk of a missing Content-Security-Policy header."}],
)
print(message.content[0].text)

TypeScript

TypeScript (Anthropic SDK)
import Anthropic from '@anthropic-ai/sdk';

const client = new Anthropic({
  apiKey: process.env.BREACHLINE_API_KEY,
  baseURL: 'https://api.breachline.io/api/v1/llm',
});

const message = await client.messages.create({
  model: 'nebula-4.5',
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Summarise the risk of a missing Content-Security-Policy header.' }],
});

cURL

cURL
curl https://api.breachline.io/api/v1/llm/v1/messages \
  -H "x-api-key: $BREACHLINE_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nebula-4.5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Summarise the risk of a missing Content-Security-Policy header."}]
  }'

Environment

Anthropic-native tools
export ANTHROPIC_BASE_URL="https://api.breachline.io/api/v1/llm"
export ANTHROPIC_API_KEY="$BREACHLINE_API_KEY"

Supported features

Feature Support
Text, images (base64 or URL) Supported. Images must be JPEG, PNG, GIF or WebP.
Documents Inline only: base64 PDF, plain text or content blocks.
Custom tools, tool_use, tool_result Supported. tool_choice accepts auto, any, tool and none, and honours disable_parallel_tool_use.
thinking enabled, adaptive or disabled, with optional budget_tokens and display.
output_config effort (low, medium, high, xhigh, max) and format (json_schema).
system, stop_sequences (up to 16), metadata Supported.
temperature, top_p 0 to 1.
stream Anthropic stream events, including ping.

Refused rather than ignored

Features that would change behaviour without warning are rejected with 400 instead of being silently dropped:

  • Server tools, such as web search and code execution.
  • mcp_servers and container.
  • Document sources BreachLine would have to fetch (url or file).

These are accepted and have no effect: top_k, cache_control, service_tier, context_management, and the anthropic-version header.

Usage and errors

  • Usage follows Anthropic’s convention: input_tokens excludes cache reads and writes, which are reported as cache_read_input_tokens and cache_creation_input_tokens.
  • Stop reasons are end_turn, max_tokens, stop_sequence, tool_use and refusal.
  • Errors use Anthropic’s envelope with the same HTTP status. A prompt that is too long starts its message with prompt is too long, so clients that compact their context on overflow can recover. See Errors.

Counting tokens

count_tokens returns an estimate of about 4 characters per token over the translated request. Requests are routed across engines with different tokenizers, so no single exact count exists. Bodies over 4 MiB get 413.

Search documentation

Type to search guides, the API reference, the CLI and the console guide.

    Enter open↑ ↓ moveEsc close