> ## Documentation Index
> Fetch the complete documentation index at: https://ngrok.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Morph with the AI Gateway

> Call Morph's code-apply models and open-weight GLM, Kimi, and DeepSeek models through the ngrok AI Gateway with credits or your own Morph API key.

[Morph](https://www.morphllm.com/) serves its Fast Apply code-edit models and open-weight models from Z.ai, Moonshot AI, and DeepSeek.

Morph supports Chat Completions requests.

> [!NOTE]
>
> Morph is a **built-in provider**.
> You can pay for every Morph model in the catalog with credits except `deepseek/deepseek-v4.1-flash-abliterated`, which needs your own Morph key.
> The **Needs BYOK?** column in the [model catalog](https://ngrok.com/docs/ai-gateway/reference/model-catalog.md#morph) shows which is which.

## Setup

### 1. Create an access key and add credits

Follow the [quickstart](https://ngrok.com/docs/ai-gateway/quickstart.md) to create an access key and purchase [credits](https://ngrok.com/docs/ai-gateway/concepts/credits.md) in [app.ngrok.ai](https://app.ngrok.ai).

### 2. Store your Morph API key (optional)

Skip this step to pay with credits for the models that support it.
To bring your own key, create an API key in your [Morph](https://www.morphllm.com/) account.
Then [add a provider key](https://ngrok.com/docs/ai-gateway/guides/attaching-provider-keys.md#add-a-provider-key) and [create an access key configuration](https://ngrok.com/docs/ai-gateway/guides/access-key-configurations.md#create-a-configuration) with a `morph` routing rule that uses it.

### 3. Send requests

Send requests with your access key:

```python theme={"theme":{"light":"css-variables","dark":"css-variables"}}
from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.ngrok.ai/v1",
    api_key="ng-xxxxx-g1-xxxxx",
)

response = client.chat.completions.create(
    model="morph:z-ai/glm-5.3",
    messages=[{"role": "user", "content": "Hello!"}]
)
```

Other providers also serve most Morph models.
The `morph:` prefix keeps the request on Morph.

## Models

* `morph/morph-v3-fast` and `morph/morph-v3-large` apply code edits.
  `morph-v3-fast` is the faster of the two, and `morph-v3-large` is the more accurate.
* `moonshotai/kimi-k3-fast` is Kimi K3 on hardware that Morph tunes for time to first token.
* `deepseek/deepseek-v4.1-flash-abliterated` is DeepSeek V4.1 Flash 1017 with its refusals removed.
  Morph serves it only to accounts it approves, and returns a 403 to others.

The gateway removes `service_tier` from Morph requests, so every request runs on Morph's standard tier.

## Available models

See the [model catalog](https://ngrok.com/docs/ai-gateway/reference/model-catalog.md#morph).

## Next steps

* [Provider keys](https://ngrok.com/docs/ai-gateway/guides/attaching-provider-keys.md)
* [Access key configurations](https://ngrok.com/docs/ai-gateway/guides/access-key-configurations.md)
* [Open-weight models](https://ngrok.com/docs/ai-gateway/concepts/open-weight-models.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.