#Can i Connect sambanova free models instead of google api
1 messages · Page 1 of 1 (latest)
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.
Docs:
https://docs.openclaw.ai/cli/onboard
https://docs.openclaw.ai/gateway/configuration-reference#modelsproviders
One catch, this only works if SambaNova’s “free” offering includes actual API access. If it’s just a web playground, then no.
If you want, paste openclaw --version and the SambaNova model/endpoint you’re targeting, and I’ll turn it into an exact config snippet.
"⚠️ 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
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:
- What does
openclaw --versionshow? - Did you restart the gateway after changing the config?
- Are you using the built-in
github-copilot/gpt-4.1path, or a custom GitHub Models/OpenAI-compatible provider?
Why this matters:
reserveTokensFlooronly 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:
{
agents: {
defaults: {
compaction: {
mode: "safeguard",
reserveTokensFloor: 20000
}
}
}
}
Docs:
https://docs.openclaw.ai/concepts/compaction
https://docs.openclaw.ai/gateway/configuration-reference#agentsdefaultscompaction
If you paste:
openclaw --version- your
agents.defaults.compactionblock - and whether this is github-copilot or a custom GitHub Models provider
…I can narrow it down pretty fast.
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
}```
I think I see one config bug right away.
Your refs are inconsistent:
model.primary=github/gpt-4.1- but
agents.defaults.modelsusesgithub/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:
reserveTokensFlooris 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,
30000can actually make compaction happen earlier. - After changing config, restart the gateway.
If it still breaks after fixing the model refs + restart, send:
openclaw --version- your
models.providers.githubblock
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
"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
}
]```
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-miniis stored asopenai/gpt-5-minigpt-4.1is stored as justgpt-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.
I’d fix that first before changing anything else. If it still throws the same compaction error after that, send:
openclaw --version- the exact error from gateway logs around the overflow
Docs:
https://docs.openclaw.ai/gateway/configuration-reference#modelsproviders
https://docs.openclaw.ai/gateway/configuration-reference#agentsdefaultscompaction
Glad you pasted the provider block, that made the mismatch a lot clearer.
400 Unknown model: openai/gpt-4.1 openclaw is texting
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, notopenai/gpt-4.1gpt-5-mini, notopenai/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.
not "primary": "github/openai/gpt-4.1" but "primary": "github/gpt-4.1"?
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.
so "id": "gpt-5-mini", "name": "gpt-5-mini (Custom Provider)",
Yep 👍
{
"id": "gpt-5-mini",
"name": "gpt-5-mini (Custom Provider)"
}
And then match it everywhere else as:
github/gpt-5-miniinagents.defaults.modelsgithub/gpt-4.1as primarygpt-5-mini/gpt-4.1as 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.
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.
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: 0disables the enforced floor- lower
reserveTokens/keepRecentTokensgives 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: