{
  "openapi": "3.0.0",
  "info": {
    "title": "Agent API",
    "version": "1.0.0",
    "description": "OpenRouter/OpenAI API-compatible completions endpoint enables developers to build their own applications on sovereign agents. The completions request object is augmented with appropriate details from the agent's memory. Following the standard API format ensures compatibility with all SDKs that support OpenRouter or OpenAI API"
  },
  "paths": {
    "/v1/attestation": {
      "get": {
        "summary": "Get attestation details",
        "description": "Attestation endpoints return cryptographically signed evidence about the code and configuration running in the Trusted Execution Environment (TEE). This evidence allows third parties to verify the authenticity and integrity of the TEE's execution environment.",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code_attestation": {
                      "type": "string",
                      "example": "asdf",
                      "description": "Base64 encoded attestation data"
                    },
                    "operator_pubkey": {
                      "type": "string",
                      "description": "Operator's public key"
                    },
                    "tee_name": {
                      "type": "string",
                      "description": "Name of the Trusted Execution Environment"
                    },
                    "tee_public_key": {
                      "type": "string",
                      "description": "Public key of the TEE"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "summary": "Create chat completion",
        "description": "OpenRouter/OpenAI API-compatible completions endpoint enables developers to build their own applications on sovereign agents. The completions request object is augmented with appropriate details from the agent's memory. Following the standard API format ensures compatibility with all SDKs that support OpenRouter or OpenAI API.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "ID of the model to use",
                    "example": "gpt-4o-mini"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "role",
                        "content"
                      ],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "user",
                            "assistant",
                            "system"
                          ]
                        },
                        "content": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "header",
            "name": "organization_id",
            "schema": {
              "type": "string"
            },
            "description": "Unique tenancy ID to select applicable memories"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/memory": {
      "post": {
        "summary": "Store memory",
        "description": "Memory endpoint enables ingestion of memories into your agent. These memories are used by the agent when using tools or when developers invoke the chat completions endpoint.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "content",
                  "tenant_id"
                ],
                "properties": {
                  "content": {
                    "type": "string",
                    "description": "Memory content"
                  },
                  "metadata": {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string"
                      }
                    }
                  },
                  "tenant_id": {
                    "type": "string",
                    "description": "Unique identifier for the agent"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response"
          }
        }
      },
      "get": {
        "summary": "Query memories",
        "description": "Memory retrieval endpoint enables querying of the agent's memory to obtain the top-k most relevant results.",
        "parameters": [
          {
            "in": "query",
            "name": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Search query"
          },
          {
            "in": "query",
            "name": "top_k",
            "schema": {
              "type": "integer"
            },
            "description": "Number of results to return"
          },
          {
            "in": "query",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Unique identifier for the agent"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          }
        }
      }
    }
  }
}