Prerequisite: You’ll need an account on Morph to obtain an API key.

Authentication

All Morph API endpoints require authentication using Bearer tokens:
Authorization: Bearer your-morph-api-key
To get your API key:
  1. Visit the Morph dashboard
  2. Create an account or sign in
  3. Navigate to your API keys section
  4. Generate a new API key
Keep your API key secure and never expose it in client-side code or public repositories.

Base URL

All Morph API endpoints use the following base URL:
https://api.morphllm.com/v1

Test Your API Key

Verify your setup with a simple test request:
from openai import OpenAI

client = OpenAI(
    api_key="your-morph-api-key",
    base_url="https://api.morphllm.com/v1"
)

# Test the connection
response = client.chat.completions.create(
    model="morph-v3-fast",
    messages=[{
        "role": "user",
        "content": "<code>def hello():\n    print('Hello World')</code>\n<update>def hello():\n    print('Hello Morph!')</update>"
    }]
)

print(response.choices[0].message.content)
If the test succeeds, you should see the updated code with “Hello Morph!” instead of “Hello World”.

Alternative Access Methods

You can also access Morph through these platforms:

OpenRouter

Access Morph models through OpenRouter’s unified API platform

MCP Integration

Use Morph with Model Context Protocol servers and Claude Desktop

Next Steps

Now that you’ve tested your API key, explore Morph’s specialized models:

Apply Model

Apply code changes with precision at 4,500+ tokens per second and 98% accuracy

Embedding Model

Generate semantic embeddings optimized for code understanding and search

Rerank Model

Reorder search results by relevance with code-aware ranking algorithms
For access to our latest models, self-hosting, or business inquiries, please contact us at info@morphllm.com.