Skip to main content

llm-public-ai

PyPI Changelog Tests License

Access models hosted by the Public AI Inference Utility from LLM, including the Swiss AI Apertus models, AI Singapore's SEA-LION models, Bielik and ALIA.

Installation

Install this plugin in the same environment as LLM.

llm install llm-public-ai

Configuration

You will need an API key from the Public AI developer portal. Configure it like this:

llm keys set publicai
# Paste key here

Or set the PUBLICAI_API_KEY environment variable.

Usage

Models are listed by the Public AI API and registered with a publicai/ prefix. Run llm models -q publicai to see them:

llm -m publicai/swiss-ai/apertus-70b-instruct "Three fun facts about Switzerland"

The list of models is cached in publicai_models.json in the LLM user directory and refreshed once an hour. To refresh it immediately run:

llm publicai refresh

To see the models along with their pricing and the features this plugin supports for each one:

llm publicai models

Add --json for the raw JSON returned by the API.

The /v1/models endpoint does not report model capabilities, so the plugin records which models support tools, schemas, images and thinking based on testing each one. Models not in that list are assumed to support tools and schemas.

Thinking

swiss-ai/apertus-v1.5-70b, aisingapore/Qwen-SEA-LION-v4.5-27B-IT and aisingapore/Nemotron-SEA-LION-v4.8-120B-A12B can turn their thinking mode on or off using the thinking option. Apertus v1.5 does not think by default; the two SEA-LION models do:

llm -m publicai/swiss-ai/apertus-v1.5-70b -o thinking 1 "What is 47 * 86?"
llm -m publicai/aisingapore/Qwen-SEA-LION-v4.5-27B-IT -o thinking 0 "Hello"

None of these models support thinking levels: reasoning_effort and similar parameters are ignored by the API.

Reasoning is displayed separately from the response, and can be hidden using llm -R/--hide-reasoning. Apertus v1.5 returns its thinking inline wrapped in <|inner_prefix|> and <|inner_suffix|> tokens; the plugin separates that out into reasoning.

The Public AI gateway caches responses, and its cache ignores the thinking setting. The plugin bypasses that cache for models that support thinking, so a cached response generated with the other setting is never returned.

Tools, schemas and images

Most models support tools and schemas:

llm -m publicai/aisingapore/Qwen-SEA-LION-v4-32B-IT -T llm_version "What version of LLM is this?" --td
llm -m publicai/speakleash/Bielik-11B-v3.0-Instruct --schema 'name, age int, bio' "Invent a dog"

swiss-ai/apertus-v1.5-70b, aisingapore/Gemma-SEA-LION-v4-27B-IT and aisingapore/Qwen-SEA-LION-v4.5-27B-IT accept image attachments:

llm -m publicai/swiss-ai/apertus-v1.5-70b -a photo.jpg "Describe this image"

Options

All models support the temperature, max_tokens, top_p, frequency_penalty, presence_penalty, stop and seed options. Run llm models --options -q publicai for details.

Development

To set up this plugin locally, first checkout the code. Then run the tests with uv:

cd llm-public-ai
uv run pytest

The tests replay recorded API responses from tests/cassettes. To record new ones, set PUBLICAI_API_KEY and run:

uv run pytest --record-mode once

To run LLM with your in-development plugin:

uv run llm --help

Metadata

Release files for llm-public-ai 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-public-ai 0.1
File Size Uploaded Provenance Actions
llm_public_ai-0.1.tar.gz 15.0 kB With provenance Details for llm_public_ai-0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-public-ai 0.1
File Interpreter ABI Platform Actions
llm_public_ai-0.1-py3-none-any.whl Python 3 none any Details for llm_public_ai-0.1-py3-none-any.whl

Total release size: 28.5 kB

Release files / llm_public_ai-0.1.tar.gz

Download URL llm_public_ai-0.1.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
26b4b3d5b2f75a2fa21e17cc5f791b4622beecb9b79a108e86cb91ad1709b599
BLAKE2b-256 checksum
How to use checksums
396923119b20b2628fbda20f31fee48375bd18feda8ba07d19d197c8a9a5d207
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / llm_public_ai-0.1-py3-none-any.whl

Download URL llm_public_ai-0.1-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8612a1110bb722d0972f03fa62c3068b81d6d93d80862aa4969ca92fb57f71bf
BLAKE2b-256 checksum
How to use checksums
bf293b7ff830f97908d3cc7d1b98cbb5af3f1d2ae5f30ef2c0a16288c28fa155
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for llm-public-ai 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for llm_public_ai-0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page