#Can i Connect sambanova free models instead of google api

1 messages · Page 1 of 1 (latest)

manic thunder
#

Can i Connect sambanova free models instead of google api?

hushed iceBOT
celest swiftBOT
#

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

barren spindleBOT
#

Yep, for normal chat models, yes.

I don’t see a built-in SambaNova provider in the docs, but OpenClaw supports custom OpenAI-compatible endpoints, so if SambaNova gives you an API key + endpoint, you can use it instead of Google.

Fast path:

openclaw onboard --non-interactive \
  --auth-choice custom-api-key \
  --custom-base-url "<your SambaNova API URL>" \
  --custom-model-id "<model-id>" \
  --custom-provider-id "sambanova" \
  --custom-compatibility openai

Or add it manually under models.providers.

manic thunder
#

"⚠️ Context limit exceeded. I've reset our conversation to start fresh - please try again.

To prevent this, increase your compaction buffer by setting agents.defaults.compaction.reserveTokensFloor to 20000 or higher in your config."
Im using github models gpt-4.1, ive added ````agents.defaults.compaction.reserveTokensFloor``` and still same issue

barren spindleBOT
#

That warning is generic, so if you already set agents.defaults.compaction.reserveTokensFloor, it does not necessarily mean that setting is the real problem.

A few quick checks:

  1. What does openclaw --version show?
  2. Did you restart the gateway after changing the config?
  3. Are you using the built-in github-copilot/gpt-4.1 path, or a custom GitHub Models/OpenAI-compatible provider?

Why this matters:

  • reserveTokensFloor only changes the buffer before compaction. It does not increase the model’s actual context window.
  • If the provider/model has a missing or wrong contextWindow, compaction can still fail.
  • Older builds had compaction edge cases, so version matters a lot here.

Also worth trying if you haven’t already:

#

If you paste:

  • openclaw --version
  • your agents.defaults.compaction block
  • and whether this is github-copilot or a custom GitHub Models provider

…I can narrow it down pretty fast.

manic thunder
#

look my config:

  "agents": {
    "defaults": {
       "compaction": { "reserveTokensFloor": 30000 },
      "workspace": "/root/.openclaw/workspace",
      "model": {
        "primary": "github/gpt-4.1"
      },
      "models": {
        "github/openai/gpt-5-mini": {},
        "github/openai/gpt-4.1": {}
      }
    }
  },```


``` {
            "id": "gpt-4.1",
            "name": "gpt-4.1 (Custom Provider)",
            "contextWindow": 128000,
            "maxTokens": 4096,
            "input": [
              "text"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "reasoning": false
          }```
barren spindleBOT
#

I think I see one config bug right away.

Your refs are inconsistent:

  • model.primary = github/gpt-4.1
  • but agents.defaults.models uses github/openai/gpt-4.1

OpenClaw model refs are provider/model, so those keys should match the actual provider id and model id exactly.

Try this shape instead:

{
  agents: {
    defaults: {
      workspace: "/root/.openclaw/workspace",
#
      model: {
        primary: "github/gpt-4.1"
      },
      compaction: {
        mode: "safeguard",
        reserveTokensFloor: 30000
      },
      models: {
        "github/gpt-4.1": {},
        "github/gpt-5-mini": {}
      }
    }
  }
}
#

A couple important notes:

  • reserveTokensFloor is only a buffer, it does not increase the real model limit.
  • If the upstream GitHub model limit is lower than what your custom provider says, 30000 can actually make compaction happen earlier.
  • After changing config, restart the gateway.

If it still breaks after fixing the model refs + restart, send:

  1. openclaw --version
  2. your models.providers.github block

Then we can check whether the custom provider metadata, especially contextWindow, matches what GitHub Models actually accepts.

Docs:
https://docs.openclaw.ai/gateway/configuration-reference#agentsdefaultscompaction
https://docs.openclaw.ai/gateway/configuration-reference#modelsproviders

