Files
elevenlabs/cmd/transcribe/main.go
2025-03-03 11:16:04 -08:00

35 lines
633 B
Go

package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/taigrr/elevenlabs/client"
"github.com/taigrr/elevenlabs/client/types"
)
func main() {
ctx := context.Background()
client := client.New(os.Getenv("XI_API_KEY"))
filePath := os.Args[1]
resp, err := client.ConvertSpeechToText(ctx, filePath, types.SpeechToTextRequest{
ModelID: types.SpeehToTextModelScribeV1,
TimestampsGranularity: types.TimestampsGranularityWord,
Diarize: true,
})
if err != nil {
panic(err)
}
bytes, err := json.Marshal(resp)
if err != nil {
panic(err)
}
fmt.Println(string(bytes))
}