gearConfiguration

Configure SDK clients with API keys, regional endpoints, and environment variable support.

This guide covers configuring the Amigo SDK clients with the required authentication credentials and optional settings.

Configuration Parameters

Both SDKs require the following configuration parameters:

Parameter
Python SDK
TypeScript SDK
Required
Description

API Key

api_key

apiKey

API key from Amigo dashboard

API Key ID

api_key_id

apiKeyId

API key ID from Amigo dashboard

User ID

user_id

userId

User ID on whose behalf requests are made

Organization ID

organization_id

orgId

Your organization ID

Base URL

base_url

baseUrl

API base URL (defaults to https://api.amigo.ai)

Creating SDK Clients

The Python SDK supports both context manager and direct instantiation patterns:

from amigo_sdk import AmigoClient

# Using context manager for automatic resource cleanup
with AmigoClient(
    api_key="your-api-key",
    api_key_id="your-api-key-id",
    user_id="user-123",
    organization_id="org-456",
    base_url="https://api.amigo.ai"  # optional
) as client:
    # Use the client
    org = client.organizations.get()
    print(f"Organization: {org.name}")

Direct Instantiation

from amigo_sdk import AmigoClient

# Direct instantiation - remember to handle cleanup manually
client = AmigoClient(
    api_key="your-api-key",
    api_key_id="your-api-key-id",
    user_id="user-123",
    organization_id="org-456"
)

try:
    org = client.organizations.get()
    print(f"Organization: {org.name}")
finally:
    # Cleanup resources
    client.close()

Regional Base URLs

Use the base URL that matches your organization’s region:

  • US: https://api.amigo.ai

  • CA: https://api-ca-central-1.amigo.ai

  • EU: https://api-eu-central-1.amigo.ai

  • AU: https://api-ap-southeast-2.amigo.ai

Set this via base_url (Python) or baseUrl (TypeScript), or with AMIGO_BASE_URL.

See Regions & Endpoints for full guidance and cURL examples.

Environment Variable Configuration

The Python SDK can automatically load configuration from environment variables:

Supported environment variables for Python:

  • AMIGO_API_KEY

  • AMIGO_API_KEY_ID

  • AMIGO_USER_ID

  • AMIGO_ORGANIZATION_ID

  • AMIGO_BASE_URL

Getting Your Credentials

API Key & API Key ID

You can generate API credentials in two ways:

Option 1: Admin Dashboard

  1. Log in to your service account

  2. Navigate to https://<your-org-id>.amigo.ai/admin/settings

  3. Click "Create API Key" and select a duration

  4. Securely store both the API key and key ID

Option 2: Programmatic Generation

Use the API to create keys programmatically. See the Authentication Guidearrow-up-right for detailed instructions.

Organization ID

Your organization ID can be found in:

  • Your Amigo dashboard URL: https://<your-org-id>.amigo.ai

  • Organization settings in the admin dashboard

  • The response from user creation endpoints

User ID

The User ID represents the user on whose behalf API calls are made:

  • Use the ID returned when creating users via the API

  • Found in the user management section of the admin dashboard

  • Required for user impersonation and conversation management

Configuration Best Practices

Security

  • Never commit credentials: Use environment variables or secure secret management

  • Rotate API keys regularly: Set expiration dates and rotate before expiry

  • Use service accounts: Create dedicated service accounts for applications

  • Limit permissions: API keys inherit the permissions of their creator

Environment Management

Create separate configurations for different environments:

Configuration Validation

Both SDKs will validate configuration parameters at initialization:

Next Steps

Once you have configured your SDK client, you're ready to:

Last updated

Was this helpful?