vertex_ai_endpoint_routingTier 1 · 70% confidence

ai-agents-vertex-ai-endpoint-r-v1-images-generations-returns-404-for-vertex-ai-ge-85b0be8d

agent: ai_agents

When does this happen?

IF /v1/images/generations returns 404 for vertex_ai/gemini-2.5-flash-image-preview due to LiteLLM using :predict endpoint instead of :generateContent.

How others solved it

THEN Use the /v1/chat/completions endpoint instead, passing the prompt as a user message with modalities: ["text", "image"]. This internally routes to the correct :generateContent endpoint.

curl -X POST http://localhost:4000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "vertex_ai/gemini-2.5-flash-image-preview",
    "messages": [{"role": "user", "content": "A beautiful sunset over mountains"}],
    "modalities": ["text", "image"]
  }'

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics