21 lines
690 B
Common Lisp
21 lines
690 B
Common Lisp
(in-package #:cl-openai)
|
|
|
|
#|
|
|
curl --request POST \
|
|
--url https://api.openai.com/v1/audio/transcriptions \
|
|
--header "Authorization: Bearer $OPENAI_API_KEY" \
|
|
--header 'Content-Type: multipart/form-data' \
|
|
--form file=@/path/to/file/audio.mp3 \
|
|
--form model=whisper-1
|
|
|#
|
|
|
|
(defun transcribe-audio (file &optional (model "whisper-1"))
|
|
(let ((args `(:method :post
|
|
:content-type "multipart/form-data"
|
|
:parameters (("file" . ,file)
|
|
("model" . ,model))))
|
|
(uri (server-path "v1/audio/transcriptions")))
|
|
(decode-json-from-octets-string
|
|
(apply #'drakma:http-request uri
|
|
(apply #'additional-api-args args)))))
|