Skip to content

[Feature]: SageMaker endpoint support in the CLI #118

Open

Description

@GregHolmes

Summary

Add SageMaker endpoint support to dg, so a customer running Deepgram self-hosted (BYOC) on Amazon SageMaker can test their endpoint from the CLI.

Problem to solve

Deepgram self-hosted (BYOC) on Amazon SageMaker is a supported deployment path, but there is no quick way to confirm a freshly provisioned endpoint actually works. Verifying it today means writing code against one of the SDKs, or hand-rolling a SageMaker InvokeEndpoint call with SigV4 signing and the right request envelope.

dg listen and dg speak are the natural smoke test for "is my endpoint up and transcribing", and right now they only talk to the hosted API.

Proposed solution

A sketch rather than a settled design. Route the existing commands through a SageMaker transport, selected by flag or environment variable:

# Batch STT against a SageMaker real-time endpoint
dg listen recording.wav --sagemaker-endpoint my-deepgram-endpoint --aws-region us-west-2

# Same thing via env, so existing examples work unchanged
export DG_SAGEMAKER_ENDPOINT=my-deepgram-endpoint
export AWS_REGION=us-west-2
dg listen recording.wav --model nova-3

# TTS
dg speak "Hello from SageMaker" --sagemaker-endpoint my-deepgram-endpoint -o hello.wav

Credentials should come from the standard AWS chain (environment, shared config, instance role) rather than anything Deepgram-specific.

Open questions for whoever picks this up:

  • Which surfaces to cover first. Batch listen is the cheapest useful smoke test; streaming and speak are reasonable follow-ups.
  • Whether this is a global option or per-command.
  • What dg whoami, dg projects, dg keys and dg usage should do when a SageMaker endpoint is configured, since those are hosted-API only and should fail with a clear message rather than a confusing auth error.

Alternatives considered

  • Do nothing. Customers keep writing throwaway scripts to verify a deployment.
  • Document a curl or aws sagemaker-runtime invoke-endpoint recipe instead. Workable, but SigV4 plus the request envelope is a lot of ceremony for a smoke test, and it does not exercise the same code path the SDKs use.
  • Leave it to the SDKs. They already support it, but that needs a project and code, which is the friction this is trying to remove.

Scope

Enhancement to existing commands, or a core/framework change, depending on which of the design options above is chosen.

Priority

Nice to have. This was explicitly raised as a non-priority request.

Extra context / links

The SageMaker transport already exists in the SDKs, so the wire format and request envelope are established and this should largely be a matter of wiring the CLI to the same path:

Docs: https://developers.deepgram.com/docs/amazon-sagemaker

Raised internally in May 2026 and agreed at the time, but never filed as an issue. Opening it now so it is actually tracked.

Activity

  1. GregHolmes commented on Oct 22, 2026

    @GregHolmes
    ContributorAuthor

    SageMaker live-canary status

    • Nova-3 streaming STT canary: endpoint reached InService; dg listen returned the expected transcript using AWS credentials. After the successful response, the AWS CRT request-body generator emitted an unhandled AWS_ERROR_HTTP_STREAM_HAS_COMPLETED teardown exception.
    • Flux streaming STT canary: endpoint reached InService, but all tested input/model combinations failed inside the model primary with SageMaker's streaming-inference error. Endpoint deleted after testing.
    • Aura-2 streaming TTS canary: endpoint remained Creating beyond 20 minutes with no AWS failure reason, so it was deleted before invocation.

    The teardown defect is below the CLI layer: AWS CRT's request-body generator unconditionally performs a final end-stream write when cancellation follows a completed remote stream. A first transport close-guard patch did not suppress it. Follow up by testing aws-sdk-sagemaker-runtime-http2 0.12.0 and, if needed, fixing or reporting the AWS SDK lifecycle behavior. Do not update the dependency until that validation is complete.

    Current state: the second Nova canary remains up for future SDK/runtime testing; no Flux or Aura canary resources remain.

  2. GregHolmes commented on Oct 22, 2026

    @GregHolmes
    ContributorAuthor

    Flux STT follow-up

    A dedicated English Flux streaming endpoint reached InService and loaded/prewarmed flux-general-en successfully. Both the CLI and the deepgram-sagemaker transport repository's own published Flux flow reproduced the same outcome:

    • The endpoint accepted v2/listen and emitted partial TurnInfo transcripts.
    • It then returned SageMaker ModelStreamError with STREAM_BROKEN before an EndOfTurn result.
    • The AWS CRT request-body generator also emitted the separate AWS_ERROR_HTTP_STREAM_HAS_COMPLETED teardown exception.

    The canary was tested with the matching English model package, the Deepgram-generated MP3, a 16 kHz PCM WAV, real-time 8 KiB WAV pacing copied from the transport example, and two seconds of trailing silence. All failed identically.

    Conclusion: Flux failure is at the SageMaker Flux endpoint / transport lifecycle boundary, not unique to the CLI integration. The debug endpoint, endpoint configuration, and model were deleted after testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions