From 512c594a0e11a29208628b448170e254ea0ee9a7 Mon Sep 17 00:00:00 2001 From: Rohan Sabhaya Date: Fri, 17 Apr 2026 12:29:10 -0700 Subject: [PATCH 1/3] Add Model Router API documentation --- specification/DigitalOcean-public.v2.yaml | 30 ++ .../resources/gen-ai/definitions.yml | 310 ++++++++++++++++++ .../curl/genai_create_model_router.yml | 21 ++ .../curl/genai_delete_model_router.yml | 6 + .../examples/curl/genai_get_model_router.yml | 6 + .../curl/genai_list_model_router_presets.yml | 6 + .../genai_list_model_router_task_presets.yml | 6 + .../curl/genai_list_model_routers.yml | 6 + .../curl/genai_update_model_router.yml | 21 ++ .../gen-ai/genai_create_model_router.yml | 39 +++ .../gen-ai/genai_delete_model_router.yml | 42 +++ .../gen-ai/genai_get_model_router.yml | 42 +++ .../genai_list_model_router_presets.yml | 47 +++ .../genai_list_model_router_task_presets.yml | 47 +++ .../gen-ai/genai_list_model_routers.yml | 47 +++ .../gen-ai/genai_update_model_router.yml | 47 +++ 16 files changed, 723 insertions(+) create mode 100644 specification/resources/gen-ai/examples/curl/genai_create_model_router.yml create mode 100644 specification/resources/gen-ai/examples/curl/genai_delete_model_router.yml create mode 100644 specification/resources/gen-ai/examples/curl/genai_get_model_router.yml create mode 100644 specification/resources/gen-ai/examples/curl/genai_list_model_router_presets.yml create mode 100644 specification/resources/gen-ai/examples/curl/genai_list_model_router_task_presets.yml create mode 100644 specification/resources/gen-ai/examples/curl/genai_list_model_routers.yml create mode 100644 specification/resources/gen-ai/examples/curl/genai_update_model_router.yml create mode 100644 specification/resources/gen-ai/genai_create_model_router.yml create mode 100644 specification/resources/gen-ai/genai_delete_model_router.yml create mode 100644 specification/resources/gen-ai/genai_get_model_router.yml create mode 100644 specification/resources/gen-ai/genai_list_model_router_presets.yml create mode 100644 specification/resources/gen-ai/genai_list_model_router_task_presets.yml create mode 100644 specification/resources/gen-ai/genai_list_model_routers.yml create mode 100644 specification/resources/gen-ai/genai_update_model_router.yml diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index 918661ca..61c25f93 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -2750,6 +2750,36 @@ paths: put: $ref: 'resources/gen-ai/genai_regenerate_model_api_key.yml' + + /v2/gen-ai/models/routers: + get: + $ref: 'resources/gen-ai/genai_list_model_routers.yml' + + post: + $ref: 'resources/gen-ai/genai_create_model_router.yml' + + + /v2/gen-ai/models/routers/presets: + get: + $ref: 'resources/gen-ai/genai_list_model_router_presets.yml' + + + /v2/gen-ai/models/routers/tasks/presets: + get: + $ref: 'resources/gen-ai/genai_list_model_router_task_presets.yml' + + + /v2/gen-ai/models/routers/{uuid}: + get: + $ref: 'resources/gen-ai/genai_get_model_router.yml' + + put: + $ref: 'resources/gen-ai/genai_update_model_router.yml' + + delete: + $ref: 'resources/gen-ai/genai_delete_model_router.yml' + + /v2/gen-ai/oauth2/dropbox/tokens: post: $ref: 'resources/gen-ai/genai_create_oauth2_dropbox_tokens.yml' diff --git a/specification/resources/gen-ai/definitions.yml b/specification/resources/gen-ai/definitions.yml index c7cee19a..ed0bc5f7 100644 --- a/specification/resources/gen-ai/definitions.yml +++ b/specification/resources/gen-ai/definitions.yml @@ -1652,6 +1652,46 @@ apiCreateModelProviderKeyOutput: api_key_info: $ref: '#/apiModelProviderKeyInfo' type: object +apiCreateModelRouterInputPublic: + description: Create a model router + properties: + description: + description: Model router description + example: '"My Model Router Description"' + type: string + fallback_models: + description: Fallback models + example: + - '"gemma3:latest"' + - '"gemma3:270m"' + items: + example: example string + type: string + type: array + name: + description: Model router name + example: '"My Model Router"' + type: string + policies: + description: Router policies + items: + $ref: '#/apiModelRouterTaskPolicy' + type: array + regions: + description: Target regions for the router + example: + - '"tor1"' + items: + example: example string + type: string + type: array + type: object +apiCreateModelRouterOutput: + description: Information about a newly created model router + properties: + model_router: + $ref: '#/apiModelRouter' + type: object apiCreateOpenAIAPIKeyInputPublic: description: CreateOpenAIAPIKeyInputPublic is used to create a new OpenAI API key for a specific agent. @@ -1896,6 +1936,18 @@ apiDeleteModelProviderKeyOutput: api_key_info: $ref: '#/apiModelProviderKeyInfo' type: object +apiDeleteModelRouterInputPublic: + properties: + uuid: + example: '"12345678-1234-1234-1234-123456789012"' +apiDeleteModelRouterOutput: + description: Information about a deleted model router + properties: + uuid: + description: The id of the deleted model router + example: 123e4567-e89b-12d3-a456-426614174000 + type: string + type: object apiDeleteOpenAIAPIKeyInputPublic: properties: api_key_uuid: @@ -2723,6 +2775,16 @@ apiGetModelUsageOutput: usage: $ref: '#/apiResourceUsage' type: object +apiGetModelRouterInputPublic: + properties: + uuid: + example: '"12345678-1234-1234-1234-123456789012"' +apiGetModelRouterOutput: + description: The model router + properties: + model_router: + $ref: '#/apiModelRouter' + type: object apiGetModelVersionsInputPublic: properties: name: @@ -3925,6 +3987,63 @@ apiListModelProviderKeysOutput: meta: $ref: '#/apiMeta' type: object +apiListModelRouterPresetsInputPublic: + properties: + page: + example: "1" + per_page: + example: "20" +apiListModelRouterPresetsOutput: + description: List of model router presets + properties: + links: + $ref: '#/apiLinks' + meta: + $ref: '#/apiMeta' + presets: + description: The model router presets + items: + $ref: '#/apiModelRouterPreset' + type: array + type: object +apiListModelRouterTaskPresetsInputPublic: + properties: + page: + example: "1" + per_page: + example: "20" +apiListModelRouterTaskPresetsOutput: + description: List of model router task presets + properties: + links: + $ref: '#/apiLinks' + meta: + $ref: '#/apiMeta' + tasks: + description: The task presets + items: + $ref: '#/apiModelRouterTaskPreset' + type: array + type: object +apiListModelRoutersInputPublic: + properties: + page: + example: "1" + per_page: + example: "20" +apiListModelRoutersOutput: + description: List of model routers + properties: + links: + $ref: '#/apiLinks' + meta: + $ref: '#/apiMeta' + model_routers: + description: The model routers + items: + $ref: '#/apiModelRouter' + type: array + type: object apiListModelUsagesByAgentOutput: description: ListModelUsagesByAgentOutput description properties: @@ -4309,6 +4428,158 @@ apiModelPublic: version: $ref: '#/apiModelVersion' type: object +apiModelRouter: + description: Model router + properties: + config: + $ref: '#/apiModelRouterConfig' + created_at: + description: Creation date / time + example: "2023-01-01T00:00:00Z" + format: date-time + type: string + description: + description: Description + example: example string + type: string + name: + description: Name of the model router + example: example name + type: string + regions: + description: Target regions for the router + example: + - example string + items: + example: example string + type: string + type: array + updated_at: + description: Last modified + example: "2023-01-01T00:00:00Z" + format: date-time + type: string + uuid: + description: Unique id + example: 123e4567-e89b-12d3-a456-426614174000 + type: string + type: object +apiModelRouterConfig: + properties: + fallback_models: + description: Router-level fallback models + example: + - example string + items: + example: example string + type: string + type: array + policies: + description: Task routing policies + items: + $ref: '#/apiModelRouterTaskPolicy' + type: array + type: object +apiModelRouterPreset: + description: Model router preset used to prefill new router configurations. + properties: + config: + $ref: '#/apiModelRouterConfig' + display_name: + description: Display name for UI surfaces + example: example name + type: string + long_description: + description: Long description for details views + example: example string + type: string + short_description: + description: Short description for list views + example: example string + type: string + slug: + description: Stable slug for routing usage + example: example string + type: string + type: object +apiModelRouterSelectionPolicy: + description: Selection policy preference for choosing among assigned models. + properties: + prefer: + description: 'One of: none, cheapest, fastest' + example: '"cheapest"' + type: string + type: object +apiModelRouterTaskDetails: + description: Task definition embedded in a model router config. + properties: + description: + description: Short task description + example: '"Summarize long-form text"' + type: string + name: + description: Task name + example: '"Custom Summarization"' + type: string + type: object +apiModelRouterTaskPolicy: + description: Model router policy + properties: + custom_task: + $ref: '#/apiModelRouterTaskDetails' + models: + description: Models assigned to the task + example: + - example string + items: + example: example string + type: string + type: array + selection_policy: + $ref: '#/apiModelRouterSelectionPolicy' + task_slug: + description: Task slug + example: '"summarization"' + type: string + type: object +apiModelRouterTaskPreset: + description: Task preset that can be referenced by slug in model router policies. + properties: + category: + description: Higher-level grouping used by the UI + example: example string + type: string + description: + description: Task description + example: example string + type: string + models: + description: Default models assigned to this task + example: + - example string + items: + example: example string + type: string + type: array + name: + description: Display name + example: example name + type: string + selection_policy: + $ref: '#/apiModelRouterSelectionPolicy' + tags: + description: Lightweight labels for filtering + example: + - example string + items: + example: example string + type: string + type: array + task_slug: + description: Task slug + example: example string + type: string + type: object apiModelUploadCompleteOutput: description: Information about an updated model properties: @@ -5393,6 +5664,45 @@ apiUpdateModelProviderKeyOutput: api_key_info: $ref: '#/apiModelProviderKeyInfo' type: object +apiUpdateModelRouterInputPublic: + description: Information about updating a model router + properties: + description: + description: Model router description + example: '"My Model Router Description"' + type: string + fallback_models: + items: + type: object + type: array + name: + description: Model router name + example: '"My Model Router"' + type: string + policies: + description: Router policies + items: + $ref: '#/apiModelRouterTaskPolicy' + type: array + regions: + description: Target regions for the router + example: + - '"tor1"' + items: + example: example string + type: string + type: array + uuid: + description: Model router id + example: '"12345678-1234-1234-1234-123456789012"' + type: string + type: object +apiUpdateModelRouterOutput: + description: Information about an updated model router + properties: + model_router: + $ref: '#/apiModelRouter' + type: object apiUpdateOpenAIAPIKeyInputPublic: description: UpdateOpenAIAPIKeyInputPublic is used to update an existing OpenAI API key for a specific agent. diff --git a/specification/resources/gen-ai/examples/curl/genai_create_model_router.yml b/specification/resources/gen-ai/examples/curl/genai_create_model_router.yml new file mode 100644 index 00000000..e120073a --- /dev/null +++ b/specification/resources/gen-ai/examples/curl/genai_create_model_router.yml @@ -0,0 +1,21 @@ +lang: cURL +source: |- + curl -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/gen-ai/models/routers" \ + -d '{ + "name": "My Model Router", + "description": "Routes chat traffic across multiple models", + "regions": ["tor1"], + "fallback_models": ["gemma3:latest", "gemma3:270m"], + "policies": [ + { + "task_slug": "summarization", + "models": ["gemma3:latest", "gemma3:270m"], + "selection_policy": { + "prefer": "cheapest" + } + } + ] + }' diff --git a/specification/resources/gen-ai/examples/curl/genai_delete_model_router.yml b/specification/resources/gen-ai/examples/curl/genai_delete_model_router.yml new file mode 100644 index 00000000..9bfc581e --- /dev/null +++ b/specification/resources/gen-ai/examples/curl/genai_delete_model_router.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X DELETE \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/gen-ai/models/routers/12345678-1234-1234-1234-123456789012" diff --git a/specification/resources/gen-ai/examples/curl/genai_get_model_router.yml b/specification/resources/gen-ai/examples/curl/genai_get_model_router.yml new file mode 100644 index 00000000..cc95fbd7 --- /dev/null +++ b/specification/resources/gen-ai/examples/curl/genai_get_model_router.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/gen-ai/models/routers/12345678-1234-1234-1234-123456789012" diff --git a/specification/resources/gen-ai/examples/curl/genai_list_model_router_presets.yml b/specification/resources/gen-ai/examples/curl/genai_list_model_router_presets.yml new file mode 100644 index 00000000..70780eb3 --- /dev/null +++ b/specification/resources/gen-ai/examples/curl/genai_list_model_router_presets.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/gen-ai/models/routers/presets?page=1&per_page=20" diff --git a/specification/resources/gen-ai/examples/curl/genai_list_model_router_task_presets.yml b/specification/resources/gen-ai/examples/curl/genai_list_model_router_task_presets.yml new file mode 100644 index 00000000..812efda2 --- /dev/null +++ b/specification/resources/gen-ai/examples/curl/genai_list_model_router_task_presets.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/gen-ai/models/routers/tasks/presets?page=1&per_page=20" diff --git a/specification/resources/gen-ai/examples/curl/genai_list_model_routers.yml b/specification/resources/gen-ai/examples/curl/genai_list_model_routers.yml new file mode 100644 index 00000000..4db2250f --- /dev/null +++ b/specification/resources/gen-ai/examples/curl/genai_list_model_routers.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/gen-ai/models/routers?page=1&per_page=20" diff --git a/specification/resources/gen-ai/examples/curl/genai_update_model_router.yml b/specification/resources/gen-ai/examples/curl/genai_update_model_router.yml new file mode 100644 index 00000000..d9e99e65 --- /dev/null +++ b/specification/resources/gen-ai/examples/curl/genai_update_model_router.yml @@ -0,0 +1,21 @@ +lang: cURL +source: |- + curl -X PUT \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/gen-ai/models/routers/12345678-1234-1234-1234-123456789012" \ + -d '{ + "name": "My Model Router", + "description": "Updated router description", + "regions": ["tor1"], + "fallback_models": ["gemma3:latest", "gemma3:270m"], + "policies": [ + { + "task_slug": "summarization", + "models": ["gemma3:latest"], + "selection_policy": { + "prefer": "cheapest" + } + } + ] + }' diff --git a/specification/resources/gen-ai/genai_create_model_router.yml b/specification/resources/gen-ai/genai_create_model_router.yml new file mode 100644 index 00000000..764133af --- /dev/null +++ b/specification/resources/gen-ai/genai_create_model_router.yml @@ -0,0 +1,39 @@ +description: To create a model router, send a POST request to `/v2/gen-ai/models/routers`. +operationId: genai_create_model_router +requestBody: + content: + application/json: + schema: + $ref: ./definitions.yml#/apiCreateModelRouterInputPublic +responses: + "200": + content: + application/json: + schema: + $ref: ./definitions.yml#/apiCreateModelRouterOutput + description: A successful response. + headers: + ratelimit-limit: + $ref: ../../shared/headers.yml#/ratelimit-limit + ratelimit-remaining: + $ref: ../../shared/headers.yml#/ratelimit-remaining + ratelimit-reset: + $ref: ../../shared/headers.yml#/ratelimit-reset + "401": + $ref: ../../shared/responses/unauthorized.yml + "404": + $ref: ../../shared/responses/not_found.yml + "429": + $ref: ../../shared/responses/too_many_requests.yml + "500": + $ref: ../../shared/responses/server_error.yml + default: + $ref: ../../shared/responses/unexpected_error.yml +security: +- bearer_auth: + - genai:create +summary: Create a Model Router +tags: +- GradientAI Platform +x-codeSamples: +- $ref: examples/curl/genai_create_model_router.yml diff --git a/specification/resources/gen-ai/genai_delete_model_router.yml b/specification/resources/gen-ai/genai_delete_model_router.yml new file mode 100644 index 00000000..51e39db3 --- /dev/null +++ b/specification/resources/gen-ai/genai_delete_model_router.yml @@ -0,0 +1,42 @@ +description: To delete a model router, send a DELETE request to `/v2/gen-ai/models/routers/{uuid}`. +operationId: genai_delete_model_router +parameters: +- description: Model router id + example: '"123e4567-e89b-12d3-a456-426614174000"' + in: path + name: uuid + required: true + schema: + type: string +responses: + "200": + content: + application/json: + schema: + $ref: ./definitions.yml#/apiDeleteModelRouterOutput + description: A successful response. + headers: + ratelimit-limit: + $ref: ../../shared/headers.yml#/ratelimit-limit + ratelimit-remaining: + $ref: ../../shared/headers.yml#/ratelimit-remaining + ratelimit-reset: + $ref: ../../shared/headers.yml#/ratelimit-reset + "401": + $ref: ../../shared/responses/unauthorized.yml + "404": + $ref: ../../shared/responses/not_found.yml + "429": + $ref: ../../shared/responses/too_many_requests.yml + "500": + $ref: ../../shared/responses/server_error.yml + default: + $ref: ../../shared/responses/unexpected_error.yml +security: +- bearer_auth: + - genai:delete +summary: Delete a Model Router +tags: +- GradientAI Platform +x-codeSamples: +- $ref: examples/curl/genai_delete_model_router.yml diff --git a/specification/resources/gen-ai/genai_get_model_router.yml b/specification/resources/gen-ai/genai_get_model_router.yml new file mode 100644 index 00000000..477130f2 --- /dev/null +++ b/specification/resources/gen-ai/genai_get_model_router.yml @@ -0,0 +1,42 @@ +description: To retrieve details of a model router, send a GET request to `/v2/gen-ai/models/routers/{uuid}`. +operationId: genai_get_model_router +parameters: +- description: Model router id + example: '"123e4567-e89b-12d3-a456-426614174000"' + in: path + name: uuid + required: true + schema: + type: string +responses: + "200": + content: + application/json: + schema: + $ref: ./definitions.yml#/apiGetModelRouterOutput + description: A successful response. + headers: + ratelimit-limit: + $ref: ../../shared/headers.yml#/ratelimit-limit + ratelimit-remaining: + $ref: ../../shared/headers.yml#/ratelimit-remaining + ratelimit-reset: + $ref: ../../shared/headers.yml#/ratelimit-reset + "401": + $ref: ../../shared/responses/unauthorized.yml + "404": + $ref: ../../shared/responses/not_found.yml + "429": + $ref: ../../shared/responses/too_many_requests.yml + "500": + $ref: ../../shared/responses/server_error.yml + default: + $ref: ../../shared/responses/unexpected_error.yml +security: +- bearer_auth: + - genai:read +summary: Retrieve an Existing Model Router +tags: +- GradientAI Platform +x-codeSamples: +- $ref: examples/curl/genai_get_model_router.yml diff --git a/specification/resources/gen-ai/genai_list_model_router_presets.yml b/specification/resources/gen-ai/genai_list_model_router_presets.yml new file mode 100644 index 00000000..be90117d --- /dev/null +++ b/specification/resources/gen-ai/genai_list_model_router_presets.yml @@ -0,0 +1,47 @@ +description: To list model router presets, send a GET request to `/v2/gen-ai/models/routers/presets`. +operationId: genai_list_model_router_presets +parameters: +- description: Page number. + example: 1 + in: query + name: page + schema: + type: integer +- description: Items per page. + example: 1 + in: query + name: per_page + schema: + type: integer +responses: + "200": + content: + application/json: + schema: + $ref: ./definitions.yml#/apiListModelRouterPresetsOutput + description: A successful response. + headers: + ratelimit-limit: + $ref: ../../shared/headers.yml#/ratelimit-limit + ratelimit-remaining: + $ref: ../../shared/headers.yml#/ratelimit-remaining + ratelimit-reset: + $ref: ../../shared/headers.yml#/ratelimit-reset + "401": + $ref: ../../shared/responses/unauthorized.yml + "404": + $ref: ../../shared/responses/not_found.yml + "429": + $ref: ../../shared/responses/too_many_requests.yml + "500": + $ref: ../../shared/responses/server_error.yml + default: + $ref: ../../shared/responses/unexpected_error.yml +security: +- bearer_auth: + - genai:read +summary: List Model Router Presets +tags: +- GradientAI Platform +x-codeSamples: +- $ref: examples/curl/genai_list_model_router_presets.yml diff --git a/specification/resources/gen-ai/genai_list_model_router_task_presets.yml b/specification/resources/gen-ai/genai_list_model_router_task_presets.yml new file mode 100644 index 00000000..112d85e2 --- /dev/null +++ b/specification/resources/gen-ai/genai_list_model_router_task_presets.yml @@ -0,0 +1,47 @@ +description: To list model router task presets, send a GET request to `/v2/gen-ai/models/routers/tasks/presets`. +operationId: genai_list_model_router_task_presets +parameters: +- description: Page number. + example: 1 + in: query + name: page + schema: + type: integer +- description: Items per page. + example: 1 + in: query + name: per_page + schema: + type: integer +responses: + "200": + content: + application/json: + schema: + $ref: ./definitions.yml#/apiListModelRouterTaskPresetsOutput + description: A successful response. + headers: + ratelimit-limit: + $ref: ../../shared/headers.yml#/ratelimit-limit + ratelimit-remaining: + $ref: ../../shared/headers.yml#/ratelimit-remaining + ratelimit-reset: + $ref: ../../shared/headers.yml#/ratelimit-reset + "401": + $ref: ../../shared/responses/unauthorized.yml + "404": + $ref: ../../shared/responses/not_found.yml + "429": + $ref: ../../shared/responses/too_many_requests.yml + "500": + $ref: ../../shared/responses/server_error.yml + default: + $ref: ../../shared/responses/unexpected_error.yml +security: +- bearer_auth: + - genai:read +summary: List Model Router Task Presets +tags: +- GradientAI Platform +x-codeSamples: +- $ref: examples/curl/genai_list_model_router_task_presets.yml diff --git a/specification/resources/gen-ai/genai_list_model_routers.yml b/specification/resources/gen-ai/genai_list_model_routers.yml new file mode 100644 index 00000000..857d62f6 --- /dev/null +++ b/specification/resources/gen-ai/genai_list_model_routers.yml @@ -0,0 +1,47 @@ +description: To list model routers, send a GET request to `/v2/gen-ai/models/routers`. +operationId: genai_list_model_routers +parameters: +- description: Page number. + example: 1 + in: query + name: page + schema: + type: integer +- description: Items per page. + example: 1 + in: query + name: per_page + schema: + type: integer +responses: + "200": + content: + application/json: + schema: + $ref: ./definitions.yml#/apiListModelRoutersOutput + description: A successful response. + headers: + ratelimit-limit: + $ref: ../../shared/headers.yml#/ratelimit-limit + ratelimit-remaining: + $ref: ../../shared/headers.yml#/ratelimit-remaining + ratelimit-reset: + $ref: ../../shared/headers.yml#/ratelimit-reset + "401": + $ref: ../../shared/responses/unauthorized.yml + "404": + $ref: ../../shared/responses/not_found.yml + "429": + $ref: ../../shared/responses/too_many_requests.yml + "500": + $ref: ../../shared/responses/server_error.yml + default: + $ref: ../../shared/responses/unexpected_error.yml +security: +- bearer_auth: + - genai:read +summary: List Model Routers +tags: +- GradientAI Platform +x-codeSamples: +- $ref: examples/curl/genai_list_model_routers.yml diff --git a/specification/resources/gen-ai/genai_update_model_router.yml b/specification/resources/gen-ai/genai_update_model_router.yml new file mode 100644 index 00000000..b5cf5cd7 --- /dev/null +++ b/specification/resources/gen-ai/genai_update_model_router.yml @@ -0,0 +1,47 @@ +description: To update a model router, send a PUT request to `/v2/gen-ai/models/routers/{uuid}`. +operationId: genai_update_model_router +parameters: +- description: Model router id + example: '"123e4567-e89b-12d3-a456-426614174000"' + in: path + name: uuid + required: true + schema: + type: string +requestBody: + content: + application/json: + schema: + $ref: ./definitions.yml#/apiUpdateModelRouterInputPublic +responses: + "200": + content: + application/json: + schema: + $ref: ./definitions.yml#/apiUpdateModelRouterOutput + description: A successful response. + headers: + ratelimit-limit: + $ref: ../../shared/headers.yml#/ratelimit-limit + ratelimit-remaining: + $ref: ../../shared/headers.yml#/ratelimit-remaining + ratelimit-reset: + $ref: ../../shared/headers.yml#/ratelimit-reset + "401": + $ref: ../../shared/responses/unauthorized.yml + "404": + $ref: ../../shared/responses/not_found.yml + "429": + $ref: ../../shared/responses/too_many_requests.yml + "500": + $ref: ../../shared/responses/server_error.yml + default: + $ref: ../../shared/responses/unexpected_error.yml +security: +- bearer_auth: + - genai:update +summary: Update a Model Router +tags: +- GradientAI Platform +x-codeSamples: +- $ref: examples/curl/genai_update_model_router.yml From dd79c93d3f622d90cc518277e838b1cd261af0ef Mon Sep 17 00:00:00 2001 From: Rohan Sabhaya Date: Tue, 21 Apr 2026 22:57:20 -0700 Subject: [PATCH 2/3] address feedback --- .../resources/gen-ai/definitions.yml | 24 +++++++++---------- .../curl/genai_create_model_router.yml | 4 ++-- .../curl/genai_update_model_router.yml | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/specification/resources/gen-ai/definitions.yml b/specification/resources/gen-ai/definitions.yml index ed0bc5f7..2c908bc1 100644 --- a/specification/resources/gen-ai/definitions.yml +++ b/specification/resources/gen-ai/definitions.yml @@ -1662,8 +1662,8 @@ apiCreateModelRouterInputPublic: fallback_models: description: Fallback models example: - - '"gemma3:latest"' - - '"gemma3:270m"' + - '"openai-gpt-5.4"' + - '"kimi-k2.5"' items: example: example string type: string @@ -2761,6 +2761,16 @@ apiGetModelProviderKeyOutput: api_key_info: $ref: '#/apiModelProviderKeyInfo' type: object +apiGetModelRouterInputPublic: + properties: + uuid: + example: '"12345678-1234-1234-1234-123456789012"' +apiGetModelRouterOutput: + description: The model router + properties: + model_router: + $ref: '#/apiModelRouter' + type: object apiGetModelUsageInputPublic: properties: start: @@ -2775,16 +2785,6 @@ apiGetModelUsageOutput: usage: $ref: '#/apiResourceUsage' type: object -apiGetModelRouterInputPublic: - properties: - uuid: - example: '"12345678-1234-1234-1234-123456789012"' -apiGetModelRouterOutput: - description: The model router - properties: - model_router: - $ref: '#/apiModelRouter' - type: object apiGetModelVersionsInputPublic: properties: name: diff --git a/specification/resources/gen-ai/examples/curl/genai_create_model_router.yml b/specification/resources/gen-ai/examples/curl/genai_create_model_router.yml index e120073a..99e763fd 100644 --- a/specification/resources/gen-ai/examples/curl/genai_create_model_router.yml +++ b/specification/resources/gen-ai/examples/curl/genai_create_model_router.yml @@ -8,11 +8,11 @@ source: |- "name": "My Model Router", "description": "Routes chat traffic across multiple models", "regions": ["tor1"], - "fallback_models": ["gemma3:latest", "gemma3:270m"], + "fallback_models": ["openai-gpt-5.4", "kimi-k2.5"], "policies": [ { "task_slug": "summarization", - "models": ["gemma3:latest", "gemma3:270m"], + "models": ["openai-gpt-5.4", "kimi-k2.5"], "selection_policy": { "prefer": "cheapest" } diff --git a/specification/resources/gen-ai/examples/curl/genai_update_model_router.yml b/specification/resources/gen-ai/examples/curl/genai_update_model_router.yml index d9e99e65..b0671a4d 100644 --- a/specification/resources/gen-ai/examples/curl/genai_update_model_router.yml +++ b/specification/resources/gen-ai/examples/curl/genai_update_model_router.yml @@ -8,11 +8,11 @@ source: |- "name": "My Model Router", "description": "Updated router description", "regions": ["tor1"], - "fallback_models": ["gemma3:latest", "gemma3:270m"], + "fallback_models": ["openai-gpt-5.4", "kimi-k2.5"], "policies": [ { "task_slug": "summarization", - "models": ["gemma3:latest"], + "models": ["openai-gpt-5.4"], "selection_policy": { "prefer": "cheapest" } From e69be5484d4ecb849c1f5e14a48c5e7b37af382a Mon Sep 17 00:00:00 2001 From: Rohan Sabhaya Date: Wed, 22 Apr 2026 12:20:04 -0700 Subject: [PATCH 3/3] Remove unreferenced model router input schemas --- specification/resources/gen-ai/definitions.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/specification/resources/gen-ai/definitions.yml b/specification/resources/gen-ai/definitions.yml index 2c908bc1..c5ca0acc 100644 --- a/specification/resources/gen-ai/definitions.yml +++ b/specification/resources/gen-ai/definitions.yml @@ -1936,10 +1936,6 @@ apiDeleteModelProviderKeyOutput: api_key_info: $ref: '#/apiModelProviderKeyInfo' type: object -apiDeleteModelRouterInputPublic: - properties: - uuid: - example: '"12345678-1234-1234-1234-123456789012"' apiDeleteModelRouterOutput: description: Information about a deleted model router properties: @@ -2761,10 +2757,6 @@ apiGetModelProviderKeyOutput: api_key_info: $ref: '#/apiModelProviderKeyInfo' type: object -apiGetModelRouterInputPublic: - properties: - uuid: - example: '"12345678-1234-1234-1234-123456789012"' apiGetModelRouterOutput: description: The model router properties: