Repository navigation
[Feature]: enable xAI API-key Priority Processing in Codex Fast mode #1875
Description
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_tiersupport 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-chatadapter.
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
- xAI Priority Processing documentation: https://docs.x.ai/developers/advanced-api-usage/priority-processing
- Related capability issue: [Feature]: expose speed/service-tier capabilities for eligible custom providers and routed models #1436
- Chat serialization gate: fix(openai-chat): forward caller-selected service tier #1512
- Provider/model capability framework landed through feat: land four rebuilt heavy drafts (service tiers, request pacing, native chat, empty-completion guard) #1752
- Historical Phase 90 deliberately stripped inherited Fast metadata from every routed provider, including
xai/*; this proposal restores it only where the final transport is verified.
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.
Activity
Ingwannu commentedon Aug 16, 2026
This is a valid and well-scoped capability request. The important boundary is exactly the one described here: the built-in
xaiid can resolve either to the canonical API-key transport or to the Grok CLI OAuth transport, so a static provider-widechatServiceTierflag would be incorrect.The mergeable direction is:
priorityonly for the canonical xAI API-key path;I am leaving this open as an accepted provider/catalog enhancement. Please do not implement it as a static registry-only opt-in.
Wibias commentedon Aug 17, 2026
[GD] Opened PR #1885 to address this.
olddonkey commentedon Aug 17, 2026
Sequencing note: this issue is now the xAI delivery unit (Phase B2) of the FastWire umbrella #1886, which generalizes Fast mode across providers.
What this changes for this issue:
resolveFastPolicypipeline instead of extending the current resolver ad hoc.codex/xai-priority-service-tier(auth-transport-scoped capability overlay) survived the design review conceptually unchanged, but stays unmerged for now.(xai, grok-*, priority)— which first requires verifying from official xAI pricing docs how Priority Processing interacts with long-context pricing. Until that verification, Fast attempts on xAI report cost as unavailable rather than applying a guessed multiplier.olddonkey commentedon Aug 17, 2026
Pricing research for the B2 gate (from the official xAI docs — Priority Processing, Pricing):
Officially priced cells for
grok-4.6(per 1M tokens, input / cached / output):Confirmation semantics (official, and it matches the per-attempt model this issue now depends on): when priority capacity is unavailable the response comes back with
"service_tier": "default", and "You are only billed at the priority rate when the response confirms"priority"". So billing follows the response echo, not the request — exactly the confirmed/downgraded distinction the FastWire per-attempt outcome records.Consequence for the B2 unit:
priceRelation: "gte-standard"with a defensible lower bound at the long-context rates ($4 / $1 / $12), surfaced ascostLowerBound("≥") rather than a point estimate.This narrows the GA blocker from "pricing unverified" to "one band lower-bounded instead of exact".
lidge-jun commentedon Aug 19, 2026
리뷰 · 우선순위 24 / 80
xAI API 키로 Grok을 쓸 때 Codex Fast가 xAI Priority Processing이 되게 하고 싶다. 문서는 Chat/Responses 모두 service_tier priority 다. 옵트인 프로바이더 Fast라 24이다. #1886 의 첫 배달이다.
src/providers/registry.ts 의 xai 항목에는 chatServiceTier 와 modelSupportsServiceTier 가 없다. 그래서 xai/* 행에 Fast가 안 뜨고 런타임도 priority 를 안 넣는다. 기본 authKind는 oauth 이고 allowKeyAuthOverride 가 true다.
키 모드는 api.x.ai 다. OAuth는 src/providers/xai-transport.ts 의 cli-chat-proxy.grok.com 으로 바뀐다. 프로바이더 전체에 Fast를 켜면 검증 안 된 OAuth 수송까지 광고한다. openai-chat.ts 는 chatServiceTier 가 true일 때만 호출자 service_tier 를 넘긴다.
src/providers/fastwire.ts 가 수송(authorization_bearer vs oauth)과 eligibility 를 나눈다. xAI Fast는 키 수송에서만 eligible 이어야 한다. 모델 이름만 보고 켜면 안 된다.
해결방안
canonical api.x.ai 키 모드에만 service_tier 능력을 연다. 카탈로그 Fast는 그 모드의 xai 행만. Fast면 priority 주입, Standard면 필드 제거. OAuth/Grok CLI 는 광고하지 않는다. 사용자 opt-out과 같은 resolver를 카탈로그/런타임이 공유한다. 가격 2배는 #1886 과금 행렬이 생기기 전에는 카탈로그 문구만 고친다.
이 댓글은 grok-bot이 작성했습니다
lidge-jun commentedon Aug 19, 2026
리뷰 · 우선순위 56 / 80
점수 정정임. 24는 Fast 옵션을 장식으로 본 거였음.
#1752서비스 티어 프레임은 이미 있고 FastWire B2도 들어왔음.xai레지스트리가chatServiceTier/modelSupportsServiceTier를 안 켜서 카탈로그에 Fast가 안 뜨고service_tier: "priority"도 안 나감.공식 문서는 API 키
https://api.x.ai/v1만임. OAuthcli-chat-proxy.grok.com은 검증 전이라 프로바이더 전체에 켜면 안 됨. 수동modelSupportsServiceTier는 인증 모드 바꿔도 남아서 OAuth에 필드가 샐 수 있음.해결방안: 키 모드 + 캐논
api.x.ai일 때만 티어 광고/주입. Fast면priority, Standard면 필드 빼기. OAuth는 그대로 숨김. 모델 이름으로 추측하지 말 것.이 댓글은 grok-bot이 작성했습니다
feat(xai): enable Priority Processing on the API-key transport
Merge pull request #2072 from olddonkey/codex/fastwire-b2-xai
lidge-jun commentedon Aug 22, 2026
이미 #2072 (
8535f082fac3f0342e2e73445edd4655be3147eb)로dev에 반영되었습니다 — xAI API-key 경로에서 Codex Fast / Priority Processing이 동작합니다. 이슈를 닫습니다.feat(xai): enable Priority Processing on the API-key transport
Merge pull request lidge-jun#2072 from olddonkey/codex/fastwire-b2-xai