OpenRouter supports the OpenAI client, allowing you to use the openai-generic provider with an overridden base_url.

BAML
1client<llm> MyClient {
2 provider "openai-generic"
3 options {
4 base_url "https://openrouter.ai/api/v1"
5 api_key env.OPENROUTER_API_KEY
6 model "openai/gpt-3.5-turbo"
7 headers {
8 "HTTP-Referer" "YOUR-SITE-URL" // Optional
9 "X-Title" "YOUR-TITLE" // Optional
10 }
11 }
12}