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
https://api.accly.netEndpoint families
| Family | Endpoint | Access | Status |
|---|---|---|---|
| OpenAI-compatible chat completions | POST /v1/chat/completions | One Accly API key | Primary quickstart endpoint |
| OpenAI-compatible responses | POST /v1/responses | One Accly API key | Used by Codex and Responses-compatible clients |
| Anthropic Messages | POST /v1/messages | One Accly API key | Native Anthropic request and response shape |
| Google Gemini generation | POST /v1/models/{model}:generateContent or /v1beta/models/{model}:generateContent | One Accly API key | Native Gemini request and response shape |
| OpenAI-compatible embeddings | POST /v1/embeddings | One Accly API key | Embedding models with this protocol enabled |
| Google native embeddings | POST /v1beta/models/{model}:embedContent | One Accly API key | Embedding models with google_embed_content enabled |
| Reranking | POST /v1/rerank | One Accly API key | Rerank models only; maximum 1,000 documents |
| Audio & speech | Chat Completions, Gemini generateContent, or MiniMax T2A routes | One Accly API key | Contracts differ by provider; see Audio & Speech |
Chat completions
/v1/chat/completionsFull URL:
https://api.accly.net/v1/chat/completionsAuthentication
Use an Accly API key in the Authorization header:
Authorization: Bearer sk-your-accly-api-keyFree accounts cannot create API keys. Gateway API access starts on paid plans.
Request body
The endpoint accepts a chat-completions style JSON body.
| Field | Type | Required | Notes |
|---|---|---|---|
model | string | Yes | Accly model ID available to your plan |
messages | array | Yes | Chat messages with role and content |
stream | boolean | No | Set true for server-sent event streaming |
max_tokens | number | No | Passed through and clamped if a plan max is configured |
temperature | number | No | Passed through to the selected model route |
top_p | number | No | Passed through to the selected model route |
n | number | No | Passed through when supported |
stop | array | No | Stop 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 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:
{
"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.
{
"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
/v1/responsesThe 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.
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.
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": {
"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
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
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"])