SDK Quick Reference

All common Highflame SDK patterns side by side — Python and TypeScript. Installation, client setup, guard evaluation, Shield wrappers, ZeroID, error handling, streaming.

Common patterns at a glance. Both Python and TypeScript side by side.

Installation

SDK
Command

Python

pip install highflame

TypeScript

npm install @highflame/sdk

Rust

cargo add highflame

Framework extras:

pip install 'highflame[langgraph]'
pip install 'highflame[crewai]'
pip install 'highflame[strands]'

Client Initialization

from highflame import Highflame

client = Highflame(api_key="hf_sk_...")

Evaluate a Prompt

resp = client.guard.evaluate_prompt("user message")
if resp.denied:
    raise PermissionError(resp.policy_reason)

Evaluate a Tool Call


Full GuardRequest


Shield Decorators / Wrappers


Async Evaluation


Error Handling


Enforcement Modes

Mode

resp.denied / decision

resp.alerted

Use for

"enforce"

True / "deny" on violation

False

Production enforcement

"monitor"

Always False / "allow"

False

Shadow testing, rollout staging

"alert"

Always False / "allow"

True if violated

Alerting without blocking


ZeroID — Issue and Verify Tokens


ZeroID Identity Helper Methods


ZeroID + Shield — Two-Layer Pattern


Streaming


Client Options Reference

Option (Python)
Option (TypeScript)
Default
Description

api_key

apiKey

required

Service key or raw JWT

base_url

baseUrl

Highflame SaaS

Guard service URL

token_url

tokenUrl

Highflame SaaS

Token exchange URL

timeout

timeout

30.0 / 30000

Per-request timeout (s / ms)

max_retries

maxRetries

2

Retries on 429/5xx

account_id

accountId

Account scope

project_id

projectId

Project scope

default_headers

defaultHeaders

Extra headers on every request

Last updated