ADC

Content switching-based model routing

Content switching-based model routing enables the NetScaler AI gateway to send the incoming chat requests from AI agents and applications to different models. This feature uses the NetScaler Content switching feature to forward the requests to different AI Models. When a request reaches the content switching virtual server, the virtual server applies the associated content switching policy to that request. The priority of the policy defines the order in which the policies bound to the content switching virtual server are evaluated.

NetScaler content switching inspects the content in the HTTP headers, HTTP body, or any Layer 3 or Layer 4 data to decide which AI model to use.

Ai gateway content switching

The following is a sample topology where 2 applications are using AI Gateway. One application is a coding application that uses GPT-5-Codex as a model while the other is a general chat bot that uses GPT-5 as the model.

To configure content switching-based model routing, perform the following steps:

  1. Create a content switching policy that inspects the model in the URL of the request sent to Azure OpenAI Deployment.

    add cs policy <CS Policy Name> <Rule>
    <!--NeedCopy-->
    

    Example:

    add cs policy pol_gpt5-codex -rule "HTTP.REQ.URL.PATH.AFTER_STR(\"/openai/deployments/\").BEFORE_STR(\"/\") == \"gpt-5-codes\""
    add cs policy pol_gpt5 -rule "HTTP.REQ.URL.PATH.AFTER_STR(\"/openai/deployments/\").BEFORE_STR(\"/\") == \"gpt-5\""
    add cs policy pol_any -rule true
    <!--NeedCopy-->
    
  2. Bind the content switching policies to the content switching virtual server and set the target as the destination load balancing virtual server. In case there is no match, the last rule is applied, and the request is sent to the GPT-5 load balancing virtual server.

    bind <CSVserver name > -policyName <CS Policy Name> -targetLBVserver <Target LB Vserver> -priority <Priority>
    <!--NeedCopy-->
    

    Example:

    bind cs vserver cs_vs -policyName pol_gpt5 -targetLBVserver Lb-Gpt-5 -priority 10
    bind cs vserver cs_vs -policyName pol_gpt5-codex -targetLBVserver Lb-Gpt-5-Codex -priority 12
    bind cs vserver cs_vs -policyName pol_any -targetLBVserver Lb-Gpt-5 -priority 13
    <!--NeedCopy-->
    
Content switching-based model routing