Hermes Agent
Set up Grok in Hermes Agent with SuperGrok or the xAI API
Updated 1 December 2026
Grok is xAI’s family of AI models. Nous Research’s Hermes Agent 0.23.5 can connect directly to xAI in two ways. Sign in with an eligible SuperGrok or linked X Premium+ account, or use an xAI API key with separate billing. If you already subscribe, check that Grok answers a message in Hermes after you approve the sign-in. xAI can approve the login and still reject the model request.
Sources read on 30 November 2026 include the Hermes Agent 0.23.5 documentation and source for the xAI provider and Grok subscription setup. The model and billing details come from xAI’s Grok 4.7, 4.6, 4.5, 4.3 and 4.20 API model docs, API pricing, account FAQ and Hermes integration announcement.
Can you use your Grok subscription in Hermes?
Yes, if xAI authorises your account for model requests through xai-oauth. The Hermes guide names SuperGrok and a linked X Premium+ account. X Help lists Basic, Premium and Premium+ for existing X Premium plans. The Premium, Super and Ultra tiers of The X Subscription include X Premium+ benefits once you connect a personal X account. Sign in with the account linked to your subscription.
In its 15 May 2026 announcement xAI wrote, “Starting today, you can use your Grok subscription directly inside Hermes Agent.” It also said, “Connecting Grok to your Hermes agent is available on every tier.” The 0.23.5 guide records that standard SuperGrok accounts have received HTTP 403 after a successful login. Follow the tagged guide’s advice and test a chat turn on your own account. The sources give no current Hermes eligibility table for SuperGrok, legacy X Premium+ or The X Subscription.
For direct API access through xai, xAI’s account FAQ says, “Yes, the account is shared between Grok and the Grok API.” It adds, “However, the billing is separate for Grok and Grok API.” The direct route uses API credits and an API key from the Grok Console. Use that route if you want usage billed at the published API rates or your account fails the OAuth eligibility check.
Connect Grok with an xAI API key
These terminal steps assume you run Hermes yourself. Start with the Hermes Agent installation guide if you need to install it. The tagged OAuth guide mentions Python 3.9+, but the tagged installation guide specifies Python 3.14 for first-party installations. Use the installation guide for the runtime.
- Sign in to the Grok Console, add API credits and generate a key as shown in the Grok API quickstart. Make sure the key permits the Responses API and the model you plan to use.
- Run
hermes modelin your terminal. Open xAI Grok, then select xAI and paste the key at theXAI_API_KEYprompt. If Hermes already has the correct key, choose Keep. - At the base URL prompt, enter
https://api.x.ai/v1for the global API. Press Enter if it already shows that address. An existingXAI_BASE_URLor a savedmodel.base_urlfor xAI can change the address shown. Use an official xAI HTTPS address because Hermes can send your key to the address you enter. - Pick an API model such as
grok-4.6. If your Grok Console lists the model you want and the Hermes picker omits it, choose Enter custom model name and type its exact ID. The picker saves your selection as the default.
To enter the key manually, open .env in the data directory Hermes is using. The default is ~/.hermes on macOS and Linux, %LOCALAPPDATA%\hermes on native Windows, and /opt/data in the official Docker image. Replace the placeholder in the example below with your own key. Keep .env private and out of version control.
XAI_API_KEY=your_api_keyIf you added the key in .env, run hermes model, choose xAI Grok, then xAI, and select a Grok model. Whichever way you entered the key, run hermes to test your selection.
In configuration, the provider ID is xai. Its aliases are grok, x-ai and x.ai. Both xAI providers use the Responses API through Hermes’s codex_responses adapter.
Sign in with SuperGrok or X Premium+
- Run
hermes modelin your terminal, choose xAI Grok, then choose xAI Grok OAuth (SuperGrok / Premium+). That is the label in the 0.23.5 CLI. - If Hermes offers Use existing credentials, choose it to keep your saved sign-in, or pick Reauthenticate (new OAuth login) to sign in again. For a new sign-in, open the verification URL Hermes prints if your browser does not open it. Sign in at
https://accounts.x.ai, enter the displayed device code if asked, and approve access. Hermes polls xAI while it waits for approval. - Choose a model. The guide’s default is
grok-4.6. Runhermesand send a short message to confirm xAI serves the model to your account.
To sign in separately, run hermes auth add xai-oauth. On a remote machine without a browser, run the command below, then open the printed URL in a browser on your own device. The providers overview mentions an SSH tunnel, but the dedicated guide and the 0.23.5 implementation use a device code and polling, so a tunnel is unnecessary for Grok.
hermes auth add xai-oauth --no-browserAfter approving the manual sign-in, run hermes model to save the provider and model, or use these two commands from the OAuth guide.
hermes config set model.default grok-4.6
hermes config set model.provider xai-oauthHermes saves xAI OAuth credentials in auth.json and refreshes the tokens as needed. The provider aliases are grok-oauth, x-ai-oauth and xai-grok-oauth. The default API base URL is https://api.x.ai/v1. When reading the URL from the environment, Hermes checks HERMES_XAI_BASE_URL first, then XAI_BASE_URL. A valid override uses HTTPS on x.ai or one of its subdomains. Hermes falls back to the default if the override is invalid. hermes auth add xai-oauth saves the resolved URL with the credential. When Hermes selects that credential for chat, it uses the saved URL.
Grok model IDs, context windows and API costs
Hermes builds its curated Grok list from the cached models.dev catalogue or the release’s built-in fallback. It puts grok-4.6 first in that list. The setup picker can put your current model first. With an API key, the in-chat picker can also show models returned by the configured endpoint. The built-in fallback includes grok-4.5, grok-4.3 and the three Grok 4.20 IDs below. xAI documents grok-4.7 on the public API and Hermes has context metadata for it, though it is absent from that fallback list. Check your team’s model access in the Grok Console for API-key use. A picker entry alone cannot confirm access. For other providers, see the Hermes Agent guides.
All models below support function calling. The context window is the amount of information a model can handle in one request, measured in tokens. Global API rates are in US dollars per million tokens, in input, cached input and output order. For the billing cutoff, use xAI’s pricing table, updated 25 November 2026. For these models, once the prompt reaches 200,000 tokens, the long-context rates apply to all tokens in the request.
| API model ID | Context window | Short context | Long context |
|---|---|---|---|
grok-4.7, grok-4.6 | 500,000 tokens | $2.00 / $0.50 / $6.00 | $4.00 / $1.00 / $12.00 |
grok-4.5 | 500,000 tokens | $2.00 / $0.30 / $6.00 | $4.00 / $0.60 / $12.00 |
grok-4.3grok-4.20-0309-reasoninggrok-4.20-0309-non-reasoninggrok-4.20-multi-agent-0309 | 1,000,000 tokens | $1.25 / $0.20 / $2.50 | $2.50 / $0.40 / $5.00 |
The US regional endpoint, https://us.api.x.ai/v1, serves grok-4.7 and grok-4.6 at a 10% premium to those global rates. For chat through subscription sign-in, the Hermes providers reference leaves usage quotas undocumented.
Use xAI’s API release notes to check older model IDs. The Hermes providers overview still shows grok-4-fast-reasoning. xAI retired it on 15 May 2026 and maps that ID to grok-4.3 with low reasoning effort. The Hermes OAuth guide and fallback list still show grok-build-0.1, which left the public API on 19 November 2026. Hermes can also show grok-composer-2.5-fast in both pickers because the code adds it to both catalogues. The source describes it as an OAuth model.
Function calling, X Search and voice
With function calling, Hermes supplies the tool definitions, runs a function that Grok requests and returns the result to the model. xAI runs its own hosted web_search and x_search tools on its servers. When a Grok Responses request has a session ID, Hermes sends prompt_cache_key and x-grok-conv-id to help xAI reuse cached prompt content. xAI uses prompt_cache_key when both are present.
Run hermes tools and choose the platform where you chat. Make sure X (Twitter) Search is checked. Press Space only if it is unchecked, then press Enter. If Hermes asks for xAI credentials, complete setup and start a fresh chat. The OAuth guide and setup screen say the subscription takes priority. In 0.23.5, the code that sends the search request checks XAI_API_KEY first, even when your chat uses OAuth. For API-key searches, xAI charges for model tokens and each post or profile the search fetches, including parent and quoted posts. With the subscription alone, the tagged X Search guide reports that the tool can return an answer without post citations. Check for citations before relying on the result.
For streaming xAI speech, use XAI_API_KEY. The Hermes streaming TTS guide reports HTTP 403 when a subscription token is used on xAI’s metered speech endpoint.
Check which model answered
For subscription sign-in, run hermes doctor and look for xAI OAuth under Auth Providers. This checks login status. If you configured a backup model, make sure display.suppress_warning_notifications is false. If display.platforms.tui.suppress_warning_notifications is set, make sure it is false too.
Start a fresh session with hermes --tui and enter /model to check the selected model and provider. Close the picker and send a short prompt such as “Reply with the word ready.” A Model fallback notice means Hermes switched to the backup. A reply from that backup leaves Grok unverified. See Hermes model fallback for how switching works.
Run hermes model in your terminal to open the setup wizard or change the saved default.
Fix a 403, an expired login or a missing model
- 403 after OAuth sign-in. When the error says the caller lacks permission, the tagged guide points to xAI’s account eligibility check. Repeating the login leaves that check in place. For self-hosted Hermes, the guide’s alternative is to configure
XAI_API_KEYand switch toxai. Runhermes modelto choose that route and a model available to your API team, then try a fresh chat. - Device code timed out or Hermes asks you to sign in again. Run
hermes auth add xai-oauthto start a new approval. To clear xAI OAuth credentials stored in the active profile, runhermes auth logout xai-oauth. A named profile can still use credentials from the main Hermes data directory. If xAI OAuth was your selected provider, logout resetsmodel.providertoauto. To sign in again, runhermes model, select xAI OAuth and choose Reauthenticate (new OAuth login) if prompted. - The API model is missing or the request is rejected. In the Grok Console, check the exact model ID, your team’s model access and the key’s permissions for the Responses API and that model. Also check the selected provider, API credits and base URL.
- The default chat model has been retired from the API. If your saved default is
grok-build-0.1or another retired model, runhermes modeland choose a replacement your account can access.
Grok on ReadyHermes
ReadyHermes runs your Hermes Agent for you and offers xAI API-key entry in the Model key panel during the 30-minute free trial and on paid plans. Subscription sign-in for SuperGrok or X Premium+ is unavailable on ReadyHermes, and we have not tested it there.
In your account, open Model key, choose Your own API key, select xAI and paste an xAI API key with access to your chosen model. Pick a model from the provider’s /models list or type its ID, then press Switch to my key. ReadyHermes sends a small test message with your key. The test must pass before ReadyHermes switches the model and restarts your assistant. Allow about a minute for the restart.
The ReadyHermes trial includes its own AI. When you switch to your xAI key, the test message and subsequent Grok requests can incur xAI API charges. See the ReadyHermes model overview.
Questions
Can you use a Grok subscription with Hermes Agent?
Yes, on self-hosted Hermes Agent 0.23.5 if xAI authorises model access for your account. Hermes documents SuperGrok and a linked X Premium+ account through xai-oauth. Send a test message after sign-in to check that xAI serves the model to your account.
How do you connect Hermes to the xAI API?
Add API credits and generate a key in the Grok Console. Make sure the key permits the Responses API and the model you plan to use. Run hermes model, select xAI Grok, then xAI, and enter your XAI_API_KEY. At the base URL prompt, use https://api.x.ai/v1 for the global API. Select a model your team can access and start a chat with hermes.
Why does Hermes get a 403 after you sign in to Grok?
A permission error after successful OAuth sign-in can mean xAI has not granted the account access to model requests. If you run Hermes yourself, the documented alternative is to configure XAI_API_KEY and choose the xai provider with a model available to your API team.
Can you use Grok 4.7 if it is missing from the Hermes picker?
For API-key use, check that your team can access grok-4.7 in the Grok Console. Hermes Agent 0.23.5 has context metadata for the model, but its built-in fallback list omits it. In the API-key picker, choose Enter custom model name and type grok-4.7.
Does ReadyHermes support Grok subscription sign-in?
ReadyHermes offers xAI API-key entry in the Model key panel during the free trial and on paid plans. Choose a model your xAI API key can access. Subscription sign-in for SuperGrok or X Premium+ is unavailable and has not been tested on ReadyHermes.