elevenlabs_client 0.5.0 โ 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +184 -0
- data/README.md +109 -4
- data/lib/elevenlabs_client/client.rb +38 -6
- data/lib/elevenlabs_client/endpoints/admin/history.rb +106 -0
- data/lib/elevenlabs_client/endpoints/admin/models.rb +27 -0
- data/lib/elevenlabs_client/endpoints/admin/samples.rb +30 -0
- data/lib/elevenlabs_client/endpoints/admin/service_accounts.rb +29 -0
- data/lib/elevenlabs_client/endpoints/admin/usage.rb +46 -0
- data/lib/elevenlabs_client/endpoints/admin/user.rb +28 -0
- data/lib/elevenlabs_client/endpoints/admin/voice_library.rb +86 -0
- data/lib/elevenlabs_client/endpoints/admin/webhooks.rb +33 -0
- data/lib/elevenlabs_client/endpoints/sound_generation.rb +0 -1
- data/lib/elevenlabs_client/endpoints/speech_to_text.rb +13 -0
- data/lib/elevenlabs_client/endpoints/text_to_dialogue.rb +34 -1
- data/lib/elevenlabs_client/endpoints/text_to_speech.rb +147 -1
- data/lib/elevenlabs_client/endpoints/text_to_voice.rb +13 -1
- data/lib/elevenlabs_client/endpoints/voices.rb +23 -24
- data/lib/elevenlabs_client/version.rb +1 -1
- data/lib/elevenlabs_client.rb +15 -12
- metadata +24 -7
- data/lib/elevenlabs_client/endpoints/models.rb +0 -26
- data/lib/elevenlabs_client/endpoints/text_to_dialogue_stream.rb +0 -50
- data/lib/elevenlabs_client/endpoints/text_to_speech_stream.rb +0 -43
- data/lib/elevenlabs_client/endpoints/text_to_speech_stream_with_timestamps.rb +0 -75
- data/lib/elevenlabs_client/endpoints/text_to_speech_with_timestamps.rb +0 -73
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2ee49fd5b47df50ba23e006446d756683c743cc5b579c38d19ac0e8a2c0ff82
|
4
|
+
data.tar.gz: e3feb0f2445c99a9ed6b97176d55c60f631bcbbc0e96ca990517167bb8e441e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70e78e6e71d8b2976d8323875f3929c2deea23bb56f68db1a02260948972f812ecc58103703592fa07519e4a2e12a4f51630ed2fe28682d879ce7e27536bb82f
|
7
|
+
data.tar.gz: 3b1d5d5176830ca92e28587002fc1bc7716b12b56c23debeae49b0778a06e8451c45aa057e74d684a79ee0202cad17e4c2261a128b0d09fe209e64d8181eec6a
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,190 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
## [0.7.0] - 2024-09-15
|
11
|
+
|
12
|
+
### Added
|
13
|
+
- **๐๏ธ Admin Samples Management** - Voice sample deletion and content moderation
|
14
|
+
- **Sample Deletion** (`client.samples.*`) - Delete voice samples by ID for content moderation and cleanup
|
15
|
+
- Comprehensive error handling for voice and sample validation
|
16
|
+
- Security-focused operations with proper authentication and authorization
|
17
|
+
- Method aliases: `delete_voice_sample`, `remove_sample`
|
18
|
+
|
19
|
+
- **๐ข Admin Service Accounts** - Complete service account monitoring and management
|
20
|
+
- **Account Monitoring** (`client.service_accounts.*`) - List all service accounts in workspace
|
21
|
+
- **API Key Analytics** - Monitor API key status, permissions, and usage across all accounts
|
22
|
+
- **Usage Tracking** - Character usage monitoring with limits and projections
|
23
|
+
- **Security Auditing** - Comprehensive security analysis and compliance reporting
|
24
|
+
- Method aliases: `list`, `all`, `service_accounts`
|
25
|
+
|
26
|
+
- **๐ Admin Webhooks Management** - Workspace webhook monitoring and health analysis
|
27
|
+
- **Webhook Monitoring** (`client.webhooks.*`) - List all workspace webhooks with detailed status
|
28
|
+
- **Health Analysis** - Monitor webhook failures, auto-disabled status, and recent error codes
|
29
|
+
- **Security Auditing** - Authentication method analysis and HTTPS compliance checking
|
30
|
+
- **Usage Analytics** - Track webhook usage across different services and features
|
31
|
+
- Method aliases: `get_webhooks`, `all`, `webhooks`
|
32
|
+
|
33
|
+
### Enhanced
|
34
|
+
- **๐ Documentation Expansion** - Comprehensive documentation for new admin endpoints
|
35
|
+
- Added `docs/admin/SAMPLES.md` - Voice sample management and content moderation guide (883 lines)
|
36
|
+
- Added `docs/admin/SERVICE_ACCOUNTS.md` - Service account monitoring and security analysis guide (1,264 lines)
|
37
|
+
- Added `docs/admin/WEBHOOKS.md` - Webhook management and health monitoring guide (1,264 lines)
|
38
|
+
- Updated `docs/admin/README.md` - Enhanced admin overview with all endpoints (548 lines)
|
39
|
+
- Updated main README.md with new admin endpoint documentation
|
40
|
+
- Total: 3,959 lines of additional admin documentation
|
41
|
+
|
42
|
+
- **๐ฏ Example Controllers** - Production-ready Rails integration examples for new endpoints
|
43
|
+
- Added `examples/admin/samples_controller.rb` - Sample deletion with content moderation workflows (767 lines)
|
44
|
+
- Added `examples/admin/service_accounts_controller.rb` - Account monitoring with analytics dashboard (500+ lines)
|
45
|
+
- Added `examples/admin/webhooks_controller.rb` - Webhook health monitoring with export capabilities (761 lines)
|
46
|
+
- All controllers include comprehensive error handling, filtering, and export functionality
|
47
|
+
|
48
|
+
### Improved
|
49
|
+
- **๐งช Test Coverage** - Comprehensive testing for all new admin endpoints
|
50
|
+
- Added 35 new endpoint tests covering samples, service accounts, and webhooks
|
51
|
+
- Added 31 new integration tests with proper WebMock stubbing and response validation
|
52
|
+
- Enhanced error handling tests for all new admin scenarios
|
53
|
+
- Total: 66 new tests, bringing total to 874 examples with 100% pass rate
|
54
|
+
|
55
|
+
- **๐ง Client Integration** - Seamless integration of new admin endpoints
|
56
|
+
- Updated `Client` class to expose new admin endpoints (`samples`, `service_accounts`, `webhooks`)
|
57
|
+
- Enhanced error handling for admin-specific scenarios across all endpoints
|
58
|
+
- Consistent API patterns and response structures
|
59
|
+
- Proper namespacing under `ElevenlabsClient::Admin` module
|
60
|
+
|
61
|
+
### Technical Improvements
|
62
|
+
- **๐ Security Management** - Advanced security monitoring and compliance
|
63
|
+
- Voice sample content moderation with audit trails
|
64
|
+
- Service account permission analysis and excessive privilege detection
|
65
|
+
- Webhook security auditing with HTTPS and authentication validation
|
66
|
+
- Comprehensive security reporting and recommendation systems
|
67
|
+
|
68
|
+
- **๐ Health Monitoring** - Sophisticated health analysis across admin resources
|
69
|
+
- Webhook failure tracking with error code analysis and auto-disable detection
|
70
|
+
- Service account usage monitoring with character limit projections
|
71
|
+
- Sample deletion tracking for content moderation compliance
|
72
|
+
- Real-time health status reporting with actionable insights
|
73
|
+
|
74
|
+
- **๐ก๏ธ Content Moderation** - Professional content management capabilities
|
75
|
+
- Secure sample deletion with proper authentication and logging
|
76
|
+
- Batch sample operations for efficient content cleanup
|
77
|
+
- Audit trail support for compliance and tracking
|
78
|
+
- Integration with content moderation workflows and policies
|
79
|
+
|
80
|
+
- **๐ Analytics & Reporting** - Advanced analytics across all admin functions
|
81
|
+
- Service account usage analytics with trend analysis
|
82
|
+
- Webhook performance monitoring with failure rate calculations
|
83
|
+
- Sample deletion analytics for content moderation reporting
|
84
|
+
- Exportable reports in CSV, JSON, and Excel formats
|
85
|
+
|
86
|
+
## [0.6.0] - 2024-09-15
|
87
|
+
|
88
|
+
### Added
|
89
|
+
- **๐ข Admin API Suite** - Complete administrative functionality for account management
|
90
|
+
- **User Management** (`client.user.*`) - Access comprehensive user account information, subscription details, and feature availability
|
91
|
+
- **Usage Analytics** (`client.usage.*`) - Monitor character usage with detailed analytics, breakdowns by voice/model/source, and trend analysis
|
92
|
+
- **Voice Library** (`client.voice_library.*`) - Browse and manage community shared voices with advanced filtering and search capabilities
|
93
|
+
- All admin endpoints include comprehensive error handling and response validation
|
94
|
+
|
95
|
+
### Enhanced
|
96
|
+
- **๐ Documentation Expansion** - Comprehensive documentation for all admin functionality
|
97
|
+
- Added `docs/admin/USER.md` - User account and subscription management guide (589 lines)
|
98
|
+
- Added `docs/admin/USAGE.md` - Usage analytics and monitoring guide (604 lines)
|
99
|
+
- Added `docs/admin/VOICE_LIBRARY.md` - Voice library browsing and management guide (883 lines)
|
100
|
+
- Added `docs/admin/README.md` - Admin API overview and quick start guide (472 lines)
|
101
|
+
- Updated main README.md with admin endpoint documentation and examples
|
102
|
+
- Total: 3,512 lines of new admin documentation
|
103
|
+
|
104
|
+
- **๐ฏ Example Controllers** - Production-ready Rails integration examples
|
105
|
+
- Added `examples/admin/user_controller.rb` - User dashboard with health monitoring (767 lines)
|
106
|
+
- Added `examples/admin/usage_controller.rb` - Usage analytics dashboard with real-time monitoring (584 lines)
|
107
|
+
- Added `examples/admin/voice_library_controller.rb` - Voice library browser with curation tools (844 lines)
|
108
|
+
- Added `examples/admin/models_controller.rb` - Model comparison and selection guide (983 lines)
|
109
|
+
- All controllers include comprehensive error handling, JSON API support, and export functionality
|
110
|
+
|
111
|
+
### Improved
|
112
|
+
- **๐งช Test Coverage** - Comprehensive testing for all admin functionality
|
113
|
+
- Added 88 endpoint tests covering all admin API methods and error scenarios
|
114
|
+
- Added 77 integration tests covering real-world usage patterns and workflows
|
115
|
+
- All tests include proper error handling validation and response structure verification
|
116
|
+
- Total: 165 new tests with 100% pass rate
|
117
|
+
|
118
|
+
- **๐ง Client Integration** - Seamless integration of admin endpoints
|
119
|
+
- Updated `Client` class to expose all admin endpoints (`usage`, `user`, `voice_library`)
|
120
|
+
- Enhanced error handling for admin-specific scenarios
|
121
|
+
- Consistent API patterns across all admin endpoints
|
122
|
+
- Proper namespacing under `ElevenlabsClient::Admin` module
|
123
|
+
|
124
|
+
### Technical Improvements
|
125
|
+
- **๐ Advanced Analytics** - Sophisticated usage monitoring and insights
|
126
|
+
- Character usage breakdowns by voice, model, user, and source
|
127
|
+
- Time-based aggregation (hour, day, week, month, cumulative)
|
128
|
+
- Trend analysis and forecasting capabilities
|
129
|
+
- Cost estimation and optimization recommendations
|
130
|
+
|
131
|
+
- **๐ค Voice Discovery** - Powerful voice library management
|
132
|
+
- Advanced filtering by category, gender, age, accent, language, and use case
|
133
|
+
- Voice recommendation engine based on requirements
|
134
|
+
- Bulk voice addition and collection curation tools
|
135
|
+
- Voice analytics and popularity tracking
|
136
|
+
|
137
|
+
- **๐ค Account Management** - Comprehensive user account oversight
|
138
|
+
- Real-time subscription monitoring and health checks
|
139
|
+
- Usage limit tracking with projections and alerts
|
140
|
+
- Feature availability matrix and upgrade recommendations
|
141
|
+
- Security and moderation status monitoring
|
142
|
+
|
143
|
+
### Changed
|
144
|
+
- **๐ Code Organization** - Moved TextToDialogue class to its own file
|
145
|
+
- Extracted `TextToDialogue` class from `text_to_speech.rb` to `text_to_dialogue.rb`
|
146
|
+
- Improved code organization and modularity
|
147
|
+
- All tests and functionality remain unchanged
|
148
|
+
- Added Speech-to-Text delete transcript endpoint (`delete_transcript`)
|
149
|
+
|
150
|
+
## [0.5.1] - 2024-09-15
|
151
|
+
|
152
|
+
### Removed
|
153
|
+
- **๐งน Dependency Optimization** - Removed unnecessary development dependencies
|
154
|
+
- Removed `rubocop` and `rubocop-rspec` dependencies
|
155
|
+
- Removed `brakeman` dependency (not suitable for gem libraries)
|
156
|
+
- Removed `.rubocop.yml` and `.brakeman.yml` configuration files
|
157
|
+
- Reduced bundle size from 49 to 31 gems (37% reduction)
|
158
|
+
|
159
|
+
### Changed
|
160
|
+
- **โก CI/CD Optimization** - Simplified and streamlined continuous integration
|
161
|
+
- Removed linting job from GitHub Actions workflow
|
162
|
+
- Focused CI pipeline on essential checks: tests, security, and build
|
163
|
+
- Updated CI to use only `bundler-audit` for dependency vulnerability scanning
|
164
|
+
- Faster CI builds with fewer dependencies and simpler workflow
|
165
|
+
|
166
|
+
### Updated
|
167
|
+
- **๐ Documentation Cleanup** - Updated documentation to reflect simplified toolchain
|
168
|
+
- Removed RuboCop references from README.md
|
169
|
+
- Updated CI/CD documentation section
|
170
|
+
- Simplified development workflow documentation
|
171
|
+
- Updated Rake task descriptions and help text
|
172
|
+
- **๐ง Development Tools** - Streamlined development workflow
|
173
|
+
- Removed lint-related Rake tasks (`dev:lint`, `dev:lint_fix`, `dev:brakeman`)
|
174
|
+
- Simplified `release:prepare` task to focus on tests and security
|
175
|
+
- Updated help documentation for available Rake tasks
|
176
|
+
|
177
|
+
### Technical Improvements
|
178
|
+
- **๐ฆ Leaner Dependencies** - More focused dependency management
|
179
|
+
- Kept only essential development tools: RSpec, WebMock, bundler-audit
|
180
|
+
- Maintained security scanning through bundler-audit
|
181
|
+
- Improved bundle install speed and reduced maintenance overhead
|
182
|
+
- **๐ Performance** - Faster development and CI workflows
|
183
|
+
- Reduced Docker image sizes for CI/CD
|
184
|
+
- Faster bundle installations
|
185
|
+
- Simplified toolchain reduces cognitive overhead
|
186
|
+
|
187
|
+
### Notes
|
188
|
+
- This release focuses on optimizing the development experience and CI/CD pipeline
|
189
|
+
- Security scanning is maintained through bundler-audit, which is more appropriate for gem libraries
|
190
|
+
- The simplified toolchain reduces maintenance overhead while maintaining code quality through comprehensive testing
|
191
|
+
|
8
192
|
## [0.5.0] - 2025-09-14
|
9
193
|
|
10
194
|
### Added
|
data/README.md
CHANGED
@@ -18,7 +18,15 @@ A comprehensive Ruby client library for the ElevenLabs API, supporting voice syn
|
|
18
18
|
๐ **Audio Isolation** - Remove background noise from audio files
|
19
19
|
๐ฑ **Audio Native** - Create embeddable audio players for websites
|
20
20
|
โฑ๏ธ **Forced Alignment** - Get precise timing information for audio transcripts
|
21
|
-
|
21
|
+
๐ **Admin APIs** - Complete administrative functionality:
|
22
|
+
- **History** - Manage and analyze your generated audio history
|
23
|
+
- **Usage** - Monitor character usage and analytics
|
24
|
+
- **User** - Access account information and subscription details
|
25
|
+
- **Voice Library** - Browse and manage community shared voices
|
26
|
+
- **Models** - List available models and their capabilities
|
27
|
+
- **Samples** - Delete voice samples for content moderation
|
28
|
+
- **Service Accounts** - Monitor service accounts and API keys
|
29
|
+
- **Webhooks** - Monitor workspace webhooks and their health
|
22
30
|
๐ก **Streaming** - Real-time audio streaming
|
23
31
|
โ๏ธ **Configurable** - Flexible configuration options
|
24
32
|
๐งช **Well-tested** - Comprehensive test coverage
|
@@ -118,6 +126,11 @@ audio_data = client.sound_generation.generate("Ocean waves crashing on rocks")
|
|
118
126
|
design_result = client.text_to_voice.design("Warm, professional female voice")
|
119
127
|
generated_voice_id = design_result["previews"].first["generated_voice_id"]
|
120
128
|
|
129
|
+
# Stream the voice preview
|
130
|
+
client.text_to_voice.stream_preview(generated_voice_id) do |chunk|
|
131
|
+
puts "Received preview chunk: #{chunk.bytesize} bytes"
|
132
|
+
end
|
133
|
+
|
121
134
|
voice_result = client.text_to_voice.create(
|
122
135
|
"Professional Voice",
|
123
136
|
"Warm, professional female voice",
|
@@ -139,6 +152,39 @@ File.open("sample1.mp3", "rb") do |sample|
|
|
139
152
|
puts "Created voice: #{voice['voice_id']}"
|
140
153
|
end
|
141
154
|
|
155
|
+
# Admin APIs - Account Management
|
156
|
+
user_info = client.user.get_user
|
157
|
+
puts "Account: #{user_info['subscription']['tier']} (#{user_info['subscription']['status']})"
|
158
|
+
puts "Usage: #{user_info['subscription']['character_count']} / #{user_info['subscription']['character_limit']}"
|
159
|
+
|
160
|
+
# Usage Analytics
|
161
|
+
usage_stats = client.usage.get_character_stats(
|
162
|
+
start_unix: (Time.now - 7.days).to_i * 1000,
|
163
|
+
end_unix: Time.now.to_i * 1000,
|
164
|
+
breakdown_type: "voice"
|
165
|
+
)
|
166
|
+
puts "7-day usage: #{usage_stats['usage']['All'].sum} characters"
|
167
|
+
|
168
|
+
# History Management
|
169
|
+
history = client.history.list(page_size: 10)
|
170
|
+
puts "Recent history: #{history['history'].length} items"
|
171
|
+
|
172
|
+
# Voice Library
|
173
|
+
voices = client.voice_library.get_shared_voices(category: "professional", page_size: 5)
|
174
|
+
puts "Professional voices available: #{voices['voices'].length}"
|
175
|
+
|
176
|
+
# Admin Samples Management
|
177
|
+
client.samples.delete_sample(voice_id: "voice_id", sample_id: "sample_id")
|
178
|
+
puts "Sample deleted successfully"
|
179
|
+
|
180
|
+
# Service Accounts Monitoring
|
181
|
+
accounts = client.service_accounts.get_service_accounts
|
182
|
+
puts "Service accounts: #{accounts['service-accounts'].length}"
|
183
|
+
|
184
|
+
# Webhooks Management
|
185
|
+
webhooks = client.webhooks.list_webhooks(include_usages: true)
|
186
|
+
puts "Active webhooks: #{webhooks['webhooks'].length}"
|
187
|
+
|
142
188
|
# Music Generation
|
143
189
|
music_data = client.music.compose(
|
144
190
|
prompt: "Upbeat electronic dance track with synthesizers",
|
@@ -167,6 +213,12 @@ File.open("audio.mp3", "rb") do |audio_file|
|
|
167
213
|
timestamps_granularity: "word"
|
168
214
|
)
|
169
215
|
puts "Transcribed: #{transcription['text']}"
|
216
|
+
|
217
|
+
# Get the transcript later
|
218
|
+
transcript = client.speech_to_text.get_transcript(transcription['transcription_id'])
|
219
|
+
|
220
|
+
# Delete when no longer needed
|
221
|
+
client.speech_to_text.delete_transcript(transcription['transcription_id'])
|
170
222
|
end
|
171
223
|
|
172
224
|
# Audio Isolation (Background Noise Removal)
|
@@ -224,7 +276,15 @@ end
|
|
224
276
|
- **[Audio Isolation API](docs/AUDIO_ISOLATION.md)** - Remove background noise from audio
|
225
277
|
- **[Audio Native API](docs/AUDIO_NATIVE.md)** - Create embeddable audio players
|
226
278
|
- **[Forced Alignment API](docs/FORCED_ALIGNMENT.md)** - Get precise timing information
|
227
|
-
- **[
|
279
|
+
- **[Admin APIs](docs/admin/README.md)** - Complete administrative functionality:
|
280
|
+
- **[User Management](docs/admin/USER.md)** - Account information and subscription details
|
281
|
+
- **[Usage Analytics](docs/admin/USAGE.md)** - Character usage monitoring and analytics
|
282
|
+
- **[History Management](docs/admin/HISTORY.md)** - Generated audio history management
|
283
|
+
- **[Voice Library](docs/admin/VOICE_LIBRARY.md)** - Community voice browsing and management
|
284
|
+
- **[Models API](docs/admin/MODELS.md)** - List available models and capabilities
|
285
|
+
- **[Samples Management](docs/admin/SAMPLES.md)** - Delete voice samples for content moderation
|
286
|
+
- **[Service Accounts](docs/admin/SERVICE_ACCOUNTS.md)** - Monitor service accounts and API keys
|
287
|
+
- **[Webhooks Management](docs/admin/WEBHOOKS.md)** - Monitor workspace webhooks and their health
|
228
288
|
|
229
289
|
### Available Endpoints
|
230
290
|
|
@@ -243,7 +303,14 @@ end
|
|
243
303
|
| `client.audio_isolation.*` | Background noise removal | [AUDIO_ISOLATION.md](docs/AUDIO_ISOLATION.md) |
|
244
304
|
| `client.audio_native.*` | Embeddable audio players | [AUDIO_NATIVE.md](docs/AUDIO_NATIVE.md) |
|
245
305
|
| `client.forced_alignment.*` | Audio-text timing alignment | [FORCED_ALIGNMENT.md](docs/FORCED_ALIGNMENT.md) |
|
246
|
-
| `client.
|
306
|
+
| `client.user.*` | User account and subscription information | [USER.md](docs/admin/USER.md) |
|
307
|
+
| `client.usage.*` | Character usage analytics and monitoring | [USAGE.md](docs/admin/USAGE.md) |
|
308
|
+
| `client.history.*` | Generated audio history management | [HISTORY.md](docs/admin/HISTORY.md) |
|
309
|
+
| `client.voice_library.*` | Community voice browsing and management | [VOICE_LIBRARY.md](docs/admin/VOICE_LIBRARY.md) |
|
310
|
+
| `client.models.*` | Model information and capabilities | [MODELS.md](docs/admin/MODELS.md) |
|
311
|
+
| `client.samples.*` | Voice sample deletion and content moderation | [SAMPLES.md](docs/admin/SAMPLES.md) |
|
312
|
+
| `client.service_accounts.*` | Service account monitoring and management | [SERVICE_ACCOUNTS.md](docs/admin/SERVICE_ACCOUNTS.md) |
|
313
|
+
| `client.webhooks.*` | Workspace webhook monitoring and health analysis | [WEBHOOKS.md](docs/admin/WEBHOOKS.md) |
|
247
314
|
|
248
315
|
## Configuration Options
|
249
316
|
|
@@ -312,6 +379,15 @@ The gem is designed to work seamlessly with Rails applications. See the [example
|
|
312
379
|
- [AudioIsolationController](examples/audio_isolation_controller.rb) - Background noise removal and audio cleanup
|
313
380
|
- [AudioNativeController](examples/audio_native_controller.rb) - Embeddable audio players for websites
|
314
381
|
- [ForcedAlignmentController](examples/forced_alignment_controller.rb) - Audio-text timing alignment and subtitle generation
|
382
|
+
- **Admin Controllers** - Complete administrative functionality:
|
383
|
+
- [Admin::HistoryController](examples/admin/history_controller.rb) - Generated audio history management and analytics
|
384
|
+
- [Admin::UsageController](examples/admin/usage_controller.rb) - Character usage monitoring and analytics
|
385
|
+
- [Admin::UserController](examples/admin/user_controller.rb) - User account and subscription management
|
386
|
+
- [Admin::VoiceLibraryController](examples/admin/voice_library_controller.rb) - Community voice browsing and management
|
387
|
+
- [Admin::ModelsController](examples/admin/models_controller.rb) - Model information and selection guidance
|
388
|
+
- [Admin::SamplesController](examples/admin/samples_controller.rb) - Voice sample deletion and content moderation
|
389
|
+
- [Admin::ServiceAccountsController](examples/admin/service_accounts_controller.rb) - Service account monitoring and analytics
|
390
|
+
- [Admin::WebhooksController](examples/admin/webhooks_controller.rb) - Workspace webhook monitoring and health analysis
|
315
391
|
|
316
392
|
## Development
|
317
393
|
|
@@ -322,6 +398,34 @@ bin/setup # Install dependencies
|
|
322
398
|
bundle exec rspec # Run tests
|
323
399
|
```
|
324
400
|
|
401
|
+
### Available Rake Tasks
|
402
|
+
|
403
|
+
```bash
|
404
|
+
# Testing
|
405
|
+
rake spec # Run all tests (default)
|
406
|
+
rake test:unit # Run unit tests only
|
407
|
+
rake test:integration # Run integration tests only
|
408
|
+
|
409
|
+
# Security
|
410
|
+
rake dev:security # Run security checks
|
411
|
+
rake dev:audit # Run bundler-audit
|
412
|
+
|
413
|
+
# Development
|
414
|
+
rake dev:test # Run all tests
|
415
|
+
rake dev:coverage # Run tests with coverage
|
416
|
+
rake release:prepare # Run full CI suite locally
|
417
|
+
```
|
418
|
+
|
419
|
+
### Continuous Integration
|
420
|
+
|
421
|
+
This gem uses GitHub Actions for CI/CD with the following checks:
|
422
|
+
|
423
|
+
- **Tests**: Runs on Ruby 3.0, 3.1, 3.2, and 3.3
|
424
|
+
- **Security**: bundler-audit for dependency vulnerability scanning
|
425
|
+
- **Build**: Verifies gem can be built and installed
|
426
|
+
|
427
|
+
All checks must pass before merging pull requests.
|
428
|
+
|
325
429
|
To install this gem onto your local machine:
|
326
430
|
|
327
431
|
```bash
|
@@ -332,7 +436,8 @@ To release a new version:
|
|
332
436
|
|
333
437
|
1. Update the version number in `version.rb`
|
334
438
|
2. Update `CHANGELOG.md`
|
335
|
-
3. Run `bundle exec rake release`
|
439
|
+
3. Run `bundle exec rake release:prepare` to verify tests and security checks pass
|
440
|
+
4. Run `bundle exec rake release`
|
336
441
|
|
337
442
|
## Testing
|
338
443
|
|
@@ -8,7 +8,7 @@ module ElevenlabsClient
|
|
8
8
|
class Client
|
9
9
|
DEFAULT_BASE_URL = "https://api.elevenlabs.io"
|
10
10
|
|
11
|
-
attr_reader :base_url, :api_key, :dubs, :text_to_speech, :
|
11
|
+
attr_reader :base_url, :api_key, :dubs, :text_to_speech, :text_to_dialogue, :sound_generation, :text_to_voice, :models, :voices, :music, :audio_isolation, :audio_native, :forced_alignment, :speech_to_speech, :speech_to_text, :websocket_text_to_speech, :history, :usage, :user, :voice_library, :samples, :service_accounts, :webhooks
|
12
12
|
|
13
13
|
def initialize(api_key: nil, base_url: nil, api_key_env: "ELEVENLABS_API_KEY", base_url_env: "ELEVENLABS_BASE_URL")
|
14
14
|
@api_key = api_key || fetch_api_key(api_key_env)
|
@@ -16,14 +16,17 @@ module ElevenlabsClient
|
|
16
16
|
@conn = build_connection
|
17
17
|
@dubs = Dubs.new(self)
|
18
18
|
@text_to_speech = TextToSpeech.new(self)
|
19
|
-
@text_to_speech_stream = TextToSpeechStream.new(self)
|
20
|
-
@text_to_speech_with_timestamps = TextToSpeechWithTimestamps.new(self)
|
21
|
-
@text_to_speech_stream_with_timestamps = TextToSpeechStreamWithTimestamps.new(self)
|
22
19
|
@text_to_dialogue = TextToDialogue.new(self)
|
23
|
-
@text_to_dialogue_stream = TextToDialogueStream.new(self)
|
24
20
|
@sound_generation = SoundGeneration.new(self)
|
25
21
|
@text_to_voice = TextToVoice.new(self)
|
26
|
-
@models = Models.new(self)
|
22
|
+
@models = Admin::Models.new(self)
|
23
|
+
@history = Admin::History.new(self)
|
24
|
+
@usage = Admin::Usage.new(self)
|
25
|
+
@user = Admin::User.new(self)
|
26
|
+
@voice_library = Admin::VoiceLibrary.new(self)
|
27
|
+
@samples = Admin::Samples.new(self)
|
28
|
+
@service_accounts = Admin::ServiceAccounts.new(self)
|
29
|
+
@webhooks = Admin::Webhooks.new(self)
|
27
30
|
@voices = Voices.new(self)
|
28
31
|
@music = Endpoints::Music.new(self)
|
29
32
|
@audio_isolation = AudioIsolation.new(self)
|
@@ -98,6 +101,17 @@ module ElevenlabsClient
|
|
98
101
|
handle_response(response)
|
99
102
|
end
|
100
103
|
|
104
|
+
# Makes an authenticated GET request expecting binary response
|
105
|
+
# @param path [String] API endpoint path
|
106
|
+
# @return [String] Binary response body
|
107
|
+
def get_binary(path)
|
108
|
+
response = @conn.get(path) do |req|
|
109
|
+
req.headers["xi-api-key"] = api_key
|
110
|
+
end
|
111
|
+
|
112
|
+
handle_response(response)
|
113
|
+
end
|
114
|
+
|
101
115
|
# Makes an authenticated POST request expecting binary response
|
102
116
|
# @param path [String] API endpoint path
|
103
117
|
# @param body [Hash, nil] Request body
|
@@ -154,6 +168,24 @@ module ElevenlabsClient
|
|
154
168
|
handle_response(response)
|
155
169
|
end
|
156
170
|
|
171
|
+
# Makes an authenticated GET request with streaming response
|
172
|
+
# @param path [String] API endpoint path
|
173
|
+
# @param block [Proc] Block to handle each chunk
|
174
|
+
# @return [Faraday::Response] Response object
|
175
|
+
def get_streaming(path, &block)
|
176
|
+
response = @conn.get(path) do |req|
|
177
|
+
req.headers["xi-api-key"] = api_key
|
178
|
+
req.headers["Accept"] = "audio/mpeg"
|
179
|
+
|
180
|
+
# Set up streaming callback
|
181
|
+
req.options.on_data = proc do |chunk, _|
|
182
|
+
block.call(chunk) if block_given?
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
handle_response(response)
|
187
|
+
end
|
188
|
+
|
157
189
|
# Makes an authenticated POST request with streaming response for timestamp data
|
158
190
|
# @param path [String] API endpoint path
|
159
191
|
# @param body [Hash, nil] Request body
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cgi'
|
4
|
+
|
5
|
+
module ElevenlabsClient
|
6
|
+
module Admin
|
7
|
+
class History
|
8
|
+
def initialize(client)
|
9
|
+
@client = client
|
10
|
+
end
|
11
|
+
|
12
|
+
# GET /v1/history
|
13
|
+
# Returns a list of your generated audio
|
14
|
+
# Documentation: https://elevenlabs.io/docs/api-reference/history/get-generated-items
|
15
|
+
#
|
16
|
+
# @param options [Hash] Optional parameters
|
17
|
+
# @option options [Integer] :page_size How many history items to return at maximum (max 1000, default 100)
|
18
|
+
# @option options [String] :start_after_history_item_id After which ID to start fetching (for pagination)
|
19
|
+
# @option options [String] :voice_id ID of the voice to filter for
|
20
|
+
# @option options [String] :search Search term for filtering history items
|
21
|
+
# @option options [String] :source Source of the generated history item ("TTS" or "STS")
|
22
|
+
# @return [Hash] Response containing history items, pagination info
|
23
|
+
def list(**options)
|
24
|
+
endpoint = "/v1/history"
|
25
|
+
|
26
|
+
# Build query parameters
|
27
|
+
query_params = {}
|
28
|
+
query_params[:page_size] = options[:page_size] if options[:page_size]
|
29
|
+
query_params[:start_after_history_item_id] = options[:start_after_history_item_id] if options[:start_after_history_item_id]
|
30
|
+
query_params[:voice_id] = options[:voice_id] if options[:voice_id]
|
31
|
+
query_params[:search] = options[:search] if options[:search]
|
32
|
+
query_params[:source] = options[:source] if options[:source]
|
33
|
+
|
34
|
+
# Add query parameters to endpoint if any exist
|
35
|
+
if query_params.any?
|
36
|
+
query_string = query_params.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join("&")
|
37
|
+
endpoint += "?#{query_string}"
|
38
|
+
end
|
39
|
+
|
40
|
+
@client.get(endpoint)
|
41
|
+
end
|
42
|
+
|
43
|
+
# GET /v1/history/:history_item_id
|
44
|
+
# Retrieves a history item by ID
|
45
|
+
# Documentation: https://elevenlabs.io/docs/api-reference/history/get-history-item
|
46
|
+
#
|
47
|
+
# @param history_item_id [String] ID of the history item
|
48
|
+
# @return [Hash] The history item data
|
49
|
+
def get(history_item_id)
|
50
|
+
endpoint = "/v1/history/#{history_item_id}"
|
51
|
+
@client.get(endpoint)
|
52
|
+
end
|
53
|
+
|
54
|
+
# DELETE /v1/history/:history_item_id
|
55
|
+
# Delete a history item by its ID
|
56
|
+
# Documentation: https://elevenlabs.io/docs/api-reference/history/delete-history-item
|
57
|
+
#
|
58
|
+
# @param history_item_id [String] ID of the history item to delete
|
59
|
+
# @return [Hash] Status response
|
60
|
+
def delete(history_item_id)
|
61
|
+
endpoint = "/v1/history/#{history_item_id}"
|
62
|
+
@client.delete(endpoint)
|
63
|
+
end
|
64
|
+
|
65
|
+
# GET /v1/history/:history_item_id/audio
|
66
|
+
# Returns the audio of a history item
|
67
|
+
# Documentation: https://elevenlabs.io/docs/api-reference/history/get-audio-from-history-item
|
68
|
+
#
|
69
|
+
# @param history_item_id [String] ID of the history item
|
70
|
+
# @return [String] The binary audio data
|
71
|
+
def get_audio(history_item_id)
|
72
|
+
endpoint = "/v1/history/#{history_item_id}/audio"
|
73
|
+
@client.get_binary(endpoint)
|
74
|
+
end
|
75
|
+
|
76
|
+
# POST /v1/history/download
|
77
|
+
# Download one or more history items
|
78
|
+
# Documentation: https://elevenlabs.io/docs/api-reference/history/download-history-items
|
79
|
+
#
|
80
|
+
# @param history_item_ids [Array<String>] List of history item IDs to download
|
81
|
+
# @param options [Hash] Optional parameters
|
82
|
+
# @option options [String] :output_format Output format ("wav" or "default")
|
83
|
+
# @return [String] The binary audio data (single file) or zip file (multiple files)
|
84
|
+
def download(history_item_ids, **options)
|
85
|
+
endpoint = "/v1/history/download"
|
86
|
+
request_body = { history_item_ids: history_item_ids }
|
87
|
+
|
88
|
+
# Add optional parameters
|
89
|
+
request_body[:output_format] = options[:output_format] if options[:output_format]
|
90
|
+
|
91
|
+
@client.post_binary(endpoint, request_body)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Alias methods for convenience
|
95
|
+
alias_method :get_history_item, :get
|
96
|
+
alias_method :get_generated_items, :list
|
97
|
+
alias_method :delete_history_item, :delete
|
98
|
+
alias_method :get_audio_from_history_item, :get_audio
|
99
|
+
alias_method :download_history_items, :download
|
100
|
+
|
101
|
+
private
|
102
|
+
|
103
|
+
attr_reader :client
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ElevenlabsClient
|
4
|
+
module Admin
|
5
|
+
class Models
|
6
|
+
def initialize(client)
|
7
|
+
@client = client
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /v1/models
|
11
|
+
# Gets a list of available models
|
12
|
+
# Documentation: https://elevenlabs.io/docs/api-reference/models/list
|
13
|
+
#
|
14
|
+
# @return [Hash] The JSON response containing an array of models
|
15
|
+
def list
|
16
|
+
endpoint = "/v1/models"
|
17
|
+
@client.get(endpoint)
|
18
|
+
end
|
19
|
+
|
20
|
+
alias_method :list_models, :list
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :client
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ElevenlabsClient
|
4
|
+
module Admin
|
5
|
+
class Samples
|
6
|
+
def initialize(client)
|
7
|
+
@client = client
|
8
|
+
end
|
9
|
+
|
10
|
+
# DELETE /v1/voices/:voice_id/samples/:sample_id
|
11
|
+
# Delete voice sample
|
12
|
+
# Documentation: https://elevenlabs.io/docs/api-reference/samples/delete-voice-sample
|
13
|
+
#
|
14
|
+
# @param voice_id [String] ID of the voice to be used. You can use the Get voices endpoint to list all the available voices.
|
15
|
+
# @param sample_id [String] ID of the sample to be used. You can use the Get voices endpoint to list all the available samples for a voice.
|
16
|
+
# @return [Hash] The JSON response containing the status of the deletion request.
|
17
|
+
def delete_sample(voice_id:, sample_id:)
|
18
|
+
endpoint = "/v1/voices/#{voice_id}/samples/#{sample_id}"
|
19
|
+
@client.delete(endpoint)
|
20
|
+
end
|
21
|
+
|
22
|
+
alias_method :delete_voice_sample, :delete_sample
|
23
|
+
alias_method :remove_sample, :delete_sample
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
attr_reader :client
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ElevenlabsClient
|
4
|
+
module Admin
|
5
|
+
class ServiceAccounts
|
6
|
+
def initialize(client)
|
7
|
+
@client = client
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /v1/service-accounts
|
11
|
+
# Get service accounts
|
12
|
+
# Documentation: https://elevenlabs.io/docs/api-reference/service-accounts/get-service-accounts
|
13
|
+
#
|
14
|
+
# @return [Hash] The JSON response containing all service accounts in the workspace.
|
15
|
+
def get_service_accounts
|
16
|
+
endpoint = "/v1/service-accounts"
|
17
|
+
@client.get(endpoint)
|
18
|
+
end
|
19
|
+
|
20
|
+
alias_method :list, :get_service_accounts
|
21
|
+
alias_method :all, :get_service_accounts
|
22
|
+
alias_method :service_accounts, :get_service_accounts
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_reader :client
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|