Skip to content

API overview ​

Import the protocol client from the package root. Avatar math and the Mac credential adapter are separate entry points so a server install does not have to load Keychain code.

js
import {
  GrokBotClient,
  SDKError,
  createLogin,
  pollLogin,
  normalizeBot,
} from 'grok-bot-sdk'
import { deriveDefaultAvatar, resolveAgentAvatar } from 'grok-bot-sdk/avatar'
import { desktopCredentials } from 'grok-bot-sdk/desktop'
SymbolRole
GrokBotClientAccount, roster, send, watch, SSE
createLogin / pollLoginBrowser authorization
normalizeBotOne raw roster record to a Bot
SDKErrorFixed code plus optional httpStatus
deriveDefaultAvatarOffline shape and color from an agent UUID
resolveAgentAvatarExplicit fields first, then the UUID fallback
desktopCredentialsOptional macOS reader for an existing Grok Bot login

Pages:

  • Client — constructor, getMe, listBots, sendMessage, watchBot, botEventsSSE
  • Events and SSE — event names, payloads, wire format
  • Avatar — algorithm grok-bot-0.70.2
  • Errors — SDKError codes and login codes
  • Protocol — the HTTP and Connect calls those methods make

The desktop client contains a much larger generated RPC surface. Methods absent from the protocol page are absent from this SDK.

Unofficial SDK by 铁柱AGI (@cgnot996). Not an xAI or Cursor product.