API

API quickstart

Create an API key and send your first MaxLabs request.

Before you start

You need a MaxLabs account, an active plan or available quota, and an API key. Select the personal or company account that should pay for usage before you create the key.

Store the key in an environment variable. Never put it in source code or a browser application.

export MAXLABS_API_KEY=your_api_key
export MAXLABS_BASE_URL=https://api.maxlabs.ai/v1

Send a request

curl "$MAXLABS_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $MAXLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "worker",
    "messages": [
      {"role": "user", "content": "Explain why idempotency matters in one paragraph."}
    ]
  }'

Read the answer from choices[0].message.content. Save the X-Censi-Request-Id response header when you log requests. Support can use it to trace a failed request.

Next steps

Call GET /models before you hard-code a model. Add streaming for interactive interfaces. Add an idempotency key when an automatic retry could otherwise create a second paid request.