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.4.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.4-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: contextwall_sdk-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 a0cb99d90b7017db8f46260741557838a681b5c783c873f6b274c7c5a0ae1b57
MD5 065328ca2e0478925307dbfaf6d654cd
BLAKE2b-256 fa62dce122f7a5e2d0b13a7c013340fa5b32c35cb74f3996029f9961774791a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for contextwall_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 91318484f84b097205610fa8d65f64d5c49168bc5359edd722b01ca97378f40d
MD5 bab7838f27e308cedc2b190c02726337
BLAKE2b-256 b694d665cee2a6b27a377e2c92b64eda72e65a9bc77fc64ab525c740d05cf755

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