Skip to Content
Gateway API

Gateway API

Accly Gateway routes requests to supported provider models through one Accly account. Each model exposes only the protocol and capabilities listed in the Model Hub; a familiar endpoint shape does not make every provider model interchangeable.

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

FamilyEndpointAccessStatus
OpenAI-compatible chat completionsPOST /v1/chat/completionsOne Accly API keyPrimary quickstart endpoint
OpenAI-compatible responsesPOST /v1/responsesOne Accly API keyUsed by Codex and Responses-compatible clients
Anthropic MessagesPOST /v1/messagesOne Accly API keyNative Anthropic request and response shape
Google Gemini generationPOST /v1/models/{model}:generateContent or /v1beta/models/{model}:generateContentOne Accly API keyNative Gemini request and response shape
OpenAI-compatible embeddingsPOST /v1/embeddingsOne Accly API keyEmbedding models with this protocol enabled
Google native embeddingsPOST /v1beta/models/{model}:embedContentOne Accly API keyEmbedding models with google_embed_content enabled
RerankingPOST /v1/rerankOne Accly API keyRerank models only; maximum 1,000 documents
Audio & speechChat Completions, Gemini generateContent, or MiniMax T2A routesOne Accly API keyContracts differ by provider; see Audio & Speech

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 the same Accly API key for this endpoint. See Codex Setup for the complete Codex setup flow.

Anthropic Messages

POST /v1/messages preserves the Anthropic Messages request shape. Include the required anthropic-version header. The Messages handler also exposes POST /v1/messages/count_tokens for a local input-token estimate.

Anthropic Messages
curl https://api.accly.net/v1/messages \
  -H "x-api-key: $ACCLY_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-opus-4-7",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "Explain API key rotation."}]
  }'

The response uses the Anthropic Messages envelope. Streaming, tools, and provider-specific features depend on the selected model and route.

Google Gemini generation

Native Gemini requests place the model ID in the URL and use Google’s contents shape. The same Accly key works through the x-goog-api-key header.

Gemini generateContent
MODEL_ID="your-model-id-from-the-model-hub"
curl "https://api.accly.net/v1beta/models/${MODEL_ID}:generateContent" \
  -H "x-goog-api-key: $ACCLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"parts": [{"text": "Explain API key rotation."}]}]
  }'

Use a model that supports native Gemini generation. Google audio generation, embedding, and streaming each have additional model-specific request requirements; see Audio & Speech and Embeddings & Reranking.

Specialized endpoint guides

  • Audio & Speech documents GPT Audio, Google TTS, and MiniMax T2A request contracts.
  • Embeddings & Reranking documents OpenAI-compatible embeddings, native Google embedContent, and /v1/rerank.
  • Models explains model discovery, capability metadata, and provider-owned behavior.

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"])