> ## Documentation Index
> Fetch the complete documentation index at: https://www.narev.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# CreateChatRouter

[**@ai-billing/nextjs**](https://www.narev.ai/docs/ai-billing/reference/nextjs/typedoc/index.md)

***

[@ai-billing/nextjs](https://www.narev.ai/docs/ai-billing/reference/nextjs/typedoc/index.md) / [server](https://www.narev.ai/docs/ai-billing/reference/nextjs/typedoc/server/index) / createChatRouter

# Function: createChatRouter()

> **createChatRouter**(`options?`): `Promise`\<\{ `getProviders`: () => `ProviderEntry`\[]; `getModels`: () => `ModelOption`\[]; `getModel`: (`modelId`) => `LanguageModel`; }>

Defined in: [packages/nextjs/src/chat/router.ts:63](https://github.com/narevai/ai-billing/blob/main/packages/nextjs/src/chat/router.ts#L63)

Creates and initialises the chat router with all configured providers.
Providers are enabled automatically when their API key env var is set.

## Parameters

### options?

[`ChatRouterOptions`](https://www.narev.ai/docs/ai-billing/reference/nextjs/typedoc/server/interfaces/ChatRouterOptions) = `{}`

Router configuration; see [ChatRouterOptions](https://www.narev.ai/docs/ai-billing/reference/nextjs/typedoc/server/interfaces/ChatRouterOptions.md).

## Returns

`Promise`\<\{ `getProviders`: () => `ProviderEntry`\[]; `getModels`: () => `ModelOption`\[]; `getModel`: (`modelId`) => `LanguageModel`; }>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.