Live
OpenShift 5 observability adds autonomous troubleshooting with LightspeedPartitioned __cf_bm cookie enables Bot Management continuity in third‑party iframesAI Production Architecture: Lessons from Microsoft Ignite’s Frontier TransformationBorderless Lakehouse Redefines Data Access for AI AgentsDynamic Model Switching in Gemini 4 Cuts Coding Agent Latency and Token CostRunning SGLang‑Neuron on AWS Trainium: Architecture and Ops GuideTerraform v5.29.0 adds full namespace control for Cloudflare AI SearchBeyond Token Pricing: Managing Amazon Bedrock Cost per TaskOpenShift 5 observability adds autonomous troubleshooting with LightspeedPartitioned __cf_bm cookie enables Bot Management continuity in third‑party iframesAI Production Architecture: Lessons from Microsoft Ignite’s Frontier TransformationBorderless Lakehouse Redefines Data Access for AI AgentsDynamic Model Switching in Gemini 4 Cuts Coding Agent Latency and Token CostRunning SGLang‑Neuron on AWS Trainium: Architecture and Ops GuideTerraform v5.29.0 adds full namespace control for Cloudflare AI SearchBeyond Token Pricing: Managing Amazon Bedrock Cost per Task
AWS

Usage‑Based Metering Added to SageMaker Bidirectional Streaming Inference

AI SummaryPowered by AI

AWS now supports usage‑based metering for Amazon SageMaker AI bidirectional streaming, letting model providers report consumption to AWS Marketplace. This change aligns software charges with actual streaming usage and introduces a new metadata channel that engineers must integrate and monitor.

Amazon SageMaker AI bidirectional streaming now includes a usage‑based metering capability that reports consumption to AWS Marketplace. Engineers building or operating real‑time speech models need to adapt because the billing model shifts from static endpoint fees to per‑unit usage, and a companion WebSocket stream must be handled alongside the existing inference channel.

Usage‑Based Metering Overview

Previously, SageMaker Marketplace metering relied on a single HTTP response header that conveyed a unit count for request‑response APIs. That approach cannot capture the variable length of a bidirectional audio session, where usage accrues over time. The new mechanism introduces a second WebSocket connection dedicated to metering data. Model providers send JSON frames that contain a Metering object with a Dimension (e.g., inference.count) and a ConsumedUnits value representing the amount of work performed, such as seconds of audio processed.

Architectural Impact

When a streaming session starts, SageMaker AI establishes two parallel connections to the model server:

  • Data connection: carries the audio payload and transcription results.
  • Metadata connection: carries metering records.

The model server signals support by returning the header X-Amzn-SageMaker-Metadata-Stream-Supported: true during the WebSocket upgrade. SageMaker then opens the metadata channel at the path /invocations-bidirectional-stream-metadata. Both channels include the same X-Amzn-SageMaker-Request-Id header, allowing the model server to correlate metering frames with the active inference session.

Operational Considerations

Metering frames must be sent as individual JSON text messages, limited to one per second per connection and a maximum size of 512 bytes. The recommended practice is to emit incremental records as usage accrues—either per unit or in small batches—so that unexpected session termination leaves minimal unreported consumption. A final record should be transmitted immediately when the session ends. Operators should monitor the rate quota, verify that each frame contains exactly one record, and reconcile the reported units against AWS Marketplace billing reports to detect gaps.

Security and Compliance Notes

The metadata stream does not introduce a new authentication mechanism; it reuses the same request‑ID and underlying authorization that protects the data connection. Practitioners should ensure that any custom handling of the metadata channel respects the existing IAM permissions granted to the SageMaker endpoint. Because the metering payload is small and text‑based, standard network security controls (TLS, VPC isolation) remain sufficient, but logging of metering traffic can aid in auditability and dispute resolution.

Related CloudNinjas coverage: AWS.

What This Means For Practitioners

  • Update model servers to detect the X-Amzn-SageMaker-Metadata-Stream-Supported header and open the companion WebSocket at /invocations-bidirectional-stream-metadata.
  • Implement logic to emit Metering JSON frames at a maximum of one per second, staying within the 512‑byte limit.
  • Correlate metering records with the X-Amzn-SageMaker-Request-Id to ensure accurate attribution.
  • Validate reported ConsumedUnits against Marketplace charge reports to confirm billing integrity.
  • Monitor the health of both data and metadata connections, and design graceful shutdown handling to guarantee the final metering record is sent.
Originally published atAWS Machine Learning Blog