Metadata-Version: 2.4
Name: octophone
Version: 0.1.0
Summary: Python SDK for Octophone — the native phone for your voice agents.
Author-email: Samrat Man Singh <samratmansingh@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://octophone.dev
Project-URL: Source, https://github.com/samrat/octophone-sdks
Project-URL: Issues, https://github.com/samrat/octophone-sdks/issues
Keywords: octophone,voice-ai,webrtc,pipecat,livekit,gemini,openai,realtime,callkit
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Communications
Classifier: Topic :: Multimedia :: Sound/Audio
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: websockets>=12.0
Provides-Extra: webrtc
Requires-Dist: aiortc>=1.9.0; extra == "webrtc"
Requires-Dist: av>=12.0.0; extra == "webrtc"
Requires-Dist: numpy>=1.24.0; extra == "webrtc"
Provides-Extra: pipecat
Requires-Dist: pipecat-ai>=1.3.0; extra == "pipecat"
Requires-Dist: aiortc>=1.9.0; extra == "pipecat"
Requires-Dist: av>=12.0.0; extra == "pipecat"
Requires-Dist: numpy>=1.24.0; extra == "pipecat"
Provides-Extra: livekit
Requires-Dist: livekit-agents>=1.0.0; extra == "livekit"
Requires-Dist: aiortc>=1.9.0; extra == "livekit"
Requires-Dist: av>=12.0.0; extra == "livekit"
Requires-Dist: numpy>=1.24.0; extra == "livekit"
Provides-Extra: gemini
Requires-Dist: google-genai>=1.0.0; extra == "gemini"
Requires-Dist: aiortc>=1.9.0; extra == "gemini"
Requires-Dist: av>=12.0.0; extra == "gemini"
Requires-Dist: numpy>=1.24.0; extra == "gemini"
Provides-Extra: openai
Requires-Dist: aiortc>=1.9.0; extra == "openai"
Requires-Dist: av>=12.0.0; extra == "openai"
Requires-Dist: numpy>=1.24.0; extra == "openai"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
Dynamic: license-file

# octophone

Python SDK for [**Octophone**](https://octophone.dev) — the native phone for your voice agents.

Connect your Pipecat, LiveKit, OpenAI Live, Gemini Live, or custom voice agents straight to your iPhone (native CallKit ringing, 48 kHz HD Opus WebRTC, mid-call sideband approval cards).

## Installation

```sh
# Core async WebSocket client
pip install octophone

# With optional framework / WebRTC extras
pip install "octophone[pipecat]"
pip install "octophone[livekit]"
pip install "octophone[gemini]"
pip install "octophone[openai]"
pip install "octophone[webrtc]"
```

## Quickstart

### Pipecat

```python
import os
from pipecat.pipeline.pipeline import Pipeline
from octophone.pipecat import OctophoneTransport

transport = OctophoneTransport(
    token=os.environ["OCTOPHONE_TOKEN"],
    sample_rate=16000,
)

pipeline = Pipeline([
    transport.input(),   # iPhone mic -> InputAudioRawFrame
    stt, llm, tts,       # your own voice stack
    transport.output(),  # audio -> 48 kHz Opus on iPhone
])

await transport.ring(reason="Staging canary passed. Promote?")
```

### LiveKit Agents

```python
import os
from livekit.agents import Agent, AgentSession
from octophone.livekit import OctophoneIO

io = OctophoneIO(token=os.environ["OCTOPHONE_TOKEN"])
session = AgentSession(
    stt="deepgram/nova-3",
    llm="openai/gpt-4.1-mini",
    tts="cartesia/sonic-2",
)
io.attach(session)

await io.ring(reason="Deploy v2.4.1 ready for sign-off")
await io.wait_for_call()
await session.start(agent=Agent(instructions="Be concise."))
```

### Gemini Live (Zero Frameworks)

```python
import asyncio
from octophone import Octophone
from octophone.gemini import bridge_gemini_live

bot = Octophone(mode="realtime")  # reads OCTOPHONE_TOKEN

@bot.on_call_started
async def on_call(ev):
    peer = await bot.join_webrtc(ev["call_id"])
    await bridge_gemini_live(peer)

asyncio.run(bot.run())
```

### OpenAI Live (Zero Frameworks)

```python
import asyncio
from octophone import Octophone
from octophone.openai import bridge_openai_live

bot = Octophone(mode="realtime")  # reads OCTOPHONE_TOKEN

@bot.on_call_started
async def on_call(ev):
    peer = await bot.join_webrtc(ev["call_id"])
    await bridge_openai_live(peer)

asyncio.run(bot.run())
```

### Managed Voice & Chat (`text_bridge`)

```python
import asyncio
from octophone import Octophone

bot = Octophone()  # reads OCTOPHONE_TOKEN

@bot.on_turn
async def handle(turn):
    await turn.delta(f"Heard you say: {turn.text}")
    await turn.done()

asyncio.run(bot.run())
```

## Configuration

| Environment Variable | Default | Purpose |
| --- | --- | --- |
| `OCTOPHONE_TOKEN` | *(required; falls back to `BOT_TOKEN`)* | Bot contact token |
| `OCTOPHONE_URL` | `wss://api.octophone.dev/bot/v1` | WebSocket gateway URL (override for local/self-hosted dev) |

## Links

- Homepage: <https://octophone.dev>
- Source & Examples: <https://github.com/samrat/octophone-sdks>
- Issues: <https://github.com/samrat/octophone-sdks/issues>

## License

MIT
