explaingit

tensorzero/tensorzero

11,368RustAudience · developerComplexity · 4/5Setup · moderate

TLDR

Self-hosted gateway for AI apps that routes requests to a dozen LLM providers, logs every call with feedback, and runs A/B tests and automated optimization to improve prompt performance over time.

Mindmap

mindmap
  root((repo))
    What it does
      LLM request routing
      Call logging
      Prompt optimization
    Tech stack
      Rust gateway
      Docker deploy
      OpenAI compatible
    Providers
      OpenAI Anthropic
      AWS Bedrock
      Groq Mistral
    Features
      AB testing
      Cost tracking
      Autopilot AI
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Replace direct OpenAI API calls with TensorZero to get automatic failover across multiple AI providers with under 1ms added latency.

USE CASE 2

Log every AI call your app makes, attach ratings or corrections, and track quality and cost trends over time in your own database.

USE CASE 3

Run A/B tests between different prompts or models in production without changing your application code.

USE CASE 4

Use Autopilot to automatically find better prompts for your AI features based on real usage data and feedback.

Tech stack

RustDockerPythonPostgreSQL

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Docker and a Postgres database, migrate from OpenAI SDK with a one-line URL change.

In plain English

TensorZero is an open-source platform that helps software teams manage how their applications interact with AI language models. Instead of connecting directly to providers like OpenAI, Anthropic, or Google, you point your code at TensorZero and it handles the routing, logging, and improvement cycles from there. The whole thing runs as a single container you deploy yourself, so your data stays in your own database. The gateway is the starting point. It accepts requests using the same format as the OpenAI API, which means switching to it often requires just a one-line change in existing code. From there it forwards requests to over a dozen AI providers, including AWS Bedrock, Google Vertex AI, Groq, Mistral, and several others. If one provider is slow or unavailable, TensorZero can retry or fall back to a different model automatically. Because the gateway is written in Rust, it adds less than one millisecond of overhead even at high traffic volumes. Observability is built in from the start. Every AI call, and any feedback you attach to it such as ratings, corrections, or scores, gets stored in your own database. You can browse individual calls in the TensorZero UI or pull the data programmatically for your own analysis. This makes it possible to see not just whether the AI produced a correct answer, but how performance changes over time or across different models and prompts. On top of that, TensorZero includes tools for evaluation and experimentation. You can run A/B tests across different prompts or models, set up automated scoring to benchmark outputs, and track usage costs at a fine-grained level. There is also a feature called Autopilot, described as an automated AI engineer: it reads the observability data, sets up evaluations, and runs optimization cycles to improve prompt and model performance without manual intervention. TensorZero is compatible with any OpenAI SDK (Python, Node, Go, and others). Setup involves deploying the Docker container, then changing one URL in your client code. The project is used by companies ranging from early-stage AI startups to large enterprises and, according to the README, handles roughly one percent of global AI API spend.

Copy-paste prompts

Prompt 1
I use the OpenAI Python SDK. Show me the single-line change needed to route all calls through a self-hosted TensorZero gateway instead.
Prompt 2
Set up a TensorZero A/B test that splits traffic 50/50 between GPT-4o and Claude Sonnet for my document summarization endpoint.
Prompt 3
Using TensorZero's feedback API, show me how to attach a correctness score to each AI response so the Autopilot can use it to optimize the prompt.
Prompt 4
Walk me through deploying TensorZero with Docker Compose, connecting it to Postgres, and pointing my existing app at the gateway URL.
Prompt 5
Configure TensorZero to retry automatically on AWS Bedrock if the primary OpenAI call fails within 5 seconds.
Open on GitHub → Explain another repo

← tensorzero on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.