<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Drishti Shah</title>
    <description>The latest articles on DEV Community by Drishti Shah (@drishti_portkey).</description>
    <link>https://dev.to/drishti_portkey</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3286404%2F4652e70d-893b-46f9-b2dc-2a4d308f0e63.png</url>
      <title>DEV Community: Drishti Shah</title>
      <link>https://dev.to/drishti_portkey</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/drishti_portkey"/>
    <language>en</language>
    <item>
      <title>n8n Best Practices</title>
      <dc:creator>Drishti Shah</dc:creator>
      <pubDate>Tue, 21 Apr 2026 23:20:50 +0000</pubDate>
      <link>https://dev.to/portkey/n8n-best-practices-1284</link>
      <guid>https://dev.to/portkey/n8n-best-practices-1284</guid>
      <description>&lt;p&gt;n8n works reliably in a single-developer status. The picture changes once AI Agent nodes begin calling LLMs across shared teams and environments.&lt;/p&gt;

&lt;p&gt;Token usage is hard to track, provider keys are spread across credentials, and workflows depend on a single model endpoint. The gap is not in workflow design. It sits between n8n and the model providers those workflows depend on.&lt;/p&gt;

&lt;p&gt;This guide covers the n8n best practices needed to run AI workflows in production, focusing on the operational control layer behind LLM calls.&lt;/p&gt;

&lt;h2&gt;
  
  
  What n8n is and why teams choose it for AI automation
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://n8n.io/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;n8n&lt;/u&gt;&lt;/a&gt; is a node-based workflow automation platform that combines a visual builder with the option to write JavaScript or Python anywhere in a workflow.&lt;/p&gt;

&lt;p&gt;That flexibility is why it shows up quickly in production AI stacks and why many discussions about n8n best practices now include agent orchestration and execution in the same system. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For AI workflows, n8n provides:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A native AI Agent node built on LangChain that connects workflows to OpenAI, Anthropic, Gemini, Azure OpenAI, and others.&lt;/li&gt;
&lt;li&gt;Sub-workflows for modular agent design across environments and teams.&lt;/li&gt;
&lt;li&gt;Memory nodes for stateful, multi-step interactions.&lt;/li&gt;
&lt;li&gt;Tool nodes for external API calls during agent execution.&lt;/li&gt;
&lt;li&gt;An MCP Trigger node that allows workflows to be invoked from AI environments like &lt;a href="https://portkey.ai/blog/claude-code-best-practices-for-enterprise-teams/" rel="noopener noreferrer"&gt;&lt;u&gt;Claude Desktop&lt;/u&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Access and pricing depend on deployment:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Deployment option&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What teams get&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;n8n Cloud&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Starter, Pro, Business, Enterprise tiers billed per workflow execution&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Self-hosted &lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Free, with infrastructure and security managed by the team&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Business plan&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Adds SSO, Git-based version control, RBAC, isolated environments&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Enterprise plan&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Adds compliance support and dedicated assistance&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;p&gt;Even well-structured workflows with retries, environments, and version control do not solve token visibility, credential management, or provider reliability. Those issues sit outside the workflow layer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where n8n’s Native Tooling Falls Short for LLM Operations at Scale
&lt;/h2&gt;

&lt;p&gt;n8n handles workflow orchestration well. The gaps appear when &lt;a href="https://portkey.ai/blog/what-are-ai-agents/" rel="noopener noreferrer"&gt;&lt;u&gt;AI Agent&lt;/u&gt;&lt;/a&gt; nodes begin calling LLMs across teams and environments.&lt;/p&gt;

&lt;p&gt;At that point, five operational issues show up consistently:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Limited provider flexibility
&lt;/h3&gt;

&lt;p&gt;n8n supports multiple providers like OpenAI, Anthropic, Gemini, Azure OpenAI, and others through credential nodes. However, switching providers still means updating workflows individually. There is no native fallback if a provider fails, and no routing across providers during rate-limit pressure.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Cost and token visibility
&lt;/h3&gt;

&lt;p&gt;Execution history shows whether a workflow ran. It does not show token usage, per-node cost, or which team triggered model activity.&lt;/p&gt;

&lt;p&gt;Agentic loops can make multiple sequential model calls inside one execution. TCosts accumulate without visibility. There is no per-team or per-workflow breakdown.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Security and compliance boundaries
&lt;/h3&gt;

&lt;p&gt;Provider API keys live directly inside credential storage. Access depends on credential permissions, not model-level isolation across teams.&lt;/p&gt;

&lt;p&gt;Prompts may include internal documents, customer records, or PII. There is no interception layer to inspect or filter what reaches the model, and no audit trail of what was sent or by whom.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Cost control and optimization
&lt;/h3&gt;

&lt;p&gt;n8n does not enforce budget caps for model usage. A looping workflow can consume quota quickly without warning.&lt;/p&gt;

&lt;p&gt;There is also no routing logic to send lightweight tasks to smaller models and reserve advanced reasoning models for complex steps. Teams share provider limits without execution-level prioritization.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Access control at the model layer
&lt;/h3&gt;

&lt;p&gt;RBAC in n8n controls who can edit workflows. It does not control which models those workflows can call.&lt;/p&gt;

&lt;p&gt;Teams typically share the same provider credentials across environments. There is no hierarchy for limiting usage by team, environment, or model class.&lt;/p&gt;

&lt;p&gt;Across all five areas, the pattern is consistent. Workflow structure remains strong, but model access operates without a coordination layer. That missing layer is what n8n best practices need to address in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  n8n best practices: Add an AI gateway as the LLM control layer
&lt;/h2&gt;

&lt;p&gt;At this stage, n8n best practices shift from workflow design to control. The issue is not workflow design but the lack of a control layer between n8n and the providers that those workflows depend on.&lt;/p&gt;

&lt;p&gt;An &lt;a href="https://portkey.ai/docs/product/ai-gateway?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;AI gateway&lt;/u&gt;&lt;/a&gt; sits between n8n’s agents and provider APIs. Every request passes through it. Routing, access control, observability, and guardrails are applied before the request reaches a model.&lt;/p&gt;

&lt;h3&gt;
  
  
  Model and provider switching
&lt;/h3&gt;

&lt;p&gt;With a gateway, model and provider selection moves out of workflows and into configuration. Providers and models can be switched centrally. Routing logic can match task complexity to model capability. Changes apply across all workflows without modification.&lt;/p&gt;

&lt;h3&gt;
  
  
  Centralized credential management
&lt;/h3&gt;

&lt;p&gt;A gateway stores provider credentials centrally and issues scoped access keys per team or workflow. These keys carry their own limits and permissions. Access can be rotated or revoked without touching workflow configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Budget and rate limits
&lt;/h3&gt;

&lt;p&gt;Budget limits cap total spend over time. Rate limits control request volume. Both apply before requests reach providers. Teams can enforce usage boundaries per workflow, team, or environment without relying on manual monitoring.&lt;/p&gt;

&lt;h3&gt;
  
  
  Full observability and cost attribution
&lt;/h3&gt;

&lt;p&gt;A gateway logs every request with metadata including workflow ID, team, model, token usage, cost, and latency.&lt;/p&gt;

&lt;p&gt;Usage becomes queryable across workflows and providers. Cost attribution no longer depends on reconstructing logs after the fact.&lt;/p&gt;

&lt;h3&gt;
  
  
  Provider fallbacks and load balancing
&lt;/h3&gt;

&lt;p&gt;A gateway introduces routing logic across providers. Requests can fall back automatically when a provider fails and distribute across providers during high-volume periods. Workflows continue running without changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Guardrails on inputs and outputs
&lt;/h3&gt;

&lt;p&gt;A gateway applies runtime checks before requests reach the model and before responses return. This includes PII detection, content filtering, and prompt injection protection. Policies apply consistently across all workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Portkey provides that layer by intercepting every LLM request before it reaches a provider.
&lt;/h2&gt;

&lt;p&gt;Once connected, routing rules, usage limits, guardrails, logging, and access policies are applied centrally rather than inside individual workflows.&lt;/p&gt;

&lt;p&gt;Workflows continue to run as they are. For platform teams, model usage becomes visible, governed, and consistent across environments.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Setting this up requires a single change in how LLM calls are routed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Add an OpenAI node in your n8n workflow&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Configure credentials:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select any model in the node. The model defined in your Portkey Config overrides the node’s default model setting.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fag9m6s03o1tn5ggcml7o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fag9m6s03o1tn5ggcml7o.png" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Scaling n8n AI workflows across engineering teams
&lt;/h2&gt;

&lt;p&gt;Once n8n LLM traffic flows through a gateway, platform teams can enforce policies that make usage predictable and manageable across teams and environments.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Capability area&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;n8n (native)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI gateway (Portkey)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Credential management&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Provider keys stored in n8n credentials&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Centralized provider keys with scoped access per team/workflow&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Access control&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Workflow-level RBAC only&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Model-level access control with scoped API keys&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;LLM routing&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Not available&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Fallbacks, load balancing, conditional routing&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Budget controls&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;No native limits&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Per-team and per-workflow budget limits and rate limits&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Observability&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Execution history only&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Detailed logs with tokens, cost, latency, and metadata&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Cost attribution&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Not available&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Usage breakdown by workflow, team, or environment&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Guardrails&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Not available&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;PII detection, content filtering, prompt injection protection&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Provider management&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Configured per workflow&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Centralized configuration with multi-provider routing&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Auditability&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Limited visibility&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Complete request and response tracking&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;h2&gt;
  
  
  What production-ready n8n AI workflows require next
&lt;/h2&gt;

&lt;p&gt;Start by routing a small set of workflows or a single team through the gateway. Apply budget limits, enable request logging, and define fallback providers early.&lt;/p&gt;

&lt;p&gt;With that layer in place, usage can expand across teams and workflows without losing control over cost, access, or reliability.&lt;/p&gt;

&lt;p&gt;As AI workflows grow more complex, with longer execution paths and higher token usage, this layer becomes necessary to keep operations stable.&lt;/p&gt;

&lt;p&gt;Refer to&lt;a href="https://portkey.ai/docs/integrations/libraries/n8n?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;/a&gt;Portkey’s &lt;a href="https://portkey.ai/docs/integrations/libraries/n8n?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;n8n integration documentation&lt;/u&gt;&lt;/a&gt; or&lt;a href="https://portkey.ai/book-a-demo?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;book a demo&lt;/u&gt;&lt;/a&gt; to see how this fits into your existing setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQs
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Does connecting n8n to Portkey require changing my existing workflows?
&lt;/h3&gt;

&lt;p&gt;No. Only the OpenAI node credentials change. Workflow logic, triggers, routing, and execution structure remain exactly the same after connecting Portkey as the gateway layer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which LLM providers can I use with n8n through Portkey?
&lt;/h3&gt;

&lt;p&gt;You can use OpenAI, Anthropic, Gemini, Azure OpenAI, AWS Bedrock, Vertex AI, and others through one gateway endpoint without modifying workflows when switching providers or models.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I attribute LLM costs to specific n8n workflows or teams?
&lt;/h3&gt;

&lt;p&gt;Portkey metadata tags attach each request to a workflow, team, or environment. Token usage, latency, and cost become searchable across providers from one centralized dashboard.&lt;/p&gt;

&lt;h3&gt;
  
  
  What happens to my n8n workflows if the primary LLM provider goes down?
&lt;/h3&gt;

&lt;p&gt;Fallback targets defined in Portkey Configs automatically reroute requests to another provider. Workflows continue running without credential updates or execution changes inside n8n.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I set different model access rules for different teams using n8n?
&lt;/h3&gt;

&lt;p&gt;Yes. Scoped Portkey &lt;a href="https://portkey.ai/blog/secret-references-ai-api-key-management/" rel="noopener noreferrer"&gt;&lt;u&gt;API keys&lt;/u&gt;&lt;/a&gt; allow separate model access, rate limits, and budget controls per team without exposing provider credentials or modifying existing workflow logic.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>llm</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>OpenAI Codex best practices</title>
      <dc:creator>Drishti Shah</dc:creator>
      <pubDate>Mon, 20 Apr 2026 21:26:50 +0000</pubDate>
      <link>https://dev.to/portkey/openai-codex-best-practices-536l</link>
      <guid>https://dev.to/portkey/openai-codex-best-practices-536l</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fneu3r59p758dz4ruohky.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fneu3r59p758dz4ruohky.png" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Codex works well for one developer. The moment it scales to an enterprise team, the operational gaps show up fast: no visibility into who's spending what, API keys scattered across machines with no clean revocation path, no isolation between teams sharing the same provider capacity, and no fallback when OpenAI's API goes down.&lt;/p&gt;

&lt;p&gt;None of these problems is visible in individual developer workflows. All of them surface fast in org-wide deployments.&lt;/p&gt;

&lt;p&gt;This guide focuses on what changes at that point: the operational controls required to run Codex safely and predictably across teams.&lt;/p&gt;

&lt;h2&gt;
  
  
  How teams access OpenAI Codex today
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://openai.com/codex/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;OpenAI Codex&lt;/u&gt;&lt;/a&gt; is a &lt;strong&gt;coding AI Agent&lt;/strong&gt; that teams can access through two modes currently:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Access mode&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it means operationally&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Subscription (Plus, Pro, Business, Edu, Enterprise)&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Usage included in plan; shared credit pool across the workspace&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;No per-developer breakdown; Business plans can purchase additional credits; Enterprise provides a shared credit pool&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;API&lt;br&gt; (Responses API)&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Pay-per-token; usage tracked at the API level&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Programmatic control, but every developer holds a raw provider key&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;p&gt;Subscription mode ties usage to ChatGPT account management with limited attribution. API mode gives programmatic control but introduces key sprawl at the team scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where OpenAI Codex best practices break down at scale
&lt;/h2&gt;

&lt;p&gt;The moment Codex moves from one developer to many, the gaps that OpenAI Codex best practices are meant to address start showing up across every team:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Cost and token visibility become difficult to interpret.&lt;/strong&gt; A single Codex task can trigger dozens of underlying model calls, making it unclear how usage maps back to a developer, team, or workflow. Enterprise plans provide totals, not per-team breakdowns. At month end, there is no clear answer to “which team spent what.”&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Credential sprawl introduces uncertainty.&lt;/strong&gt; Provider keys are spread across local files, shell environments, and internal channels, with no clear ownership or lifecycle. Over time, it becomes unclear who has access, where keys are stored, and what they are being used for.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reliability is tied to a single provider.&lt;/strong&gt; When requests fail or degrade, workflows stall with no alternative path. Teams that need to route through different providers for compliance or cost reasons have no consistent way to do so.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Access control and team isolation become difficult to enforce.&lt;/strong&gt; Usage from one team can silently consume shared capacity allocated to another, with no clear boundary between workloads. Access is not scoped at the team or project level, and over time it becomes unclear who is using Codex, for what purpose, and at what cost.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  OpenAI Codex best practices: The six operational controls every team needs
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6qcs7ktfjcs6dug8t8yq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6qcs7ktfjcs6dug8t8yq.png" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using Portkey's &lt;a href="https://portkey.ai/features/ai-gateway?ref=portkey.ai" rel="noopener noreferrer"&gt;AI gateway&lt;/a&gt;, build a centralized to control and monitor provider, users and API keys.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Manage credential centrally
&lt;/h3&gt;

&lt;p&gt;Store provider API keys centrally instead of distributing them across developer environments. Developers should never handle raw credentials. Issue scoped API keys per team or project with defined permissions, budgets, and rate limits. This allows access to be revoked or rotated instantly without touching individual machines. The same setup should support multiple providers and models without requiring per-developer configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Connect to multiple providers at once
&lt;/h3&gt;

&lt;p&gt;With Portkey, allow your teams to switch between providers of their choice. Admin teams can centrally control access to providers and models, while adding budgets and rate limits for each.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Get visibility into costs and usage
&lt;/h3&gt;

&lt;p&gt;With requests flowing via Portkey, you can see detailed costs and usage, down to user level. You can also add metadata to each request. The same logs are critical for debugging multi-step agent workflows where failures need to be traced across multiple requests.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Apply guardrails to inputs and outputs
&lt;/h3&gt;

&lt;p&gt;Codex runs with developer-level access, so sensitive data can enter prompts without inspection. Apply validation to both inputs and outputs, including PII detection, content filtering, prompt injection protection, and token limits. Guardrails should be enforced at the gateway layer so they apply consistently across all developers without requiring local configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Enforce RBAC and maintain a full audit trail
&lt;/h3&gt;

&lt;p&gt;Access should map to organizational structure. Use scoped API keys to define which models, providers, and environments each team or developer can access. Maintain a hierarchy across org, team, and developer levels. This ensures teams operate independently while preserving clear boundaries and enabling centralized governance and traceability.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to implement these controls with Portkey
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1gvt0jzqhxkl2gj9iika.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1gvt0jzqhxkl2gj9iika.png" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As an AI gateway, &lt;a href="http://portkey.ai/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;Portkey&lt;/u&gt;&lt;/a&gt; sits between Codex and providers like OpenAI, Anthropic, AWS Bedrock, and Vertex AI, centralizing model access into a single system.&lt;/p&gt;

&lt;p&gt;Cost, tokens, and latency are tracked per request. Budgets and rate limits are enforced at the team or project level. Access is scoped through API keys, and traffic can be routed across providers with fallbacks and retries configured centrally.&lt;/p&gt;

&lt;p&gt;Developers continue using Codex as usual. For platform teams, model access becomes centralized, observable, and controlled.&lt;/p&gt;

&lt;p&gt;To &lt;a href="https://portkey.ai/docs/integrations/libraries/codex?ref=portkey.ai" rel="noopener noreferrer"&gt;integrate Codex with Portkey&lt;/a&gt;, read the complete documentation here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running Codex as infrastructure
&lt;/h2&gt;

&lt;p&gt;If you are running Codex across multiple teams, start by routing one team through a gateway, setting budget limits, and enabling request logging and fallback routing.&lt;/p&gt;

&lt;p&gt;Once this layer is in place, expand usage across teams without losing visibility, access control, or cost predictability.&lt;/p&gt;

