Yesterday was a milestone for our OpenClaw stack: we wired Vertex AI directly into openclaw.json and made Gemini models first class citizens across multiple regions. The goal was simple but ambitious: get reliable, OpenAI compatible routing for Gemini 2.5 while keeping fallbacks deterministic and performance consistent.

Office celebration reaction GIF
GIF via Tenor

Why This Integration Mattered

We wanted a setup that could survive network hiccups and regional outages without manual intervention. By routing through Google’s OpenAI compatible endpoints in Vertex AI, we get a consistent request and response shape while still benefiting from Gemini’s strength in speed and multimodality.

  • Reliability: Multi region endpoints reduce single region failure risk.
  • Consistency: OpenAI compatible APIs make model swapping easy.
  • Control: Explicit fallback chains keep workloads stable.

What We Implemented

We added several Vertex AI providers (global and regional) and registered Gemini 2.5 Flash/Pro. We also updated our model priority chain so Gemini 2.5 Flash stays the primary choice, with carefully ordered fallbacks.

Key Configuration (Sanitized Excerpt)

{
  "models": {
    "providers": {
      "vertex-global": {
        "baseUrl": "https://aiplatform.googleapis.com/v1beta1/projects//locations/global/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (Global)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-global-pro": {
        "baseUrl": "https://aiplatform.googleapis.com/v1beta1/projects//locations/global/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-pro",
            "name": "Gemini 2.5 Pro (Global)",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-us1": {
        "baseUrl": "https://us-central1-aiplatform.googleapis.com/v1beta1/projects//locations/us-central1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (US Iowa)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-us2": {
        "baseUrl": "https://us-east4-aiplatform.googleapis.com/v1beta1/projects//locations/us-east4/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (US Virginia)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-eu1": {
        "baseUrl": "https://europe-west1-aiplatform.googleapis.com/v1beta1/projects//locations/europe-west1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (EU Belgium)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-eu2": {
        "baseUrl": "https://europe-west4-aiplatform.googleapis.com/v1beta1/projects//locations/europe-west4/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (EU Netherlands)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-eu3": {
        "baseUrl": "https://europe-west2-aiplatform.googleapis.com/v1beta1/projects//locations/europe-west2/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (EU London)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-asia1": {
        "baseUrl": "https://asia-southeast1-aiplatform.googleapis.com/v1beta1/projects//locations/asia-southeast1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (Asia Singapore)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-asia2": {
        "baseUrl": "https://asia-northeast1-aiplatform.googleapis.com/v1beta1/projects//locations/asia-northeast1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (Asia Tokyo)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-india": {
        "baseUrl": "https://asia-south1-aiplatform.googleapis.com/v1beta1/projects//locations/asia-south1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (India Mumbai)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3-global": {
        "baseUrl": "https://aiplatform.googleapis.com/v1beta1/projects//locations/global/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (Global)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3-us1": {
        "baseUrl": "https://us-central1-aiplatform.googleapis.com/v1beta1/projects//locations/us-central1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (US Iowa)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3-us2": {
        "baseUrl": "https://us-east4-aiplatform.googleapis.com/v1beta1/projects//locations/us-east4/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (US Virginia)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3-eu1": {
        "baseUrl": "https://europe-west1-aiplatform.googleapis.com/v1beta1/projects//locations/europe-west1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (EU Belgium)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3-eu2": {
        "baseUrl": "https://europe-west4-aiplatform.googleapis.com/v1beta1/projects//locations/europe-west4/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (EU Netherlands)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3-eu3": {
        "baseUrl": "https://europe-west2-aiplatform.googleapis.com/v1beta1/projects//locations/europe-west2/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (EU London)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3-asia1": {
        "baseUrl": "https://asia-southeast1-aiplatform.googleapis.com/v1beta1/projects//locations/asia-southeast1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (Asia Singapore)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3-asia2": {
        "baseUrl": "https://asia-northeast1-aiplatform.googleapis.com/v1beta1/projects//locations/asia-northeast1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (Asia Tokyo)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3-india": {
        "baseUrl": "https://asia-south1-aiplatform.googleapis.com/v1beta1/projects//locations/asia-south1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash (India Mumbai)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3pro-global": {
        "baseUrl": "https://aiplatform.googleapis.com/v1beta1/projects//locations/global/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-pro",
            "name": "Gemini 2.5 Pro (Global)",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3pro-us1": {
        "baseUrl": "https://us-central1-aiplatform.googleapis.com/v1beta1/projects//locations/us-central1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-pro",
            "name": "Gemini 2.5 Pro (US Iowa)",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3pro-us2": {
        "baseUrl": "https://us-east4-aiplatform.googleapis.com/v1beta1/projects//locations/us-east4/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-pro",
            "name": "Gemini 2.5 Pro (US Virginia)",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3pro-eu1": {
        "baseUrl": "https://europe-west1-aiplatform.googleapis.com/v1beta1/projects//locations/europe-west1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-pro",
            "name": "Gemini 2.5 Pro (EU Belgium)",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3pro-eu2": {
        "baseUrl": "https://europe-west4-aiplatform.googleapis.com/v1beta1/projects//locations/europe-west4/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-pro",
            "name": "Gemini 2.5 Pro (EU Netherlands)",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3pro-eu3": {
        "baseUrl": "https://europe-west2-aiplatform.googleapis.com/v1beta1/projects//locations/europe-west2/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-pro",
            "name": "Gemini 2.5 Pro (EU London)",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3pro-asia1": {
        "baseUrl": "https://asia-southeast1-aiplatform.googleapis.com/v1beta1/projects//locations/asia-southeast1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-pro",
            "name": "Gemini 2.5 Pro (Asia Singapore)",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3pro-asia2": {
        "baseUrl": "https://asia-northeast1-aiplatform.googleapis.com/v1beta1/projects//locations/asia-northeast1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-pro",
            "name": "Gemini 2.5 Pro (Asia Tokyo)",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      },
      "vertex-g3pro-india": {
        "baseUrl": "https://asia-south1-aiplatform.googleapis.com/v1beta1/projects//locations/asia-south1/endpoints/openapi",
        "apiKey": "",
        "api": "openai-completions",
        "models": [
          {
            "id": "google/gemini-2.5-pro",
            "name": "Gemini 2.5 Pro (India Mumbai)",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 65536
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "vertex-g3-global/google/gemini-2.5-flash",
        "fallbacks": [
          "vertex-g3-global/google/gemini-2.5-flash",
          "vertex-g3-us1/google/gemini-2.5-flash",
          "vertex-g3-us2/google/gemini-2.5-flash",
          "vertex-g3-eu1/google/gemini-2.5-flash",
          "vertex-g3-eu2/google/gemini-2.5-flash",
          "vertex-g3-eu3/google/gemini-2.5-flash",
          "vertex-g3-asia1/google/gemini-2.5-flash",
          "vertex-g3-asia2/google/gemini-2.5-flash",
          "vertex-g3-india/google/gemini-2.5-flash",
          "vertex-g3pro-global/google/gemini-2.5-pro",
          "vertex-g3pro-us1/google/gemini-2.5-pro",
          "vertex-g3pro-us2/google/gemini-2.5-pro",
          "vertex-g3pro-eu1/google/gemini-2.5-pro",
          "vertex-g3pro-eu2/google/gemini-2.5-pro",
          "vertex-g3pro-eu3/google/gemini-2.5-pro",
          "vertex-g3pro-asia1/google/gemini-2.5-pro",
          "vertex-g3pro-asia2/google/gemini-2.5-pro",
          "vertex-g3pro-india/google/gemini-2.5-pro"
        ]
      }
    }
  }
}
Movie night excitement GIF
GIF via Tenor

What We Learned

  • Model ordering matters: It defines both reliability and cost behavior.
  • OpenAI compatible endpoints are a big win: We can swap providers without rewriting our clients.
  • Fallbacks must be explicit: This keeps failures from degrading overall quality.

Next Steps

We plan to add an automated health check across regions, and keep a close eye on log routing so error heavy traces do not degrade model context.

In short: we now have a robust, multi region Vertex AI layer inside OpenClaw, and it is already paying off.


Discover more from TheFlipbit

Subscribe to get the latest posts to your email.

Leave a Reply

Discover more from TheFlipbit

Subscribe now to keep reading and get access to the full archive.

Continue reading