---
title: "Working with Together AI in Pixeltable"
description: "Use Together AI from Pixeltable for chat completions and image generation."
url: "https://www.pixeltable.com/notebooks/working-with-together"
updated: "2026-10-08"
---

# Working with Together AI in Pixeltable

Use Together AI from Pixeltable for chat completions and image generation.

- **Type:** Notebook
- **Group:** Providers

## What it uses

- **Install:** `pip install pixeltable together`
- **Environment variables it names:** `TOGETHER_API_KEY`
- **Pixeltable calls:** `together.chat_completions()`, `together.image_generations()`, `pxt.create_table()`, `add_computed_column()`, `insert()`

## A look at the code

```python
from pixeltable.functions import together

chat_t = pxt.create_table('together_demo/chat', {'input': pxt.String})

messages = [{'role': 'user', 'content': chat_t.input}]

chat_t.add_computed_column(
    output=together.chat_completions(
        messages=messages,
        model='Qwen/Qwen3.5-9B',
        model_kwargs={
            # Optional dict with parameters for the Together API
            'max_tokens': 300,
            'stop': ['\n'],
            'temperature': 0.7,
            'top_p': 0.9,
        },
    )
)
chat_t.add_computed_column(
    response=chat_t.output.choices[0].message.content
)
```

## Open it

- **Open in Colab:** https://colab.research.google.com/github/pixeltable/pixeltable/blob/release/docs/release/howto/providers/working-with-together.ipynb
- **Docs page:** https://docs.pixeltable.com/howto/providers/working-with-together
- **Source on GitHub:** https://github.com/pixeltable/pixeltable/blob/release/docs/release/howto/providers/working-with-together.ipynb
