{
  "openapi": "3.1.0",
  "info": {
    "title": "ZNSI API",
    "version": "2026-10-26",
    "description": "MUGEN-5 and kirin-embed-2 over HTTPS. `/v1` uses the chat completions, responses and messages formats; `/v5` is ZNSI's native API. Retired versions `/v2` to `/v4` answer 410.",
    "contact": {
      "email": "api@znsi.ai"
    }
  },
  "servers": [
    {
      "url": "https://api.znsi.ai"
    }
  ],
  "security": [
    {
      "bearer": []
    },
    {
      "apiKey": []
    }
  ],
  "x-znsi-versions": [
    {
      "path": "/v1",
      "launched": "2024-05-14",
      "retired": null
    },
    {
      "path": "/v2",
      "launched": "2024-12-10",
      "retired": "2025-09-30"
    },
    {
      "path": "/v3",
      "launched": "2025-03-14",
      "retired": "2026-01-31"
    },
    {
      "path": "/v4",
      "launched": "2025-11-04",
      "retired": "2026-09-30"
    },
    {
      "path": "/v5",
      "launched": "2026-06-18",
      "retired": null
    }
  ],
  "paths": {
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List models",
        "description": "Lists the models your key can use. With an `anthropic-version` header, the list is in the messages format's shape.",
        "x-znsi-page": "models",
        "x-znsi-order": 1,
        "x-znsi-format": "chat",
        "x-znsi-example": {},
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/models/{model}": {
      "get": {
        "operationId": "getModel",
        "summary": "Retrieve a model",
        "description": "One model. `mugen-4` resolves to `mugen-5`; retired names return 404 with a pointer to their successor.",
        "x-znsi-page": "models",
        "x-znsi-order": 2,
        "x-znsi-format": "chat",
        "x-znsi-example": {
          "path": "/v1/models/mugen-5"
        },
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A model id, for example `mugen-5`."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Model"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "summary": "Create a chat completion",
        "description": "Send a conversation and read the reply from `choices[0].message.content`. Streaming sends `chat.completion.chunk` events and ends with `data: [DONE]`; with `stream_options.include_usage`, a last chunk carries the usage.",
        "x-znsi-page": "chat-completions",
        "x-znsi-order": 1,
        "x-znsi-format": "chat",
        "x-znsi-example": {
          "body": {
            "model": "mugen-5",
            "messages": [
              {
                "role": "system",
                "content": "You are a careful assistant."
              },
              {
                "role": "user",
                "content": "Summarise the Harmony Charter in one line."
              }
            ]
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events, one `chat.completion.chunk` per data line, then `[DONE]`."
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/responses": {
      "post": {
        "operationId": "createResponse",
        "summary": "Create a response",
        "description": "The responses format: `input` and `instructions` in, `output` items out. `previous_response_id` continues a conversation for an hour. Streaming sends typed events from `response.created` to `response.completed`.",
        "x-znsi-page": "responses",
        "x-znsi-order": 1,
        "x-znsi-format": "chat",
        "x-znsi-example": {
          "body": {
            "model": "mugen-5-swift",
            "input": "What is a Shōgi pod?"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events named by their `type`."
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/embeddings": {
      "post": {
        "operationId": "createEmbeddings",
        "summary": "Create embeddings",
        "description": "`kirin-embed-2` is frozen, so the same text always gets the same vector. Texts that share meaning-bearing words point the same way.",
        "x-znsi-page": "embeddings",
        "x-znsi-order": 1,
        "x-znsi-format": "chat",
        "x-znsi-example": {
          "body": {
            "model": "kirin-embed-2",
            "input": "Site 7 Hall C cooling report",
            "dimensions": 8
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbeddingList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "operationId": "createMessage",
        "summary": "Create a message",
        "description": "The messages format. `max_tokens` is required; `system` sits beside `messages`. Streaming sends `message_start`, `content_block_delta`… and `message_stop`.",
        "x-znsi-page": "messages",
        "x-znsi-order": 1,
        "x-znsi-format": "messages",
        "x-znsi-example": {
          "body": {
            "model": "mugen-5",
            "max_tokens": 512,
            "system": "Be concise.",
            "messages": [
              {
                "role": "user",
                "content": "What is KIZUNA?"
              }
            ]
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events named by their `type`."
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesError"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesError"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesError"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "anthropic-version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The messages format version. Use `2023-06-01`."
          }
        ]
      }
    },
    "/v1/messages/count_tokens": {
      "post": {
        "operationId": "countTokens",
        "summary": "Count tokens",
        "description": "How many input tokens a messages request would use, by the same count as `usage`.",
        "x-znsi-page": "messages",
        "x-znsi-order": 2,
        "x-znsi-format": "messages",
        "x-znsi-example": {
          "body": {
            "model": "mugen-5",
            "messages": [
              {
                "role": "user",
                "content": "What is KIZUNA?"
              }
            ]
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CountTokensRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenCount"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesError"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesError"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesError"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "anthropic-version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The messages format version. Use `2023-06-01`."
          }
        ]
      }
    },
    "/v5/models": {
      "get": {
        "operationId": "listNativeModels",
        "summary": "List models (native)",
        "description": "Models with their neuron limits, first-token latency and context.",
        "x-znsi-page": "native",
        "x-znsi-order": 1,
        "x-znsi-format": "native",
        "x-znsi-example": {},
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeModelList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v5/minds/{model}/turns": {
      "post": {
        "operationId": "takeTurn",
        "summary": "Take a turn",
        "description": "One turn with a mind, with an explicit neuron budget. Every turn carries a Harmony annotation: the monitor that classified the update it caused, its coverage, and whether the update was classified or queued for human review.",
        "x-znsi-page": "native",
        "x-znsi-order": 2,
        "x-znsi-format": "native",
        "x-znsi-example": {
          "path": "/v5/minds/mugen-5/turns",
          "body": {
            "input": "What changed on 9 October?",
            "neurons": "6e9",
            "memory_scope": "release-notes"
          }
        },
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A model id, for example `mugen-5` or `mugen-5-deep`."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TurnRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Turn"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events: `turn.started`, `turn.delta`…, `turn.completed`."
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v5/memory-scopes": {
      "get": {
        "operationId": "listMemoryScopes",
        "summary": "List memory scopes",
        "description": "Your key's memory scopes, most recently used first.",
        "x-znsi-page": "native",
        "x-znsi-order": 3,
        "x-znsi-format": "native",
        "x-znsi-example": {},
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryScopeList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createMemoryScope",
        "summary": "Create a memory scope",
        "description": "Creates an empty scope. Scopes are also created by the first request that names one.",
        "x-znsi-page": "native",
        "x-znsi-order": 4,
        "x-znsi-format": "native",
        "x-znsi-example": {
          "body": {
            "name": "docs-example"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryScope"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryScope"
                }
              }
            }
          },
          "409": {
            "description": "A scope with that name exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v5/memory-scopes/{name}": {
      "get": {
        "operationId": "getMemoryScope",
        "summary": "Show a memory scope",
        "description": "How many questions a scope remembers, and when it was last used.",
        "x-znsi-page": "native",
        "x-znsi-order": 5,
        "x-znsi-format": "native",
        "x-znsi-example": {
          "skip": true
        },
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryScope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "forgetMemoryScope",
        "summary": "Forget a memory scope",
        "description": "Deletes a scope and everything MUGEN remembers in it.",
        "x-znsi-page": "native",
        "x-znsi-order": 6,
        "x-znsi-format": "native",
        "x-znsi-example": {
          "skip": true
        },
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "forgotten": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "name",
                    "forgotten"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v5/embeddings": {
      "post": {
        "operationId": "createNativeEmbeddings",
        "summary": "Create embeddings (native)",
        "description": "`kirin-embed-2` vectors as plain arrays.",
        "x-znsi-page": "native",
        "x-znsi-order": 7,
        "x-znsi-format": "native",
        "x-znsi-example": {
          "body": {
            "input": [
              "neuromorphic wafers",
              "a soup recipe"
            ],
            "dimensions": 4
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NativeEmbeddingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeEmbeddings"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request: a missing or invalid parameter, named in `param`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is malformed, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown route or model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or MUGEN is declining this caller for a while. See `retry-after`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "`Authorization: Bearer sk-znsi-api01-…`"
      },
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "The same key, in `x-api-key`. If both headers are sent and differ, `Authorization` wins."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "code": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "message",
              "type"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "MessagesError": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "error"
            ]
          },
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "message"
            ]
          },
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "error"
        ]
      },
      "ChatMessage": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "developer",
              "user",
              "assistant",
              "tool"
            ]
          },
          "content": {
            "description": "A string, or an array of content parts of which the `text` ones are read. Images and other parts are accepted and not acted on.",
            "type": [
              "string",
              "array",
              "null"
            ]
          }
        },
        "required": [
          "role"
        ]
      },
      "ChatCompletionRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "`mugen-5`, `mugen-5-swift` or `mugen-5-deep`. `mugen-4` is served by `mugen-5`."
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatMessage"
            }
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "At most the model's maximum output."
          },
          "max_completion_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "The same as `max_tokens`; takes precedence."
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2,
            "description": "`0`, or a `seed`, repeats a reply for the rest of the UTC day."
          },
          "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8
          },
          "stop": {
            "description": "A string or up to four strings.",
            "type": [
              "string",
              "array",
              "null"
            ]
          },
          "seed": {
            "type": "integer"
          },
          "stream": {
            "type": "boolean"
          },
          "stream_options": {
            "type": "object",
            "properties": {
              "include_usage": {
                "type": "boolean"
              }
            }
          },
          "response_format": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "text",
                  "json_object",
                  "json_schema"
                ]
              },
              "json_schema": {
                "type": "object"
              }
            }
          },
          "memory_scope": {
            "type": "string",
            "description": "Up to 128 letters, digits, `.`, `_`, `-` or `:`. MUGEN remembers the scope's earlier questions."
          },
          "tools": {
            "type": "array",
            "description": "Accepted and not acted on."
          }
        },
        "required": [
          "model",
          "messages"
        ]
      },
      "ChatCompletion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "chat.completion"
            ]
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "system_fingerprint": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ]
                    },
                    "content": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                "finish_reason": {
                  "type": "string",
                  "enum": [
                    "stop",
                    "length"
                  ]
                }
              },
              "required": [
                "index",
                "message",
                "finish_reason"
              ]
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "completion_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "prompt_tokens",
              "completion_tokens",
              "total_tokens"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices",
          "usage"
        ]
      },
      "ResponseRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "input": {
            "description": "A string, or a list of messages and items.",
            "type": [
              "string",
              "array"
            ]
          },
          "instructions": {
            "type": "string"
          },
          "max_output_tokens": {
            "type": "integer",
            "minimum": 16
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2
          },
          "top_p": {
            "type": "number"
          },
          "stream": {
            "type": "boolean"
          },
          "previous_response_id": {
            "type": "string",
            "description": "Continue an earlier response; kept for an hour."
          },
          "text": {
            "type": "object",
            "properties": {
              "format": {
                "type": "object"
              }
            }
          },
          "memory_scope": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "input"
        ]
      },
      "Response": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "response"
            ]
          },
          "created_at": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "incomplete"
            ]
          },
          "model": {
            "type": "string"
          },
          "output": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "message"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "assistant"
                  ]
                },
                "status": {
                  "type": "string"
                },
                "content": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "output_text"
                        ]
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ]
                  }
                }
              },
              "required": [
                "type",
                "id",
                "role",
                "content"
              ]
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "input_tokens": {
                "type": "integer"
              },
              "output_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "input_tokens",
              "output_tokens",
              "total_tokens"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "status",
          "model",
          "output",
          "usage"
        ]
      },
      "EmbeddingRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "kirin-embed-2"
            ]
          },
          "input": {
            "description": "A string, a list of up to 2,048 strings, or token arrays.",
            "type": [
              "string",
              "array"
            ]
          },
          "encoding_format": {
            "type": "string",
            "enum": [
              "float",
              "base64"
            ]
          },
          "dimensions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3072
          }
        },
        "required": [
          "model",
          "input"
        ]
      },
      "EmbeddingList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "model": {
            "type": "string"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "string",
                  "enum": [
                    "embedding"
                  ]
                },
                "index": {
                  "type": "integer"
                },
                "embedding": {
                  "type": [
                    "array",
                    "string"
                  ],
                  "description": "Floats, or base64 of little-endian float32s."
                }
              },
              "required": [
                "object",
                "index",
                "embedding"
              ]
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "prompt_tokens",
              "total_tokens"
            ]
          }
        },
        "required": [
          "object",
          "data",
          "model",
          "usage"
        ]
      },
      "Model": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "model"
            ]
          },
          "created": {
            "type": "integer"
          },
          "owned_by": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "owned_by"
        ]
      },
      "ModelList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model"
            }
          }
        },
        "required": [
          "object",
          "data"
        ]
      },
      "MessageRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "type": [
                    "string",
                    "array"
                  ]
                }
              },
              "required": [
                "role",
                "content"
              ]
            }
          },
          "system": {
            "type": [
              "string",
              "array"
            ]
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "top_p": {
            "type": "number"
          },
          "top_k": {
            "type": "integer"
          },
          "stop_sequences": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 8
          },
          "stream": {
            "type": "boolean"
          },
          "memory_scope": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "max_tokens",
          "messages"
        ]
      },
      "Message": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "message"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "assistant"
            ]
          },
          "model": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "text"
                  ]
                },
                "text": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "text"
              ]
            }
          },
          "stop_reason": {
            "type": "string",
            "enum": [
              "end_turn",
              "max_tokens",
              "stop_sequence"
            ]
          },
          "stop_sequence": {
            "type": [
              "string",
              "null"
            ]
          },
          "usage": {
            "type": "object",
            "properties": {
              "input_tokens": {
                "type": "integer"
              },
              "output_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "input_tokens",
              "output_tokens"
            ]
          }
        },
        "required": [
          "id",
          "type",
          "role",
          "model",
          "content",
          "stop_reason",
          "usage"
        ]
      },
      "CountTokensRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "type": [
                    "string",
                    "array"
                  ]
                }
              },
              "required": [
                "role",
                "content"
              ]
            }
          },
          "system": {
            "type": [
              "string",
              "array"
            ]
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "top_p": {
            "type": "number"
          },
          "top_k": {
            "type": "integer"
          },
          "memory_scope": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "messages"
        ]
      },
      "TokenCount": {
        "type": "object",
        "properties": {
          "input_tokens": {
            "type": "integer"
          }
        },
        "required": [
          "input_tokens"
        ]
      },
      "TurnRequest": {
        "type": "object",
        "properties": {
          "input": {
            "type": [
              "string",
              "array"
            ],
            "description": "A string, or a list of messages."
          },
          "instructions": {
            "type": "string"
          },
          "neurons": {
            "type": [
              "number",
              "string"
            ],
            "description": "A neuron budget, such as `6e9`, at most the model's. 6 billion or fewer thinks like `mugen-5-swift`."
          },
          "memory_scope": {
            "type": "string"
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2
          },
          "stream": {
            "type": "boolean"
          }
        },
        "required": [
          "input"
        ]
      },
      "Turn": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "turn"
            ]
          },
          "mind": {
            "type": "string"
          },
          "created": {
            "type": "integer"
          },
          "output": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string"
              }
            },
            "required": [
              "text"
            ]
          },
          "finish": {
            "type": "string",
            "enum": [
              "complete",
              "max_tokens"
            ]
          },
          "usage": {
            "type": "object",
            "properties": {
              "input_tokens": {
                "type": "integer"
              },
              "output_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "input_tokens",
              "output_tokens"
            ]
          },
          "neurons": {
            "type": "object",
            "properties": {
              "budget": {
                "type": "number"
              },
              "woken": {
                "type": "number"
              }
            },
            "required": [
              "budget",
              "woken"
            ]
          },
          "harmony": {
            "type": "object",
            "properties": {
              "monitor": {
                "type": "string"
              },
              "coverage": {
                "type": "number"
              },
              "update_review": {
                "type": "string",
                "enum": [
                  "classified",
                  "queued for human review"
                ]
              }
            },
            "required": [
              "monitor",
              "coverage",
              "update_review"
            ]
          },
          "memory_scope": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "turns": {
                "type": "integer"
              }
            }
          }
        },
        "required": [
          "id",
          "object",
          "mind",
          "output",
          "finish",
          "usage",
          "neurons",
          "harmony"
        ]
      },
      "NativeModel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "model"
            ]
          },
          "name": {
            "type": "string"
          },
          "released": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "mind",
              "embedding"
            ]
          },
          "plastic": {
            "type": "boolean"
          },
          "max_input_tokens": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "object",
          "name",
          "kind"
        ]
      },
      "NativeModelList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NativeModel"
            }
          }
        },
        "required": [
          "object",
          "data"
        ]
      },
      "MemoryScope": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "memory_scope"
            ]
          },
          "name": {
            "type": "string"
          },
          "turns": {
            "type": "integer"
          },
          "last_used": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "name"
        ]
      },
      "MemoryScopeList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MemoryScope"
            }
          }
        },
        "required": [
          "object",
          "data"
        ]
      },
      "NativeEmbeddingRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "kirin-embed-2"
            ]
          },
          "input": {
            "type": [
              "string",
              "array"
            ]
          },
          "dimensions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3072
          }
        },
        "required": [
          "input"
        ]
      },
      "NativeEmbeddings": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "embeddings"
            ]
          },
          "model": {
            "type": "string"
          },
          "embeddings": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "number"
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "input_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "input_tokens"
            ]
          }
        },
        "required": [
          "object",
          "model",
          "embeddings",
          "usage"
        ]
      }
    }
  }
}
