Welcome to Portkey Forum

Updated 2 days ago

Blocking a specific model through the config

Hi all, working on some configs and trying to understand if it is possible to block a specific model through the config. I am able to load balance and set the weight to zero, but is there a way to explicitly block a model from a provider?
W
s
3 comments
you can use conditional routing for this. you can set the routing to be model based and set the target as something which will fail
https://portkey.ai/docs/product/ai-gateway/conditional-routing#conditional-routing
Hi, can you please let us know an example on how to use the model based conditional routing.
Plain Text
{
  "strategy": {
    "mode": "conditional",
    "conditions": [
      {
        "query": {
          "params.model": {
            "$eq": "fastest"
          }
        },
        "then": "fastest"
      },
      {
        "query": {
          "params.model": {
            "$eq": "smartest"
          }
        },
        "then": "smartest"
      }
    ],
    "default": "fastest"
  },
  "targets": [
    {
      "name": "smartest",
      "virtual_key": "anthropic-vk",
      "override_params": {
        "model": "claude-3.5-sonnet"
      }
    },
    {
      "name": "fastest",
      "virtual_key": "oai-vk",
      "override_params": {
        "model": "gpt-4o-mini"
      }
    }
  ]
}
Add a reply
Sign up and join the conversation on Discord