Skip to content
AI Primer
release

Hugging Face adds OpenRouter routing for 160 chat models

Hugging Face integrates OpenRouter for access to 160 chat models using existing tokens and code. Routing selects providers by price, speed or reliability, with failover within a single API call.

4 min read
Hugging Face adds OpenRouter routing for 160 chat models
Hugging Face adds OpenRouter routing for 160 chat models

TL;DR

Provider pins disable automatic failover. OpenRouter’s October routing experiment traded a 6% higher cost per request for fewer capacity errors and faster responses.

160 chat models on the Hub

Hugging Face switched its language-model inference routing to OpenRouter on November 16. Launch coverage includes every model OpenRouter serves that has a Hub page, according to OpenRouter’s announcement.

Existing Hugging Face tokens and endpoints continue to work. The supported API interfaces are:

  • OpenAI Chat Completions.
  • OpenAI Responses.
  • Anthropic Messages.

The integration also adds a route back to the weights from OpenRouter’s model pages.

Custom provider keys

Language-model requests now bill to the Hugging Face account or organization. Previously configured provider API keys no longer work for these requests.

The custom-key removal is the release’s biggest migration gotcha.

Hugging Face adds no markup over provider pricing. Provider selection remains configurable, but selecting a provider no longer means billing its API key through Hugging Face.

Image, video and audio generation continue directly through Hugging Face Inference Providers, outside OpenRouter. Custom keys for image and video providers keep working.

Routing and provider pins

OpenRouter scores providers using three live signals:

  • Effective price: actual charges, accounting for cache-hit rates and the model’s usual input/output token mix.
  • Speed: throughput and time to first token.
  • Reliability: failures, malformed tool calls and capacity rejections.

Hugging Face previously selected one provider and returned its error if it failed. OpenRouter retries another provider within the same call, the change testingcatalog highlighted.

Model-ID suffixes expose explicit routing controls:

  • zai-org/GLM-5.3:fastest: highest throughput in tokens per second.
  • zai-org/GLM-5.3:cheapest: lowest price.
  • zai-org/GLM-5.3:novita: only Novita, with no fallback to another provider.

Provider opt-outs also remain available in settings. Organization settings govern organization-billed requests; pinning a disabled provider returns an error.

October routing experiment

OpenRouter reports four changes from the live experiment accompanying its October routing rebuild:

  • Capacity errors: 46% fewer requests hitting a capacity error.
  • Time to first token: 16.9% faster.
  • Throughput: 16.3% higher.
  • Cost per request: 6.0% higher.

These measurements come from OpenRouter’s own routing experiment before the Hugging Face launch.

Prompt-cache affinity

Conversations stay with the provider holding their prompt cache. Hugging Face’s caching documentation specifies the mechanics:

  • X-HF-Session-Id accepts a stable UUID per conversation to maintain provider affinity. Other values are ignored.
  • usage.prompt_tokens_details.cached_tokens reports how many input tokens came from cache.
  • Hugging Face’s Python and JavaScript clients handle caching automatically.

Providers and Metrics tabs

Hub model pages now expose two dashboards:

  • Providers: available providers, input/output prices, speed and uptime over the preceding 24 hours.
  • Metrics: best price, throughput, time to first token, context length and uptime across providers.

The usage overview also breaks spending down by the provider that served each request.

Trace export and Privacy Mode

OpenRouter also added a beta Hugging Face Storage destination to Broadcast, its trace-export feature. Each request becomes a separate JSON file in a bucket owned by the user or organization, according to OpenRouter’s launch post.

The exported records contain:

  • Input messages.
  • Model output.
  • Token counts.
  • Cost.

Images and other media are omitted.

Configuration uses S3 credentials generated from a Hugging Face token with write access. The Storage Buckets documentation supports path templates such as {apiKeyName}/{date} and saves the configuration only after a test write succeeds.

Privacy Mode excludes prompt and completion content plus provider error text, while retaining token usage, costs, timing, model information and custom metadata. It also replaces raw provider usage with null, because that object can contain arbitrary future fields.

Further reading

Discussion across the web

Where this story is being discussed, in original context.

On X· 4 threads
TL;DR1 post
160 chat models on the Hub1 post
Routing and provider pins1 post
Trace export and Privacy Mode2 posts
Share on X