NewHow we catch a seller listing the wrong model, and refund you if one does.

Anthropic SDK

MartLLM exposes an Anthropic-compatible Messages API at /v1/messages. Point the official anthropic SDK at MartLLM by setting its base URL, and you can call any model in the catalog through the Anthropic wire format — not just Anthropic models. MartLLM translates between the Anthropic and OpenAI shapes in its own gateway, including streaming.

  • Base URL: https://api.martllm.com
  • Endpoint: POST /v1/messages
  • Auth: your ull_ key

The Anthropic SDK sends the key in the x-api-key header; MartLLM also accepts Authorization: Bearer ull_.... Either works.

Python

import os
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.martllm.com",
    api_key=os.environ["UBERLLM_API_KEY"],
)

msg = client.messages.create(
    model="deepseek/deepseek-v4-flash",
    max_tokens=256,
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(msg.content[0].text)

Streaming

with client.messages.stream(
    model="deepseek/deepseek-v4-flash",
    max_tokens=256,
    messages=[{"role": "user", "content": "Count to five."}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

TypeScript / JavaScript

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://api.martllm.com",
  apiKey: process.env.UBERLLM_API_KEY,
});

const msg = await client.messages.create({
  model: "deepseek/deepseek-v4-flash",
  max_tokens: 256,
  messages: [{ role: "user", content: "Say hello in one sentence." }],
});
console.log(msg.content[0].type === "text" ? msg.content[0].text : "");

curl

curl -N https://api.martllm.com/v1/messages \
  -H "x-api-key: $UBERLLM_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4-flash",
    "max_tokens": 256,
    "stream": true,
    "messages": [{"role": "user", "content": "Say hello."}]
  }'

Notes

  • max_tokens is required by the Anthropic Messages API — include it.
  • Models think only when you ask, as on Anthropic's API: send "thinking": {"type": "enabled", "budget_tokens": 2000} (or "adaptive"). Without it, reasoning models such as DeepSeek answer directly, faster, and a small max_tokens is never used up by thinking. A few models cannot turn thinking off; they think either way.
  • System prompts use the top-level system field, as in the native Anthropic API; MartLLM maps it to the target model correctly.
  • Anthropic models are billed like any other model: what the provider charged, with no MartLLM fee added. See Pricing.
  • If your framework only speaks OpenAI, use the OpenAI SDK instead. Both surfaces reach the same models and use the same billing.