Skip to content

v0.13.0 — Domain-Based Package Restructure

This release restructures the SDK from a flat package with 20+ services into domain-based subpackages for better discoverability, maintainability, and pkg.go.dev organization. The agents/ package also receives significant expansion with Knowledge Base and Batch Calling services.

Breaking Changes

Import Path Changes

Services are now organized into domain-based subpackages. The root elevenlabs package provides short accessor methods:

Before (v0.12.0):

import elevenlabs "github.com/plexusone/elevenlabs-go"

client, _ := elevenlabs.NewClient()
resp, _ := client.TextToSpeech().Generate(ctx, &elevenlabs.TTSRequest{...})
voices, _ := client.Voices().List(ctx)

After (v0.13.0):

import (
    elevenlabs "github.com/plexusone/elevenlabs-go"
    "github.com/plexusone/elevenlabs-go/tts"
)

client, _ := elevenlabs.NewClient()
resp, _ := client.TTS().Generate(ctx, &tts.Request{...})
voices, _ := client.Voice().List(ctx)

Service Accessor Renames

v0.12.0 v0.13.0 Package
client.TextToSpeech() client.TTS() tts/
client.SpeechToText() client.STT() stt/
client.SpeechToSpeech() client.TTS().ConvertSpeech() tts/
client.TextToDialogue() client.TTS().GenerateDialogue() tts/
client.Voices() client.Voice() voice/
client.VoiceDesign() client.Voice().Design() voice/
client.AudioIsolation() client.Audio().Isolate() audio/
client.ForcedAlignment() client.Audio().Align() audio/
client.SoundEffects() client.Audio().GenerateSoundEffect() audio/
client.Music() client.Content().GenerateMusic() content/
client.Dubbing() client.Content().CreateDubbing() content/
client.Projects() client.Content().ListProjects() content/
client.WebSocketTTS() client.Realtime().ConnectTTS() realtime/
client.WebSocketSTT() client.Realtime().ConnectSTT() realtime/
client.Twilio() client.Telephony() telephony/
client.PhoneNumbers() client.Telephony().ListPhoneNumbers() telephony/
client.User() client.Account() account/
client.Models() client.Account().ListModels() account/
client.History() client.Account().ListHistory() account/
client.Pronunciation() client.Account().CreatePronunciation() account/
client.Agents() client.Agents() agents/
client.Conversations() client.Agents().ListConversations() agents/
client.KnowledgeBase() client.Agents().CreateFileDocument() agents/
client.BatchCalling() client.Agents().CreateBatchCall() agents/
client.AgentTesting() client.Agents().CreateTestFolder() agents/
client.Analytics() client.Agents().GetLiveCount() agents/

New Package Structure

github.com/plexusone/elevenlabs-go/
├── client.go           # Client, NewClient, Option, constants
├── errors.go           # APIError, ValidationError, error helpers
├── voicesettings.go    # VoiceSettings (shared across services)
│
├── tts/                # Text-to-Speech, Speech-to-Speech, Dialogue
├── stt/                # Speech-to-Text
├── voice/              # Voice management and design
├── audio/              # Isolation, Alignment, Sound Effects
├── content/            # Music, Dubbing, Projects
├── realtime/           # WebSocket TTS/STT
├── telephony/          # Twilio, Phone Numbers
├── account/            # User, Models, History, Pronunciation
├── agents/             # Full Conversational AI platform
│
├── ax/                 # Agent Experience errors (unchanged)
├── ttsconfig/          # TTS configuration utilities (unchanged)
├── ttsscript/          # TTS script compilation (unchanged)
├── omnivoice/          # OmniVoice integration (unchanged)
├── voices/             # Voice data utilities (unchanged)
└── cmd/                # CLI tools (unchanged)

Expanded Agents Package

The agents/ package now consolidates all Conversational AI services:

Knowledge Base (New)

Full document management for RAG:

// Create documents from different sources
doc, _ := client.Agents().CreateFileDocument(ctx, &agents.CreateFileDocumentRequest{
    File:     fileReader,
    Filename: "manual.pdf",
    Name:     "Product Manual",
})

doc, _ := client.Agents().CreateTextDocument(ctx, &agents.CreateTextDocumentRequest{
    Content: "FAQ content...",
    Name:    "Company FAQ",
})

doc, _ := client.Agents().CreateURLDocument(ctx, &agents.CreateURLDocumentRequest{
    URL:  "https://docs.example.com",
    Name: "API Docs",
})

// Create folders for organization
folder, _ := client.Agents().CreateKnowledgeBaseFolder(ctx, &agents.CreateKnowledgeBaseFolderRequest{
    Name: "Product Documentation",
})

// List and manage documents
docs, _ := client.Agents().ListDocuments(ctx, &agents.ListDocumentsOptions{
    PageSize: 20,
    Search:   "manual",
})

// Get document chunks for RAG
chunks, _ := client.Agents().GetDocumentChunks(ctx, documentID)

