{
  "openapi": "3.1.0",
  "info": {
    "title": "AnchorShell Hosted API",
    "version": "1.0.0",
    "description": "Bearer User API keys authenticate inference and documented management operations. Key scopes intersect with the owner’s current permissions, with normal organization/resource ownership and plan entitlements. Inference requires relay:request; management requires its relevant scopes. Browser cookies are not required for programmatic calls. Password/email changes, browser logout, and staff APIs are not API-key operations. Management operations override the default /v1 server with the API origin. This is the documented subset, not an exhaustive route inventory."
  },
  "servers": [
    {
      "url": "https://api.anchorshell.com/v1",
      "description": "Managed AnchorShell Relay"
    }
  ],
  "security": [
    {
      "UserAPIKey": []
    }
  ],
  "tags": [
    {
      "name": "Inference",
      "description": "Provider-compatible inference requests."
    },
    {
      "name": "Models",
      "description": "Configured model discovery."
    }
  ],
  "paths": {
    "/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "summary": "Create a chat completion",
        "tags": [
          "Inference"
        ],
        "description": "Uses enabled candidates, scheduling and limits. Effective HTTP guardrails support non-streaming chat/responses only; guarded streaming or embeddings requests are rejected. Additional fields follow the configured provider, not a universal provider schema.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              },
              "example": {
                "model": "production",
                "messages": [
                  {
                    "role": "user",
                    "content": "Return a short status sentence."
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected provider response.",
            "headers": {
              "X-Relay-Selected-Endpoint": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Relay-Selected-Endpoint-Id": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Relay-Selected-Provider-Id": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Relay-Selected-Upstream-Model": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Relay-Wait-Ms": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Fallback-Count": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Estimated-Input-Tokens": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Estimated-Output-Tokens": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Estimated-Cost-Micros": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Actual-Input-Tokens": {
                "description": "Terminal non-streaming metering when available; inspect logs for streaming usage.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Actual-Output-Tokens": {
                "description": "Terminal non-streaming metering when available; inspect logs for streaming usage.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Actual-Total-Tokens": {
                "description": "Terminal non-streaming metering when available; inspect logs for streaming usage.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Actual-Cost-Micros": {
                "description": "Terminal non-streaming metering when available; inspect logs for streaming usage.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "OpenAI-compatible JSON from the selected upstream. Fields and usage availability vary by provider."
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "description": "Provider SSE frames. Committed streams cannot be transparently restarted or replaced."
              }
            }
          },
          "400": {
            "description": "Invalid request, route selection, or incompatible guardrail request."
          },
          "401": {
            "description": "Missing, invalid or revoked User API key."
          },
          "403": {
            "description": "Product access or required permission is not granted."
          },
          "413": {
            "description": "Request body exceeds the configured size limit."
          },
          "429": {
            "description": "No candidate fits the wait budget, or an unhandled provider throttle.",
            "headers": {
              "Retry-After": {
                "description": "Wait duration in seconds when returned by Relay.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "error": {
                    "type": "rate_limit_wait_budget_exceeded",
                    "message": "all candidates exceed wait budget",
                    "retry_after": 12
                  }
                }
              }
            }
          },
          "502": {
            "description": "Selected upstream could not be prepared or failed after bounded handling."
          },
          "503": {
            "description": "Relay or required configuration is unavailable, or policy handling fails closed."
          },
          "default": {
            "description": "Provider status and body may pass through. Relay and upstream errors do not share one universal JSON schema.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/responses": {
      "post": {
        "operationId": "createResponse",
        "summary": "Create a response",
        "tags": [
          "Inference"
        ],
        "description": "Uses enabled candidates, scheduling and limits. Effective HTTP guardrails support non-streaming chat/responses only; guarded streaming or embeddings requests are rejected. Additional fields follow the configured provider, not a universal provider schema.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest"
              },
              "example": {
                "model": "production",
                "input": "Return a short status sentence."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected provider response.",
            "headers": {
              "X-Relay-Selected-Endpoint": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Relay-Selected-Endpoint-Id": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Relay-Selected-Provider-Id": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Relay-Selected-Upstream-Model": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Relay-Wait-Ms": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Fallback-Count": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Estimated-Input-Tokens": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Estimated-Output-Tokens": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Estimated-Cost-Micros": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Actual-Input-Tokens": {
                "description": "Terminal non-streaming metering when available; inspect logs for streaming usage.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Actual-Output-Tokens": {
                "description": "Terminal non-streaming metering when available; inspect logs for streaming usage.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Actual-Total-Tokens": {
                "description": "Terminal non-streaming metering when available; inspect logs for streaming usage.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Actual-Cost-Micros": {
                "description": "Terminal non-streaming metering when available; inspect logs for streaming usage.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "OpenAI-compatible JSON from the selected upstream. Fields and usage availability vary by provider."
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "description": "Provider SSE frames. Committed streams cannot be transparently restarted or replaced."
              }
            }
          },
          "400": {
            "description": "Invalid request, route selection, or incompatible guardrail request."
          },
          "401": {
            "description": "Missing, invalid or revoked User API key."
          },
          "403": {
            "description": "Product access or required permission is not granted."
          },
          "413": {
            "description": "Request body exceeds the configured size limit."
          },
          "429": {
            "description": "No candidate fits the wait budget, or an unhandled provider throttle.",
            "headers": {
              "Retry-After": {
                "description": "Wait duration in seconds when returned by Relay.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "error": {
                    "type": "rate_limit_wait_budget_exceeded",
                    "message": "all candidates exceed wait budget",
                    "retry_after": 12
                  }
                }
              }
            }
          },
          "502": {
            "description": "Selected upstream could not be prepared or failed after bounded handling."
          },
          "503": {
            "description": "Relay or required configuration is unavailable, or policy handling fails closed."
          },
          "default": {
            "description": "Provider status and body may pass through. Relay and upstream errors do not share one universal JSON schema.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/embeddings": {
      "post": {
        "operationId": "createEmbedding",
        "summary": "Create embeddings",
        "tags": [
          "Inference"
        ],
        "description": "Uses enabled candidates, scheduling and limits. Effective HTTP guardrails support non-streaming chat/responses only; guarded streaming or embeddings requests are rejected. Additional fields follow the configured provider, not a universal provider schema.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingsRequest"
              },
              "example": {
                "model": "embedding-model",
                "input": "A sample document."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected provider response.",
            "headers": {
              "X-Relay-Selected-Endpoint": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Relay-Selected-Endpoint-Id": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Relay-Selected-Provider-Id": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Relay-Selected-Upstream-Model": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Relay-Wait-Ms": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Fallback-Count": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Estimated-Input-Tokens": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Estimated-Output-Tokens": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Estimated-Cost-Micros": {
                "description": "Selected path or admission metadata when available.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Actual-Input-Tokens": {
                "description": "Terminal non-streaming metering when available; inspect logs for streaming usage.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Actual-Output-Tokens": {
                "description": "Terminal non-streaming metering when available; inspect logs for streaming usage.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Actual-Total-Tokens": {
                "description": "Terminal non-streaming metering when available; inspect logs for streaming usage.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Relay-Actual-Cost-Micros": {
                "description": "Terminal non-streaming metering when available; inspect logs for streaming usage.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "OpenAI-compatible JSON from the selected upstream. Fields and usage availability vary by provider."
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, route selection, or incompatible guardrail request."
          },
          "401": {
            "description": "Missing, invalid or revoked User API key."
          },
          "403": {
            "description": "Product access or required permission is not granted."
          },
          "413": {
            "description": "Request body exceeds the configured size limit."
          },
          "429": {
            "description": "No candidate fits the wait budget, or an unhandled provider throttle.",
            "headers": {
              "Retry-After": {
                "description": "Wait duration in seconds when returned by Relay.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "error": {
                    "type": "rate_limit_wait_budget_exceeded",
                    "message": "all candidates exceed wait budget",
                    "retry_after": 12
                  }
                }
              }
            }
          },
          "502": {
            "description": "Selected upstream could not be prepared or failed after bounded handling."
          },
          "503": {
            "description": "Relay or required configuration is unavailable, or policy handling fails closed."
          },
          "default": {
            "description": "Provider status and body may pass through. Relay and upstream errors do not share one universal JSON schema.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List enabled model endpoints",
        "tags": [
          "Models"
        ],
        "description": "Returns upstream model identifiers for enabled configured endpoints. It is not a complete list of group call names or a global provider catalog.",
        "responses": {
          "200": {
            "description": "Enabled model endpoints visible to the deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked User API key."
          },
          "403": {
            "description": "Product access or required permission is not granted."
          },
          "503": {
            "description": "Relay or required configuration is unavailable, or policy handling fails closed."
          },
          "default": {
            "description": "Deployment or data access failure."
          }
        }
      }
    },
    "/api/account": {
      "get": {
        "summary": "GET /api/account",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "user": {
                    "id": "<USER_ID>",
                    "name": "Your name",
                    "email": "you@example.com",
                    "status": "active",
                    "marketing_opt_in": false
                  },
                  "org": {
                    "id": "<ORG_ID>",
                    "name": "Your team"
                  },
                  "role": "owner"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "patch": {
        "summary": "PATCH /api/account",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Your name"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "user": {
                    "id": "<USER_ID>",
                    "name": "Your name",
                    "email": "you@example.com",
                    "status": "active",
                    "marketing_opt_in": false
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/account/preferences": {
      "patch": {
        "summary": "PATCH /api/account/preferences",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "marketing_opt_in": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "user": {
                    "id": "<USER_ID>",
                    "name": "Your name",
                    "email": "you@example.com",
                    "status": "active",
                    "marketing_opt_in": false
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/account/api-keys": {
      "get": {
        "summary": "GET /api/account/api-keys",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "api_keys": [
                    {
                      "id": "<API_KEY_ID>",
                      "user_uuid": "<USER_ID>",
                      "name": "support-agent",
                      "key_prefix": "<KEY_PREFIX>",
                      "product_key": "model_relay",
                      "scopes": [
                        "relay:request"
                      ],
                      "status": "active",
                      "last_used_at": null,
                      "expires_at": null,
                      "revoked_at": null
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "post": {
        "summary": "POST /api/account/api-keys",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "provider-automation",
                "scopes": [
                  "relay:providers:manage"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The api_key secret is returned only here. Copy it now; key.id is the public ID.",
            "content": {
              "application/json": {
                "example": {
                  "api_key": "<NEW_API_KEY>",
                  "key": {
                    "id": "<API_KEY_ID>",
                    "user_uuid": "<USER_ID>",
                    "name": "provider-automation",
                    "key_prefix": "<KEY_PREFIX>",
                    "product_key": "model_relay",
                    "scopes": [
                      "relay:providers:read",
                      "relay:providers:manage"
                    ],
                    "status": "active",
                    "last_used_at": null,
                    "expires_at": null,
                    "revoked_at": null
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/account/api-key-scopes": {
      "get": {
        "summary": "GET /api/account/api-key-scopes",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Example permitted scopes; the list varies with the owner and calling key.",
            "content": {
              "application/json": {
                "example": {
                  "scopes": [
                    "relay:request",
                    "relay:providers:read",
                    "relay:providers:manage",
                    "cloud:account:manage"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/account/api-keys/{api_key_id}": {
      "patch": {
        "summary": "PATCH /api/account/api-keys/<API_KEY_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "api_key_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "support-agent-production"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No response body."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "delete": {
        "summary": "DELETE /api/account/api-keys/<API_KEY_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "api_key_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No response body."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/providers": {
      "get": {
        "summary": "GET /api/relay/providers",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "<PROVIDER_ID>",
                    "name": "OpenAI",
                    "slug": "openai",
                    "base_url": "https://api.openai.com/v1",
                    "auth_mode": "bearer_static",
                    "enabled": true
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "post": {
        "summary": "POST /api/relay/providers",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "OpenAI",
                "base_url": "https://api.openai.com/v1",
                "auth_mode": "bearer_static",
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<PROVIDER_ID>",
                  "name": "OpenAI",
                  "slug": "openai",
                  "base_url": "https://api.openai.com/v1",
                  "auth_mode": "bearer_static",
                  "enabled": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/billing/history": {
      "get": {
        "summary": "GET /api/billing/history",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Example account with no billing history.",
            "content": {
              "application/json": {
                "example": {
                  "invoices": [],
                  "payments": [],
                  "refunds": [],
                  "disputes": [],
                  "activities": []
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/stats/summary": {
      "get": {
        "summary": "GET /api/relay/stats/summary",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "providers": 1,
                  "endpoints": 2,
                  "lanes": 1,
                  "requests": 12,
                  "request_states": {
                    "completed": 10,
                    "failed": 1,
                    "cancelled": 1
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/routing-lanes": {
      "get": {
        "summary": "GET /api/relay/routing-lanes",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "<GROUP_ID>",
                    "name": "agentic",
                    "slug": "agentic",
                    "default_max_wait_ms": 60000,
                    "allow_fallback": true,
                    "enabled": true
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "post": {
        "summary": "POST /api/relay/routing-lanes",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "agentic",
                "default_max_wait_ms": 60000,
                "allow_fallback": true,
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<GROUP_ID>",
                  "name": "agentic",
                  "slug": "agentic",
                  "default_max_wait_ms": 60000,
                  "allow_fallback": true,
                  "enabled": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/routing-lanes/{group_id}": {
      "put": {
        "summary": "PUT /api/relay/routing-lanes/<GROUP_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "agentic",
                "default_max_wait_ms": 30000,
                "allow_fallback": true,
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<GROUP_ID>",
                  "name": "agentic",
                  "slug": "agentic",
                  "default_max_wait_ms": 30000,
                  "allow_fallback": true,
                  "enabled": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "delete": {
        "summary": "DELETE /api/relay/routing-lanes/<GROUP_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No response body."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/lane-memberships": {
      "get": {
        "summary": "GET /api/relay/lane-memberships",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "<MEMBERSHIP_ID>",
                    "lane_id": "<GROUP_ID>",
                    "endpoint_id": "<MODEL_ID>",
                    "manual_rank": 1,
                    "enabled": true
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "post": {
        "summary": "POST /api/relay/lane-memberships",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "lane_id": "<GROUP_ID>",
                "endpoint_id": "<MODEL_ID>",
                "manual_rank": 1,
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<MEMBERSHIP_ID>",
                  "lane_id": "<GROUP_ID>",
                  "endpoint_id": "<MODEL_ID>",
                  "manual_rank": 1,
                  "enabled": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/lane-memberships/{membership_id}": {
      "put": {
        "summary": "PUT /api/relay/lane-memberships/<MEMBERSHIP_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "membership_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "manual_rank": 2,
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<MEMBERSHIP_ID>",
                  "lane_id": "<GROUP_ID>",
                  "endpoint_id": "<MODEL_ID>",
                  "manual_rank": 2,
                  "enabled": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "delete": {
        "summary": "DELETE /api/relay/lane-memberships/<MEMBERSHIP_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "membership_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No response body."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/guardrails": {
      "get": {
        "summary": "GET /api/relay/guardrails",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "<GUARDRAIL_ID>",
                    "name": "Content policy",
                    "preset_slug": "custom-http",
                    "enabled": false,
                    "has_credential": false,
                    "binding_count": 0
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "post": {
        "summary": "POST /api/relay/guardrails",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Content policy",
                "preset_slug": "custom-http",
                "base_url": "https://policy.example.com/check",
                "http_method": "POST",
                "auth_mode": "none",
                "pre_dispatch_enabled": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<GUARDRAIL_ID>",
                  "name": "Content policy",
                  "preset_slug": "custom-http",
                  "enabled": false,
                  "has_credential": false,
                  "binding_count": 0
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/guardrails/{guardrail_id}": {
      "get": {
        "summary": "GET /api/relay/guardrails/<GUARDRAIL_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "guardrail_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "guardrail": {
                    "id": "<GUARDRAIL_ID>",
                    "name": "Content policy",
                    "preset_slug": "custom-http",
                    "enabled": false,
                    "has_credential": false,
                    "binding_count": 0
                  },
                  "bindings": []
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "put": {
        "summary": "PUT /api/relay/guardrails/<GUARDRAIL_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "guardrail_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Production content policy",
                "enabled": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<GUARDRAIL_ID>",
                  "name": "Production content policy",
                  "preset_slug": "custom-http",
                  "enabled": false,
                  "has_credential": false,
                  "binding_count": 0
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "delete": {
        "summary": "DELETE /api/relay/guardrails/<GUARDRAIL_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "guardrail_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No response body."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/guardrails/{guardrail_id}/bindings": {
      "put": {
        "summary": "PUT /api/relay/guardrails/<GUARDRAIL_ID>/bindings",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "guardrail_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "bindings": [
                  {
                    "provider_id": "<PROVIDER_ID>",
                    "enabled": true
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "<BINDING_ID>",
                    "guardrail_id": "<GUARDRAIL_ID>",
                    "provider_id": "<PROVIDER_ID>",
                    "enabled": true
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/guardrails/{guardrail_id}/test": {
      "post": {
        "summary": "POST /api/relay/guardrails/<GUARDRAIL_ID>/test",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "guardrail_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "stage": "pre_dispatch",
                "request_text": "A harmless sample request."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Example configured policy allowing the test input. This calls the policy service, not an LLM.",
            "content": {
              "application/json": {
                "example": {
                  "response_status": 200,
                  "latency_ms": 42,
                  "result": {
                    "decision": "allow",
                    "guardrail_uuid": "<GUARDRAIL_ID>",
                    "stage": "pre_dispatch"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/limit-policies": {
      "get": {
        "summary": "GET /api/relay/limit-policies",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "<POLICY_ID>",
                    "scope_type": "global",
                    "metric": "requests",
                    "period": "minute",
                    "limit_value": 60,
                    "enabled": true
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "post": {
        "summary": "POST /api/relay/limit-policies",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "scope_type": "global",
                "metric": "requests",
                "period": "minute",
                "limit_value": 60,
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<POLICY_ID>",
                  "scope_type": "global",
                  "metric": "requests",
                  "period": "minute",
                  "limit_value": 60,
                  "enabled": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/limit-policies/{policy_id}": {
      "put": {
        "summary": "PUT /api/relay/limit-policies/<POLICY_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "scope_type": "global",
                "metric": "requests",
                "period": "minute",
                "limit_value": 120,
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<POLICY_ID>",
                  "scope_type": "global",
                  "metric": "requests",
                  "period": "minute",
                  "limit_value": 120,
                  "enabled": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "delete": {
        "summary": "DELETE /api/relay/limit-policies/<POLICY_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No response body."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/pro/user-limit-policies": {
      "get": {
        "summary": "GET /api/relay/pro/user-limit-policies",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "policies": [
                    {
                      "id": "<POLICY_ID>",
                      "limit_uuid": "<POLICY_ID>",
                      "user_uuid": "<MEMBER_ID>",
                      "target_type": "global",
                      "metric": "tokens",
                      "period": "day",
                      "limit_value": 100000,
                      "enabled": true
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "post": {
        "summary": "POST /api/relay/pro/user-limit-policies",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "user_uuid": "<MEMBER_ID>",
                "target_type": "global",
                "metric": "tokens",
                "period": "day",
                "limit_value": 100000,
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "No policy ID is returned. List policies to obtain its limit_uuid.",
            "content": {
              "application/json": {
                "example": {
                  "ok": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "delete": {
        "summary": "DELETE /api/relay/pro/user-limit-policies",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "limit_uuid",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The policy was removed.",
            "content": {
              "application/json": {
                "example": {
                  "ok": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/api-key-limit-policies": {
      "get": {
        "summary": "GET /api/relay/api-key-limit-policies",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "policies": [
                    {
                      "id": "<POLICY_ID>",
                      "limit_uuid": "<POLICY_ID>",
                      "api_key_uuid": "<API_KEY_ID>",
                      "owner_user_uuid": "<MEMBER_ID>",
                      "target_type": "global",
                      "metric": "requests",
                      "period": "day",
                      "limit_value": 2000,
                      "enabled": true
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "post": {
        "summary": "POST /api/relay/api-key-limit-policies",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "api_key_uuid": "<API_KEY_ID>",
                "target_type": "global",
                "metric": "requests",
                "period": "day",
                "limit_value": 2000,
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "No policy ID is returned. List policies to obtain its limit_uuid.",
            "content": {
              "application/json": {
                "example": {
                  "ok": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "delete": {
        "summary": "DELETE /api/relay/api-key-limit-policies",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "limit_uuid",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The policy was removed.",
            "content": {
              "application/json": {
                "example": {
                  "ok": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/logs/requests": {
      "get": {
        "summary": "GET /api/relay/logs/requests",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "request_id": "<REQUEST_ID>",
                      "incoming_model": "agentic",
                      "selected_upstream_model": "gpt-5-mini",
                      "status_code": 200,
                      "task_state": "completed",
                      "wait_ms": 0
                    }
                  ],
                  "total": 1,
                  "limit": 20,
                  "offset": 0,
                  "next_offset": 1,
                  "has_more": false
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/logs/requests/{request_id}": {
      "get": {
        "summary": "GET /api/relay/logs/requests/<REQUEST_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "request_id": "<REQUEST_ID>",
                  "incoming_model": "agentic",
                  "selected_upstream_model": "gpt-5-mini",
                  "status_code": 200,
                  "task_state": "completed",
                  "wait_ms": 0
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/providers/{provider_id}": {
      "put": {
        "summary": "PUT /api/relay/providers/<PROVIDER_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "provider_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "OpenAI production",
                "base_url": "https://api.openai.com/v1",
                "auth_mode": "bearer_static",
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<PROVIDER_ID>",
                  "name": "OpenAI production",
                  "slug": "openai",
                  "base_url": "https://api.openai.com/v1",
                  "auth_mode": "bearer_static",
                  "enabled": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "delete": {
        "summary": "DELETE /api/relay/providers/<PROVIDER_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "provider_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No response body."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/credentials": {
      "post": {
        "summary": "POST /api/relay/credentials",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "provider_id": "<PROVIDER_ID>",
                "name": "OpenAI key",
                "secret": "<PROVIDER_API_KEY>",
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<CREDENTIAL_ID>",
                  "provider_id": "<PROVIDER_ID>",
                  "name": "OpenAI key",
                  "has_secret": true,
                  "enabled": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/endpoints": {
      "get": {
        "summary": "GET /api/relay/endpoints",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "<MODEL_ID>",
                    "provider_id": "<PROVIDER_ID>",
                    "credential_id": "<CREDENTIAL_ID>",
                    "name": "gpt-5-mini",
                    "upstream_model": "gpt-5-mini",
                    "route_kind": "chat",
                    "enabled": true
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "post": {
        "summary": "POST /api/relay/endpoints",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "provider_id": "<PROVIDER_ID>",
                "credential_id": "<CREDENTIAL_ID>",
                "name": "gpt-5-mini",
                "upstream_model": "gpt-5-mini",
                "route_kind": "chat",
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<MODEL_ID>",
                  "provider_id": "<PROVIDER_ID>",
                  "credential_id": "<CREDENTIAL_ID>",
                  "name": "gpt-5-mini",
                  "upstream_model": "gpt-5-mini",
                  "route_kind": "chat",
                  "enabled": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/endpoints/{model_id}": {
      "put": {
        "summary": "PUT /api/relay/endpoints/<MODEL_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "model_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Support model",
                "upstream_model": "gpt-5-mini",
                "route_kind": "chat",
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "id": "<MODEL_ID>",
                  "provider_id": "<PROVIDER_ID>",
                  "credential_id": "<CREDENTIAL_ID>",
                  "name": "Support model",
                  "upstream_model": "gpt-5-mini",
                  "route_kind": "chat",
                  "enabled": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "delete": {
        "summary": "DELETE /api/relay/endpoints/<MODEL_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "model_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No response body."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/queue/items": {
      "get": {
        "summary": "GET /api/relay/queue/items",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": [
                  {
                    "task_id": "<TASK_ID>",
                    "request_id": "<REQUEST_ID>",
                    "incoming_model": "agentic",
                    "state": "queued",
                    "wait_ms": 1500
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/queue/cancel/{task_id}": {
      "post": {
        "summary": "POST /api/relay/queue/cancel/<TASK_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No response body."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/account/sessions": {
      "get": {
        "summary": "GET /api/account/sessions",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "sessions": [
                    {
                      "id": "<SESSION_ID>",
                      "current": false,
                      "browser": "Chrome",
                      "os": "macOS",
                      "device": "Desktop"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/account/sessions/{session_id}": {
      "delete": {
        "summary": "DELETE /api/account/sessions/<SESSION_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No response body."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/settings": {
      "get": {
        "summary": "GET /api/relay/settings",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "value_json is serialized JSON text, not a native boolean.",
            "content": {
              "application/json": {
                "example": [
                  {
                    "key": "store_requests",
                    "value_json": "false",
                    "updated_at": "2026-09-17T12:00:00Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/settings/store_requests": {
      "put": {
        "summary": "PUT /api/relay/settings/store_requests",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "value": false
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No response body."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/team/members": {
      "get": {
        "summary": "GET /api/team/members",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "members": [
                    {
                      "id": "<MEMBER_ID>",
                      "name": "Your name",
                      "email": "you@example.com",
                      "role": "owner",
                      "status": "active"
                    }
                  ],
                  "team_members": [
                    {
                      "id": "<MEMBER_ID>",
                      "name": "Your name",
                      "email": "you@example.com",
                      "role": "owner",
                      "status": "active"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/team/invitations": {
      "post": {
        "summary": "POST /api/team/invitations",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "email": "teammate@example.com",
                "role": "developer"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Invitation created and invitation email queued; expires_at is authoritative.",
            "content": {
              "application/json": {
                "example": {
                  "invitation": {
                    "id": "<INVITATION_ID>",
                    "email": "teammate@example.com",
                    "role": "developer",
                    "expires_at": "2026-09-24T12:00:00Z",
                    "accepted_at": null,
                    "revoked_at": null
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/team/members/{member_id}/permissions": {
      "get": {
        "summary": "GET /api/team/members/<MEMBER_ID>/permissions",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "member_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "member": {
                    "id": "<MEMBER_ID>",
                    "name": "Your name",
                    "email": "you@example.com",
                    "role": "developer",
                    "status": "active"
                  },
                  "mode": "custom",
                  "permissions": [
                    "relay:request",
                    "relay:usage:read:self"
                  ],
                  "editable": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      },
      "put": {
        "summary": "PUT /api/team/members/<MEMBER_ID>/permissions",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "member_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "permissions": [
                  "relay:request",
                  "relay:usage:read:self"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selected response fields shown; IDs and values are illustrative.",
            "content": {
              "application/json": {
                "example": {
                  "member": {
                    "id": "<MEMBER_ID>",
                    "name": "Your name",
                    "email": "you@example.com",
                    "role": "developer",
                    "status": "active"
                  },
                  "mode": "custom",
                  "permissions": [
                    "relay:request",
                    "relay:usage:read:self"
                  ],
                  "editable": true
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/team/members/{member_id}": {
      "delete": {
        "summary": "DELETE /api/team/members/<MEMBER_ID>",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "member_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No response body."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/stats/usage": {
      "get": {
        "summary": "GET /api/relay/stats/usage",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Counters are returned by scope, metric, and window. Selected response fields shown.",
            "content": {
              "application/json": {
                "example": [
                  {
                    "scope_type": "global",
                    "scope_id": "global",
                    "metric": "requests",
                    "period": "day",
                    "used_value": 12,
                    "window_start": "2026-09-17T00:00:00Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    },
    "/api/relay/stats/spend": {
      "get": {
        "summary": "GET /api/relay/stats/spend",
        "description": "Subject to key scopes, current owner permissions, resource ownership, and plan entitlements. Examples illustrate common fields; the linked feature documentation explains constraints.",
        "servers": [
          {
            "url": "https://api.anchorshell.com"
          }
        ],
        "security": [
          {
            "UserAPIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "used_value is in microdollars: 125000 = $0.125. Selected response fields shown.",
            "content": {
              "application/json": {
                "example": [
                  {
                    "scope_type": "global",
                    "scope_id": "global",
                    "metric": "spend",
                    "period": "day",
                    "used_value": 125000,
                    "window_start": "2026-09-17T00:00:00Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API key."
          },
          "403": {
            "description": "Required key scope, owner permission, or entitlement is absent."
          },
          "404": {
            "description": "Resource not found in the permitted scope."
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "InferenceUnauthorized": {
        "description": "Missing, malformed, or incorrect RELAY_API_TOKEN. Management tokens and session cookies are not inference credentials.",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            },
            "example": "Bearer realm=\"Relay inference API\""
          },
          "Cache-Control": {
            "schema": {
              "type": "string"
            },
            "example": "no-store"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            },
            "example": {
              "error": "valid Relay API token required"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "UserAPIKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "AnchorShell User API key, displayed once on creation. Never use provider keys or operator tokens here."
      }
    },
    "schemas": {
      "ChatRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "Routing selector: configured group name/slug, model name, or provider/model. No separate route or endpoint selector is required."
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string"
                },
                "content": {
                  "description": "Provider-supported text, multimodal parts, or null.",
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "additionalProperties": true
            }
          },
          "stream": {
            "type": "boolean",
            "default": false
          }
        },
        "additionalProperties": true,
        "description": "Provider-compatible request. Relay derives wait, fallback, priority, token estimates, and cost limits from internal/configured policy, not per-request override fields or headers. Standard output-token limits inform internal estimation. Additional provider fields are forwarded, not interpreted as Relay policy controls."
      },
      "ResponsesRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "Routing selector: configured group name/slug, model name, or provider/model. No separate route or endpoint selector is required."
          },
          "input": {
            "description": "Provider-supported text or input items.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {}
              }
            ]
          },
          "stream": {
            "type": "boolean",
            "default": false
          }
        },
        "additionalProperties": true,
        "description": "Provider-compatible request. Relay derives wait, fallback, priority, token estimates, and cost limits from internal/configured policy, not per-request override fields or headers. Standard output-token limits inform internal estimation. Additional provider fields are forwarded, not interpreted as Relay policy controls."
      },
      "EmbeddingsRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "Routing selector: configured group name/slug, model name, or provider/model. No separate route or endpoint selector is required."
          },
          "input": {
            "description": "Text, text arrays, or provider-supported token arrays.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {}
              }
            ]
          }
        },
        "additionalProperties": true,
        "description": "Provider-compatible request. Relay derives wait, fallback, priority, token estimates, and cost limits from internal/configured policy, not per-request override fields or headers. Standard output-token limits inform internal estimation. Additional provider fields are forwarded, not interpreted as Relay policy controls."
      },
      "ModelList": {
        "type": "object",
        "required": [
          "object",
          "data"
        ],
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "object",
                "owned_by"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "object": {
                  "const": "model"
                },
                "owned_by": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}
