model field in the request. This routing policy applies to the following scenarios:gpt-4o, gpt-4o-mini, and claude-3-5-sonnet).gpt-4-* matches all gpt-4 series models).Parameter | Description | Example | Required |
Model Service | Select from the list of created model services. | gpt-4o-openai | Yes |
Model Name to Match | Matching rule for the model parameter in client requests, supporting exact matching and wildcard matching ( *). | gpt-4o or gpt-4-* | Yes |
Model Name to Rewrite | When the request is forwarded to the backend service, rewrite the model parameter in the request to a specified value. If the model parameter is left blank, the original value is passed through. | gpt-4o or leave it blank | No |
Model Service | Matching Model Name | Rewritten Model Name |
gpt-4o-openai | gpt-4o | (Leave blank) |
gpt-4o-mini-openai | gpt-4o-mini | (Leave blank) |
claude-3-5-sonnet-anthropic | claude-3-5-sonnet | (Leave blank) |
# Request 1: Route to gpt-4o-openaicurl -X POST https://{Gateway Domain}/ai/llm/v1/chat/completions \\-H "Authorization:Bearer {API_Key}" \\-H "Content-Type:application/json" \\-d '{"model":"gpt-4o", "messages":[{"role":"user", "content":"Hello"}]}'# Request 2: Route to claude-3-5-sonnet-anthropiccurl -X POST https://{Gateway Domain}/ai/llm/v1/chat/completions \\-H "Authorization:Bearer {API_Key}" \\-H "Content-Type:application/json" \\-d '{"model":"claude-3-5-sonnet", "messages": [{"role": "user", "content": "Hello"}]}'
gpt-4-* series models to the same service.Model Service | Matching Model Name | Rewritten Model Name |
gpt-4-family-openai | gpt-4-* | (Leave blank) |
gpt-3.5-turbo-openai | gpt-3.5-turbo | (Leave blank) |
# Request 1: Match the wildcard rule, route to gpt-4-family-openai, and pass through model=gpt-4o.curl -X POST https://{Gateway Domain}/ai/llm/v1/chat/completions \\-H "Authorization: Bearer {API_Key}" \\-H "Content-Type: application/json" \\-d '{"model": "gpt-4o", "messages": [{"role": "user", "content": "Hello"}]}'# Request 2: Match the wildcard rule, route to gpt-4-family-openai, and pass through model=gpt-4-turbo.curl -X POST https://{Gateway Domain}/ai/llm/v1/chat/completions \\-H "Authorization: Bearer {API_Key}" \\-H "Content-Type: application/json" \\-d '{"model": "gpt-4-turbo", "messages": [{"role": "user", "content": "Hello"}]}'# Request 3: Exact match, route to gpt-3.5-turbo-openai.curl -X POST https://{Gateway Domain}/ai/llm/v1/chat/completions \\-H "Authorization: Bearer {API_Key}" \\-H "Content-Type: application/json" \\-d '{"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Hello"}]}'
Model Service | Matching Model Name | Rewritten Model Name |
gpt-4o-openai | my-custom-gpt4 | gpt-4o |
claude-3-5-sonnet-anthropic | my-custom-claude | claude-3-5-sonnet-20241022 |
# When the client requests model=my-custom-gpt4, the gateway rewrites it to model=gpt-4o during forwarding.curl -X POST https://{Gateway Domain}/ai/llm/v1/chat/completions \\-H "Authorization: Bearer {API_Key}" \\-H "Content-Type: application/json" \\-d '{"model": "my-custom-gpt4", "messages": [{"role": "user", "content": "Hello"}]}'# Request body forwarded to the backend OpenAI service:# {"model": "gpt-4o", "messages": [{"role": "user", "content": "Hello"}]}
model_name_route routing policy is enabled, the gateway starts from the first rule in the configuration list and matches the model parameter in the request in top-down order. The first matching rule takes effect.Order | Model Name Rule | Matching Type | Target Model Service |
1 | gpt-4o | Exact matching | Service A |
2 | gpt-4* | Wildcard matching | Service B |
model=gpt-4o, the first rule is matched and the request is routed to Service A. When a request contains model=gpt-4-turbo, the second rule is matched and the request is routed to Service B.gpt-4* is configured before gpt-4o, a request with model=gpt-4o will first be matched by gpt-4* and then routed to Service B.gpt-4-* is a regular character. This rule can match gpt-4-turbo but cannot match gpt-4o.gpt-* and gpt-4* can match gpt-4o. The model service corresponding to the rule that appears first in the list is used.model parameter but fails to match any configured rules, the gateway returns HTTP 404{"error": {"message": "model 'unknown-model' is not supported by any configured model_name_route rule"}}
model parameter is missing, model is an empty string, or model is not a string, it is considered a request parameter exception and does not fall under the "model name not matched" scenario.Wildcard | Description | Example | Match Result |
* | Matches any character (zero or more) | gpt-4-* | Matches gpt-4-turbo, gpt-4o, and gpt-4-0125-preview |
gpt-* | Prefix matching | gpt-* | Matches all models starting with gpt- |
* can only be used in the matching model name field and is not supported in the rewritten model name field.*.GPT-* does not match gpt-4o.model field in the request body with the value configured for "Rewritten Model Name".Scenario | Matching Model Name | Rewritten Model Name | Client Request model | model Forwarded to Backend |
Pass through the original model | gpt-4o | (Leave blank) | gpt-4o | gpt-4o |
Unify model identifiers | gpt-4-* | gpt-4-turbo-2024-04-09 | gpt-4-turbo | gpt-4-turbo-2024-04-09 |
Custom alias | my-gpt4 | gpt-4o | my-gpt4 | gpt-4o |
{"error": {"code": "model_not_found","message": "Model 'gpt-5' does not exist. Please check whether the model name is correct. Available models: gpt-4o, gpt-4-*, claude-3-5-sonnet","type": "invalid_request_error"}}
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback