Metadata-Version: 2.5
Name: llama-index-llms-modal
Version: 0.1.0
Summary: llama-index llms Modal integration
Project-URL: Homepage, https://github.com/modal-labs/llamaindex-modal
Author: Modal
License-Expression: MIT
License-File: LICENSE
Keywords: LLM,Modal,inference,llama-index
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: <4.0,>=3.11
Requires-Dist: llama-index-core<0.15,>=0.14.3
Requires-Dist: llama-index-llms-openai-like<0.10,>=0.9.0
Description-Content-Type: text/markdown

# LlamaIndex Model API Integration

Use [Modal](https://modal.com?utm_source=llamaindex&utm_medium=referral&utm_campaign=inference_partners&utm_content=home_page) Model APIs and Endpoints with [LlamaIndex](https://www.llamaindex.ai/).

```bash
uv add llama-index-llms-modal
```

## Usage

Create a proxy token and grant it access to your Model API's or Endpoint's environment:

```bash
modal workspace proxy-tokens create
modal workspace proxy-tokens allow <token-id> <environment-name>
```

For [Model APIs](https://modal.com/docs/guide/model-apis?utm_source=llamaindex&utm_medium=referral&utm_campaign=inference_partners&utm_content=model_apis_guide), pass the hostname shown in the dashboard as the model and the token in its combined `wk-<id>.ws-<secret>` form:

```python
from llama_index.llms.modal import Modal

llm = Modal(
    model="my-endpoint.us-west.modal.direct",
    proxy_token="wk-<id>.ws-<secret>",
)
response = llm.complete("Hello, world!")
```

Use `region` to select another shared gateway (`us-west` default, `us-east`, `ca-central`, `eu-west`, `ap-south`):

```python
llm = Modal(model="my-endpoint.eu-west.modal.direct", region="eu-west")
```

For a dedicated [Endpoint](https://modal.com/docs/guide/endpoints?utm_source=llamaindex&utm_medium=referral&utm_campaign=inference_partners&utm_content=endpoints_guide), pass its base URL:

```python
llm = Modal(
    model="Qwen/Qwen3.5-4B",
    endpoint_url="https://my-endpoint.us-west.modal.direct",
)
```

For any other OpenAI-compatible serving stack deployed on Modal (e.g. a self-hosted vLLM app), pass `api_base` directly.

Set `context_window` to your model's context window, and `is_function_calling_model=True` if the deployment supports OpenAI tool calling.
