DSPy
DSPy calls models through LiteLLM, so OpenCheap is an openai/ model with an api_base.
What you need
- Base URL
https://api.opencheap.si/v1 - API keyA
kl_live_…key from the console, kept inOPENCHEAP_API_KEY. - ModelAn id from Models, for example
claude-sonnet-5.
pip install dspyThe language model
import os
import dspy
lm = dspy.LM(
"openai/claude-sonnet-5",
api_base="https://api.opencheap.si/v1",
api_key=os.environ["OPENCHEAP_API_KEY"],
)
dspy.configure(lm=lm)
qa = dspy.Predict("question -> answer")
print(qa(question="What is the capital of France?").answer)
cot = dspy.ChainOfThought("question -> answer: int")
print(cot(question="What is 6 times 7?").answer)openai/ is LiteLLM's prefix for an OpenAI-compatible endpoint; claude-sonnet-5 is what OpenCheap receives. Every module you build after dspy.configure uses this model, and an optimizer's calls are billed to your key like any other.
What was checked
Run on October 28, 2026 with DSPy 3.4.1 on claude-sonnet-5: the program above answered "Paris" and 42. Optimizers were not run.