> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipecat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Sprag LLM

> SpragLLMService provides chat completions using Sprag's OpenAI-compatible API.

> [!NOTE]
>
> **Community-maintained integration.** This service is built and
> maintained by
> [sprag-ai](https://github.com/sprag-ai)
> . Pipecat does not test or officially support it. Please report issues and
> request changes on the
> [source repository](https://github.com/sprag-ai/pipecat-sprag)
> . Learn more about
> [community integrations](https://docs.pipecat.ai/api-reference/server/services/community-integrations.md)
> .

## Overview

`SpragLLMService` provides chat completion capabilities using [Sprag](https://sprag.ai)'s OpenAI-compatible API.

> **[Source Repository](https://github.com/sprag-ai/pipecat-sprag)**
>
> Source code, examples, and issues for the Sprag integration

> **[Sprag Docs](https://sprag.ai/docs/integrations/pipecat)**
>
> Official Sprag documentation for Pipecat

## Installation

This is a community-maintained package distributed separately from `pipecat-ai`.

```bash theme={null}
uv add pipecat-sprag
```

## Prerequisites

### Sprag Account Setup

Before using Sprag LLM services, you need:

1. **Sprag Account**: Sign up at [sprag.ai](https://sprag.ai/auth/signup)
2. **API Key**: Generate an API key in the [Sprag app](https://sprag.ai/app/api-keys)

### Required Environment Variables

* `SPRAG_API_KEY`: Your Sprag API key. May be passed directly via the `api_key` constructor argument instead.

## Configuration

**api\_key** `str` (default: None)

Sprag API key. Falls back to the `SPRAG_API_KEY` environment variable.

**base\_url** `str` (default: [https://api.sprag.ai/v1](https://api.sprag.ai/v1))

Sprag API base URL.

**default\_headers** `Mapping[str, str]` (default: None)

Extra headers sent with every request.

**settings** `SpragLLMService.Settings` (default: None)

Runtime-configurable settings. The model defaults to `"symphony"`.

> [!NOTE]
>
> `SpragLLMService.Settings` inherits from `OpenAILLMService.Settings`. See the
> [source repository](https://github.com/sprag-ai/pipecat-sprag) for the
> authoritative, up-to-date list of settings.

## Usage

```python theme={null}
from pipecat_sprag.llm import SpragLLMService

llm = SpragLLMService(
    settings=SpragLLMService.Settings(
        system_instruction="You are a helpful assistant in a voice conversation.",
    ),
)
```

```python theme={null}
pipeline = Pipeline([
    transport.input(),
    stt,
    user_aggregator,
    llm,
    tts,
    transport.output(),
    assistant_aggregator,
])
```

## Compatibility

Tested with Pipecat v1.12.0 (`pipecat-ai>=1.8,<2`). Check the [source repository](https://github.com/sprag-ai/pipecat-sprag) for the latest tested version and changelog.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.