{"id":17360203,"url":"https://github.com/srgtuszy/llama-cpp-swift","last_synced_at":"2025-06-20T14:10:51.094Z","repository":{"id":257827043,"uuid":"870734791","full_name":"srgtuszy/llama-cpp-swift","owner":"srgtuszy","description":"Swift bindings for llama-cpp library","archived":false,"fork":false,"pushed_at":"2024-12-10T12:08:36.000Z","size":46,"stargazers_count":57,"open_issues_count":2,"forks_count":20,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-19T08:05:10.208Z","etag":null,"topics":["ios","linux","llama2","llama3","llm","macos","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/srgtuszy.png","metadata":{"files":{"readme":"README.mdown","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,"zenodo":null}},"created_at":"2024-10-10T15:13:15.000Z","updated_at":"2025-06-08T13:38:46.000Z","dependencies_parsed_at":"2025-04-15T00:40:31.278Z","dependency_job_id":null,"html_url":"https://github.com/srgtuszy/llama-cpp-swift","commit_stats":null,"previous_names":["srgtuszy/llama-cpp-swift"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/srgtuszy/llama-cpp-swift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srgtuszy%2Fllama-cpp-swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srgtuszy%2Fllama-cpp-swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srgtuszy%2Fllama-cpp-swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srgtuszy%2Fllama-cpp-swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srgtuszy","download_url":"https://codeload.github.com/srgtuszy/llama-cpp-swift/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srgtuszy%2Fllama-cpp-swift/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260959066,"owners_count":23088817,"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":["ios","linux","llama2","llama3","llm","macos","swift"],"created_at":"2024-10-15T19:16:28.480Z","updated_at":"2025-06-20T14:10:46.076Z","avatar_url":"https://github.com/srgtuszy.png","language":"Swift","readme":"# llama-cpp-swift\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fsrgtuszy%2Fllama-cpp-swift%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/srgtuszy/llama-cpp-swift) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fsrgtuszy%2Fllama-cpp-swift%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/srgtuszy/llama-cpp-swift)\n\nSwift bindings for [llama.cpp](https://github.com/ggerganov/llama.cpp) thanks to which you'll be able to run compatible LLM models directly on your device.\n\n## Features\n\n- Lightweight and easy to use\n- Works on macOS and Linux\n- Supports streaming via structured concurrency\n- Swift 6 ready!\n\n## TODO\n\n- [ ] Unit tests\n- [ ] Model downloads from URL and HuggingFace\n\n## How to install\n\nUse swift package manager:\n\n```\n.package(url: \"https://github.com/srgtuszy/llama-cpp-swift\", branch: \"main\")\n```\n\n## How to use\n\nHere's a quick example on how to use it. For more, please refer to an example app in `example/` folder.\n\n```swift\n// Initialize model\nlet model = try Model(modelPath: \"\u003cmodel path\u003e\")\nlet llama = try LLama(model: model)\n\n// Results are delivered through an `AsyncStream`\nlet prompt = \"what is the meaning of life?\"\nfor try await token in await llama.infer(prompt: prompt, maxTokens: 1024) {\n    print(token, terminator: \"\")\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrgtuszy%2Fllama-cpp-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrgtuszy%2Fllama-cpp-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrgtuszy%2Fllama-cpp-swift/lists"}