{"id":583186,"date":"2026-08-04T19:06:13","date_gmt":"2026-08-04T19:06:13","guid":{"rendered":"https:\/\/www.newsbeep.com\/ie\/583186\/"},"modified":"2026-08-04T19:06:13","modified_gmt":"2026-08-04T19:06:13","slug":"a-unified-api-for-ai-model-routing","status":"publish","type":"post","link":"https:\/\/www.newsbeep.com\/ie\/583186\/","title":{"rendered":"A unified API for AI model routing"},"content":{"rendered":"<p data-block-key=\"r2cz9\">When building AI applications, developers need the freedom to route traffic to the best model for the job without hardcoding endpoints or managing open-source proxies. <a href=\"https:\/\/docs.cloud.google.com\/api-gateway\/docs\" rel=\"nofollow noopener\" target=\"_blank\">Google Cloud API Gateway<\/a> now offers model routing in Public Preview to solve this. It provides a lightweight, serverless ingress layer that accepts OpenAI-compatible requests and dynamically routes them to Gemini, Claude, or OpenAI OSS-GPT.<\/p>\n<p data-block-key=\"a0dae\">API Gateway can be used standalone for simple rate limiting and token tracking, or paired seamlessly with the Gemini Enterprise Agent Platform. For example, you can route your agent&#8217;s egress through Agent Gateway for strict security governance, and then pass the request to API Gateway to handle dynamic routing to Google-hosted LLMs. Here is a step-by-step guide on how to configure your routing logic.<\/p>\n<p>Routing your traffic<\/p>\n<p data-block-key=\"9m16r\">Setting up your model routing logic takes just a few steps:<\/p>\n<p>Configure your routing rules: You can map virtual model names to specific backend targets directly in your OpenAPI 3.x specification using the new x-google-api-management extension block.<\/p>\n<p>    openapi: 3.0.4&#13;<br \/>\n&#13;<br \/>\ninfo:&#13;<br \/>\n  title: OpenAPI 3.x spec using Model Routing&#13;<br \/>\n  description: Using Model Routing in an OAS 3.x spec&#13;<br \/>\n  version: 1.0.0&#13;<br \/>\n&#13;<br \/>\nx-google-api-management:&#13;<br \/>\n  backends:&#13;<br \/>\n    gemini-35-flashlite:&#13;<br \/>\n      address: &gt;-&#13;<br \/>\n        https:\/\/aiplatform.googleapis.com\/v1\/projects\/YOUR_PROJECT_ID\/locations\/global\/publishers\/google\/models\/gemini-3.5-flash-lite:generateContent&#13;<br \/>\n      deadline: 60.0&#13;<br \/>\n      pathTranslation: CONSTANT_ADDRESS&#13;<br \/>\n&#13;<br \/>\n    anthropic-claude-opus-47:&#13;<br \/>\n      address: &gt;-&#13;<br \/>\n        https:\/\/aiplatform.googleapis.com\/v1\/projects\/YOUR_PROJECT_ID\/locations\/global\/publishers\/anthropic\/models\/claude-opus-4-7:rawPredict&#13;<br \/>\n      deadline: 60.0&#13;<br \/>\n      pathTranslation: CONSTANT_ADDRESS&#13;<br \/>\n&#13;<br \/>\n    openai-gpt-oss-120b:&#13;<br \/>\n      address: &gt;-&#13;<br \/>\n        https:\/\/aiplatform.googleapis.com\/v1\/projects\/YOUR_PROJECT_ID\/locations\/global\/endpoints\/openapi\/chat\/completions&#13;<br \/>\n      deadline: 60.0&#13;<br \/>\n      pathTranslation: CONSTANT_ADDRESS&#13;<br \/>\n&#13;<br \/>\n  ai:&#13;<br \/>\n    models:&#13;<br \/>\n      routing:&#13;<br \/>\n        routers:&#13;<br \/>\n          # Router 1: route between Gemini (default) and Claude.&#13;<br \/>\n          gemini-claude-router:&#13;<br \/>\n            defaultModel:&#13;<br \/>\n              backend: gemini-35-flashlite&#13;<br \/>\n              targetModel: google\/gemini-3.5-flash-lite&#13;<br \/>\n            rules:&#13;<br \/>\n              &#8211; model: &#8220;claude-opus-4-7&#8243;&#13;<br \/>\n                backend: anthropic-claude-opus-47&#13;<br \/>\n                targetModel: anthropic\/claude-opus-4-7&#13;<br \/>\n&#13;<br \/>\n          # Router 2: route between OpenAI GPT (default) and Gemini.&#13;<br \/>\n          openai-gemini-router:&#13;<br \/>\n            defaultModel:&#13;<br \/>\n              backend: openai-gpt-oss-120b&#13;<br \/>\n              targetModel: openai\/gpt-oss-120b-maas&#13;<br \/>\n            rules:&#13;<br \/>\n              &#8211; model: &#8220;gemini-3.5-flash-lite&#8221;&#13;<br \/>\n                backend: gemini-35-flashlite&#13;<br \/>\n                targetModel: google\/gemini-3.5-flash-lite&#13;<br \/>\n&#13;<br \/>\nservers:&#13;<br \/>\n  &#8211; url: &#8220;https:\/\/my-gateway-url.com&#8221;&#13;<br \/>\n&#13;<br \/>\npaths:&#13;<br \/>\n  \/v1\/chat\/gemini-claude:&#13;<br \/>\n    post:&#13;<br \/>\n      summary: &#8220;Endpoint:defaults to Gemini &amp; Claude as an option.&#8221;&#13;<br \/>\n      operationId: &#8220;chatGeminiClaude&#8221;&#13;<br \/>\n      x-google-model-router: gemini-claude-router&#13;<br \/>\n      responses:&#13;<br \/>\n        &#8216;200&#8217;:&#13;<br \/>\n          description: &#8220;OK&#8221;&#13;<br \/>\n&#13;<br \/>\n  \/v1\/chat\/openai-gemini:&#13;<br \/>\n    post:&#13;<br \/>\n      summary: &#8220;Endpoint:defaults to OpenAI &amp; Gemini as an option.&#8221;&#13;<br \/>\n      operationId: &#8220;chatOpenAIGemini&#8221;&#13;<br \/>\n      x-google-model-router: openai-gemini-router&#13;<br \/>\n      responses:&#13;<br \/>\n        &#8216;200&#8217;:&#13;<br \/>\n          description: &#8220;OK&#8221;<\/p>\n<p>\n        YAML\n    <\/p>\n<p data-block-key=\"r2cz9\">Note: All backends referenced by a single router must share the same host (for example, aiplatform.googleapis.com). Routing selects a different model and path on that shared Vertex host \u2014 it does not route across different hosts.<\/p>\n<p data-block-key=\"cjbe6\">2. Deploy the Gateway: Deploy your updated API config so the Gateway is active and ready to process traffic.<\/p>\n<p data-block-key=\"820q5\">3. Send standard requests: Your application simply sends a standard OpenAI POST \/v1\/chat\/gemini-claude or POST \/v1\/chat\/openai-gemini request. The Gateway intercepts it, transcodes the payload to the native schema of the backend, and routes it on the fly. As an example (use appropriate values for $API_KEY and my-gateway-url.com) :<\/p>\n<p>    curl -X POST &#8220;https:\/\/my-gateway-url.com\/v1\/chat\/gemini-claude&#8221; \\&#13;<br \/>\n  -H &#8220;content-type: application\/json&#8221; \\&#13;<br \/>\n  -H &#8220;x-api-key: $API_KEY&#8221; \\&#13;<br \/>\n  -d &#8216;{&#13;<br \/>\n        &#8220;model&#8221;: &#8220;claude-opus-4-7&#8221;,&#13;<br \/>\n        &#8220;messages&#8221;: [&#13;<br \/>\n          {&#8220;role&#8221;: &#8220;user&#8221;, &#8220;content&#8221;: &#8220;Introduce yourself in 5 words&#8221;}&#13;<br \/>\n        ]&#13;<br \/>\n      }&#8217;<\/p>\n<p>\n        Shell\n    <\/p>\n<p>    Get started<\/p>\n<p data-block-key=\"2254c\">Model routing is now available in Public Preview for API Gateway. To stop managing proxies and start unifying your AI traffic, <a href=\"https:\/\/docs.cloud.google.com\/api-gateway\/docs\/model-routing-overview\" rel=\"nofollow noopener\" target=\"_blank\">check out our documentation<\/a> to deploy your first model router today.<\/p>\n","protected":false},"excerpt":{"rendered":"When building AI applications, developers need the freedom to route traffic to the best model for the job&hellip;\n","protected":false},"author":2,"featured_media":583187,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[220,218,219,61,60,80],"class_list":["post-583186","post","type-post","status-publish","format-standard","has-post-thumbnail","category-artificial-intelligence","tag-ai","tag-artificial-intelligence","tag-artificialintelligence","tag-ie","tag-ireland","tag-technology"],"_links":{"self":[{"href":"https:\/\/www.newsbeep.com\/ie\/wp-json\/wp\/v2\/posts\/583186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.newsbeep.com\/ie\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.newsbeep.com\/ie\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/ie\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/ie\/wp-json\/wp\/v2\/comments?post=583186"}],"version-history":[{"count":0,"href":"https:\/\/www.newsbeep.com\/ie\/wp-json\/wp\/v2\/posts\/583186\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/ie\/wp-json\/wp\/v2\/media\/583187"}],"wp:attachment":[{"href":"https:\/\/www.newsbeep.com\/ie\/wp-json\/wp\/v2\/media?parent=583186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.newsbeep.com\/ie\/wp-json\/wp\/v2\/categories?post=583186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.newsbeep.com\/ie\/wp-json\/wp\/v2\/tags?post=583186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}