API Documentation

Simple integration. Start making API calls in minutes.

Introduction

Modexia gives you access to 100+ AI models through one API. No juggling multiple API keys, no complex billing. Just make calls and pay per request.

What You Get

One API key for OpenAI, Anthropic, Google, and 100+ models. Automatic budget controls. Real-time cost tracking. Pay with your credit card.

Key Features

  • ✨ 100+ AI Models - One API for everything
  • πŸ’³ Simple Payment - Use your credit card, we handle the rest
  • πŸ›‘οΈ Automatic Limits - Set budgets that can't be exceeded
  • πŸ“Š Cost Transparency - See exact costs before each call
  • πŸ” Complete History - Track every request and payment

Quick Start

Get started in 3 steps:

1. Sign Up

Create your account at Modexia Dashboard. Get 10 free API calls to test.

2. Add Your Credit Card

Add your payment method. We handle the crypto conversion automatically.

3. Get Your API Key

Generate your API key from the dashboard and start making calls:

Python
import requests

response = requests.post('https://api.modexia.ai/v1/request', 
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'provider': 'openai',
        'model': 'gpt-4',
        'prompt': 'Hello, world!',
        'max_tokens': 100
    }
)

print(response.json())

πŸ’‘ Pro Tip

Start with gpt-3.5-turbo to test your integrationβ€”it's cheaper.

Authentication

Every API request needs your API key in the header.

Get Your API Key

1. Open your Modexia Dashboard
2. Go to Settings β†’ API Keys
3. Click "Generate New Key"
4. Copy it somewhere safe

⚠️ Keep It Secret

Don't share your API key or commit it to GitHub. Use environment variables.

Making Requests

cURL
curl -X POST https://api.modexia.ai/v1/request \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "openai",
    "model": "gpt-4",
    "prompt": "Hello!"
  }'

Making Requests

The Modexia API accepts JSON-formatted requests with the following structure:

Request Parameters

Parameter Type Required Description
provider string Yes AI provider (openai, anthropic, google)
model string Yes Model name (gpt-4, claude-3, gemini-pro)
prompt string Yes The prompt text to send
max_tokens integer No Maximum tokens to generate (default: 1000)
temperature float No Sampling temperature 0-1 (default: 0.7)
agent_id string No Your agent identifier for tracking

Example Request

JavaScript
const response = await fetch('https://api.modexia.ai/v1/request', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    provider: 'openai',
    model: 'gpt-4',
    prompt: 'Explain quantum computing in simple terms',
    max_tokens: 500,
    temperature: 0.7,
    agent_id: 'my_research_agent'
  })
});

const data = await response.json();
console.log(data);

Response Format

Modexia returns structured JSON responses with detailed information about the request processing.

Success Response

JSON
{
  "status": "success",
  "decision": "approved",
  "confidence": 95,
  "agent_tier": "FLASH",
  "response": {
    "text": "Quantum computing uses quantum mechanics...",
    "tokens_used": 156,
    "finish_reason": "stop"
  },
  "cost": {
    "amount": 0.0078,
    "currency": "USD",
    "breakdown": {
      "input_tokens": 12,
      "output_tokens": 156
    }
  },
  "processing_time_ms": 892,
  "request_id": "req_abc123xyz"
}

Response Fields

Field Type Description
status string Request status (success, requires_review, denied)
decision string Agent decision result
confidence integer Decision confidence (0-100)
agent_tier string Which agent processed (FLASH or PRO)
response object AI model response data
cost object Cost breakdown in USD
request_id string Unique request identifier

Supported Models

Modexia provides access to 100+ AI models across multiple providers.

OpenAI

  • gpt-4 - Most capable model
  • gpt-4-turbo - Faster GPT-4 variant
  • gpt-3.5-turbo - Fast and cost-effective

Anthropic

  • claude-3-opus - Most powerful Claude
  • claude-3-sonnet - Balanced performance
  • claude-3-haiku - Fast and affordable

Google

  • gemini-pro - Advanced reasoning
  • gemini-flash - Speed optimized

πŸ“Š Pricing Varies by Model

Each model has different pricing based on input/output tokens. Check your dashboard for real-time pricing.

Payments

Add your credit card to start making API calls. We handle everything else automatically.

How It Works

1. Add your credit card in the dashboard
2. Each API request charges the exact cost + 5% fee
3. View your spending history in real-time
4. Set budget limits to control costs

Why It's Simple

  • πŸ’³ Credit card only - No crypto knowledge needed
  • ⚑ Instant payments - Start using APIs immediately
  • πŸ” Full transparency - See every transaction in your dashboard
  • 🌍 Global access - Works with any major credit card

🎯 Get Started

New users get 10 free API calls. Add your credit card to unlock them.