Skip to content

[Feature]: enable xAI API-key Priority Processing in Codex Fast mode #1875

Description

@olddonkey

Area

Provider adapters

What are you trying to accomplish?

Use Codex Fast mode with Grok models routed through the built-in xai provider when that provider is using an xAI API key. xAI documents Priority Processing for text inference by sending service_tier: "priority" on both Chat Completions and Responses requests.

The expected workflow is that selecting Fast in Codex, or enabling the existing OpenCodex Fast setting, makes an xAI API-key request use xAI Priority Processing while Standard leaves the field absent/default.

What prevents this today?

OpenCodex now has provider/model-scoped service-tier capability resolution, catalog publication, and Chat serialization, but the built-in xai registry entry declares neither chatServiceTier nor modelSupportsServiceTier. Consequently xai/* catalog rows do not advertise Fast and the runtime does not inject or forward the priority tier.

The preset also multiplexes two transports under one provider id:

  • API-key mode stays on https://api.x.ai/v1, where Priority Processing is officially documented.
  • OAuth mode is rewritten to https://cli-chat-proxy.grok.com/v1, where the same capability is not established by the public API documentation.

A provider-wide unconditional opt-in would therefore overstate the unverified OAuth transport.

What should OpenCodex do?

OpenCodex should make service-tier capability sensitive to the effective xAI authentication transport:

  • enable verified service_tier support for the canonical xAI API-key transport;
  • publish the Codex Standard/Fast selector for eligible xai/* rows only in API-key mode;
  • inject/forward service_tier: "priority" when Fast is selected and remove it when Fast is explicitly disabled;
  • keep the Grok OAuth/CLI subscription transport unadvertised and uninjected unless that exact endpoint is separately verified;
  • preserve explicit user opt-outs and keep catalog/runtime decisions driven by the same capability resolver;
  • avoid inferring support merely from a Grok model name or from the shared openai-chat adapter.

Example usage or interface

Given an xAI API-key configuration:

{
  "defaultProvider": "xai",
  "providers": {
    "xai": {
      "adapter": "openai-chat",
      "baseUrl": "https://api.x.ai/v1",
      "authMode": "key"
    }
  },
  "fastMode": true
}

the routed catalog entry for xai/grok-4.6 should advertise the priority/Fast tier and the effective Chat Completions body should contain:

{
  "model": "grok-4.6",
  "service_tier": "priority"
}

With authMode: "oauth", the same preset should not advertise Fast and should not send service_tier until the CLI subscription endpoint has its own evidence.

Alternatives or workarounds

Users on current dev can manually declare modelSupportsServiceTier or chatServiceTier, but those settings are not automatically constrained to API-key mode. They can survive an auth-mode switch and cause the unverified OAuth transport to receive the field.

A separate custom API-key provider can also opt in manually, but that duplicates the canonical xAI preset and loses the intended built-in provider experience.

Additional context

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolOAuth, credentials, Codex pool, quota, failover, planscatalogModel catalog, slugs, visibility, routed entriesenhancementNew feature or requestproviderProvider adapters, OpenAI-compat presets, upstream API quirks

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions