MĀRGA API Reference
OpenAI-compatible endpoints. Drop-in replacement. Change the base URL — keep your existing code.
🟢 Alphav0.1.0OpenAI Compatible
API Overview
MĀRGA exposes an OpenAI-compatible API. Point any existing OpenAI SDK at MĀRGA by changing the base URL — no code changes needed. MĀRGA handles intelligent routing, failover, cost optimization, and observability behind the scenes.
🔗 Base URL
https://marga.avyay.aiAuthentication
All API requests require an API key passed in the request header:
bash
# Option 1: Bearer token (OpenAI-compatible)
Authorization: Bearer your-api-key
# Option 2: Custom header
X-API-Key: your-api-key
Quick Start
Send your first request in seconds:
bash
curl -X POST https://marga.avyay.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "What is machine learning?"}
]
}'
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/chat/completions | Chat completions (primary endpoint) |
| GET | /health | Service health check |
| GET | /v1/config | Router configuration & provider status |
| GET | /v1/metrics | Prometheus-format metrics |
Model Mappings
MĀRGA provides a unified model namespace. Use familiar model names and MĀRGA maps them to the optimal provider:
| Request Model | Routes To | Provider |
|---|---|---|
auto | Cost-optimized selection | Any |
gpt-4o | gpt-4o | OpenAI |
gpt-4o-mini | gpt-4o-mini | OpenAI |
claude-sonnet-4-20250514 | claude-sonnet-4 | Anthropic |
claude-opus-4-20250514 | claude-opus-4 | Anthropic |
Ready to cut your LLM costs?
MĀRGA is in alpha. Request access and start routing in minutes.