diff --git a/docs/providers/cerebras.md b/docs/providers/cerebras.md index 1475a39ce986..195a7fbd9c73 100644 --- a/docs/providers/cerebras.md +++ b/docs/providers/cerebras.md @@ -17,7 +17,7 @@ read_when: | Direct CLI flag | `--cerebras-api-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: { diff --git a/extensions/cerebras/index.ts b/extensions/cerebras/index.ts index dbd474cb8f07..2ec508887e6b 100644 --- a/extensions/cerebras/index.ts +++ b/extensions/cerebras/index.ts @@ -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.", diff --git a/extensions/cerebras/onboard.test.ts b/extensions/cerebras/onboard.test.ts index 43f7536af04b..3b7d6bfb13ef 100644 --- a/extensions/cerebras/onboard.test.ts +++ b/extensions/cerebras/onboard.test.ts @@ -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" }, }); }); }); diff --git a/extensions/cerebras/onboard.ts b/extensions/cerebras/onboard.ts index 01a17cdf7e7b..b5ac64fb9e6c 100644 --- a/extensions/cerebras/onboard.ts +++ b/extensions/cerebras/onboard.ts @@ -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" }], }), }); diff --git a/extensions/cerebras/openclaw.plugin.json b/extensions/cerebras/openclaw.plugin.json index b5e1fcc8fdc6..530f53b8240d 100644 --- a/extensions/cerebras/openclaw.plugin.json +++ b/extensions/cerebras/openclaw.plugin.json @@ -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",