> ## Documentation Index > Fetch the complete documentation index at: https://openrouter.ai/docs/llms.txt > Use this file to discover all available pages before exploring further. # Options ## Global Options Global options are passed when initializing the SDK client and apply to all operations. ### WithServerURL WithServerURL allows providing an alternative server URL. ```go theme={null} openrouter.WithServerURL("https://api.example.com") ``` ### WithTemplatedServerURL WithTemplatedServerURL allows providing an alternative server URL with templated parameters. ```go theme={null} openrouter.WithTemplatedServerURL("https://{host}:{port}", map[string]string{ "host": "api.example.com", "port": "8080", }) ``` ### WithServer WithServer allows the overriding of the default server by name. ```go theme={null} openrouter.WithServer("my-server") ``` ### WithClient WithClient allows the overriding of the default HTTP client used by the SDK. ```go theme={null} openrouter.WithClient(httpClient) ``` ### WithSecurity WithSecurity configures the SDK to use the provided security details. ```go theme={null} openrouter.WithSecurity(/* ... */) ``` ### WithSecuritySource WithSecuritySource configures the SDK to invoke the provided function on each method call to determine authentication. ```go theme={null} openrouter.WithSecuritySource(/* ... */) ``` ### WithHTTPReferer WithHTTPReferer allows setting the HTTPReferer parameter for all supported operations. ```go theme={null} openrouter.WithHTTPReferer(/* ... */) ``` ### WithXTitle WithXTitle allows setting the XTitle parameter for all supported operations. ```go theme={null} openrouter.WithXTitle(/* ... */) ``` ### WithRetryConfig WithRetryConfig allows setting the default retry configuration used by the SDK for all supported operations. ```go theme={null} openrouter.WithRetryConfig(retry.Config{ Strategy: "backoff", Backoff: retry.BackoffStrategy{ InitialInterval: 500 * time.Millisecond, MaxInterval: 60 * time.Second, Exponent: 1.5, MaxElapsedTime: 5 * time.Minute, }, RetryConnectionErrors: true, }) ``` ### WithTimeout WithTimeout sets the default request timeout for all operations. ```go theme={null} openrouter.WithTimeout(30 * time.Second) ``` ## Per-Method Options Per-method options are passed as the last argument to individual methods and override any global settings for that request. ### WithServerURL WithServerURL allows providing an alternative server URL for a single request. ```go theme={null} operations.WithServerURL("http://api.example.com") ``` ### WithTemplatedServerURL WithTemplatedServerURL allows providing an alternative server URL with templated parameters for a single request. ```go theme={null} operations.WithTemplatedServerURL("http://{host}:{port}", map[string]string{ "host": "api.example.com", "port": "8080", }) ``` ### WithRetries WithRetries allows customizing the default retry configuration for a single request. ```go theme={null} operations.WithRetries(retry.Config{ Strategy: "backoff", Backoff: retry.BackoffStrategy{ InitialInterval: 500 * time.Millisecond, MaxInterval: 60 * time.Second, Exponent: 1.5, MaxElapsedTime: 5 * time.Minute, }, RetryConnectionErrors: true, }) ``` ### WithOperationTimeout WithOperationTimeout allows setting the request timeout for a single request. ```go theme={null} operations.WithOperationTimeout(30 * time.Second) ``` ### WithSetHeaders WithSetHeaders allows setting custom headers on a per-request basis. If the request already contains headers matching the provided keys, they will be overwritten. ```go theme={null} operations.WithSetHeaders(map[string]string{ "X-Cache-TTL": "60", }) ``` ### WithURLOverride WithURLOverride allows overriding the default URL for an operation. ```go theme={null} operations.WithURLOverride("/custom/path") ``` ### WithAcceptHeaderOverride WithAcceptHeaderOverride allows overriding the `Accept` header for operations that support multiple response content types. ```go theme={null} operations.WithAcceptHeaderOverride(operations.AcceptHeaderEnumApplicationJson) ```