Dokumentasi API
Panduan lengkap menggunakan API key AIMurah di berbagai IDE dan tools. Compatible dengan OpenAI SDK, Anthropic SDK, dan semua tools yang mendukung format OpenAI.
Mulai Cepat
Tiga langkah mudah untuk mulai menggunakan API AIMurah:
Daftar di AIMurah
Buat akun gratis di aimurah.my.id. Tidak perlu kartu kredit.
Buat API Key
Masuk ke dashboard, buka menu "API Keys", lalu klik "Buat API Key Baru".
Gunakan di Tool Favorit
Masukkan base URL dan API key di IDE atau tool pilihan Anda. Lihat panduan setup di bawah.
Setelah punya API key, coba langsung dengan curl. Scroll ke Chat Completions untuk contoh lengkap.
Base URL & Endpoint
Semua request dikirim ke base URL berikut:
https://aimurah.my.id/api/v1
Endpoint yang Tersedia
| Method | Endpoint | Deskripsi |
|---|---|---|
| POST | /v1/chat/completions | OpenAI-compatible chat completions |
| POST | /v1/messages | Anthropic-compatible messages |
| POST | /v1/responses | OpenAI Responses API |
| GET | /v1/models | Daftar model tersedia |
| POST | /v1/images/generations | Image generation (Flux AI) |
| POST | /v1/mcp | MCP Server (Streamable HTTP) |
Autentikasi
Semua request harus menyertakan API key di header Authorization.
Authorization: Bearer YOUR_API_KEY
Simpan API key dengan aman
API key hanya ditampilkan sekali saat pembuatan. Jangan share key di public repository atau client-side code.
Chat Completions
OpenAI-compatible chat completions. Mendukung streaming, function calling, dan vision.
POST https://aimurah.my.id/api/v1/chat/completions
Parameters
| Parameter | Tipe | Deskripsi | |
|---|---|---|---|
| model | string | * | Model ID, contoh: claude-sonnet-4.5 |
| messages | array | * | Array of message objects (role + content) |
| stream | boolean | Enable SSE streaming (default: false) | |
| max_tokens | integer | Maximum output tokens | |
| temperature | number | Sampling temperature (0-2, default: 1) | |
| top_p | number | Nucleus sampling (0-1) | |
| tools | array | Function calling tools definition | |
| tool_choice | string|object | "auto", "none", atau specific tool |
Request Example
curl https://aimurah.my.id/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-4.5", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing briefly."} ], "stream": true, "max_tokens": 1024 }'
from openai import OpenAI client = OpenAI( base_url="https://aimurah.my.id/api/v1", api_key="YOUR_API_KEY" ) response = client.chat.completions.create( model="claude-sonnet-4.5", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing briefly."} ], stream=True, max_tokens=1024 ) for chunk in response: if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="")
import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://aimurah.my.id/api/v1", apiKey: "YOUR_API_KEY", }); const stream = await client.chat.completions.create({ model: "claude-sonnet-4.5", messages: [ { role: "system", content: "You are a helpful assistant." }, { role: "user", content: "Explain quantum computing briefly." } ], stream: true, max_tokens: 1024, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content || ""); }
// Using Guzzle HTTP client use GuzzleHttp\Client; $client = new Client(['base_uri' => 'https://aimurah.my.id/api/v1/']); $response = $client->post('chat/completions', [ 'headers' => [ 'Authorization' => 'Bearer YOUR_API_KEY', 'Content-Type' => 'application/json', ], 'json' => [ 'model' => 'claude-sonnet-4.5', 'messages' => [ ['role' => 'user', 'content' => 'Explain quantum computing briefly.'], ], 'max_tokens' => 1024, ], ]); $body = json_decode($response->getBody(), true); echo $body['choices'][0]['message']['content'];
Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "claude-sonnet-4.5",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Quantum computing uses qubits that can exist in multiple states simultaneously..."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 28,
"completion_tokens": 42,
"total_tokens": 70
}
}
Reasoning models (o3, o4-mini) membutuhkan max_tokens minimal 500. Token digunakan untuk internal reasoning.
Messages (Anthropic Format)
Endpoint compatible dengan Anthropic SDK. Gunakan jika tool Anda membutuhkan format Anthropic Messages API.
POST https://aimurah.my.id/api/v1/messages
Request Example
curl https://aimurah.my.id/api/v1/messages \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "claude-sonnet-4.5", "max_tokens": 1024, "messages": [ {"role": "user", "content": "Hello, Claude!"} ] }'
from anthropic import Anthropic client = Anthropic( base_url="https://aimurah.my.id/api/v1", api_key="YOUR_API_KEY" ) message = client.messages.create( model="claude-sonnet-4.5", max_tokens=1024, messages=[ {"role": "user", "content": "Hello, Claude!"} ] ) print(message.content[0].text)
Kedua format (OpenAI dan Anthropic) menggunakan API key yang sama. Pilih format sesuai SDK yang Anda gunakan.
Streaming (SSE)
Gunakan "stream": true untuk menerima response secara real-time via Server-Sent Events.
Format SSE Response
// Setiap chunk dikirim sebagai SSE event: data: {"id":"chatcmpl-abc","choices":[{"delta":{"content":"Hello"}}]} data: {"id":"chatcmpl-abc","choices":[{"delta":{"content":" world"}}]} data: {"id":"chatcmpl-abc","choices":[{"delta":{},"finish_reason":"stop"}]} data: [DONE]
Parsing Streaming di Python
from openai import OpenAI client = OpenAI(base_url="https://aimurah.my.id/api/v1", api_key="YOUR_API_KEY") stream = client.chat.completions.create( model="claude-sonnet-4.5", messages=[{"role": "user", "content": "Hi!"}], stream=True ) full_response = "" for chunk in stream: content = chunk.choices[0].delta.content or "" full_response += content print(content, end="", flush=True)
Parsing Streaming di JavaScript
const response = await fetch("https://aimurah.my.id/api/v1/chat/completions", { method: "POST", headers: { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ model: "claude-sonnet-4.5", messages: [{ role: "user", content: "Hi!" }], stream: true, }), }); const reader = response.body.getReader(); const decoder = new TextDecoder(); while (true) { const { done, value } = await reader.read(); if (done) break; const text = decoder.decode(value); // Parse SSE lines starting with "data: " for (const line of text.split("\n")) { if (line.startsWith("data: ") && line !== "data: [DONE]") { const json = JSON.parse(line.slice(6)); process.stdout.write(json.choices[0]?.delta?.content || ""); } } }
Model Tersedia
Daftar lengkap model AI yang tersedia. Model dengan badge FREE dapat digunakan tanpa biaya.
Anthropic (Claude)
OpenAI (GPT)
Google (Gemini)
DeepSeek
Lainnya
Setup IDE & Tools
VS Code
Continue Extension
Edit file ~/.continue/config.json:
{
"models": [{
"title": "AIMurah - Claude Sonnet 4.5",
"provider": "openai",
"model": "claude-sonnet-4.5",
"apiBase": "https://aimurah.my.id/api/v1",
"apiKey": "YOUR_API_KEY"
}]
}Cline / Roo Code
Buka settings extension dan atur:
- •Provider: OpenAI Compatible
- •Base URL:
https://aimurah.my.id/api/v1 - •API Key: API key Anda
- •Model:
claude-sonnet-4.5
Cursor
Buka Settings → Models → OpenAI API Key:
- •Base URL:
https://aimurah.my.id/api/v1 - •API Key: API key Anda
- •Override Model:
claude-sonnet-4.5
Windsurf
Buka Settings → AI → Custom Provider:
- •Base URL:
https://aimurah.my.id/api/v1 - •API Key: API key Anda
- •Model:
claude-sonnet-4.5
OpenCode
Edit file ~/.config/opencode/opencode.json:
{
"providers": {
"aimurah": {
"kind": "openai",
"baseURL": "https://aimurah.my.id/api/v1",
"apiKey": "YOUR_API_KEY"
}
},
"models": {
"sonnet": {
"provider": "aimurah",
"model": "claude-sonnet-4.5"
}
}
}Claude Code
Set environment variables:
# Set environment variables export ANTHROPIC_BASE_URL="https://aimurah.my.id/api/v1" export ANTHROPIC_API_KEY="YOUR_API_KEY" # Atau gunakan flag claude --provider openai --api-base "https://aimurah.my.id/api/v1" --api-key "YOUR_API_KEY"
KiloCode
Buka settings KiloCode:
- •Provider: OpenAI Compatible
- •API Base URL:
https://aimurah.my.id/api/v1 - •API Key: API key Anda
- •Model ID:
claude-sonnet-4.5
Hermes Agent
Edit file config.yaml:
providers: aimurah: kind: openai base_url: https://aimurah.my.id/api/v1 api_key: YOUR_API_KEY models: - claude-sonnet-4.5 - claude-opus-4.6
Antigravity
Buka Settings → Provider → Custom OpenAI:
- •Endpoint:
https://aimurah.my.id/api/v1/chat/completions - •API Key: API key Anda
- •Model:
claude-sonnet-4.5
OpenClaw
Buka Configuration → API Provider → OpenAI Compatible:
- •Base URL:
https://aimurah.my.id/api/v1 - •API Key: API key Anda
- •Model: Pilih dari daftar model di atas
Generic (OpenAI-Compatible)
Untuk tool apapun yang mendukung format OpenAI:
https://aimurah.my.id/api/v1API AIMurah 100% compatible dengan format OpenAI. Jika tool Anda mendukung "Custom OpenAI" atau "OpenAI Compatible", cukup masukkan base URL dan API key.
Image Generation
Generate gambar dari text prompt menggunakan Flux AI. Tersedia untuk user dengan subscription aktif (Pro/Premium/Harian).
Image generation hanya tersedia untuk user dengan subscription aktif. User free tier tidak dapat mengakses fitur ini.
Parameters
| Parameter | Tipe | Deskripsi | |
|---|---|---|---|
| model | string | * | Gunakan flux-2-klein-4b |
| prompt | string | * | Deskripsi gambar yang ingin di-generate |
| n | integer | Jumlah gambar (1-4, default: 1) | |
| size | string | 256x256, 512x512, atau 1024x1024 (default: 512x512) |
Request Example
curl https://aimurah.my.id/api/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "flux-2-klein-4b", "prompt": "a cute orange cat sitting on a cloud", "n": 1, "size": "512x512" }'
from openai import OpenAI import base64 client = OpenAI( base_url="https://aimurah.my.id/api/v1", api_key="YOUR_API_KEY" ) response = client.images.generate( model="flux-2-klein-4b", prompt="a cute orange cat sitting on a cloud", n=1, size="512x512", response_format="b64_json" ) # Save image img_data = base64.b64decode(response.data[0].b64_json) with open("output.jpg", "wb") as f: f.write(img_data)
Limit per Plan
| Plan | Limit Harian | Keterangan |
|---|---|---|
| Free | ✗ Tidak tersedia | - |
| Pro / Premium / Harian | 10 gambar/hari | Reset tengah malam WIB |
MCP Server (Image Generation)
Generate gambar langsung dari coding agent Anda. Copy instruksi di bawah, paste ke agent/LLM Anda, dan MCP akan terpasang otomatis.
Via NPX (Node.js)
// Copy dan paste ke agent Anda: Pasangkan MCP server image generation AIMurah di environment saya. Config MCP yang perlu ditambahkan: { "mcpServers": { "aimurah-image": { "command": "npx", "args": ["-y", "@aimurah/mcp-image", "--api-key", "GANTI_DENGAN_API_KEY"] } } }
Via HTTP (tanpa Node.js)
// Untuk client yang support HTTP transport: { "mcpServers": { "aimurah-image": { "url": "https://aimurah.my.id/api/v1/mcp", "headers": { "Authorization": "Bearer GANTI_DENGAN_API_KEY" } } } }
Setelah terpasang, cukup minta agent: "generate gambar kucing lucu" atau "buatkan logo minimalis". Agent akan otomatis menggunakan tool generate_image.
Rate Limits & Kuota
Setiap plan memiliki batasan penggunaan yang berbeda:
| Plan | Request/Hari | Request/Menit | Concurrent | Token Cap |
|---|---|---|---|---|
| FREE | 50 | 6 | 1 | Unlimited |
| PRO (Rp29K/bln) | 500 | 30 | 2 | 50M tokens |
| PREMIUM (Rp59K/bln) | 2000 | 90 | 4 | 250M tokens |
| Harian (Rp29K/hari) | Unlimited | 60 | 4 | 75M tokens |
Response Headers
Setiap response menyertakan header rate limit:
X-RateLimit-Limit: 30 // Max requests per menit X-RateLimit-Remaining: 29 // Sisa requests X-RateLimit-Reset: 1620000000 // Unix timestamp reset
Error Handling
API mengembalikan error dalam format JSON yang konsisten:
{
"error": {
"message": "Invalid API key",
"type": "authentication_error"
}
}{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error"
}
}{
"error": {
"message": "Token quota exceeded",
"type": "insufficient_quota"
}
}{
"error": {
"message": "Model not available for your plan",
"type": "permission_error"
}
}FAQ
https://aimurah.my.id/api/v1 dan gunakan API key AIMurah."stream": true untuk mendapatkan response secara streaming (Server-Sent Events). Lihat bagian Streaming untuk contoh lengkap./v1/messages. Lihat bagian Messages API.