Documentation

Quick start

Get an API key

Sign in, enter your access code on the API keys page and create a key.

Shell
export TYPELLM_API_KEY="tl-sk-..."  # from Dashboard, API keys

Build with a coding agent

Paste this into Claude Code, Cursor, or any agent that can read a URL.

Read https://typellm.ai/SKILL.md and follow it to set up TypeLLM in this project.

Python access

Install the client

Install
pip install -U typellm

Create a client

Create a client
import os
from typellm import TypeLLMClient

client = TypeLLMClient(api_key=os.environ["TYPELLM_API_KEY"])

Make a request

Python
response = client.generate(
    context="""
    Receipt from Hilton London
    Total: £324.50
    Employee travelled to London for a client meeting.
    """,
    questions={
        "merchant": {
            "type": "string",
            "instructions": "Return only the merchant name.",
        },
        "total": {
            "type": "number",
            "instructions": "Extract the total amount in GBP.",
        },
        "expense_type": {
            "type": "string",
            "enum": ["meal", "travel", "equipment"],
            "instructions": "What type of expense is this?",
        },
        "reimbursable": {
            "type": "boolean",
            "instructions": "Should this expense be reimbursed?",
        },
    },
)

print(response.result)

Example response.result:

Python
{
    "merchant": "Hilton London",
    "total": 324.5,
    "expense_type": "travel",
    "reimbursable": True,
}

The response also carries response.thinking, the reasoning of each field that thought, and response.usage, the call's input_tokens and thinking_tokens. See After a call.

HTTP API

Without Python, send the same JSON to the HTTP API:

curl
curl https://api.typellm.ai/v1/generate \
  -H "Authorization: Bearer $TYPELLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"context": "Receipt from Hilton London. Total: GBP 324.50.",
       "questions": {"total": {"type": "number"},
                     "expense_type": {"type": "string", "enum": ["meal", "travel", "equipment"]}}}'
Response
{"id": "gen_...", "model": "typellm-latest",
 "result": {"total": 324.5, "expense_type": "travel"},
 "thinking": {}, "usage": {"input_tokens": 66, "thinking_tokens": 0}, "elapsed": 0.61}

See the API reference for every field, the limits and the errors.

To run TypeLLM on your own model, see self-hosting on GitHub.