> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# close

> Close the AI chat client, when the gateway built it.

[chatgateway]: /docs/server-sdks/reference/typescript/agents/chat-gateway

[aichatclient]: /docs/server-sdks/reference/typescript/agents/ai-chat-client

Closes the [`AIChatClient`][aichatclient] the gateway built from the environment. A client you
passed to the constructor belongs to you and is left open. Call `close()` once, when the process
shuts down.

## Parameters

None.

## Returns

`Promise<void>`.

## Examples

```typescript
import { ChatGateway } from '@signalwire/sdk';

const gateway = new ChatGateway({
  configUrl: 'https://bayview-taxi.example.com/dispatch',
  key: '<YOUR_PUBLISHABLE_KEY>',
});

process.on('SIGTERM', async () => {
  await gateway.close();
  process.exit(0);
});
```