Drop-in
OpenAI-compatible proxy
recommendedRun runelm in front of your application. Change one line in the SDK constructor. Every call now flows through classification, routing, and bounded rehydration.
# server side
$ runelm serve --config runelm.yaml
# client side — the only change
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8080/v1", # <-- swap
api_key="sk-runelm-...",
)
resp = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": prompt}],
)
Planned · Phase E
Python decorator
Not yet shipped (Phase E). Wrap the function that calls the LLM. The decorator handles classification, pseudonymization, routing, and rehydration around the call site.
from runelm import runelm_protect, Level
@runelm_protect(session_id="conv-42", min_level=Level.MEDIUM)
def ask_llm(prompt: str) -> str:
from openai import OpenAI
client = OpenAI() # ordinary client, no proxy
resp = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": prompt}],
)
return resp.choices[0].message.content
Planned · Phase E
Direct API
Not yet shipped (Phase E). For custom pipelines. Call classify, pseudonymize, route, and rehydrate yourself.
from runelm import Runelm
rl = Runelm.from_config("runelm.yaml")
result = rl.classify(text=prompt, session_id="conv-42")
sanitized = rl.pseudonymize(result, session_id="conv-42")
provider = rl.route(level=result.level)
# call provider.base_url with sanitized.text
response_text = your_llm_call(sanitized.text, provider)
clean = rl.rehydrate(response_text, session_id="conv-42")