// Move documents between folders
_ = client.Agents().MoveDocument(ctx, documentID, targetFolderID)
_ = client.Agents().BulkMoveDocuments(ctx, []string{doc1, doc2}, folderID)

// Refresh URL documents
_ = client.Agents().RefreshURLDocument(ctx, documentID)

Batch Calling (Expanded)

Full batch outbound calling:

// Create a batch calling campaign
batch, _ := client.Agents().CreateBatchCall(ctx, &agents.CreateBatchCallRequest{
    AgentID: agentID,
    Name:    "Sales Outreach",
    Recipients: []agents.BatchCallRecipient{
        {PhoneNumber: "+14155551234"},
        {PhoneNumber: "+14155555678", ID: "customer-123"},
    },
    AgentPhoneNumberID: phoneNumberID,
    Timezone:           "America/New_York",
})

// Get batch call details with recipient status
detail, _ := client.Agents().GetBatchCall(ctx, batchID)
for _, r := range detail.Recipients {
    fmt.Printf("%s: %s (conv: %s)\n", r.PhoneNumber, r.Status, r.ConversationID)
}

// List all batch calls
batches, _ := client.Agents().ListBatchCalls(ctx, &agents.ListBatchCallsOptions{
    AgentID:  agentID,
    PageSize: 10,
})

// Manage batch calls
_ = client.Agents().CancelBatchCall(ctx, batchID)
batch, _ = client.Agents().RetryBatchCall(ctx, batchID)
_ = client.Agents().DeleteBatchCall(ctx, batchID)

Conversation Simulation

Test agents with simulated conversations:

// Non-streaming simulation
messages, _ := client.Agents().SimulateConversation(ctx, agentID,
    &agents.SimulateConversationOptions{
        SimulationPersona: "A confused customer",
        InitialMessage:    "I need help with my order",
        MaxTurns:          5,
    })

// Streaming simulation via WebSocket
conn, _ := client.Agents().SimulateConversationStream(ctx, agentID,
    &agents.SimulateConversationOptions{
        SimulationPersona: "A technical user",
    })
defer conn.Close()

for msg := range conn.Messages() {
    fmt.Printf("[%s] %s\n", msg.Role, msg.Content)
}

Agent Testing

Organize tests with folders:

// Create test folders
folder, _ := client.Agents().CreateTestFolder(ctx, &agents.CreateTestFolderRequest{
    Name: "Regression Tests",
})

// Get and update folders
folder, _ = client.Agents().GetTestFolder(ctx, folderID)
folder, _ = client.Agents().UpdateTestFolder(ctx, folderID, &agents.UpdateTestFolderRequest{
    Name: "Core Regression Tests",
})

// List tests and folders
tests, _ := client.Agents().ListTests(ctx, &agents.ListTestsOptions{
    PageSize:       20,
    ParentFolderID: folderID,
})

// Get test details
test, _ := client.Agents().GetResponseTest(ctx, testID)

// Bulk operations
_ = client.Agents().BulkMoveTests(ctx, &agents.BulkMoveTestsRequest{
    TestIDs:        []string{test1, test2},
    TargetFolderID: folderID,
})

Analytics

// Get live conversation count
count, _ := client.Agents().GetLiveCount(ctx)
fmt.Printf("Active conversations: %d\n", count)

Migration Guide

Step 1: Update Imports

Add subpackage imports for types you use:

import (
    elevenlabs "github.com/plexusone/elevenlabs-go"
    "github.com/plexusone/elevenlabs-go/tts"
    "github.com/plexusone/elevenlabs-go/agents"
)

Step 2: Update Type References

Types are now in their respective packages:

// Before
req := &elevenlabs.TTSRequest{...}

// After
req := &tts.Request{...}

Step 3: Update Service Calls

Use the new accessor methods:

// Before
audio, _ := client.TextToSpeech().Simple(ctx, voiceID, text)

// After
audio, _ := client.TTS().Simple(ctx, voiceID, text)

Step 4: Update Conversational AI Code

All Conversational AI services are now methods on client.Agents():

// Before
conversations, _ := client.Conversations().List(ctx, opts)
doc, _ := client.KnowledgeBase().CreateFileDocument(ctx, req)
batch, _ := client.BatchCalling().Create(ctx, req)

// After
conversations, _ := client.Agents().ListConversations(ctx, opts)
doc, _ := client.Agents().CreateFileDocument(ctx, req)
batch, _ := client.Agents().CreateBatchCall(ctx, req)

Benefits

  • Better pkg.go.dev Discovery: Each domain appears as a separate package
  • Clearer Organization: Related functionality grouped together
  • Reduced Naming Conflicts: Types use short names within their package context
  • Easier Navigation: Jump to specific domains in documentation
  • Smaller Import Scope: Import only the packages you need

Installation

go get github.com/plexusone/elevenlabs-go@v0.13.0

Full Changelog | Compare to v0.12.0