#LiteLLM-OpenAI integration errors

1 messages ยท Page 1 of 1 (latest)

polar sundialBOT
#

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

errant daggerBOT
#

The issue is that openai/bedrock-claude-4-5-opus tells Clawdbot to use the built-in OpenAI provider, which connects to OpenAI's actual API (not your LiteLLM server). The "unauthorized" error is Clawdbot trying to hit the real OpenAI with your LiteLLM credentials.

Fix: Configure LiteLLM as a custom provider

Add this to your ~/.clawdbot/clawdbot.json:

{
  agents: {
    defaults: {
      model: { primary: "litellm/bedrock-claude-4-5-opus" },
      models: {
        "litellm/bedrock-claude-4-5-opus": { alias: "Bedrock Opus" }
      }
    }
  },
#
  models: {
    mode: "merge",
    providers: {
      litellm: {
        baseUrl: "http://127.0.0.1:4000/v1",
        apiKey: "sk-1234",
        api: "openai-completions",
        models: [
          {
            id: "bedrock-claude-4-5-opus",
            name: "Bedrock Claude Opus 4.5",
            reasoning: false,
            input: ["text"],
            cost: { input: 0, output: 0 },
            contextWindow: 200000,
#
            maxTokens: 8192
          }
        ]
      }
    }
  }
}

Key changes:

  1. Model reference: litellm/bedrock-claude-4-5-opus (not openai/)
  2. baseUrl: Points to your LiteLLM server (http://127.0.0.1:4000/v1)
  3. apiKey: Matches your LiteLLM master_key

Then restart the gateway:

#
clawdbot gateway call config.apply

Your curl test confirms LiteLLM is working โ€” you just need to route Clawdbot to it correctly! ๐Ÿฆ

crimson shadow
#

My claudebot.json looks like this now:

"models": {
"mode": "merge",
"providers": {
"litellm": {
"baseUrl": "http://0.0.0.0:4000/",
"apiKey": "sk-1234",
"api": "openai-completions",
"models": [
{
"id": "bedrock-claude-4-5-opus",
"name": "bedrock-claude-4-5-opus",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 15,
"output": 75,
"cacheRead": 1.5,
"cacheWrite": 18.75
},
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "litellm/bedrock-claude-4-5-opus"
}
}
},

#

But I still get this error:

clawdbot tui has this error message:

๐Ÿฆž Clawdbot 2026.1.13 (unknown)

clawdbot tui - ws://127.0.0.1:18789 - agent main - session main
connecting | idle
agent main | session main | unknown | think off | verbose off | tokens ?
gateway disconnected: unauthorized | idle gateway connect failed: Error: unauthorized

#

clawdbot models status --check

๐Ÿฆž Clawdbot 2026.1.13 (unknown) โ€” I'm basically a Swiss Army knife, but with more opinions and fewer sharp edges.

Config : /Users/brent/.clawdbot/clawdbot.json
Agent dir : ~/.clawdbot/agents/main/agent
Default : litellm/bedrock-claude-4-5-opus
Fallbacks (0) : -
Image model : -
Image fallbacks (0): -
Aliases (0) : -
Configured models (0): all

Auth overview
Auth store : ~/.clawdbot/agents/main/agent/auth-profiles.json
Shell env : off
Providers w/ OAuth/tokens (0): -

  • litellm effective=models.json:sk-1234 | models.json=sk-1234 | source=models.json: ~/.clawdbot/agents/main/agent/models.json
errant daggerBOT
#

The error is not about the model โ€” it's the gateway rejecting the CLI connection. The TUI connects to the gateway via WebSocket, and something's wrong with that handshake.

Two things to check:

  1. Does your LiteLLM conflict with Clawdbot's gateway auth?

Your LiteLLM uses master_key: sk-1234 on port 4000. Clawdbot's gateway also runs on a port (default 18789 in the TUI output). Check if your gateway has its own masterKey configured:

clawdbot config get gateway

If the gateway has a different masterKey, make sure the TUI/CLI knows it, or unset it for local dev.

  1. Try restarting the gateway to pick up config:
#
clawdbot gateway restart

Then reconnect with the TUI.


Quick test: Is the gateway even running and accessible?

curl http://127.0.0.1:18789/health 2>/dev/null || echo "Gateway not responding on 18789"

What port is your Clawdbot gateway running on? The TUI shows ws://127.0.0.1:18789 โ€” is that correct? ๐Ÿฆ

crimson shadow
#

curl http://127.0.0.1:18789/health 2>/dev/null || echo "Gateway not responding on 18789"
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Clawdbot Control</title>
<meta name="color-scheme" content="dark light" />
<link rel="icon" href="./favicon.ico" sizes="any" />
<script type="module" crossorigin src="./assets/index-CN7mhdU7.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-bmCB4WXs.css">
<script>window.CLAWDBOT_CONTROL_UI_BASE_PATH="";</script></head>
<body>
<clawdbot-app></clawdbot-app>
</body>
</html>

errant daggerBOT
crimson shadow
#

try again

errant daggerBOT
# crimson shadow try again

The gateway is alive (HTML response = good). The "unauthorized" is specifically the WebSocket connection from TUI โ†’ gateway, not a model auth issue.

Check your gateway config for auth settings:

clawdbot config get gateway

Look for:

  • masterKey
  • allowedUsers or allowFrom
  • Any auth-related settings

If there's a masterKey set, you need to pass it to the TUI or unset it for local dev:

#
# Option 1: Set it in the CLI
export CLAWDBOT_MASTER_KEY=your-key-here
clawdbot tui

# Option 2: Remove masterKey from config (for local dev)
clawdbot config unset gateway.masterKey
clawdbot gateway restart

What does clawdbot config get gateway show? ๐Ÿฆ

crimson shadow
#

You are hallucinating. clawdbot config get gateway
error: too many arguments for 'configure'. Expected 0 arguments but got 2.

#

I don't think clawdbot has a master key.

errant daggerBOT
crimson shadow
#

hey

errant daggerBOT
#

You're right, I apologize for the bad commands! Let me check the actual config file directly:

What does your ~/.clawdbot/clawdbot.json show for gateway settings?

cat ~/.clawdbot/clawdbot.json | grep -A 20 '"gateway"'

The "unauthorized" WebSocket error suggests the gateway is rejecting connections from the CLI. This could be:

  • A masterKey in the gateway config that the CLI doesn't know about
  • An allowFrom / allowedUsers restriction
  • Or the gateway needs a specific auth token for CLI connections

What gateway settings do you have in your config? ๐Ÿฆ

#

No worries! Let me look at the actual gateway connection docs to debug this properly.

Can you share the gateway section from your ~/.clawdbot/clawdbot.json?

cat ~/.clawdbot/clawdbot.json | grep -A 30 '"gateway"'

Or just paste the gateway portion. The "unauthorized" WebSocket error is usually a gateway auth/token issue, not a model issue. I want to see if there's a gatewayToken or similar setting that needs to match. ๐Ÿฆ

crimson shadow
#

cat ~/.clawdbot/clawdbot.json | grep -A 20 '"gateway"'
"gateway": {
"port": 18789,
"mode": "local",
"bind": "loopback",
"tailscale": {
"mode": "off",
"resetOnExit": false
}
},
"skills": {
"install": {
"nodeManager": "npm"
}
}
}

errant daggerBOT
crimson shadow
#

OK, there used to be an "auth" gateway parameter, but when I use it, it tries to use my .claude credentials instead of my litellm provider.