New STT provider (Go)
Build
- One package per provider:
acceleration/internal/stt/<name>/<name>.go, implementingstt.STT(Start,ProcessAudio,Events,Close,Provider,Model). - Emit
stt.ModeReplacementfor hypotheses andstt.ModeFinalfor the settled turn. NeverModeDeltaunless the server really sends deltas. - Options struct with an
APIKeythat falls back to the provider's env var. Validate the options inNewand return a descriptive error rather than failing at connect time. - Register it in sttrouter/registry.go so routing config can name it.
Test
Three files, in this order of value:
<name>_test.go— no network. FeedhandleMessage(or its equivalent) server frames and assert the events that come out.socket_test.go— a fake WebSocket server. Asserts what goes on the wire (setup frame, keyterms, flush on close).<name>_integration_test.go—//go:build integration, embedssttsuite.Suite. Copydeepgram/deepgram_integration_test.go, and see thego-testingskill'sai-routing.md:
gosuite.Run(t, &XIntegrationSuite{Suite: sttsuite.Suite{ New: func() stt.STT { p, err := New(Options{}); require.NoError(t, err); return p }, Requires: []string{"X_API_KEY"}, ChunkMs: 80, // the pace the server prefers; 100 by default SettlesOnClose: true, // set if ending the audio stream flushes the tail }})
That inherits accuracy (>=90% of the fixture's words), settle time, interim arrival, transcript identity and the tail-of-the-call test. Only add provider-specific tests on top; .env is loaded for you. Tune MaxSettle, MinAccuracy or SessionTimeout only when the provider genuinely cannot meet the default, and say why in a comment.
Run
bashcd acceleration go test ./internal/stt/... # unit + socket go test -tags integration -run TestXIntegrationSuite ./internal/stt/x # live


