Skip to main content

ContextWall SDK - drop-in context firewall enforcement for any LLM

Project description

contextwall-sdk

Drop-in context firewall enforcement for any LLM. Routes calls through a local ContextWall daemon, enforcing your policy before content reaches the model.

Built-in wrappers for Anthropic and OpenAI. Any OpenAI-compatible API (Mistral, Groq, Together, Ollama, etc.) works via SafeOpenAI. For other providers, use the zero-code proxy mode.

Install

pip install 'contextwall-sdk[anthropic]'   # Anthropic
pip install 'contextwall-sdk[openai]'      # OpenAI + any OpenAI-compatible API
pip install 'contextwall-sdk[all]'         # both

Usage

Anthropic:

from contextwall_sdk import SafeAnthropic, ContextWallBlockedError

client = SafeAnthropic(api_key="sk-ant-...", ctxfw_url="http://localhost:8080")
# use exactly like the standard Anthropic client

OpenAI / any OpenAI-compatible API:

from contextwall_sdk import SafeOpenAI

# OpenAI
client = SafeOpenAI(api_key="sk-...", ctxfw_url="http://localhost:8080")

# Mistral, Groq, Together, Ollama — just pass base_url
client = SafeOpenAI(api_key="...", ctxfw_url="http://localhost:8080",
                    base_url="https://api.mistral.ai/v1")

Zero-code proxy mode (any provider, no SDK changes):

export ANTHROPIC_BASE_URL=http://localhost:8080/proxy/anthropic
export OPENAI_BASE_URL=http://localhost:8080/proxy/openai
# your existing code runs unchanged

Blocked requests raise ContextWallBlockedError with the policy violation detail.

Daemon setup

Requires a running ContextWall daemon. See the quickstart or the GitHub repo.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contextwall_sdk-0.1.3.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contextwall_sdk-0.1.3-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file contextwall_sdk-0.1.3.tar.gz.

File metadata

  • Download URL: contextwall_sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for contextwall_sdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f91e248a433b8b81d125335aa640df21338a280580bf895f3304a96aa034db13
MD5 b63f3d54236db5de89270ab8b4ac040d
BLAKE2b-256 7fcb86ffc9843ebb6877056ee8d6e00032b7874aa0dcdae48563a6060cf68bc6

See more details on using hashes here.

File details

Details for the file contextwall_sdk-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for contextwall_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1c2057b1abc17c7da71d4e29017f8b190dde536b6182243ce01d2ed389c70e4d
MD5 1bb38577c376b25be381d9e2a9e019eb
BLAKE2b-256 de326d0c9833cb389eb5b539038594707ee9a5594b48cabf9c98d1771ce6b104

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page