Connect Strands Agents to the private Morse API, uncensored models included: set it up, pick a model, and check it works. Updated December 2, 2026.

Page: https://trymorse.ai/inference/docs/tools/strands

# Use Strands Agents with a private, uncensored API

Give [Strands Agents](https://strandsagents.com) the base URL `https://inference.trymorse.ai/v1` and a Morse API key. It calls the OpenAI API.

The same key also calls 13 uncensored models. [See them](https://trymorse.ai/inference/uncensored).

## Before you start

Make a key for Strands Agents alone, with a spend limit, under **API keys** in the [console](https://console.trymorse.ai). Then one tool can't spend all your credits. See [Limit a key](https://trymorse.ai/inference/docs/authentication#limits). Keep the key in your environment, where Strands Agents 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 Strands Agents for you. Or set it up by hand, below.

Setup prompt

```
Set up Strands Agents 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/strands, then run its check.

Change only Strands Agents's settings. Leave everything else as it is.
```

## Set up Strands Agents

1. Install Strands Agents with its OpenAI providerPython`pip install 'strands-agents[openai]'`TypeScript`npm install @strands-agents/sdk openai`The Python package needs Python 3.10 or later.
2. Point the OpenAI provider at MorseGive `OpenAIModel` Morse's base URL, your key, and a model id. Set the output limit too, since a request holds credit for it.agent.py`import os from strands import Agent from strands.models.openai import OpenAIModel model = OpenAIModel( client_args={ "api_key": os.environ["MORSE_API_KEY"], "base_url": "https://inference.trymorse.ai/v1", }, model_id="qwen/qwen3-coder", params={"max_tokens": 32768}, ) agent = Agent(model=model) response = agent("Explain tool calling in one sentence.") print(response)`agent.ts`import { Agent } from "@strands-agents/sdk"; import { OpenAIModel } from "@strands-agents/sdk/models/openai"; const model = new OpenAIModel({ api: "chat", apiKey: process.env.MORSE_API_KEY, clientConfig: { baseURL: "https://inference.trymorse.ai/v1" }, modelId: "qwen/qwen3-coder", maxTokens: 32768, }); const agent = new Agent({ model }); const response = await agent.invoke("Explain tool calling in one sentence."); console.log(response.toString());`

## Which model to pick

| Model | Context | Input / output | Why |
| --- | --- | --- | --- |
| `qwen/qwen3-coder` | 256K | $0.375 / $1.25 | Qwen's coding model. It doesn't reason, so it starts writing sooner. |
| `moonshotai/kimi-k3.1-pro` | 1M | $2 / $10 | Reasons, and reads images. |
| `z-ai/glm-5.3` | 1M | $1.40 / $4.40 | Reasons, and takes tools at TEE too. |
| `deepseek/deepseek-v4-pro-0813` | 1M | $1.32 / $3.96 | Reasons, at a lower price. |
| `z-ai/glm-5.3-flash` | 1M | $0.15 / $0.50 | Cheap and fast for small edits, and takes tools at TEE too. |
| `google/gemma-4-26b-a4b-uncensored` | 256K | $0.175 / $0.85 | Uncensored, and takes tools at TEE. |

Prices are in dollars per million tokens, on each model's default endpoint. Every model is on the [models page](https://trymorse.ai/inference/models).

## Check it works

Give the agent a tool and ask a question that needs it. An answer with the count shows that Morse took both the request and its tools:

Python

```
from strands import Agent, tool


@tool
def word_count(text: str) -> int:
    """Count the words in a piece of text."""
    return len(text.split())


agent = Agent(model=model, tools=[word_count])
agent("How many words are in 'private inference for open-weight models'?")
```

## Keep it private

Set a privacy floor on Strands Agents'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](https://trymorse.ai/inference/docs/privacy-tiers) and [Provider routing](https://trymorse.ai/inference/docs/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](https://trymorse.ai/inference/docs/sealed-api-keys).

## If something goes wrong

| What you see | What to do |
| --- | --- |
| OpenAI API key is required | TypeScript's `OpenAIModel` found no key. Set `MORSE_API_KEY` where your program starts, and pass it as `apiKey`. |
| An error names platform.openai.com | Set `base_url` in Python or `baseURL` in TypeScript. Without it, the request goes to OpenAI with your Morse key. |
| `401 invalid_api_key` | Check that `MORSE_API_KEY` is set where Strands Agents 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](https://trymorse.ai/inference/docs/pricing#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](https://trymorse.ai/inference/docs/api/errors). For other tools, see [Tools and coding agents](https://trymorse.ai/inference/docs/tools).
