Create a chat completion
Send an OpenAI Chat Completions request through Atlaso, with memory added.
curl --request POST \
--url https://api.atlaso.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai/gpt-5.4-mini",
"messages": [
{
"role": "user",
"content": "What do I like to drink?"
}
]
}
'import requests
url = "https://api.atlaso.ai/v1/chat/completions"
payload = {
"model": "openai/gpt-5.4-mini",
"messages": [
{
"role": "user",
"content": "What do I like to drink?"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'openai/gpt-5.4-mini',
messages: [{role: 'user', content: 'What do I like to drink?'}]
})
};
fetch('https://api.atlaso.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.atlaso.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"openai/gpt-5.4-mini\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What do I like to drink?\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.atlaso.ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"openai/gpt-5.4-mini\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What do I like to drink?\"\n }\n ]\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.atlaso.ai/v1/chat/completions");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"openai/gpt-5.4-mini\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What do I like to drink?\"\n }\n ]\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1763366400,
"model": "gpt-5.4-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "You like oat-milk lattes."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 120,
"completion_tokens": 8,
"total_tokens": 128
}
}{
"error": {
"message": "Parameter 'logit_bias' is not supported by this Anthropic model. Remove 'logit_bias' and retry.",
"type": "invalid_request_error",
"param": null,
"code": "unsupported_parameter",
"doc_url": "https://docs.atlaso.ai/gateway/errors#unsupported_parameter"
}
}{
"error": {
"message": "Your Atlaso API key is missing, invalid or revoked. Set Authorization: Bearer to an active key from the API keys page.",
"type": "authentication_error",
"param": null,
"code": "invalid_api_key",
"doc_url": "https://docs.atlaso.ai/gateway/errors#invalid_api_key"
}
}{
"error": {
"message": "OpenAI refused the call for a billing reason on your saved key. Check your OpenAI plan and credit.",
"type": "billing_error",
"param": null,
"code": "provider_billing_error",
"doc_url": "https://docs.atlaso.ai/gateway/errors#provider_billing_error"
}
}{
"error": {
"message": "The Atlaso API is not enabled for this account yet. No model call was made.",
"type": "permission_error",
"param": null,
"code": "gateway_not_enabled",
"doc_url": "https://docs.atlaso.ai/gateway/errors#gateway_not_enabled"
}
}{
"error": {
"message": "This model is not available through Atlaso. Choose an exact id from GET /v1/models.",
"type": "invalid_request_error",
"param": null,
"code": "model_not_available",
"doc_url": "https://docs.atlaso.ai/gateway/errors#model_not_available"
}
}{
"error": {
"message": "Method not allowed.",
"type": "invalid_request_error",
"param": null,
"code": "method_not_allowed",
"doc_url": "https://docs.atlaso.ai/gateway/errors#method_not_allowed"
}
}{
"error": {
"message": "Microsoft retired this model, so Microsoft Foundry no longer answers calls to it. Choose a newer model. Microsoft's model retirement schedule names its replacement.",
"type": "invalid_request_error",
"param": null,
"code": "azure_model_retired",
"doc_url": "https://docs.atlaso.ai/gateway/errors#azure_model_retired"
}
}{
"error": {
"message": "The request body is too large. Send at most 32 MiB, or shorten the messages.",
"type": "invalid_request_error",
"param": null,
"code": "request_too_large",
"doc_url": "https://docs.atlaso.ai/gateway/errors#request_too_large"
}
}{
"error": {
"message": "Too many requests on this Atlaso key. Retry after the indicated delay; no model call was made.",
"type": "rate_limit_error",
"param": null,
"code": "rate_limited",
"doc_url": "https://docs.atlaso.ai/gateway/errors#rate_limited"
}
}{
"error": {
"message": "Atlaso hit an internal error. Retry; if it repeats, contact support with the x-request-id.",
"type": "api_error",
"param": null,
"code": "internal_error",
"doc_url": "https://docs.atlaso.ai/gateway/errors#internal_error"
}
}{
"error": {
"message": "OpenAI is unavailable or returned a server error. The request may have reached OpenAI; check your OpenAI usage before retrying. Atlaso did not retry or switch providers.",
"type": "api_error",
"param": null,
"code": "provider_unavailable",
"doc_url": "https://docs.atlaso.ai/gateway/errors#provider_unavailable"
}
}{
"error": {
"message": "Atlaso could not check your API key right now. Retry shortly; no model call was made.",
"type": "api_error",
"param": null,
"code": "auth_unavailable",
"doc_url": "https://docs.atlaso.ai/gateway/errors#auth_unavailable"
}
}{
"error": {
"message": "OpenAI did not answer in time. The request may have reached OpenAI; check your OpenAI usage before retrying. Atlaso did not retry or switch providers.",
"type": "api_error",
"param": null,
"code": "provider_timeout",
"doc_url": "https://docs.atlaso.ai/gateway/errors#provider_timeout"
}
}Authorizations
Headers
Lowers memory for this one call. off: no recall and no learning, and the reply's x-atlaso-memory header says status=off with reason=request_off. use: recall as usual, but nothing from this call is learned. Letter case and spaces around the value are ignored; any other value is ignored too. It never turns memory or learning on for a key whose settings are lower.
off, use Your own id for a group of related calls (a chat session). Only printable ASCII is kept: other characters are removed and a longer value is cut to 128 characters. Ignored when the call comes from Claude Code or Codex through the Gateway (coming soon), which will send their own.
Your own labels for this call, as comma-separated key=value pairs. At most 10 tags per call (header and body together). A key is lowercase letters, digits, _ and -, at most 32 characters. A value is printable ASCII, 1 to 64 characters. A tag that breaks a rule is dropped and named in x-atlaso-tags-dropped; the call still goes ahead. A header over 2048 characters is not read at all: none of its tags is used, and x-atlaso-tags-dropped names it as x-atlaso-tags too_long. See Tags.
Body
The OpenAI Chat Completions request. Fields not listed here are passed to the provider, which may refuse them. At most 32 MiB.
Never fails a call. OpenAI and OpenAI-compatible hosts get it as sent. Where Atlaso knows the provider does not take it, it is left out of the provider request and named in x-atlaso-ignored-params. On a key that keeps your own memory, Atlaso also reads it to label cost by app user (x-atlaso-user first, then safety_identifier, then user). On a key with memory for each user of your app, a value that differs from x-atlaso-user is refused with 400 user_id_conflict. On Google models the value is sent as a label, which allows at most 63 characters of lowercase letters, digits, _ or -. A value those rules do not allow is left out and named in x-atlaso-ignored-params; it is never rewritten. When user and safety_identifier are both sent with different values, safety_identifier is the label (or user, when only its value is allowed) and the other is left out and named.
Never fails a call. OpenAI and OpenAI-compatible hosts get it as sent. Where Atlaso knows the provider does not take it, it is left out of the provider request and named in x-atlaso-ignored-params. On a key that keeps your own memory, Atlaso also reads it to label cost by app user (x-atlaso-user first, then safety_identifier, then user). On a key with memory for each user of your app, a value that differs from x-atlaso-user is refused with 400 user_id_conflict. On Google models the value is sent as a label, which allows at most 63 characters of lowercase letters, digits, _ or -. A value those rules do not allow is left out and named in x-atlaso-ignored-params; it is never rewritten. When user and safety_identifier are both sent with different values, safety_identifier is the label (or user, when only its value is allowed) and the other is left out and named.
Response
The provider's answer in the OpenAI Chat Completions shape. Replies from OpenAI models are passed on as OpenAI sent them. Replies from providers with a different shape (for example Anthropic, Google and Amazon Bedrock) are translated into it. When a Claude model (on Anthropic or Amazon Bedrock) spends all of max_tokens on thinking and writes no text, the reply also carries atlaso with reason (thinking_limit_no_text) and notice.
The provider's reply in the OpenAI shape: unchanged for OpenAI models, translated for providers with a different shape.
curl --request POST \
--url https://api.atlaso.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai/gpt-5.4-mini",
"messages": [
{
"role": "user",
"content": "What do I like to drink?"
}
]
}
'import requests
url = "https://api.atlaso.ai/v1/chat/completions"
payload = {
"model": "openai/gpt-5.4-mini",
"messages": [
{
"role": "user",
"content": "What do I like to drink?"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'openai/gpt-5.4-mini',
messages: [{role: 'user', content: 'What do I like to drink?'}]
})
};
fetch('https://api.atlaso.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.atlaso.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"openai/gpt-5.4-mini\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What do I like to drink?\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.atlaso.ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"openai/gpt-5.4-mini\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What do I like to drink?\"\n }\n ]\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.atlaso.ai/v1/chat/completions");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"openai/gpt-5.4-mini\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What do I like to drink?\"\n }\n ]\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1763366400,
"model": "gpt-5.4-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "You like oat-milk lattes."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 120,
"completion_tokens": 8,
"total_tokens": 128
}
}{
"error": {
"message": "Parameter 'logit_bias' is not supported by this Anthropic model. Remove 'logit_bias' and retry.",
"type": "invalid_request_error",
"param": null,
"code": "unsupported_parameter",
"doc_url": "https://docs.atlaso.ai/gateway/errors#unsupported_parameter"
}
}{
"error": {
"message": "Your Atlaso API key is missing, invalid or revoked. Set Authorization: Bearer to an active key from the API keys page.",
"type": "authentication_error",
"param": null,
"code": "invalid_api_key",
"doc_url": "https://docs.atlaso.ai/gateway/errors#invalid_api_key"
}
}{
"error": {
"message": "OpenAI refused the call for a billing reason on your saved key. Check your OpenAI plan and credit.",
"type": "billing_error",
"param": null,
"code": "provider_billing_error",
"doc_url": "https://docs.atlaso.ai/gateway/errors#provider_billing_error"
}
}{
"error": {
"message": "The Atlaso API is not enabled for this account yet. No model call was made.",
"type": "permission_error",
"param": null,
"code": "gateway_not_enabled",
"doc_url": "https://docs.atlaso.ai/gateway/errors#gateway_not_enabled"
}
}{
"error": {
"message": "This model is not available through Atlaso. Choose an exact id from GET /v1/models.",
"type": "invalid_request_error",
"param": null,
"code": "model_not_available",
"doc_url": "https://docs.atlaso.ai/gateway/errors#model_not_available"
}
}{
"error": {
"message": "Method not allowed.",
"type": "invalid_request_error",
"param": null,
"code": "method_not_allowed",
"doc_url": "https://docs.atlaso.ai/gateway/errors#method_not_allowed"
}
}{
"error": {
"message": "Microsoft retired this model, so Microsoft Foundry no longer answers calls to it. Choose a newer model. Microsoft's model retirement schedule names its replacement.",
"type": "invalid_request_error",
"param": null,
"code": "azure_model_retired",
"doc_url": "https://docs.atlaso.ai/gateway/errors#azure_model_retired"
}
}{
"error": {
"message": "The request body is too large. Send at most 32 MiB, or shorten the messages.",
"type": "invalid_request_error",
"param": null,
"code": "request_too_large",
"doc_url": "https://docs.atlaso.ai/gateway/errors#request_too_large"
}
}{
"error": {
"message": "Too many requests on this Atlaso key. Retry after the indicated delay; no model call was made.",
"type": "rate_limit_error",
"param": null,
"code": "rate_limited",
"doc_url": "https://docs.atlaso.ai/gateway/errors#rate_limited"
}
}{
"error": {
"message": "Atlaso hit an internal error. Retry; if it repeats, contact support with the x-request-id.",
"type": "api_error",
"param": null,
"code": "internal_error",
"doc_url": "https://docs.atlaso.ai/gateway/errors#internal_error"
}
}{
"error": {
"message": "OpenAI is unavailable or returned a server error. The request may have reached OpenAI; check your OpenAI usage before retrying. Atlaso did not retry or switch providers.",
"type": "api_error",
"param": null,
"code": "provider_unavailable",
"doc_url": "https://docs.atlaso.ai/gateway/errors#provider_unavailable"
}
}{
"error": {
"message": "Atlaso could not check your API key right now. Retry shortly; no model call was made.",
"type": "api_error",
"param": null,
"code": "auth_unavailable",
"doc_url": "https://docs.atlaso.ai/gateway/errors#auth_unavailable"
}
}{
"error": {
"message": "OpenAI did not answer in time. The request may have reached OpenAI; check your OpenAI usage before retrying. Atlaso did not retry or switch providers.",
"type": "api_error",
"param": null,
"code": "provider_timeout",
"doc_url": "https://docs.atlaso.ai/gateway/errors#provider_timeout"
}
}