For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
ModelsChatRankingsDocs
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
    • Overview
    • Usage for Agents
  • TypeScript SDK
    • Overview
  • Python SDK
    • Overview
  • Go SDK
      • Analytics
      • APIKeys
      • Byok
      • Chat
      • Credits
      • Embeddings
      • Endpoints
      • Generations
      • Guardrails
      • OAuth
      • Observability
      • Organization
      • Presets
      • Providers
      • Rerank
      • Beta.Responses
      • Transcriptions
      • Speech
      • VideoGeneration
      • Workspaces
  • DevTools
    • Overview
    • Migrating to @openrouter/agent
LogoLogo
ModelsChatRankingsDocs
On this page
  • Overview
  • Available Operations
  • CreateTranscription
  • Example Usage
  • Parameters
  • Response
  • Errors
Go SDKAPI Reference

Transcriptions - Go SDK

Transcriptions method reference
Was this page helpful?
Previous

Speech - Go SDK

Speech method reference
Next
Built with

The Go SDK and docs are currently in beta. Report issues on GitHub.

Overview

Speech-to-text endpoints

Available Operations

  • CreateTranscription - Create transcription

CreateTranscription

Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text.

Example Usage

1package main
2
3import(
4 "context"
5 "os"
6 openrouter "github.com/OpenRouterTeam/go-sdk"
7 "github.com/OpenRouterTeam/go-sdk/models/components"
8 "log"
9)
10
11func main() {
12 ctx := context.Background()
13
14 s := openrouter.New(
15 openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
16 )
17
18 res, err := s.Stt.CreateTranscription(ctx, components.STTRequest{
19 InputAudio: components.STTInputAudio{
20 Data: "UklGRiQA...",
21 Format: "wav",
22 },
23 Language: openrouter.Pointer("en"),
24 Model: "openai/whisper-large-v3",
25 })
26 if err != nil {
27 log.Fatal(err)
28 }
29 if res != nil {
30 // handle response
31 }
32}

Parameters

ParameterTypeRequiredDescription
ctxcontext.Context✔️The context to use for the request.
requestcomponents.STTRequest✔️The request object to use for the request.
opts[]operations.Option➖The options for this request.

Response

*components.STTResponse, error

Errors

Error TypeStatus CodeContent Type
sdkerrors.BadRequestResponseError400application/json
sdkerrors.UnauthorizedResponseError401application/json
sdkerrors.PaymentRequiredResponseError402application/json
sdkerrors.NotFoundResponseError404application/json
sdkerrors.TooManyRequestsResponseError429application/json
sdkerrors.InternalServerResponseError500application/json
sdkerrors.BadGatewayResponseError502application/json
sdkerrors.ServiceUnavailableResponseError503application/json
sdkerrors.EdgeNetworkTimeoutResponseError524application/json
sdkerrors.ProviderOverloadedResponseError529application/json
sdkerrors.APIError4XX, 5XX*/*