Installation
Prérequis
Python 3.8+
Support des opérations synchrones et asynchrones
Obtenir Votre Clé API
Pour utiliser le SDK, vous aurez besoin d’une clé API depuis votre tableau de bord itellicoAI :
Accédez à Développeurs depuis la barre latérale
Cliquez sur Clés API
Cliquez sur Créer une Clé API
Copiez la clé générée pour l’utiliser avec le SDK
Stockez votre clé API en toute sécurité en utilisant des variables d’environnement. Ne la commitez jamais dans le contrôle de version.
Démarrage Rapide
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 } " )
Support Async
import asyncio
from itellicoai import AsyncItellicoAI
async def main ():
client = AsyncItellicoAI( api_key = "your-api-key" )
# List agents asynchronously
agents = await client.agents.list()
for agent in agents:
print ( f "Agent: { agent.name } " )
asyncio.run(main())
Opérations du SDK
Lister les Agents from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
agents = client.agents.list(
account_id = "account_id" ,
)
print (agents.count)
Récupérer un Agent 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)
Mettre à Jour un Agent 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)
Archiver un Agent from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
client.agents.archive(
agent_id = "agent_id" ,
account_id = "account_id" ,
)
Lister les Conversations 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 } " )
Lister les Numéros de Téléphone 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)
Créer un Numéro de Téléphone 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)
Obtenir un Numéro de Téléphone 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)
Mettre à Jour un Numéro de Téléphone 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)
Supprimer un Numéro de Téléphone 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" ,
)
Lister les Modèles from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
response = client.accounts.providers.list_models(
account_id = "account_id" ,
)
print (response)
Lister les Transcripteurs from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
response = client.accounts.providers.list_transcribers(
account_id = "account_id" ,
)
print (response)
Lister les Voix 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)
Lister les Trunks SIP 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)
Créer un Trunk SIP 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)
Obtenir un Trunk SIP 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)
Mettre à Jour un Trunk SIP 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)
Supprimer un Trunk SIP 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" ,
)
Obtenir les Analyses d’Utilisation response = client.accounts.analytics.get_usage(
account_id = "account_id" ,
)
print (response.meta)
Lister les Sous-comptes subaccounts = client.accounts.subaccounts.list(
account_id = "account_id" ,
)
print (subaccounts.count)
Créer un Sous-compte account = client.accounts.subaccounts.create(
account_id = "account_id" ,
name = "name" ,
)
print (account.id)
Obtenir un Sous-compte account = client.accounts.subaccounts.retrieve(
subaccount_id = "subaccount_id" ,
account_id = "account_id" ,
)
print (account.id)
Mettre à Jour un Sous-compte account = client.accounts.subaccounts.update(
subaccount_id = "subaccount_id" ,
account_id = "account_id" ,
)
print (account.id)
Gestion des Erreurs
from itellicoai import ItellicoAI
from itellicoai.exceptions import (
AuthenticationError,
NotFoundError,
RateLimitError,
APIError
)
client = ItellicoAI( api_key = "your-api-key" )
try :
agent = client.agents.retrieve( "agent_123abc" )
except AuthenticationError:
print ( "Invalid API key" )
except NotFoundError:
print ( "Agent not found" )
except RateLimitError:
print ( "Rate limit exceeded" )
except APIError as e:
print ( f "API error: { e.message } " )
Variables d’Environnement
import os
from itellicoai import ItellicoAI
# API key automatically loaded from ITELLICO_API_KEY env var
client = ItellicoAI()
# Or set explicitly
client = ItellicoAI( api_key = os.getenv( "ITELLICO_API_KEY" ))
Ressources