Use Cowrie with a private API
Connect Cowrie to the private Morse API: set it up, pick a model, and check it works.
Give Cowrie the base URL https://inference.trymorse.ai/v1 and a Morse API key. It calls the OpenAI API.
Before you start
Make a key for Cowrie 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 Cowrie 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 Cowrie for you. Or set it up by hand, below.
Set up Cowrie 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-flash-uncensored.
4. Follow https://trymorse.ai/inference/docs/tools/cowrie, then run its check.
Change only Cowrie's settings. Leave everything else as it is.Set up Cowrie
Why an uncensored model
Cowrie is an SSH and Telnet honeypot. Its LLM backend has a model write the shell's output, so it answers any command.
Run Cowrie only on servers and networks you control. Morse's acceptable-use policy bans creating malware and attacking systems or people you're not authorized to test.
Attackers type commands that fetch and run malicious scripts. A stock model can answer those with a refusal, which tells the attacker the shell isn't real. An uncensored model keeps playing the server.
Point the LLM backend at Morse
In
etc/cowrie.cfg, changebackend = shellunder[honeypot]tobackend = llm. Then set these lines under the[llm]section already in the file.Don't add either section a second time, or Cowrie won't start. Cowrie joins
hostandpathinto the URL it calls, so the/v1goes inpath:etc/cowrie.cfg [honeypot] backend = llm [llm] host = https://inference.trymorse.ai path = /v1/chat/completions model = z-ai/glm-5.3-flash-uncensored max_tokens = 2000Keep the key out of the file. Cowrie reads any setting from an environment variable named
COWRIE_<SECTION>_<OPTION>:Terminal export COWRIE_LLM_API_KEY="$MORSE_API_KEY"Reasoning tokens count toward
max_tokens. Give the model more room than Cowrie's default of 500, or its response can be cut short.Or run it in Docker
Every setting above can be an environment variable, so the Docker image needs no config file:
Terminal docker run -p 2222:2222 \ -e COWRIE_HONEYPOT_BACKEND=llm \ -e COWRIE_LLM_HOST=https://inference.trymorse.ai \ -e COWRIE_LLM_PATH=/v1/chat/completions \ -e COWRIE_LLM_MODEL=z-ai/glm-5.3-flash-uncensored \ -e COWRIE_LLM_MAX_TOKENS=2000 \ -e COWRIE_LLM_API_KEY="$MORSE_API_KEY" \ cowrie/cowrie:latest
Which model to pick
| Model | Context | Input / output | Why |
|---|---|---|---|
z-ai/glm-5.3-flash-uncensored | 1M | $0.225 / $1 | Uncensored, fast, and cheap: a honeypot sends one request per command. |
deepseek/deepseek-v4.1-flash-1017-abliterated | 1M | $0.50 / $1.50 | Uncensored, and knows more of what real systems print. |
google/gemma-4-26b-a4b-uncensored | 262.1K | $0.175 / $0.85 | Uncensored, the cheapest here, and runs only in attested enclaves. |
Prices are in dollars per million tokens, on each model's default endpoint. Every model is on the models page.
Check it works
Start Cowrie with cowrie start, or the Docker command above. Then log in to it from the same machine and run a command:
ssh -p 2222 root@localhost
uname -aCowrie takes any password for root, except a few such as root. A believable response shows the model wrote it. To see each request and response in Cowrie's log, set debug = true under [llm], or COWRIE_LLM_DEBUG=true.
Keep it private
Set a privacy floor on Cowrie'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 |
|---|---|
| The shell answers like the stock emulator | Check that backend = llm is under [honeypot], not [llm]. |
| Commands print nothing | Look in var/log/cowrie/cowrie.log, or docker logs, for LLM API error. It shows the status Morse returned, such as the ones below. Check that host has no path, and that path is /v1/chat/completions. |
| Responses stop mid-line | Raise max_tokens: the model's reasoning counts toward it. |
401 invalid_api_key | Check that MORSE_API_KEY is set where Cowrie 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.