opencheap.si
Credits

Connect Cursor, LiteLLM or the OpenAI SDK with the base URL

OpenCheap speaks the OpenAI API, so Cursor, LiteLLM and the OpenAI SDK connect with three values: the base URL https://api.opencheap.si/v1, an OpenCheap API key, and a model id. In Cursor, paste the key under OpenAI API Key, turn on Override OpenAI Base URL, and add the model as opencheap/claude-sonnet-5. In LiteLLM, call openai/claude-sonnet-5 with api_base set to the same URL. In the OpenAI SDK, set base_url (or OPENAI_BASE_URL) and the key.

Get API key Updated November 17, 2026
3
values to set: base URL, key, model id
901
chat models behind that one URL
/v1
where the base URL ends

The three values

Every tool below takes the same three. Get the key in the console under API keys.

ValueSet it toWatch for
Base URLhttps://api.opencheap.si/v1It ends in /v1. Do not paste a full request URL: the tool adds /chat/completions itself.
API keyYour OpenCheap key, starting kl_live_Sent as Authorization: Bearer <key>. A key from OpenAI or another provider does not work here.
Model idclaude-sonnet-5The plain id from the Models page. opencheap/ in front works everywhere, and Cursor needs it for ids that start with claude-.

Environment variables

Keep the key out of your code. The examples on this page read it from one variable.

VariableValueRead by
OPENCHEAP_API_KEYYour OpenCheap keyThe examples on this page and in the docs, and the LiteLLM config below (os.environ/…).
OPENAI_BASE_URLhttps://api.opencheap.si/v1The OpenAI Python and JavaScript SDKs, when the client is built with no base URL.
OPENAI_API_KEYYour OpenCheap keyThe same SDKs, when the client is built with no key.

With the two OPENAI_ variables set, code that already builds OpenAI() with no arguments calls OpenCheap without a change. Set them only for the program that should call OpenCheap: any other tool that reads them would send its requests here too.

# The OpenAI SDKs read these two when the client is built with no arguments
export OPENAI_BASE_URL=https://api.opencheap.si/v1
export OPENAI_API_KEY=<your OpenCheap key>

# Python: client = OpenAI()      JavaScript: const client = new OpenAI()

The OpenAI SDK

The base URL and the key change; your prompts, tools and parsing stay the same.

from openai import OpenAI
import os

client = OpenAI(
    base_url="https://api.opencheap.si/v1",
    api_key=os.environ["OPENCHEAP_API_KEY"],
)

r = client.chat.completions.create(
    model="claude-sonnet-5",
    messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(r.choices[0].message.content)
print(r.usage)  # tokens, and cost: what this request was charged in USD
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.opencheap.si/v1",
  apiKey: process.env.OPENCHEAP_API_KEY,
});

