Skip to content

About

Log in to Grok Bot, then call it as OpenAI /v1/chat/completions

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

grokbot-openai

Last updated: 2026-08-31

Grok Bot.app talks ConnectRPC protobuf at https://api2.cursor.sh. It does not have /v1/chat/completions. This repo logs you in with the same PKCE the app uses, then serves a local OpenAI URL:

http://127.0.0.1:8931/v1

Point Hermes, OpenCode, Cursor, or curl at that. Python 3.10+. No pip packages. Unofficial. Not a Cursor or xAI product.

Quick start

git clone https://github.com/owenisas/grokbot-openai.git
cd grokbot-openai

python3 -m grokbot_openai login    # browser, Cursor sand PKCE
python3 -m grokbot_openai serve    # http://127.0.0.1:8931/v1

Login writes ~/.grokbot/session.json mode 0600 and never prints tokens. Same file the local Hermes native transport uses.

python3 -m grokbot_openai status     # redacted
python3 -m grokbot_openai refresh
python3 -m grokbot_openai snippet hermes

Hermes

Keep serve running. Then:

providers:
  grokbot:
    name: Grok Bot
    base_url: http://127.0.0.1:8931/v1
    api_key: local
    default_model: grok-4.6
    models:
      - grok-4.6
      - grok-4.5
      - default
      - composer-2.5

/model grokbot/grok-4.6

There is no direct OpenAI URL at Cursor. If you skip serve, Hermes POSTs /chat/completions at api2.cursor.sh and 404s.

curl

curl -s http://127.0.0.1:8931/v1/chat/completions \
  -H 'content-type: application/json' \
  -d '{"model":"grok-4.6","messages":[{"role":"user","content":"Reply with exactly: PONG"}]}'

Streaming and tools work. Tool results are flattened to user text (TOOL_RESULT …) because native proto role=tool still errors.

Why a local server

WorkBuddy already speaks OpenAI JSON, so that repo can skip the shim. Grok Bot cannot. The wire is:

POST https://api2.cursor.sh/aiserver.v1.InferenceService/Stream
Content-Type: application/connect+proto

serve is the product.

Layout

grokbot_openai/   login, Connect client, OpenAI HTTP server
examples/hermes-provider.yaml
tests/
python3 -m unittest tests.test_openai_shape

Env

var meaning
GROKBOT_HOME or GROKBOT_OPENAI_HOME Config dir (default ~/.grokbot)

Do not commit ~/.grokbot/.

About

Log in to Grok Bot, then call it as OpenAI /v1/chat/completions

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages