#How to setup XAI as a custom model provider?

1 messages Β· Page 1 of 1 (latest)

fervent crescent
#

Hey, a bit new to clawdbot. How can I setup XAI as a new model provider?

jolly galleonBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> βœ… Mark Solution

vagrant valeBOT
#
          "medium": "grok-beta",
          "large": "grok-beta"
        }
      }
    }
  }
}

3. Set it as your default model:

{
  "models": {
    "default": "custom-xai"
  }
#
}

Note: The exact model names might vary β€” check the xAI console for available models. The API is OpenAI-compatible, so most OpenAI-style configs work.

If you hit issues, run clawdbot --version and share it β€” version mismatches can cause weird errors! 🦐

Want me to dig into the docs for more details?

dense swift
vagrant valeBOT
# dense swift not supported, model is not good

Peter's right! 🦐 xAI/Grok isn't the best fit for Clawdbot's agentic use cases right now. It works for basic stuff but doesn't quite have the reasoning capabilities needed for reliable agent behavior.

For Clawdbot, models like Claude (Anthropic), GPT-4o, or MiniMax tend to perform much better for the kind of autonomous task execution Clawdbot does.

That said, if someone really wants to try xAI anyway, the config I shared above will work β€” it's just a matter of whether the model performs well in practice. πŸ‘

fervent crescent
#

ok! thanks for letting me know πŸ™‚

lavish basin
#

Either I am stupid or it doesn't work anymore. The first possibility is probably the right one tho.
Can you help me out ?
I have tried to put your config on to my .json but it doesn't work.
I'm probably missing something

vagrant valeBOT
#
{
  env: { XAI_API_KEY: "xai-..." },
  agents: { defaults: { model: { primary: "xai/grok-4" } } }
}

3. Available models

According to the docs, you can use models like:

  • xai/grok-4
  • xai/grok-3 (if available)

Use clawdbot models list to see all available xAI models.


For Heimdall's issue: If you tried adding custom provider config (the complex models.providers block), that's not needed for xAI since it's built-in. Just use the simple env var + xai/model-name format above. The docs mention xAI right here: https://docs.clawd.bot/concepts/model-providers#other-built-in-providers

#

Let me know if you're still hitting errors after trying the built-in setup! 🦐

tropic island
vagrant valeBOT
#
clawdbot gateway restart

For the onboarding bug: This might be a recent regression. Could you share:

  1. Your Clawdbot version: clawdbot --version
  2. Your OS?

This would help track down whether it's a known issue. The manual config approach above should bypass the bug entirely. 🦐

tropic island
vagrant valeBOT
# tropic island 2026.1.23-1 mac-os specifically mac-os Tahoe 26.3

Thanks for the details! Version 2026.1.23-1 on macOS Tahoe 26.3.

This looks like a regression in the onboarding wizard. A few things to try:

Quick Fixes

  1. Try the full auth flag:

    clawdbot onboard --auth-choice xai --token "$XAI_API_KEY"
    
  2. Or use the models auth command:

    clawdbot models auth xai --token "xai-your-key"
    
  3. If those fail, manual edit always works:

#
   clawdbot config edit
   # Add env.XAI_API_KEY manually, then:
   clawdbot gateway restart

Reporting the Bug

Can you check if there's already a GitHub issue for this?

If not, consider filing one with:

  • Version: 2026.1.23-1
  • OS: macOS Tahoe 26.3
  • Steps to reproduce: clawdbot onboard --auth-choice xai-api-key skips API key prompt

This helps the team track and fix it. Thanks for reporting! 🦐

tacit umbra
#

I'm also trying to use xAI, and running into issues. If I try running clawdbot models auth login --provider xai, the error message says "No provider plugins found. Install one via clawdbot plugins install".

If I try clawdbot models auth xai --token "<token>", it says "unknown command xai"

I did the clawdbot onboard command mentioned before, and that command "works", but it never gives any indication that anything happened with regard to model provider auth. If I do clawdbot models list, there's an entry for xai/grok-4-1-fast and it seems to be authenticated, but when I try to chat with the telegram bot, the gateway reports this error: "No API key found for provider xai"

#

I am thoroughly confused

#

I'm running 2026.1.24-3 on Windows 11

vagrant valeBOT
# tacit umbra I am thoroughly confused

Great news β€” xAI is already a built-in provider in Clawdbot! πŸŽ‰

Setup

  1. Get your xAI API key from https://console.x.ai/

  2. Set the environment variable (in your shell or gateway env):

    export XAI_API_KEY="xai-..."
    
  3. Configure your model in clawdbot.json:

    {
      "agents": {
        "defaults": {
    
#
         "model": {
           "primary": "xai/grok-3-beta"
         }
       }
     }
   }

Available xAI Models

Check the full list with:

clawdbot models list | grep xai

Or see xAI's docs for current model options β€” they typically offer grok-3-beta, grok-2, etc.

#

Quick Auth Setup

If you're running clawdbot onboard, you can also use:

clawdbot onboard --auth-choice xai-api-key

That's it! xAI uses an OpenAI-compatible API, so it works out of the box without any custom provider configuration.

https://docs.clawd.bot/concepts/model-providers#xai

tacit umbra
#

I did this and it didn't work

#

ok, adding the "env" block to clawdbot.json worked; merely having the env var set did not work.

vagrant valeBOT
# tacit umbra ok, adding the `"env"` block to clawdbot.json worked; merely having the env var ...

Good to know! The env block in clawdbot.json is more reliable because it explicitly injects the variables into the Gateway's environment, whereas shell exports might not propagate correctly depending on how you're running Clawdbot.

Your working config should look something like:

{
  "env": {
    "XAI_API_KEY": "xai-..."
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "xai/grok-3-beta"
      }
    }
  }
#
}

For extra safety, you can also use an environment file or set it in your shell profile (.bashrc, .zshrc, etc.) and source it before starting Clawdbot. But the config block is the simplest solution! 🦐

vernal needle
#

This works, but ignore krill, you likely want to use xai/grok-4 not the grok 3 beta

vagrant valeBOT
#
     }
   }
  1. Or use the CLI:
    clawdbot models set xai/grok-4
    

Available xAI Models

  • xai/grok-4 (mentioned in the testing docs)
  • xai/grok-3 and other Grok variants should also work

xAI uses the OpenAI-compatible API format, so no custom provider config is neededβ€”just set the XAI_API_KEY and you're good to go! πŸš€