Refract Guides · Connect a target

OpenAI-Compatible Targets in Refract

The openai-compatible target lets Refract test the same guardrail path your application uses, including private gateways and self-hosted OpenAI-compatible servers.

Target string

Put the model name after openai_compat:. Refract calls https://api.openai.com/v1 unless --base-url (or OPENAI_BASE_URL) points at a gateway or self-hosted server.

openai_compat:gpt-6.2-astra

Configure credentials

export OPENAI_API_KEY=...
# Self-hosted servers without auth: leave OPENAI_API_KEY unset.

Run a scan

refract scan --target openai_compat:gpt-6.2-astra --pack ./packs/prompt-injection-basic.jsonl --db ./runs.sqlite --sarif refract-openai-compatible.sarif
# The same pack through a private gateway:
refract scan --target openai_compat:gpt-6.2-astra --base-url https://llm-gateway.example/v1 --pack ./packs/prompt-injection-basic.jsonl --db ./runs.sqlite

Keep secrets out of evidence

The key is read from OPENAI_API_KEY (or --api-key), sent as a bearer token, and never written into the record chain, SARIF output, or matrix tables.

Verify and gate

refract gate --scan scan-a1b2c3d4 --db ./runs.sqlite --max-fn 0 --max-fp-rate 0.05 --min-mcc 0.70
Related

AWS Bedrock SigV4 Targets in Refract

How to run Refract scans against AWS Bedrock with SigV4 credential resolution, without logging or storing secrets in the record chain or SARIF output.