Skip to main content
Open in Kaggle  Open in Colab  Download Notebook
This documentation page is also available as an interactive notebook. You can launch the notebook in Kaggle or Colab, or download it for use with an IDE or local Jupyter installation, by clicking one of the above links.
Pixeltable’s OpenLLM integration lets you call the AI subscriptions, provider API keys, and local models you connect to OpenLLM through one OpenAI-compatible endpoint.

Prerequisites

Important notes

  • Usage counts against the subscriptions and provider plans you connect to OpenLLM.
  • Be mindful of sensitive data and consider security measures when integrating with external services.
OpenLLM uses the OpenAI SDK as its Python API, so we need to install it in addition to Pixeltable.
By default, Pixeltable calls the local OpenLLM daemon at http://127.0.0.1:8787/v1, which needs no API key. To use another endpoint, set OPENLLM_BASE_URL, and set OPENLLM_API_KEY if that endpoint requires authentication. Now let’s create a Pixeltable directory to hold the tables for our demo.
Connected to Pixeltable database at: postgresql+psycopg://postgres:***@/pixeltable?host=%2Fhome%2Fuser%2F.pixeltable%2Fpgdata
Created directory ‘openllm_demo’.
<pixeltable.catalog.dir.Dir at 0x136c1deb0>

Responses

Create a table with an input column, then add a computed column that calls OpenLLM through the Responses API. The plus model is a fallback alias: OpenLLM moves to the next model in the alias’s chain when a provider is rate-limited or unavailable. You can also use any model ID listed by the OpenLLM models endpoint.
Created table ‘chat’.
Added 0 column values with 0 errors in 0.00 s
No rows affected.
Added 0 column values with 0 errors in 0.00 s
No rows affected.
Inserted 2 rows with 0 errors in 2.89 s (0.69 rows/s)

Chat completions

chat_completions() takes messages in the OpenAI chat format, for code that already uses it.
Added 2 column values with 0 errors in 2.42 s (0.83 rows/s)
Added 2 column values with 0 errors in 0.01 s (276.66 rows/s)

Learn more

To learn more about advanced techniques like RAG operations in Pixeltable, check out the RAG Operations in Pixeltable tutorial.
Last modified on December 4, 2026