Skip to content

Add an SDK example for passing virtual-key governance headers #7

Description

@deepintai

Context

The examples/sdk/ directory demonstrates most DeepintShield features, but the virtual-keys example (examples/sdk/11_virtual_keys.py) is minimal and does not show how to pass per-request governance headers. Users need a copy-paste example demonstrating x-deepintshield-* headers for per-key model allowlists, budgets, and rate limits.

What to do

  1. Create examples/sdk/11b_virtual_key_governance_headers.py that:
    • Constructs a DeepintShield client (reuse the setup from 11_virtual_keys.py).
    • Sends a request passing at least 3 x-deepintshield-* governance headers via the SDK's headers parameter.
    • Includes inline comments explaining what each header controls (model allowlist, budget, rate limit).
  2. Add a row for the new example to the Core SDK table in examples/README.md.
  3. Add a short note on when to use per-request governance headers vs. configuring the virtual key in the UI.

Acceptance criteria

  • New file examples/sdk/11b_virtual_key_governance_headers.py, copy-paste ready (runs against an active gateway + virtual key).
  • Demonstrates at least 3 distinct governance headers, each with an explanatory comment.
  • examples/README.md updated to reference the new example.
  • No real secrets committed; use env vars / placeholders consistent with the other examples.

File pointers

  • Existing minimal example: examples/sdk/11_virtual_keys.py
  • Examples index/table: examples/README.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions