{"id":18772694,"url":"https://github.com/vyfor/groq-kt","last_synced_at":"2025-04-10T21:12:33.204Z","repository":{"id":261409433,"uuid":"884076235","full_name":"vyfor/groq-kt","owner":"vyfor","description":"📦 Kotlin Multiplatform library for the Groq API","archived":false,"fork":false,"pushed_at":"2025-01-27T21:46:03.000Z","size":144,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T21:12:32.493Z","etag":null,"topics":["android","groq","groq-api","groq-integration","javascript","js","jvm","kmp","kotlin","kotlin-native","multiplatform","native","sdk","sdk-kotlin"],"latest_commit_sha":null,"homepage":"https://central.sonatype.com/artifact/io.github.vyfor/groq-kt","language":"Kotlin","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/vyfor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","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":"2024-11-06T05:05:57.000Z","updated_at":"2025-03-09T13:11:51.000Z","dependencies_parsed_at":"2024-11-06T12:37:04.976Z","dependency_job_id":"72619f2e-34bc-4cd9-bdc8-274188a15b24","html_url":"https://github.com/vyfor/groq-kt","commit_stats":null,"previous_names":["vyfor/groq-kt"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vyfor%2Fgroq-kt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vyfor%2Fgroq-kt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vyfor%2Fgroq-kt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vyfor%2Fgroq-kt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vyfor","download_url":"https://codeload.github.com/vyfor/groq-kt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248298316,"owners_count":21080320,"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":["android","groq","groq-api","groq-integration","javascript","js","jvm","kmp","kotlin","kotlin-native","multiplatform","native","sdk","sdk-kotlin"],"created_at":"2024-11-07T19:29:56.964Z","updated_at":"2025-04-10T21:12:33.180Z","avatar_url":"https://github.com/vyfor.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📚 Groq Kotlin Library \n\n![Maven Central Version](https://img.shields.io/maven-central/v/io.github.vyfor/groq-kt)\n\n**An idiomatic [Kotlin Multiplatform](https://kotlinlang.org/docs/multiplatform.html) library for the [Groq](https://groq.com/) API.**\n\n## 💎 Features\n- 🚀 Built with [Ktor](https://ktor.io/) for seamless networking\n- 🎨 Complete and documented API for chat completions, audio transcription, and translation, including tool support and function calling\n- ⚡ Real-time streaming responses via Kotlin Flows\n- 🧩 Rich, idiomatic DSL for clean and expressive syntax\n- 🔒 Ensures required validations are met before request submission\n- 🔧 Allows specifying default values for API requests in client configuration\n- ⏳ Automatically handles rate limiting and retries on failed requests\n- 📱 Supports multiple platforms:\n  - Android\n  - iOS\n  - JavaScript\n  - JVM\n  - Linux\n  - macOS\n  - Windows\n  - WebAssembly\n  - tvOS, watchOS\n\n## 🔌 Requirements\n- Java 8 or higher (only for use within the JVM environment)\n\n## ⚙️ Installation\n\nAdd these dependencies to your project:\n```kotlin\ndependencies {\n    implementation(\"io.github.vyfor:groq-kt:0.1.0\")\n    /* required */\n    implementation(\"io.ktor:ktor-client-$engine:$version\")\n}\n```\n\nFor the list of supported engines, see [Ktor Client Engines](https://ktor.io/docs/client-engines.html#platforms).\n\n## 🧩 Usage\n\n### Initialization\n```kotlin\n/* It is recommended to use an environment variable for the API key */\nval apiKey = System.getenv(\"GROQ_API_KEY\")        // JVM\nval apiKey = process.env.GROQ_API_KEY             // JS\nval apiKey = getenv(\"GROQ_API_KEY\")!!.toKString() // Native\n\nval client = GroqClient(apiKey)\n```\n\n### Specifying default values\nYou can configure default values for requests. These values will be automatically applied to every request made with a DSL function.\n```kotlin\nval client = GroqClient(apiKey) {\n  defaults {\n    chatCompletion {\n      model = GroqModel.LLAMA_3_8B_8192\n    }\n    \n    audioTranscription {\n      format = AudioResponseFormat.VERBOSE_JSON\n    }\n  }\n}\n```\n\n### Chat completion\n```kotlin\nval response = client.chat {\n    model = GroqModel.LLAMA_3_8B_8192\n\n    messages {\n        system(\"You are a helpful assistant.\")\n        text(\"What is the capital of Germany?\")\n    }\n}\n```\n\n### Streaming\n```kotlin\nval response = client.chatStreaming {\n    model = GroqModel.LLAMA_3_2_90B_VISION_PREVIEW\n\n    messages {\n        user(\n          \"Describe what you see in the image.\",\n          \"https://example.com/image.png\"\n        )\n    }\n}.data.collect { chunk -\u003e\n    println(chunk)\n}\n```\n\n### Audio transcription\n```kotlin\nval response = client.transcribe {\n    model = GroqModel.DISTIL_WHISPER_LARGE_V3_EN\n\n    file(\"path/to/audio.mp3\")\n    /* or */\n    url = \"https://example.com/audio.mp3\"\n}\n```\n\n### Audio translation\n\u003e [!NOTE]\n\u003e Does not seem to be supported by the API yet.\n```kotlin\nval response = client.translate {\n    model = GroqModel.DISTIL_WHISPER_LARGE_V3_EN\n\n    file(\"path/to/audio.mp3\")\n    /* or */\n    url = \"https://example.com/audio.mp3\"\n}\n```\n\n## ⚖️ License\n`groq-kt` is licensed under the [MIT License](./LICENSE).\n\nThe project is not affiliated with [Groq](https://groq.com/) in any way.\n\n## 📚 Documentation\n\nThe REST API documentation can be found on [console.groq.com](https://console.groq.com/docs).\n\n## 🌱 Contributing\nThis project is in beta and hasn't undergone excessive testing. Contributions of any kind are welcome, just make sure you read the [Contribution Guidelines](./.github/CONTRIBUTING.md) first. You can also contact me directly on Discord (**[vyfor](https://discord.com/users/446729269872427018)**) if you have any questions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvyfor%2Fgroq-kt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvyfor%2Fgroq-kt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvyfor%2Fgroq-kt/lists"}