Integration Examples
SDK Integration — Direct Guardrails
Guard a Prompt (Python)
from highflame import Highflame, Shield, BlockedError
client = Highflame(api_key="hf_sk_...")
shield = Shield(client)
@shield.prompt(mode="enforce")
def chat(message: str) -> str:
return openai.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": message}],
).choices[0].message.content
try:
reply = chat("Summarize the quarterly report")
except BlockedError as e:
print(f"Blocked: {e.response.policy_reason}")Guard a Prompt (TypeScript)
Guard a Tool Call
Guard a Model Response (Hallucination Detection)
Framework Integrations (Python)
Gateway Integration — Centralized Protection
Example 1: Keep Your OpenAI-Compatible Client
Example 2: Use TypeScript With the OpenAI SDK
Example 3: Route Different Providers Through One API
Example 4: Responses API Through Highflame
Example 5: Azure OpenAI
Example 6: AWS Bedrock
Endpoint
Method
Description
Combining Both Patterns
How To Choose
Next Steps
Last updated