skillfed

text-generation

Hugging Face Text Generation Python Client

text-generation v0.7.0 173.5K downloads/30d#10,306 on PyPI10,886
Permissive license Apache-2.0 Abandoned released

What it is and what it does

Text Generation is a Python client library for querying large language models hosted on Hugging Face's managed inference infrastructure. It wraps HTTP calls to text-generation-inference instances running on Hugging Face Inference Endpoints or the Hub, exposing both synchronous and asynchronous interfaces for generating text completions. The library handles request serialization via pydantic, HTTP communication through aiohttp, and model discovery via huggingface-hub.

You use it by instantiating a Client (or AsyncClient) with an endpoint URL, then calling generate() or generate_stream() to send prompts and receive completions. The library supports advanced generation parameters—sampling, repetition penalties, stop sequences, grammar constraints, and token-level details—and can stream tokens as they are produced rather than waiting for the full response.

Use it for:

  • Query a deployed Hugging Face Inference Endpoint model from Python without managing the underlying HTTP protocol.
  • Stream text generation tokens in real time for interactive applications or live UI updates.
  • Build async-first applications that query multiple models concurrently without blocking.
  • Prototype language model applications against Hugging Face's managed inference without running local infrastructure.
  • Access generation metadata (finish reason, token logprobs, top-k alternatives) for analysis or debugging.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a Python client to query text generation models hosted on Hugging Face Inference Endpoints or the Hugging Face Hub, with support for both synchronous and asynchronous generation and token streaming.

No—do not install. The package is abandoned (archived repository, no commits since 2026-03-21), carries four known vulnerabilities, and receives no maintenance. While the install friction is low and the license is permissive, the lack of security patches and active support makes it unsuitable for production use. Consider using the official Hugging Face Hub library or InferenceClient from huggingface-hub directly instead.

Install

text-generation on PyPI

pip

pip install text-generation

uv

uv add text-generation

poetry

poetry add text-generation

Installing text-generation

Before you install

Installation is straightforward with low friction—a pure Python wheel with three runtime dependencies (pydantic, aiohttp, huggingface-hub). However, the repository is archived and the package is abandoned; the last commit was 2026-03-21 and no maintenance is active, so security patches and compatibility updates are unlikely.

License in practice

Licensed under Apache-2.0 (permissive), so you can use, modify, and distribute the package freely in commercial and private projects without restriction.

Quickstart

pip install text-generation

from text_generation import Client

client = Client("https://YOUR_ENDPOINT.endpoints.huggingface.cloud")
response = client.generate("Why is the sky blue?")
print(response.generated_text)

Requires a running text-generation-inference instance or an active Hugging Face Inference Endpoint URL to connect to.

Verify before relying

  • Whether the package still works reliably with current Hugging Face Inference Endpoint APIs, given the abandoned status.
  • Compatibility of the four known vulnerabilities (GHSA-j7x9-7j54-2v3h, GHSA-qq99-p57r-g3v7, PYSEC-2026-1965, PYSEC-2026-1966) with your use case and whether they are exploitable in your deployment context.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (<4.0,>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 3 — pydantic, aiohttp, huggingface-hub
Maintenance abandoned — 875 days since the last release
Last repo commit (repository archived)
First released
Downloads 173,500/month — #10,306 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities 4 — GHSA-j7x9-7j54-2v3h, GHSA-qq99-p57r-g3v7, PYSEC-2026-1965, PYSEC-2026-1966

Evidence: text_generation-0.7.0-py3-none-any.whl

License :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

hugging face text generation clientinference endpoint python clientllm api wrappertext generation streaminghugging face model inferenceasync text generationlanguage model api client
llm-clienthugging-faceasync-support

More Artificial Intelligence packages