opencheap.si
鸣谢

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

Updated November 17, 2026

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 光标, 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.

3
values to set: base URL, key, model id
814
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
基础网址https://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.
模型 ID克劳德-十四行诗-5The plain id from the 模型 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 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 克劳德-十四行诗-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.

问题与解答

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.

More guides

最便宜的LLM API
最便宜的 LLM API(实时价格,每日更新)

热门模型的实时报价(按100万代币计价),由系统自动路由至最便宜且运行正常的提供商。一个兼容OpenAI的密钥。按需付费,无月费。

最便宜的 DeepSeek API
更实惠的 DeepSeek API,附官方价格对比表

Official DeepSeek API prices next to live OpenCheap rates for V4.1 Flash, V4 Pro and other DeepSeek models. One OpenAI-compatible key. Prices move; the tables are dated.

Cheapest-provider routing
An LLM router that sends each request to the cheapest provider

OpenCheap routes each request to the cheapest healthy provider of your model, fails over before the first byte, and bills that provider's price.

One API key for all AI models
One API key for all AI models

One OpenCheap key calls Anthropic, Google, OpenAI, DeepSeek, Moonshot, Qwen and more through the OpenAI SDK: change the base URL and the key.

Pay per call in USDC
Pay for LLM API calls with USDC, without an account or an API key

An AI agent can pay OpenCheap for one completion in USDC on Base with x402: call with no key, read the 402 price, sign, and get the answer in the same request.

Spend limits per key
Set a daily spend limit on each API key your agents use

Give each OpenCheap key a daily, weekly, monthly or lifetime spend limit, so an agent left running overnight can't spend more than you allow.

OpenCheap vs OpenRouter
OpenCheap vs OpenRouter for cheapest pricing and failover

OpenCheap routes to the cheapest provider by default; OpenRouter balances price, speed and uptime. Compare live prices, failover and fees.

Cheapest Claude API
一款价格低廉的Claude API,附官方价格对比

Anthropic's list prices next to live OpenCheap rates for Claude. One OpenAI-compatible key. Prices move; both tables are dated.

最便宜的GPT API
GPT API 的定价,以及调用它的最便宜方式

GPT API pricing per 1M tokens: OpenAI's list rates for GPT-6, GPT-5 and GPT-4 models next to live OpenCheap prices, on one OpenAI-compatible key.

Cheapest Gemini API
The cheapest way to use Gemini through an API

Gemini chat models on OpenCheap, with today's price per million input and output tokens from the same book as the pricing page.

最便宜的 Qwen API
最便宜的 Qwen API,附官方价格对比

Qwen API pricing per 1M tokens: Alibaba Cloud's list rates next to live OpenCheap prices for Qwen4 Max, Qwen3 Coder and more. One OpenAI-compatible key.

最便宜的 Llama API
最便宜的 Llama API,实时报价

Llama 4 Maverick、Scout、3.3 70B 和 3.1 8B 的 Llama API 定价(按 100 万个令牌计),来自最便宜且服务稳定的提供商。包含一个与 OpenAI 兼容的密钥。

最便宜的Kimi API
The cheapest Kimi API, with official prices side by side

Kimi API pricing per 1M tokens: Moonshot's list rates next to live OpenCheap prices for Kimi K3.1 Pro, K3 and K2.6. One OpenAI-compatible key.

Claude Code for less
Run Claude Code for less

Point Claude Code at OpenCheap and pick a model per task: Claude at the provider's price, or open models for a fraction, on one key with a spend limit.

每款主要车型,仅需一把钥匙。