manic thunder
#
  "agents": {
    "defaults": {
       "compaction": {
           "mode": "safeguard",
          "reserveTokensFloor": 30000
},
      "workspace": "/root/.openclaw/workspace",
      "model": {
        "primary": "github/gpt-4.1"
      },
      "models": {
        "github/gpt-5-mini": {},
        "github/gpt-4.1": {}
      }
    }
  },```

```"github": {
        "baseUrl": "https://models.inference.ai.azure.com",
        "api": "openai-completions",
        "apiKey": "...",
        "models": [
          {
            "id": "openai/gpt-5-mini",
            "name": "openai/gpt-5-mini (Custom Provider)",
            "contextWindow": 16000,
            "maxTokens": 4096,
            "input": [
              "text"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "reasoning": false
          },
           {
            "id": "gpt-4.1",
            "name": "gpt-4.1 (Custom Provider)",
            "contextWindow": 128000,
            "maxTokens": 4096,
            "input": [
              "text"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "reasoning": false
          }
        ]```
barren spindleBOT
#

I need to correct one thing from my last reply, I oversimplified the model refs.

With a custom provider, the model id is whatever the upstream expects. For GitHub Models, refs like openai/gpt-4.1 are normal, so github/openai/gpt-4.1 can be valid.

What I see now is inconsistent model IDs:

  • gpt-5-mini is stored as openai/gpt-5-mini
  • gpt-4.1 is stored as just gpt-4.1

I’d make them consistent and match GitHub Models exactly, like this:

{
  agents: {
    defaults: {
      workspace: "/root/.openclaw/workspace",
#
      compaction: {
        mode: "safeguard",
        reserveTokensFloor: 30000
      },
      model: {
        primary: "github/openai/gpt-4.1"
      },
      models: {
        "github/openai/gpt-4.1": {},
        "github/openai/gpt-5-mini": {}
      }
    }
  },
  models: {
    providers: {
#
      github: {
        baseUrl: "https://models.inference.ai.azure.com",
        api: "openai-completions",
        apiKey: "...",
        models: [
          {
            id: "openai/gpt-4.1",
            name: "openai/gpt-4.1 (Custom Provider)",
            contextWindow: 128000,
            maxTokens: 4096,
            input: ["text"],
            cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
            reasoning: false
          },
          {
#
            id: "openai/gpt-5-mini",
            name: "openai/gpt-5-mini (Custom Provider)",
            contextWindow: 16000,
            maxTokens: 4096,
            input: ["text"],
            cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
            reasoning: false
          }
        ]
      }
    }
  }
}

Then restart the gateway.

manic thunder
#

400 Unknown model: openai/gpt-4.1 openclaw is texting

barren spindleBOT
#

Yep, that confirms it. This endpoint wants bare model IDs, not openai/....

So for your GitHub provider, make them all consistent like this:

{
  agents: {
    defaults: {
      workspace: "/root/.openclaw/workspace",
      compaction: {
        mode: "safeguard",
        reserveTokensFloor: 30000
      },
      model: {
        primary: "github/gpt-4.1"
      },
#
      models: {
        "github/gpt-4.1": {},
        "github/gpt-5-mini": {}
      }
    }
  },
  models: {
    providers: {
      github: {
        baseUrl: "https://models.inference.ai.azure.com",
        api: "openai-completions",
        apiKey: "...",
        models: [
          {
            id: "gpt-4.1",
#
            name: "gpt-4.1 (Custom Provider)",
            contextWindow: 128000,
            maxTokens: 4096,
            input: ["text"],
            cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
            reasoning: false
          },
          {
            id: "gpt-5-mini",
            name: "gpt-5-mini (Custom Provider)",
            contextWindow: 16000,
            maxTokens: 4096,
            input: ["text"],
            cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
            reasoning: false
#
          }
        ]
      }
    }
  }
}

So the important fix is:

  • gpt-4.1, not openai/gpt-4.1
  • gpt-5-mini, not openai/gpt-5-mini

Then restart the gateway.

If you still get the context limit exceeded error after that, send openclaw --version, because then we’re probably looking at a compaction/version issue, not a model-name issue.

manic thunder
#

not "primary": "github/openai/gpt-4.1" but "primary": "github/gpt-4.1"?

barren spindleBOT
#

Yes, exactly, use:

"primary": "github/gpt-4.1"

Not:

"primary": "github/openai/gpt-4.1"

Because your endpoint just told us it accepts bare gpt-4.1 and rejects openai/gpt-4.1.

So keep it consistent everywhere:

  • primary: github/gpt-4.1
#
  • allowlist: github/gpt-4.1, github/gpt-5-mini
  • provider model ids: gpt-4.1, gpt-5-mini

Sorry for the back-and-forth, that 400 error was the missing clue.

manic thunder
#

so "id": "gpt-5-mini", "name": "gpt-5-mini (Custom Provider)",

barren spindleBOT
#

Yep 👍

{
  "id": "gpt-5-mini",
  "name": "gpt-5-mini (Custom Provider)"
}

And then match it everywhere else as:

  • github/gpt-5-mini in agents.defaults.models
  • github/gpt-4.1 as primary
  • gpt-5-mini / gpt-4.1 as the provider model ids

One small note, your gpt-5-mini entry is only 16000 context, so if you switch to that model you’ll hit compaction much sooner than gpt-4.1.

#

Glad we caught the naming mismatch. If this fixed it, please right-click the solution message → Apps → ✅ Mark Solution so Answer Overflow can index it.

manic thunder
#

Context limit exceeded. I've reset our conversation to start fresh - please try again.

To prevent this, increase your compaction buffer by setting agents.defaults.compaction.reserveTokensFloor to 20000 or higher in your config.

barren spindleBOT
#

Yeah, at this point that auto-reply is being misleading.

You already have reserveTokensFloor: 30000, so do not raise it further. The docs explicitly note that too-high compaction reserves can make compaction happen earlier.

Next thing I’d try is actually lowering the compaction budget for this custom provider, for example:

{
  agents: {
    defaults: {
      compaction: {
        mode: "safeguard",
        reserveTokensFloor: 0,
        reserveTokens: 12000,
        keepRecentTokens: 12000
      }
#
    }
  }
}

Then restart the gateway and test again.

Why:

  • reserveTokensFloor: 0 disables the enforced floor
  • lower reserveTokens / keepRecentTokens gives compaction more room to recover
  • with custom providers, the generic “set it to 20000+” message is not always correct

I also need your exact version now: