{"id":26359116,"url":"https://github.com/assemblyai/assemblyai-java-sdk","last_synced_at":"2025-03-16T15:58:46.551Z","repository":{"id":197059247,"uuid":"693291764","full_name":"AssemblyAI/assemblyai-java-sdk","owner":"AssemblyAI","description":"The AssemblyAI Java SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, audio intelligence models, as well as the latest LeMUR models.","archived":false,"fork":false,"pushed_at":"2024-05-22T17:18:58.000Z","size":8495,"stargazers_count":6,"open_issues_count":8,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-05-22T18:05:59.559Z","etag":null,"topics":["ai","asr","assemblyai","java","llm","speech-to-text","stt","transcription"],"latest_commit_sha":null,"homepage":"https://www.assemblyai.com/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AssemblyAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-18T18:24:56.000Z","updated_at":"2024-05-30T23:18:42.629Z","dependencies_parsed_at":null,"dependency_job_id":"5f2ff760-8b9c-474c-a959-af084951c259","html_url":"https://github.com/AssemblyAI/assemblyai-java-sdk","commit_stats":null,"previous_names":["assemblyai/assemblyai-java-sdk"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssemblyAI%2Fassemblyai-java-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssemblyAI%2Fassemblyai-java-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssemblyAI%2Fassemblyai-java-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssemblyAI%2Fassemblyai-java-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AssemblyAI","download_url":"https://codeload.github.com/AssemblyAI/assemblyai-java-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243893857,"owners_count":20364916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","asr","assemblyai","java","llm","speech-to-text","stt","transcription"],"created_at":"2025-03-16T15:58:46.461Z","updated_at":"2025-03-16T15:58:46.536Z","avatar_url":"https://github.com/AssemblyAI.png","language":"Java","readme":"# AssemblyAI Java Library\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.assemblyai/assemblyai-java)](https://central.sonatype.com/artifact/com.assemblyai/assemblyai-java)\n[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://buildwithfern.com/?utm_source=assemblyai/assemblyai-java-sdk/readme)\n[![GitHub License](https://img.shields.io/github/license/AssemblyAI/assemblyai-java-sdk)](https://github.com/AssemblyAI/assemblyai-java-sdk/blob/main/LICENSE)\n[![AssemblyAI Twitter](https://img.shields.io/twitter/follow/AssemblyAI?label=%40AssemblyAI\u0026style=social)](https://twitter.com/AssemblyAI)\n[![AssemblyAI YouTube](https://img.shields.io/youtube/channel/subscribers/UCtatfZMf-8EkIwASXM4ts0A)](https://www.youtube.com/@AssemblyAI)\n[![Discord](https://img.shields.io/discord/875120158014853141?logo=discord\u0026label=Discord\u0026link=https%3A%2F%2Fdiscord.com%2Fchannels%2F875120158014853141\u0026style=social)\n](https://assembly.ai/discord)\n\n## Documentation\n\nAPI reference documentation is available [here](https://www.assemblyai.com/docs/).\n\n## Requirements\n\nJava 8+\n\n## Installation\n\n### Gradle\n\nAdd the dependency in your `build.gradle`:\n\n```groovy\ndependencies {\n    implementation 'com.assemblyai:assemblyai-java:x.x.x'\n}\n```\n\n### Maven\n\nAdd the dependency in your `pom.xml`:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.assemblyai\u003c/groupId\u003e\n    \u003cartifactId\u003eassemblyai-java\u003c/artifactId\u003e\n    \u003cversion\u003ex.x.x\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## HTTP Client Usage\n\nThe SDK exports a vanilla HTTP client, `AssemblyAI`. You can\nuse this to call into each of our API endpoints and get typed\nresponses back.\n\n```java\nimport com.assemblyai.api.AssemblyAI;\n\nAssemblyAI aai = AssemblyAI.builder()\n  .apiKey(\"YOUR_API_KEY\")\n  .build();\n\nTranscript transcript = aai.transcripts().get(\"transcript-id\");\n\nSystem.out.printlin(\"Received response!\" + transcript);\n```\n\n### Handling Errors\nWhen the API returns a non-success status code (4xx or 5xx response),\na subclass of [ApiError](src/main/java/com/assemblyai/api/core/ApiError.java)\nwill be thrown:\n\n```java\nimport com.assemblyai.api.core.ApiError;\n\ntry {\n  aai.transcript().get(\"transcript-id\");\n} catch (ApiError error) {\n  System.out.println(error.getBody());\n  System.out.println(error.getStatusCode());\n}\n```\n\n## Creating a transcript\nWhen you create a transcript, you can either pass in a URL to an audio file \nor upload a file directly.\n\n```java\nimport com.assemblyai.api.resources.transcripts.types.Transcript;\n\n// Transcribe file at remote URL\nTranscript transcript = aai.transcripts().transcribe(\n        \"https://assembly.ai/espn.m4a\");\n\n// Upload a file via local path and transcribe\ntranscript = aai.transcripts().transcribe(\n        new File(\"./news.mp4\"));\n```\n\n`transcribe` queues a transcription job and polls it until the status is completed or error.\nIf you don't want to wait until the transcript is ready, you can use submit:\n\n```java\nimport com.assemblyai.api.resources.transcripts.types.Transcript;\n\n// Transcribe file at remote URL\nTranscript transcript = aai.transcripts().submit(\n        \"https://assembly.ai/espn.m4a\");\n\n// Upload a file via local path and transcribe\ntranscript = aai.transcripts().submit(\n        new File(\"./news.mp4\"));\n```\n\n## Using the Realtime Transcriber\nThe Realtime Transcriber can be used to process any live\naudio streams and sends data over websockets. The Realtime Transcriber\nwill take event handlers\n\n```java\nimport com.assemblyai.api.RealtimeTranscriber;\n\nRealtimeTranscriber realtime = RealtimeTranscriber.builder()\n  .apiKey(\"YOUR_API_KEY\")\n  .onPartialTranscript(partial -\u003e System.out.println(partial))\n  .onFinalTranscript(finalTranscript -\u003e System.out.println(finalTranscript))\n  .build();\n\nrealtime.sendAudio(new byte[]{...});\n\nrealtime.close();\n```\n\n## Staged Builders\nThe generated builders all follow the staged builder pattern.\nRead more [here](https://immutables.github.io/immutable.html#staged-builder).\nStaged builders only allow you to construct the object once all required\nproperties have been specified.\n\nFor example, in the snippet below, you will not be able to access the build\nmethod on `CreateTranscriptParameters` until you have specified the mandatory\naudioUrl variable.\n\n```java\nimport com.assemblyai.api.resources.transcripts.requests.TranscriptParams;\n\nTranscriptParams params = TranscriptParams.builder()\n        .audioUrl(\"https://...\")\n        .build();\n```\n\n## Timeouts\n\nThe SDK uses the default timeouts of OkHttpClient:\n* 10 seconds for connection timeout\n* 10 seconds for read timeout\n* 10 seconds for write timeout\n* No timeout for call timeout\n\nHowever, there are **no timeouts for any LeMUR** HTTP request.\n\nTo specify your own timeout, you can pass `RequestOptions` to each request method:\n\n```java\nimport com.assemblyai.api.core.RequestOptions;\n\n// initialize client\n\nclient.transcripts()\n        .get(\n                \"50c54d73-7a3f-44dc-af6b-f4579841b1ce\",\n                RequestOptions.builder()\n                        .timeout(30, TimeUnit.SECONDS)\n                        .build()\n        );\n```\n\nFor this operation, the call timeout will be 30 seconds, and the other timeouts will be turned off.\n\nThe default timeout should be sufficient for most use cases. \nHowever, depending on your network speed and distance, you may occasionally experience timeouts, in which case you can increase the timeout.\n\n## Android\n\nIf you've enabled [Code shrinking](https://developer.android.com/build/shrink-code#shrink-code) using `minifyEnabled`, you need to add the following ProGuard configuration to keep R8 from incorrectly marking the SDK classes as unused.\n```text\n-keep class com.assemblyai.api.** { *; }\n```\n\n## Contributing\nWhile we value open-source contributions to this SDK, this library\nis generated programmatically. Additions made directly to this library\nwould have to be moved over to our generation code, otherwise they would\nbe overwritten upon the next generated release. Feel free to open a PR as a\nproof of concept, but know that we will not be able to merge it as-is.\nWe suggest opening an issue first to discuss with us!\n\nOn the other hand, contributions to the README are always very welcome!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassemblyai%2Fassemblyai-java-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fassemblyai%2Fassemblyai-java-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassemblyai%2Fassemblyai-java-sdk/lists"}