> For the complete documentation index, see [llms.txt](https://docs.degirum.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.degirum.com/degirumjs/guides/connection-modes.md).

# Architecture and Connection Modes

DeGirumJS offers flexible connection modes to cater to various AI inference needs, whether you're running models locally on an AI Server, entirely in the cloud, or a hybrid approach.

## Connection Modes

DeGirumJS offers three easy ways to connect for AI inference:

### Local Server

Inference runs on your own AI Server (e.g., on your machine or LAN). No internet needed, but you do need your own model zoo ready.

{% code overflow="wrap" %}

```js
const dg = new dg_sdk();
const zoo = await dg.connect('localhost:8779'); // IP/Port of an AI Server on your network
const models = await zoo.listModels();
console.log('Local models:', Object.keys(models));
```

{% endcode %}

### Hybrid (Local + Cloud Models)

Inference still runs on your local AI Server, but models are loaded from the DeGirum Cloud Zoo.

{% code overflow="wrap" %}

```js
const dg = new dg_sdk();
const zoo = await dg.connect(
  'localhost:8779',                         // IP/Port of an AI Server on your network
  'https://cs.degirum.com/degirum/public', // or another Cloud Zoo URL from AI Hub
  'YOUR_TOKEN'                              // your AI Hub access token
);
const models = await zoo.listModels();
console.log('Cloud models via local server:', Object.keys(models));
```

{% endcode %}

### Cloud Only

Everything runs in the DeGirum Cloud - ideal for scalable, managed inference.

{% code overflow="wrap" %}

```js
const dg = new dg_sdk();
const zoo = await dg.connect(
  'cloud',
  'https://cs.degirum.com/degirum/public',  // or another Cloud Zoo URL from AI Hub
  'YOUR_TOKEN'                              // your AI Hub access token
);
const models = await zoo.listModels();
console.log('Cloud models:', Object.keys(models));
```

{% endcode %}

***

For more information on setting up your AI Server, refer to the [AI Server documentation](https://docs.degirum.com/pysdk/user-guide-pysdk/setting-up-an-ai-server)
