openclaw - ✅(Solved) Fix [Bug]: music_generate Google provider produces double /v1beta in URL — 404 when baseUrl is configured [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#63240Fetched 2026-04-09 07:56:26
View on GitHub
Comments
0
Participants
1
Timeline
8
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×3referenced ×3labeled ×2

When models.providers.google.baseUrl is configured in openclaw.json, the music_generate tool fails with 404 for all Google Lyria models. The music generation provider passes the baseUrl through normalizeGoogleApiBaseUrl() (which ensures /v1beta suffix), then the Google GenAI SDK appends its own /v1beta, resulting in a double /v1beta path.

Error Message

  1. All attempts fail with {"error":{"message":"","code":404,"status":""}}.

Root Cause

When models.providers.google.baseUrl is configured in openclaw.json, the music_generate tool fails with 404 for all Google Lyria models. The music generation provider passes the baseUrl through normalizeGoogleApiBaseUrl() (which ensures /v1beta suffix), then the Google GenAI SDK appends its own /v1beta, resulting in a double /v1beta path.

Fix Action

Fix / Workaround

Workaround: patch the file manually with the above change.

PR fix notes

PR #63258: Google: fix double /v1beta in music and video generation base URL

Description (problem / solution / changelog)

Summary

  • Strip /v1beta suffix from resolveConfiguredGoogleMusicBaseUrl() and resolveConfiguredGoogleVideoBaseUrl() before passing to the GoogleGenAI SDK, which appends its own /v1beta apiVersion
  • Matches the existing pattern used by text generation in normalizeGoogleGenerativeAiBaseUrl()

Problem

When models.providers.google.baseUrl is configured (e.g., https://generativelanguage.googleapis.com/v1beta), music and video generation construct a doubled path /v1beta/v1beta, resulting in 404 errors for all Lyria and Veo models.

The text generation path already handles this correctly via .replace(/\/v1beta$/i, "") in normalizeGoogleGenerativeAiBaseUrl(). The music and video providers were missing this strip.

Changes

  • extensions/google/music-generation-provider.ts: Add .replace(/\/v1beta$/i, "") to resolveConfiguredGoogleMusicBaseUrl()
  • extensions/google/video-generation-provider.ts: Add .replace(/\/v1beta$/i, "") to resolveConfiguredGoogleVideoBaseUrl()

Test plan

  • Configure models.providers.google.baseUrl to https://generativelanguage.googleapis.com/v1beta
  • Run music_generate with google/lyria-3-clip-preview — should succeed instead of 404
  • Run video_generate with a Google Veo model — should succeed instead of 404
  • Verify text generation still works (unchanged code path)
  • Verify behavior when baseUrl is not configured (no change)

Fixes #63240.

Changed files

  • extensions/google/music-generation-provider.ts (modified, +2/-2)
  • extensions/google/video-generation-provider.ts (modified, +2/-2)

PR #63264: fix(google): strip /v1beta from music and video provider baseUrl before GoogleGenAI SDK call

Description (problem / solution / changelog)

Summary

Fixes #63240.

When models.providers.google.baseUrl is configured (e.g. the default https://generativelanguage.googleapis.com/v1beta), both the music and video generation providers were passing this URL through normalizeGoogleApiBaseUrl, which ensures /v1beta is present. The GoogleGenAI SDK then appends its own API version segment (/v1beta), producing a double /v1beta/v1beta path that returns 404.

Root cause: resolveConfiguredGoogleMusicBaseUrl and resolveConfiguredGoogleVideoBaseUrl used normalizeGoogleApiBaseUrl (which adds /v1beta) instead of resolveGoogleGenerativeAiApiOrigin (which normalizes and strips /v1beta).

The text generation path already handles this correctly via resolveGoogleGenerativeAiApiOrigin. This PR applies the same pattern to the music and video providers.

Changes

  • extensions/google/music-generation-provider.ts: switch to resolveGoogleGenerativeAiApiOrigin in resolveConfiguredGoogleMusicBaseUrl
  • extensions/google/video-generation-provider.ts: switch to resolveGoogleGenerativeAiApiOrigin in resolveConfiguredGoogleVideoBaseUrl
  • extensions/google/music-generation-provider.test.ts: add regression test asserting the SDK receives a baseUrl without /v1beta

Test plan

  • Run pnpm test extensions/google/music-generation-provider.test.ts — new test verifies the SDK receives https://generativelanguage.googleapis.com (no /v1beta) when configured baseUrl includes it
  • Manually configure models.providers.google.baseUrl: "https://generativelanguage.googleapis.com/v1beta" and run music_generate with a Lyria model — should succeed rather than 404
  • video_generate with a configured baseUrl should also work correctly now

Changed files

  • extensions/google/music-generation-provider.test.ts (modified, +50/-0)
  • extensions/google/music-generation-provider.ts (modified, +5/-2)
  • extensions/google/video-generation-provider.test.ts (modified, +52/-0)
  • extensions/google/video-generation-provider.ts (modified, +5/-2)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When models.providers.google.baseUrl is configured in openclaw.json, the music_generate tool fails with 404 for all Google Lyria models. The music generation provider passes the baseUrl through normalizeGoogleApiBaseUrl() (which ensures /v1beta suffix), then the Google GenAI SDK appends its own /v1beta, resulting in a double /v1beta path.

Steps to reproduce

  1. Configure models.providers.google.baseUrl to "https://generativelanguage.googleapis.com/v1beta" in openclaw.json (the default/documented value).
  2. Ensure a valid Google API key is configured with access to Lyria models.
  3. Use music_generate with model: google/lyria-3-pro-preview (or lyria-3-clip-preview).
  4. All attempts fail with {"error":{"message":"","code":404,"status":""}}.
  5. Calling the same API directly via curl to the correct v1beta endpoint works fine.

Expected behavior

music_generate should construct the correct URL (https://generativelanguage.googleapis.com/v1beta/models/lyria-3-pro-preview:generateContent) and successfully generate music, regardless of whether baseUrl includes /v1beta or not.

Actual behavior

resolveConfiguredGoogleMusicBaseUrl() in music-generation-provider passes the configured baseUrl through normalizeGoogleApiBaseUrl(), which always ensures the URL ends with /v1beta. This is then set as httpOptions.baseUrl for the GoogleGenAI SDK, which appends its own apiVersion (v1beta) to the baseUrl.

Resulting URL: https://generativelanguage.googleapis.com/v1beta/v1beta/models/lyria-3-pro-preview:generateContent → 404.

The text generation path handles this correctly via normalizeGoogleGenerativeAiBaseUrl(), which strips /v1beta before passing to the SDK: return normalizeGoogleApiBaseUrl(baseUrl).replace(//v1beta$/i, "");

But the music generation provider uses normalizeGoogleApiBaseUrl() directly without stripping.

Code path:

  1. resolveConfiguredGoogleMusicBaseUrl() (music-generation-provider-CXALIR_I.js:14) reads cfg.models.providers.google.baseUrl
  2. Passes it through normalizeGoogleApiBaseUrl() which returns URL with /v1beta
  3. This is spread into httpOptions.baseUrl (line 112)
  4. GoogleGenAI SDK concatenates baseUrl + apiVersion ("v1beta") → double /v1beta

The same issue likely affects video_generate if it follows the same pattern.

OpenClaw version

2026.4.8

Operating system

Ubuntu 24.04 (Oracle Cloud ARM64)

Install method

npm global

Model

google/lyria-3-pro-preview

Provider / routing chain

openclaw -> google

Additional provider/model setup details

Suggested fix — strip /v1beta in resolveConfiguredGoogleMusicBaseUrl:

function resolveConfiguredGoogleMusicBaseUrl(req) { const configured = normalizeOptionalString(req.cfg?.models?.providers?.google?.baseUrl); const normalized = configured ? normalizeGoogleApiBaseUrl(configured) : void 0; return normalized ? normalized.replace(//v1beta$/i, "") : normalized; }

Workaround: patch the file manually with the above change.

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

To fix the issue, modify the resolveConfiguredGoogleMusicBaseUrl function to strip the /v1beta suffix from the normalized base URL.

Guidance

  • Identify the resolveConfiguredGoogleMusicBaseUrl function in the music-generation-provider code and apply the suggested fix to strip the /v1beta suffix.
  • Verify that the modified function correctly constructs the URL without the duplicate /v1beta path.
  • Test the music_generate tool with the modified function to ensure it successfully generates music without returning a 404 error.
  • Consider applying the same fix to the video_generate tool if it follows the same pattern.

Example

function resolveConfiguredGoogleMusicBaseUrl(req) {
    const configured = normalizeOptionalString(req.cfg?.models?.providers?.google?.baseUrl);
    const normalized = configured ? normalizeGoogleApiBaseUrl(configured) : void 0;
    return normalized ? normalized.replace(/\/v1beta$/i, "") : normalized;
}

Notes

The suggested fix assumes that the normalizeGoogleApiBaseUrl function correctly handles the base URL normalization. If this function has any issues, additional modifications may be necessary.

Recommendation

Apply the workaround by patching the music-generation-provider file with the modified resolveConfiguredGoogleMusicBaseUrl function, as this is a targeted fix for the identified issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

music_generate should construct the correct URL (https://generativelanguage.googleapis.com/v1beta/models/lyria-3-pro-preview:generateContent) and successfully generate music, regardless of whether baseUrl includes /v1beta or not.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING