DEDUPED Hot AI repos, turned into use cases Get the Monday 5

How to trace every model call and read cost and latency with Respan Gateway

Send all gateway traffic to Respan and check cost, latency and tokens per call.

Who it is forA team lead or engineer who needs to see what each AI call costs and how long it takes across providers.

The problemModel spend and latency are spread across several vendor dashboards, with no single view of each call.

The outcomeEvery call through the gateway is traced in Respan, with cost, latency and tokens visible in one place.

What you need first

  • Python with pip, or a Rust toolchain with cargo, or Docker
  • An API key for at least one model vendor, such as OPENAI_API_KEY
  • An existing app or SDK that accepts a custom base URL
  • Optional: a Respan API key for tracing and a tool vendor key for MCP tools

Steps

  1. Create gateway.toml with respan-gateway init.
  2. Add a [plugins.respan] table with key = "env:RESPAN_API_KEY", as in the README example.
  3. Export your Respan key with export RESPAN_API_KEY=.... (inferred, check the README)
  4. Validate with respan-gateway check, then start the gateway with respan-gateway.
  5. Send a few requests and open http://localhost:8080/ui/ for the live log, then check traces in Respan.

Prompt for your agent

In the respan-gateway repo, configure the respan plugin in gateway.toml using RESPAN_API_KEY from the environment, validate the config, and send <number> test requests through the gateway. Return the cost, latency and token count for one call, and verify that a matching trace appears in Respan.

Caveat. Traces only reach Respan when a valid RESPAN_API_KEY is set, and the README does not describe what data is included in each trace beyond cost, latency and tokens.

Share: X LinkedIn Hacker News Email Copy link

Disclaimer

Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page