POST /rpc — JSON-RPC 2.0

A single endpoint for all muLLM operations using the JSON-RPC 2.0 specification. Supports single and batch requests.

Available Methods

query
Run the full classify → route → execute pipeline. Returns the response from the cheapest capable model.
content (string, required) — the query text
source (string) — "api", "chat", "mcp" (default: "api")
skip_cache (bool) — bypass cache lookup
force_tier (string) — "local", "cloud_cheap", "cloud_full"
temperature (float) — override temperature
session_id (string) — for cost/session tracking
history (array) — conversation history [{role, content}]
classify
Classify intent and determine routing tier without executing the query.
content (string, required) — the query text
Returns: category, complexity, confidence, tier, model, provider, reasoning
cache.search
Semantic vector cache lookup. Returns cached answer if similarity exceeds threshold.
query or content (string, required) — search text
n_results (int, max 20) — number of results
cache.lookup
Alias for cache.search. Returns one cache hit when available.
query or content (string, required) — search text
cache.store
Store an answer in the semantic cache.
query or content (string, required) — cache key text
response or answer (string, required) — answer to cache
metadata (object) — optional metadata
budget.status
Current spend vs limits — daily, weekly, tiered thresholds, override status.
No parameters required.
system.info
System resource stats — CPU, GPU, VRAM, RAM, temperature.
No parameters required.
agents.list
List registered A2A agents. Optionally filter by capability.
capability (string) — filter agents by capability (e.g. "code", "translate")
agents.register
Register an A2A-style agent in muLLM's in-process registry.
agent_id or id (string, required) — safe identifier
endpoint (string) — http(s) endpoint for the agent
capabilities (array or comma-separated string) — discoverable capabilities

Quick Start

Classify a query (no execution, free)

bashcurl -s -X POST https://localhost:6856/rpc \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "classify",
    "params": {"content": "What is 2+2?"}
  }' | jq

Execute a query

bashcurl -s -X POST https://localhost:6856/rpc \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "query",
    "params": {"content": "Explain quicksort in 3 sentences"}
  }' | jq

Check budget

bashcurl -s -X POST https://localhost:6856/rpc \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"budget.status","params":{}}' | jq

Batch request (3 calls in 1)

bashcurl -s -X POST https://localhost:6856/rpc \
  -H 'Content-Type: application/json' \
  -d '[
    {"jsonrpc":"2.0","id":1,"method":"budget.status","params":{}},
    {"jsonrpc":"2.0","id":2,"method":"system.info","params":{}},
    {"jsonrpc":"2.0","id":3,"method":"classify","params":{"content":"Write a poem"}}
  ]' | jq

Python

pythonimport httpx

client = httpx.Client(base_url="https://localhost:6856", verify=False)

# Classify
r = client.post("/rpc", json={
    "jsonrpc": "2.0", "id": 1,
    "method": "classify",
    "params": {"content": "Deploy to production"}
})
data = r.json()
print(f"Tier: {data['result']['tier']}, Model: {data['result']['model']}")

# Batch
r = client.post("/rpc", json=[
    {"jsonrpc": "2.0", "id": 1, "method": "budget.status", "params": {}},
    {"jsonrpc": "2.0", "id": 2, "method": "system.info", "params": {}},
])
for resp in r.json():
    print(f"#{resp['id']}: {list(resp.get('result', {}).keys())[:5]}")

Try It

Error Codes

reference-32700  Parse error       Invalid JSON body
-32600  Invalid request   Missing jsonrpc/method fields
-32601  Method not found  Unknown method name
-32602  Invalid params    Wrong/missing required params
-32603  Internal error    Server-side failure (traceback in data)

Protocol Notes