Community Go SDK for Deepgram. Start building with our powerful transcription & speech understanding API.
This SDK only supports hosted usage of api.deepgram.com.
- Deepgram Go SDK
- Getting an API Key
- Documentation
- Installation
- Requirements
- Configuration
- Transcription
- Generating Captions
- Projects
- Keys
- Members
- Scopes
- Invitations
- Usage
🔑 To access the Deepgram API you will need a free Deepgram API Key.
You can learn more about the full Deepgram API at https://developers.deepgram.com.
go get github.com/deepgram-devs/deepgram-go-sdk
Go (version ^1.18)
dg := deepgram.NewClient(DEEPGRAM_API_KEY)
Contributors to the SDK can test their changes locally by running the projects in the examples
folder. This can be done when making changes without adding a unit test, but of course it is recommended that you add unit tests for any feature additions made to the SDK.
Go to the folder examples
and look for these two projects, which can be used to test out features in the Deepgram Go SDK:
- prerecorded
- streaming
These are standalone projects, so you will need to follow the instructions in the README.md files for each project to get it running.
dg := deepgram.NewClient("DEEPGRAM_API_KEY")
res, err := dg.PreRecordedFromURL(deepgram.UrlSource{Url: "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav"},
deepgram.PreRecordedTranscriptionOptions{Punctuate: true, Utterances: true})
See our Pre-Recorded Quickstart for more info.
Property | Value | Description |
---|---|---|
Url | string | Url of the file to transcribe |
dg := deepgram.NewClient("DEEPGRAM_API_KEY")
file, err := os.Open("PATH_TO_LOCAL_FILE")
if err != nil {
fmt.Printf("error opening file %s:", file.Name())
}
source := deepgram.ReadStreamSource{Stream: file, Mimetype: "MIMETYPE_OF_YOUR_FILE"}
res, err := dg.PreRecordedFromStream(source, deepgram.PreRecordedTranscriptionOptions{Punctuate: true})
if err != nil {
fmt.Println("ERROR", err)
return
}
See our Pre-Recorded Quickstart for more info.
Property | Value Type | reason for |
---|---|---|
Stream | io.Reader | stream to transcribe |
MimeType | string | MIMETYPE of stream |
Property | Value Type | Example |
---|---|---|
Model | string | Model: "phonecall" |
Tier | string | Tier: "nova" |
Version | string | Version: "latest" |
Language | string | Language: "es" |
DetectLanguage | bool | DetectLanguage: true |
Punctuate | bool | Punctuate: true |
Profanity_filter | bool | Profanity_filter: true |
Redact | bool | Redact: true |
Diarize | bool | Diarize: true |
SmartFormat | bool | SmartFormat: true |
Multichannel | bool | Multichannel: true |
Alternatives | int | Alternatives: 2 |
Numerals | bool | Numerals: true |
Search | []string | Search: []string{"apple"} |
Replace | []string | Replace:[]string{"apple:orange"} |
Callback | string | Callback: "https://example.com" |
Keywords | []string | Keywords: []string{"Hannah"} |
Paragraphs | bool | Paragraphs: true |
Summarize | bool | Summarize: true |
DetectTopics | bool | DetectTopics: true |
Utterances | bool | Utterances: true |
Utt_split | int | Utt_split: 9 |
// The request can be from a local file stream or a URL
// Turn on utterances with {Utterances: true} for captions to work
res, err := dg.PreRecordedFromStream(source, deepgram.PreRecordedTranscriptionOptions{Punctuate: true, Utterances:true})
// Convert the results to WebVTT format
vtt, err := res.ToWebVTT()
// Convert the results to SRT format
stt, err := res.ToSRT()
dg := *deepgram.NewClient("DEEPGRAM_API_KEY")
options := deepgram.LiveTranscriptionOptions{
Language: "en-US",
Punctuate: true,
}
ws, _, err := dg.LiveTranscription(options)
See API Reference
projectId and memberId are of type
string
Returns all projects accessible by the API key.
dg := deepgram.NewClient("YOUR_API_KEY")
res, err := dg.ListProjects()
See our API reference for more info.
Retrieves a specific project based on the provided projectId.
dg := deepgram.NewClient("YOUR_API_KEY")
res, err := dg.GetProject(projectId)
See our API reference for more info.
Update a project.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
options := deepgram.ProjectUpdateOptions{
Name: "NAME_OF_PROJECT",
Company:"COMPANY",
}
res, err := dg.UpdateProject(projectID, options)
Project Type
Property Name | Type | Description |
---|---|---|
ProjectId | string | Unique identifier of the Deepgram project |
Name | string | Name of the project |
Company | string | Name of the company associated with the Deepgram project |
See our API reference for more info.
Delete a project.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
res, err := dg.DeleteProject(projectID)
See our API reference for more info.
projectId,keyId and comment are of type
string
Retrieves all keys associated with the provided project_id.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
res, err := dg.ListKeys(projectID)
See our API reference for more info.
Retrieves a specific key associated with the provided project_id.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
keyID := "YOUR_KEY_ID"
res, err := dg.GetKey(projectID, keyID)
See our API reference for more info.
Creates an API key with the provided scopes.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
comment := "A comment"
scopes := []string{"admin", "member"}
options := deepgram.CreateKeyOptions{
ExpirationDate: time.Now().AddDate(1, 0, 0),
TimeToLive: 3600,
Tags: []string{"tag1", "tag2"},
}
res, err := dg.CreateKey(projectID, comment, scopes, options)
See our API reference for more info.
Deletes a specific key associated with the provided project_id.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
keyID := "YOUR_KEY_ID"
res, err := dg.DeleteKey(projectID, keyID)
See our API reference for more info.
projectId and memberId are of type
string
Retrieves account objects for all of the accounts in the specified project_id.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
res, err := dg.ListMembers(projectID)
See our API reference for more info.
Removes member account for specified member_id.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
memberID := "YOUR_MEMBER_ID"
res, err := dg.RemoveMember(projectID, memberID)
See our API reference for more info.
projectId and memberId are of type
string
Retrieves scopes of the specified member in the specified project.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
memberID := "YOUR_MEMBER_ID"
res, err := dg.GetMemberScopes(projectID, memberID)
See our API reference for more info.
Updates the scope for the specified member in the specified project.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
memberID := "THEIR_MEMBER_ID"
scope := "SCOPE_TO_ASSIGN"
res, err := dg.UpdateMemberScopes(projectID, memberID, scope)
See our API reference for more info.
Retrieves all invitations associated with the provided project_id.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
res, err := dg.ListInvitations(projectID)
See our API reference for more info.
Sends an invitation to the provided email address.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
invitationOptions := deepgram.InvitationOptions{
Email: "",
Scope: "",
}
res, err := dg.SendInvitation(projectID, invitationOptions)
See our API reference for more info.
Removes the specified invitation from the project.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
email := ""
res, err := dg.DeleteInvitation(projectID, email)
See our API reference for more info.
Removes the authenticated user from the project.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
res, err := dg.LeaveProject(projectID)
See our API reference for more info.
projectId and requestId type
string
Retrieves all requests associated with the provided projectId based on the provided options.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
options := deepgram.UsageRequestListOptions{
Start: "2009-11-10",
End: "2029-11-10",
Page: 0,
Limit:0,
Status: "failed",
}
res, err := dg.ListRequests(projectID, options)
Property | Type | Description |
---|---|---|
Start | string | Start date of the requested date range, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM |
End | string | End date of the requested date range, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM |
Page | int | Pages to include |
Limit | int | number of results per page |
Status | string | Status of requests to return |
See our API reference for more info.
Retrieves a specific request associated with the provided projectId.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
requestID := "REQUEST_ID"
res, err := dg.GetRequest(projectID, requestID)
See our API reference for more info.
Retrieves usage associated with the provided project_id based on the provided options.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
options := deepgram.UsageOptions{
Start: "2009-11-10",
End: "2029-11-10",
}
res, err := dg.GetUsage(projectID, options)
Property | Value | Description |
---|---|---|
Start | string | Start date of the requested date range, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM |
End | string | End date of the requested date range, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM |
See our API reference for more info.
Lists the features, models, tags, languages, and processing method used for requests in the specified project.
dg := deepgram.NewClient("YOUR_API_KEY")
projectID := "YOUR_PROJECT_ID"
options := deepgram.UsageRequestListOptions{
Start: "2009-11-10",
End: "2029-11-10",
}
res, err := dg.GetFields(projectID, options)
Property | Value | Description |
---|---|---|
StartDateTime | DateTime | Start date of the requested date range, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM |
EndDateTime | DateTime | End date of the requested date range, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM |
See our API reference for more info.
Interested in contributing? We ❤️ pull requests!
To make sure our community is safe for all, be sure to review and agree to our Code of Conduct. Then see the Contribution guidelines for more information.
We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either: