Skip to Content
Gateway API

Gateway API

Accly Gateway is a multi-model AI gateway API for accessing supported AI models through one Accly account. It supports familiar provider-compatible API formats where available, including OpenAI-compatible chat completions, Anthropic-style messages, and Google/Gemini-style generate content endpoints.

The primary quickstart path is the OpenAI-compatible chat completions endpoint. Use Accly API keys to call the gateway from your server, agent, automation, or backend application.

Base URL

Base URL
https://api.accly.net

Endpoint families

FamilyEndpointKey typeStatus
OpenAI-compatible chat completionsPOST /v1/chat/completionsopenai or universalPrimary quickstart endpoint
OpenAI-compatible responsesPOST /v1/responsesopenai or universalUsed by Codex and Responses-compatible clients
Google/Gemini-style generate contentPOST /v1/models/{model}:generateContent and POST /v1beta/models/{model}:generateContentgoogleEndpoint-specific examples are not included on this page
Anthropic-style messagesAnthropic-style endpoint familyanthropicEndpoint-specific examples are not included on this page

Chat completions

Endpoint
POST/v1/chat/completions

Full URL:

URL
POSThttps://api.accly.net/v1/chat/completions

Authentication

Use an Accly API key in the Authorization header:

Authorization header
Authorization: Bearer sk-your-accly-api-key

Free accounts cannot create API keys. Gateway API access starts on paid plans.

Request body

The endpoint accepts a chat-completions style JSON body.

FieldTypeRequiredNotes
modelstringYesAccly model ID available to your plan
messagesarrayYesChat messages with role and content
streambooleanNoSet true for server-sent event streaming
max_tokensnumberNoPassed through and clamped if a plan max is configured
temperaturenumberNoPassed through to the selected model route
top_pnumberNoPassed through to the selected model route
nnumberNoPassed through when supported
stoparrayNoStop sequences

Message content can be a string. Some supported models also accept vision-style content arrays. If a request includes image content for a model that does not support vision, the gateway returns vision_not_supported.

Request example

curl
curl https://api.accly.net/v1/chat/completions \
  -H "Authorization: Bearer sk-your-accly-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-4-7",
    "messages": [
      {
        "role": "user",
        "content": "Write a short API integration checklist."
      }
    ],
    "stream": false
  }'

Streaming

Streaming is supported for chat completions.

Set stream to true:

streaming-request.json
{
  "model": "claude-opus-4-7",
  "messages": [
    {
      "role": "user",
      "content": "Write a short onboarding email."
    }
  ],
  "stream": true
}

The gateway returns OpenAI-compatible server-sent events.

Response body

Successful non-streaming responses use an OpenAI-compatible chat completion shape. Fields can vary by model response, but the response includes choices and may include usage.

response.json
{
  "id": "chatcmpl_example",
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Start with authentication, send a small request, then add error handling and usage monitoring."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 17,
    "total_tokens": 41
  }
}

The gateway also sets request correlation headers such as X-Request-ID and X-Accly-Request-ID.

Responses endpoint

Endpoint
POST/v1/responses

The Responses-compatible endpoint is available for agents and clients that use OpenAI’s Responses API wire format. For Codex, configure the Accly base URL and let Codex append the request path itself.

Use an openai or universal key type for this endpoint. See Codex Setup for the complete Codex setup flow.

Error format

Gateway errors use this shape:

error.json
{
  "error": {
    "message": "Invalid API key.",
    "type": "authentication_error",
    "code": "invalid_api_key"
  },
  "request_id": "req_accly_1779290000000_0123456789abcdef"
}

Use error.code for programmatic handling and keep request_id for support/debug correlation. The same request id is returned in X-Request-ID and X-Accly-Request-ID. See Errors & Limits for common codes.

TypeScript example

index.ts
const response = await fetch('https://api.accly.net/v1/chat/completions', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.ACCLY_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    model: 'claude-opus-4-7',
    messages: [
      {
        role: 'user',
        content: 'Write a short API integration checklist.',
      },
    ],
    stream: false,
  }),
})
 
if (!response.ok) {
  const error = await response.json()
  throw new Error(error.error?.message ?? 'Accly request failed')
}
 
const data = await response.json()
console.log(data.choices?.[0]?.message?.content)

Python example

main.py
import os
import requests
 
response = requests.post(
    "https://api.accly.net/v1/chat/completions",
    headers={
        "Authorization": f"Bearer {os.environ['ACCLY_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "model": "claude-opus-4-7",
        "messages": [
            {
                "role": "user",
                "content": "Write a short API integration checklist.",
            }
        ],
        "stream": False,
    },
    timeout=120,
)
 
if not response.ok:
    error = response.json()
    raise RuntimeError(error.get("error", {}).get("message", "Accly request failed"))
 
data = response.json()
print(data["choices"][0]["message"]["content"])