canonical: https://jentic.com/apis/morphllm.com/morphllm

# Morphllm Morph API

The Morph API runs fast, specialised models for coding agents through OpenAI- and Anthropic-compatible endpoints. Fast Apply models such as morph-v3-fast and morph-v3-large merge an edit snippet into an original file, and the morph-warp-grep-v1 model runs an agentic repository search, both on the chat completions endpoint. Compact prunes irrelevant lines from chat history and code context while keeping every surviving line byte-for-byte identical. Reflex classifies text in realtime, inline, or as asynchronous batches, Singleshot returns probability distributions for typed yes/no, choice, and score questions about a state, and fine-tuning jobs train custom Reflex classifiers.

## For AI agents

Apply code edits to files with Fast Apply, compress agent context with Compact, classify text with Reflex, answer typed questions with Singleshot, and train custom classifiers through Morph.

## Scope

Does not host repositories, run code, or generate images. Use for Morph code-edit merging, context compression, classification, and typed decisions only.

## Capabilities

- Merge an edit snippet into an original file with the morph-v3-fast or morph-v3-large Apply models
- Run an agentic repository search turn with the morph-warp-grep-v1 model
- Compress chat history or code context with Compact, tuning compression_ratio and preserve_recent
- Classify text with a Reflex model in realtime, as an inline batch, or as an asynchronous batch
- Answer noul, choice, and score questions about a state with Singleshot probability distributions
- Train a custom Reflex from training_data, generate, or label_data and follow its training events
- Serve Anthropic-shaped Messages requests with a Morph model

## Use cases

### Coding agent that applies edits through Morph

A coding agent that drafts changes with a large model needs those changes merged into the real file without rewriting it by hand. Through Jentic the agent searches for 'apply a code edit to a file', loads the Morph chat completions operation with its input schema, and sends the original file and edit snippet with model morph-v3-fast. Your own Jentic One instance attaches the sk- API key at call time, and the merged file comes back in the completion.

Example prompt: Call POST `/v1/chat/completions` with model morph-v3-fast and messages containing the original file and the edit snippet, then write the returned content back to the file

### Keeping long agent sessions inside the context window

Long-running agents accumulate chat history and code that crowd the context window. Compact takes string input or a message array plus a query, and removes lines irrelevant to that query while every line it keeps stays identical to the original. Options such as compression_ratio, preserve_recent, and include_line_ranges control how aggressively it prunes.

Example prompt: Call POST `/v1/compact` with the session messages, the current task as query, and a compression_ratio, then continue the session with the compacted messages

### Low-latency text classification with Reflex

Routing support tickets or moderating messages needs a label fast. Reflex predict runs a default or trained classifier over text and returns a label, with several classifiers runnable over one shared prefill by passing a models array. For larger jobs, rows can be sent as an inline batch or uploaded as an asynchronous batch and polled by batch_id.

Example prompt: Upload rows with POST `/v1/reflex/asynchronous_batches/upload` using an Idempotency-Key header, poll GET `/v1/reflex/asynchronous_batches/{batch_id}`, then fetch GET `/v1/reflex/asynchronous_batches/{batch_id}/results`

### Typed decisions without generated text

Agent loops often need a yes/no or multiple-choice decision rather than prose. Singleshot reads a state once and answers named questions of type noul, choice, or score, returning a probability distribution for each, with a confidence for choice and score questions. Code can branch directly on the result.

Example prompt: Call POST `/v1/singleshot` with the agent's latest state, a model, and questions including a noul question 'is the task complete' and a choice question for the next step

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/v1/chat/completions` | Apply an edit or run Warp Grep |
| POST | `/v1/compact` | Compact context |
| POST | `/v1/reflex/predict` | Classify text in realtime |
| POST | `/v1/singleshot` | Answer typed questions about a state |
| POST | `/v1/messages` | Create an Anthropic-shaped message |
| POST | `/v1/fine_tuning/jobs` | Train a Reflex |
| GET | `/v1/models` | List models |

## Key resources

- **Chat completions and messages** — OpenAI-compatible Apply and Warp Grep requests, and Anthropic-shaped Messages
- **Compact** — Line-level context compression for chat history and code
- **Reflex** — Realtime, inline batch, and asynchronous batch text classification
- **Singleshot** — Typed noul, choice, and score answers about a state
- **Fine-tuning jobs and models** — Train, list, cancel, and delete Reflex jobs and models

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 74 / 100
- **Maturity:** AI-Aware
- **Dimensions:**
  - Foundational Compliance: 87 / 100
  - Developer Experience & Jentic Compatibility: 84 / 100
  - AI-Readiness & Agent Experience: 58 / 100
  - Agent Usability: 94 / 100
  - Security: 60 / 100
  - AI Discoverability: 82 / 100
- **View full report:** https://jentic.com/apis/morphllm.com/morphllm/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring Morph by hand means sending an sk- key as a bearer token, picking the right model id per request shape on the shared chat completions endpoint, and adding an Idempotency-Key header for async batch uploads. Through Jentic you install once, import Morph from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** Fine-tuning jobs and models are addressed by id in the URL path, as in `/v1/fine_tuning/jobs/{job_id}`, so a rule can hold your agent to one job, while inference calls carry their inputs in the body and are bounded by operation. You choose the operations it may call, so destructive ones like deleting a model or a job are not included unless you add them.
- **Credential handling:** Your Morph API key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'apply a code edit to a file' or 'classify text', and Jentic returns the matching Morph operation with its input schema, including the model enum and required fields.

## Related APIs

- **OpenAI API** — General-purpose language models, embeddings, and fine-tuning
- **Anthropic Messages API** — Claude models that draft the code changes Morph then applies
- **Groq API** — Low-latency inference for open models

## FAQ

### What authentication does the Morph API use?

Per its OpenAPI spec, the Morph API uses HTTP bearer authentication with a Morph API key passed as Authorization: Bearer sk-..., created in the Morph dashboard. Through Jentic the key is stored by your own Jentic One instance and attached at call time, so the agent never handles it.

### Can I use the Morph API as a drop-in for OpenAI or Anthropic clients?

The spec describes POST `/v1/chat/completions` as OpenAI-compatible and POST `/v1/messages` as Anthropic-shaped, so existing client code can point at https://api.morphllm.com with a Morph model id. The chat completions endpoint selects the request shape by model: Apply models such as morph-v3-fast and morph-v3-large, or morph-warp-grep-v1 for repository search.

### What are the rate limits for the Morph API?

The OpenAPI spec does not specify rate limits. Check the Morph site at https://www.morphllm.com for current limits on your plan.

### Is there a Morph MCP server?

You don't need an MCP server to give your agent the Morph API. Jentic connects it directly from the API Directory: import it, store your API key once, and your agent calls Apply, Compact, and Reflex on demand without another server's tool definitions in its context.

### Can I limit what my agent is allowed to do with the Morph API?

Yes. Write a rule that allows only POST `/v1/chat/completions` and POST `/v1/compact`, so a coding agent can apply edits and compress context but cannot start fine-tuning jobs or delete models. Every call it makes is logged.

### How do I compress agent context through Jentic?

Search Jentic for 'compress agent context', load the POST `/v1/compact` operation, and execute it with input or messages and a query describing the current task. The response keeps only relevant lines, each identical to the original. To run it on your own infrastructure, install Jentic One from its GitHub repo.
