@deepgram/sdk 5.0.0-beta.2 → 5.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -9
- package/dist/browser/index.global.js +304 -451
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/CustomClient.js +131 -0
- package/dist/cjs/api/resources/agent/resources/v1/client/Client.d.ts +2 -0
- package/dist/cjs/api/resources/agent/resources/v1/client/Client.js +2 -2
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1ConversationText.d.ts +1 -1
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1Settings.d.ts +5 -65
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.d.ts +1 -1
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateSpeak.d.ts +1 -26
- package/dist/cjs/api/resources/agent/resources/v1/types/index.d.ts +0 -4
- package/dist/cjs/api/resources/agent/resources/v1/types/index.js +0 -4
- package/dist/cjs/api/resources/listen/resources/v1/client/Client.d.ts +3 -0
- package/dist/cjs/api/resources/listen/resources/v1/client/Client.js +3 -2
- package/dist/cjs/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestCallbackMethod.d.ts +1 -1
- package/dist/cjs/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestCustomIntentMode.d.ts +1 -1
- package/dist/cjs/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestCustomTopicMode.d.ts +1 -1
- package/dist/cjs/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestEncoding.d.ts +1 -1
- package/dist/cjs/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestModel.d.ts +1 -1
- package/dist/cjs/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestSummarize.d.ts +1 -1
- package/dist/cjs/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestVersion.d.ts +1 -1
- package/dist/cjs/api/resources/listen/resources/v1/types/ListenV1CloseStream.d.ts +1 -1
- package/dist/cjs/api/resources/listen/resources/v1/types/ListenV1Finalize.d.ts +1 -1
- package/dist/cjs/api/resources/listen/resources/v1/types/ListenV1KeepAlive.d.ts +1 -1
- package/dist/cjs/api/resources/listen/resources/v1/types/ListenV1Results.d.ts +19 -0
- package/dist/cjs/api/resources/listen/resources/v2/client/Client.d.ts +2 -0
- package/dist/cjs/api/resources/listen/resources/v2/client/Client.js +2 -2
- package/dist/cjs/api/resources/listen/resources/v2/types/ListenV2CloseStream.d.ts +1 -1
- package/dist/cjs/api/resources/listen/resources/v2/types/ListenV2TurnInfo.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/types/BreakdownListRequestDeployment.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/types/BreakdownListRequestGroupingItem.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/keys/types/KeysListRequestStatus.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.js +2 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/types/RequestsListRequestDeployment.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/types/RequestsListRequestEndpoint.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/types/RequestsListRequestMethod.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/types/RequestsListRequestStatus.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/types/BreakdownGetRequestDeployment.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/types/BreakdownGetRequestEndpoint.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/types/BreakdownGetRequestGrouping.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/types/BreakdownGetRequestMethod.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/types/UsageGetRequestDeployment.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/types/UsageGetRequestEndpoint.d.ts +1 -1
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/types/UsageGetRequestMethod.d.ts +1 -1
- package/dist/cjs/api/resources/read/resources/v1/resources/text/types/TextAnalyzeRequestCallbackMethod.d.ts +1 -1
- package/dist/cjs/api/resources/read/resources/v1/resources/text/types/TextAnalyzeRequestCustomIntentMode.d.ts +1 -1
- package/dist/cjs/api/resources/read/resources/v1/resources/text/types/TextAnalyzeRequestCustomTopicMode.d.ts +1 -1
- package/dist/cjs/api/resources/read/resources/v1/resources/text/types/TextAnalyzeRequestSummarize.d.ts +1 -1
- package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/types/DistributionCredentialsCreateRequestScopesItem.d.ts +1 -1
- package/dist/cjs/api/resources/speak/resources/v1/client/Client.d.ts +2 -0
- package/dist/cjs/api/resources/speak/resources/v1/client/Client.js +2 -2
- package/dist/cjs/api/resources/speak/resources/v1/resources/audio/types/AudioGenerateRequestCallbackMethod.d.ts +1 -1
- package/dist/cjs/api/resources/speak/resources/v1/resources/audio/types/AudioGenerateRequestContainer.d.ts +1 -1
- package/dist/cjs/api/resources/speak/resources/v1/resources/audio/types/AudioGenerateRequestEncoding.d.ts +1 -1
- package/dist/cjs/api/resources/speak/resources/v1/resources/audio/types/AudioGenerateRequestModel.d.ts +1 -1
- package/dist/cjs/api/resources/speak/resources/v1/types/SpeakV1Clear.d.ts +1 -1
- package/dist/cjs/api/resources/speak/resources/v1/types/SpeakV1Cleared.d.ts +1 -1
- package/dist/cjs/api/resources/speak/resources/v1/types/SpeakV1Close.d.ts +1 -1
- package/dist/cjs/api/resources/speak/resources/v1/types/SpeakV1Flush.d.ts +1 -1
- package/dist/cjs/api/resources/speak/resources/v1/types/SpeakV1Flushed.d.ts +1 -1
- package/dist/cjs/api/types/AgentThinkModelsV1Response.d.ts +3 -3
- package/dist/cjs/api/types/Anthropic.d.ts +17 -0
- package/dist/cjs/api/types/Anthropic.js +12 -0
- package/dist/cjs/api/types/AwsBedrockThinkProvider.d.ts +40 -0
- package/dist/cjs/api/types/AwsBedrockThinkProvider.js +20 -0
- package/dist/cjs/api/types/AwsPollySpeakProvider.d.ts +47 -0
- package/dist/cjs/api/types/AwsPollySpeakProvider.js +31 -0
- package/dist/cjs/api/types/Cartesia.d.ts +24 -0
- package/dist/cjs/api/types/Cartesia.js +12 -0
- package/dist/cjs/api/types/Deepgram.d.ts +76 -0
- package/dist/cjs/api/types/Deepgram.js +73 -0
- package/dist/cjs/api/types/ElevenLabsSpeakProvider.d.ts +20 -0
- package/dist/cjs/api/types/ElevenLabsSpeakProvider.js +13 -0
- package/dist/cjs/api/types/Google.d.ts +18 -0
- package/dist/cjs/api/types/Google.js +13 -0
- package/dist/cjs/api/types/Groq.d.ts +9 -0
- package/dist/cjs/api/types/Groq.js +3 -0
- package/dist/cjs/api/types/ListBillingFieldsV1Response.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1CallbackMethod.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1DetectEntities.d.ts +6 -0
- package/dist/cjs/api/types/ListenV1DetectEntities.js +9 -0
- package/dist/cjs/api/types/ListenV1Diarize.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1Dictation.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1Encoding.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1InterimResults.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1Model.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1Multichannel.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1Numerals.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1ProfanityFilter.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1Punctuate.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1Redact.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1ResponseResultsChannelsItem.d.ts +12 -0
- package/dist/cjs/api/types/ListenV1SmartFormat.d.ts +1 -1
- package/dist/cjs/api/types/ListenV1VadEvents.d.ts +1 -1
- package/dist/cjs/api/types/ListenV2Encoding.d.ts +1 -1
- package/dist/cjs/api/types/OpenAi.d.ts +27 -0
- package/dist/cjs/api/types/OpenAi.js +21 -0
- package/dist/cjs/api/types/OpenAiSpeakProvider.d.ts +27 -0
- package/dist/cjs/api/types/OpenAiSpeakProvider.js +21 -0
- package/dist/cjs/api/types/OpenAiThinkProvider.d.ts +23 -0
- package/dist/cjs/api/types/OpenAiThinkProvider.js +18 -0
- package/dist/cjs/api/types/SpeakSettingsV1.d.ts +20 -0
- package/dist/cjs/api/types/SpeakSettingsV1.js +3 -0
- package/dist/cjs/api/types/SpeakSettingsV1Provider.d.ts +19 -0
- package/dist/cjs/api/types/SpeakSettingsV1Provider.js +3 -0
- package/dist/cjs/api/types/SpeakV1Encoding.d.ts +1 -1
- package/dist/cjs/api/types/SpeakV1Model.d.ts +1 -1
- package/dist/cjs/api/types/SpeakV1SampleRate.d.ts +1 -1
- package/dist/cjs/api/types/ThinkSettingsV1.d.ts +50 -0
- package/dist/cjs/api/types/ThinkSettingsV1.js +3 -0
- package/dist/cjs/api/types/ThinkSettingsV1Provider.d.ts +19 -0
- package/dist/cjs/api/types/ThinkSettingsV1Provider.js +3 -0
- package/dist/cjs/api/types/index.d.ts +15 -0
- package/dist/cjs/api/types/index.js +15 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/middleware/adapters/express.d.ts +103 -0
- package/dist/cjs/middleware/adapters/express.js +141 -0
- package/dist/cjs/middleware/adapters/fastify.d.ts +32 -0
- package/dist/cjs/middleware/adapters/fastify.js +194 -0
- package/dist/cjs/middleware/adapters/http.d.ts +153 -0
- package/dist/cjs/middleware/adapters/http.js +192 -0
- package/dist/cjs/middleware/core/ProxyHandler.d.ts +35 -0
- package/dist/cjs/middleware/core/ProxyHandler.js +225 -0
- package/dist/cjs/middleware/core/TokenManager.d.ts +29 -0
- package/dist/cjs/middleware/core/TokenManager.js +110 -0
- package/dist/cjs/middleware/core/WebSocketProxy.d.ts +32 -0
- package/dist/cjs/middleware/core/WebSocketProxy.js +169 -0
- package/dist/cjs/middleware/core/jwt.d.ts +71 -0
- package/dist/cjs/middleware/core/jwt.js +136 -0
- package/dist/cjs/middleware/core/types.d.ts +37 -0
- package/dist/cjs/middleware/core/types.js +2 -0
- package/dist/cjs/middleware/index.d.ts +55 -0
- package/dist/cjs/middleware/index.js +75 -0
- package/dist/cjs/tests/manual/test-custom-baseurl.js +124 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/CustomClient.mjs +131 -0
- package/dist/esm/api/resources/agent/resources/v1/client/Client.d.mts +2 -0
- package/dist/esm/api/resources/agent/resources/v1/client/Client.mjs +2 -2
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1ConversationText.d.mts +1 -1
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1Settings.d.mts +5 -65
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.d.mts +1 -1
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateSpeak.d.mts +1 -26
- package/dist/esm/api/resources/agent/resources/v1/types/index.d.mts +0 -4
- package/dist/esm/api/resources/agent/resources/v1/types/index.mjs +0 -4
- package/dist/esm/api/resources/listen/resources/v1/client/Client.d.mts +3 -0
- package/dist/esm/api/resources/listen/resources/v1/client/Client.mjs +3 -2
- package/dist/esm/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestCallbackMethod.d.mts +1 -1
- package/dist/esm/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestCustomIntentMode.d.mts +1 -1
- package/dist/esm/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestCustomTopicMode.d.mts +1 -1
- package/dist/esm/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestEncoding.d.mts +1 -1
- package/dist/esm/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestModel.d.mts +1 -1
- package/dist/esm/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestSummarize.d.mts +1 -1
- package/dist/esm/api/resources/listen/resources/v1/resources/media/types/MediaTranscribeRequestVersion.d.mts +1 -1
- package/dist/esm/api/resources/listen/resources/v1/types/ListenV1CloseStream.d.mts +1 -1
- package/dist/esm/api/resources/listen/resources/v1/types/ListenV1Finalize.d.mts +1 -1
- package/dist/esm/api/resources/listen/resources/v1/types/ListenV1KeepAlive.d.mts +1 -1
- package/dist/esm/api/resources/listen/resources/v1/types/ListenV1Results.d.mts +19 -0
- package/dist/esm/api/resources/listen/resources/v2/client/Client.d.mts +2 -0
- package/dist/esm/api/resources/listen/resources/v2/client/Client.mjs +2 -2
- package/dist/esm/api/resources/listen/resources/v2/types/ListenV2CloseStream.d.mts +1 -1
- package/dist/esm/api/resources/listen/resources/v2/types/ListenV2TurnInfo.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/types/BreakdownListRequestDeployment.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/types/BreakdownListRequestGroupingItem.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/keys/types/KeysListRequestStatus.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.mjs +2 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/types/RequestsListRequestDeployment.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/types/RequestsListRequestEndpoint.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/types/RequestsListRequestMethod.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/types/RequestsListRequestStatus.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/types/BreakdownGetRequestDeployment.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/types/BreakdownGetRequestEndpoint.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/types/BreakdownGetRequestGrouping.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/types/BreakdownGetRequestMethod.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/types/UsageGetRequestDeployment.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/types/UsageGetRequestEndpoint.d.mts +1 -1
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/types/UsageGetRequestMethod.d.mts +1 -1
- package/dist/esm/api/resources/read/resources/v1/resources/text/types/TextAnalyzeRequestCallbackMethod.d.mts +1 -1
- package/dist/esm/api/resources/read/resources/v1/resources/text/types/TextAnalyzeRequestCustomIntentMode.d.mts +1 -1
- package/dist/esm/api/resources/read/resources/v1/resources/text/types/TextAnalyzeRequestCustomTopicMode.d.mts +1 -1
- package/dist/esm/api/resources/read/resources/v1/resources/text/types/TextAnalyzeRequestSummarize.d.mts +1 -1
- package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/types/DistributionCredentialsCreateRequestScopesItem.d.mts +1 -1
- package/dist/esm/api/resources/speak/resources/v1/client/Client.d.mts +2 -0
- package/dist/esm/api/resources/speak/resources/v1/client/Client.mjs +2 -2
- package/dist/esm/api/resources/speak/resources/v1/resources/audio/types/AudioGenerateRequestCallbackMethod.d.mts +1 -1
- package/dist/esm/api/resources/speak/resources/v1/resources/audio/types/AudioGenerateRequestContainer.d.mts +1 -1
- package/dist/esm/api/resources/speak/resources/v1/resources/audio/types/AudioGenerateRequestEncoding.d.mts +1 -1
- package/dist/esm/api/resources/speak/resources/v1/resources/audio/types/AudioGenerateRequestModel.d.mts +1 -1
- package/dist/esm/api/resources/speak/resources/v1/types/SpeakV1Clear.d.mts +1 -1
- package/dist/esm/api/resources/speak/resources/v1/types/SpeakV1Cleared.d.mts +1 -1
- package/dist/esm/api/resources/speak/resources/v1/types/SpeakV1Close.d.mts +1 -1
- package/dist/esm/api/resources/speak/resources/v1/types/SpeakV1Flush.d.mts +1 -1
- package/dist/esm/api/resources/speak/resources/v1/types/SpeakV1Flushed.d.mts +1 -1
- package/dist/esm/api/types/AgentThinkModelsV1Response.d.mts +3 -3
- package/dist/esm/api/types/Anthropic.d.mts +17 -0
- package/dist/esm/api/types/Anthropic.mjs +9 -0
- package/dist/esm/api/types/AwsBedrockThinkProvider.d.mts +40 -0
- package/dist/esm/api/types/AwsBedrockThinkProvider.mjs +17 -0
- package/dist/esm/api/types/AwsPollySpeakProvider.d.mts +47 -0
- package/dist/esm/api/types/AwsPollySpeakProvider.mjs +28 -0
- package/dist/esm/api/types/Cartesia.d.mts +24 -0
- package/dist/esm/api/types/Cartesia.mjs +9 -0
- package/dist/esm/api/types/Deepgram.d.mts +76 -0
- package/dist/esm/api/types/Deepgram.mjs +70 -0
- package/dist/esm/api/types/ElevenLabsSpeakProvider.d.mts +20 -0
- package/dist/esm/api/types/ElevenLabsSpeakProvider.mjs +10 -0
- package/dist/esm/api/types/Google.d.mts +18 -0
- package/dist/esm/api/types/Google.mjs +10 -0
- package/dist/esm/api/types/Groq.d.mts +9 -0
- package/dist/esm/api/types/Groq.mjs +2 -0
- package/dist/esm/api/types/ListBillingFieldsV1Response.d.mts +1 -1
- package/dist/esm/api/types/ListenV1CallbackMethod.d.mts +1 -1
- package/dist/esm/api/types/ListenV1DetectEntities.d.mts +6 -0
- package/dist/esm/api/types/ListenV1DetectEntities.mjs +6 -0
- package/dist/esm/api/types/ListenV1Diarize.d.mts +1 -1
- package/dist/esm/api/types/ListenV1Dictation.d.mts +1 -1
- package/dist/esm/api/types/ListenV1Encoding.d.mts +1 -1
- package/dist/esm/api/types/ListenV1InterimResults.d.mts +1 -1
- package/dist/esm/api/types/ListenV1Model.d.mts +1 -1
- package/dist/esm/api/types/ListenV1Multichannel.d.mts +1 -1
- package/dist/esm/api/types/ListenV1Numerals.d.mts +1 -1
- package/dist/esm/api/types/ListenV1ProfanityFilter.d.mts +1 -1
- package/dist/esm/api/types/ListenV1Punctuate.d.mts +1 -1
- package/dist/esm/api/types/ListenV1Redact.d.mts +1 -1
- package/dist/esm/api/types/ListenV1ResponseResultsChannelsItem.d.mts +12 -0
- package/dist/esm/api/types/ListenV1SmartFormat.d.mts +1 -1
- package/dist/esm/api/types/ListenV1VadEvents.d.mts +1 -1
- package/dist/esm/api/types/ListenV2Encoding.d.mts +1 -1
- package/dist/esm/api/types/OpenAi.d.mts +27 -0
- package/dist/esm/api/types/OpenAi.mjs +18 -0
- package/dist/esm/api/types/OpenAiSpeakProvider.d.mts +27 -0
- package/dist/esm/api/types/OpenAiSpeakProvider.mjs +18 -0
- package/dist/esm/api/types/OpenAiThinkProvider.d.mts +23 -0
- package/dist/esm/api/types/OpenAiThinkProvider.mjs +15 -0
- package/dist/esm/api/types/SpeakSettingsV1.d.mts +20 -0
- package/dist/esm/api/types/SpeakSettingsV1.mjs +2 -0
- package/dist/esm/api/types/SpeakSettingsV1Provider.d.mts +19 -0
- package/dist/esm/api/types/SpeakSettingsV1Provider.mjs +2 -0
- package/dist/esm/api/types/SpeakV1Encoding.d.mts +1 -1
- package/dist/esm/api/types/SpeakV1Model.d.mts +1 -1
- package/dist/esm/api/types/SpeakV1SampleRate.d.mts +1 -1
- package/dist/esm/api/types/ThinkSettingsV1.d.mts +50 -0
- package/dist/esm/api/types/ThinkSettingsV1.mjs +2 -0
- package/dist/esm/api/types/ThinkSettingsV1Provider.d.mts +19 -0
- package/dist/esm/api/types/ThinkSettingsV1Provider.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +15 -0
- package/dist/esm/api/types/index.mjs +15 -0
- package/dist/esm/index.d.mts +2 -0
- package/dist/esm/index.mjs +6 -0
- package/dist/esm/middleware/adapters/express.d.mts +103 -0
- package/dist/esm/middleware/adapters/express.mjs +136 -0
- package/dist/esm/middleware/adapters/fastify.d.mts +32 -0
- package/dist/esm/middleware/adapters/fastify.mjs +157 -0
- package/dist/esm/middleware/adapters/http.d.mts +153 -0
- package/dist/esm/middleware/adapters/http.mjs +187 -0
- package/dist/esm/middleware/core/ProxyHandler.d.mts +35 -0
- package/dist/esm/middleware/core/ProxyHandler.mjs +218 -0
- package/dist/esm/middleware/core/TokenManager.d.mts +29 -0
- package/dist/esm/middleware/core/TokenManager.mjs +106 -0
- package/dist/esm/middleware/core/WebSocketProxy.d.mts +32 -0
- package/dist/esm/middleware/core/WebSocketProxy.mjs +162 -0
- package/dist/esm/middleware/core/jwt.d.mts +71 -0
- package/dist/esm/middleware/core/jwt.mjs +99 -0
- package/dist/esm/middleware/core/types.d.mts +37 -0
- package/dist/esm/middleware/core/types.mjs +1 -0
- package/dist/esm/middleware/index.d.mts +55 -0
- package/dist/esm/middleware/index.mjs +59 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -214,9 +214,9 @@ const deepgramClient = new DeepgramClient({
|
|
|
214
214
|
});
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
-
#### Proxy requests in the browser
|
|
217
|
+
#### Proxy requests in the browser (Required)
|
|
218
218
|
|
|
219
|
-
|
|
219
|
+
Due to CORS header restrictions in the Deepgram API, you must use a proxy server when making REST API calls from browsers. To set up your proxy, you configure the SDK like so:
|
|
220
220
|
|
|
221
221
|
```js
|
|
222
222
|
import { DeepgramClient } from "@deepgram/sdk";
|
|
@@ -233,6 +233,8 @@ Your proxy service should replace the Authorization header with `Authorization:
|
|
|
233
233
|
|
|
234
234
|
Check out our example Node-based proxy here: [Deepgram Node Proxy](https://github.com/deepgram-devs/deepgram-node-proxy).
|
|
235
235
|
|
|
236
|
+
**Why is a proxy required?** The SDK sends custom headers (`X-Fern-Runtime-Version`, etc.) that are not whitelisted by the Deepgram API's CORS configuration, causing preflight requests to fail. A proxy bypasses this limitation while also keeping your API key secure.
|
|
237
|
+
|
|
236
238
|
#### Set custom headers for fetch
|
|
237
239
|
|
|
238
240
|
Useful for many things.
|
|
@@ -258,9 +260,11 @@ The SDK works in modern browsers with some considerations:
|
|
|
258
260
|
|
|
259
261
|
### REST API Features (Proxy Required)
|
|
260
262
|
|
|
261
|
-
- **Pre-recorded Transcription**: ⚠️ Requires proxy due to CORS
|
|
262
|
-
- **Text Intelligence**: ⚠️ Requires proxy due to CORS
|
|
263
|
-
- **Management APIs**: ⚠️ Requires proxy due to CORS
|
|
263
|
+
- **Pre-recorded Transcription**: ⚠️ Requires proxy due to CORS header restrictions
|
|
264
|
+
- **Text Intelligence**: ⚠️ Requires proxy due to CORS header restrictions
|
|
265
|
+
- **Management APIs**: ⚠️ Requires proxy due to CORS header restrictions
|
|
266
|
+
|
|
267
|
+
> **Important:** The SDK sends custom headers that are not allowed by the Deepgram API's CORS policy. You must use a proxy server (see setup instructions above) to make REST API calls from browsers.
|
|
264
268
|
|
|
265
269
|
### Setup Options
|
|
266
270
|
|
|
@@ -328,7 +332,7 @@ const deepgramClient = new DeepgramClient({ apiKey: "YOUR_API_KEY" });
|
|
|
328
332
|
|
|
329
333
|
#### Option 4: Proxy for REST APIs
|
|
330
334
|
|
|
331
|
-
See [proxy requests in the browser](#proxy-requests-in-the-browser)
|
|
335
|
+
See [proxy requests in the browser](#proxy-requests-in-the-browser-optional) to hide your API key from client-side code.
|
|
332
336
|
|
|
333
337
|
## Transcription
|
|
334
338
|
|
|
@@ -984,17 +988,54 @@ project, let us know! You can either:
|
|
|
984
988
|
|
|
985
989
|
## Request And Response Types
|
|
986
990
|
|
|
987
|
-
The SDK exports all request and response types as TypeScript interfaces.
|
|
988
|
-
|
|
991
|
+
The SDK exports all request and response types as TypeScript interfaces. You can import them in two ways:
|
|
992
|
+
|
|
993
|
+
### Direct Import (Recommended)
|
|
994
|
+
|
|
995
|
+
Import types directly for better IDE autocomplete and discoverability:
|
|
996
|
+
|
|
997
|
+
```typescript
|
|
998
|
+
import {
|
|
999
|
+
ListenV1Response,
|
|
1000
|
+
SpeakV1Response,
|
|
1001
|
+
ReadV1Response,
|
|
1002
|
+
GetProjectV1Response,
|
|
1003
|
+
CreateKeyV1Response,
|
|
1004
|
+
UsageV1Response,
|
|
1005
|
+
} from "@deepgram/sdk";
|
|
1006
|
+
|
|
1007
|
+
// Use types directly
|
|
1008
|
+
async function handleTranscription(response: ListenV1Response) {
|
|
1009
|
+
console.log(response.metadata);
|
|
1010
|
+
console.log(response.results);
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
async function handleProject(project: GetProjectV1Response) {
|
|
1014
|
+
console.log(project.projectId);
|
|
1015
|
+
console.log(project.name);
|
|
1016
|
+
}
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
### Namespace Import
|
|
1020
|
+
|
|
1021
|
+
Alternatively, import types via the `Deepgram` namespace:
|
|
989
1022
|
|
|
990
1023
|
```typescript
|
|
991
1024
|
import { Deepgram } from "@deepgram/sdk";
|
|
992
1025
|
|
|
1026
|
+
// Use types via namespace
|
|
1027
|
+
async function handleTranscription(response: Deepgram.ListenV1Response) {
|
|
1028
|
+
console.log(response.metadata);
|
|
1029
|
+
console.log(response.results);
|
|
1030
|
+
}
|
|
1031
|
+
|
|
993
1032
|
const request: Deepgram.GrantV1Request = {
|
|
994
|
-
|
|
1033
|
+
// ...
|
|
995
1034
|
};
|
|
996
1035
|
```
|
|
997
1036
|
|
|
1037
|
+
Both import styles refer to the same types and can be used interchangeably or mixed in the same file.
|
|
1038
|
+
|
|
998
1039
|
## Exception Handling
|
|
999
1040
|
|
|
1000
1041
|
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|