{"id":50795286,"url":"https://github.com/zerogpu/langchain-zerogpu","last_synced_at":"2026-06-12T14:01:31.521Z","repository":{"id":361934461,"uuid":"1253142717","full_name":"zerogpu/langchain-zerogpu","owner":"zerogpu","description":"LangChain tools for ZeroGPU's nano language models — classify, summarize, extract PII, and more.","archived":false,"fork":false,"pushed_at":"2026-06-08T15:57:38.000Z","size":632,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-09T03:21:01.871Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/zerogpu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-29T07:30:52.000Z","updated_at":"2026-06-08T15:47:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/zerogpu/langchain-zerogpu","commit_stats":null,"previous_names":["zerogpu/langchain-zerogpu"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zerogpu/langchain-zerogpu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerogpu%2Flangchain-zerogpu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerogpu%2Flangchain-zerogpu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerogpu%2Flangchain-zerogpu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerogpu%2Flangchain-zerogpu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerogpu","download_url":"https://codeload.github.com/zerogpu/langchain-zerogpu/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerogpu%2Flangchain-zerogpu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34247461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-06-12T14:01:10.195Z","updated_at":"2026-06-12T14:01:31.512Z","avatar_url":"https://github.com/zerogpu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://zerogpu.ai\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/zerogpu/langchain-zerogpu/main/assets/logo.png\" alt=\"ZeroGPU\" width=\"128\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# langchain-zerogpu\n\nLangChain tools for [ZeroGPU](https://zerogpu.ai).\n\nZeroGPU is a compute-efficient inference provider for apps and agents. We run\npurpose-built small and nano language models across an edge network for the\nhigh-volume tasks you run constantly — classification, extraction, moderation,\nrouting, summarization — at ~10x lower latency and 50%+ lower cost than\nfrontier-model workflows. Auto-scaling, with zero GPU infrastructure to manage.\nPlug in and you're live.\n\nThis package exposes those models as first-class LangChain\n[`BaseTool`](https://python.langchain.com/docs/concepts/tools/) subclasses, so\nany LangChain agent — including `create_agent` and LangGraph graphs — can offload\nthese repeatable NLP tasks (classification, summarization, entity / JSON\nextraction, PII redaction, and short chat) to ZeroGPU instead of spending\nfrontier-model tokens.\n\nAll calls go through the official [`zerogpu-api`](https://pypi.org/project/zerogpu-api/)\nPython SDK.\n\n## Install\n\n```bash\npip install langchain-zerogpu\n```\n\n## Authenticate\n\nEvery request needs a ZeroGPU **API key** (starts with `zgpu-api-`) and a\n**project id**. Provide them via environment variables:\n\n```bash\nexport ZEROGPU_API_KEY=\"zgpu-api-...\"\nexport ZEROGPU_PROJECT_ID=\"your-project-id\"\n```\n\n…or pass them directly to any tool or the toolkit:\n\n```python\nfrom langchain_zerogpu import ZeroGPUSummarizeTool\n\ntool = ZeroGPUSummarizeTool(api_key=\"zgpu-api-...\", project_id=\"your-project-id\")\n```\n\nThe API key is stored as a `pydantic.SecretStr` and is never logged.\n\n## The tools\n\n| Tool class | ZeroGPU model | Purpose |\n| --- | --- | --- |\n| `ZeroGPUChatTool` | `LFM2.5-1.2B-Instruct` | Short single-turn chat reply |\n| `ZeroGPUChatThinkingTool` | `LFM2.5-1.2B-Thinking` | Chat with a visible reasoning trace |\n| `ZeroGPUSummarizeTool` | `llama-3.1-8b-instruct-fast` | Condense a passage |\n| `ZeroGPUClassifyIABTool` | `zlm-v1-iab-classify-edge` | IAB taxonomy classification |\n| `ZeroGPUClassifyIABEnrichedTool` | `zlm-v1-iab-classify-edge-enriched` | IAB + topics / keywords / intent |\n| `ZeroGPUClassifyZeroShotTool` | `deberta-v3-small` | Zero-shot vs. custom labels |\n| `ZeroGPUClassifyStructuredTool` | `gliner2-base-v1` | Multi-axis schema classification |\n| `ZeroGPUExtractEntitiesTool` | `gliner2-base-v1` | Custom-label NER |\n| `ZeroGPUExtractPIITool` | `gliner-multi-pii-v1` | Extract PII entities (JSON) |\n| `ZeroGPURedactPIITool` | `gliner-multi-pii-v1` | Mask PII inline with `[LABEL]` |\n| `ZeroGPUExtractJSONTool` | `gliner2-base-v1` | Schema-driven JSON extraction |\n\n## Quick start\n\n```python\nfrom langchain_zerogpu import ZeroGPUClassifyZeroShotTool\n\ntool = ZeroGPUClassifyZeroShotTool()  # reads creds from the environment\n\nprint(tool.invoke({\n    \"text\": \"The new GPU smashes every benchmark we threw at it.\",\n    \"labels\": [\"tech\", \"politics\", \"sports\"],\n}))\n```\n\nTools work asynchronously too:\n\n```python\nresult = await tool.ainvoke({\"text\": \"...\", \"labels\": [\"a\", \"b\"]})\n```\n\n## Bind the tools to an agent\n\nUse the toolkit to get all eleven tools — wired to a single shared client — and\nbind them to an agent:\n\n```python\nfrom langchain.agents import create_agent\nfrom langchain_zerogpu import ZeroGPUToolkit\n\ntoolkit = ZeroGPUToolkit()  # reads ZEROGPU_API_KEY / ZEROGPU_PROJECT_ID\ntools = toolkit.get_tools()\n\nagent = create_agent(\"anthropic:claude-sonnet-4-6\", tools=tools)\n\nagent.invoke({\n    \"messages\": [\n        {\"role\": \"user\", \"content\": \"Redact the PII in: 'Call Jane at 555-0100.'\"}\n    ]\n})\n```\n\nOr bind a single tool to a chat model directly:\n\n```python\nfrom langchain.chat_models import init_chat_model\nfrom langchain_zerogpu import ZeroGPUExtractPIITool\n\nllm = init_chat_model(\"anthropic:claude-sonnet-4-6\")\nllm_with_tools = llm.bind_tools([ZeroGPUExtractPIITool()])\n```\n\n## Errors\n\nFailures surface as clear, typed exceptions instead of raw stack traces:\n\n- `ZeroGPUAuthError` — missing / malformed credentials, `401`, or `403`.\n- `ZeroGPUError` — rate limits (`429`), server errors (`5xx`), and network\n  failures.\n\n## Development\n\n```bash\nmake install            # uv sync --all-groups\nmake lint               # ruff check + format --check\nmake mypy               # mypy (disallow_untyped_defs)\nmake test               # unit tests, sockets disabled\nmake integration_test   # integration tests (needs real ZeroGPU creds)\n```\n\n## License\n\nMIT — see [LICENSE](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerogpu%2Flangchain-zerogpu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerogpu%2Flangchain-zerogpu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerogpu%2Flangchain-zerogpu/lists"}