By default the SDK sends all requests toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/openrouter/llms.txt
Use this file to discover all available pages before exploring further.
https://openrouter.ai/api/v1. This base URL can be overridden when you need to route traffic through a proxy in front of the OpenRouter API, or when running tests against a local mock server.
Default URL
The default base URL is declared as a constant onOpenRouterOptions:
Override via environment variable
SetOPENROUTER_BASE_URL in your environment or .env file to replace the default for all requests:
Env::loadOptionalSetting() inside OpenRouterOptions::fromArray(), so no code changes are required.
Override via config array
You can also supply the base URL programmatically when callingOpenRouter::create():
Trailing slash handling
Trailing slashes are stripped automatically. Internally the SDK callsUrl::withoutTrailingSlash() on whatever value you provide, so https://your-proxy.example.com/api/v1/ and https://your-proxy.example.com/api/v1 are treated identically.
Appended endpoints
The SDK appends a fixed path segment to the base URL depending on the operation being performed:| Operation | Path appended | Full default URL |
|---|---|---|
| Text generation | /chat/completions | https://openrouter.ai/api/v1/chat/completions |
| Image generation | /images | https://openrouter.ai/api/v1/images |
Changing the base URL is only necessary when using an OpenRouter-compatible proxy or during local testing with a mock server. Leave it at the default for standard usage against the OpenRouter API.