Use Crush with a private API

Connect Crush to the private Morse API: set it up, pick a model, and check it works.

Give Crush 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 Crush 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 Crush reads it.

Terminal
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 Crush for you. Or set it up by hand, below.

Setup prompt
Set up Crush 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 qwen/qwen3-coder.
4. Follow https://trymorse.ai/inference/docs/tools/crush, then run its check.

Change only Crush's settings. Leave everything else as it is.

Set up Crush

  1. Add Morse as a provider

    Put this in ~/.config/crush/crushrc. It names Morse's base URL, the variable your key is in, and each model's limits and prices. Crush reads the key from MORSE_API_KEY when it starts.

    crushrc
    provider add morse \
      --name "Morse" \
      --type completions \
      --base-url "https://inference.trymorse.ai/v1" \
      --api-key "$MORSE_API_KEY"
    
    model add morse/qwen/qwen3-coder --name "Qwen3 Coder 480B A35B" \
      --context-window 262144 \
      --default-max-tokens 32768 --thinking never \
      --price-input 0.375 --price-output 1.25
    
    model add morse/moonshotai/kimi-k3.1-pro --name "Kimi K3.1 Pro" \
      --context-window 1048576 \
      --default-max-tokens 32768 --thinking toggleable \
      --supports-images true \
      --price-input 2 --price-output 10
    
    model add morse/z-ai/glm-5.3 --name "GLM 5.3" \
      --context-window 1048576 \
      --default-max-tokens 32768 --thinking always \
      --price-input 1.4 --price-output 4.4
    
    model add morse/deepseek/deepseek-v4-pro-0813 --name "DeepSeek V4 Pro" \
      --context-window 1048576 \
      --default-max-tokens 32768 --thinking toggleable \
      --price-input 1.32 --price-output 3.96
    
    model add morse/z-ai/glm-5.3-flash --name "GLM 5.3 Flash" \
      --context-window 1048576 \
      --default-max-tokens 32768 --thinking always \
      --supports-images true \
      --price-input 0.15 --price-output 0.5
    
    model large morse/qwen/qwen3-coder
    model small morse/z-ai/glm-5.3-flash

    model large is the model Crush codes with. model small names its sessions, so a cheap model does.

  2. Start Crush

    Start Crush in your project's folder. To switch models inside it, press ctrl+l and pick another Morse model.

    Terminal
    crush

Which model to pick

ModelContextInput / outputWhy
qwen/qwen3-coder262.1K$0.375 / $1.25Qwen's coding model. It doesn't reason, so it starts writing sooner.
moonshotai/kimi-k3.1-pro1M$2 / $10Reasons, and reads images.
z-ai/glm-5.31M$1.40 / $4.40Reasons, and takes tools at TEE too.
deepseek/deepseek-v4-pro-08131M$1.32 / $3.96Reasons, at a lower price.
z-ai/glm-5.3-flash1M$0.15 / $0.50Cheap and fast for small edits, and takes tools at TEE too.

Prices are in dollars per million tokens, on each model's default endpoint. Every model is on the models page.

Check it works

Ask Crush to list the files in your folder. It calls a tool to read them, so an answer shows that Morse took both the request and its tools. One command asks and exits:

Terminal
crush run -m morse/qwen/qwen3-coder "List the files in this folder."

Keep it private

Set a privacy floor on Crush'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 seeWhat to do
Crush doesn't list the Morse modelsRun crush models. Each Morse model shows as morse/ and its id. If none does, check the path of crushrc.
401 invalid_api_keyCheck that MORSE_API_KEY is set where Crush starts, and that the key isn't revoked.
402 insufficient_balance or key_spend_limit_reachedAdd credits, or raise the key's spend limit. A request holds credit for its output limit before it starts: see Holds.
404 model_not_foundUse 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.