{"id":17603462,"url":"https://github.com/lebrunel/anthropix","last_synced_at":"2025-04-15T03:53:37.208Z","repository":{"id":226950303,"uuid":"770039892","full_name":"lebrunel/anthropix","owner":"lebrunel","description":"Unofficial Anthropic API client for Elixir. Integrate Claude, Anthropic's powerful language model, into your applications.","archived":false,"fork":false,"pushed_at":"2024-06-13T11:38:11.000Z","size":112,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-05T11:07:06.183Z","etag":null,"topics":["ai","anthropic","api-client","claude-ai","elixir","llms"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/anthropix","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lebrunel.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":"2024-03-10T18:49:46.000Z","updated_at":"2024-08-25T05:45:07.000Z","dependencies_parsed_at":"2024-04-18T16:44:36.946Z","dependency_job_id":"31c280e5-5edf-44ca-873e-d5cbde9c736f","html_url":"https://github.com/lebrunel/anthropix","commit_stats":null,"previous_names":["lebrunel/anthropix"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebrunel%2Fanthropix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebrunel%2Fanthropix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebrunel%2Fanthropix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebrunel%2Fanthropix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lebrunel","download_url":"https://codeload.github.com/lebrunel/anthropix/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249003955,"owners_count":21196794,"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","anthropic","api-client","claude-ai","elixir","llms"],"created_at":"2024-10-22T13:48:49.489Z","updated_at":"2025-04-15T03:53:37.202Z","avatar_url":"https://github.com/lebrunel.png","language":"Elixir","funding_links":[],"categories":["LLM Clients and APIs"],"sub_categories":[],"readme":"# Anthropix\n\n![Anthropix](https://raw.githubusercontent.com/lebrunel/anthropix/main/media/poster.webp)\n\n![Hex.pm](https://img.shields.io/hexpm/v/anthropix?color=informational)\n![License](https://img.shields.io/github/license/lebrunel/anthropix?color=informational)\n![Build Status](https://img.shields.io/github/actions/workflow/status/lebrunel/anthropix/elixir.yml?branch=main)\n\nAnthropix is an open-source Elixir client for the Anthropic API, providing a simple and convenient way to integrate Claude, Anthropic's powerful language model, into your applications.\n\n- ✅ API client fully implementing the [Anthropic API](https://docs.anthropic.com/claude/reference/getting-started-with-the-api)\n- 🧰 Tool use (function calling)\n- 🧠 Extended thinking\n- ⚡ Prompt caching\n- 📦 Message batching\n- 🛜 Streaming API requests\n  - Stream to an Enumerable\n  - Or stream messages to any Elixir process\n\n## Installation\n\nThe package can be installed by adding `anthropix` to your list of dependencies in `mix.exs`.\n\n```elixir\ndef deps do\n  [\n    {:anthropix, \"~\u003e 0.6\"}\n  ]\nend\n```\n\n## Quickstart\n\n\u003e [!NOTE]\n\u003e #### Beta features\n\u003e\n\u003e Anthropic frequently ship new features under a beta flag, requiring headers to be added to your requests to take advantage of the feature.\n\u003e\n\u003e If required, beta headers can be added with `init/2`.\n\u003e\n\u003e ```elixir\n\u003e client = Anthropix.init(beta: [\"output-128k-2025-02-19\"])\n\u003e ```\n\nFor more examples, refer to the [Anthropix documentation](https://hexdocs.pm/anthropix).\n\n### Initiate a client.\n\nSee `Anthropix.init/2`.\n\n```elixir\nclient = Anthropix.init(api_key)\n```\n\n### Chat with Claude\n\nSee `Anthropix.chat/2`.\n\n```elixir\nmessages = [\n  %{role: \"user\", content: \"Why is the sky blue?\"},\n  %{role: \"assistant\", content: \"Due to rayleigh scattering.\"},\n  %{role: \"user\", content: \"How is that different than mie scattering?\"},\n]\n\nAnthropix.chat(client, [\n  model: \"claude-3-opus-20240229\",\n  messages: messages,\n])\n# {:ok, %{\"content\" =\u003e [%{\n#   \"type\" =\u003e \"text\",\n#   \"text\" =\u003e \"Mie scattering affects all wavelengths similarly, while Rayleigh favors shorter ones.\"\n# }], ...}}\n```\n\n### Streaming\n\nA streaming request can be initiated by setting the `:stream` option.\n\nWhen `:stream` is true a lazy `t:Enumerable.t/0` is returned which can be used with any `Stream` functions.\n\n```elixir\n{:ok, stream} = Anthropix.chat(client, [\n  model: \"claude-3-opus-20240229\",\n  messages: messages,\n  stream: true,\n])\n# {:ok, #Function\u003c52.53678557/2 in Stream.resource/3\u003e}\n\nstream\n|\u003e Stream.each(\u0026update_ui_with_chunk/1)\n|\u003e Stream.run()\n# :ok\n```\n\nBecause the above approach builds the `t:Enumerable.t/0` by calling `receive`, using this approach inside GenServer callbacks may cause the GenServer to misbehave. Setting the `:stream` option to a `t:pid/0` returns a `t:Task.t/0` which will send messages to the specified process.\n\n## License\n\nThis package is open source and released under the [Apache-2 License](https://github.com/lebrunel/ollama/blob/master/LICENSE).\n\n© Copyright 2024 [Push Code Ltd](https://www.pushcode.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flebrunel%2Fanthropix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flebrunel%2Fanthropix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flebrunel%2Fanthropix/lists"}