Skip to main content

llama-stack-api

API and Provider specifications for Llama Stack - a lightweight package with protocol definitions and provider specs.

Overview

llama-stack-api is a minimal dependency package that contains:

  • API Protocol Definitions: Type-safe protocol definitions for all Llama Stack APIs (inference, agents, safety, etc.)
  • Provider Specifications: Provider spec definitions for building custom providers
  • Data Types: Shared data types and models used across the Llama Stack ecosystem
  • Type Utilities: Strong typing utilities and schema validation

What This Package Does NOT Include

  • Server implementation (see llama-stack package)
  • Provider implementations (see llama-stack package)
  • CLI tools (see llama-stack package)
  • Runtime orchestration (see llama-stack package)

Use Cases

This package is designed for:

  1. Third-party Provider Developers: Build custom providers without depending on the full Llama Stack server
  2. Client Library Authors: Use type definitions without server dependencies
  3. Documentation Generation: Generate API docs from protocol definitions
  4. Type Checking: Validate implementations against the official specs

Installation

pip install llama-stack-api

Or with uv:

uv pip install llama-stack-api

Dependencies

Minimal dependencies:

  • openai>=2.5.0 - For OpenAI-compatible types
  • fastapi>=0.115.0,<1.0 - For FastAPI route definitions
  • pydantic>=2.11.9 - For data validation and serialization
  • jsonschema - For JSON schema utilities
  • opentelemetry-sdk>=1.30.0 - For telemetry
  • opentelemetry-exporter-otlp-proto-http>=1.30.0 - For OTLP export

Versioning

This package follows semantic versioning independently from the main llama-stack package:

  • Patch versions (0.1.x): Documentation, internal improvements
  • Minor versions (0.x.0): New APIs, backward-compatible changes
  • Major versions (x.0.0): Breaking changes to existing APIs

The version is determined dynamically via setuptools-scm at build time.

Usage Example

from llama_stack_api import (
    Api,
    Inference,
    InlineProviderSpec,
    OpenAIChatCompletionRequestWithExtraBody,
)


# Use protocol definitions for type checking
class MyInferenceProvider(Inference):
    async def openai_chat_completion(
        self, request: OpenAIChatCompletionRequestWithExtraBody
    ):
        # Your implementation
        pass


# Define provider specifications
my_provider_spec = InlineProviderSpec(
    api=Api.inference,
    provider_type="inline::my-provider",
    pip_packages=["my-dependencies"],
    module="my_package.providers.inference",
    config_class="my_package.providers.inference.MyConfig",
)

Relationship to llama-stack

The main llama-stack package depends on llama-stack-api and provides:

  • Full server implementation
  • Built-in provider implementations
  • CLI tools for running and managing stacks
  • Runtime provider resolution and orchestration

Contributing

See the main Llama Stack repository for contribution guidelines.

License

MIT License - see LICENSE file for details.

Links

Metadata

Release files for llama-stack-api 0.7.3

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

Source distribution (sdist)

Source distribution for llama-stack-api 0.7.3
File Size Uploaded
llama_stack_api-0.7.3.tar.gz 135.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llama-stack-api 0.7.3
File Interpreter ABI Platform
llama_stack_api-0.7.3-py3-none-any.whl Python 3 none any Details

Total release size: 295.1 kB

Release files / llama_stack_api-0.7.3.tar.gz

Download URL llama_stack_api-0.7.3.tar.gz
Size 135.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8ad83caa3ae9917d7d3af9d465f3b41078ac1c452a9bfca540e292fadc4c3346
BLAKE2b-256 checksum
How to use checksums
7ca53dab6fb560aa99a6bda659da71a83a03ef411cba493c13a86098cf944781
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jul 27, 2026.

Transparency log

Release files / llama_stack_api-0.7.3-py3-none-any.whl

Download URL llama_stack_api-0.7.3-py3-none-any.whl
Size 159.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbd9f06632b50661aa536f3c9f55d064e236287488c1909c14abb429dc143bb9
BLAKE2b-256 checksum
How to use checksums
bcee1cb8febc80e02e00289dd871a090528babfb71d111779ab384cfdf88efcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jul 27, 2026.

Transparency log
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