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

# SDKs Overview

> Official SDKs for JavaScript, Python, and CLI

# SDKs

PolarGrid provides official SDKs to make integration easy.

> [card] [JavaScript](https://polargrid.mintlify.site/sdks/javascript/quickstart.md)
>
> For Node.js and browser applications

> [card] [Python](https://polargrid.mintlify.site/sdks/python/quickstart.md)
>
> Async and sync clients with full type hints

> [card] [CLI](https://polargrid.mintlify.site/sdks/cli/quickstart.md)
>
> Command-line interface for scripting and CI/CD

## Installation

```bash JavaScript theme={null}
npm install @polargrid/polargrid-sdk
```

```bash Python theme={null}
pip install polargrid-sdk
```

```bash CLI theme={null}
npm install -g @polargrid/cli
```

## Features

All SDKs include:

| Feature | JS | Python | CLI |
| - | :-: | :-: | :-: |
| Chat completions | ✅ | ✅ | ✅ |
| Text completions | ✅ | ✅ | — |
| Streaming | ✅ | ✅ | — |
| Text-to-Speech | ✅ | ✅ | — |
| Speech-to-Text | ✅ | ✅ | — |
| Model management | ✅ | ✅ | — |
| GPU management | ✅ | ✅ | — |
| Auto-routing | ✅ | ✅ | ✅ |
| Mock mode | ✅ | ✅ | — |
| Full TypeScript/Pydantic types | ✅ | ✅ | — |
| Async | ✅ | ✅ | — |
| Sync | — | ✅ | ✅ |

## Quick Example

```javascript JavaScript theme={null}
import { PolarGrid } from '@polargrid/polargrid-sdk';

// Auto-select best region
const client = await PolarGrid.create({
  apiKey: process.env.POLARGRID_API_KEY,
});

const response = await client.chatCompletion({
  model: 'qwen-3.8-27b',
  messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(response.choices[0].message.content);
```

```python Python theme={null}
import os
from polargrid import PolarGrid

# Auto-select best region
client = await PolarGrid.create(api_key=os.environ["POLARGRID_API_KEY"])

response = await client.chat_completion({
    "model": "qwen-3.8-27b",
    "messages": [{"role": "user", "content": "Hello!"}],
})

print(response.choices[0].message.content)
```

```bash CLI theme={null}
export POLARGRID_API_KEY="pg_your_key"
polargrid test inference --region toronto --prompt "Hello!"
```

## Authentication

All SDKs support these authentication methods:

1. **Constructor parameter**: Pass `apiKey` / `api_key` directly
2. **Environment variable**: Set `POLARGRID_API_KEY`

```bash theme={null}
export POLARGRID_API_KEY="pg_your_api_key"
```

Get your API key from the [Console](https://app.polargrid.ai/dashboard/settings?tab=api-keys).


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