Skip to content

Fix OpenClaw Google model API when routing through cllama #127

@mostlydev

Description

@mostlydev

Problem

Pods can now declare direct Gemini models like google/gemini-3-flash-preview behind cllama, but the OpenClaw driver still compiles models.providers.google.api as google-generative-ai whenever the provider prefix is google.

That is correct for direct-to-Google runtime wiring, but it is wrong when cllama is enabled. In the cllama case the provider base URL is rewritten to http://cllama:8080/v1, and the proxy only exposes Google through the OpenAI-compatible /v1/chat/completions surface.

Reproduction

  1. Configure an OpenClaw service with:
    • x-claw.cllama: passthrough
    • x-claw.models.primary: google/gemini-3-flash-preview
  2. Run claw up -d.
  3. Observe generated OpenClaw config under models.providers.google:
    • baseUrl: http://cllama:8080/v1
    • api: google-generative-ai
  4. Send a message to the agent.
  5. The request fails with 404 page not found from the provider path.

Direct probes against Google's OpenAI-compatible endpoint succeed with the same key and model. The failure is specific to the runner->cllama request shape.

Root cause

internal/driver/openclaw/config.go calls defaultModelAPIForProvider(provider) even inside the cllama rewrite branch. For google, that returns google-generative-ai, which causes OpenClaw to speak Google-native request semantics to a cllama endpoint that expects OpenAI-compatible semantics.

Expected behavior

When OpenClaw rewrites a provider to cllama, the compiled api should match the proxy surface, not the upstream vendor-native surface. For google/* models behind cllama, that means openai-completions.

Scope

  • Fix OpenClaw config generation for google/* + cllama.
  • Add regression coverage in internal/driver/openclaw/config_test.go.
  • Check whether any other driver has the same provider-API rewrite bug before closing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions