llama-api-client
The official Python library for the llama-api-client API
What it is and what it does
This is an official Python client library for the Llama API, generated using Stainless. It wraps the Llama API REST endpoints with type-safe request and response objects, built on httpx for HTTP transport. The library supports both synchronous and asynchronous usage patterns, with the async client optionally using aiohttp for improved concurrency. It includes full type hints for all request parameters and response fields, enabling IDE autocomplete and static type checking.
The client handles common API patterns: chat completions (including streaming via Server-Side Events), file uploads with multipart support, and structured error handling with automatic retries for transient failures. Responses are Pydantic models with helper methods for JSON serialization and dictionary conversion. The library targets Python 3.9 and later, supporting current and recent Python versions.
Use it for:
- Build a chatbot or conversational AI application using Llama models with typed, autocompleted API calls.
- Stream Llama model responses token-by-token for real-time user feedback in web or CLI applications.
- Integrate Llama API calls into async Python services or concurrent batch-processing pipelines.
- Upload fine-tuning datasets to Llama API using the built-in file upload and multipart handling.
- Handle API errors gracefully with automatic retries and specific exception types for different failure modes.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a typed Python client for the Llama API with support for synchronous and asynchronous requests, streaming responses, and automatic error handling.
Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and installs with low friction. It provides a well-typed, officially-backed client for Llama API access with both sync and async support. Install it if you need to integrate Llama models into a Python application.
Install
llama-api-client on PyPI
pip
pip install llama-api-clientuv
uv add llama-api-clientpoetry
poetry add llama-api-clientInstalling llama-api-client
Before you install
Low friction install with six common runtime dependencies (anyio, distro, httpx, pydantic, sniffio, typing-extensions). The package is actively maintained with recent commits and has been in active development since April 2025.
License in practice
MIT license is permissive, allowing use in commercial and private projects with minimal restrictions—only requiring attribution and inclusion of the license text.
Quickstart
pip install llama-api-client
import os
from llama_api_client import LlamaAPIClient
client = LlamaAPIClient(
api_key=os.environ.get("LLAMA_API_KEY"),
)
response = client.chat.completions.create(
messages=[{"content": "string", "role": "user"}],
model="model",
)
print(response.completion_message)
Requires a valid LLAMA_API_KEY environment variable or explicit api_key parameter to authenticate with the Llama API.
Verify before relying
- Whether the package is officially maintained by Meta or a third-party wrapper around the Llama API.
- Rate limits, quotas, or cost implications of using the Llama API through this client.
- Whether all Llama API endpoints are fully covered or if some are missing.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — anyio, distro, httpx, pydantic, sniffio, typing-extensions |
| Maintenance | actively maintained — 239 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 136,863/month — #11,385 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: llama_api_client-0.6.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
llama-stack-clientPython client library for interacting with…
permissive · top 15,000 on PyPI
sambanovaProvides a Python client library for accessing…
permissive · top 15,000 on PyPI
togetherA Python client library for the Together REST…
permissive · top 5,000 on PyPI
groqProvides a Python client library for accessing…
permissive · top 1,000 on PyPI
hiddenlayer-sdkProvides a typed Python client for the…
permissive · top 15,000 on PyPI
fireworks-aiPython SDK for the Fireworks REST API,…
permissive · top 5,000 on PyPI
cerebras-cloud-sdkProvides a Python client library for accessing…
permissive · top 5,000 on PyPI
composio-clientA Python client library for the Composio REST…
permissive · top 5,000 on PyPI
writer-sdkPython client library for the Writer REST API,…
permissive · top 15,000 on PyPI
openaiProvides a Python client library for the OpenAI…
permissive · top 1,000 on PyPI