Skip to main content

ZeroGPU

langchain-zerogpu

LangChain tools for ZeroGPU.

ZeroGPU is a compute-efficient inference provider for apps and agents. We run purpose-built small and nano language models across an edge network for the high-volume tasks you run constantly — classification, extraction, moderation, routing, summarization — at ~10x lower latency and 50%+ lower cost than frontier-model workflows. Auto-scaling, with zero GPU infrastructure to manage. Plug in and you're live.

This package exposes those models as first-class LangChain BaseTool subclasses, so any LangChain agent — including create_agent and LangGraph graphs — can offload these repeatable NLP tasks (classification, summarization, moderation, routing decisions, signal / entity / JSON extraction, PII redaction, and chat) to ZeroGPU instead of spending frontier-model tokens — plus larger open-weight models for the calls that do need reasoning headroom.

All calls go through the official zerogpu-api Python SDK.

Install

pip install langchain-zerogpu

Authenticate

Every request needs a ZeroGPU API key (starts with zgpu-api-). A project id is optional — set one to scope requests to a specific project. Provide them via environment variables:

export ZEROGPU_API_KEY="zgpu-api-..."
export ZEROGPU_PROJECT_ID="your-project-id"   # optional

…or pass them directly to any tool or the toolkit:

from langchain_zerogpu import ZeroGPUSummarizeTool

tool = ZeroGPUSummarizeTool(api_key="zgpu-api-...", project_id="your-project-id")

The API key is stored as a pydantic.SecretStr and is never logged.

The tools

Tool class ZeroGPU model Purpose
ZeroGPUChatTool LFM2.5-1.2B-Instruct Short single-turn chat reply
ZeroGPUChatThinkingTool LFM2.5-1.2B-Thinking Chat with a visible reasoning trace
ZeroGPUReasonTool gpt-oss-120b Heavier reasoning, 131K context
ZeroGPUReasonMultilingualTool qwen3-30b-a3b-fp8 Reasoning across 100+ languages
ZeroGPUReasonQwenTool qwen3.6-35b-a3b Fast 35B MoE reasoning, 16K context
ZeroGPUReasonGLMTool glm-5.3-flash Coding and agentic work, 1M context
ZeroGPUReasonDeepseekTool deepseek-v4.1-flash DeepSeek V4.1 Flash reasoning, 1M context
ZeroGPUReasonGPTLunaTool gpt-5.6-luna Cost-optimized GPT-5.6, 272K context
ZeroGPUReasonGPT6LunaTool gpt-6-luna Most efficient GPT-6, 272K context
ZeroGPUReasonGPTMiniTool gpt-4.1-mini GPT-4.1 mini, 1M context
ZeroGPUReasonGPTNanoTool gpt-5.4-nano Cost-efficient GPT-5.4, 400K context
ZeroGPUModerateTool llama-guard-4-12b Safe / unsafe moderation verdict, 160K context
ZeroGPUSummarizeTool llama-3.1-8b-instruct-fast Condense a passage
ZeroGPUSummarize3BTool llama-3.2-3b-instruct-fast Condense a passage with a cheaper 3B model
ZeroGPUClassifyIABTool zlm-v1-iab-classify-edge IAB taxonomy classification
ZeroGPUClassifyIABEnrichedTool zlm-v2-iab-classify-edge-enriched IAB + topics / keywords / intent
ZeroGPUClassifyDomainTool zlm-v1-iab-domain-classifier IAB classification from a domain name
ZeroGPUExtractSignalsTool zlm-v1-signal-extract Topics / keywords / intent signals
ZeroGPUDecideToolsTool zlm-v1-tool-decisions Pick a tool and generate its arguments
ZeroGPUClassifyZeroShotTool deberta-v3-small Zero-shot vs. custom labels
ZeroGPUClassifyStructuredTool gliner2.5-base-v1 Multi-axis schema classification
ZeroGPUDecideTool gliner2.5-decide-v1 Zero-shot decisions and routing
ZeroGPUExtractEntitiesTool gliner2.5-base-v1 Custom-label NER
ZeroGPUExtractPIITool gliner2.5-multi-v1 Extract PII entities (JSON)
ZeroGPURedactPIITool gliner2.5-multi-v1 Mask PII inline with [LABEL]
ZeroGPUExtractJSONTool gliner2.5-base-v1 Schema-driven JSON extraction

Quick start

from langchain_zerogpu import ZeroGPUClassifyZeroShotTool

tool = ZeroGPUClassifyZeroShotTool()  # reads creds from the environment

print(tool.invoke({
    "text": "The new GPU smashes every benchmark we threw at it.",
    "labels": ["tech", "politics", "sports"],
}))

Tools work asynchronously too:

result = await tool.ainvoke({"text": "...", "labels": ["a", "b"]})

Bind the tools to an agent

Use the toolkit to get all 26 tools — wired to a single shared client — and bind them to an agent:

from langchain.agents import create_agent
from langchain_zerogpu import ZeroGPUToolkit

toolkit = ZeroGPUToolkit()  # reads ZEROGPU_API_KEY / ZEROGPU_PROJECT_ID
tools = toolkit.get_tools()

agent = create_agent("anthropic:claude-sonnet-4-6", tools=tools)

agent.invoke({
    "messages": [
        {"role": "user", "content": "Redact the PII in: 'Call Jane at 555-0100.'"}
    ]
})

Or bind a single tool to a chat model directly:

from langchain.chat_models import init_chat_model
from langchain_zerogpu import ZeroGPUExtractPIITool

llm = init_chat_model("anthropic:claude-sonnet-4-6")
llm_with_tools = llm.bind_tools([ZeroGPUExtractPIITool()])

Errors

Failures surface as clear, typed exceptions instead of raw stack traces:

  • ZeroGPUAuthError — missing / malformed credentials, 401, or 403.
  • ZeroGPUError — rate limits (429), server errors (5xx), and network failures.

Development

make install            # uv sync --all-groups
make lint               # ruff check + format --check
make mypy               # mypy (disallow_untyped_defs)
make test               # unit tests, sockets disabled
make integration_test   # integration tests (needs real ZeroGPU creds)
make bump               # bump the version; merging to main releases it

Releases are automatic — see RELEASING.md.

License

MIT — see LICENSE.

Metadata

Release files for langchain-zerogpu 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-zerogpu 1.3.0
File Size Uploaded Provenance Actions
langchain_zerogpu-1.3.0.tar.gz 31.5 kB With provenance Details for langchain_zerogpu-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-zerogpu 1.3.0
File Interpreter ABI Platform Actions
langchain_zerogpu-1.3.0-py3-none-any.whl Python 3 none any Details for langchain_zerogpu-1.3.0-py3-none-any.whl

Total release size: 53.7 kB

Release files / langchain_zerogpu-1.3.0.tar.gz

Download URL langchain_zerogpu-1.3.0.tar.gz
Size 31.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0d6f731928b7524190f73551628938fd42454b8db5cb552506047ad32133dd2a
BLAKE2b-256 checksum
How to use checksums
13b16931e89e1f29ff2145696770184b6b6c9978ffb26720302ea27454fbafdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / langchain_zerogpu-1.3.0-py3-none-any.whl

Download URL langchain_zerogpu-1.3.0-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0e4ef0911ab23ab16477c3c6d3701cb39e506138127a84596d40fca4ddd0cc9
BLAKE2b-256 checksum
How to use checksums
7691a18bc713091ac20647ea32796fdc2d7dddc8655fa012f9896d23572833ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for langchain-zerogpu 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_zerogpu-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page