# OpenRouter

You can configure the OpenAI provider to use the [OpenRouter](https://openrouter.ai/docs/quick-start) service instead by setting the `OPENAI_API_BASE` to `https://openrouter.ai/api/v1`. You will also need an [api key](https://openrouter.ai/settings/keys).

.env

```txt
OPENAI_API_BASE=https://openrouter.ai/api/v1
OPENAI_API_KEY=...
```

Then use the OpenRouter model name in your script:

```js
script({ model: "openai:openai/gpt-4o-mini" });
```

By default, GenAIScript will set the site URL and name to `GenAIScript` but you can override these settings with your own values:

.env

```txt
OPENROUTER_SITE_URL=... # populates HTTP-Referer header
OPENROUTER_SITE_NAME=... # populate X-Title header
```