useOnlineShortcut method

OpenRouterBuilder useOnlineShortcut(
  1. bool enabled
)

Enables or disables the online shortcut feature

When enabled, you can simply add :online to the model name to enable web search without additional configuration.

Example:

// With online shortcut enabled (default)
final provider = await ai()
    .openRouter((openrouter) => openrouter
        .useOnlineShortcut(true))
    .apiKey(apiKey)
    .model('anthropic/claude-3.5-sonnet:online')
    .build();

Implementation

OpenRouterBuilder useOnlineShortcut(bool enabled) {
  _baseBuilder.extension('useOnlineShortcut', enabled);
  return this;
}