Skip to main content

Official Python SDK for HyperNeuron AI services

Project description

hyperneuronai

HyperNeuronAI

Official Python SDK for HyperNeuron AI — TTS streaming and AI telephony services.

Install

pip install hyperneuronai

Quick start

"""Make an outbound AI voice call (sync)."""
import time
import hyperneuronai

client = hyperneuronai.HyperNeuron(
    api_key="<api-key-get-from-your-account>",
    base_url="https://ai.hyperneuron.in/",
)

### Uncomment for oneway outbound calls
# call = client.telephony.outbound(
#     to_number="+91<10digitphone>",
#     text="Hello! This is an automated call from HyperNeuron. How are you today?",
#     voice="deepraj",
#     language="en",
# )
call = client.telephony.agent_call(
    to_number="+91<10digitphone>",
    greetings="Hello! This is an automated call from HyperNeuron. How are you today?",
    voice="deepraj",
    language="en",
)
print(f"Call initiated: {call.call_uuid}")
print(f"State: {call.state}")

# Poll until call ends
while True:
    time.sleep(5)
    status = client.telephony.status(call.call_uuid)
    print(f"  → {status.state}")
    if status.is_terminal:
        print(f"\nCall ended: {status.state}")
        if status.duration_sec:
            print(f"Duration: {status.duration_sec}s ({status.duration_min:.1f} min)")
        break


client.close()
import hyperneuronai

client = hyperneuronai.HyperNeuron(
    api_key="hn_key_xxxx",
    base_url="https://ai.hyperneuron.in",
)

# TTS — save to WAV
audio = client.tts.generate("Hello, world!", voice="sanjana")
with open("hello.wav", "wb") as f:
    f.write(audio)

# TTS — stream in real time
for chunk in client.tts.stream("Hello, world!", voice="sanjana"):
    your_speaker.write(chunk)

# One-way outbound call
call = client.telephony.outbound(
    to="+91<10digitIndianNumber>",
    text="Hi! Your order has shipped and arrives tomorrow.",
    voice="sanjana",
)
print(call.call_uuid, call.state)

Async

import asyncio
import hyperneuronai

async def main():
    async with hyperneuronai.AsyncHyperNeuron(api_key="hn_key_xxxx") as client:
        audio = await client.tts.generate("Hello!")
        call  = await client.telephony.outbound(to="+91<10digitIndianNumber>", text="Hi there!")

asyncio.run(main())

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hyperneuronai-0.1.22.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hyperneuronai-0.1.22-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file hyperneuronai-0.1.22.tar.gz.

File metadata

  • Download URL: hyperneuronai-0.1.22.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for hyperneuronai-0.1.22.tar.gz
Algorithm Hash digest
SHA256 2f55cd47aedae4b0f5a0d290c819da71373a7eeca69f2ac0395c8e927e2275ec
MD5 8c6bee2734ca0e16a93af662520cb5f2
BLAKE2b-256 4cec6c6ffc9a354b19d4fe0645313b85c06935df497d78f3dff0d35e92dd075f

See more details on using hashes here.

File details

Details for the file hyperneuronai-0.1.22-py3-none-any.whl.

File metadata

  • Download URL: hyperneuronai-0.1.22-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for hyperneuronai-0.1.22-py3-none-any.whl
Algorithm Hash digest
SHA256 332e94dc39ae9a20cc37e184fec42697a934745f44dbad09ba2a83c0a903333d
MD5 122e1247d6b9ec428d37f622a6158c96
BLAKE2b-256 75ae4aff354a738eccea3fd27d15cbc23803aa733239cc7ec0ca3df0949b6c60

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page