{"id":20003449,"url":"https://github.com/nathanborror/swift-anthropic","last_synced_at":"2025-05-04T15:34:59.331Z","repository":{"id":215893151,"uuid":"739983170","full_name":"nathanborror/swift-anthropic","owner":"nathanborror","description":"An easy way to use the Anthropic platform in Swift.","archived":false,"fork":false,"pushed_at":"2025-05-02T17:30:22.000Z","size":2449,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-02T17:55:02.185Z","etag":null,"topics":["anthropic","claude","llm","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/nathanborror.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,"zenodo":null}},"created_at":"2024-01-07T06:27:38.000Z","updated_at":"2025-05-02T17:30:25.000Z","dependencies_parsed_at":"2024-06-02T18:17:39.259Z","dependency_job_id":"b0ddb1d9-4222-4072-9cff-9b0a2f6dddcd","html_url":"https://github.com/nathanborror/swift-anthropic","commit_stats":null,"previous_names":["nathanborror/swift-anthropic"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanborror%2Fswift-anthropic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanborror%2Fswift-anthropic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanborror%2Fswift-anthropic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanborror%2Fswift-anthropic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nathanborror","download_url":"https://codeload.github.com/nathanborror/swift-anthropic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252357396,"owners_count":21735137,"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":["anthropic","claude","llm","swift"],"created_at":"2024-11-13T05:25:38.520Z","updated_at":"2025-05-04T15:34:59.321Z","avatar_url":"https://github.com/nathanborror.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"Images/Animal.png\" width=\"256\"\u003e\n\n# Swift Anthropic\n\nAn unofficial Swift client library for interacting with [Anthropic's API](https://docs.anthropic.com).\n\n## Requirements\n\n- Swift 5.9+\n- iOS 16+\n- macOS 13+\n- watchOS 9+\n- tvOS 16+\n\n## Installation\n\nAdd the following to your `Package.swift` file:\n\n```swift\nPackage(\n    dependencies: [\n        .package(url: \"https://github.com/nathanborror/swift-anthropic\", branch: \"main\"),\n    ],\n    targets: [\n        .target(\n            name: \"YourApp\",\n            dependencies: [\n                .product(name: \"Anthropic\", package: \"swift-anthropic\"),\n            ]\n        ),\n    ]\n)\n```\n\n## Usage\n\n### Chat Completion\n\n```swift\nimport Anthropic\n\nlet client = Client(apiKey: ANTHROPIC_API_KEY)\n\nlet req = ChatRequest(\n    messages: [.init(text: \"Hello, Anthropic!\", role: .user)],\n    model: \"claude-3-7-sonnet-latest\"\n)\n\ndo {\n    let response = try await client.chatCompletions(request)\n    print(response)\n} catch {\n    print(error)\n}\n```\n\n### List models\n\n```swift\nimport Anthropic\n\nlet client = Client(apiKey: ANTHROPIC_API_KEY)\n\ndo {\n    let response = try await client.models()\n    print(response.data.map { $0.id }.joined(separator: \"\\n\"))\n} catch {\n    print(error)\n}\n```\n\n### Command Line Interface\n\n```\n$ make\n$ ./anthropic\nOVERVIEW: A utility for interacting with the Anthropic API.\n\nUSAGE: anthropic \u003csubcommand\u003e\n\nOPTIONS:\n  --version               Show the version.\n  -h, --help              Show help information.\n\nSUBCOMMANDS:\n  models                  Returns available models.\n  chat-completion         Completes a chat request.\n\n  See 'anthropic help \u003csubcommand\u003e' for detailed help.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanborror%2Fswift-anthropic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathanborror%2Fswift-anthropic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanborror%2Fswift-anthropic/lists"}