DEVELOPER GATEWAY API v1.0.0 • Edge Proxy Architecture

AgentMink Gateway Documentation

A high-performance, OpenAI-compatible proxy gateway for autonomous model routing, real-time cost arbitrage, and automated upstream failover. Drop in your endpoint to connect any model provider instantly.

1. Quickstart

AgentMink is completely OpenAI-compatible. To route your requests through the gateway, simply point your client SDK or HTTP requests to the AgentMink base URL and provide your API token.

curl -X POST "https://gateway.agentmink.com/v1/chat/completions" 
  -H "Authorization: Bearer MINK_API_KEY" 
  -H "Content-Type: application/json" 
  -H "x-mink-strategy: cost_first" 
  -d '{
    "model": "gpt-4o",
    "messages": [
      {"role": "user", "content": "Extract invoice totals from this receipt."}
    ]
  }'

2. Base URL & Authentication

All API requests are served through our globally distributed Cloudflare edge proxy.

GATEWAY ENDPOINT
https://gateway.agentmink.com/v1/chat/completions POST
Authentication Header

Authenticate all requests by including your key in the Authorization: Bearer <KEY> header. Generate and manage keys in your AgentMink Dashboard.

3. Autonomous Routing Strategies

AgentMink includes three deterministic routing strategies designed for different production workloads:

Strategy Behavior Primary Use Case
cost_first Default Evaluates active pricing across all connected providers and routes to the lowest-cost model matching your quality floor. Batch extraction, classification, summarization, high-volume workloads.
quality_first Routes to the frontier reasoning model with highest verified benchmark accuracy, with automated failover on 5xx errors. Complex code generation, medical/legal analysis, multi-step agent reasoning.
latency_first Dispatches requests to the provider endpoint with lowest Time-To-First-Token (TTFT) and p95 latency. Live conversational chat, interactive voice agents, search autocomplete.

4. Custom Request Headers

Control proxy routing per request using custom HTTP headers:

Header Type Description
x-mink-strategy string Routing mode: cost_first, quality_first, or latency_first. Default is cost_first.
x-mink-vendor-key string Pass your own provider secret key for zero-markup direct execution.
x-mink-fallback-model string Explicit secondary model target if the primary requested model triggers a rate limit or 503 outage.

5. Zero-Markup BYOK Key Vault Architecture

AgentMink offers two execution models that can be mixed and matched freely:

Zero-Markup BYOK Vault

Store your vendor API keys (Anthropic, Gemini, Groq, DeepSeek) in our encrypted AES-GCM vault. Requests route directly against your provider agreements with zero markup.

100% Direct Billing
Unified Managed Routing

Store your direct provider credentials (OpenAI, Anthropic, Google Gemini, Groq, DeepSeek, AWS Bedrock) in the encrypted key vault. Keys are encrypted at rest with AES-256-GCM and injected strictly in volatile RAM at the edge during upstream dispatch. You pay your providers directly with zero token markups or middleman fees.

Single Unified Invoice

6. Multi-Language SDK Integrations

Integrate seamlessly with LangChain, Vercel AI SDK, LlamaIndex, or any standard HTTP client.

Vercel AI SDK (Next.js)
import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";

const agentmink = createOpenAI({
  baseURL: "https://gateway.agentmink.com/v1",
  apiKey: process.env.AGENTMINK_API_KEY,
  headers: {
    "x-mink-strategy": "latency_first"
  }
});

export async function POST(req: Request) {
  const { text } = await generateText({
    model: agentmink("gpt-4o"),
    prompt: "Generate an executive summary of the quarterly financials."
  });

  return Response.json({ text });
}

7. Status Codes & Failover Handling

AgentMink standardizes error responses across all upstream model vendors:

Code Status Meaning & Gateway Action
200 OK Success Request routed and completed successfully. Telemetry recorded to ledger.
401 Unauthorized Auth Failed Missing or invalid Authorization: Bearer gateway token.
402 Payment Required Quota Exceeded Monthly request allowance exhausted or daily spending cap reached.
429 Rate Limit Upstream 429 Upstream provider rate limit hit; gateway triggers automatic failover to healthy secondary provider.
502 Bad Gateway Provider Error All candidate providers returned 5xx errors; check status dashboard.

8. Rate Limits & Spending Caps

Protect your budget with customizable daily spending limits, hard monthly quotas, and real-time Slack webhook incident notifications configured in your workspace settings.

Ready to Start Routing?

Sign up for free and get 500 requests per month with full gateway access.

Create Free Developer Account →