cognisafe
LLM observability, cost tracking, and automated safety scoring — by Cognisafe.
Instrument your LLM calls in two lines. Every request is captured, costed, and scanned for safety issues in the background — with zero latency impact.
Installation
pip install cognisafe
Or with provider extras:
pip install "cognisafe[openai]" # OpenAI + httpx
pip install "cognisafe[anthropic]" # Anthropic
pip install "cognisafe[all]" # All providers
Quick start
1. Get your API key
Sign up at cognisafe.uk and create an API key in Settings.
2. Instrument your code
OpenAI (auto-patch)
import openai
import cognisafe
cognisafe.configure(
api_key="csk_...",
project_id="my-project",
api_url="https://cognisafe.uk",
)
cognisafe.patch_openai()
client = openai.OpenAI(api_key="sk-...")
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)
Manual tracing (any provider)
import cognisafe
cognisafe.configure(api_key="csk_...", api_url="https://cognisafe.uk")
messages = [{"role": "user", "content": "Hello"}]
with cognisafe.traced(model="gpt-4o", request_body={"messages": messages}) as ctx:
response = client.chat.completions.create(model="gpt-4o", messages=messages)
ctx["response_body"] = {
"choices": [{"message": {"content": response.choices[0].message.content}}],
"usage": {
"prompt_tokens": response.usage.prompt_tokens,
"completion_tokens": response.usage.completion_tokens,
},
}
Anthropic
import anthropic
import cognisafe
cognisafe.configure(api_key="csk_...", api_url="https://cognisafe.uk")
cognisafe.patch_anthropic()
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-opus-4-7",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
What you get
- Requests dashboard — every LLM call with model, tokens, cost, latency
- Safety scoring — automated threat detection on every prompt/response (content safety, PII detection, jailbreak detection)
- Cost tracking — per-project spend with tier limits
- Governance — red-team assessment runs against any LLM endpoint
Supported providers
| Provider | Mode |
|---|---|
| OpenAI | Auto-patch |
| Azure OpenAI | Auto-patch |
| Anthropic | Auto-patch |
| Mistral | Auto-patch |
| Cohere | Auto-patch |
| Any provider | Manual (traced) |
Links
- Dashboard
- Docs
- npm package (JavaScript/TypeScript)
Metadata
Release files for cognisafe 0.1.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 | |
|---|---|---|---|
| cognisafe-0.1.0.tar.gz | 9.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cognisafe-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.3 kB
Release files / cognisafe-0.1.0.tar.gz
| Download URL | cognisafe-0.1.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f17638916cbfde0acbbd24c862894e7055b572f52ce5756b4f2c9c19c5b37a3
|
|
BLAKE2b-256 checksum How to use checksums |
40665508087e141012f7dc1bdf9c2bfdfa8e316b0689ea4d6102a058f260885f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cognisafe-0.1.0-py3-none-any.whl
| Download URL | cognisafe-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ebc396ecdc23a0dbd2160e53e543bebb7ac7d7ee0ebeb12dbfe2e9a18f66c70
|
|
BLAKE2b-256 checksum How to use checksums |
1921a2316d135562d0614b05cb05465aaab89c1c17731facfd611bfb8b355a63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|