MorphClient
Unified client for all Morph tools.redactPII
Keeps personal data and secrets on your machine. Fast Apply, WarpGrep, Compact and the routers send a token in place of each sensitive value and put the real value back in what they return.
- Fast Apply fails closed. If the merged code holds a token that was never sent, the edit returns
success: falseand nothing is written. - WarpGrep runs its tools on your real files. A grep for a token runs as a grep for the value.
- Prefix caching is unaffected. Tokens are numbered by where a value first appears, so the same input always produces the same request.
- Not covered: GitHub search and subagents.
FastApplyClient, WarpGrepClient, CompactClient, the routers) take the same option.
createRedactingFetch
Chat models are called through the openai package or the AI SDK provider, so the client option never sees those requests. Pass createRedactingFetch() as their fetch. It takes the same values as redactPII.
createMorph({ fetch: createRedactingFetch() }).
- Streaming works. A token split across chunks is held until the rest arrives.
- Prefix caching is unaffected, including across the turns of a conversation.
- Only
/chat/completionsis understood. A request with a body to any other path throws before anything is sent. - A reply cut off by
max_tokensin the middle of a token returns that fragment as written.
Namespaces
Standalone Clients (Advanced)
Need custom configuration per tool? Use individual clients:Fast Apply
morph.fastApply.execute(input, overrides?)
Edit files with AI-powered merge.
Framework Adapters
Types
WarpGrep
morph.warpGrep.execute(input)
Agentic code search. Runs grep and file reads in a separate context window.
Framework Adapters
Types
Requires ripgrep on the machine running the search. Full options — streaming, GitHub search, sandbox execution — are on the WarpGrep pages.
Environment Variables
Import Patterns
Main SDK (Recommended)
Framework Adapters
morph.anthropic.createWarpGrepTool(), morph.openai.createWarpGrepTool(), morph.vercel.createWarpGrepTool().
Error Handling
All tools return results withsuccess: boolean and optional error: string.
Next Steps
Examples
See real-world usage patterns
Dashboard
Monitor usage and manage API keys