Aqta

API Endpoints

Aqta provides OpenAI-compatible endpoints, so you can point any existing OpenAI integration at our gateway with a single config change.


Base URL

https://api.aqta.ai/v1

Chat completions

POST /v1/chat/completions

Send a chat request to any supported model. Aqta enforces your policies, tracks cost, and returns an aqta metadata object alongside the standard OpenAI response.

Supported providers and models:

  • OpenAI — gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo
  • Anthropic — claude-3-5-sonnet-20241022, claude-3-haiku-20240307
  • Google — gemini-1.5-pro, gemini-2.0-flash
  • Perplexity — sonar, sonar-pro

Request

curl https://api.aqta.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-aqta-your-key-here" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "What is AI governance?"}
    ],
    "temperature": 0.7,
    "max_tokens": 500
  }'

Parameters

ParameterTypeRequiredDescription
modelstringYesModel ID (e.g. gpt-4o, claude-3-5-sonnet-20241022)
messagesarrayYesArray of {role, content} objects
temperaturenumberNoSampling temperature 0–2 (default: 1)
max_tokensintegerNoMaximum tokens to generate
top_pnumberNoNucleus sampling parameter
streambooleanNoStream tokens via SSE (default: false)

Response

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1743465600,
  "model": "gpt-4o",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "AI governance refers to..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 22,
    "completion_tokens": 95,
    "total_tokens": 117
  },
  "aqta": {
    "trace_id": "tr_abc123",
    "cost_eur": 0.00041,
    "provider": "openai",
    "status": "passed"
  }
}

Streaming

Add "stream": true to receive tokens via Server-Sent Events as they are generated.

from openai import OpenAI

client = OpenAI(
    base_url="https://api.aqta.ai/v1",
    api_key="sk-aqta-your-key-here",
)

stream = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Tell me a story"}],
    stream=True,
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Each chunk follows the standard SSE format, terminated with data: [DONE].


Models

GET /v1/models

List all models available to your API key.

curl https://api.aqta.ai/v1/models \
  -H "Authorization: Bearer sk-aqta-your-key-here"
{
  "object": "list",
  "data": [
    {
      "id": "gpt-4o",
      "object": "model",
      "owned_by": "openai",
      "provider": "openai"
    },
    {
      "id": "claude-3-5-sonnet-20241022",
      "object": "model",
      "owned_by": "anthropic",
      "provider": "anthropic"
    },
    {
      "id": "gemini-1.5-pro",
      "object": "model",
      "owned_by": "google",
      "provider": "google"
    }
  ]
}

Model availability depends on your tier. Free tier is limited to cost-effective models; Starter and above have access to all models.


Error responses

All endpoints return consistent error objects:

400 Bad Request

{
  "error": {
    "message": "Invalid request: missing 'model' parameter",
    "type": "invalid_request_error",
    "code": "missing_parameter"
  }
}

401 Unauthorized

{
  "error": {
    "message": "Invalid API key",
    "type": "invalid_request_error",
    "code": "invalid_api_key"
  }
}

429 Too Many Requests

{
  "error": {
    "message": "Rate limit exceeded. Retry after 30 seconds.",
    "type": "rate_limit_error",
    "code": "rate_limit_exceeded",
    "retry_after": 30
  }
}

502 Bad Gateway

Upstream provider returned an error. Retry with exponential backoff — provider outages are typically short-lived.


Rate limits

TierRate limit
Free5 / min
Starter100 / min
Pro1,000 / min
EnterpriseCustom

See Rate Limits for full details including monthly quotas, burst limits, and retry guidance.


Next steps


Questions? hello@aqta.ai