skillfed

llama-api-client

The official Python library for the llama-api-client API

llama-api-client v0.6.0 136.9K downloads/30d#11,385 on PyPI64
Permissive license MIT Active released

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-client

uv

uv add llama-api-client

poetry

poetry add llama-api-client

Installing 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

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

llama api python clientmeta llama api libraryllama chat completionsasync llama apillama streaming responsestyped llama clientllama api error handling
llama-modelsapi-clientasync-support

More Python Modules packages