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

# Connections

> Reuse one connection for every request, and where we run.

Opening an HTTPS connection costs two round trips before your request is sent. On
an order that is dead time, and it is the single largest thing you control.

## Reuse one connection

Create one client when your process starts and reuse it, rather than creating
one per request.

The Python SDK holds its connection open for you from 3.2.3, with nothing to set:

```python Python theme={null}
from parlayx import ParlayX

client = ParlayX()
```

On the TypeScript SDK, from 1.4.3, it is an option, because the setting it needs
is process-wide and we will not reach into a transport you configured yourself:

```ts TypeScript theme={null}
import { createClient } from "@parlayx/sdk";

const client = createClient({
  keyId: process.env.PARLAYX_KEY_ID!,
  privateKeyHex: process.env.PARLAYX_PRIVATE_KEY_HEX!,
  keepAliveConnections: true,
});
```

Leave it off if you reach us through a proxy or with custom TLS, and set the
idle timeout on your own transport instead.

## On your own HTTP client

We advertise no keep-alive, so whatever your client does by default is what
happens. Most hang up after a few seconds of quiet, which means a request sent
after a pause pays for a new connection.

Raise your idle timeout to **50 seconds** and reuse one client. We hold an idle
connection for at least 90 seconds, so 50 leaves room. Nothing breaks if you go
higher or lower; you simply pay for more reconnects.

## Where we run

The API is served from edge locations worldwide, so your TLS handshake finishes
near you wherever you are. Orders are then routed from **US East (Ohio)**.

If you run your own infrastructure and latency is what you care about most, place
it in that region. A client already there, holding its connection open, is as
close to us as you can get.


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