elevenlabs

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

elevenlabs implements an API client for ElevenLabs, whose Scribe models transcribe speech. https://elevenlabs.io/docs/api-reference/speech-to-text/convert

Index

Constants

View Source
const (
	// Endpoint is ElevenLabs' API, which is the default endpoint
	Endpoint = "https://api.elevenlabs.io/v1"
)

Variables

View Source
var PingInterval = 5 * time.Minute

PingInterval is how long the result of pinging the API is kept, before it is pinged again, so that a third-party API isn't pinged too often

Functions

This section is empty.

Types

type Client

type Client struct {
	*client.Client
	// contains filtered or unexported fields
}

func New

func New(endPoint, apiKey string, opts ...client.ClientOpt) (*Client, error)

New returns a client of ElevenLabs' API, at the endpoint, or ElevenLabs' own when it's empty, with the API key, which it needs

func (*Client) GetModel

func (c *Client) GetModel(_ context.Context, name string) (llm.Model, error)

GetModel returns the Scribe model with the name, or ErrNotFound

func (*Client) ListModels

func (c *Client) ListModels(context.Context) ([]llm.Model, error)

ListModels returns the Scribe models, which transcribe speech

func (*Client) Name

func (*Client) Name() string

Name returns the provider name

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping checks the API can be reached, with the API key, by listing its models, and returns an error if it can't. The API is only pinged once every PingInterval: otherwise, the result of the last ping is returned, unless it ended as its caller's context did.

func (*Client) Self

func (c *Client) Self() llm.Provider

Self returns the underlying client implementation

func (*Client) Transcribe

func (c *Client) Transcribe(ctx context.Context, model llm.Model, audio llm.Resource, stream llm.TranscriberStreamFn, opts ...llm.Opt) (llm.Transcript, llm.Usage, error)

Transcribe returns the speech in the audio as text, and its language, which is detected, unless it's set, and its segments, and their speakers, when they're asked for, and the seconds of audio. ElevenLabs doesn't stream a transcript, so the stream function, when it isn't nil, is called once it's transcribed. The request isn't timed out, as audio can take a while, but is cancelled with the context.

func (*Client) Translate

Translate returns ErrNotImplemented, as ElevenLabs doesn't translate speech

func (*Client) URL

func (c *Client) URL() *url.URL

URL returns the client's endpoint

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is one of ElevenLabs' Scribe models, which transcribe speech

func (*Model) Aliases

func (m *Model) Aliases() []string

Aliases returns no other names

func (*Model) Capabilities

func (m *Model) Capabilities() llm.ModelCap

Capabilities returns what the model can do, which is transcribe speech, but not translate it, nor anything else

func (*Model) Created

func (m *Model) Created() time.Time

Created isn't known

func (*Model) Description

func (m *Model) Description() string

Description returns what the model is

func (*Model) InputTokenLimit

func (m *Model) InputTokenLimit() *uint

InputTokenLimit isn't known, as a model transcribes audio

func (*Model) Meta

func (m *Model) Meta() map[string]json.RawMessage

Meta returns no metadata

func (*Model) Name

func (m *Model) Name() string

Name returns the model's id, such as "scribe_v2"

func (*Model) OutputTokenLimit

func (m *Model) OutputTokenLimit() *uint

OutputTokenLimit isn't known, as a model transcribes audio

func (*Model) Provider

func (m *Model) Provider() llm.Provider

Provider returns the client the model came from

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL