---
title: "Working with OpenAI in Pixeltable"
description: "Pixeltable's OpenAI integration enables you to access OpenAI models via the OpenAI API."
url: "https://www.pixeltable.com/notebooks/working-with-openai"
updated: "2026-10-29"
---

# Working with OpenAI in Pixeltable

Pixeltable's OpenAI integration enables you to access OpenAI models via the OpenAI API.

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

## What it covers

- Azure OpenAI
- Chat completions
- Responses API
- Decisions
- Embeddings
- Image generations
- Audio Transcription

## What it uses

- **Install:** `pip install pixeltable openai`
- **Environment variables it names:** `OPENAI_API_KEY`
- **Pixeltable calls:** `openai.chat_completions()`, `openai.responses()`, `openai.decisions()`, `openai.embeddings()`, `openai.image_generations()`, `openai.transcriptions()`, `pxt.create_table()`, `@pxt.udf`, `add_computed_column()`, `insert()`

## A look at the code

```python
from pixeltable.functions import openai

# Create a table in Pixeltable and add a computed column that calls OpenAI

t = pxt.create_table('openai_demo/chat', {'input': pxt.String})

messages = [{'role': 'user', 'content': t.input}]
t.add_computed_column(
    output=openai.chat_completions(
        messages=messages,
        model='gpt-4o-mini',
        model_kwargs={
            # Optional dict with parameters for the OpenAI API
            'max_tokens': 300,
            'top_p': 0.9,
            'temperature': 0.7,
        },
    )
)
```

## Open it

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