Skip to content
Ask
Reference

Gateway Provider Reference

OpenRouter and Requesty configuration, attribution headers, reasoning controls, usage telemetry, and shared OpenAI tool encoding.

OpenRouter and Requesty are OpenAI-compatible gateway providers. Both are built on the shared OpenAI-compatible client and add gateway-specific defaults for reasoning, usage, and telemetry.

Factories

TS
import { openrouterModelClient } from '@inbrowser/model/providers/openrouter';
import { requestyModelClient } from '@inbrowser/model/providers/requesty';
FactoryEndpointClient id
openrouterModelClient(config)https://openrouter.ai/api/v1/chat/completionsopenrouter:${config.model}
requestyModelClient(config)https://router.requesty.ai/v1/chat/completionsrequesty:${config.model}

Both factories return a ModelClient.

Config

Both providers accept the shared cloud-provider fields:

FieldDescription
apiKeyBearer token sent to the gateway.
modelGateway model id.
reasoningEffortoff, low, medium, or high, when the gateway supports reasoning controls.

They also accept optional app attribution:

TS
const client = openrouterModelClient({
  apiKey,
  model: 'openai/gpt-4.1-mini',
  appAttribution: {
    referer: 'https://example.com',
    title: 'Example Builder',
  },
});

appAttribution.referer becomes HTTP-Referer. appAttribution.title becomes X-Title. No attribution headers are sent unless you pass them.

Reasoning controls

Gateway providers use OpenRouter-compatible reasoning fields:

reasoningEffortRequest fields
offreasoning: { enabled: false }
low, medium, highreasoning: { effort, summary: 'auto' } and include_reasoning: true

Reasoning stream deltas are surfaced as ModelEvent values with kind: 'thinking' when the gateway sends reasoning or reasoning_content delta fields.

Usage telemetry

Both gateway providers request included usage details and preserve provider telemetry in ModelUsage:

Usage fieldSource
promptTokensusage.prompt_tokens
outputTokensusage.completion_tokens
cachedTokensusage.prompt_tokens_details.cached_tokens
reasoningTokensusage.completion_tokens_details.reasoning_tokens
costUsdusage.cost

Fields are omitted when the provider does not report them.

Tool encoding

OpenRouter and Requesty share the same nested OpenAI tool encoding. A ToolSpec becomes:

TS
{
  type: 'function',
  function: {
    name: tool.name,
    description: tool.description,
    parameters: tool.parameters,
  },
}

The shared encoding keeps gateway providers aligned when new tool metadata is added to the model contract.