Skip to content

fix(openclaw): use proxy API for google models behind cllama#129

Merged
mostlydev merged 2 commits intomasterfrom
issue-127-openclaw-google-cllama-api
Apr 9, 2026
Merged

fix(openclaw): use proxy API for google models behind cllama#129
mostlydev merged 2 commits intomasterfrom
issue-127-openclaw-google-cllama-api

Conversation

@mostlydev
Copy link
Copy Markdown
Owner

Summary

  • route google/* models behind cllama through the proxy API surface instead of Google-native OpenClaw API mode
  • keep direct non-cllama Google behavior unchanged
  • add regression coverage for both cases

Why

When OpenClaw rewrites google/* providers to http://cllama:8080/v1, it must speak the proxy's OpenAI-compatible surface. google-generative-ai causes OpenClaw to hit the wrong path and return 404 page not found.

What changed

  • use a dedicated cllamaModelAPIForProvider() helper inside the cllama rewrite branch
  • keep Anthropics on anthropic-messages
  • map Google and other non-Anthropic providers behind cllama to openai-completions
  • add regression tests for:
    • google/* + cllama => openai-completions
    • direct google/* => no cllama provider rewrite, native Google API behavior preserved

Validation

  • go test -run 'TestGenerateConfig(CllamaGoogleUsesOpenAICompletions|DirectGoogleKeepsNativeAPI|CllamaRewritesProviderBaseURL|CllamaRewritesAllModelProviders)' -count=1 ./internal/driver/openclaw
  • go test -count=1 ./internal/driver/openclaw
  • go test -count=1 ./internal/driver/...

Scope note

I audited the other cllama-aware drivers while fixing this. This specific provider-API mismatch is confined to OpenClaw; the others do not compile the same api field in their cllama path.

Closes #127

@mostlydev
Copy link
Copy Markdown
Owner Author

Addressed the two must-fix review points:

  • added an explicit anthropic["api"] == "anthropic-messages" assertion in the existing cllama Anthropic test
  • removed the tautological direct-Google helper assertion so the test stays purely behavioral

Re-verified with:

  • go test -run 'TestGenerateConfig(CllamaGoogleUsesOpenAICompletions|DirectGoogleKeepsNativeAPI|CllamaRewritesProviderBaseURL|CllamaRewritesAllModelProviders)' -count=1 ./internal/driver/openclaw
  • go test -count=1 ./internal/driver/openclaw

@mostlydev mostlydev merged commit 4fc2985 into master Apr 9, 2026
@mostlydev mostlydev deleted the issue-127-openclaw-google-cllama-api branch April 9, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix OpenClaw Google model API when routing through cllama

1 participant