The current alma image command-line tool is tightly coupled with the Gemini API. Even when specifying OpenRouter models, the POST request host remains Google's host, and image extraction logic only supports Google (extracting URL links from responses).
OpenRouter's Google text-to-image model response includes a ` data:image/png;base64 ` string. Placing this directly in the output causes context overflow. After some troubleshooting, Alma has been fixed—it can now parse the string and use `send_file` to send it to the session for processing.
Base64 image extraction:
// Identify and process Base64 image data to prevent console output
if (responseBody.includes("data:image")) {
const base64Match = responseBody.match(/data:image\/([a-zA-Z]+);base64,([^"\s\)]+)/);
if (base64Match) {
const [_, ext, data] = base64Match;
const tempPath = path.join(os.tmpdir(), alma-img-${Date.now()}.${ext} );
fs.writeFileSync(tempPath, data, 'base64');
// Return only the path, do not print the raw JSON
return tempPath;
}
}
Please authenticate to join the conversation.
In Review
Feature Request
About 2 months ago

name my
Get notified by email when there are changes.
In Review
Feature Request
About 2 months ago

name my
Get notified by email when there are changes.