&lt;p&gt;Refer to the &lt;a href="https://portkey.ai/docs/integrations/libraries/codex?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;OpenAI Codex integration docs&lt;/u&gt;&lt;/a&gt; or book a &lt;a href="https://portkey.sh/blog?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;personalized demo&lt;/u&gt;&lt;/a&gt; for a walkthrough on enterprise deployment.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQs
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What breaks first when Codex scales across teams?
&lt;/h3&gt;

&lt;p&gt;Cost visibility and access control. Usage cannot be attributed after the fact, and API keys are distributed without scope or central revocation.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do teams prevent one session from exhausting shared credits?
&lt;/h3&gt;

&lt;p&gt;Set per-developer and per-team budget and rate limits at the gateway layer before issuing access. Isolate teams into separate workspaces so one group's usage cannot consume another's capacity.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I get per-team cost attribution for Codex usage?
&lt;/h3&gt;

&lt;p&gt;Tag every request with team, project, and developer metadata at the gateway layer. Filter by tag in the &lt;a href="https://portkey.ai/blog/buyers-guide-to-llm-observability-tools/" rel="noopener noreferrer"&gt;&lt;u&gt;observability&lt;/u&gt;&lt;/a&gt; dashboard. Without metadata tagging, attribution requires manual log analysis.&lt;/p&gt;

&lt;h3&gt;
  
  
  What happens when the primary provider fails?
&lt;/h3&gt;

&lt;p&gt;Without a configured fallback, all in-flight sessions and new requests fail immediately with no native retry or reroute. With automatic failover at the gateway layer, requests route to an alternative provider without developer intervention.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I route OpenAI Codex through AWS Bedrock or Google Vertex AI?
&lt;/h3&gt;

&lt;p&gt;Yes. Route Codex through a gateway that supports multi-provider configs. Switch providers by updating the provider slug in config.toml with no changes to individual developer setups.&lt;/p&gt;

</description>
      <category>aiagents</category>
    </item>
    <item>
      <title>Semantic caching thresholds and why they matter</title>
      <dc:creator>Drishti Shah</dc:creator>
      <pubDate>Sat, 18 Apr 2026 22:41:45 +0000</pubDate>
      <link>https://dev.to/portkey/semantic-caching-thresholds-and-why-they-matter-4ab3</link>
      <guid>https://dev.to/portkey/semantic-caching-thresholds-and-why-they-matter-4ab3</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllq82solemj7bl3bvcgi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllq82solemj7bl3bvcgi.jpg" alt="Semantic caching thresholds and why they matter" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;LLM apps waste a surprising amount of time and money answering the same question over and over again because users ask it in slightly different ways. A basic cache does not help here. It only works when the input text is identical. In real usage, that almost never happens.&lt;/p&gt;

&lt;p&gt;Semantic caching fixes this by matching meaning instead of wording. It turns each query into a vector and checks whether a similar intent has already been answered. If it has, the system returns the cached response instead of calling the model again.&lt;/p&gt;

&lt;p&gt;🔎 AWS found that semantic caching reduced cost by &lt;a href="https://aws.amazon.com/blogs/database/lower-cost-and-latency-for-ai-using-amazon-elasticache-as-a-semantic-cache-with-amazon-bedrock/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;up to 86%&lt;/u&gt;&lt;/a&gt; and improved latency by 88%, with cache hits returning in milliseconds instead of seconds.&lt;/p&gt;

&lt;p&gt;However, the similarity threshold controls whether any of this works. It defines how close two queries need to be before the system reuses a response. If that threshold is too strict, most requests miss the cache. If it is too loose, the system starts returning answers that do not quite fit.&lt;/p&gt;

&lt;p&gt;But don’t worry, this post’s got you covered. It’ll explain how semantic caching works, how to set the right threshold, and how to handle the real production issues that follow, including stale data, multi-turn context, and monitoring cache performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How semantic caching works&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before getting into embeddings, it’s important to separate three caching approaches that are often conflated but solve very different problems.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Type&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Where it operates&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;What it matches&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Limitation&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Exact-match caching&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Application layer, string key lookup.&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Identical input strings only.&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Near-zero hit rate on natural language. Different phrasing always results in a miss.&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Prompt / prefix caching&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Provider-side (&lt;a href="https://openai.com/?ref=portkey.ai" rel="noopener noreferrer"&gt;OpenAI&lt;/a&gt;, &lt;a href="https://www.anthropic.com/?ref=portkey.ai" rel="noopener noreferrer"&gt;Anthropic&lt;/a&gt;, etc.).&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Identical prompt prefixes (shared system prompts).&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;No understanding of meaning. Only helps when large parts of the prompt are identical.&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Semantic caching&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Application or gateway layer.&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Queries with similar meaning regardless of phrasing.&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Requires embeddings + vector store. Accuracy depends on the threshold and the embedding quality.&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;p&gt;All three approaches operate at different layers and can be used together.&lt;/p&gt;

&lt;p&gt;Exact-match caching is the simplest form. The system stores a response and only reuses it if the exact same input appears again. That works well for structured data, but breaks down completely with natural language, where users rarely phrase things the same way twice.&lt;/p&gt;

&lt;p&gt;Prompt caching is a provider feature you enable through an API setting. It reduces the cost of reprocessing shared context, like system prompts or long instructions. This improves efficiency, but it does not help with reusing answers across different user queries. &lt;/p&gt;

&lt;p&gt;Meanwhile, semantic caching is something you build or adopt at the application or gateway layer. It prevents redundant model calls by reusing responses for queries that mean the same thing.&lt;/p&gt;

&lt;p&gt;For example, &lt;em&gt;“What’s your return policy?”&lt;/em&gt;, &lt;em&gt;“How do I return something?”&lt;/em&gt;, and &lt;em&gt;“Can I send this back?”&lt;/em&gt; would all miss an exact-match cache because the wording is different. With semantic caching, these questions map to the same intent and reuse a single stored response.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;From query to cache hit in four steps&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flxv8io27j5u2uvoe4zi8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flxv8io27j5u2uvoe4zi8.png" alt="Semantic caching thresholds and why they matter" width="800" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To understand how this works in practice, it helps to break down what happens at runtime:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Convert the query into an embedding:&lt;/strong&gt; Every incoming query is first passed through an embedding model, which transforms the text into a numerical vector that represents its meaning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search for similar past queries:&lt;/strong&gt; The system queries a vector store (such as &lt;a href="https://redis.io/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;Redis&lt;/u&gt;&lt;/a&gt;, &lt;a href="https://www.pinecone.io/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;Pinecone&lt;/u&gt;&lt;/a&gt;, &lt;a href="https://github.com/pgvector/pgvector?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;pgvector&lt;/u&gt;&lt;/a&gt;, etc.) to find embeddings that are close in meaning. This is done using a similarity metric like cosine similarity, for example, which has a mathematical range of −1 to 1. A score of 1 means identical direction, 0 means orthogonal, and −1 means diametrically opposed. In practice, text embeddings tend to produce positive scores, but this is model-dependent behavior, not a mathematical guarantee.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decide whether it is a cache hit:&lt;/strong&gt; The system compares the best match against a configured similarity threshold. If the score exceeds that threshold, it is treated as a cache hit, and the stored response is returned immediately.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Handle the cache miss:&lt;/strong&gt; If no match meets the threshold, the request is sent to the LLM. Latency at this step varies widely by model, prompt length, and whether you measure time-to-first-token or full response time. The response is then stored along with its embedding so it can be reused in future requests.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This setup introduces two components that traditional caches do not require: an embedding model to generate vectors and a vector store capable of efficient similarity search.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Choosing the right similarity threshold for your use case&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Most teams assume a stricter similarity threshold is safer, but the data shows that that’s not always true.&lt;/p&gt;

&lt;p&gt;AWS tested multiple thresholds on real chatbot queries using Claude 3 Haiku and Titan Embeddings. The results highlight how much performance depends on where you set the cutoff.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Threshold&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Hit rate&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Accuracy&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Cost savings&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;0.99 (strict)&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;23.5%&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;92.1%&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;15.8%&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;0.95&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;56.0%&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;92.6%&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;51.9%&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;0.90&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;74.5%&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;92.3%&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;72.5%&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;0.80&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;87.6%&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;91.8%&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;84.6%&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;0.75 (permissive)&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;90.3%&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;91.2%&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;86.3%&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;p&gt;Moving from a strict threshold of 0.99 to a more permissive 0.75 barely changes accuracy, with less than a one percentage point difference. At the same time, cost savings increase by roughly 70 percentage points. This means you can allow significantly more cache reuse without meaningfully degrading quality for general chatbot scenarios.&lt;/p&gt;

&lt;p&gt;But this only holds when “similar” queries truly lead to the same answer.&lt;/p&gt;

&lt;p&gt;In domain-specific systems, that assumption breaks. In medical or legal use cases, small wording differences can change the meaning entirely. A cached response that is slightly off can be harmful.&lt;/p&gt;

&lt;p&gt;The same issue shows up in technical documentation. Queries like “How to fix Error A” and “How to fix Error B” may look similar in embeddings, but they require completely different fixes.&lt;/p&gt;

&lt;p&gt;So the real risk is how much your domain can tolerate small mismatches in meaning.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;How to choose your tuning threshold&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A practical way to approach this is to treat threshold selection as an evaluation problem:&lt;/p&gt;

&lt;p&gt;Start with a threshold between 0.90 and 0.95. This range gives you a strong baseline where reuse is meaningful without introducing obvious errors. From there, build a validation set that reflects your real usage. Include two types of pairs. Queries that clearly express the same intent, and queries that look similar but should produce different answers.&lt;/p&gt;

&lt;p&gt;Run these through your cache and lower the threshold gradually. At each step, track the false positive rate, which is when the system reuses a response it should not. This is the metric that matters most.&lt;/p&gt;

&lt;p&gt;Once false positives start to exceed roughly 3% to 5%, you have reached the limit of your embedding model. At that point, adjusting the threshold further will not help. The model itself cannot reliably separate “same intent” from “similar but different.” Fixing that requires improving or replacing the embedding model.&lt;/p&gt;

&lt;p&gt;Portkey takes a more opinionated production approach to threshold tuning. Instead of relying on arbitrary values, it recommends starting around 0.95 similarity and validating performance through backtesting on real traffic. Based on learnings from &lt;a href="https://portkey.ai/blog/implementing-frugalgpt-smarter-llm-usage-for-lower-costs/" rel="noopener noreferrer"&gt;&lt;u&gt;over 250 million&lt;/u&gt;&lt;/a&gt; cache requests, teams are advised to test on roughly 5,000 queries and adjust until accuracy consistently stays above 99%. In practice, Portkey applies a high-confidence threshold before returning cache hits, with tests reporting around &lt;a href="https://portkey.ai/blog/reducing-llm-costs-and-latency-semantic-cache/" rel="noopener noreferrer"&gt;&lt;u&gt;99% user-rated accuracy&lt;/u&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This differs from a fully DIY setup. Portkey does not expose user-configurable thresholds. Similarity confidence is managed internally rather than exposed as a tuning knob. Teams that want to experiment across a wider range of thresholds, like the 0.5 to 0.99 range used in benchmarks, will need a self-managed setup.&lt;/p&gt;


&lt;p&gt;&amp;lt;!--kg-card-begin: html--&amp;gt;&lt;/p&gt;
Inline CTA&amp;lt;br&amp;gt;&lt;br&gt;
        * {&amp;lt;br&amp;gt;&lt;br&gt;
            margin: 0;&amp;lt;br&amp;gt;&lt;br&gt;
            padding: 0;&amp;lt;br&amp;gt;&lt;br&gt;
            box-sizing: border-box;&amp;lt;br&amp;gt;&lt;br&gt;
        }&amp;lt;/p&amp;gt;&lt;br&gt;
&amp;lt;div class="highlight"&amp;gt;&amp;lt;pre class="highlight plaintext"&amp;gt;&amp;lt;code&amp;gt;    body {&lt;br&gt;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;&lt;br&gt;
        line-height: 1.6;&lt;br&gt;
        color: #333;&lt;br&gt;
        background: #f5f5f5;&lt;br&gt;
        padding: 40px 20px;&lt;br&gt;
        display: flex;&lt;br&gt;
        align-items: center;&lt;br&gt;
        justify-content: center;&lt;br&gt;
        min-height: 100vh;&lt;br&gt;
    }
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
    max-width: 1200px;
    width: 100%;
}

/* Inline CTA */
.cta-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 30px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 20px;
}

.cta-inline-content h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.cta-inline-content p {
    color: #666;
    font-size: 16px;
}

/* Button Styles */
.btn-primary {
    display: inline-block;
    background: #000;
    color: white;
    padding: 14px 32px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.btn-primary:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-secondary {
    display: inline-block;
    background: white;
    color: #000;
    padding: 14px 32px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid #000;
    cursor: pointer;
    font-size: 16px;
}

.btn-secondary:hover {
    background: #000;
    color: white;
}

.btn-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .cta-inline {
        flex-direction: column;
        text-align: center;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        text-align: center;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&amp;amp;lt;/style&amp;amp;gt;&lt;br&gt;
&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;h3&amp;gt;&lt;br&gt;
  &amp;lt;a name="ready-to-get-started" href="#ready-to-get-started" class="anchor"&amp;gt;&lt;br&gt;
  &amp;lt;/a&amp;gt;&lt;br&gt;
  Ready to get started?&lt;br&gt;
&amp;lt;/h3&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;Create your account and start building in minutes&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;&amp;lt;a href="&lt;a href="https://app.portkey.ai/signup?ref=portkey.ai%22&amp;gt;Get" rel="noopener noreferrer"&gt;https://app.portkey.ai/signup?ref=portkey.ai"&amp;amp;gt;Get&lt;/a&gt; Started&amp;lt;/a&amp;gt;&amp;lt;a href="&lt;a href="https://portkey.ai/book-a-demo?ref=portkey.ai%22&amp;gt;Book" rel="noopener noreferrer"&gt;https://portkey.ai/book-a-demo?ref=portkey.ai"&amp;amp;gt;Book&lt;/a&gt; a Demo&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;!--kg-card-end: html--&amp;gt;&lt;br&gt;
&amp;lt;h2&amp;gt;&lt;br&gt;
  &amp;lt;a name="ttl-invalidation-and-keeping-cached-responses-fresh" href="#ttl-invalidation-and-keeping-cached-responses-fresh" class="anchor"&amp;gt;&lt;br&gt;
  &amp;lt;/a&amp;gt;&lt;br&gt;
  &amp;lt;strong&amp;gt;TTL, invalidation, and keeping cached responses fresh&amp;lt;/strong&amp;gt;&lt;br&gt;
&amp;lt;/h2&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;A semantic cache can return a correct match, but an outdated answer. That’s why you need to manage when cached responses expire or are refreshed using the following three mechanisms.&amp;lt;/p&amp;gt;&lt;br&gt;
&amp;lt;h3&amp;gt;&lt;br&gt;
  &amp;lt;a name="timebased-expiration-ttl" href="#timebased-expiration-ttl" class="anchor"&amp;gt;&lt;br&gt;
  &amp;lt;/a&amp;gt;&lt;br&gt;
  &amp;lt;strong&amp;gt;Time-based expiration (TTL)&amp;lt;/strong&amp;gt;&lt;br&gt;
&amp;lt;/h3&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;TTL defines how long a cached response is considered valid before it expires automatically. The right TTL depends entirely on how often the underlying data changes.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;Short TTLs reduce the risk of stale answers but lower your cache hit rate. Longer TTLs improve reuse but increase the chance of serving outdated information.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;A critical best practice is adding random jitter to TTL values. Without it, many entries expire simultaneously, causing a spike of cache misses and LLM calls (the “thundering herd” problem). Jitter spreads expirations over time and stabilizes system load..&amp;lt;/p&amp;gt;&lt;br&gt;
&amp;lt;h3&amp;gt;&lt;br&gt;
  &amp;lt;a name="eventtriggered-invalidation" href="#eventtriggered-invalidation" class="anchor"&amp;gt;&lt;br&gt;
  &amp;lt;/a&amp;gt;&lt;br&gt;
  &amp;lt;strong&amp;gt;Event-triggered invalidation&amp;lt;/strong&amp;gt;&lt;br&gt;
&amp;lt;/h3&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;Unlike TTL, which expires entries passively over time, event-triggered invalidation actively removes cache entries in response to specific changes in underlying data or systems. This ensures the cache reflects real-world updates as they happen. &amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;For example, when a pricing update occurs, all related cached responses should be immediately cleared rather than waiting for TTL expiry. This approach prevents serving outdated answers within the TTL window and is essential for highly dynamic data.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;💡 In production systems like Portkey, cache behavior is &amp;lt;a href="&lt;a href="https://portkey.ai/docs/product/ai-gateway/cache-simple-and-semantic?ref=portkey.ai%22&amp;gt;&amp;lt;u&amp;gt;controlled" rel="noopener noreferrer"&gt;https://portkey.ai/docs/product/ai-gateway/cache-simple-and-semantic?ref=portkey.ai"&amp;amp;gt;&amp;amp;lt;u&amp;amp;gt;controlled&lt;/a&gt; through TTL settings&amp;lt;/u&amp;gt;&amp;lt;/a&amp;gt;, and requests can also use Force Refresh to bypass an existing cached response.&amp;lt;/p&amp;gt;&lt;br&gt;
&amp;lt;h2&amp;gt;&lt;br&gt;
  &amp;lt;a name="why-multiturn-conversations-break-naive-caching" href="#why-multiturn-conversations-break-naive-caching" class="anchor"&amp;gt;&lt;br&gt;
  &amp;lt;/a&amp;gt;&lt;br&gt;
  &amp;lt;strong&amp;gt;Why multi-turn conversations break naive caching&amp;lt;/strong&amp;gt;&lt;br&gt;
&amp;lt;/h2&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;Semantic caching works best when queries are self-contained, but multi-turn conversations and RAG pipelines rarely behave that way. In these settings, meaning is distributed across prior messages, so caching each query in isolation can produce answers that are technically correct yet contextually wrong.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;Consider one conversation where the system caches the query “What is the largest lake in North America?” Later, in a separate discussion about stadiums, a user asks, “What is the second largest?” A naive semantic cache may match this to the earlier geography query and return “Lake Huron.” The retrieval is semantically similar at the surface level, but completely wrong in intent because the conversational context is missing.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;There are two main ways to address this:&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;ul&amp;gt;&lt;br&gt;
&amp;lt;li&amp;gt;&amp;lt;strong&amp;gt;Context-aware embedding&amp;lt;/strong&amp;gt; , where the system embeds not just the latest user message but also the relevant conversational history retrieved from memory. This ensures the embedding reflects actual intent rather than isolated phrasing, which is why AWS recommends applying semantic caching to the combined query and context. The trade-off is that longer inputs generate more unique embeddings, reducing cache hit rates. As conversations grow, caching becomes less effective and may need to be bypassed.&amp;lt;/li&amp;gt;&lt;br&gt;
&amp;lt;li&amp;gt;&amp;lt;strong&amp;gt;Query rewriting&amp;lt;/strong&amp;gt; , where a lightweight model rewrites follow-up questions into standalone queries before cache lookup. For example, “What is the second largest?” becomes “What is the second largest stadium in the US?” This avoids embedding long context while preserving intent, improving reuse.&amp;lt;/li&amp;gt;&lt;br&gt;
&amp;lt;/ul&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;RAG pipelines face the same issue because retrieved documents effectively modify the query. Caching only the raw question ignores this augmentation and risks mismatches.&amp;lt;/p&amp;gt;&lt;br&gt;
&amp;lt;h2&amp;gt;&lt;br&gt;
  &amp;lt;a name="monitoring-a-semantic-cache-in-production" href="#monitoring-a-semantic-cache-in-production" class="anchor"&amp;gt;&lt;br&gt;
  &amp;lt;/a&amp;gt;&lt;br&gt;
  &amp;lt;strong&amp;gt;Monitoring a semantic cache in production&amp;lt;/strong&amp;gt;&lt;br&gt;
&amp;lt;/h2&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;The hardest problem with semantic caching is that failures are invisible by default. Unlike typical system errors, nothing breaks. A cache miss simply falls through to the LLM and returns a normal response. More dangerously, a bad cache hit returns an incorrect answer with full confidence and a 200 OK status. Without explicit instrumentation, you cannot tell whether the system is working or silently degrading. Even performance signals can mislead – cache hits are significantly faster than misses, but this latency gap is only visible if you track hits and misses separately.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;To make these issues observable, you need cache-specific metrics:&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;ul&amp;gt;&lt;br&gt;
&amp;lt;li&amp;gt;&amp;lt;strong&amp;gt;The cache hit ratio&amp;lt;/strong&amp;gt; provides a baseline efficiency signal, but it is not sufficient on its own. &amp;lt;/li&amp;gt;&lt;br&gt;
&amp;lt;li&amp;gt;&amp;lt;strong&amp;gt;Distribution of similarity&amp;lt;/strong&amp;gt; measures whether matches are strong or barely clear the threshold. &amp;lt;/li&amp;gt;&lt;br&gt;
&amp;lt;li&amp;gt;&amp;lt;strong&amp;gt;The latency differential&amp;lt;/strong&amp;gt; between hits and misses helps confirm that the cache is actually delivering performance gains. &amp;lt;/li&amp;gt;&lt;br&gt;
&amp;lt;/ul&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;Most importantly, you need a way to estimate false positives, typically through sampling and evaluation using humans or LLM-based judges.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;High hit rates can also hide serious problems. If 90% of requests are fast cache hits and 10% are slow or failing LLM calls, average latency looks healthy while real user experience suffers. To avoid this, monitor P99 latency for cache misses separately so fallback-path issues are not masked.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;In some cases, the safest approach is to bypass caching entirely. This includes real-time queries such as inventory or pricing, safety-critical outputs, and multi-step agent workflows where one incorrect cached step can corrupt everything downstream.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;This is where platforms like Portkey &amp;lt;a href="&lt;a href="https://portkey.ai/docs/product/ai-gateway/cache-simple-and-semantic?ref=portkey.ai%22&amp;gt;&amp;lt;u&amp;gt;go" rel="noopener noreferrer"&gt;https://portkey.ai/docs/product/ai-gateway/cache-simple-and-semantic?ref=portkey.ai"&amp;amp;gt;&amp;amp;lt;u&amp;amp;gt;go&lt;/a&gt; beyond basic caching&amp;lt;/u&amp;gt;&amp;lt;/a&amp;gt; by providing per-request cache status in logs and response metadata. The Logs UI surfaces statuses such as Cache hit or a miss while the analytics dashboard provides visibility into hit rate, latency savings, and cost savings, making cache performance measurable and easy to monitor.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;⭐ One large food delivery platform handling tens of millions of AI requests used Portkey’s caching, routing, and fallbacks to &amp;lt;a href="&lt;a href="https://portkey.ai/case-studies/leading-delivery-platform?ref=portkey.ai%22&amp;gt;&amp;lt;u&amp;gt;cut" rel="noopener noreferrer"&gt;https://portkey.ai/case-studies/leading-delivery-platform?ref=portkey.ai"&amp;amp;gt;&amp;amp;lt;u&amp;amp;gt;cut&lt;/a&gt; LLM spend by over $500K&amp;lt;/u&amp;gt;&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;&lt;br&gt;
&amp;lt;h2&amp;gt;&lt;br&gt;
  &amp;lt;a name="putting-semantic-caching-to-work" href="#putting-semantic-caching-to-work" class="anchor"&amp;gt;&lt;br&gt;
  &amp;lt;/a&amp;gt;&lt;br&gt;
  &amp;lt;strong&amp;gt;Putting semantic caching to work&amp;lt;/strong&amp;gt;&lt;br&gt;
&amp;lt;/h2&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;Semantic caching is a layer you add to your LLM stack, and there are multiple ways to implement it depending on how much control you want.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;Semantic caching can be implemented across a broad tooling landscape, each option balancing control and operational overhead. Open-source libraries like GPTCache offer flexibility for teams that want full control over embeddings and storage. Cloud-managed options such as Amazon ElastiCache and Azure Cosmos DB provide scalable, production-ready infrastructure with less setup. Dedicated vector-backed caches built on Redis are also common.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;For teams prioritizing speed and observability, AI gateways like Portkey offer managed semantic caching with built-in analytics, cross-provider support, and minimal integration overhead.&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;&amp;lt;a href="&lt;a href="https://portkey.ai/?ref=portkey.ai%22&amp;gt;&amp;lt;u&amp;gt;Explore" rel="noopener noreferrer"&gt;https://portkey.ai/?ref=portkey.ai"&amp;amp;gt;&amp;amp;lt;u&amp;amp;gt;Explore&lt;/a&gt; Portkey’s semantic caching&amp;lt;/u&amp;gt;&amp;lt;/a&amp;gt; to see how you can reduce cost, control quality, and ship faster without managing the infrastructure yourself!&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;&amp;amp;lt;!--kg-card-begin: html--&amp;amp;gt;&amp;lt;meta charset="UTF-8"&amp;gt;&amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;&amp;lt;title&amp;gt;Inline CTA&amp;lt;/title&amp;gt;&amp;lt;style&amp;gt;&amp;lt;br&amp;gt;&lt;br&gt;
        * {&amp;lt;br&amp;gt;&lt;br&gt;
            margin: 0;&amp;lt;br&amp;gt;&lt;br&gt;
            padding: 0;&amp;lt;br&amp;gt;&lt;br&gt;
            box-sizing: border-box;&amp;lt;br&amp;gt;&lt;br&gt;
        }&amp;lt;/p&amp;gt;&lt;br&gt;
&amp;lt;div class="highlight"&amp;gt;&amp;lt;pre class="highlight plaintext"&amp;gt;&amp;lt;code&amp;gt;    body {&lt;br&gt;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;&lt;br&gt;
        line-height: 1.6;&lt;br&gt;
        color: #333;&lt;br&gt;
        background: #f5f5f5;&lt;br&gt;
        padding: 40px 20px;&lt;br&gt;
        display: flex;&lt;br&gt;
        align-items: center;&lt;br&gt;
        justify-content: center;&lt;br&gt;
        min-height: 100vh;&lt;br&gt;
    }&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
    max-width: 1200px;
    width: 100%;
}

/* Inline CTA */
.cta-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 30px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 20px;
}

.cta-inline-content h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.cta-inline-content p {
    color: #666;
    font-size: 16px;
}

/* Button Styles */
.btn-primary {
    display: inline-block;
    background: #000;
    color: white;
    padding: 14px 32px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.btn-primary:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-secondary {
    display: inline-block;
    background: white;
    color: #000;
    padding: 14px 32px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid #000;
    cursor: pointer;
    font-size: 16px;
}

.btn-secondary:hover {
    background: #000;
    color: white;
}

.btn-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .cta-inline {
        flex-direction: column;
        text-align: center;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        text-align: center;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&amp;amp;lt;/style&amp;amp;gt;&lt;br&gt;
&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;h3&amp;gt;&lt;br&gt;
  &amp;lt;a name="ready-to-get-started" href="#ready-to-get-started" class="anchor"&amp;gt;&lt;br&gt;
  &amp;lt;/a&amp;gt;&lt;br&gt;
  Ready to get started?&lt;br&gt;
&amp;lt;/h3&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;Create your account and start building in minutes&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;&amp;lt;a href="&lt;a href="https://app.portkey.ai/signup?ref=portkey.ai%22&amp;gt;Get" rel="noopener noreferrer"&gt;https://app.portkey.ai/signup?ref=portkey.ai"&amp;amp;gt;Get&lt;/a&gt; Started&amp;lt;/a&amp;gt;&amp;lt;a href="&lt;a href="https://portkey.ai/book-a-demo?ref=portkey.ai%22&amp;gt;Book" rel="noopener noreferrer"&gt;https://portkey.ai/book-a-demo?ref=portkey.ai"&amp;amp;gt;Book&lt;/a&gt; a Demo&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;!--kg-card-end: html--&amp;gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>nlp</category>
      <category>performance</category>
    </item>
    <item>
      <title>How to choose the right AIOps platform</title>
      <dc:creator>Drishti Shah</dc:creator>
      <pubDate>Fri, 17 Apr 2026 22:09:01 +0000</pubDate>
      <link>https://dev.to/portkey/how-to-choose-the-right-aiops-platform-27lk</link>
      <guid>https://dev.to/portkey/how-to-choose-the-right-aiops-platform-27lk</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgn7yr7vue9n3rlnqa76f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgn7yr7vue9n3rlnqa76f.png" alt="How to choose the right AIOps platform" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your AI agent has been routing requests incorrectly, but your dashboards still show green because the infrastructure is healthy.&lt;/p&gt;

&lt;p&gt;Traditional ops were built for infrastructure systems. They do not account for workloads where correctness depends on prompts, models, and multi-step reasoning. This guide outlines what enterprises should expect from an AIOps platform built for generative AI.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;AI Agents and LLM apps are now production-critical systems&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Enterprises are embedding LLMs into revenue-generating, customer-facing, and internal decision workflows. An agent that routes customer requests, summarizes contracts, or generates compliance documents is now a system of record.&lt;/p&gt;

&lt;p&gt;However, only &lt;a href="https://www.gartner.com/en/articles/hype-cycle-for-artificial-intelligence?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;43% of organizations&lt;/u&gt;&lt;/a&gt; say their data is ready for AI, and fewer than 30% of AI leaders think their CEOs are satisfied with GenAI results&lt;/p&gt;

&lt;p&gt;Failures in LLM systems behave differently from infrastructure outages. A server is either up or down; it is binary. An LLM failure can be invisible. Wrong outputs that look correct, missed guardrails that go undetected, or runaway token costs that only appear on next month's bill. &lt;/p&gt;

&lt;p&gt;The blast radius is qualitatively different. One hallucinated response from a customer support agent can trigger dozens of escalation tickets before anyone notices the pattern.&lt;/p&gt;

&lt;p&gt;Teams are discovering that server-uptime thinking does not apply to LLM systems. Their correctness is probabilistic, and their behavior shifts with model and prompt changes. Without purpose-built operational tooling, enterprises are flying blind on their most strategically important systems.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Five capabilities to evaluate in an AIOps platform&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;When evaluating an AIOps platform for LLM and AI agent workloads, these five capabilities should be considered.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. Unified LLM observability&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Full request-level visibility across every model call, with distributed tracing for multi-step agent flows and analytics for latency, cost, and output behavior. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Portkey's observability layer is OTEL-compliant and captures the full request lifecycle: prompts, responses, token usage, latency, and metadata, all searchable and traceable across multi-step agent flows. This is backed by analysis of over 2 trillion production tokens processed across 3000+ models and 90+ regions.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2. Routing and resilience&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Fallbacks to secondary models when a primary provider fails. &lt;/li&gt;
&lt;li&gt;Load balancing across providers. &lt;/li&gt;
&lt;li&gt;Conditional routing based on request type, cost target, or latency requirements. &lt;/li&gt;
&lt;li&gt;Caching to reduce redundant model calls.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Portkey's &lt;a href="https://portkey.ai/features/ai-gateway?ref=portkey.ai" rel="noopener noreferrer"&gt;AI Gateway&lt;/a&gt; helps you set up load balancing, fallbacks, conditional routing, to keep your apps reliable, even on production scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. Guardrails and safety controls&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Real-time enforcement of content and safety policies on both inputs and outputs. &lt;/li&gt;
&lt;li&gt;Protection against prompt injection attacks&lt;/li&gt;
&lt;li&gt;The ability to route or reject requests that fail checks before they reach users, not just log them after.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Portkey runs 50+ guardrail checks, including both rule-based and model-based checks, helping you stay under compliance.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;4. Prompt management and versioning&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Collaborative prompt template creation with version control. &lt;/li&gt;
&lt;li&gt;Deploy prompt changes without code releases. &lt;/li&gt;
&lt;li&gt;Experimentation across models using the same prompt template.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Portkey's prompt studio lets teams create, version, and deploy prompt templates without code changes, and run experiments across models using the same template. Prompt changes can be promoted across environments independently of application deployments.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;5. Governance and cost controls&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;RBAC to control which teams and applications can access which models. &lt;/li&gt;
&lt;li&gt;Per-workspace and per-user budget limits. &lt;/li&gt;
&lt;li&gt;Audit logs that tie every LLM output to the team, prompt, and model that produced it. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Portkey manages over $180 million in annualized AI spend across its customer base, with per-team cost attribution, virtual key management, role-based access control, and full audit trails. It is ISO 27001 and SOC 2 certified, GDPR and HIPAA compliant, with SSO support for enterprise identity integration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2t8vcsd9cnj12nlbtfai.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2t8vcsd9cnj12nlbtfai.png" alt="How to choose the right AIOps platform" width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How enterprises actually adopt an AIOps platform&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Most teams already have LLMs running in production before they formalize how to operate them. The starting point should be getting clear on what you cannot currently see.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start by identifying one workflow and routing it through Portkey to get immediate visibility into requests, costs, and failures.&lt;/li&gt;
&lt;li&gt;Add routing and fallback rules next. Understanding your traffic patterns first makes it easier to write policies that reflect how your system actually behaves.&lt;/li&gt;
&lt;li&gt;Introduce guardrails before prompt versioning. Safety controls are harder to retrofit once workflows are in production.&lt;/li&gt;
&lt;li&gt;Roll out governance, access control, and cost attribution last. These require enough operational history to set limits that are meaningful rather than arbitrary.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What changes when LLMs become operational systems&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As &lt;a href="https://portkey.ai/blog/challenges-faced-by-agentic-ai-companies/" rel="noopener noreferrer"&gt;&lt;u&gt;agentic AI&lt;/u&gt;&lt;/a&gt; systems become more autonomous and multi-step, the need for centralized control only increases.&lt;/p&gt;

&lt;p&gt;If you are already running LLMs in production, the next step is centralizing how those systems are routed, monitored, and controlled. Explore Portkey’s &lt;a href="https://portkey.ai/docs?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;documentation&lt;/u&gt;&lt;/a&gt; to see how this works in practice, or &lt;a href="https://portkey.sh/blog?ref=portkey.ai" rel="noopener noreferrer"&gt;book a demo&lt;/a&gt; with us.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;FAQs&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Q: What makes LLM cost management harder than traditional systems?
&lt;/h3&gt;

&lt;p&gt;Costs scale with tokens and multi-step workflows, making them unpredictable without request-level tracking and budget enforcement.&lt;/p&gt;

&lt;h3&gt;
  
  
  Q: Do you need to change your application code to adopt AIOps?
&lt;/h3&gt;

&lt;p&gt;No. Most platforms start by routing existing traffic through a gateway to capture logs, apply controls, and add observability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Q: How do teams debug multi-step agent failures?
&lt;/h3&gt;

&lt;p&gt;By tracing the full execution path across model calls, tools, and prompts to identify where the output diverged.&lt;/p&gt;

&lt;h3&gt;
  
  
  Q: When should an enterprise introduce governance for LLM usage?
&lt;/h3&gt;

&lt;p&gt;As soon as multiple teams or workflows use LLMs, before cost, access, and compliance issues scale.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>devops</category>
      <category>llm</category>
    </item>
    <item>
      <title>What is AIOps?</title>
      <dc:creator>Drishti Shah</dc:creator>
      <pubDate>Thu, 16 Apr 2026 21:49:05 +0000</pubDate>
      <link>https://dev.to/portkey/what-is-aiops-3n8n</link>
      <guid>https://dev.to/portkey/what-is-aiops-3n8n</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv5q464y5082bfdoae1ie.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv5q464y5082bfdoae1ie.png" alt="What is AIOps?" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;LLM systems can fail in ways that never show up on a dashboard. Latency is fine, error rates are steady, infrastructure is green — and yet outputs are drifting, costs are climbing, and nobody can point to why.&lt;/p&gt;

&lt;p&gt;This is the gap most teams hit as they move AI from prototype to production. Traditional monitoring tells you whether your systems are &lt;em&gt;running&lt;/em&gt;, not whether they're &lt;em&gt;behaving correctly&lt;/em&gt;. Requests succeed, but you can't see which model decisions drove a cost spike, why output quality shifted after a config change, or whether a given response even met the intent behind it.&lt;/p&gt;

&lt;p&gt;AIOps shifts the focus from system health to how each request is executed. To make that work, you need a control layer that sits between your application and the models; one place where routing, policies, and visibility come together.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Why traditional MLOps falls short&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Most platform teams start with the monitoring they already have: infrastructure metrics, API logs, latency dashboards. These are necessary but not sufficient. Here's where they break down.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Visibility gaps&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Infrastructure metrics measure whether the system is running. They don't measure whether it's doing the right thing. A request that returns HTTP 200 with a hallucinated response looks identical to a correct one in your logs.&lt;/p&gt;

&lt;p&gt;The signals that actually matter for LLM behavior — prompt quality, output relevance, model decision paths — are either absent from standard observability tooling or fragmented across provider dashboards with no shared context.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;No request-level traceability&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In a multi-step LLM workflow, a single user request can trigger multiple model calls, tool invocations, and validation steps across services. Traditional observability collects signals at each layer independently, but there's no unified trace connecting them.&lt;/p&gt;

&lt;p&gt;When something goes wrong, you have isolated error events with no way to reconstruct the full execution path. Debugging becomes manual correlation across systems which becomes hard to reproduce.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;LLM failures are different&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Latency thresholds and error rate alerts are designed to catch infrastructure problems. LLM failures are different: incorrect outputs, degraded relevance, and cost drift don't move these metrics. Fallback chains can activate repeatedly due to poor response quality and the system will still appear healthy by every standard alert condition.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Costs are unpredictable&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In most setups, token usage and cost are tracked retroactively through provider billing dashboards. There's no mechanism to enforce limits at the request or workflow level during execution. A single misconfigured workflow can silently consume a disproportionate share of your budget before anyone notices.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;How AIOps solves these problems&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Each of the failures above has the same root cause: there is no single operational layer that governs how requests are executed. AIOps introduces that layer. Here is what it enables.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;End-to-end request traceability&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;With AIOps, every request carries a unified trace through its full execution path. You can see which prompt version ran, which model handled the request, how routing decisions were applied, what the output was, and where any failure occurred. Every step is connected under a single execution context.&lt;/p&gt;

&lt;p&gt;This means debugging an LLM failure stops being manual log correlation. You follow the trace the same way you would in any other distributed system. OpenTelemetry provides the standardization layer that makes this possible, structuring logs, metrics, and traces consistently so signals across infrastructure and LLM-specific layers can be correlated rather than analyzed in isolation.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Routing and policy enforcement at runtime&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;AIOps gives you the ability to define and enforce routing behavior explicitly, rather than letting it happen implicitly across individual services. You set conditions: which model handles which request, when fallbacks activate, how retries behave, what content policies apply before responses reach users.&lt;/p&gt;

&lt;p&gt;When something changes, such as a model degrading, a provider going down, or a cost threshold being hit, the system responds according to defined rules. Routing behavior becomes something you govern, not something you observe after the fact.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Usage control during execution, not after&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;AIOps shifts cost from a trailing metric to a governable variable. Instead of reviewing spend after the billing cycle closes, you can enforce constraints during execution:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Token limits per workflow, team, or API key&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://portkey.ai/docs/product/ai-gateway/virtual-keys/rate-limits?ref=portkey.ai" rel="noopener noreferrer"&gt;Rate limits&lt;/a&gt; on specific models or endpoints&lt;/li&gt;
&lt;li&gt;Requests that exceed defined thresholds are throttled or blocked&lt;/li&gt;
&lt;li&gt;Usage attributed to specific workflows or owners in real time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This means teams can enforce budgets, prevent runaway usage, and align model consumption with operational constraints without waiting for a billing surprise.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Governance and auditability&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As LLM systems scale across teams, AIOps gives you the ability to define and enforce who can call which models, under what conditions, and with what constraints. Access control operates at the model, provider, and API key level.&lt;/p&gt;

&lt;p&gt;Every request is logged with its associated prompt, model, routing decision, and output. This creates a traceable record that supports debugging, compliance validation, and root cause analysis at the request level. Governance stops being documentation and becomes something enforceable.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What this looks like in practice&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;The architecture that delivers AIOps for LLM systems is an operational layer that intercepts every request between your application and your model providers. At each step, AIOps evaluates routing policy, enforces access controls and usage limits, validates responses, and logs the full execution context.&lt;/p&gt;

&lt;p&gt;Platforms like Portkey's &lt;a href="https://portkey.ai/features/ai-gateway?ref=portkey.ai" rel="noopener noreferrer"&gt;AI Gateway&lt;/a&gt; implement this pattern, providing centralized routing, policy enforcement, and observability across all model interactions from a single interface.&lt;/p&gt;

&lt;p&gt;Teams that adopt this approach typically see the same outcomes: faster debugging because traces are complete, more predictable costs because limits are enforced at runtime, and more consistent model behavior because routing is governed by policy rather than scattered across services.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;FAQs&lt;/strong&gt;
&lt;/h1&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What problems does AIOps solve for LLM systems?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;AIOps addresses the visibility and control gaps that standard infrastructure monitoring cannot cover: output drift, cost spikes without obvious triggers, failed requests with no traceable root cause, and policy enforcement across teams and workflows. It shifts the focus from whether requests are completing to how they are executing.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How is AIOps different from monitoring?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Monitoring tells you whether your system is running. AIOps tells you how it is behaving and gives you controls to change that behavior. The distinction matters most when a system appears healthy by every infrastructure metric but is producing incorrect, expensive, or inconsistent outputs.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Where should teams start?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Pick one workflow with limited visibility and focus on tracing requests end-to-end across prompts, model selection, token usage, and execution path. Once you have that baseline, introduce controls such as routing rules and usage limits before expanding to other workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What skills are needed to implement AIOps for LLM systems?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Teams need familiarity with prompts and model behavior, basic observability concepts (logs, metrics, traces), and enough system design knowledge to introduce an operational layer between applications and models. Deep ML expertise is not required. This is fundamentally a platform engineering problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How do teams measure ROI?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The clearest signals are reduced time to root cause when something breaks, fewer unexpected cost increases, and fewer incidents caused by uncontrolled model behavior. Teams also report spending less time on manual log correlation and more time building, which is harder to quantify but consistently cited.&lt;/p&gt;

</description>
      <category>aigovernance</category>
    </item>
    <item>
      <title>The Harness Tax: The Dead Weight Inside Your Coding Agent</title>
      <dc:creator>Drishti Shah</dc:creator>
      <pubDate>Tue, 14 Apr 2026 06:53:26 +0000</pubDate>
      <link>https://dev.to/portkey/the-harness-tax-the-dead-weight-inside-your-coding-agent-fb5</link>
      <guid>https://dev.to/portkey/the-harness-tax-the-dead-weight-inside-your-coding-agent-fb5</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjk4nbuaa7d3ch0d3fk5c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjk4nbuaa7d3ch0d3fk5c.png" alt="The Harness Tax: The Dead Weight Inside Your Coding Agent" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://x.com/hwchase17/status/2042978500567609738?ref=portkey.ai" rel="noopener noreferrer"&gt;Harnesses are not going away&lt;/a&gt;. Even the best models rely on them. Claude Code alone has ~512k lines of harness code. But nobody talks about what that harness actually costs you at inference time.&lt;/p&gt;

&lt;p&gt;I wanted to know: when using coding agents, how much of the payload that hits the model is actually my message? And how much is the harness overhead added?&lt;/p&gt;

&lt;p&gt;So I pointed three agents at &lt;a href="https://portkey.ai/?ref=portkey.ai" rel="noopener noreferrer"&gt;Portkey's gateway&lt;/a&gt; and captured every request. &lt;a href="https://github.com/badlogic/pi-mono?ref=portkey.ai" rel="noopener noreferrer"&gt;Pi&lt;/a&gt; (the harness behind &lt;a href="https://openclaw.ai/?ref=portkey.ai" rel="noopener noreferrer"&gt;OpenClaw&lt;/a&gt;), &lt;a href="https://openai.com/index/codex/?ref=portkey.ai" rel="noopener noreferrer"&gt;OpenAI Codex&lt;/a&gt;, and &lt;a href="https://www.anthropic.com/product/claude-code?ref=portkey.ai" rel="noopener noreferrer"&gt;Claude Code&lt;/a&gt;. Same request and complete token visibility. Then I gave each one the same two messages&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Message 1: hey
Message 2: write a simple python script to check
fibonacci series and save on desktop as agent.py

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pi sent ~2,600 input tokens. Claude Code sent ~27,000. A 10x spread. Same task. Same model capability. The difference was pure harness overhead.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Harness Tax
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;The Harness Tax&lt;/strong&gt; is every token your agent spends on itself before it spends a single token on your task.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8nayy2o7cuyzt4jg72cc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8nayy2o7cuyzt4jg72cc.png" alt="The Harness Tax: The Dead Weight Inside Your Coding Agent" width="800" height="507"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You pay this tax before the model does a single unit of useful work.Every agent has one. You never see it unless you look at raw request logs. I routed all three agents through a gateway to get that visibility.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Goes Into the Harness Tax?
&lt;/h3&gt;

&lt;p&gt;Every request a coding agent makes to the model carries the full harness payload: tool definitions, system prompt, memory instructions, behavioral routing, and conversation history. All of it. On every turn.&lt;/p&gt;

&lt;p&gt;Claude Code's harness costs roughly 27,000 input tokens per request. Codex costs about 15,000. Pi costs about 2,600.&lt;/p&gt;

&lt;p&gt;And because the conversation history includes the model's previous responses, which were themselves inflated by verbose tool-call formatting, the payload grows faster than your actual conversation does.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0z69g3374tin4szcacn9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0z69g3374tin4szcacn9.png" alt="The Harness Tax: The Dead Weight Inside Your Coding Agent" width="800" height="781"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A real coding session runs 30 to 50 turns. At Claude Code's rate, a 40-turn session burns through 1.12 million input tokens. Roughly half of those are harness overhead.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 You pay the harness tax whether you use the tools or not. The 24 extra tools in Claude Code were defined but never called. Their definitions shipped on every request anyway.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Context Rot
&lt;/h2&gt;

&lt;p&gt;The harness tax isn’t just a cost problem. It’s an attention problem. Every extra token competes with your actual task: your code, your files, your intent.&lt;/p&gt;

&lt;p&gt;As the context window fills, the model gets worse at reasoning over the tokens that matter. Every token the harness adds competes for attention against your code, your files, and your actual task. On a complex refactor where the model needs to hold three source files, a test suite, and twenty turns of conversation, 28,000 tokens of framework plumbing aren't sitting idle. They're noise.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 A 200k context window carrying 28k tokens of harness overhead isn't a 200k window. It's a 172k window with worse attention distribution.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The harness rots in a second way: staleness. Every component encodes an assumption about what the model can't do on its own. Those assumptions go stale fast. More on that below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thin Harness, Fat skills
&lt;/h2&gt;

&lt;p&gt;Pi gives the model four capabilities: read. write, edit a file and run a shell command. That's the entire tool surface.&lt;/p&gt;

&lt;p&gt;The bet is that a model trained on millions of shell sessions, the internet, and GitHub repos already knows how to compose those primitives into anything else. You don't need a dedicated list_directory tool when ls -la exists. You don't need search_files when the model can write grep -r on its own.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"All frontier models have been RL-trained up the wazoo. They inherently understand what a coding agent is."— Mario Zechner, Pi's creator&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://www.anthropic.com/engineering/harness-design-long-running-apps?ref=portkey.ai" rel="noopener noreferrer"&gt;Anthropic's harness engineering team&lt;/a&gt; demonstrated this concretely over three model generations. Their coding agent harness for Sonnet 4.5 required context resets because the model would start wrapping up work prematurely as the window filled. Opus 4.5 shipped, resets became unnecessary. Opus 4.6 shipped; they stripped out sprint decomposition entirely, and it still worked better.&lt;/p&gt;

&lt;p&gt;Three model generations. Three layers of harness removed. Load-bearing in January, dead weight by March.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Harnesses encode assumptions that go stale as models improve -&lt;/em&gt; &lt;a href="https://www.anthropic.com/engineering/harness-design-long-running-apps?ref=portkey.ai" rel="noopener noreferrer"&gt;Anthropic Blog&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;An agent has three layers. Complexity should push up into the model, which gets better at reasoning, planning, and self-correction with every release. It should push down into infrastructure, where routing, governance, observability, and cost controls don't ride along in the context window. The harness in the middle should carry as little as possible.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv8bjgjj8aqst06n6u644.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv8bjgjj8aqst06n6u644.png" alt="The Harness Tax: The Dead Weight Inside Your Coding Agent" width="800" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What This Means
&lt;/h2&gt;

&lt;p&gt;This was a narrow benchmark. Two messages, one trivial task. Claude Code's deep tooling may earn back its overhead on complex work that genuinely exercises those 28 tools.&lt;/p&gt;

&lt;p&gt;What this benchmark does show: the overhead exists, it's measurable, and almost nobody is looking at it. For most tasks, the model is carrying 15,000 tokens of framework plumbing it doesn't need. And that overhead is growing slower than models are improving, which means the tax gets harder to justify.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Route your agent through&lt;/em&gt; &lt;a href="https://portkey.ai/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;em&gt;Portkey&lt;/em&gt;&lt;/a&gt; &lt;em&gt;to measure your own harness tax.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Further Reading:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.claudeusercontent.com/?domain=claude.ai&amp;amp;parentOrigin=https%3A%2F%2Fclaude.ai&amp;amp;errorReportingMode=parent&amp;amp;formattedSpreadsheets=true&amp;amp;ref=portkey.ai" rel="noopener noreferrer"&gt;Mario Zechner's blog post on building Pi — the design rationale&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.claudeusercontent.com/?domain=claude.ai&amp;amp;parentOrigin=https%3A%2F%2Fclaude.ai&amp;amp;errorReportingMode=parent&amp;amp;formattedSpreadsheets=true&amp;amp;ref=portkey.ai" rel="noopener noreferrer"&gt;Armin Ronacher: "Pi: The Minimal Agent Within OpenClaw"&lt;/a&gt;&lt;a href="https://www.claudeusercontent.com/?domain=claude.ai&amp;amp;parentOrigin=https%3A%2F%2Fclaude.ai&amp;amp;errorReportingMode=parent&amp;amp;formattedSpreadsheets=true&amp;amp;ref=portkey.ai" rel="noopener noreferrer"&gt;Pi on GitHub · OpenClaw on GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This article was first published on &lt;a href="https://x.com/siddhxrth10/status/2043703343453987133?ref=portkey.ai" rel="noopener noreferrer"&gt;X&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>agentsinproduction</category>
    </item>
    <item>
      <title>Cursor best practices for enterprise teams</title>
      <dc:creator>Drishti Shah</dc:creator>
      <pubDate>Thu, 09 Apr 2026 09:23:12 +0000</pubDate>
      <link>https://dev.to/portkey/cursor-best-practices-for-enterprise-teams-30hn</link>
      <guid>https://dev.to/portkey/cursor-best-practices-for-enterprise-teams-30hn</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6mnjf1u9tqbf2vxzmrll.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6mnjf1u9tqbf2vxzmrll.png" alt="Cursor best practices for enterprise teams" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cursor has become one of the most widely adopted AI coding tools in enterprise engineering organizations. The individual productivity gains are real. &lt;/p&gt;

&lt;p&gt;But operational control across teams is a different problem entirely. Platform teams now face a new challenge: scattered API keys, invisible token spend, no budget controls, and compliance gaps.&lt;/p&gt;

&lt;p&gt;This best practices playbook is for platform teams running Cursor across dozens or hundreds of engineers, and how they can implement them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Cursor is and why teams are adopting it at scale
&lt;/h2&gt;

&lt;p&gt;Cursor is an AI-first code editor built on a VS Code fork, designed for AI-native development workflows. It integrates large language models directly into the development environment for autocomplete, multi-file edits, codebase-aware chat, and agent-driven tasks that can plan and implement changes across a repository.&lt;/p&gt;

&lt;p&gt;Teams typically access Cursor through one of several plans, depending on how they want to manage usage and billing:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Plan&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it includes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Free&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Exploration and evaluation&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Limited premium requests and basic AI features&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Pro&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Individual developers&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Higher request limits and access to more capable models&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Teams&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Engineering teams&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Centralized billing, usage analytics, SSO, and admin controls&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Enterprise&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Large organizations&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Custom pricing, expanded quotas, SCIM provisioning, and enhanced compliance controls&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;p&gt;Many teams also use Cursor in &lt;strong&gt;Bring Your Own Key (BYOK)&lt;/strong&gt; mode, connecting directly to providers like OpenAI, Anthropic, Bedrock, or Vertex AI and paying per API usage. &lt;/p&gt;

&lt;h2&gt;
  
  
  Where Cursor's native tooling falls short at scale
&lt;/h2&gt;

&lt;p&gt;At enterprise scale, five core operational gaps emerge. These are infrastructure and governance gaps, not issues with how developers use Cursor.&lt;/p&gt;

&lt;h3&gt;
  
  
  Vendor lock-in
&lt;/h3&gt;

&lt;p&gt;Cursor connects to whatever provider credentials a developer supplies. Switching providers, models, or accounts requires updating configurations on individual machines. There is no centralized way to manage provider selection, failover, or traffic distribution at the team level.&lt;/p&gt;

&lt;h3&gt;
  
  
  Invisible spends due to silos
&lt;/h3&gt;

&lt;p&gt;With subscription plans, usage is opaque at the org level. With BYOK, every developer's spend is siloed to their own key. There is &lt;strong&gt;no centralized, cross-provider view of usage by team, project, or environment&lt;/strong&gt; , and no real-time visibility into which workflows or teams are driving cost.&lt;/p&gt;

&lt;p&gt;Teams also run into &lt;strong&gt;unused usage&lt;/strong&gt; problems, where prepaid credits, committed spend, or reserved capacity with one provider go underutilized because usage is spread across individual developer keys instead of being centrally routed and optimized.&lt;/p&gt;

&lt;h3&gt;
  
  
  Credential sprawl and data exposure risks
&lt;/h3&gt;

&lt;p&gt;When developers use their own API keys, those keys end up stored in environment files, shared in Slack, or committed to repositories. As adoption grows, this turns into a credential management problem rather than a developer workflow problem. There is no built-in credential hierarchy for provider API keys, no scoped keys per team or project, and no audit trail showing which key made which request.&lt;/p&gt;

&lt;p&gt;Additionally,teams often have no visibility into what data is being sent to which model provider. Source code, internal documentation, or sensitive data can be included in prompts without any centralized filtering, logging, or policy enforcement, which creates data security and compliance risks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Runaway costs
&lt;/h3&gt;

&lt;p&gt;There is no native mechanism to set budget caps per team or project before a session begins. A single long-running agent session on a frontier model can consume a significant amount of tokens without any warning or enforcement.&lt;/p&gt;

&lt;h3&gt;
  
  
  No restriction over model usage
&lt;/h3&gt;

&lt;p&gt;Role-based access exists at the IDE and workspace level, but not at the model and provider access layer. Teams cannot easily restrict access to specific models, route routine tasks to cheaper models, or centrally enforce model usage policies.&lt;/p&gt;

&lt;p&gt;All of these issues appear for the same reason: Cursor is being used as a shared system, but there is no control layer between Cursor and the model providers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cursor best practices: Add a gateway between Cursor and your LLM providers
&lt;/h2&gt;

&lt;p&gt;The architectural solution to the problems above is to introduce an &lt;a href="https://portkey.ai/features/ai-gateway?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;AI gateway&lt;/u&gt;&lt;/a&gt; between Cursor and your LLM providers. The gateway becomes the control plane that applies policy, logs usage, routes requests, and enforces limits before any request reaches a model.&lt;/p&gt;

&lt;p&gt;Here are six implementation-ready cursor best practices:&lt;/p&gt;

&lt;h3&gt;
  
  
  Practice 1: Provider flexibility and failback
&lt;/h3&gt;

&lt;p&gt;Instead of sending requests directly from Cursor to a single provider, requests go through the gateway. This gateway can route traffic to multiple providers such as Anthropic, Google Gemini, Google Vertex AI, Azure OpenAI, AWS Bedrock, and others. Teams can configure routing logic, load balancing, and automatic fallbacks so that if a primary provider is unavailable or rate-limited, requests are routed to a backup provider automatically.&lt;/p&gt;

&lt;h3&gt;
  
  
  Practice 2: Centralized credential management
&lt;/h3&gt;

&lt;p&gt;Provider API keys are stored centrally in the gateway instead of being distributed to developers. The developers use &lt;strong&gt;scoped API keys per users, team or project&lt;/strong&gt; that inherit provider access. Access can be revoked or rotated from a single place without touching developer machines.&lt;/p&gt;

&lt;h3&gt;
  
  
  Practice 3: Budget limits and rate limits before coding starts
&lt;/h3&gt;

&lt;p&gt;Budget limits can be set per API key, user, team or project before access is distributed. &lt;a href="https://portkey.ai/blog/rate-limiting-for-llm-applications/" rel="noopener noreferrer"&gt;&lt;u&gt;Rate limits&lt;/u&gt;&lt;/a&gt; can prevent any single developer or team from overwhelming shared provider capacity. This is especially important when multiple teams share the same Bedrock or Vertex AI quotas.&lt;/p&gt;

&lt;h3&gt;
  
  
  Practice 4: Full request logging with cost attribution
&lt;/h3&gt;

&lt;p&gt;Every request can be logged with metadata such as team, project, developer, model, token usage, cost, and latency. This allows teams to attribute AI spend accurately and investigate usage spikes or anomalies.&lt;/p&gt;

&lt;h3&gt;
  
  
  Practice 5: Guardrails on inputs and outputs
&lt;/h3&gt;

&lt;p&gt;With the &lt;a href="https://portkey.ai/blog/what-is-an-llm-gateway/" rel="noopener noreferrer"&gt;LLM &lt;u&gt;gateway&lt;/u&gt;&lt;/a&gt;, you can apply PII guardrails, content filtering, and custom security rules to prompts and responses before they reach the provider or return to the developer. This reduces the risk of sensitive data exposure and helps enforce organizational policies.&lt;/p&gt;

&lt;h3&gt;
  
  
  Practice 6: Model access governance
&lt;/h3&gt;

&lt;p&gt;Teams can define which models specific teams or developers are allowed to use, and routing logic can be updated centrally without requiring changes to individual developer setups.&lt;/p&gt;

&lt;p&gt;The key idea is that developers continue using Cursor exactly as they do today. However, model access, routing, budgets, and guardrails are enforced at the infrastructure layer instead of relying on individual developer configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3aoqazubbkgeu3xdcvuh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3aoqazubbkgeu3xdcvuh.png" alt="Cursor best practices for enterprise teams" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How Portkey makes this operational model possible
&lt;/h2&gt;

&lt;p&gt;The best practices described above require an operational layer between Cursor and your LLM providers. This is where &lt;a href="https://portkey.ai/?ref=portkey.ai" rel="noopener noreferrer"&gt;Portkey&lt;/a&gt; acts as an AI gateway that sits between Cursor and model providers. The platform helps turn model access into a controlled, observable infrastructure layer instead of a direct connection from each developer’s machine.&lt;/p&gt;

&lt;p&gt;Once Cursor is connected to Portkey, these policies, like routing, budgets, guardrails, logging, and access control, can be enforced centrally.&lt;/p&gt;

&lt;p&gt;From the developer’s perspective, nothing changes. From the platform team’s perspective, model access becomes centralized, observable, and governed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Connecting Cursor to Portkey
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://portkey.ai/docs/integrations/libraries/cursor?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;Cursor integration&lt;/u&gt;&lt;/a&gt; follows a simple pattern:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add your model providers in Portkey and configure routing, budgets, and guardrails&lt;/li&gt;
&lt;li&gt;Generate a scoped Portkey API &lt;/li&gt;
&lt;li&gt;Define routing logic, fallback providers, and limits&lt;/li&gt;
&lt;li&gt;In Cursor Settings, enable the OpenAI API Key option&lt;/li&gt;
&lt;li&gt;Enter the Portkey API key and override the base URL to &lt;a href="https://api.portkey.ai/v1" rel="noopener noreferrer"&gt;https://api.portkey.ai/v1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Verify the connection and start using Cursor normally&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All Cursor traffic now routes through Portkey, where policies, logging, routing, and guardrails are applied automatically.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2tj6ik98y99fyi09pmwm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2tj6ik98y99fyi09pmwm.png" alt="Cursor best practices for enterprise teams" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Scaling Cursor Across Engineering Teams: Governance Patterns That Work
&lt;/h2&gt;

&lt;p&gt;Once Cursor traffic flows through a gateway, platform teams can implement governance patterns that make usage predictable and manageable across the organization.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Capability area&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cursor Teams/Enterprise&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI gateway (Portkey)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Identity and access&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;SSO, admin controls, team management&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Scoped API keys per team/project&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;IDE governance&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Privacy mode, Team Rules, IDE policies&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Not applicable&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;LLM routing&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Not available&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Fallbacks, load balancing, conditional routing&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Budget controls&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Per-user request accounting (Teams plan)&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Per-team and per-project budget limits, rate limits&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Observability&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Basic usage metrics&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Detailed logs with prompts, tokens, cost, latency, metadata tags&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Guardrails&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Not available&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;PII detection, content filtering, prompt injection blocking&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Provider management&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;BYOK or Cursor credits&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Centralized provider keys, multi-provider access&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Audit trails&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Limited&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Complete request/response audit logs&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;h2&gt;
  
  
  Building AI coding infrastructure that holds up in production
&lt;/h2&gt;

&lt;p&gt;If you are running Cursor across multiple teams, start by routing one team through Portkey, setting budget limits, and enabling request logging and fallback routing.&lt;/p&gt;

&lt;p&gt;Once the control layer is in place, you can expand usage across the organization without losing visibility, control, or cost predictability.&lt;/p&gt;

&lt;p&gt;Explore the &lt;a href="https://portkey.ai/docs/integrations/libraries/cursor?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;Cursor integration docs&lt;/u&gt;&lt;/a&gt; to see the setup process or &lt;a href="https://portkey.sh/blog?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;book a personalized demo&lt;/u&gt;&lt;/a&gt; for an enterprise deployment walkthrough.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQs
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Q: Can I use Portkey with Cursor without switching away from my existing LLM provider?
&lt;/h3&gt;

&lt;p&gt;Yes. Portkey works alongside your existing providers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Q: What happens when a team hits their budget limit set in Portkey?
&lt;/h3&gt;

&lt;p&gt;Alerts are sent as teams approach their budget thresholds so action can be taken before limits are reached. Budgets can be adjusted or reset at any time without changing developer configurations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Q: How is this different from Cursor's built-in Teams or Enterprise plan?
&lt;/h3&gt;

&lt;p&gt;Cursor handles IDE governance such as SSO and workspace policies. Portkey handles the LLM infrastructure layer, including routing, budgets, observability, and guardrails.&lt;/p&gt;

&lt;h3&gt;
  
  
  Q: Do developers need to change anything about how they use Cursor after the gateway is set up?
&lt;/h3&gt;

&lt;p&gt;No. Only the API key and base URL change in Cursor settings. The developer workflow remains the same.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>softwareengineering</category>
      <category>tooling</category>
    </item>
    <item>
      <title>What is AI lifecycle management?</title>
      <dc:creator>Drishti Shah</dc:creator>
      <pubDate>Tue, 24 Mar 2026 08:23:14 +0000</pubDate>
      <link>https://dev.to/portkey/what-is-ai-lifecycle-management-18a2</link>
      <guid>https://dev.to/portkey/what-is-ai-lifecycle-management-18a2</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffwfllf6xifr32zhgwif0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffwfllf6xifr32zhgwif0.png" alt="What is AI lifecycle management?" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AI lifecycle management begins before any model is called. The first step is defining &lt;strong&gt;where AI should be used, what success looks like, and how risk is managed from the start&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For most teams, this means moving beyond isolated experiments to identifying &lt;strong&gt;repeatable, high-impact use cases,&lt;/strong&gt; whether internal copilots, workflow automation, or customer-facing AI features. AI lifecycle management begins with defining the right use case and each use case should have clearly defined success metrics across &lt;strong&gt;quality, latency, cost, and adoption&lt;/strong&gt; , so performance can be measured as systems scale.&lt;/p&gt;

&lt;p&gt;Equally important is &lt;strong&gt;risk classification&lt;/strong&gt;. Not all AI applications carry the same level of sensitivity. Internal productivity tools, for example, require different controls compared to systems handling user data or making critical decisions. Establishing this early helps determine the right level of governance, guardrails, and monitoring required downstream.&lt;/p&gt;

&lt;p&gt;AI lifecycle management is the process of building, deploying, and continuously improving AI systems in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Data governance&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;AI systems are only as reliable as the data they operate on. Managing the data lifecycle is critical to ensuring outputs remain accurate, safe, and compliant over time.&lt;/p&gt;

&lt;p&gt;This starts with &lt;strong&gt;controlled data access,&lt;/strong&gt; defining what data can be used in prompts, which systems can access it, and how sensitive information (like PII) is handled. As AI usage scales across teams, enforcing consistent policies becomes essential to avoid leakage or misuse.&lt;/p&gt;

&lt;p&gt;Equally important is &lt;strong&gt;data quality and consistency&lt;/strong&gt;. Inputs to AI systems should be structured, validated, and, where necessary, filtered before reaching the model. This includes applying guardrails such as content filters, redaction, or transformation layers to standardize requests and responses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Model selection and evaluation
&lt;/h2&gt;

&lt;p&gt;Choosing the right model is not a one-time decision. It is an ongoing process of balancing &lt;strong&gt;quality, latency, and cost&lt;/strong&gt; across different use cases.&lt;/p&gt;

&lt;p&gt;Most teams start by testing a few models, but as AI usage grows, this quickly becomes harder to manage. Different tasks may require different models, some optimized for reasoning, others for speed or cost efficiency.&lt;/p&gt;

&lt;p&gt;Evaluation plays a critical role here. This includes &lt;strong&gt;offline testing&lt;/strong&gt; on curated datasets to benchmark performance, as well as &lt;strong&gt;online evaluation&lt;/strong&gt; on live traffic to understand real-world behavior. Tracking outputs, comparing responses, and identifying regressions helps teams make informed decisions when switching or upgrading models.&lt;/p&gt;

&lt;p&gt;Over time, models evolve, new providers emerge, and pricing changes. Treating model selection as part of the lifecycle allows teams to continuously optimize performance without disrupting production systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prompt and agent management
&lt;/h2&gt;

&lt;p&gt;Prompts and agents define how AI systems behave in production. Managing them as versioned, testable components is essential to maintaining consistency and control.&lt;/p&gt;

&lt;p&gt;Prompts should not live inside application code. Instead, they need to be &lt;strong&gt;versioned, reusable, and independently updatable&lt;/strong&gt; , so teams can iterate without redeploying entire systems. Even small changes in prompts can significantly impact output quality.&lt;/p&gt;

&lt;p&gt;As systems evolve, many teams move from simple prompts to &lt;strong&gt;agents with tool-calling and multi-step reasoning&lt;/strong&gt;. This introduces additional complexity, agents can behave non-deterministically, depend on external tools, and vary based on context. Managing this requires clear definitions of agent logic, tool access, and fallback behavior.&lt;/p&gt;

&lt;p&gt;Guardrails also play an important role at this layer. Applying constraints on inputs and outputs helps ensure that prompts and agents operate within defined boundaries, especially in sensitive or user-facing scenarios.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security and governance
&lt;/h2&gt;

&lt;p&gt;As AI systems move into production, they need the same level of control and accountability as any other critical infrastructure.&lt;/p&gt;

&lt;p&gt;This begins with &lt;strong&gt;access control&lt;/strong&gt; i.e. defining who can use which models, tools, and data. Role-based access (RBAC), workspace isolation, and scoped permissions ensure that usage is intentional and contained, especially in larger organizations.&lt;/p&gt;

&lt;p&gt;Equally important is &lt;strong&gt;cost and usage governance&lt;/strong&gt;. AI workloads can scale quickly, making it essential to enforce budgets, rate limits, and usage policies at both the user and application level. This prevents unexpected spend while maintaining system stability.&lt;/p&gt;

&lt;p&gt;Security also extends to &lt;strong&gt;policy enforcement and compliance&lt;/strong&gt;. Guardrails help filter unsafe or non-compliant content, while audit logs provide a clear record of how AI systems are being used. For enterprise environments, alignment with standards like GDPR, SOC 2, and ISO requirements is often mandatory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deployment and routing
&lt;/h2&gt;

&lt;p&gt;A critical part of AI lifecycle management is ensuring production reliability, scale, and constant change, without adding complexity to the application itself.&lt;/p&gt;

&lt;p&gt;A unified gateway layer sits between applications and model providers, abstracting away provider-specific logic and enabling teams to manage AI traffic centrally. This allows applications to remain stable even as models, providers, or configurations evolve.&lt;/p&gt;

&lt;p&gt;At the core of this is &lt;strong&gt;intelligent routing&lt;/strong&gt;. Requests can be dynamically routed across models and providers based on latency, cost, quality, or availability. If a provider fails or degrades, &lt;strong&gt;automatic failover&lt;/strong&gt; ensures continuity without requiring changes in application code.&lt;/p&gt;

&lt;p&gt;Production reliability also depends on built-in controls like &lt;strong&gt;retries, timeouts, rate limits, caching, and load balancing&lt;/strong&gt;. These mechanisms help reduce failures, smooth traffic spikes, and maintain consistent performance under scale.&lt;/p&gt;

&lt;p&gt;For enterprise deployments, this layer also supports &lt;strong&gt;regional routing, private infrastructure (VPC), and secure production environments&lt;/strong&gt;, ensuring compliance and data control alongside performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Observability and monitoring
&lt;/h2&gt;

&lt;p&gt;Effective AI lifecycle management requires deep visibility into system behavior. Without it, teams have no reliable way to understand performance, debug issues, or improve outcomes.&lt;/p&gt;

&lt;p&gt;AI observability goes beyond traditional metrics. In addition to &lt;strong&gt;latency, error rates, and throughput&lt;/strong&gt; , teams need visibility into &lt;strong&gt;model outputs, prompt behavior, token usage, and cost&lt;/strong&gt;. This helps answer questions like: Why did a response fail? Which model is underperforming? Where is spend increasing?&lt;/p&gt;

&lt;p&gt;Centralized logging and tracing make this possible. Every request should carry context, &lt;strong&gt;model used, prompt version, routing decision, and response,&lt;/strong&gt; so teams can trace issues end-to-end. For more complex systems, especially agents, &lt;strong&gt;execution traces&lt;/strong&gt; help visualize multi-step workflows and identify where breakdowns occur.&lt;/p&gt;

&lt;p&gt;Monitoring also enables proactive control. Tracking trends in performance and usage allows teams to detect anomalies, enforce budgets, and maintain consistent user experience as traffic scales.&lt;/p&gt;

&lt;p&gt;With a unified observability layer, AI systems become measurable and debuggable, turning what would otherwise be a black box into a system teams can actively manage and improve.&lt;/p&gt;

&lt;h2&gt;
  
  
  Continuous improvement
&lt;/h2&gt;

&lt;p&gt;AI lifecycle management doesn’t end at deployment. It requires continuous optimization across every layer of the system.&lt;/p&gt;

&lt;p&gt;With Portkey's &lt;a href="https://portkey.ai/features/ai-gateway?ref=portkey.ai" rel="noopener noreferrer"&gt;AI Gateway&lt;/a&gt;, teams can iterate across the full AI lifecycle, from model selection and prompt updates to routing changes and cost optimization, without disrupting production. Observability, logging, and tracing provide the foundation to evaluate performance, detect regressions, and understand real-world behavior.&lt;/p&gt;

&lt;p&gt;Because all requests flow through a unified gateway, improvements can be applied centrally. Teams can update prompts, switch models, refine routing strategies, and enforce policies in one place, instead of making changes across multiple applications.&lt;/p&gt;


&lt;p&gt;&amp;lt;!--kg-card-begin: html--&amp;gt;&lt;/p&gt;
Full Width CTA&amp;lt;br&amp;gt;&lt;br&gt;
        * {&amp;lt;br&amp;gt;&lt;br&gt;
            margin: 0;&amp;lt;br&amp;gt;&lt;br&gt;
            padding: 0;&amp;lt;br&amp;gt;&lt;br&gt;
            box-sizing: border-box;&amp;lt;br&amp;gt;&lt;br&gt;
        }&amp;lt;/p&amp;gt;&lt;br&gt;
&amp;lt;div class="highlight"&amp;gt;&amp;lt;pre class="highlight plaintext"&amp;gt;&amp;lt;code&amp;gt;    body {&lt;br&gt;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;&lt;br&gt;
        line-height: 1.6;&lt;br&gt;
        color: #333;&lt;br&gt;
        background: #f5f5f5;&lt;br&gt;
        padding: 40px 20px;&lt;br&gt;
        display: flex;&lt;br&gt;
        align-items: center;&lt;br&gt;
        justify-content: center;&lt;br&gt;
        min-height: 100vh;&lt;br&gt;
    }
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
    max-width: 1200px;
    width: 100%;
}

/* Full Width CTA */
.cta-full {
    text-align: center;
    padding: 60px 40px;
    background: #000;
    color: white;
    border-radius: 12px;
}

.cta-full h2 {
    font-size: 36px;
    margin-bottom: 16px;
 Color: white;
}

.cta-full p {
    font-size: 18px;
    margin-bottom: 32px;
    opacity: 0.9;
}

/* Button Styles */
.btn-primary {
    display: inline-block;
    background: white;
    color: #000;
    padding: 14px 32px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.btn-primary:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,255,255,0.15);
}

