progrok proxy

progrok proxy turns the stored OAuth session into an OpenAI-compatible local endpoint. It is the bridge for clients that already know how to call OpenAI-shaped APIs but do not know how to perform xAI OAuth.

Start the server

progrok proxy --host 127.0.0.1 --port 18645

The default bind address is 127.0.0.1 and the default port is 18645. Keep it on localhost unless you are deliberately placing your own authentication and network controls in front of it.

Client configuration

export OPENAI_BASE_URL=http://127.0.0.1:18645/v1
export OPENAI_API_KEY=anything

The placeholder API key only satisfies client libraries that require a value. progrok discards that bearer token and injects the refreshed xAI OAuth token before the upstream request leaves your machine.

Proxy behavior

POST http://127.0.0.1:18645/v1/chat/completions
Authorization: Bearer anything

progrok:
  1. loads ~/.progrok/auth.json
  2. refreshes the token if needed
  3. replaces Authorization with the xAI OAuth bearer
  4. forwards to https://api.x.ai/v1/chat/completions

What paths are covered

The proxy forwards HTTP /v1/* paths, so the same local endpoint can be used for chat, Responses, reasoning, structured output, tool calls, files, batches, tokenizer requests, model listing, images, videos, voice endpoints, and collection search when your account has access.

WebSocket boundary

The localhost server is HTTP-only. Responses, realtime Voice, streaming STT, and streaming TTS clients connect directly to wss://api.x.ai/v1; there is no localhost WebSocket upgrade path. Server clients use the stored bearer. Browser realtime and STT clients mint a fresh one-use secret through same-origin HTTP for every connection and reconnect.

When not to use the proxy

Use direct commands when progrok provides a richer workflow than a generic HTTP forwarder:

  • progrok search for web/X source selection, JSON output, and reasoning effort.
  • progrok image for local reference files and output handling.
  • progrok video for async job polling and downloads.
  • progrok tts and progrok stt for local audio files.
  • progrok live for a direct Realtime NDJSON bridge.
  • progrok chat for the local web app on port 18646.
  • progrok capabilities --json for agent-readable metadata.