Skip to main content
Cascade detects OpenRouter as an OpenAI-compatible client. Use the standard OpenAI client with the OpenRouter base URL, then wrap it with Cascade.

Setup

Usage

Custom OpenAI-compatible APIs

The same approach works for any OpenAI-compatible API:
The wrapped client behaves identically to the original. All existing method calls, attributes, and patterns continue to work. The only difference is that LLM calls now produce spans in your Cascade traces.
If the SDK does not recognize a client type, it returns the client unwrapped with a warning. LLM calls will still work but won’t be traced.