Get up and running with the VoiceCraft AI API in under 5 minutes. Follow these steps to create your first voice agent and make a test call.
Navigate to Settings → API Keys in the VoiceCraft AI dashboard. Click "Create New Key", give it a name, and copy the generated key. Store it securely — you will not be able to view it again.
Install the official VoiceCraft AI Python SDK from PyPI:
pip install voicecraft-aiUse the SDK to create a voice agent with a system prompt and language configuration:
from voicecraft import VoiceCraftClient
client = VoiceCraftClient(api_key="vc_your_api_key")
agent = client.agents.create(
name="Sales Assistant",
system_prompt="You are a helpful sales assistant for an Indian e-commerce company. Greet the customer in Hindi and assist with product inquiries.",
language="hi-IN",
voice_id="meera-hindi",
max_call_duration=300,
)
print(f"Agent created: {agent.id}")Before making a live call, test the agent with a simulated conversation:
test_result = client.agents.test(
agent_id=agent.id,
test_message="Hi, I want to know about your latest offers",
)
print(f"Agent response: {test_result.response}")
print(f"Latency: {test_result.latency_ms}ms")Initiate an outbound call using the agent you just created:
call = client.calls.create(
agent_id=agent.id,
to_number="+919876543210",
from_number="+911234567890",
metadata={"campaign": "welcome_offer"},
)
print(f"Call initiated: {call.id}")
print(f"Status: {call.status}")