← MĀRGA/API Documentation

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.ai

Authentication

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

MethodEndpointDescription
POST/v1/chat/completionsChat completions (primary endpoint)
GET/healthService health check
GET/v1/configRouter configuration & provider status
GET/v1/metricsPrometheus-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 ModelRoutes ToProvider
autoCost-optimized selectionAny
gpt-4ogpt-4oOpenAI
gpt-4o-minigpt-4o-miniOpenAI
claude-sonnet-4-20250514claude-sonnet-4Anthropic
claude-opus-4-20250514claude-opus-4Anthropic

Ready to cut your LLM costs?

MĀRGA is in alpha. Request access and start routing in minutes.

Request Alpha AccessView on GitHub