HTTP 402 Payment Required (CreditsExceededError) when using webrtc-gpu-medium on Research Plan

Hi everyone,

I am experiencing a sudden issue with cloud-hosted inference.

The Situation:

I am streaming video from a Raspberry Pi to Roboflow using inference_sdk with webrtc-gpu-medium.

  • Yesterday: This exact code worked perfectly on my Research Plan.

  • Today: The exact same code fails immediately with an HTTP 402 Payment Required error.

Context:

  • Plan: Research Plan

  • Credits: Dashboard shows ~50 credits remaining (0.6 used).

  • Code: No changes were made to the code between yesterday (working) and today (broken).

Code:

import cv2
import sys
import os
from inference_sdk import InferenceHTTPClient
from inference_sdk.webrtc import WebcamSource, StreamConfig, VideoMetadata

# --- CONFIGURATION ---
# API Key hidden for security
API_KEY = "YOUR_API_KEY"

# Initialize client
client = InferenceHTTPClient.init(
    api_url="https://serverless.roboflow.com",
    api_key=API_KEY
)

# Configure video source
# On Pi Camera 3, we often need libcamerify
source = WebcamSource(resolution=(1280, 720))

# Configure streaming options
config = StreamConfig(
    stream_output=["output_image"],
    data_output=["output_deduplicated", "count_objects", "predictions"],
    requested_plan="webrtc-gpu-medium", # Options: webrtc-gpu-small, webrtc-gpu-medium, webrtc-gpu-large
    requested_region="eu",
)

# Create streaming session
session = client.webrtc.stream(
    source=source,
    workflow="your-workflow-id",   # Replaced specific workflow ID
    workspace="your-workspace-id", # Replaced specific workspace ID
    image_input="image",
    config=config
)

# Handle incoming video frames
@session.on_frame
def show_frame(frame, metadata):
    # Only show popup window if a monitor is attached (avoids crash on SSH)
    if os.environ.get('DISPLAY') is not None:
        cv2.imshow("Workflow Output", frame)
        if cv2.waitKey(1) & 0xFF == ord("q"):
            session.close()

# Handle prediction data
@session.on_data()
def on_data(data: dict, metadata: VideoMetadata):
    # Print counts to terminal
    if "count_objects" in data:
        print(f"Frame {metadata.frame_id}: Counts: {data['count_objects']}")
    else:
        print(f"Frame {metadata.frame_id}: {data}")

# Run the session
print("Stream starting... Press Ctrl+C to stop.")
try:
    session.run()
except KeyboardInterrupt:
    print("\nStopping...")
    session.close()

The Error:

RuntimeError: Failed to initialize WebRTC session (HTTP 402).
Response: {"message":"Not enough credits to perform this request.","error_type":"CreditsExceededError"}

My Question:

Since this was working fine yesterday and I still have credits displayed on my dashboard, I am confused why it is now throwing a payment error?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.