Skip to content
XPNCORE

Core Features

The journey of an AI request: How intelligent routing works

Explore how the gateway receives your prompt, selects the fastest route, streams tokens smoothly in real time, and ensures completely transparent billing.6 min readUpdated Sep 24, 2026

What happens behind the scenes of an AI call?#

When an end-user sends a question in your app or a background script submits a prompt to the API, an intelligent chain of events unfolds within just a few milliseconds before the AI model begins generating its very first word.

Here is a simple look at how XPNCORE validates your credentials, picks the optimal route, and delivers blazing-fast responses with fair, transparent pricing.

1. Instant verification and balance protection#

The moment your request reaches the platform, your API key is verified for validity, permissions, and security rules. Simultaneously, the system estimates the maximum token cost based on the length of your input prompt and checks your wallet balance.

This validation step completes in under 5 milliseconds. By checking available funds upfront, you are protected against unexpected negative balances, while your API key stays secure against unintended runaway loops or abuse.

2. Smart routing to the fastest, most reliable server#

Once verified, XPNCORE picks the server best placed to handle your requested model. Rather than picking at random, it weighs several live signals:

  • Real-time latency: Which server is responding fastest right now?
  • Health status: Which server is stable, without congestion or overload?
  • Feature support: Does the model fully support what you asked for, such as vision or function calling?

This ensures your application consistently connects to the highest-performing pipeline available at that exact moment.

3. Smooth, low-latency streaming in real time#

Waiting 5 to 10 seconds for a lengthy response to finish generating feels sluggish to users. With real-time Server-Sent Events (streaming), the moment the model begins outputting text, tokens flow directly to your application without delay.

Users see characters appear smoothly and dynamically on screen, creating an engaging, responsive experience that makes your product feel modern and polished.

4. Fair and transparent token accounting#

Once the response stream concludes, the gateway logs the exact number of tokens actually generated:

  • Prompt tokens received.
  • Completion tokens generated.
  • Cached tokens eligible for discounted rates.

The exact charge is calculated strictly according to public pricing rules and settled against your wallet balance. You can review every single request on your Usage Log dashboard anytime — complete with response times, token breakdowns, and step-by-step cost calculations.