DSPy
SDKs & frameworksProgram (not prompt) language models, and optimize the prompts automatically.
Fill the guide with your values
Stays in this browser tab — never sent or stored by us. Sign in to create one
Setup
- 1Configure
dspy.LMwith theopenai/prefix andapi_base=https://api.ultragpt.pro/v1.
# pip install dspy
import os
import dspy
lm = dspy.LM("openai/grok-4.7", api_base="https://api.ultragpt.pro/v1", api_key=os.environ["ULTRAGPT_API_KEY"])
dspy.configure(lm=lm)
qa = dspy.ChainOfThought("question -> answer")
print(qa(question="What is 17 * 23?").answer)Tips
- Any model id from Models works; suffixes like :online (web search) and :nitro work too.
- Give each tool its own key with a spend limit, so usage shows separately in Activity.
- Something off? Error codes · Support