{
  "openapi": "3.1.0",
  "info": {
    "title": "Asterionyx Customer API",
    "summary": "Customer-facing OpenAI-compatible API surface for Asterionyx accounts.",
    "description": "Use this OpenAPI document only for the public Asterionyx customer API. Discover current public model IDs through the live catalog before making a request.",
    "version": "2026-07-20"
  },
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "servers": [
    {
      "url": "https://api.a.eus/v1",
      "description": "Production customer API"
    },
    {
      "url": "https://api.staging.asterionyx.com/v1",
      "description": "Private staging customer API; HTTP basic-auth guarded"
    }
  ],
  "security": [
    {
      "AsterionyxApiKey": []
    }
  ],
  "tags": [
    {
      "name": "Models",
      "description": "Asterionyx model alias discovery"
    },
    {
      "name": "Chat Completions",
      "description": "OpenAI-compatible chat completion requests using Asterionyx model aliases"
    }
  ],
  "paths": {
    "/models": {
      "get": {
        "operationId": "listAsterionyxModels",
        "tags": ["Models"],
        "summary": "List Asterionyx model aliases",
        "description": "Returns the customer-visible Asterionyx model aliases. Internal providers, raw model identifiers, and routing details are never exposed.",
        "responses": {
          "200": {
            "description": "Model aliases available on the Asterionyx customer API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListModelsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "tags": ["Chat Completions"],
        "summary": "Create a chat completion",
        "description": "Creates an OpenAI-compatible chat completion using a currently callable Asterionyx public model ID. Keep the completion id for support; when no usable completion id is available, use the X-Asterionyx-Request-ID response header.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chat completion response with the requested Asterionyx model alias echoed in the model field.",
            "headers": {
              "X-Asterionyx-Request-ID": {
                "description": "Customer-safe request reference for support; an opaque axreq_ value is used when no completion ID is available.",
                "schema": { "type": "string", "maxLength": 128 }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "410": {
            "$ref": "#/components/responses/ModelRetired"
          },
          "503": {
            "$ref": "#/components/responses/TemporarilyUnavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "AsterionyxApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Asterionyx API key",
        "description": "Customer-owned Asterionyx API key from the customer portal. Send as Authorization: Bearer <Asterionyx API key>."
      }
    },
    "schemas": {
      "AsterionyxModelAlias": {
        "type": "string",
        "pattern": "^asterionyx-[a-z0-9]+(?:-[a-z0-9]+)*$",
        "minLength": 12,
        "maxLength": 128,
        "description": "A published Asterionyx public model ID. This schema is not an availability list; discover current IDs from https://api.a.eus/api/v1/public/models.",
        "examples": ["asterionyx-model-id"]
      },
      "ListModelsResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": ["object", "data"],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model"
            }
          }
        }
      },
      "Model": {
        "type": "object",
        "additionalProperties": true,
        "required": ["id", "object"],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/AsterionyxModelAlias"
          },
          "object": {
            "type": "string",
            "const": "model"
          },
          "owned_by": {
            "type": "string",
            "const": "asterionyx"
          }
        }
      },
      "ChatCompletionRequest": {
        "type": "object",
        "additionalProperties": true,
        "required": ["model", "messages"],
        "properties": {
          "model": {
            "$ref": "#/components/schemas/AsterionyxModelAlias"
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/ChatMessage"
            }
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "ChatMessage": {
        "type": "object",
        "additionalProperties": true,
        "required": ["role", "content"],
        "properties": {
          "role": {
            "type": "string",
            "enum": ["system", "user", "assistant", "tool"]
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            ]
          }
        }
      },
      "ChatCompletionResponse": {
        "type": "object",
        "additionalProperties": true,
        "required": ["id", "object", "created", "model", "choices"],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "$ref": "#/components/schemas/AsterionyxModelAlias"
          },
          "choices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatCompletionChoice"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "ChatCompletionChoice": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "index": {
            "type": "integer"
          },
          "message": {
            "$ref": "#/components/schemas/ChatMessage"
          },
          "finish_reason": {
            "type": ["string", "null"]
          }
        }
      },
      "Usage": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid request body or unsupported model alias.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid Asterionyx API key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "InsufficientCredits": {
        "description": "The customer account does not have enough prepaid Points for the request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "ModelRetired": {
        "description": "The requested public model ID is retired and no longer callable.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "TemporarilyUnavailable": {
        "description": "The Asterionyx customer API is temporarily unable to serve the request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    }
  },
  "externalDocs": {
    "description": "Asterionyx public API documentation",
    "url": "https://asterionyx.com/docs"
  },
  "x-asterionyx-boundary": {
    "customer_visible_only": true,
    "models_url": "https://api.a.eus/api/v1/public/models",
    "do_not_expose": [
      "internal routing",
      "internal model identifiers",
      "provider names",
      "hidden gateway implementation details"
    ]
  }
}
