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

# GatewayV3MiddlewareOptions

[**@ai-billing/gateway**](../index)

***

[@ai-billing/gateway](/docs/sdk/ai-billing/reference/gateway/typedoc/index) / GatewayV3MiddlewareOptions

# Interface: GatewayV3MiddlewareOptions\<TTags>

Defined in: [gateway/src/ai-sdk/language-model-middleware/v3/language-model-v3-ai-gateway-billing-middleware.ts:69](https://github.com/narevai/ai-billing/blob/main/packages/gateway/src/ai-sdk/language-model-middleware/v3/language-model-v3-ai-gateway-billing-middleware.ts#L69)

Configuration for [createGatewayV3Middleware](/docs/sdk/ai-billing/reference/gateway/typedoc/functions/createGatewayV3Middleware).

The shape matches BaseBillingMiddlewareOptions: `destinations`, `defaultTags`, `waitUntil`, and
`onError`. The gateway middleware does not add provider-specific fields (for example there is no
`priceResolver`). Model cost is read from AI Gateway metadata (`gateway.cost` / `gateway.marketCost` on
the response) rather than from a local pricing table.

## Extends

* `BaseBillingMiddlewareOptions`\<`TTags`>

## Type Parameters

### TTags

`TTags` *extends* `DefaultTags` = `DefaultTags`

The shape of the tags object, extending DefaultTags. Defaults to standard tags.

## Properties

### destinations?

> `optional` **destinations?**: `Destination`\<`TTags`>\[]

Defined in: types/dist/index.d.ts:71

One or more billing destinations that receive each emitted BillingEvent.

#### Inherited from

`BaseBillingMiddlewareOptions.destinations`

***

### defaultTags?

> `optional` **defaultTags?**: `TTags`

Defined in: types/dist/index.d.ts:73

Tags merged into every emitted event.

#### Inherited from

`BaseBillingMiddlewareOptions.defaultTags`

***

### waitUntil?

> `optional` **waitUntil?**: (`promise`) => `void`

Defined in: types/dist/index.d.ts:78

Edge-runtime hook (e.g. `ctx.waitUntil`) used to keep the process alive
while billing events are flushed asynchronously.

#### Parameters

##### promise

`Promise`\<`unknown`>

#### Returns

`void`

#### Inherited from

`BaseBillingMiddlewareOptions.waitUntil`

***

### onError?

> `optional` **onError?**: (`error`) => `void`

Defined in: types/dist/index.d.ts:80

Called when an error occurs during event extraction or dispatch. Defaults to a silent no-op.

#### Parameters

##### error

`unknown`

#### Returns

`void`

#### Inherited from

`BaseBillingMiddlewareOptions.onError`
