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

# Python SDK

> Type-safe Python library for the itellicoAI API

export const Screenshot = ({lightSrc, darkSrc, alt, caption, maxWidth = "880px"}) => {
  return <div style={{
    margin: "1rem auto",
    maxWidth,
    width: "100%"
  }}>
      <Frame>
        <img className="block dark:hidden" src={lightSrc} alt={alt} />
        <img className="hidden dark:block" src={darkSrc} alt={alt} />
      </Frame>
      {caption ? <p style={{
    marginTop: "0.5rem",
    fontSize: "0.875rem",
    color: "inherit",
    opacity: 0.8
  }}>
          {caption}
        </p> : null}
    </div>;
};

## Installation

<CodeGroup>
  ```bash pip theme={null}
  pip install itellicoai
  ```

  ```bash poetry theme={null}
  poetry add itellicoai
  ```
</CodeGroup>

## Requirements

* Python 3.9+
* Supports both sync and async operations

***

## Get Your API Key

To use the SDK, you will need an API key from your [itellicoAI dashboard](https://app.itellico.ai):

<Steps>
  <Step title="Navigate to API Keys">
    Go to **Developers → API Keys**
  </Step>

  <Step title="Create Key">
    Click **Create API Key**
  </Step>

  <Step title="Copy Key">
    Copy the generated key — it is only shown once
  </Step>
</Steps>

<Screenshot lightSrc="/images/accounts__api-keys-light.png" darkSrc="/images/accounts__api-keys-dark.png" alt="API Keys management page" />

<Warning>
  Store your API key securely using environment variables. Never commit it to version control.
</Warning>

***

## Quick Start

```python theme={null}
from itellicoai import Itellicoai

# Initialize client
client = Itellicoai(
    api_key="your-api-key"
)

# Create an agent
agent = client.agents.create(
    account_id="your-account-id",
    name="Customer Support Agent",
    model={
        "provider": "openai",
        "model": "gpt-4o-mini"
    },
    voice={
        "provider": "elevenlabs",
        "voice_id": "EXAVITQu4vr4xnSDxMaL"
    },
    transcriber={
        "provider": "deepgram",
        "model": "nova-2:general",
        "language": "en-US"
    },
    initial_message={
        "mode": "fixed_message",
        "message": "Hello! How can I assist you today?",
        "delay_ms": 1000
    },
    max_duration_seconds=1800,
    tags=["support", "customer-service"]
)

print(f"Created agent: {agent.id}")
```

***

## Async Support

```python theme={null}
import asyncio
from itellicoai import AsyncItellicoai

async def main():
    client = AsyncItellicoai(api_key="your-api-key")

    # List agents asynchronously
    agents = await client.agents.list("account_id")

    for agent in agents.items:
        print(f"Agent: {agent.name}")

asyncio.run(main())
```

***

## SDK Operations

<AccordionGroup>
  <Accordion title="Agent Management" defaultOpen>
    ### List Agents

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )
    agents = client.agents.list(
        account_id="account_id",
    )
    print(agents.count)
    ```

    ### Retrieve Agent

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )
    agent_response = client.agents.retrieve(
        agent_id="agent_id",
        account_id="account_id",
    )
    print(agent_response.id)
    ```

    ### Update Agent

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )
    agent_response = client.agents.update(
        agent_id="agent_id",
        account_id="account_id",
    )
    print(agent_response.id)
    ```

    ### Archive Agent

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )
    client.agents.archive(
        agent_id="agent_id",
        account_id="account_id",
    )
    ```
  </Accordion>

  <Accordion title="Conversations">
    ### List Conversations

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(api_key="My API Key")

    conversations = client.accounts.list_conversations(
        account_id="account_id"
    )

    for conv in conversations.items:
        print(f"Conversation ID: {conv.conversation_id}")
        print(f"Contact: {conv.contact_number}")
        print(f"Duration: {conv.duration_seconds}s")
        print(f"Status: {conv.status}")
    ```
  </Accordion>

  <Accordion title="Phone Numbers">
    ### List Phone Numbers

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )
    phone_numbers = client.accounts.phone_numbers.list(
        account_id="account_id",
    )
    print(phone_numbers.count)
    ```

    ### Create Phone Number

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )
    phone_number = client.accounts.phone_numbers.create(
        account_id="account_id",
        sip_trunk_id="sip_trunk_id",
    )
    print(phone_number.id)
    ```

    ### Get Phone Number

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )
    phone_number = client.accounts.phone_numbers.retrieve(
        phone_number_id="phone_number_id",
        account_id="account_id",
    )
    print(phone_number.id)
    ```

    ### Update Phone Number

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )
    phone_number = client.accounts.phone_numbers.update(
        phone_number_id="phone_number_id",
        account_id="account_id",
    )
    print(phone_number.id)
    ```

    ### Delete Phone Number

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )
    client.accounts.phone_numbers.delete(
        phone_number_id="phone_number_id",
        account_id="account_id",
    )
    ```
  </Accordion>

  <Accordion title="Providers">
    ### List Models

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )

    response = client.accounts.providers.list_models(
        account_id="account_id",
    )
    print(response)
    ```

    ### List Transcribers

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )

    response = client.accounts.providers.list_transcribers(
        account_id="account_id",
    )
    print(response)
    ```

    ### List Voices

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )

    response = client.accounts.providers.list_voices(
        account_id="account_id",
        provider="provider",
    )
    print(response)
    ```
  </Accordion>

  <Accordion title="SIP Trunks">
    ### List SIP Trunks

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )

    sip_trunks = client.accounts.sip_trunks.list(
        account_id="account_id",
    )
    print(sip_trunks.count)
    ```

    ### Create SIP Trunk

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )

    sip_trunk = client.accounts.sip_trunks.create(
        account_id="account_id",
    )
    print(sip_trunk.id)
    ```

    ### Get SIP Trunk

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )

    sip_trunk = client.accounts.sip_trunks.retrieve(
        sip_trunk_id="sip_trunk_id",
        account_id="account_id",
    )
    print(sip_trunk.id)
    ```

    ### Update SIP Trunk

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )

    sip_trunk = client.accounts.sip_trunks.update(
        sip_trunk_id="sip_trunk_id",
        account_id="account_id",
    )
    print(sip_trunk.id)
    ```

    ### Delete SIP Trunk

    ```python theme={null}
    from itellicoai import Itellicoai

    client = Itellicoai(
        api_key="My API Key",
    )

    client.accounts.sip_trunks.delete(
        sip_trunk_id="sip_trunk_id",
        account_id="account_id",
    )
    ```
  </Accordion>

  <Accordion title="Analytics">
    ### Get Usage Analytics

    ```python theme={null}
    response = client.accounts.analytics.get_usage(
        account_id="account_id",
    )
    print(response.meta)
    ```
  </Accordion>

  <Accordion title="Subaccounts">
    ### List Subaccounts

    ```python theme={null}
    subaccounts = client.accounts.subaccounts.list(
        account_id="account_id",
    )
    print(subaccounts.count)
    ```

    ### Create Subaccount

    ```python theme={null}
    account = client.accounts.subaccounts.create(
        account_id="account_id",
        name="name",
    )
    print(account.id)
    ```

    ### Get Subaccount

    ```python theme={null}
    account = client.accounts.subaccounts.retrieve(
        subaccount_id="subaccount_id",
        account_id="account_id",
    )
    print(account.id)
    ```

    ### Update Subaccount

    ```python theme={null}
    account = client.accounts.subaccounts.update(
        subaccount_id="subaccount_id",
        account_id="account_id",
    )
    print(account.id)
    ```
  </Accordion>
</AccordionGroup>

***

## Error Handling

```python theme={null}
from itellicoai import Itellicoai
import itellicoai

client = Itellicoai(api_key="your-api-key")

try:
    agent = client.agents.retrieve("agent_123abc", account_id="account_id")
except itellicoai.AuthenticationError:
    print("Invalid API key")
except itellicoai.NotFoundError:
    print("Agent not found")
except itellicoai.RateLimitError:
    print("Rate limit exceeded")
except itellicoai.APIStatusError as e:
    print(f"API error: {e.status_code}")
```

***

## Environment Variables

```python theme={null}
import os
from itellicoai import Itellicoai

# API key automatically loaded from ITELLICOAI_API_KEY env var
client = Itellicoai()

# Or set explicitly
client = Itellicoai(api_key=os.getenv("ITELLICOAI_API_KEY"))
```

***

## Resources

<CardGroup cols={2}>
  <Card title="PyPI Package" icon="python" href="https://pypi.org/project/itellicoai/">
    Install from PyPI
  </Card>

  <Card title="GitHub Repository" icon="github" href="https://github.com/itellicoAI/server-sdk-python">
    View source code on GitHub
  </Card>

  <Card title="API Reference" icon="book" href="/api-reference/introduction">
    Browse REST API documentation
  </Card>
</CardGroup>
