Quickstart

Zero to a first response in five steps.

Everything below happens once. After this, every call you make is the same request shape you'd send to OpenAI, aimed at a different base URL.

1. Create an account

Sign up with an email and password. We send a verification link — you can't sign in or create a key until you click it, so use an address you can check right now. Signing up creates an organisation and a default project for you automatically; you don't have to think about either one to make your first call.

2. Create an API key

Once you're signed in, go to API keys and create one. The key is shown exactly once, at creation — copy it somewhere before you close the dialog, because the server never stores it in a form it can show you again. Set it as an environment variable rather than pasting it into code:

cURL
export LARSA_API_KEY="sk-larsa-..."

Every key starts with sk-larsa-, so a copy of one sitting in a repository is easy to catch in a secret scan. Authentication covers scoping a key to a project and specific models, and what to do if one leaks.

3. Install a client

Python and JavaScript/TypeScript have an official OpenAI client; point its base_url at ours and it works unmodified. Every other language below talks plain HTTP — there is nothing to install beyond what the sample imports.

Python
pip install openai
JavaScript / TypeScript
npm install openai

4. Make the call

larsa-general is the general-purpose model — a reasonable default while you're finding your way around. Each sample below prints the answer on success and a short message on failure.

curl https://api.console.larsa.larsima.com/v1/chat/completions \
  -H "Authorization: Bearer $LARSA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "larsa-general",
    "messages": [
      {"role": "user", "content": "In one sentence, what is the Larsa API?"}
    ]
  }'
This example doesn't set reasoning_effort, so the model decides how much to think before answering out loud. If a run ever comes back empty, see `reasoning_effort` in the chat reference — setting it to "none" is the one value guaranteed to produce a visible answer.

5. Read the response

A successful call returns a chat.completion object. The text you want is choices[0].message.content; usage is the exact token count the request billed.

Response
{
  "id": "chatcmpl-9f2a1c3e7b1a4e0daf3b6c2e1f9a7d55",
  "object": "chat.completion",
  "created": 1755878402,
  "model": "larsa-general",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The Larsa API is an OpenAI-compatible gateway that serves chat, vision, speech, translation and legal retrieval from dedicated GPU hardware."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 21,
    "completion_tokens": 28,
    "total_tokens": 49
  }
}

6. Handle the error

A failed call is still valid JSON — the top-level shape changes to a single error object instead of choices. This is the exact body the gateway returns for a request with no key at all:

JSON
{
  "error": {
    "message": "Authentication Error, No api key passed in.",
    "type": "auth_error",
    "param": "None",
    "code": "401"
  }
}

Every sample above checks for this before touching choices. Errors lists every status code and what each one means.

What next

Navigate Open esc Close