const r = await client.chat.completions.create({
  model: "claude-sonnet-5",
  messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(r.choices[0].message.content);

Streaming is the same call with stream=True. The answer arrives as server-sent events in OpenAI's shape; with stream_options include_usage set, as with OpenAI, a last chunk carries usage and its cost.

stream = client.chat.completions.create(
    model="claude-sonnet-5",
    messages=[{"role": "user", "content": "Write a haiku about routers."}],
    stream=True,
    stream_options={"include_usage": True},  # a last chunk with usage and its cost
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Cursor

Cursor takes the key and the base URL in its own settings.

  1. Open Cursor Settings, then Models.
  2. Under OpenAI API Key, paste your key.
    The key from the console.
  3. Turn on Override OpenAI Base URL, paste the URL and click Verify.
    https://api.opencheap.si/v1
  4. Click Add Custom Model, type the name as it is here (opencheap/ and the model id), and enable it.
    For example opencheap/claude-sonnet-5: opencheap/ and any id from the Models page.
  5. Pick it in the chat's model menu.

Keep the opencheap/ in front of the model id: Cursor keeps names that start with claude- for its own Anthropic connection and answers "Model name is not valid", so a plain claude-sonnet-5.5 never reaches the base URL. OpenCheap accepts opencheap/ in front of every model id.

Two things Cursor's own documentation says about your own keys: they work for chat models only, and Tab completion keeps using Cursor's built-in models; and requests made with them are routed through Cursor's servers. So the base URL has to be reachable from the internet. OpenCheap's is; a LiteLLM proxy on localhost is not.

LiteLLM

An openai/ model name, an api_base and your key, in the Python SDK and in the proxy.

import os
import litellm

response = litellm.completion(
    model="openai/claude-sonnet-5",
    api_base="https://api.opencheap.si/v1",
    api_key=os.environ["OPENCHEAP_API_KEY"],
    messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(response.choices[0].message.content)

The openai/ in front is LiteLLM's own prefix: it picks LiteLLM's OpenAI-compatible route, and claude-sonnet-5 is what OpenCheap receives. Add stream=True to stream; tool calls and acompletion take the same three arguments.

For the proxy, list the models it offers. The second entry lets a client ask for any OpenCheap id as opencheap/<id>.

model_list:
  - model_name: claude-sonnet-5
    litellm_params:
      model: openai/claude-sonnet-5
      api_base: https://api.opencheap.si/v1
      api_key: os.environ/OPENCHEAP_API_KEY
  # any other model, as opencheap/<id>
  - model_name: opencheap/*
    litellm_params:
      model: openai/*
      api_base: https://api.opencheap.si/v1
      api_key: os.environ/OPENCHEAP_API_KEY

Clients of the proxy send the proxy's own key (LITELLM_MASTER_KEY or a virtual key LiteLLM issues); your OpenCheap key stays on the proxy. The full setup is in the LiteLLM docs page.

Common errors

What the API answers when one of the three values is off, and the fix.

You seeWhyFix
401 invalid_api_keyThe key is wrong, revoked, or from another provider; or the variable that holds it is empty in the shell the program runs in.Copy the key again from the console; check echo $OPENCHEAP_API_KEY in that shell. Behind the LiteLLM proxy, clients send the proxy's key, not this one.
402 with an accepts listNo Authorization header reached the API, so it answered with the price of paying for that one call in USDC (x402).Send the key: Authorization: Bearer <key>. In the SDK, check that api_key is set.
402 insufficient_balanceThe balance does not cover the request. The message says how much it may need and how much is available.Top up in the console, or set a lower max_tokens.
404 not_foundThe path is wrong: the base URL lacks /v1, has it twice, or is a full request URL.Use https://api.opencheap.si/v1 exactly.
404 model_not_foundThat id is not listed.Copy the id from the Models page, or list them with GET /v1/models.
Cursor: “Model name is not valid”Cursor keeps names that start with claude- for its own Anthropic connection.Add the model as opencheap/claude-sonnet-5.
A long answer is cut off, or the call times outWithout streaming, nothing comes back until the whole answer is written, and many apps close a call after a fixed 30 or 60 seconds. A closed call can still be charged for what the model wrote.Set stream to true, or raise the client's timeout.

Every code, and which ones to retry, is in the errors docs.

Check it works

Before you open a tool, check the key and the URL from a terminal.

# 1. The key and the URL: lists the models your key can call
curl https://api.opencheap.si/v1/models -H "Authorization: Bearer $OPENCHEAP_API_KEY"

# 2. One call: the answer, and usage with the cost
curl https://api.opencheap.si/v1/chat/completions \
  -H "Authorization: Bearer $OPENCHEAP_API_KEY" -H "Content-Type: application/json" \
  -d '{ "model": "claude-sonnet-5", "messages": [{ "role": "user", "content": "Hello" }] }'

The first command lists models; the second answers with usage, where cost is what that request was charged in USD. The request also shows in the console under Usage › Requests. Then open the tool: in Cursor, pick the model and send a message; behind the LiteLLM proxy, call the proxy's own /v1/chat/completions with its key.

Cursor's behaviour as its own documentation described it on November 17, 2026.

Questions, answered

What is OpenCheap's OpenAI-compatible base URL?

https://api.opencheap.si/v1. Use it exactly as written, ending in /v1: the SDK or tool adds /chat/completions itself.

How do I use OpenCheap in Cursor?

Open Cursor Settings, then Models. Paste your OpenCheap key under OpenAI API Key, turn on Override OpenAI Base URL and paste https://api.opencheap.si/v1, then add a custom model named opencheap/ followed by the model id, for example opencheap/claude-sonnet-5, and pick it in the chat's model menu.

How do I use OpenCheap with LiteLLM?

Call it as an OpenAI-compatible endpoint: model="openai/<model id>", api_base="https://api.opencheap.si/v1" and your OpenCheap key as api_key. In the LiteLLM proxy, put the same three values under litellm_params in config.yaml.

Which environment variables do I need?

One: your key. The examples here read it from OPENCHEAP_API_KEY. Code built on the OpenAI SDK can instead set OPENAI_BASE_URL=https://api.opencheap.si/v1 and OPENAI_API_KEY to the OpenCheap key and switch with no code change.

Why does Cursor say “Model name is not valid”?

Cursor keeps model names that start with claude- for its own Anthropic connection, so a plain claude-sonnet-5 never reaches your base URL. Add the model as opencheap/claude-sonnet-5: OpenCheap accepts opencheap/ in front of every model id.

Why do I get 402 Payment Required with a list called accepts?

The request reached the API with no Authorization header, so it was treated as a call paid in USDC (x402) and the answer is that call's price. Send your key as a bearer token: Authorization: Bearer <key>.

Does streaming work?

Yes. Set stream to true and the answer comes back as server-sent events in the shape OpenAI uses. Add stream_options with include_usage set to true, as with OpenAI, to get a last chunk with usage and what the request cost. Tool calls stream the same way.

Every major model, one key.