Developers

Litmiq REST API: run prompt evals from code

On this page

TL;DR · The short answer

#
  • The same five tools as the MCP connector, as plain JSON over HTTPS at https://mcp.litmiq.com/v1.
  • Authenticate with Authorization: Bearer lq_live_…, or send no key for the Free tier (3 eval runs a day). Create keys in the app under Settings and Keys.
  • Your provider key goes in the X-Litmiq-Provider-Key header for that call only. Litmiq does not store or log it.

Key takeaways

#
  • curl https://mcp.litmiq.com/v1/run_eval \ -H "Authorization: Bearer $LITMIQ_API_KEY" \ -H "X-Litmiq-Provider-Key: $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "YOUR_MODEL_ID", "variants": [{"name": "current", "system_prompt": "You are a support bot.
  • No model call, no cost, not counted as a run.

Authentication

#

Send Authorization: Bearer lq_live_…. Without a header the request is treated as Free and counted per network. A bad or revoked key returns 401; Litmiq does not silently fall back to Free for a key it rejects.

Endpoints

#
Method and pathPurpose
POST /v1/run_evalRun variants against cases with assertions
POST /v1/compare_promptsA/B two prompts
POST /v1/score_outputsCheck existing outputs; no model call
POST /v1/share_linkTurn a result into a share link
GET /v1/templatesList templates, or ?id= for one
GET /v1/usageYour plan, runs used today and limits
POST /v1/keysCreate a key (Free with no auth; Pro/Team with X-Litmiq-License)
GET /v1/keysList keys (X-Litmiq-License, or a Free key as Bearer)
POST /v1/keys/{id}/rotateReplace a key; the old one stops working
DELETE /v1/keys/{id}Revoke a key

Run an eval

#
curl https://mcp.litmiq.com/v1/run_eval \
  -H "Authorization: Bearer $LITMIQ_API_KEY" \
  -H "X-Litmiq-Provider-Key: $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR_MODEL_ID",
    "variants": [{"name": "current", "system_prompt": "You are a support bot. Refunds are accepted within 30 days."}],
    "cases": [{"input": "What is your refund window?",
               "assertions": [{"type": "contains", "value": "30 days"}, {"type": "max-length", "value": 300}]}],
    "share": "scores"
  }'

The response has summary (pass rate and average per variant, a winner when there are two or more), per-case results with each assertion's verdict, usage (plan and runs used today), notes, and, if you asked, a share_link. Assertion types: contains, not-contains, regex, json-valid (optional required_keys), max-length (characters) and llm-judge (criteria, optional threshold, default 7 out of 10). A case with an expected text and no assertions gets an llm-judge check.

Score outputs

#

No model call, no cost, not counted as a run. Good for CI checks on outputs you generated yourself:

curl https://mcp.litmiq.com/v1/score_outputs \
  -H "Content-Type: application/json" \
  -d '{"assertions": [{"type": "json-valid", "required_keys": ["category"]}],
       "cases": [{"outputs": [{"variant": "old", "text": "{\"category\":\"billing\"}"},
                              {"variant": "new", "text": "Sure! Here you go."}]}]}'

Manage keys

#

Normally you do this in the app. Scripts can too: POST /v1/keys with header X-Litmiq-License: LITMIQ-… creates a Pro/Team key (Litmiq checks the license with Polar and returns the key once). With no license header it creates a Free key. Up to 5 active keys per license; 5 new Free keys a day per network.

Limits and errors

#
StatusMeaning
400Invalid input. The message names the field.
401Missing or bad key (only when a key was sent).
403Plan limit, such as too many variants or cases for your plan.
413Body larger than 256 KB.
429Daily run cap, rate limit (see Retry-After) or the shared free-model allowance.
5xxOur side or the provider's. A run where every model call failed is not counted.

Limits per plan are in the plan table. Rate limits are per key (per network without one). The API is a standard HTTPS service on Cloudflare Workers; there is no SLA on the Free tier. See the Privacy Policy for what is stored.

Claude and Anthropic are trademarks of Anthropic, PBC. ChatGPT, Codex and OpenAI are trademarks of OpenAI. Gemini and Google are trademarks of Google LLC. Cursor is a trademark of Anysphere. Visual Studio Code, GitHub Copilot and GitHub are trademarks of Microsoft or GitHub. Perplexity is a trademark of Perplexity AI. Grok and xAI are trademarks of X.AI Corp. Names are used only to say which products this works with. Litmiq is independent and is not affiliated with, endorsed by or sponsored by any of them.

FAQ

#

Is there an OpenAPI file?

Yes: https://mcp.litmiq.com/openapi.json describes the tool endpoints. Key management routes are listed too.

Does the API cost anything?

The Free tier is free: 3 eval runs a day, no key needed. Pro and Team keys remove the daily run cap. Model costs are billed by your own provider because you bring your own key.

Can I call it from a browser?

Tool endpoints allow any origin because they use bearer keys, not cookies. Key management accepts browser calls only from litmiq.com pages. Never put a Pro or Team key in public front-end code.

How is this different from the MCP server?

Same keys, same tools, same limits. REST is plain JSON over HTTPS for scripts and CI; MCP is for AI apps.

Call Litmiq from your scripts

#

Create a key in the app, or start with no key at the Free tier.

  • Free, no signup
  • Runs in your browser
  • Your OpenAI key, sent only to OpenAI

Newsletter

Get Litmiq AI Weekly

Practical AI tips and the best tools of the week, in plain English.