Skip to Content
Client SDKGet gateway configuration

Get gateway configuration

Use client.gateway.providerConfiguration() when another library needs to send requests through the Preternatural gateway.

The method returns the gateway base URL, authenticated request headers, and the fetch implementation configured on the Client SDK.

Create an authenticated configuration

import { ServiceProvider } from '@preternatural-js/client-sdk' const gateway = await client.gateway.providerConfiguration({ provider: ServiceProvider.openai, modelIdentifier: 'gpt-4o-mini', productId: 'your-product-id' })

The result has this shape:

type ProviderGatewayConfiguration = { baseURL: string headers: Record<string, string> fetchImpl: typeof fetch }

The baseURL depends on the provider. For OpenAI, it ends in /v1, and the OpenAI SDK appends /chat/completions. For Anthropic, it is the gateway origin, and the Anthropic SDK appends /v1/messages. Pass the returned baseURL to either SDK without changing it.