# Quickstart

Create an account and API key, choose a model, then send and stream a request with an OpenAI SDK or curl.

## 1. Create an account and API key.

Create your account and sign in. Use an API key—not your account session—to authenticate API requests.

- Create a Blaschke account with a verified email, then sign in.
- In your account, open the API keys section and select “Create key.” Give the key a name and create it. Copy the complete key when it appears and store it securely; you won’t be able to view it again. Blaschke API keys begin with `blsk_`.

**Protect your key.** Never commit the key, include it in browser code, or paste it into prompts or screenshots. If it is exposed, revoke it and create a replacement.

## 2. Set your environment and select a model.

List available models, then export your API key and the exact model ID you want to use. The examples read both variables from your environment.

### Configure your environment

```shell
export BLASCHKE_API_KEY="blsk_..."
export BLASCHKE_MODEL="<exact-model-id>"
```

### List available models

```shell
curl --fail --silent --show-error https://beta.blaschkelabs.com/v1/models \
  -H "Authorization: Bearer $BLASCHKE_API_KEY"
```

Copy an `id` returned by `GET /v1/models` into `BLASCHKE_MODEL`. Use an Available model, not an Upcoming catalog entry.

## 3. Send a request.

Use `POST /v1/chat/completions` with an OpenAI SDK or curl. The SDK examples disable automatic retries, and each example sets `max_tokens` to 256.

### Python

Install:

```shell
python -m pip install openai
```

main.py

```python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://beta.blaschkelabs.com/v1",
    api_key=os.environ["BLASCHKE_API_KEY"],
    max_retries=0,
)

response = client.chat.completions.create(
    model=os.environ["BLASCHKE_MODEL"],
    messages=[{"role": "user", "content": "Explain Blaschke in two sentences."}],
    max_tokens=256,
)

print(response.model)
print(response.choices[0].message.content)
```

### JavaScript

Install:

```shell
npm install openai
```

main.mjs

```javascript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://beta.blaschkelabs.com/v1",
  apiKey: process.env.BLASCHKE_API_KEY,
  maxRetries: 0,
});

const response = await client.chat.completions.create({
  model: process.env.BLASCHKE_MODEL,
  messages: [{ role: "user", content: "Explain Blaschke in two sentences." }],
  max_tokens: 256,
});

console.log(response.model);
console.log(response.choices[0]?.message.content);
```

### curl

request.sh

```shell
curl https://beta.blaschkelabs.com/v1/chat/completions \
  -H "Authorization: Bearer $BLASCHKE_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<JSON
{
    "model": "$BLASCHKE_MODEL",
    "messages": [
      {"role": "user", "content": "Explain Blaschke in two sentences."}
    ],
    "max_tokens": 256
}
JSON
```

Check that the returned model matches your selection.

## 4. Stream the answer.

Set `stream: true` for server-sent events. Add `stream_options.include_usage: true` to request token usage at the end. The final usage event may contain no text.

### Python

stream.py

```python
from openai import OpenAI
import os

client = OpenAI(
    base_url="https://beta.blaschkelabs.com/v1",
    api_key=os.environ["BLASCHKE_API_KEY"],
)

stream = client.chat.completions.create(
    model=os.environ["BLASCHKE_MODEL"],
    messages=[{"role": "user", "content": "What is a Blaschke product?"}],
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in stream:
    if chunk.choices:
        delta = chunk.choices[0].delta.content or ""
        print(delta, end="", flush=True)
    if chunk.usage:
        print("\nUsage:", chunk.usage)
```

### JavaScript

stream.mjs

```javascript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://beta.blaschkelabs.com/v1",
  apiKey: process.env.BLASCHKE_API_KEY,
});

const stream = await client.chat.completions.create({
  model: process.env.BLASCHKE_MODEL,
  messages: [{ role: "user", content: "What is a Blaschke product?" }],
  stream: true,
  stream_options: { include_usage: true },
});

for await (const chunk of stream) {
  const text = chunk.choices[0]?.delta.content;
  if (text) process.stdout.write(text);
  if (chunk.usage) console.log("\nUsage:", chunk.usage);
}
```

### curl

stream.sh

```shell
curl https://beta.blaschkelabs.com/v1/chat/completions \
  -H "Authorization: Bearer $BLASCHKE_API_KEY" \
  -H "Content-Type: application/json" \
   -d @- <<JSON
{
    "model": "$BLASCHKE_MODEL",
    "messages": [
      {"role": "system", "content": "You are a concise, helpful assistant."},
      {"role": "user", "content": "Explain what a Blaschke product is."}
    ],
    "stream": true,
    "stream_options": {"include_usage": true}
}
JSON
```

## Related guides

- [Choose a model](https://beta.blaschkelabs.com/docs/models): Review exact IDs and model-specific limits.
- [Connect a coding agent](https://beta.blaschkelabs.com/docs/agents/coding-agents): Pi, Cursor, Claude Code, Codex and OpenCode.
- [Call your own functions](https://beta.blaschkelabs.com/docs/tools): Learn the complete tool-call and result loop.

Source: https://beta.blaschkelabs.com/docs/quickstart

Markdown: https://beta.blaschkelabs.com/docs/md/quickstart.md