.btn-secondary {
    display: inline-block;
    background: transparent;
    color: white;
    padding: 14px 32px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid white;
    cursor: pointer;
    font-size: 16px;
}

.btn-secondary:hover {
    background: white;
    color: #000;
}

.btn-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 768px) {
    .cta-full h2 {
        font-size: 28px;
    }

    .cta-full p {
        font-size: 16px;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        text-align: center;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&amp;amp;lt;/style&amp;amp;gt;&lt;br&gt;
&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;h2&amp;gt;&lt;br&gt;
  &amp;lt;a name="ship-ai-agents-faster-with-portkey" href="#ship-ai-agents-faster-with-portkey" class="anchor"&amp;gt;&lt;br&gt;
  &amp;lt;/a&amp;gt;&lt;br&gt;
  Ship AI Agents faster with Portkey&lt;br&gt;
&amp;lt;/h2&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;Everything you need to build, deploy, and scale AI agents&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;&amp;lt;a href="&lt;a href="https://portkey.sh/blogs?ref=portkey.ai%22&amp;gt;Get" rel="noopener noreferrer"&gt;https://portkey.sh/blogs?ref=portkey.ai"&amp;amp;gt;Get&lt;/a&gt; Started&amp;lt;/a&amp;gt;&amp;lt;a href="&lt;a href="https://portkey.sh/blog?ref=portkey.ai%22&amp;gt;Book" rel="noopener noreferrer"&gt;https://portkey.sh/blog?ref=portkey.ai"&amp;amp;gt;Book&lt;/a&gt; a Demo&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;!--kg-card-end: html--&amp;gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>management</category>
      <category>product</category>
    </item>
    <item>
      <title>Claude Code agents: what they are, how they work, and how to scale them</title>
      <dc:creator>Drishti Shah</dc:creator>
      <pubDate>Mon, 09 Mar 2026 14:57:31 +0000</pubDate>
      <link>https://dev.to/portkey/claude-code-agents-what-they-are-how-they-work-and-how-to-scale-them-15n0</link>
      <guid>https://dev.to/portkey/claude-code-agents-what-they-are-how-they-work-and-how-to-scale-them-15n0</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fck3t9iaujrlzd1ybm3ew.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fck3t9iaujrlzd1ybm3ew.png" alt="Claude Code agents: what they are, how they work, and how to scale them"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Claude Code is now the most widely used AI coding agent. We all know what it does. The harder question is what happens when you roll it out across a team of 20, 50, or 200 engineers, each running agentic loops that spawn subagents, call MCP tools, and burn through tokens autonomously.&lt;/p&gt;

&lt;p&gt;This post covers the agent architecture inside Claude Code, what breaks when you take it to production, and how to add the governance and observability layer that enterprises need.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Claude Code agents work under the hood
&lt;/h2&gt;

&lt;p&gt;Claude Code runs a straightforward agent loop: the model produces a message, and if it includes a tool call, the tool executes and results feed back into the model. No tool call means the loop stops and the agent waits for input. It ships with around 14 tools spanning file operations, shell commands, web access, and control flow.&lt;/p&gt;

&lt;p&gt;What makes the system powerful is the layered agent architecture sitting on top of that loop.&lt;/p&gt;

&lt;h3&gt;
  
  
  Subagents
&lt;/h3&gt;

&lt;p&gt;Claude Code delegates to specialized subagents that each run in their own context window. The built-in ones include Explore (read-only codebase search), Plan (research for planning mode), and a general-purpose agent for complex multi-step tasks. Each subagent has restricted tool access and independent permissions.&lt;/p&gt;

&lt;p&gt;The real value here is context management. Agentic tasks fill up the context window fast. Subagents keep exploration and implementation out of the main conversation, preserving the primary context for decision-making.&lt;/p&gt;

&lt;p&gt;You can also define custom subagents as markdown files with YAML frontmatter, scoped to specific tools, models, and system prompts. A read-only code reviewer, a documentation generator, a security auditor, each with exactly the permissions it needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Agent teams
&lt;/h3&gt;

&lt;p&gt;Subagents work within a single session. Agent teams coordinate across separate sessions, enabling parallel workflows. Think: one agent building a backend API while another builds the frontend, each in an isolated Git worktree.&lt;/p&gt;

&lt;p&gt;Anthropic's own 2026 trends report names multi-agent coordination as a top priority for engineering teams this year.&lt;/p&gt;

&lt;h3&gt;
  
  
  Skills, hooks, and the Agent SDK
&lt;/h3&gt;

&lt;p&gt;Skills are reusable instruction packages that Claude loads automatically when it encounters a matching task. Hooks trigger actions at specific workflow points (run tests after changes, lint before commits). The Claude Agent SDK gives teams the same underlying tools and permissions framework to build custom agent experiences outside the terminal entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  What breaks at scale
&lt;/h2&gt;

&lt;p&gt;None of these capabilities ship with the operational scaffolding that production environments demand. Here is where teams consistently run into trouble.&lt;/p&gt;

&lt;h3&gt;
  
  
  Runaway costs with no attribution
&lt;/h3&gt;

&lt;p&gt;A single complex task can spawn multiple subagents, each making dozens of tool calls across extended agentic loops. Multiply that by a team of engineers, and token spend becomes unpredictable. &lt;a href="https://portkey.ai/for/claude-code?ref=portkey.ai" rel="noopener noreferrer"&gt;Claude Code&lt;/a&gt; has no native cost tracking by user, team, or project. The first monthly bill is usually the wake-up call.&lt;/p&gt;

&lt;h3&gt;
  
  
  Zero observability
&lt;/h3&gt;

&lt;p&gt;There is no built-in logging, tracing, or audit trail. You cannot see what prompts were run, which subagents were spawned, how long requests took, or where errors occurred. For debugging, optimization, and compliance, this is a non-starter.&lt;/p&gt;

&lt;h3&gt;
  
  
  Single-provider fragility
&lt;/h3&gt;

&lt;p&gt;Claude Code ties you to one provider. If that provider hits rate limits, has an outage, or is unavailable in a region you need, your workflows stop. Switching providers requires manual reconfiguration.&lt;/p&gt;

&lt;h3&gt;
  
  
  No access control
&lt;/h3&gt;

&lt;p&gt;There is no centralized way to manage API keys, restrict access by role or team, enforce rate limits, or set budget caps. Every developer's setup is independent, which makes governance at scale nearly impossible.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ungoverned MCP tool access
&lt;/h3&gt;

&lt;p&gt;Claude Code supports MCP for connecting to external tools like GitHub, Slack, databases, and internal APIs. When agents can take real actions through these tools, the question is not whether MCP works but whether it should be allowed, for which agent, with what permissions, and who is watching. Without a governance layer, MCP adoption stalls at experimentation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding governance with an AI gateway
&lt;/h2&gt;

&lt;p&gt;An AI gateway sits between Claude Code and the model providers, adding observability, access control, and reliability without changing how developers use the tool. Portkey is built for exactly this.&lt;/p&gt;

&lt;h3&gt;
  
  
  Team-level governance
&lt;/h3&gt;

&lt;p&gt;Isolate teams with separate workspaces, each with its own budget, rate limits, and access controls. Manage API keys centrally instead of distributing raw keys to individual developers. Enforce org-wide policies without building custom wrappers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multi-provider routing
&lt;/h3&gt;

&lt;p&gt;Route Claude Code requests across Anthropic, Bedrock, and Vertex AI through a single endpoint. Define fallback logic, add load balancing or define conditions using meta data for smarter routing. Developers change nothing in their workflow. The gateway handles it.&lt;/p&gt;

&lt;p&gt;Just add this to &lt;em&gt;settings.json&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ANTHROPIC_BASE_URL"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.portkey.ai"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ANTHROPIC_AUTH_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"YOUR_PORTKEY_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ANTHROPIC_CUSTOM_HEADERS"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"x-portkey-api-key: YOUR_PORTKEY_API_KEY&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;x-portkey-provider: @anthropic-prod"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Cost tracking and budget controls
&lt;/h3&gt;

&lt;p&gt;Every request is logged with token usage and cost, broken down by provider, team, user, and project. Set hard &lt;a href="https://portkey.ai/docs/product/enterprise-offering/budget-policies?ref=portkey.ai" rel="noopener noreferrer"&gt;budget limits&lt;/a&gt; per team or developer. Get alerts when spend crosses thresholds. Route to cheaper providers when cost matters more than latency.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhl90ib0wry3y4dyfrww7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhl90ib0wry3y4dyfrww7.png" alt="Claude Code agents: what they are, how they work, and how to scale them"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For teams running parallel agent fleets, this is the difference between controlled scaling and a surprise invoice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Full observability
&lt;/h3&gt;

&lt;p&gt;Portkey's OTEL-compliant &lt;a href="https://portkey.ai/features/observability?ref=portkey.ai" rel="noopener noreferrer"&gt;observability&lt;/a&gt; captures every request with metadata: latency, tokens, error rates, provider, route, and custom tags. Filter and search across all Claude Code usage in one dashboard. Debug failed agent loops, monitor MCP tool calls, and track performance trends over time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7dkz9gyb53vkumszplvn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7dkz9gyb53vkumszplvn.png" alt="Claude Code agents: what they are, how they work, and how to scale them"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Guardrails
&lt;/h3&gt;

&lt;p&gt;Enforce PII detection, content filtering, prompt injection protection, and token limits before requests reach the model. This matters especially for agentic workflows processing sensitive codebases or interacting with production systems through MCP.&lt;/p&gt;

&lt;h3&gt;
  
  
  MCP Gateway
&lt;/h3&gt;

&lt;p&gt;Portkey's MCP Gateway provides centralized authentication, role-based access control, and full observability for MCP tool connections. Agents authenticate once through Portkey. The gateway handles credential injection, permission checks, and request logging for every configured MCP server.&lt;/p&gt;

&lt;p&gt;Platform teams control exactly which teams can access which MCP servers and tools. Every tool call is logged with full context: who accessed what, when, and with what parameters. This is the layer that makes MCP safe for production use.&lt;/p&gt;

&lt;h3&gt;
  
  
  Putting it together
&lt;/h3&gt;

&lt;p&gt;The shift happening right now is clear. Claude Code agents are moving from individual developer tools to team-level infrastructure. Subagents, agent teams, skills, MCP integrations, and orchestration layers are making agents dramatically more capable. But capability without governance is a liability.&lt;/p&gt;

&lt;p&gt;The teams scaling Claude Code successfully are treating it as an infrastructure problem: routing through a gateway, tracking every request, setting budget boundaries, and governing tool access centrally. The developers keep typing &lt;code&gt;claude&lt;/code&gt; in their terminal. The platform team gets the visibility and control they need.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To run Claude Code agents with governance at scale,&lt;/em&gt; &lt;a href="https://app.portkey.ai/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;em&gt;get started with Portkey&lt;/em&gt;&lt;/a&gt; &lt;em&gt;or&lt;/em&gt; &lt;a href="https://portkey.sh/blog?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;em&gt;book a demo&lt;/em&gt;&lt;/a&gt; &lt;em&gt;for a walkthrough.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>architecture</category>
      <category>llm</category>
    </item>
    <item>
      <title>LLM Deployment Pipeline Explained Step by Step</title>
      <dc:creator>Drishti Shah</dc:creator>
      <pubDate>Fri, 27 Feb 2026 11:41:00 +0000</pubDate>
      <link>https://dev.to/portkey/llm-deployment-pipeline-explained-step-by-step-6g6</link>
      <guid>https://dev.to/portkey/llm-deployment-pipeline-explained-step-by-step-6g6</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk4buzfcfhmlp6clv89t0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk4buzfcfhmlp6clv89t0.jpg" alt="LLM Deployment Pipeline Explained Step by Step" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;LLM deployment is the process of taking a trained language model and converting it into a production service that can handle live user requests reliably and at scale. &lt;/p&gt;

&lt;p&gt;In practice, &lt;strong&gt;a truly production-ready LLM system is shaped by five interconnected layers: containerization, infrastructure and GPU allocation, the API and serving layer, autoscaling, and monitoring&lt;/strong&gt;. These layers keep performance stable, costs predictable, and outputs trustworthy as real traffic flows in.&lt;/p&gt;

&lt;p&gt;💡 Gartner estimates that &lt;a href="https://www.gartner.com/en/newsroom/press-releases/2023-10-11-gartner-says-more-than-80-percent-of-enterprises-will-have-used-generative-ai-apis-or-deployed-generative-ai-enabled-applications-by-2026?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;more than 80% of enterprises will have generative AI applications in production by 2026&lt;/u&gt;&lt;/a&gt;, yet most online tutorials still stop at “get it running” and ignore what happens after.&lt;/p&gt;

&lt;p&gt;Don’t worry, though, because this article covers the full lifecycle teams struggle with post-launch, including scaling predictably under real demand, monitoring probabilistic outputs that can fail silently, and controlling costs that compound with every request.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Cloud APIs, self-hosted, or on-premises&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Every LLM deployment begins with a foundational architectural decision: consume models via cloud APIs, run them yourself on cloud GPUs, or operate fully on-premises. The right choice depends on how you balance speed, control, cost, and compliance.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Architecture path&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;What it offers&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Tradeoffs&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Typical use case&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Cloud APIs (&lt;a href="https://openai.com/?ref=portkey.ai" rel="noopener noreferrer"&gt;OpenAI&lt;/a&gt;, &lt;a href="https://www.anthropic.com/?ref=portkey.ai" rel="noopener noreferrer"&gt;Anthropic&lt;/a&gt;, &lt;a href="https://azure.microsoft.com/en-us?ref=portkey.ai" rel="noopener noreferrer"&gt;Microsoft Azure&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Fastest route to production, no infrastructure management, elastic scaling&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Pay-per-token costs compound, vendor lock-in risk, data residency constraints&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Prototyping and early production&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;Self-hosted on cloud GPUs&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Full control over open models (&lt;a href="https://www.llama.com/?ref=portkey.ai" rel="noopener noreferrer"&gt;Llama&lt;/a&gt;, &lt;a href="https://mistral.ai/?ref=portkey.ai" rel="noopener noreferrer"&gt;Mistral&lt;/a&gt;), performance tuning&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;You own reliability, scaling, and ops complexity&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Teams needing flexibility and customization&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;On-premises&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Strong compliance posture (HIPAA, GDPR), predictable cost at high utilization&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Hardware expense, deep infrastructure expertise required&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Regulated or high-volume workloads&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;p&gt;For self-hosting, infrastructure costs typically range from about &lt;a href="https://www.whitefiber.com/compare/best-gpus-for-llm-inference-in-2025?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;$0.75/hour&lt;/u&gt;&lt;/a&gt; for an L4 GPU up to &lt;a href="https://docs.jarvislabs.ai/blog/h100-price?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;$3.25/hour&lt;/u&gt;&lt;/a&gt; for an H100, before orchestration and redundancy. On-premises shifts that spend into upfront hardware investment that only pays off with sustained utilization.&lt;/p&gt;

&lt;p&gt;Across all three paths, data residency and security requirements often become the deciding factor.&lt;/p&gt;

&lt;p&gt;Also, keep in mind that according to &lt;a href="https://portkey.ai/llms-in-prod-25?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;Portkey’s LLMs in Prod 2025&lt;/u&gt;&lt;/a&gt;, 40% of teams now use multiple LLM providers, up from 23% ten months earlier. As a result, you have to carefully consider how your architectural choice will affect portability and long-term leverage to avoid the risk of vendor lock-in. You can also use Portkey’s AI Gateway to mitigate that risk by routing across 1,600+ models through a single API, so switching providers becomes a configuration change rather than a rewrite.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;GPU selection and infrastructure sizing&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;LLMs only run fast when everything fits inside GPU memory (VRAM). That includes not just the model itself, but also the temporary memory it uses to hold conversation context while generating responses, called the &lt;a href="https://research.aimultiple.com/llm-quantization/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;KV cache&lt;/u&gt;&lt;/a&gt;. If either spills into normal system memory, performance drops sharply.&lt;/p&gt;

&lt;p&gt;This is why sizing GPUs by model size alone often fails in production. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A 70B model (FP16) needs about 140GB for weights. If you add a standard 8k context window and batch headroom, total VRAM &lt;a href="https://apxml.com/posts/ultimate-system-requirements-llama-3-models?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;reaches ~161GB&lt;/u&gt;&lt;/a&gt;, requiring two 80GB GPUs (like the H100) or a single H200.&lt;/li&gt;
&lt;li&gt;An 8B model (FP16) uses roughly 16GB for weights and &lt;a href="https://apxml.com/models/llama-3-1-8b?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;~18.4GB&lt;/u&gt;&lt;/a&gt; with context overhead – an ideal fit for one 24GB L4 GPU.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, always budget VRAM for both the model and its live working memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Inference frameworks and API endpoint design&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The efficiency of an LLM deployment is defined by the request lifecycle:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;During prefill, the full prompt is processed in parallel and is primarily compute-bound. &lt;/li&gt;
&lt;li&gt;During decode, tokens are generated one by one and become memory-bandwidth bound. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For this, you’ll need an inference framework to manage the KV cache so the GPU never sits idle between these phases.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Framework&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Key innovation&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;2026 performance edge&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Best for&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.vllm.ai/en/latest/?ref=portkey.ai" rel="noopener noreferrer"&gt;vLLM&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;PagedAttention&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Industry standard; highest stability for general APIs.&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;High-concurrency production APIs.&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.google.com/search?q=https%3A%2F%2Fgithub.com%2Fsglang-project%2Fsglang&amp;amp;ref=portkey.ai" rel="noopener noreferrer"&gt;SGLang&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;RadixAttention&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;&lt;a href="https://research.aimultiple.com/inference-engines/?ref=portkey.ai" rel="noopener noreferrer"&gt;29% higher throughput&lt;/a&gt; than vLLM; instant prefix caching.&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Agentic and RAG workloads.&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;&lt;a href="https://nvidia.github.io/TensorRT-LLM/?ref=portkey.ai" rel="noopener noreferrer"&gt;TensorRT-LLM&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Compiled kernels&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Lowest latency (up to 2x faster TTFT on NVIDIA).&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;Latency-critical systems.&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/InternLM/lmdeploy?ref=portkey.ai" rel="noopener noreferrer"&gt;LMDeploy&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;TurboMind C++ engine&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;&lt;a href="https://research.aimultiple.com/inference-engines/?ref=portkey.ai" rel="noopener noreferrer"&gt;Rivals SGLang&lt;/a&gt;; excellent 4-bit/8-bit throughput&lt;/p&gt;

&lt;p&gt;| &lt;/p&gt;

&lt;p&gt;High-volume batch inference.&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The hierarchy of metrics&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;First is &lt;strong&gt;TTFT (Time to First Token)&lt;/strong&gt;, which is how quickly users see the first word appear – the &lt;strong&gt;most critical UX signal&lt;/strong&gt;. With superior cache reuse, &lt;a href="https://rawlinson.ca/articles/vllm-vs-sglang-performance-benchmark-h100?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;SGLang achieves roughly 3.7× faster TTFT at low concurrency&lt;/u&gt;&lt;/a&gt;, making it ideal for highly interactive agents.&lt;/p&gt;

&lt;p&gt;Next is &lt;strong&gt;TPS (Tokens Per Second)&lt;/strong&gt;, which defines total system capacity. While vLLM is commonly the default choice, &lt;a href="https://www.reddit.com/r/LocalLLaMA/comments/1odp8pe/sglang_vs_vllm_on_h200_which_one_do_you_prefer/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;SGLang can deliver about 33% higher TPS&lt;/u&gt;&lt;/a&gt; in multi-turn conversations by avoiding repeated context processing.&lt;/p&gt;

&lt;p&gt;Then comes &lt;strong&gt;KV cache utilization&lt;/strong&gt; , which determines stability. Modern inference engines target around &lt;a href="https://research.aimultiple.com/inference-engines/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;80% GPU memory usage&lt;/u&gt;&lt;/a&gt; to balance throughput and safety, while pushing toward 95% can increase the risk of instability and trigger crashes during graph capture and runtime spikes.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;API design for production UX&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Streaming&lt;/strong&gt; is mandatory. Total generation time matters less than TTFT – users tolerate a 10-second response if the first token appears in ~200ms.&lt;/p&gt;

&lt;p&gt;Also, &lt;strong&gt;continuous batching&lt;/strong&gt; prevents queue bottlenecks. Your framework must allow new requests to join an active decode loop, rather than waiting in a strict first-in-first-out pipeline.&lt;/p&gt;

&lt;p&gt;For RAG systems, &lt;strong&gt;prefix caching&lt;/strong&gt; is critical. By caching the system prompt and retrieved documents, you can reduce prefill latency and cost by &lt;a href="https://blog.gopenai.com/sglang-vs-vllm-the-new-throughput-king-7daec596f7fa?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;up to 90% for returning users&lt;/u&gt;&lt;/a&gt;, dramatically improving both responsiveness and efficiency.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Scaling strategies that actually work for LLMs&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Traditional autoscaling based on CPU or memory utilization fails for LLM workloads. Inference is primarily memory-bandwidth and I/O bound, so scaling decisions must reflect user-facing latency and GPU saturation, not generic resource metrics.&lt;/p&gt;

&lt;p&gt;For Kubernetes deployments, configure the Horizontal Pod Autoscaler (HPA) around three signals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Queue depth (num_requests_waiting) – the most responsive signal:&lt;/strong&gt; Best practice today is to trigger scale-out when just 3–5 requests begin to queue, preventing latency spikes before users feel them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;P90 TTFT (Time to First Token) – the SLA-level experience metric:&lt;/strong&gt; If the 90th percentile drifts beyond roughly 200–500ms, new replicas should spin up to preserve a fast, conversational feel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPU KV cache utilization (gpu_cache_usage_perc) – shows physical saturation:&lt;/strong&gt; High cache usage combined with a growing queue means existing pods can’t accept more tokens without instability or crashes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally, cold starts were once the biggest constraint, with model loads taking 30–120 seconds. However, modern streaming loaders have reset that baseline. Using &lt;a href="https://developer.nvidia.com/blog/reducing-cold-start-latency-for-llm-inference-with-nvidia-runai-model-streamer/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;NVIDIA’s Run:ai Model Streamer&lt;/u&gt;&lt;/a&gt;, a 7B model can stream from object storage into GPU memory in 5–15 seconds. When paired with frameworks like vLLM, total Time to Ready (container spin-up plus engine initialization) is now under 25 seconds, reducing the need for costly warm pools.&lt;/p&gt;

&lt;p&gt;In practice, Kubernetes users should avoid default CPU-based scaling rules. Instead, configure the HPA to scale using queue depth and TTFT, since those directly reflect user experience and system saturation.&lt;/p&gt;

&lt;p&gt;Scaling at the infrastructure layer is only part of the solution. Above it, the &lt;a href="https://portkey.ai/features/ai-gateway?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt; AI Gateway&lt;/u&gt;&lt;/a&gt; adds production safeguards such as automatic retries, exponential backoff, circuit breakers, and provider failover. These mechanisms prevent temporary overloads or upstream failures from cascading into user-visible downtime.&lt;/p&gt;

&lt;p&gt;With the Gateway, &lt;a href="https://portkey.ai/case-studies/leading-delivery-platform?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;a leading online food delivery platform successfully handled a 3,100× traffic increase&lt;/u&gt;&lt;/a&gt;, peaking at 1,800 requests per second, while maintaining 99.99% uptime by combining HPA-based scaling with gateway-level resilience controls.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Monitoring LLMs in production&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;LLMs often fail silently, returning a successful status code (200 OK) while producing hallucinated or misleading outputs. Monitoring and observability are essential here: monitoring confirms the system is running, while observability confirms the response is actually correct. For this, production teams need a dual-layer telemetry approach.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 1: Operational metrics&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Operational metrics (the heartbeat of your inference stack) ensure the fleet is responsive and stable under load. The most important are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;P95 TTFT (Time to First Token) –  the gold standard for user experience:&lt;/strong&gt; In 2026, enterprise targets have tightened to 200–500ms to preserve a natural, conversational feel. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TPOT (Time Per Output Token):&lt;/strong&gt; This measures streaming smoothness, with a goal of under 50ms so responses outpace human reading speed. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;KV cache saturation – an early warning system:&lt;/strong&gt; Rising cache usage paired with growing queues signals an impending generation stall or crash long before errors appear.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Layer 2: Semantic observability&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Semantic observability evaluates whether answers are actually correct and safe. Using LLM-as-a-Judge techniques, teams can detect quality drift that traditional APM tools miss:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Faithfulness and grounding&lt;/strong&gt; verify that responses truly exist in retrieved documents, forming the core guardrail for RAG systems. &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://portkey.ai/blog/the-complete-guide-to-llm-observability/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;u&gt;Cost harvesting&lt;/u&gt;&lt;/strong&gt;&lt;/a&gt; attacks track abusive prompts designed to explode token usage and drain budgets – a growing 2026 threat. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tone and bias&lt;/strong&gt; drift monitor whether the model’s personality or alignment shifts subtly across millions of requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Modern platforms now unify these layers. For instance, Portkey provides observability directly within its AI Gateway, capturing over 40 data points per request across cost, performance, and accuracy – earning recognition as a &lt;a href="https://www.gartner.com/en/documents/7024598?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;Gartner Cool Vendor in LLM Observability (2025)&lt;/u&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;👀 Typical production SLOs in 2026 include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;99.99% availability.&lt;/li&gt;
&lt;li&gt;P95 TTFT of 200–500ms.&lt;/li&gt;
&lt;li&gt;P50 end-to-end RAG latency under 1.5 seconds.&lt;/li&gt;
&lt;li&gt;Hallucination rates below 1%, depending on domain risk tolerance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Controlling costs as you scale&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;LLM costs grow in a fundamentally different way than traditional infrastructure. Instead of paying mainly for reserved compute, spending increases with usage volume, since every request consumes tokens. What looks like a few cents per call can quickly become a major expense at millions of requests per month.&lt;/p&gt;

&lt;p&gt;To manage this, teams must start with cost attribution – tracking spend by feature, team, and user. Without this visibility, optimization happens too late, after budgets have already been exceeded.&lt;/p&gt;

&lt;p&gt;Once costs are visible, three levers drive meaningful savings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Semantic caching&lt;/strong&gt; avoids recomputing responses for repeated or similar queries. For instance, &lt;a href="https://portkey.ai/blog/reducing-llm-costs-and-latency-semantic-cache/" rel="noopener noreferrer"&gt;&lt;u&gt;semantic cache&lt;/u&gt;&lt;/a&gt; delivers around 20% average cache hit rates in early production and up to 60% in focused RAG systems, with roughly 20× faster responses at near-zero cost on cached requests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intelligent routing&lt;/strong&gt; sends simpler requests to cheaper, faster models while reserving premium models for complex reasoning. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Batch processing&lt;/strong&gt; , such as &lt;a href="https://developers.openai.com/api/docs/guides/batch?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;OpenAI’s Batch API&lt;/u&gt;&lt;/a&gt;, reduces costs for large, non-urgent workloads by grouping requests into lower-priced bulk jobs with flexible completion windows.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re looking for a way to maintain control over costs, opt for Portkey’s AI Gateway. One delivery platform &lt;a href="https://portkey.ai/case-studies/leading-delivery-platform?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;saved $500,000 through optimized routing and caching via Portkey&lt;/u&gt;&lt;/a&gt; while maintaining 99.99% uptime across billions of requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Building your deployment pipeline&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As you’ve seen, LLM deployment is an operational pipeline made up of infrastructure, serving, scaling, monitoring, and cost control, with each layer compounding the reliability and efficiency of the next.&lt;/p&gt;

&lt;p&gt;If your models are already running but the operational layer is holding you back, this is where an AI gateway like Portkey fits. &lt;/p&gt;

&lt;p&gt;Portkey sits above your inference stack, providing intelligent routing across providers, built-in observability, semantic caching, cost controls, and automatic failover, so you can scale reliably without building custom infrastructure.&lt;/p&gt;

&lt;p&gt;Ready to move from “model deployed” to truly production-ready? &lt;a href="https://portkey.ai/features/ai-gateway?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;u&gt;Try Portkey’s AI gateway&lt;/u&gt;&lt;/a&gt; now and turn your LLMs into reliable, cost-efficient production systems!&lt;/p&gt;


&lt;p&gt;&amp;lt;!--kg-card-begin: html--&amp;gt;&lt;/p&gt;Full Width CTA&amp;lt;br&amp;gt;&lt;br&gt;
        * {&amp;lt;br&amp;gt;&lt;br&gt;
            margin: 0;&amp;lt;br&amp;gt;&lt;br&gt;
            padding: 0;&amp;lt;br&amp;gt;&lt;br&gt;
            box-sizing: border-box;&amp;lt;br&amp;gt;&lt;br&gt;
        }&amp;lt;/p&amp;gt;&lt;br&gt;
&amp;lt;div class="highlight"&amp;gt;&amp;lt;pre class="highlight plaintext"&amp;gt;&amp;lt;code&amp;gt;    body {&lt;br&gt;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;&lt;br&gt;
        line-height: 1.6;&lt;br&gt;
        color: #333;&lt;br&gt;
        background: #f5f5f5;&lt;br&gt;
        padding: 40px 20px;&lt;br&gt;
        display: flex;&lt;br&gt;
        align-items: center;&lt;br&gt;
        justify-content: center;&lt;br&gt;
        min-height: 100vh;&lt;br&gt;
    }
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
    max-width: 1200px;
    width: 100%;
}

/* Full Width CTA */
.cta-full {
    text-align: center;
    padding: 60px 40px;
    background: #000;
    color: white;
    border-radius: 12px;
}

.cta-full h2 {
    font-size: 36px;
    margin-bottom: 16px;
}

.cta-full p {
    font-size: 18px;
    margin-bottom: 32px;
    opacity: 0.9;
}

/* Button Styles */
.btn-primary {
    display: inline-block;
    background: white;
    color: #000;
    padding: 14px 32px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.btn-primary:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,255,255,0.15);
}

.btn-secondary {
    display: inline-block;
    background: transparent;
    color: white;
    padding: 14px 32px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid white;
    cursor: pointer;
    font-size: 16px;
}

.btn-secondary:hover {
    background: white;
    color: #000;
}

.btn-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 768px) {
    .cta-full h2 {
        font-size: 28px;
    }

    .cta-full p {
        font-size: 16px;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        text-align: center;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&amp;amp;lt;/style&amp;amp;gt;&lt;br&gt;
&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;h2&amp;gt;&lt;br&gt;
  &amp;lt;a name="ship-faster-with-ai" href="#ship-faster-with-ai" class="anchor"&amp;gt;&lt;br&gt;
  &amp;lt;/a&amp;gt;&lt;br&gt;
  Ship Faster with AI&lt;br&gt;
&amp;lt;/h2&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;Everything you need to build, deploy, and scale AI applications&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;&amp;lt;a href="#"&amp;gt;Get Started&amp;lt;/a&amp;gt;&amp;lt;a href="#"&amp;gt;Book a Demo&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;!--kg-card-end: html--&amp;gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>devops</category>
      <category>llm</category>
    </item>
    <item>
      <title>The best approach to compare LLM outputs</title>
      <dc:creator>Drishti Shah</dc:creator>
      <pubDate>Tue, 24 Feb 2026 13:45:39 +0000</pubDate>
      <link>https://dev.to/portkey/the-best-approach-to-compare-llm-outputs-4am4</link>
      <guid>https://dev.to/portkey/the-best-approach-to-compare-llm-outputs-4am4</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3arsssydu4vizk4101oh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3arsssydu4vizk4101oh.png" alt="The best approach to compare LLM outputs" width="800" height="562"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once LLMs are in production, output quality stops being a subjective question and becomes an operational one. Teams are no longer asking &lt;em&gt;whether&lt;/em&gt; they need to evaluate outputs, but &lt;em&gt;how&lt;/em&gt; to do it reliably as systems evolve.&lt;/p&gt;

&lt;p&gt;Production systems can change frequently. Prompts are iterated on, models are swapped, routing logic is adjusted, and traffic patterns shift. In this environment, point-in-time judgments of quality are not useful. What matters is whether output quality is stable, improving, or degrading across these changes.&lt;/p&gt;

&lt;p&gt;A repeatable approach to measurable output quality gives teams a way to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Establish baselines that survive prompt and model updates&lt;/li&gt;
&lt;li&gt;Compare outputs across versions, providers, and configurations&lt;/li&gt;
&lt;li&gt;Detect regressions before they reach users&lt;/li&gt;
&lt;li&gt;Reason about trade-offs between quality, latency, and cost&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Is manual review and one-off prompting enough to compare LLM outputs?
&lt;/h2&gt;

&lt;p&gt;Manual review and ad-hoc prompting still play a role in mature LLM systems, but they stop being sufficient once scale and change are introduced.&lt;/p&gt;

&lt;p&gt;Spot-checking outputs is inherently narrow. Reviewers see a small slice of traffic, often curated or synthetic, and their judgments are shaped by context that may not exist in real usage. As prompts and models evolve, those reviews quickly become outdated. What was “approved” last week may no longer reflect what users are seeing today.&lt;/p&gt;

&lt;p&gt;One-off prompting has similar limitations. Testing a handful of inputs against a new model or prompt can reveal obvious failures, but it does not capture variance. Non-determinism means two runs of the same prompt can produce meaningfully different outputs. Without repetition and aggregation, it’s impossible to tell whether a change actually improved quality or simply produced a better-looking example.&lt;/p&gt;

&lt;p&gt;At scale, manual review also introduces inconsistency. Different reviewers apply different standards, and those standards shift over time. There is no durable baseline, no reliable way to compare runs across days or deployments, and no systematic way to surface regressions early.&lt;/p&gt;

&lt;p&gt;Manual review remains useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Calibrating evaluation criteria&lt;/li&gt;
&lt;li&gt;Investigating edge cases&lt;/li&gt;
&lt;li&gt;Providing high-quality labels for difficult tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But as the primary mechanism for comparing LLM outputs, it breaks down. Production systems need methods that are repeatable, aggregatable, and resilient to change.&lt;/p&gt;

&lt;h2&gt;
  
  
  Metrics to consider when comparing LLM outputs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The core dimensions:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Effective LLM evaluation requires metrics that map to the actual risks and goals of your application. Most production systems care about three primary dimensions:   &lt;/p&gt;

&lt;p&gt;_1. whether the output is factually grounded (hallucination detection),   &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;whether it addresses what the user actually asked (relevance and correctness), and
&lt;/li&gt;
&lt;li&gt;whether it meets safety and quality standards (toxicity, coherence, formatting)._&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These dimensions are not interchangeable. A response can be highly relevant but factually wrong, or factually correct but unhelpful. Choosing which metrics to track depends on what failure modes matter most for your use case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deterministic vs. LLM-based metrics:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Metrics fall into two categories: &lt;em&gt;deterministic and model-based&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Deterministic metrics like regex matching, JSON validation, and keyword presence are fast, cheap, and predictable. They work well for structured outputs or hard constraints.&lt;/p&gt;

&lt;p&gt;Model-based metrics use an LLM to judge another LLM's output, which is necessary for evaluating qualities like coherence, completeness, or whether an answer is actually helpful. LLM-as-a-judge approaches are more expensive and introduce their own variance, but they scale where human review cannot. In practice, most teams use both: deterministic checks for objective criteria, model-based evaluation for subjective quality.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://arize.com/llm-as-a-judge/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvi5j9i7qtquyt434ioyy.png" alt="The best approach to compare LLM outputs" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Choosing the right granularity:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Metrics also differ in scope.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Span-level evaluation scores individual LLM calls, useful for isolating which step in a pipeline is underperforming. &lt;/li&gt;
&lt;li&gt;Trace-level evaluation looks at the full chain of reasoning, which matters when correctness depends on multiple steps working together. &lt;/li&gt;
&lt;li&gt;Session-level evaluation captures user experience across a conversation, surfacing issues like frustration or confusion that only emerge over time. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Comparing outputs effectively means instrumenting at the right level and aggregating results in ways that surface actionable patterns, not just individual failures.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Arize approaches evals
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The evaluation loop:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Arize treats evaluation as an operational loop, not a one-time gate. Evaluations attach directly to traces, so every LLM call can be scored and explained in context. This means teams can run evaluations offline during development, testing prompt changes against datasets before deployment, and then transition the same evaluators to run online against production traffic. The result is a continuous feedback mechanism: evaluations surface regressions, traces provide the context to diagnose them, and experiments validate fixes before they ship.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pre-built and custom evaluators:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The platform includes pre-built &lt;a href="https://portkey.ai/docs/guides/prompts/llm-as-a-judge?ref=portkey.ai#building-an-llm-as-a-judge-system-for-ai-customer-support-agent" rel="noopener noreferrer"&gt;LLM-as-a-judge&lt;/a&gt; evaluators for common concerns: hallucination, relevance, toxicity, summarization quality, code correctness, and user frustration, among others. These templates are benchmarked against golden datasets with known precision and recall, so teams can deploy them with confidence. For domain-specific needs, custom evaluators can be defined in plain language, describing what "good" looks like in the same way you would brief a human reviewer, or implemented as deterministic code for objective criteria. Evaluators are versioned and reusable across projects, which keeps evaluation criteria consistent as systems evolve.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explainability and action:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Every evaluation produces not just a label or score, but an explanation. This matters because knowing that an output was marked "hallucinated" is less useful than understanding why: which claim was unsupported, which context was missing. Explanations make evaluations actionable: they point teams toward specific retrieval failures, prompt gaps, or model limitations. Combined with trace-level observability, this turns evaluation from a reporting mechanism into a diagnostic tool that accelerates iteration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98ck2eve4ts41xndbj0t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98ck2eve4ts41xndbj0t.png" alt="The best approach to compare LLM outputs" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Completing the loop with Portkey: routing and orchestration for evaluations
&lt;/h2&gt;

&lt;p&gt;Running meaningful &lt;a href="https://portkey.ai/docs/guides/use-cases/run-batch-evals?ref=portkey.ai#how-to-run-structured-output-evals-at-scale" rel="noopener noreferrer"&gt;LLM evaluations&lt;/a&gt; requires more than scoring outputs in isolation. Teams need a reliable way to orchestrate how different models, prompts, and configurations are exercised so that comparisons are intentional and repeatable.&lt;/p&gt;

&lt;p&gt;By acting as a routing layer for LLM traffic, Portkey's &lt;a href="https://portkey.ai/features/ai-gateway?ref=portkey.ai" rel="noopener noreferrer"&gt;AI Gateway&lt;/a&gt;makes this orchestration straightforward. Multiple models and providers can be invoked through a single, consistent API, allowing teams to evaluate alternatives side by side without changing application code. The same inputs can be routed to different models, prompt versions, or configurations as part of structured evaluation runs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3mkker32fip2ch1qyl2y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3mkker32fip2ch1qyl2y.png" alt="The best approach to compare LLM outputs" width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This becomes especially useful when evaluations move closer to production. Instead of maintaining separate pipelines for testing and live traffic, teams can reuse the same routing logic to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compare models under identical conditions&lt;/li&gt;
&lt;li&gt;Test prompt changes against real inputs&lt;/li&gt;
&lt;li&gt;Run controlled experiments alongside production traffic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Observability ensures that these evaluations remain interpretable. Every request captures the context needed to explain outcomes: which model was used, how it was routed, which prompt version was applied, and how the system performed in terms of latency and cost.&lt;/p&gt;

&lt;p&gt;Together, routing and observability turn evaluations into an operational loop. Results from Arize evaluations can be traced back to the exact model and routing decisions that produced them, making it easier to act on those insights and iterate with confidence.&lt;/p&gt;

&lt;p&gt;To try it out, &lt;a href="https://app.portkey.ai/?ref=portkey.ai" rel="noopener noreferrer"&gt;get started with Portkey&lt;/a&gt; for free (Portkey is open source!)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://portkey.ai/book-a-demo?utm_medium=blog&amp;amp;ref=portkey.ai" rel="noopener noreferrer"&gt;Book a demo&lt;/a&gt; with our experts if you're looking to deploy AI Agents in production!&lt;/p&gt;

</description>
      <category>aievals</category>
      <category>observability</category>
    </item>
    <item>
      <title>Open AI Responses API vs. Chat Completions vs. Anthropic Messages API</title>
      <dc:creator>Drishti Shah</dc:creator>
      <pubDate>Mon, 23 Feb 2026 14:27:32 +0000</pubDate>
      <link>https://dev.to/portkey/open-ai-responses-api-vs-chat-completions-vs-anthropic-messages-api-33h2</link>
      <guid>https://dev.to/portkey/open-ai-responses-api-vs-chat-completions-vs-anthropic-messages-api-33h2</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsuoszatlu11gfgohkqp3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsuoszatlu11gfgohkqp3.png" alt="Open AI Responses API vs. Chat Completions vs. Anthropic Messages API"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The LLM API landscape has never been more fragmented, or more consequential. As teams move from prototypes to production, the choice of which API format to build on shapes your vendor flexibility, your codebase complexity, and how quickly you can swap models when something better comes along.&lt;/p&gt;

&lt;p&gt;Today, three API formats dominate how AI Agents talk to LLMs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI's Chat Completions API&lt;/strong&gt; — the de facto standard, universally supported&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI's Responses API&lt;/strong&gt; — the newer, agent-oriented evolution with built-in tools and state management&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anthropic's Messages API&lt;/strong&gt; — Claude's native interface, with capabilities like extended thinking and prompt caching&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each was designed with different goals in mind. Understanding the differences affects how you build, how you scale, and how locked in you are to a single provider.&lt;/p&gt;

&lt;p&gt;Portkey supports all three natively, and that's where standardization starts to matter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open AI Responses API vs. Chat Completions vs. Messages API: At a glance
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Chat Completions&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Responses API&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Messages API&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Provider&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;OpenAI&lt;/td&gt;
&lt;td&gt;OpenAI&lt;/td&gt;
&lt;td&gt;Anthropic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Endpoint&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;POST /v1/chat/completions&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;POST /v1/responses&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;POST /v1/messages&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Design goal&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Stateless text generation&lt;/td&gt;
&lt;td&gt;Agentic workflows with built-in tools&lt;/td&gt;
&lt;td&gt;Claude-native capabilities&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;State management&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Manual&lt;/td&gt;
&lt;td&gt;Optional server-side (with &lt;code&gt;store: true&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Manual&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Streaming&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tool / function calling&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅ (with built-in tools)&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Built-in web search&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅ (via server tools)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Extended thinking&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅ (Claude only)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Prompt caching&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅ (with &lt;code&gt;cache_control&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Computer use&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ecosystem compatibility&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Widest&lt;/td&gt;
&lt;td&gt;Growing&lt;/td&gt;
&lt;td&gt;Claude-specific&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What makes each endpoint different
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Chat Completions: the universal standard
&lt;/h3&gt;

&lt;p&gt;Chat Completions (&lt;code&gt;POST /v1/chat/completions&lt;/code&gt;) is where everything started. You send an array of messages, each with a role (&lt;code&gt;system&lt;/code&gt;, &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;assistant&lt;/code&gt;, or &lt;code&gt;tool&lt;/code&gt; for tool call results) and the model replies. It's stateless by design, so you own the conversation history and pass it with every request.&lt;/p&gt;

&lt;p&gt;This simplicity is its biggest strength. Because the model has no memory between calls, you have full control over what context it sees. And because practically every major provider has adopted this format, code written against Chat Completions works across OpenAI, Anthropic (via adapters), Gemini, Mistral, Bedrock, and other models with minimal changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does well:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Widest ecosystem of tools, frameworks, and libraries&lt;/li&gt;
&lt;li&gt;Predictable, well-understood response format&lt;/li&gt;
&lt;li&gt;Easiest path to switching providers or running multi-provider setups&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What it doesn't do:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No built-in tools. Web search, code execution, file search all need external orchestration&lt;/li&gt;
&lt;li&gt;No native support for extended reasoning or prompt caching&lt;/li&gt;
&lt;li&gt;No server-side state, you manage conversation history entirely&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The response object returns &lt;code&gt;choices&lt;/code&gt;, where each choice contains a &lt;code&gt;message&lt;/code&gt; with &lt;code&gt;role: "assistant"&lt;/code&gt; and &lt;code&gt;content&lt;/code&gt;. Tool calls come back in &lt;code&gt;tool_calls&lt;/code&gt;. Clean and predictable, which is why it became the lingua franca of LLM APIs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt; When your use case is primarily text generation i.e., chatbots, summarization, classification, content generation, Q&amp;amp;A. It's the right default if you're using frameworks like LangChain or LlamaIndex that abstract over providers, or if cross-provider portability matters.&lt;/p&gt;

&lt;h3&gt;
  
  
  Responses API: built for agents
&lt;/h3&gt;

&lt;p&gt;The Responses API (&lt;code&gt;POST /v1/responses&lt;/code&gt;) takes a different approach. It's designed to run agentic loops as the model can call multiple built-in tools (web search, file search, code interpreter, computer use, remote MCP servers) within a single API request, without you orchestrating each step.&lt;/p&gt;

&lt;p&gt;State management comes in two forms. With &lt;code&gt;previous_response_id&lt;/code&gt;, you chain responses by referencing a prior response ID and the model picks up context without you resending the full history, but you're still tracking the ID yourself. The newer Conversations API goes further, maintaining a durable conversation object server-side that automatically accumulates turns across sessions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does well:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built-in tools that run within a single request, no external orchestration needed&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;previous_response_id&lt;/code&gt; chains turns without resending prior tokens&lt;/li&gt;
&lt;li&gt;Designed for multi-step agentic workflows where context and tool results accumulate&lt;/li&gt;
&lt;li&gt;Better cache utilization compared to Chat Completions for repeated context&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What it doesn't do:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Natively available on OpenAI models only (though Portkey makes it work across providers)&lt;/li&gt;
&lt;li&gt;More complex response structure, &lt;code&gt;output&lt;/code&gt; is an array of typed items rather than a single message&lt;/li&gt;
&lt;li&gt;Overkill for simple single-turn completions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt; When you're building autonomous agents that use built-in tools, or multi-turn workflows where you want to reduce token overhead across turns. It's the right choice when agentic behavior and tool use are core to your application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Messages API: Claude's native interface
&lt;/h3&gt;

&lt;p&gt;Anthropic's Messages API (&lt;code&gt;POST /v1/messages&lt;/code&gt;) is designed around how Claude works. While it shares surface similarities with Chat Completions, it exposes capabilities that are specific to Claude and don't exist in OpenAI's formats.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does well:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Extended thinking:&lt;/strong&gt; Claude returns &lt;code&gt;type: "thinking"&lt;/code&gt; content blocks before the final answer, exposing its reasoning process. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt caching:&lt;/strong&gt; Fine-grained &lt;code&gt;cache_control&lt;/code&gt; lets you cache specific content blocks (with 5-minute or 1-hour TTLs), reducing latency and cost significantly for repeated context&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rich content blocks:&lt;/strong&gt; The &lt;code&gt;content&lt;/code&gt; array supports text, images, PDFs, tool use, thinking blocks, and citations pointing to source documents&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stop reason granularity:&lt;/strong&gt; &lt;code&gt;stop_reason&lt;/code&gt; can be &lt;code&gt;end_turn&lt;/code&gt;, &lt;code&gt;max_tokens&lt;/code&gt;, &lt;code&gt;stop_sequence&lt;/code&gt;, &lt;code&gt;tool_use&lt;/code&gt;, &lt;code&gt;pause_turn&lt;/code&gt;, or &lt;code&gt;refusal&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native web search:&lt;/strong&gt; Pass &lt;code&gt;{"type": "web_search_20250305", "name": "web_search"}&lt;/code&gt; in the &lt;code&gt;tools&lt;/code&gt; array and Claude handles execution server-side, returning results in a &lt;code&gt;server_tool_use&lt;/code&gt; response block&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What it doesn't do:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No server-side state management (you manage history yourself)&lt;/li&gt;
&lt;li&gt;Not natively compatible with non-Anthropic providers without a translation layer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The response object returns a &lt;code&gt;content&lt;/code&gt; array of typed blocks. A single response might include a &lt;code&gt;thinking&lt;/code&gt; block, a &lt;code&gt;text&lt;/code&gt; block, and a &lt;code&gt;tool_use&lt;/code&gt; block in sequence. Citations on text blocks tell you exactly which document or character range the model drew from.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt; When you're building specifically on Claude and need extended thinking for complex reasoning, prompt caching for document-heavy workloads, or reasoning transparency in your application.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Portkey supports all three
&lt;/h2&gt;

&lt;p&gt;Most teams end up needing more than one of these formats. You might use Chat Completions for a general assistant, the Responses API for an autonomous agent, and Claude's Messages API for a document reasoning pipeline, all in the same &lt;a href="https://portkey.ai/features/agents?ref=portkey.ai" rel="noopener noreferrer"&gt;AI Agent&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Building direct integrations with each provider means separate SDKs, separate observability, and code that breaks every time you want to try a new model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Portkey sits between your application and every provider, handling the translation so you don't have to.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The best part: you can &lt;strong&gt;use any of the three API formats with any provider and model&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Want to use the Messages API format but route to a Gemini model? Portkey handles the transformation. Want Chat Completions format but call a Claude model? Same thing.&lt;/p&gt;

&lt;p&gt;Beyond format flexibility, Portkey adds what direct API access can't give you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Observability:&lt;/strong&gt; Every request logged, traced, and searchable across all providers and API formats&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fallbacks and load balancing:&lt;/strong&gt; Route to a backup provider if your primary is down or rate-limited&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt management:&lt;/strong&gt; Version, test, and deploy prompts centrally&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost tracking:&lt;/strong&gt; Unified spend view across providers and models&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Governance:&lt;/strong&gt; Enterprise controls over which teams access which models&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Making calls with each API through Portkey
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Chat Completions
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;portkey_ai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Portkey&lt;/span&gt;

&lt;span class="n"&gt;portkey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Portkey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;PORTKEY_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;portkey&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@openai-provider/gpt-5.2&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Explain quantum computing in simple terms&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Responses API
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;portkey_ai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Portkey&lt;/span&gt;

&lt;span class="n"&gt;portkey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Portkey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;PORTKEY_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;portkey&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@openai-provider/gpt-4o&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Explain quantum computing in simple terms&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output_text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Messages API
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Anthropic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;PORTKEY_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.portkey.ai&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@anthropic-provider/claude-sonnet-4-5-20250514&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Explain quantum computing in simple terms&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Switching providers without changing your code
&lt;/h3&gt;

&lt;p&gt;The real payoff is when you want to swap providers.&lt;/p&gt;

&lt;p&gt;To move from OpenAI to Claude on Responses, all you need to do is change the provider name and model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;portkey_ai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Portkey&lt;/span&gt;

&lt;span class="n"&gt;portkey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Portkey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;PORTKEY_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;portkey&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@anthropic-provider/claude-sonnet-4-5-20250514&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Explain quantum computing in simple terms&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output_text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your application code, your observability, your fallback logic, none of it changes. The format stays the same and Portkey's &lt;a href="https://portkey.ai/docs/product/ai-gateway/universal-api?ref=portkey.ai" rel="noopener noreferrer"&gt;universal API&lt;/a&gt; handles the translation to whichever provider you're routing to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;All three API formats work through Portkey with a single configuration change, pointing your SDK's base URL at Portkey's gateway. From there, routing, translation, observability, and reliability are handled for you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://portkey.ai/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;strong&gt;Get started with Portkey&lt;/strong&gt;&lt;/a&gt; | &lt;a href="https://docs.portkey.ai/?ref=portkey.ai" rel="noopener noreferrer"&gt;&lt;strong&gt;Read the docs&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To see how explore how Portkey can support your AI strategy, &lt;a href="https://calendly.com/portkey-ai/quick-meeting?ref=portkey.ai" rel="noopener noreferrer"&gt;book a demo&lt;/a&gt; here.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>llm</category>
      <category>openai</category>
    </item>
  </channel>
</rss>
