The superprompts package fetches prompts at runtime, fills in variables and caches reads. It uses only the standard library, so it drops into any Python 3.9+ project.
pip install superpromptsimport os
from superprompts import SuperPrompts
sp = SuperPrompts(api_key=os.environ["SUPERPROMPTS_API_KEY"])
prompt = sp.get_prompt("<PROMPT_ID>", variables={"customer": "Ada"})
print(prompt.prompt) # assembled system message
print(prompt.version[:7]) # content hash that was servedget_prompt serves the published version by default. Pass version="latest" in staging to read the newest draft, or a version hash to pin one.
from openai import OpenAI
prompt = sp.get_prompt("<PROMPT_ID>", variables={"customer": user.name})
completion = OpenAI().chat.completions.create(
model="gpt-5",
messages=[
{"role": "system", "content": prompt.prompt},
{"role": "user", "content": "I need help with my order"},
],
tools=prompt.tools or None,
)import anthropic
prompt = sp.get_prompt("<PROMPT_ID>")
message = anthropic.Anthropic().messages.create(
model="claude-sonnet-5",
max_tokens=1024,
system=prompt.prompt,
messages=[{"role": "user", "content": "I need help with my order"}],
)created = sp.create_prompt(
"Onboarding email",
markdown="# Role\nYou write {{ tone }} emails.",
)
sp.update_prompt(
created["id"],
sections=[{"title": "Role", "content": "You write short emails."}],
message="tighten",
)
sp.publish_prompt(created["id"]) # publish latest
sp.publish_prompt(created["id"], "18bab0e") # or roll back to a versionSuperPrompts(
api_key="sp_...",
base_url="https://superprompts.app",
cache_ttl=5.0, # seconds; 0 disables the in-memory cache
guard=True, # append Prompt Guard to fetched prompts
timeout=10.0,
)Failures raise SuperPromptsError with a .status attribute and the server's message. strict=True on get_prompt raises KeyError when a variable has no value.