LaminarityDocs
View agent text
Integration guide

Quickstart

Make an authenticated request, understand `auto`, and inspect the selected provider.

Read this guide as Markdown

1. Create a project key

Create an API key in the Laminarity dashboard and store it as LAMINARITY_API_KEY. Keys are shown once and must only be used in trusted server-side environments.

bash
export LAMINARITY_API_KEY=pr-...

2. List the models available to the key

The models endpoint is authenticated and filtered by the key's project policies and price caps. auto appears first when at least one concrete model is eligible.

bash
curl https://api.laminarity.ai/v1/models \
  -H "Authorization: Bearer $LAMINARITY_API_KEY"

3. Create a chat completion

Use model: "auto" to let Laminarity select an eligible model and automatically fall back when appropriate.

bash
curl https://api.laminarity.ai/v1/chat/completions \
  -H "Authorization: Bearer $LAMINARITY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [
      {"role": "developer", "content": "Answer concisely."},
      {"role": "user", "content": "Why is the sky blue?"}
    ],
    "max_completion_tokens": 300
  }'

4. Read the routing result

Responses retain the OpenAI chat-completions shape and add router_metadata. It records the selected provider and model, routing reason, latency, and fallback details. OpenAI-compatible clients may ignore this additive field; use the raw response when your application needs it.

Docs build local