Pydantic Logfire and AI Gateway: Controlling LLM Spend and Sensitive Data Without Slowing Down

As AI applications move from prototypes into day-to-day business systems, teams need to understand how their models behave in production without turning observability, data handling, or model access into separate engineering projects. Pydantic Logfire addresses these challenges with a single platform. It is an observability and evaluation platform for the entire AI engineering stack, and its AI Gateway gives teams a single control point for model calls, spend, and sensitive data.

A Practical Review of Pydantic Logfire and the AI Gateway

Pydantic Logfire combines AI and LLM observability, OpenTelemetry and evaluations across the application and infrastructure. It is OpenTelemetry-native, so it works with any framework, SDK, or language that emits OpenTelemetry, including Pydantic AI, LangChain, the OpenAI and Anthropic SDKs, Go, and Java. Teams keep the agent framework they already use, and the AI Gateway is part of Pydantic Logfire, not a separate product to run.

What the Platform Brings to the Review

The central idea is one trace that follows an agent’s reasoning to the model call, the API requests, and the database query behind it. AI observability tools often see only the LLM layer, while general monitoring tools treat AI as an afterthought, and root cause hides between the two. Pydantic Logfire covers API requests, background jobs, workers, LLM calls, agent spans, hosts, metrics, and dashboards in one platform, so you can read cost and behavior alongside the services around them. Logfire’s SLOs with burn-rate alerts are available only on Enterprise.

Trace data is queried with standard PostgreSQL-compatible SQL rather than a proprietary query language. An MCP server lets coding agents query production traces to find failure patterns and propose fixes, and SQL-based monitors and alerts turn those patterns into action. Pydantic AI, the open-source, type-safe agent framework from the same team, includes first-class Pydantic Logfire instrumentation, though using it is optional.

The AI Gateway Adds a Control Point for Model Calls

The AI Gateway is a single control point for model calls. Teams bring their own provider keys, route across providers, and see per-project cost in traces. That gives them an orderly way to manage model access as an application grows, without scattering keys and budgets across services.

Spend Controls Built Into the Gateway

Model selection and usage are among the clearest levers for managing AI spend, and the AI Gateway puts controls around both:

Built-in providers carry a 5% markup on Personal and Team and 3% on Growth and Enterprise. The gateway comes with Personal, Team, and Growth. At 0% markup, those plans support 3, 5, and 20 bring-your-own keys, respectively. On Enterprise, full access is available as an add-on. Because the figures sit in the same platform as the traces, a spike in spend can be followed back to the agent run and the project that caused it.

Guardrails for Sensitive Data

The AI Gateway can also set guardrails to redact sensitive information from traces and LLM outputs. That matters for teams whose prompts and responses contain customer details, internal documents, or other material that should not travel through every system untouched. The gateway is one of three places where sensitive data can be handled.

Protecting Sensitive Data at Three Layers

Pydantic Logfire can scrub sensitive data at three layers: the SDK, the OpenTelemetry collector, and AI Gateway DLP. Each layer catches data at a different point, so a team can apply the right control where it fits its architecture instead of relying on a single filter.

Deliberate Telemetry Design

For teams handling information that deserves careful treatment, observability creates a useful design conversation. The value is not simply collecting more data. It is deciding what should be visible for operational diagnosis, who should have access to it, and how telemetry fits internal privacy practices. Pydantic Logfire offers several choices for that decision:

Sophos runs self-hosted Pydantic Logfire for highly sensitive data, with unified tracing across its APIs, LLM calls, and workers. Teams still need their own policies for what they log and retain, and no observability product replaces clear internal controls, but the platform gives them the layers to apply those policies.

Evals Connect Spend and Quality

Spend control is only half the picture, because a cheaper model call that gets the answer wrong is not a saving. Pydantic Logfire treats evaluation as part of the same platform. Teams define datasets and evaluators in code with Pydantic Evals or edit them in the Pydantic Logfire interface, run experiments in CI so regressions fail the build, and run the same evaluators on live production traffic. Experiments report duration, tokens, and cost when the run provides them, and Compare runs shows per-metric deltas against a baseline.

Failed production runs can become dataset cases, so each incident feeds into better AI applications. That loop lets a team change a model or a prompt, check the result against the same cases, and see the cost impact before the change ships.

Where the Approach Fits Best

Teams That Want One Place for Cost, Behavior, and Data Control

The strongest fit is a team running AI in production that wants model access, spend, traces, and evals in one platform. It suits organizations whose agents call internal services or query production databases, because the trace shows the whole path, and teams that work across several model providers and want routing, caps, and cost per project in one view.

Pydantic Logfire can also sit beside tools a team already runs. Several customers run it alongside other observability products, such as Datadog, and because telemetry can go to Pydantic Logfire and to a team’s own collectors at the same time, adopting it does not require ripping out existing instrumentation.

Pricing and Plan Limits

Pricing is usage-based and follows the spans, logs, and metrics sent, not hosts. One record-based meter covers AI observability, evals, APM, and infrastructure. The free Personal plan includes 10M records a month and is hard-capped, so a team can never owe anything while it experiments. Team costs $49 per month, Growth costs $249 per month, and after the included 10M records, usage costs $2 per million on both. Personal and Team retain data for 30 days, while Growth extends retention to up to 90 days, and self-hosting requires Enterprise.

Strengths and Considerations for Buyers

Pydantic Logfire is appealing because it starts with practical engineering concerns: cost, data handling, traceability, and testable behavior. Instead of treating spend, privacy, and quality as three separate projects, it brings them together on one telemetry model.

The main consideration is scope and plan fit. Teams that only need a lightweight prompt viewer may find the full-stack platform more than they need, and teams with long investigation cycles should plan to retain the tier they choose. The full AI Gateway is an Enterprise add-on, so buyers who rely on it heavily should confirm what each plan includes. Buyers should also distinguish between platform capabilities and organizational policy: logging, retention, access control, provider selection, and budget governance still need to align with the company’s own security and operational requirements.

A Measured Choice for Teams Controlling Spend and Data

For teams that want AI observability, OpenTelemetry, and evals in one platform, with spend caps and data protection built in, Pydantic Logfire is worth a close look. The AI Gateway sets the limits, the three scrubbing layers protect sensitive data, and one trace across agents and infrastructure shows what happened when something goes wrong. Because the whole platform rests on open standards, it works across frameworks and languages, and it can run next to the tools a team already uses.