Skip to content

Quick Start

This guide will help you run your first Litmus test in just a few minutes.

  • Litmus installed on your system (see Installation)
  • An OpenRouter API key, or a Cloudflare AI Gateway (see Providers)

Set your OpenRouter API key as an environment variable:

Terminal window
export OPENROUTER_API_KEY="your-api-key"

To use Cloudflare AI Gateway instead, see Providers.

Create a test file called tests.json:

[
{
"name": "Extract person info",
"input": "John Smith is 30 years old and works at Acme Corp",
"expected": {
"name": "John Smith",
"age": 30,
"company": "Acme Corp"
}
},
{
"name": "Extract another person",
"input": "Jane Doe, age 25, is employed by TechStart Inc",
"expected": {
"name": "Jane Doe",
"age": 25,
"company": "TechStart Inc"
}
}
]

Create a schema file called schema.json:

{
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer" },
"company": { "type": "string" }
},
"required": ["name", "age", "company"],
"additionalProperties": false
}

Create a prompt file called prompt.txt:

Extract the person's name, age, and company from the given text.

Run your tests against a model:

Terminal window
litmus run --tests tests.json --schema schema.json --prompt-file prompt.txt --model openai/gpt-4.1-nano

Run tests against multiple models to compare them:

Terminal window
litmus run --tests tests.json --schema schema.json --prompt-file prompt.txt --model openai/gpt-4.1-nano --model mistralai/mistral-nemo