Morphic AI Gateway is a high-speed intelligent reverse-proxy 100% compliant with the OpenAI wire protocol. Use a single Base URL and API Key to access DeepSeek V4, Claude 3.5 Sonnet, Qwen 2.5, and more without separate international subscriptions.
Morphic operates as a transparent drop-in reverse proxy for the OpenAI ecosystem. All client requests are streamed directly to upstream providers (DeepSeek, Anthropic, Qwen, Moonshot Kimi) maintaining exact OpenAI wire specifications.
/v1/chat/completions dan /v1/models tanpa perubahan kode aplikasi Anda.stream: true) yang dioptimasi untuk Cursor Composer, Cline, dan interactive chat.Send your first chat completion through Morphic Gateway directly from your terminal in two steps:
Keys start with prefix mp-live-xxxxxxxxxxxxxxxxxxxx. Go to API Keys →
# Opsi 1: Menggunakan curl.exe bawaan Windows (PowerShell)
curl.exe https://morphic-api.web.id/v1/chat/completions `
-H "Authorization: Bearer mp-live-xxxxxxxxxxxxxxxxxxxx" `
-H "Content-Type: application/json" `
-d '{"model":"deepseek-v4","messages":[{"role":"system","content":"You are an expert developer."},{"role":"user","content":"Hello Morphic Gateway!"}],"temperature":0.2}'
# Opsi 2: Menggunakan cmdlet native PowerShell (Invoke-RestMethod)
$headers = @{
"Authorization" = "Bearer mp-live-xxxxxxxxxxxxxxxxxxxx"
"Content-Type" = "application/json"
}
$body = @{
model = "deepseek-v4"
messages = @(
@{ role = "system"; content = "You are an expert developer." }
@{ role = "user"; content = "Hello Morphic Gateway!" }
)
temperature = 0.2
} | ConvertTo-Json -Depth 5
Invoke-RestMethod -Uri "https://morphic-api.web.id/v1/chat/completions" -Method Post -Headers $headers -Body $bodyWindows Usage Note:
On Windows 10/11, run curl.exe explicitly to bypass the PowerShell alias, or run the native Invoke-RestMethod script above.
{
"id": "chatcmpl-morph-98f2b314d",
"object": "chat.completion",
"created": 1741628400,
"model": "deepseek-v4",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I am DeepSeek V4 running via Morphic Gateway. How can I help you build today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 18,
"completion_tokens": 24,
"total_tokens": 42
}
}All API requests route through Morphic’s canonical base endpoint using a Bearer token. Your API key is authenticated cryptographically with Zero Data Retention (ZDR).
Select your coding editor or CLI agent platform below for instant setup instructions and configuration snippets:
Replace mp-xxxx with your API key, paste the command into a terminal for your OS, then run opencode. Any existing config is backed up automatically. Windows: a native PowerShell script is available — no WSL required.
$env:MORPHIC_API_KEY = "mp-xxxxxxxxxxxxxxxxxxxx"
irm https://morphic-api.web.id/quickstart/opencode.ps1 | iex{
"$schema": "https://opencode.ai/config.json",
"provider": {
"morphic": {
"npm": "@ai-sdk/openai-compatible",
"name": "Morphic AI",
"options": {
"baseURL": "https://morphic-api.web.id/v1",
"apiKey": "{env:MORPHIC_API_KEY}"
},
"models": {
"MiniMaxAI/MiniMax-M2.7": {
"name": "MiniMax M2.7"
}
}
}
},
"plugin": []
}Use official OpenAI libraries in TypeScript or Python without third-party proprietary wrappers:
import OpenAI from "openai";
// Inisialisasi client resmi OpenAI mengarah ke Morphic Gateway
const client = new OpenAI({
baseURL: "https://morphic-api.web.id/v1",
apiKey: process.env.MORPHIC_API_KEY || "mp-live-xxxxxxxxxxxxxxxxxxxx",
});
async function main() {
// 1. Chat Completion Standar
const completion = await client.chat.completions.create({
model: "deepseek-v4",
messages: [
{ role: "system", content: "You are an expert TypeScript engineer." },
{ role: "user", content: "Buatkan helper debounce typed di TypeScript." },
],
temperature: 0.2,
});
console.log(completion.choices[0].message.content);
// 2. Real-time Streaming (SSE)
const stream = await client.chat.completions.create({
model: "deepseek-v4",
messages: [{ role: "user", content: "Jelaskan arsitektur micro-frontend." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || "");
}
}
main().catch(console.error);Creates a model response for the given chat conversation. Supports multi-turn context, SSE streaming, and sampling parameters.
| Header | Tipe | Keterangan |
|---|---|---|
| Authorization | string | Format wajib: Bearer mp-live-xxxx |
| Content-Type | string | Wajib: application/json |
| Field | Tipe | Status | Deskripsi |
|---|---|---|---|
| model | string | Required | ID Model resmi (misal: deepseek-v4, kimi-coding). |
| messages | array | Required | Array objek pesan percakapan dengan properti role dan content. |
| stream | boolean | Optional | Jika true, gateway mengirim token chunks via Server-Sent Events (SSE). Default: false. |
| temperature | number | Optional | Tingkat variasi respon (0.0 sampai 2.0). Disarankan 0.0 - 0.3 untuk tugas coding presisi. |
| max_tokens | integer | Optional | Batas maksimum output token yang digenerasikan oleh model. |
Lists all available models currently supported and routed by Morphic AI Gateway.
// GET https://morphic-api.web.id/v1/models
// Header: Authorization: Bearer mp-live-xxxx
{
"object": "list",
"data": [
{
"id": "deepseek-v4",
"object": "model",
"created": 1740000000,
"owned_by": "morphic"
},
{
"id": "kimi-coding",
"object": "model",
"created": 1740000000,
"owned_by": "morphic"
},
{
"id": "qwen-max",
"object": "model",
"created": 1740000000,
"owned_by": "morphic"
}
]
}| Model ID | Provider | Context | Use Case |
|---|---|---|---|
| deepseek-v4 | DeepSeek | 64K | Paling hemat & responsif. Ideal untuk auto-complete Cursor dan routine coding. |
| kimi-coding | Kimi | 256K | Konteks terpanjang di katalog. Untuk refactoring multi-file dan membaca repo besar sekaligus. |
| qwen-max | Qwen | 32K | Kuat dalam logika matematika, data engineering, dan database schema design. |
| DeepSeek-V4-Flash-0731 | Dahl | 64K | Varian Flash dari DeepSeek V4, tanpa dukungan vision. |
| Status | Kode | Penyebab | Solusi |
|---|---|---|---|
| 400 Bad Request | unsupported_capability | The request uses tools or image input, but no provider for this model supports it. | Pick a model with tools/vision support on the Models page, or send the request without tools/images. |
| 401 Unauthorized | INVALID_KEY_FORMAT | Header Authorization tidak ada, tidak berawalan mp-, atau key sudah dicabut. | Periksa kunci di Dashboard API Keys atau generate key baru. |
| 402 Payment Required | INSUFFICIENT_CREDITS | Saldo kredit akun Anda habis (≤ 0). | Top up saldo via QRIS instan di menu Billing. |
| 429 Too Many Requests | RATE_LIMIT_EXCEEDED | Batas request per menit (RPM) akun telah tercapai. | Tambahkan exponential retry backoff pada client Anda. |
| 503 Service Unavailable | UPSTREAM_TIMEOUT | Server provider upstream sedang overload atau antrean penuh. | Gateway melakukan retry otomatis; jika berlanjut, alihkan sementara ke model alternatif. |
Penting: If Cursor displays "Connection failed", ensure there is no trailing slash: use strictly ${BASE_URL} (not .../v1/).
Never commit API keys into public repositories. Store them in .env.local and add it to your .gitignore.
Create dedicated keys for local workstations and production servers to enable isolated key revocation.