Use PyRIT with a private, uncensored API
Connect PyRIT to the private Morse API, uncensored models included: set it up, pick a model, and check it works.
Give PyRIT the base URL https://inference.trymorse.ai/v1 and a Morse API key. It calls the OpenAI API.
The same key also calls 17 uncensored models. See them.
Agent security: Stress-test your AI agents to identify prompt injection, jailbreak, and tool misuse vulnerabilities.
Before you start
Make a key for PyRIT alone, with a spend limit, under API keys in the console. Then one tool can't spend all your credits. See Limit a key. Keep the key in your environment, where PyRIT reads it.
export MORSE_API_KEY="sk_morse_..."Set it up with a prompt
Paste this into a coding agent, such as Claude Code or Codex, and it sets up PyRIT for you. Or set it up by hand, below.
Set up PyRIT to use Morse.
1. Use the OpenAI-compatible endpoint https://inference.trymorse.ai/v1
2. Read the key from the MORSE_API_KEY environment variable.
3. Default to the model z-ai/glm-5.3-uncensored.
4. Follow https://trymorse.ai/inference/docs/tools/pyrit, then run its check.
Change only PyRIT's settings. Leave everything else as it is.Set up PyRIT
Add Morse to PyRIT's .env
PyRIT reads its endpoints from
~/.pyrit/.env. Add these lines:~/.pyrit/.env OPENAI_CHAT_ENDPOINT="https://inference.trymorse.ai/v1" OPENAI_CHAT_KEY="${MORSE_API_KEY}" OPENAI_CHAT_MODEL="z-ai/glm-5.3-uncensored" ADVERSARIAL_CHAT_ENDPOINT="https://inference.trymorse.ai/v1" ADVERSARIAL_CHAT_KEY="${MORSE_API_KEY}" ADVERSARIAL_CHAT_MODEL="z-ai/glm-5.3-uncensored"OPENAI_CHAT_*is the model PyRIT'sOpenAIChatTargetcalls when you name no other.ADVERSARIAL_CHAT_*is the attacker: the model that writes the attacks PyRIT sends to your agent.- PyRIT fills in the key from
MORSE_API_KEYin your environment, so the file holds no key.
Aim the attacks at your agent
PyRIT's
targetinitializer, which runs by default, makes the attackeradversarial_chat. Its attacks, such as role play and TAP, use it to write the prompts. Make your agent's endpoint the attack'sobjective_target.
Which model to pick
| Model | Context | Input / output | Why |
|---|---|---|---|
z-ai/glm-5.3-uncensored | 1M | $1.75 / $5 | Uncensored, so it writes attacks instead of refusing, with JSON output in an attested enclave. |
qwen/qwen3.8-27b-uncensored | 256K | $0.35 / $1.75 | Uncensored and cheaper, with JSON output in an attested enclave. |
google/gemma-4-26b-a4b-uncensored | 256K | $0.175 / $0.85 | Uncensored, and the cheapest here, for long attack runs. |
Prices are in dollars per million tokens, on each model's default endpoint. Every model is on the models page.
Check it works
Save this as a script and run it with Python:
import asyncio
from pyrit.executor.attack import PromptSendingAttack
from pyrit.prompt_target import OpenAIChatTarget
from pyrit.setup import IN_MEMORY, initialize_pyrit_async
async def main():
await initialize_pyrit_async(memory_db_type=IN_MEMORY)
attack = PromptSendingAttack(objective_target=OpenAIChatTarget())
result = await attack.execute_async(objective="Say hello in one word.")
print(result.last_response.converted_value)
asyncio.run(main())It sends one request. The model's response shows that Morse took it.
Keep it private
Set a privacy floor on PyRIT's key to hold it to a tier, such as TEE. Without a floor, a request runs on its model's default privacy tier. The floor only decides which endpoints serve the requests. See Privacy tiers and Provider routing.
On a plain API call, TLS ends inside Morse's door, an attested enclave, which seals the request before the relay receives it. A plain client checks the door's certificate, not its attestation. To check the attestation yourself, see Sealed API keys.
If something goes wrong
| What you see | What to do |
|---|---|
400 on a scorer's request | Use a model from the table: PyRIT's scorers and its attacker ask for JSON output. The scorers use OPENAI_CHAT_* unless you set OBJECTIVE_SCORER_CHAT_*. |
No API key available for endpoint | Set MORSE_API_KEY in the shell you start Python from: the file reads it from there. |
400 setting_not_forwarded | PyRIT's attacker sends temperature and response_format. Turn on Let my settings reach the model host on the key's page in the console. See Settings. |
401 invalid_api_key | Check that MORSE_API_KEY is set where PyRIT starts, and that the key isn't revoked. |
402 insufficient_balance or key_spend_limit_reached | Add credits, or raise the key's spend limit. A request holds credit for its output limit before it starts: see Holds. |
404 model_not_found | Use a model's id exactly as the table above writes it, with the part before the slash. |
Every code is in Error codes. For other tools, see Tools and coding agents.