NotPixel Python SDK (notpixel)
Official Python SDK for NotPixel — privacy-first contextual monetization for LLM applications, agents, and backends (FastAPI, Django, Flask, LangChain, LlamaIndex, CrewAI).
Installation
pip install notpixel
Quick Start (Async — FastAPI / LangChain)
from notpixel import AsyncAds
# Ad matching uses local embeddings automatically.
# Prompt text is not sent to the NotPixel API.
ads = AsyncAds(publisher_id="pub_10565")
# 1. Fetch a contextual ad + run your LLM in parallel (best-effort)
result = await ads.respond(
input="How do I optimize PostgreSQL queries with indexes?",
llm=lambda: call_my_llm("How do I optimize PostgreSQL queries with indexes?"),
)
print(result.text) # LLM response + sponsored ad block (if matched)
# 2. Track events
if result.ad:
await ads.impression(result.ad)
await ads.track_click(result.ad, metadata={"source": "fastapi_chat"})
await ads.track_conversion(
result.ad,
type="signup",
value_cents=2900,
external_id="order_12345",
)
Synchronous Usage (Django WSGI / Scripts)
from notpixel import Ads
ads = Ads(publisher_id="pub_10565")
ad = ads.get_ad(input="Best serverless Postgres database")
if ad:
print(ad.text)
ads.track_click(ad)
Privacy
Ad matching uses local embeddings automatically. The SDK sends a numerical vector to NotPixel instead of the prompt text. No privacy flag is needed.
If the local model cannot generate an embedding, get_ad() reports the error through
on_error and returns None, without sending the prompt to NotPixel.
Your LLM calls remain under your application's control and follow your provider's own data handling rules. Keep personal data out of optional context and event metadata.
Metadata
Release files for notpixel 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| notpixel-0.2.0.tar.gz | 16.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| notpixel-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.4 kB
Release files / notpixel-0.2.0.tar.gz
| Download URL | notpixel-0.2.0.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a31adafe8139207838d52ee9ec516a5700934330882ca2e1ffbbc26ef48be3b
|
|
BLAKE2b-256 checksum How to use checksums |
5382c0c4d2b91a7a308e6671dffa31f64c72213690ba39b3856bc2d2a0313f3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 23, 2026.
Transparency logRelease files / notpixel-0.2.0-py3-none-any.whl
| Download URL | notpixel-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b983f8864b287ac74c61db00904228eb8881928076f1753d6d6c1fc0857dd02f
|
|
BLAKE2b-256 checksum How to use checksums |
9b4ba285881c6843db4462502a5898df075cf94087050807ad3dd71404968459
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 23, 2026.
Transparency logSecurity for notpixel 0.2.0
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.
Attestation for notpixel-0.2.0.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 23, 2026.
Transparency logA 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.