Skip to main content
TracePress has no default model. Every LM operator needs one, and you pick it in one of two ways:
A run without a model fails before it makes any calls. openrouter:openai/gpt-6-luna is the suggested model. It’s cheap (about $0.10 per million input tokens and $0.50 per million output tokens) and works well for trace analysis.

Model strings

Use a gateway prefix (openrouter:, portkey:, typesafe:), or name a provider directly.
  • Portkey: the part before the / is your Model Catalog provider slug. Writing portkey:@openai-prod/gpt-5 means the same thing. Set PORTKEY_BASE_URL to use a self-hosted gateway.
  • Colons in model names: a colon after a / is part of the model name, so strings like ollama_chat/llama3:8b work as written.
  • Options: wrap a model string in tp.LM to set options such as temperature or an endpoint, e.g. tp.LM("openrouter:openai/gpt-6-luna", temperature=0.0). It takes the same options as dspy.LM.
Keys are read from the environment, or from a .env file in the working directory.

Jev

Jev, TypeSafe’s System One model, can be a cheaper option for stages that only make decisions, such as flagging steps or picking a category. It doesn’t write text: it answers yes/no (Noul) or picks among fixed options (Choice), with probabilities. Each output needs a desc, which Jev reads as the question:
failed comes back with Jev’s probability, and kind as the chosen option. For example (values made up to show the shape):

Local models

Any locally hosted model works, so your traces never leave your machine.
  • Ollama: use ollama_chat/<model>, e.g. tp.configure(lm="ollama_chat/llama3.1"). It talks to Ollama on localhost:11434 by default.
  • vLLM, llama.cpp, LM Studio, or any other OpenAI-compatible server: point a tp.LM at it:
Local models have no price, so their calls show up as unpriced_calls in tp.last_run(). Add a price with tp.configure(prices=...) if you want a cost estimate.

Cost and caching

Every call is cached on disk, so rerunning a pipeline only pays for prompts that changed. After a run, tp.last_run() shows what it did:
Calls answered from the disk cache send no request and cost nothing, so they aren’t in prompt_tokens or completion_tokens. What those calls used when they were first made is counted in cached_prompt_tokens and cached_completion_tokens: the tokens the cache saved you. by_model and by_op break the totals down by model and by operator. latency() gives per-call percentiles. status is running, completed, failed or cancelled, and error holds what ended a run that didn’t complete. During a live run, tp.last_run() shows the totals so far. Cost is estimated from token counts. Prices come from a bundled price table, plus built-in entries for the suggested model and Jev. When a provider reports a call’s cost (OpenRouter does for models with no listed price), that’s used instead. Add your own prices, in USD per million input and output tokens, keyed by the model name:
These are added to the prices already configured; an entry for a model that already has a price replaces it. Calls to models with no known price are counted as unpriced_calls instead of being guessed.

Next steps