Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Speech-to-text API client for R.
| Backend | Description | Segments |
|---------|-------------|----------|
| `whisper` | Native R torch whisper | **No** (text only) |
| `audio.whisper` | audio.whisper R package | Yes |
| `openai` | OpenAI Whisper API | Yes |
| `auto` | Try backends in order | Depends |

Expand All @@ -38,7 +37,6 @@ stt("audio.wav", backend = "whisper", model = "large-v3")
options(stt.api_base = "https://api.openai.com") # API endpoint
options(stt.api_key = "sk-...") # API key
options(stt.timeout = 120) # Request timeout (seconds)
options(stt.gpuctl = TRUE) # Enable GPU management
```

## Known Issues
Expand Down
7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ Title: 'OpenAI' Compatible Speech-to-Text API Client
Version: 0.1.0
Authors@R:
person("Troy", "Hernandez", email = "troy@cornball.ai", role = c("aut", "cre"))
Description: A minimal-dependency R client for 'OpenAI'-compatible Speech-to-Text
APIs with optional local fallbacks. Supports 'OpenAI', local servers
('LM Studio', 'OpenWebUI', 'Whisper' containers), and the 'audio.whisper'
package.
Description: A minimal-dependency R client for 'OpenAI'-compatible speech-to-text
APIs with optional local fallbacks. Supports 'OpenAI', local servers,
and the 'whisper' package for local transcription.
License: MIT + file LICENSE
Encoding: UTF-8
URL: https://github.com/cornball-ai/stt.api
Expand Down
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# tinyrox says don't edit this manually, but it can't stop you!

export(clear_native_whisper_cache)
export(clear_whisper_cache)
export(set_stt_base)
export(set_stt_key)
export(stt)
export(stt_health)

importFrom(stats,predict)
importFrom(utils,capture.output)
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
* Initial CRAN release
* Support for OpenAI-compatible speech-to-text APIs
* Local server support (LM Studio, OpenWebUI, Whisper containers)
* Optional audio.whisper package integration for local transcription
* Optional whisper package integration for local transcription
* Segment-level timestamps with word-level timing when available
62 changes: 0 additions & 62 deletions R/gpuctl_integration.R

This file was deleted.

130 changes: 0 additions & 130 deletions R/internal_audio_whisper.R

This file was deleted.

34 changes: 4 additions & 30 deletions R/internal_backend.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
getOption("stt.timeout", default = 60)
}

# Check if audio.whisper is available
.has_audio_whisper <- function() {

requireNamespace("audio.whisper", quietly = TRUE)
}

#' Convert time string to numeric seconds
#' @param time_str Time string in "HH:MM:SS.mmm" or "MM:SS.mmm" format
#' @return Numeric seconds
Expand Down Expand Up @@ -73,11 +67,10 @@
}

# Choose backend based on availability and user preference
.choose_backend <- function(backend = c("auto", "whisper", "audio.whisper", "openai")) {
.choose_backend <- function(backend = c("auto", "whisper", "openai")) {
backend <- match.arg(backend)

if (backend == "openai") {
# Explicit OpenAI API request - verify it's configured
if (is.null(.get_api_base())) {
stop(
"Backend 'openai' requested but no API base URL is set.\n",
Expand All @@ -89,50 +82,31 @@
}

if (backend == "whisper") {
# Explicit native whisper request - verify it's available
if (!.has_whisper()) {
stop(
"Backend 'whisper' requested but package is not installed.\n",
"Install with: remotes::install_github('cornball-ai/whisper')",
"Install with: install.packages('whisper')",
call. = FALSE
)
}
return("whisper")
}

if (backend == "audio.whisper") {
# Explicit audio.whisper request - verify it's available
if (!.has_audio_whisper()) {
stop(
"Backend 'audio.whisper' requested but package is not installed.\n",
"Install with: install.packages('audio.whisper', repos = 'https://bnosac.github.io/drat')",
call. = FALSE
)
}
return("audio.whisper")
}

# Auto mode: try backends in priority order
# 1. Native whisper (fastest, no external dependencies)
if (.has_whisper()) {
return("whisper")
}

# 2. audio.whisper (local, no API needed)
if (.has_audio_whisper()) {
return("audio.whisper")
}

# 3. OpenAI API (if configured)
# 2. OpenAI-compatible API (if configured)
if (!is.null(.get_api_base())) {
return("openai")
}

stop(
"No transcription backend available.\n",
"Either:\n",
" - Install whisper: remotes::install_github('cornball-ai/whisper'), or\n",
" - Install audio.whisper: install.packages('audio.whisper', repos = 'https://bnosac.github.io/drat'), or\n",
" - Install whisper: install.packages('whisper'), or\n",
" - Set an API endpoint with set_stt_base()",
call. = FALSE
)
Expand Down
Loading