Welcome to Portkey Forum

Updated 6 days ago

Configuring Retry Behavior in a Nested Object

Also when I added retry to the nested object as follows:

Plain Text
{
    "strategy": {
        "mode": "fallback",
        "on_status_codes": [
            401,
            500,
            503,
            520,
            524
        ]
    },
    "request_timeout": 360000,
    "targets": [
        {
            "virtual_key": "open-ai-virtual-xxxx",
            "override_params": {
                "model": "gpt-4o-2024-08-06"
            },
            "request_timeout": 12,
            "retry": {
                "attempts": 1,
                "on_status_codes": [
                    429,
                    408
                ]
            }
        },
        {
            "virtual_key": "anthropic-api-k-xxxx",
            "override_params": {
                "model": "claude-3-7-sonnet-20250219"
            },
            "request_timeout": 120000
        },
        {
            "virtual_key": "anthropic-api-k-xxxx",
            "override_params": {
                "model": "claude-3-5-sonnet-20241022"
            },
            "request_timeout": 120000
        }
    ],
    "cache": {
        "mode": "simple",
        "max_age": 6
    }
}
....

also, when I play with the retry number, I definitely observe setting it to 3 takes long for it to fallback to anthropic, but the portkey UI only shows one log for gpt-4 and one for claude, there is on information available on retries.
v
A
2 comments
Hey, retries are not logged separately. So all the retries will be logged as a single request. The log should highlight if any retries were triggered.

In case of fallbacks, each request is logged individually.

In this case, the first target (open-ai-virtual-xxxx) will be retried 3 times with exponential backoff before it falls back to second target (anthropic-api-k-xxxx)
Attachment
Screenshot_2025-03-02_at_22.37.36.png
got it makes sense .
Add a reply
Sign up and join the conversation on Discord