# Installation

This guide covers installing the Amigo SDK in your Python or TypeScript/JavaScript project.

{% hint style="warning" %}
**Classic API only** - These SDKs are for the Classic API. Platform API developers should use direct HTTP requests.
{% endhint %}

{% tabs %}
{% tab title="Python" %}

#### Requirements

* Python 3.11 or higher
* pip (Python package manager)

#### Install from PyPI

Install the latest version of the Python SDK using pip:

```bash
pip install amigo_sdk
```

#### Add to requirements.txt

For reproducible builds, add the SDK to your `requirements.txt` file:

```txt
amigo_sdk
```

Then install dependencies:

```bash
pip install -r requirements.txt
```

#### Virtual Environment (Recommended)

We recommend using a virtual environment to avoid dependency conflicts:

```bash
# Create virtual environment
python -m venv amigo-env

# Activate virtual environment
# On macOS/Linux:
source amigo-env/bin/activate
# On Windows:
amigo-env\Scripts\activate

# Install SDK
pip install amigo_sdk
```

#### Verify Installation

Verify the installation by importing the SDK:

```python
from amigo_sdk import AmigoClient
print("Amigo Python SDK installed successfully!")
```

{% endtab %}

{% tab title="TypeScript" %}

#### Requirements

* Node.js 18 or higher
* npm or yarn package manager

#### Install from npm

Install the latest version of the TypeScript SDK:

```bash
npm install @amigo-ai/sdk
```

#### Add to package.json

The SDK will be automatically added to your `package.json` dependencies:

```json
{
  "dependencies": {
    "@amigo-ai/sdk": "^1.0.0"
  }
}
```

#### TypeScript Configuration

If you're using TypeScript, ensure your `tsconfig.json` includes:

```json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  }
}
```

#### Verify Installation

Verify the installation by importing the SDK:

```typescript
import { AmigoClient } from '@amigo-ai/sdk'
console.log('Amigo TypeScript SDK installed successfully!')
```

{% endtab %}
{% endtabs %}

## Configuration Setup

Both SDKs support initialization with configuration parameters passed directly to the client constructor.

{% hint style="info" %}
**Regional Endpoints**\
Ensure you set the correct regional base URL for your organization. See [Regions & Endpoints](https://docs.amigo.ai/developer-guide/getting-started/regions-and-endpoints).
{% endhint %}

{% tabs %}
{% tab title="Python" %}

```python
from amigo_sdk import AmigoClient

# Initialize with configuration parameters
with AmigoClient(
    api_key="your-api-key",
    api_key_id="your-api-key-id",
    user_id="user-id",
    organization_id="your-organization-id",
    base_url="https://api.amigo.ai"  # optional
) as client:
    # Use the client
    pass
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import { AmigoClient } from '@amigo-ai/sdk'

// Initialize with configuration parameters
const client = new AmigoClient({
  apiKey: 'your-api-key',
  apiKeyId: 'your-api-key-id',
  userId: 'user-id',
  orgId: 'your-organization-id',
  baseUrl: 'https://api.amigo.ai' // optional
})
```

{% endtab %}
{% endtabs %}

## Environment Variables

For enhanced security, use environment variables for configuration. Create a `.env` file in your project root:

```env
AMIGO_API_KEY=your-api-key
AMIGO_API_KEY_ID=your-api-key-id
AMIGO_USER_ID=user-id
AMIGO_ORGANIZATION_ID=your-organization-id
AMIGO_BASE_URL=https://api.amigo.ai
```

{% tabs %}
{% tab title="Python" %}
Install `python-dotenv` to load environment variables:

```bash
pip install python-dotenv
```

Then load them in your application:

```python
from dotenv import load_dotenv
load_dotenv()

from amigo_sdk import AmigoClient

# Automatically loads from environment variables
with AmigoClient() as client:
    pass
```

{% endtab %}

{% tab title="TypeScript" %}
Install `dotenv`:

```bash
npm install dotenv
```

Then load them in your application:

```typescript
import 'dotenv/config'
import { AmigoClient } from '@amigo-ai/sdk'

// For TypeScript, you still need to pass config explicitly
const client = new AmigoClient({
  apiKey: process.env.AMIGO_API_KEY!,
  apiKeyId: process.env.AMIGO_API_KEY_ID!,
  userId: process.env.AMIGO_USER_ID!,
  orgId: process.env.AMIGO_ORGANIZATION_ID!,
})
```

{% endtab %}
{% endtabs %}

## Next Steps

Once you have the SDK installed, proceed to:

* [**SDK Configuration**](https://docs.amigo.ai/developer-guide/classic-api/sdks/sdk-configuration) - Configure authentication and client options
* [**Hello World Example**](https://docs.amigo.ai/developer-guide/classic-api/sdks/sdk-hello-world) - Create your first conversation
