# Quickstart

MartLLM is one API endpoint for every model in its catalog. It accepts the
**OpenAI** and **Anthropic** wire formats, so most tools and SDKs work after you
set the base URL and a MartLLM API key.

- OpenAI-compatible base URL: `https://api.martllm.com/v1`
- Anthropic-compatible base URL: `https://api.martllm.com` (endpoint `/v1/messages`)

## 1. Get your API key

1. Sign up at [martllm.com](https://martllm.com). Your first key is made for
   you and shown at the top of the dashboard, with a first call you can paste.
2. Copy the key: it is shown until you press **I've copied it**, then never
   again. Keys look like `ull_` followed by 43 characters (`ull_R7f2...`).
   Store it in an environment variable, never in source control.
3. Need another key, or lost this one? Open **Dashboard → API keys**, click
   **Create key**, and (optionally) set a spend limit or per-minute rate limit.

```bash
export MARTLLM_API_KEY="ull_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
```

## 2. Add credits

Inference is prepaid and new accounts start at $0. Open **Dashboard → Credits**
and top up by card or PayPal (minimum $5). Each call is sent to an available third-party provider and billed what
that provider charged. MartLLM adds no fee to calls. A card fee
of 5.5% + $0.50 is added when you pay; your credit is the exact amount you pick. See [Pricing](./pricing).

## 3. Make your first call

Point any OpenAI-compatible client at `https://api.martllm.com/v1` with your
`ull_` key as the API key.

### curl (streaming)

```bash
curl -N https://api.martllm.com/v1/chat/completions \
  -H "Authorization: Bearer $MARTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4-flash",
    "stream": true,
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'
```

### Python (official `openai` SDK)

```python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.martllm.com/v1",
    api_key=os.environ["MARTLLM_API_KEY"],
)

stream = client.chat.completions.create(
    model="deepseek/deepseek-v4-flash",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="", flush=True)
```

### TypeScript (official `openai` SDK)

```ts
import OpenAI from "openai";

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

const stream = await client.chat.completions.create({
  model: "deepseek/deepseek-v4-flash",
  messages: [{ role: "user", content: "Say hello in one sentence." }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}
```

## 4. Confirm it worked

Open **Dashboard → Activity**. You will see the request logged with the model,
the provider it was routed to, token counts, latency, and the exact cost
deducted from your balance.

## Next steps

- [OpenAI SDK drop-in](./openai-sdk) — full guide including non-streaming, tools.
- [Anthropic SDK](./anthropic-sdk) — use `client.messages` against `/v1/messages`.
- [Models & routing](./models-and-routing) — model ids, automatic retries, and
  routing options.
- Editor integrations: [Cursor](./cursor), [Cline](./cline), [Roo Code](./roo),
  [Aider](./aider), [Continue](./continue).
- Frameworks: [LangChain](./langchain), [Vercel AI SDK](./ai-sdk).
