[ Web Proxy ]
URL:
Viewing: https://docs.digitalocean.com/reference/pydo/reference/genai/create_model_router/ [Back]  [Original]

pydo.genai.create_model_router() | DigitalOcean Documentation

For AI agents: The documentation index is at https://docs.digitalocean.com/llms.txt. Markdown versions of pages use the same URL with index.html.md in place of the HTML page (for example, append index.html.md to the directory path instead of opening the HTML document).

pydo.genai.create_model_router()

Generated on 3 Aug 2026 from pydo version v0.40.0

Copy page as Markdown View page as Markdown

Usage

client.genai.create_model_router(
    body={
        "description": "\"My Model Router Description\"",
        "fallback_models": [...],
        "name": "\"my-model-router\"",
        ...,
    },
)
Returns JSONRaises HttpResponseError

Description

To create a model router, send a POST request to /v2/gen-ai/models/routers.

Parameters

description string optional

Example: "My Model Router Description"

Model router description

fallback_models array of strings optional

Example: ['example string']

At least one fallback model is required; order defines failover priority

name string optional

Example: "my-model-router"

Model router name: lowercase, at most 255 characters, only a-z, 0-9, and hyphens

policies array of objects optional

Router policies

Show child properties
custom_task object optional

Task definition embedded in a model router config.

Show child properties
description string optional

Example: "Summarize long-form text"

Short task description

name string optional

Example: "Custom Summarization"

Task name

models array of strings optional

Example: ['example string']

Models assigned to the task

selection_policy object optional

Selection policy preference for choosing among assigned models.

Show child properties
prefer string optional

Example: "cheapest"

One of: none, cheapest, fastest

task_slug string optional

Example: "summarization"

Task slug

regions array of strings optional

Example: ['example string']

DEPRECATED: this field does not affect deployment and model routers are always
deployed to all regions. Must be omitted or set to ["all"].

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "description": "\"My Model Router Description\"",
  "fallback_models": [
    "example string"
  ],
  "name": "\"my-model-router\"",
  "policies": [
    {
      "models": [
        "example string"
      ],
      "task_slug": "\"summarization\""
    }
  ],
  "regions": [
    "example string"
  ]
}

resp = client.genai.create_model_router(body=req)

Response Example

Show Response Example
{
  "model_router": {
    "config": {
      "fallback_models": [
        "example string"
      ],
      "policies": []
    },
    "created_at": "2023-01-01T00:00:00Z",
    "description": "example string",
    "name": "example name",
    "regions": [
      "example string"
    ],
    "updated_at": "2023-01-01T00:00:00Z",
    "uuid": "123e4567-e89b-12d3-a456-426614174000"
  }
}

More Information

See /v2/gen-ai/models/routers in the API reference for additional detail on responses, headers, parameters, and more.

In this article...


We can't find any results for your search.

Try using different keywords or simplifying your search terms.


Web Proxy Viewer  |  New URL  |  Original Page