fix(cerebras): prefer current Gemma 4 onboarding default (#114015)

* fix(cerebras): default onboarding to Gemma 4

* fix(cerebras): preserve existing primary on setup
This commit is contained in:
Peter Steinberger
2026-07-25 21:44:59 -07:00
committed by GitHub
parent 99d8d90572
commit 5c7f7d198e
5 changed files with 45 additions and 8 deletions

View File

@@ -17,7 +17,7 @@ read_when:
| Direct CLI flag | `--cerebras-api-key <key>` |
| API | OpenAI-compatible (`openai-completions`) |
| Base URL | `https://api.cerebras.ai/v1` |
| Default model | `cerebras/gpt-oss-120b` |
| Default model | `cerebras/gemma-4-31b` |
## Install plugin
@@ -78,8 +78,10 @@ All three models have a 131,072-token context window and a 40,960-token max outp
| Model ref | Name | Reasoning | Notes |
| ----------------------- | ------------ | --------- | ----------------------------------------- |
| `cerebras/zai-glm-4.7` | Z.ai GLM 4.7 | yes | Scheduled for deprecation August 17, 2026 |
| `cerebras/gpt-oss-120b` | GPT OSS 120B | yes | Default production reasoning model |
| `cerebras/gemma-4-31b` | Gemma 4 31B | yes | Preview; text-and-image input |
| `cerebras/gpt-oss-120b` | GPT OSS 120B | yes | Production reasoning model |
| `cerebras/gemma-4-31b` | Gemma 4 31B | yes | Default; preview; text-and-image input |
Fresh onboarding follows Cerebras's current [Gemma 4 recommendation](https://www.cerebras.ai/blog/gemma-4-on-cerebras-the-fastest-inference-is-now-multimodal). Cerebras describes Gemma 4 31B as its reference medium-size model for equal-or-higher intelligence than GPT OSS, with multimodal agentic support. It is a public-preview model and may change or be discontinued on shorter notice than the production GPT OSS endpoint; existing OpenClaw configurations keep their selected model.
## Manual config
@@ -90,7 +92,7 @@ Most setups only need the API key. Use explicit `models.providers.cerebras` conf
env: { CEREBRAS_API_KEY: "csk-..." },
agents: {
defaults: {
model: { primary: "cerebras/gpt-oss-120b" },
model: { primary: "cerebras/gemma-4-31b" },
},
},
models: {

View File

@@ -24,6 +24,7 @@ export default defineSingleProviderPluginEntry({
envVar: "CEREBRAS_API_KEY",
promptMessage: "Enter Cerebras API key",
defaultModel: CEREBRAS_DEFAULT_MODEL_REF,
preserveExistingPrimary: true,
applyConfig: (cfg) => applyCerebrasConfig(cfg),
noteMessage: [
"Cerebras provides high-speed OpenAI-compatible inference for GPT OSS and GLM models.",

View File

@@ -1,5 +1,7 @@
import { registerSingleProviderPlugin } from "openclaw/plugin-sdk/plugin-test-runtime";
import { resolveAgentModelPrimaryValue } from "openclaw/plugin-sdk/provider-onboard";
import { describe, expect, it } from "vitest";
import { describe, expect, it, vi } from "vitest";
import plugin from "./index.js";
import { applyCerebrasConfig, CEREBRAS_DEFAULT_MODEL_REF } from "./onboard.js";
import manifest from "./openclaw.plugin.json" with { type: "json" };
@@ -14,7 +16,39 @@ describe("Cerebras onboarding", () => {
CEREBRAS_DEFAULT_MODEL_REF,
);
expect(config.agents?.defaults?.models).toEqual({
[CEREBRAS_DEFAULT_MODEL_REF]: { alias: "Cerebras GPT OSS 120B" },
[CEREBRAS_DEFAULT_MODEL_REF]: { alias: "Cerebras Gemma 4 31B" },
});
});
it("preserves an existing primary during non-interactive auth setup", async () => {
const provider = await registerSingleProviderPlugin(plugin);
const method = provider.auth?.[0];
if (!method?.runNonInteractive) {
throw new Error("expected Cerebras non-interactive auth method");
}
const result = await method.runNonInteractive({
authChoice: "cerebras-api-key",
config: {
agents: {
defaults: {
model: { primary: "anthropic/claude-sonnet-4-6" },
models: { "anthropic/claude-sonnet-4-6": { alias: "Existing" } },
},
},
},
opts: {},
runtime: { error: vi.fn(), exit: vi.fn(), log: vi.fn() },
resolveApiKey: vi.fn(async () => ({ key: "fixture-value", source: "profile" })),
toApiKeyCredential: vi.fn(() => null),
} as never);
expect(resolveAgentModelPrimaryValue(result?.agents?.defaults?.model)).toBe(
"anthropic/claude-sonnet-4-6",
);
expect(result?.agents?.defaults?.models).toEqual({
"anthropic/claude-sonnet-4-6": { alias: "Existing" },
[CEREBRAS_DEFAULT_MODEL_REF]: { alias: "Cerebras Gemma 4 31B" },
});
});
});

View File

@@ -18,7 +18,7 @@ const cerebrasPresetAppliers = createModelCatalogPresetAppliers({
api: "openai-completions",
baseUrl: CEREBRAS_BASE_URL,
catalogModels: buildCerebrasCatalogModels(),
aliases: [{ modelRef: CEREBRAS_DEFAULT_MODEL_REF, alias: "Cerebras GPT OSS 120B" }],
aliases: [{ modelRef: CEREBRAS_DEFAULT_MODEL_REF, alias: "Cerebras Gemma 4 31B" }],
}),
});

View File

@@ -23,7 +23,7 @@
"cerebras": {
"baseUrl": "https://api.cerebras.ai/v1",
"api": "openai-completions",
"defaultModel": "gpt-oss-120b",
"defaultModel": "gemma-4-31b",
"models": [
{
"id": "zai-glm-4.7",