{
  "openapi": "3.0.0",
  "authentication": {
    "preferredSecurityScheme": "apiKey"
  },
  "info": {
    "title": "Neuronpedia API",
    "description": "\nThis is Neuronpedia's API. You can test calls right in the browser.\n\nIMPORTANT: Check the [available resources](https://neuronpedia.org/available-resources) page to see which models and sources are available in the API.\n\nAPI KEY: Get your API key by logging in at [neuronpedia.org](https://www.neuronpedia.org) then going to [/account](https://neuronpedia.org/account).\n\nRequests for new APIs, questions, or feedback? [Contact us](https://neuronpedia.org/contact).\n",
    "version": "1.0"
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "schemas": {
      "Explanation": {
        "type": "object",
        "description": "Schema for a returned explanation or explanations.",
        "properties": {
          "modelId": {
            "type": "string"
          },
          "layer": {
            "type": "string"
          },
          "index": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "typeName": {
            "type": "string"
          },
          "explanationModelName": {
            "type": "string"
          }
        }
      },
      "NeuronSchema": {
        "type": "object",
        "required": [
          "modelId",
          "source",
          "index"
        ],
        "properties": {
          "modelId": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "index": {
            "type": "string"
          },
          "sourceSetName": {
            "type": "string"
          }
        }
      },
      "InferenceActivationResultSingle": {
        "type": "object",
        "properties": {
          "tokens": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "activations": {
            "type": "object",
            "properties": {
              "layer": {
                "type": "string"
              },
              "index": {
                "type": "number"
              },
              "values": {
                "type": "array",
                "items": {
                  "type": "number"
                }
              },
              "maxValue": {
                "type": "number"
              },
              "maxValueIndex": {
                "type": "number"
              },
              "dfaValues": {
                "type": "array",
                "items": {
                  "type": "number"
                }
              },
              "dfaTargetIndex": {
                "type": "number"
              },
              "dfaMaxValue": {
                "type": "number"
              }
            }
          },
          "error": {
            "type": "string"
          }
        }
      }
    }
  },
  "security": [],
  "paths": {
    "/api/activation/get": {
      "post": {
        "tags": [
          "Activations"
        ],
        "summary": "Get Activations",
        "description": "Returns all activations for a given model, source, and index.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "Model ID"
                  },
                  "source": {
                    "type": "string",
                    "description": "Source or layer"
                  },
                  "index": {
                    "type": "string",
                    "description": "Index of the feature/latent"
                  }
                },
                "required": [
                  "modelId",
                  "source",
                  "index"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Activation data"
          }
        }
      }
    },
    "/api/explanation/{explanationId}/delete": {
      "post": {
        "summary": "Auto-Interp - Delete",
        "description": "Deletes an explanation by its ID. Only the user who created the explanation can delete it.",
        "tags": [
          "Explanations"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "explanationId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The ID of the explanation to delete"
          }
        ],
        "responses": {
          "200": {
            "description": "Explanation successfully deleted"
          }
        }
      }
    },
    "/api/explanation/export": {
      "get": {
        "tags": [
          "Explanations"
        ],
        "summary": "Export Explanations",
        "security": [
          {
            "apiKey": []
          }
        ],
        "description": "Removed: Use https://neuronpedia-datasets.s3.us-east-1.amazonaws.com/index.html?prefix=v1/ instead."
      }
    },
    "/api/explanation/score/{explanationScoreId}/delete": {
      "post": {
        "summary": "Auto-Interp - Score Delete",
        "description": "Deletes an explanation score by its ID. Only the user who created the score can delete it.",
        "tags": [
          "Explanations"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "explanationScoreId",
            "in": "path",
            "required": true,
            "description": "ID of the explanation score to delete",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Explanation score successfully deleted"
          }
        }
      }
    },
    "/api/feature/{modelId}/{layer}/{index}": {
      "get": {
        "tags": [
          "Features"
        ],
        "summary": "Get Feature",
        "security": [
          {
            "apiKey": []
          }
        ],
        "description": "Returns a feature, including its activations and explanations.",
        "parameters": [
          {
            "name": "modelId",
            "in": "path",
            "description": "Model ID",
            "required": true,
            "schema": {
              "type": "string",
              "default": "gpt2-small"
            }
          },
          {
            "name": "layer",
            "in": "path",
            "description": "SAE ID or Layer",
            "required": true,
            "schema": {
              "type": "string",
              "default": "0-res-jb"
            }
          },
          {
            "name": "index",
            "in": "path",
            "description": "Index",
            "required": true,
            "schema": {
              "type": "number",
              "default": 14057
            }
          }
        ],
        "responses": {
          "200": {
            "description": null
          }
        }
      }
    },
    "/api/graph/{modelId}/{slug}": {
      "get": {
        "summary": "Get Graph Metadata",
        "description": "Retrieves metadata for a specific graph by model ID and slug",
        "tags": [
          "Attribution Graphs"
        ],
        "parameters": [
          {
            "name": "modelId",
            "in": "path",
            "description": "Model ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "description": "Graph slug",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved graph metadata"
          },
          "404": {
            "description": "Graph not found"
          },
          "500": {
            "description": "Server error"
          }
        }
      }
    },
    "/api/graph/delete": {
      "post": {
        "summary": "Delete Graph",
        "description": "Deletes an existing graph from Neuronpedia. You can only delete graphs you created.",
        "tags": [
          "Attribution Graphs"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "slug"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "ID of the model"
                  },
                  "slug": {
                    "type": "string",
                    "description": "Slug of the graph to delete"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Graph deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/graph/generate": {
      "post": {
        "summary": "Generate New Graph",
        "description": "Creates a new graph by analyzing the provided text prompt using the specified model. You'll get a link to access the graph visualization directly on Neuronpedia's UI, and the graph will be saved to S3 and metadata stored in the database.",
        "tags": [
          "Attribution Graphs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "prompt",
                  "modelId",
                  "slug"
                ],
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "The text prompt to analyze and generate a graph from. Capped at 64 max tokens.",
                    "maxLength": 10000,
                    "example": "abc12"
                  },
                  "modelId": {
                    "type": "string",
                    "description": "The ID of the model to use for graph generation. Currently only gemma-2-2b is supported.",
                    "pattern": "^[a-zA-Z0-9_-]+$",
                    "example": "gemma-2-2b"
                  },
                  "sourceSetName": {
                    "type": "string",
                    "description": "Optional. The name of the source set to use for graph generation. If not provided, the default source set for the model will be used.",
                    "pattern": "^[a-zA-Z0-9_-]+$",
                    "example": "gemmascope-transcoder-16k"
                  },
                  "slug": {
                    "type": "string",
                    "description": "A unique identifier for this graph (lowercase, alphanumeric, underscores, and hyphens only)",
                    "pattern": "^[a-z0-9_-]+$"
                  },
                  "maxNLogits": {
                    "type": "number",
                    "description": "Maximum number of logits to consider",
                    "minimum": 5,
                    "maximum": 15,
                    "default": 10
                  },
                  "desiredLogitProb": {
                    "type": "number",
                    "description": "Desired logit probability threshold",
                    "minimum": 0.6,
                    "maximum": 0.99,
                    "default": 0.95
                  },
                  "nodeThreshold": {
                    "type": "number",
                    "description": "Threshold for including nodes in the graph",
                    "minimum": 0.5,
                    "maximum": 1,
                    "default": 0.8
                  },
                  "edgeThreshold": {
                    "type": "number",
                    "description": "Threshold for including edges in the graph",
                    "minimum": 0.8,
                    "maximum": 1,
                    "default": 0.85
                  },
                  "maxFeatureNodes": {
                    "type": "number",
                    "description": "Maximum number of feature nodes to include in the graph",
                    "minimum": 3000,
                    "maximum": 10000,
                    "default": 5000
                  },
                  "qkTopFraction": {
                    "type": "number",
                    "description": "(Lorsa models only) Fraction of top Lorsa heads to run QK tracing on. Ignored for non-lorsa models.",
                    "minimum": 0.05,
                    "maximum": 0.5,
                    "default": 0.5
                  },
                  "qkTopk": {
                    "type": "number",
                    "description": "(Lorsa models only) Number of QK upstream contributors to return per Lorsa target node. Ignored for non-lorsa models.",
                    "minimum": 1,
                    "maximum": 6,
                    "default": 6
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Graph generated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Graph saved to database"
                    },
                    "s3url": {
                      "type": "string",
                      "description": "The S3 URL where the graph data is stored"
                    },
                    "url": {
                      "type": "string",
                      "description": "The public URL to access the generated graph"
                    },
                    "numNodes": {
                      "type": "integer",
                      "description": "Number of nodes in the generated graph"
                    },
                    "numLinks": {
                      "type": "integer",
                      "description": "Number of links in the generated graph"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - validation error, prompt too long, or duplicate slug",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "Validation error",
                        "Prompt Too Long",
                        "Model + Slug/ID Exists",
                        "Invalid scan or slug"
                      ]
                    },
                    "message": {
                      "type": "string",
                      "description": "Detailed error message"
                    },
                    "details": {
                      "type": "string",
                      "description": "Additional error details (for validation errors)"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "Failed to generate graph"
                    },
                    "message": {
                      "type": "string",
                      "description": "Error message"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable - GPUs are busy",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "GPUs Busy"
                    },
                    "message": {
                      "type": "string",
                      "example": "Sorry, all GPUs are currently busy. Please try again in a minute."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/graph/list": {
      "get": {
        "summary": "List User's Graphs",
        "description": "Retrieves a list of all graph metadata for the authenticated user",
        "tags": [
          "Attribution Graphs"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved graph list"
          }
        }
      }
    },
    "/api/graph/save-to-db": {
      "post": {
        "summary": "Upload Graph 2/2 - Save Graph Metadata to Database",
        "description": "Saves metadata about an uploaded graph file to the database after it has been uploaded to S3.",
        "tags": [
          "Attribution Graphs"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "putRequestId"
                ],
                "properties": {
                  "putRequestId": {
                    "type": "string",
                    "description": "ID of the previously created put request record"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully saved graph metadata to database",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "description": "URL to access the saved graph"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/graph/signed-put": {
      "post": {
        "summary": "Upload Graph 1/2 - Get Pre-Signed URL",
        "description": "Creates a pre-signed URL that allows authenticated users to upload graph files directly to S3. Both this and the second step are necessary for your graph to be saved correctly. Use the returned URL with a PUT request, like this `curl -X PUT -T my-graph.json [returned-url]`. Don't lose your putRequestId, you'll need it for the second part.",
        "tags": [
          "Attribution Graphs"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "filename",
                  "contentLength"
                ],
                "properties": {
                  "filename": {
                    "type": "string",
                    "description": "Name of the file to be uploaded"
                  },
                  "contentLength": {
                    "type": "number",
                    "description": "Size of the file in bytes",
                    "minimum": 1024,
                    "maximum": 209715200
                  },
                  "contentType": {
                    "type": "string",
                    "description": "MIME type of the file (optional)",
                    "default": "application/json"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully generated signed URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "description": "Pre-signed URL for uploading to S3"
                    },
                    "putRequestId": {
                      "type": "string",
                      "description": "ID of the created put request record"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/graph/subgraph/delete": {
      "post": {
        "summary": "Subgraph Delete",
        "description": "Deletes an existing subgraph owned by the authenticated user",
        "tags": [
          "Attribution Graphs"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "subgraphId"
                ],
                "properties": {
                  "subgraphId": {
                    "type": "string",
                    "description": "ID of the subgraph to delete",
                    "example": "clx1234567890abcdef"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Subgraph deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "message": {
                      "type": "string",
                      "example": "Subgraph deleted successfully"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Not authorized to delete this subgraph"
          },
          "404": {
            "description": "Subgraph not found"
          },
          "500": {
            "description": "Failed to delete subgraph"
          }
        }
      }
    },
    "/api/graph/subgraph/list": {
      "post": {
        "summary": "Subgraphs List",
        "description": "Lists all subgraphs owned by the authenticated user for a specific graph",
        "tags": [
          "Attribution Graphs"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "slug"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "example": "gemma-2-2b"
                  },
                  "slug": {
                    "type": "string",
                    "example": "thedogsitsonthe-1756413232594"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Subgraphs retrieved successfully"
          },
          "500": {
            "description": "Failed to retrieve subgraphs"
          }
        }
      }
    },
    "/api/graph/subgraph/save": {
      "post": {
        "summary": "Subgraph Save (or Overwrite)",
        "description": "Creates a new subgraph or overwrites an existing one if overwriteId is provided",
        "tags": [
          "Attribution Graphs"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "slug",
                  "pinnedIds",
                  "supernodes",
                  "clerps"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "example": "gemma-2-2b"
                  },
                  "slug": {
                    "type": "string",
                    "example": "my doggo graph"
                  },
                  "displayName": {
                    "type": "string",
                    "example": "my cool subgraph"
                  },
                  "pinnedIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "2_15681_2",
                      "E_2_0",
                      "4_14735_2",
                      "E_5929_2",
                      "19_9180_3",
                      "27_6784_5"
                    ]
                  },
                  "supernodes": {
                    "type": "array",
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "example": [
                      [
                        "supernode",
                        "4_14735_2",
                        "19_9180_3"
                      ]
                    ]
                  },
                  "clerps": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    },
                    "example": []
                  },
                  "pruningThreshold": {
                    "type": "number",
                    "nullable": true,
                    "example": 0.8
                  },
                  "densityThreshold": {
                    "type": "number",
                    "nullable": true,
                    "example": 0.99
                  },
                  "overwriteId": {
                    "type": "string",
                    "description": "ID of existing subgraph to overwrite (optional)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Subgraph saved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "subgraphId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Not authorized to overwrite this subgraph"
          },
          "500": {
            "description": "Failed to save subgraph"
          }
        }
      }
    },
    "/api/graph/tokenize": {
      "post": {
        "summary": "Steer Graph Features (1/2) - Tokenize",
        "description": "Tokenizes a prompt using the graph server for the requested model/source set and returns token positions plus salient next-token logits.\n\nUse this before `/api/steer-logits` to identify the token positions you want to steer. The zero-based index of a token in `input_tokens` is the position to use for `token_active_position` and, when steering a specific prompt token, `steer_position`.\n",
        "tags": [
          "Attribution Graphs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "prompt",
                  "maxNLogits",
                  "desiredLogitProb"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "enum": [
                      "gemma-2-2b",
                      "gemma-3-4b-it",
                      "qwen3-4b",
                      "qwen3-1.7b"
                    ],
                    "description": "The model id to tokenize with.",
                    "example": "gemma-2-2b"
                  },
                  "sourceSetName": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional source set name. If omitted or null, the model's default graph source set is used.",
                    "example": "gemmascope-transcoder-16k"
                  },
                  "prompt": {
                    "type": "string",
                    "description": "Prompt text to tokenize.",
                    "maxLength": 10000,
                    "example": "Fact: The capital of the state containing Dallas is"
                  },
                  "maxNLogits": {
                    "type": "integer",
                    "description": "Maximum number of salient logits to return.",
                    "minimum": 5,
                    "maximum": 15,
                    "default": 10,
                    "example": 10
                  },
                  "desiredLogitProb": {
                    "type": "number",
                    "description": "Desired cumulative probability threshold for salient logits.",
                    "minimum": 0.6,
                    "maximum": 0.99,
                    "default": 0.95,
                    "example": 0.95
                  }
                }
              },
              "example": {
                "modelId": "gemma-2-2b",
                "sourceSetName": "gemmascope-transcoder-16k",
                "prompt": "Fact: The capital of the state containing Dallas is",
                "maxNLogits": 10,
                "desiredLogitProb": 0.95
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tokenized prompt and salient next-token logits.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "prompt": {
                      "type": "string",
                      "description": "The prompt that was tokenized."
                    },
                    "input_tokens": {
                      "type": "array",
                      "description": "Prompt tokens in order. Use each token's zero-based array index as its position for steering.",
                      "items": {
                        "type": "string"
                      }
                    },
                    "salient_logits": {
                      "type": "array",
                      "description": "Salient next-token logits from the forward pass.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "token": {
                            "type": "string",
                            "description": "Candidate next token."
                          },
                          "token_id": {
                            "type": "integer",
                            "description": "Candidate token id."
                          },
                          "probability": {
                            "type": "number",
                            "description": "Candidate token probability."
                          }
                        }
                      }
                    },
                    "total_salient_tokens": {
                      "type": "integer",
                      "description": "Number of salient logits returned."
                    },
                    "cumulative_probability": {
                      "type": "number",
                      "description": "Cumulative probability covered by the salient logits."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, invalid JSON, validation error, or missing source set."
          },
          "500": {
            "description": "Failed to tokenize text."
          },
          "502": {
            "description": "Graph server error."
          }
        }
      }
    },
    "/api/lens/prompt": {
      "post": {
        "summary": "Run J-lens Over Prompt/Chat",
        "description": "Runs the Jacobian/Logit lens over a prompt (or chat) and returns the per-position, per-layer top read-out tokens. Results are streamed as newline-delimited JSON (NDJSON) by default, or returned as a single buffered JSON object when `stream: false` (see **Response format** below).\n\nThis powers the [Jacobian Lens](https://neuronpedia.org/jlens) tool. The model is run once and the requested lens types share the same residual stream, so requesting both `LOGIT_LENS` and `JACOBIAN_LENS` is essentially free.\n\nProvide **exactly one** of `prompt` (completion / raw text) or `chat` (instruct / chat-formatted turns). This is all most callers need.\n\n_Advanced:_ instead of `prompt`/`chat` you may supply `inputTokenIds` to read out over an exact, pre-tokenized sequence verbatim (no tokenization and no generation). This is intended for faithfully reproducing a previous run's read-outs \u2014 e.g. re-running with a different `filterNonWordTokens` setting \u2014 by feeding back the token `id` values returned on each `token` message. Most callers should ignore this field.\n\n**Response format:** By default (`stream: true`) the endpoint responds with `Content-Type: application/x-ndjson` and streams one JSON object per line: a `meta` message describing the run, one `token` message per sequence position (prompt tokens then generated tokens), and finally a `done` message. If an error occurs mid-stream, an `error` message is emitted instead. Set `stream: false` to instead receive a single JSON object `{ meta, tokens, done }` once the run completes.\n",
        "tags": [
          "Jacobian Lens"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "The Neuronpedia model id to run the lens with.",
                    "maxLength": 128,
                    "example": "qwen3.6-27b"
                  },
                  "prompt": {
                    "type": "string",
                    "description": "Raw completion prompt. Provide exactly one of `prompt` or `chat` (unless `inputTokenIds` is supplied).",
                    "maxLength": 1024,
                    "example": "The capital of France is"
                  },
                  "chat": {
                    "type": "array",
                    "description": "Chat-formatted conversation turns. Provide exactly one of `prompt` or `chat` (unless `inputTokenIds` is supplied).",
                    "maxItems": 200,
                    "items": {
                      "type": "object",
                      "required": [
                        "role",
                        "content"
                      ],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "user",
                            "assistant",
                            "system"
                          ]
                        },
                        "content": {
                          "type": "string",
                          "description": "Message content. User messages are capped at 1024 characters; assistant/system messages at 10000."
                        }
                      }
                    },
                    "example": [
                      {
                        "role": "user",
                        "content": "What is the capital of France? Answer in 1 word."
                      }
                    ]
                  },
                  "type": {
                    "type": "array",
                    "description": "Which lens types to compute. Defaults to both.",
                    "maxItems": 2,
                    "items": {
                      "type": "string",
                      "enum": [
                        "LOGIT_LENS",
                        "JACOBIAN_LENS"
                      ]
                    },
                    "default": [
                      "LOGIT_LENS",
                      "JACOBIAN_LENS"
                    ]
                  },
                  "topN": {
                    "type": "integer",
                    "description": "Number of top read-out tokens to return per layer per position.",
                    "minimum": 1,
                    "maximum": 8,
                    "default": 8
                  },
                  "temperature": {
                    "type": "number",
                    "description": "Sampling temperature for generated tokens. 0 = greedy (argmax).",
                    "minimum": 0,
                    "maximum": 2,
                    "default": 0
                  },
                  "numCompletionTokens": {
                    "type": "integer",
                    "description": "Number of tokens to generate after the prompt. 0 = read out over the input only (no generation). The maximum depends on the model \u2014 2048 for deepseek-v4-flash, 1024 for every other model.",
                    "minimum": 0,
                    "maximum": 2048,
                    "default": 128
                  },
                  "prependBos": {
                    "type": "boolean",
                    "description": "Whether to prepend a beginning-of-sequence token.",
                    "default": true
                  },
                  "enableThinking": {
                    "type": "boolean",
                    "description": "Enable \"thinking\" mode when applying a chat template (chat requests only).",
                    "default": false
                  },
                  "filterNonWordTokens": {
                    "type": "boolean",
                    "description": "Drop non-word tokens (punctuation/whitespace/symbol/special) from each position's read-out before selecting the top-n. The model's true top-1 per layer is always kept.",
                    "default": true
                  },
                  "steerTokens": {
                    "type": "array",
                    "description": "Read-outs to steer on (additively inject, negatively to suppress) into the residual stream.",
                    "maxItems": 16,
                    "items": {
                      "type": "object",
                      "required": [
                        "token",
                        "type"
                      ],
                      "properties": {
                        "token": {
                          "type": "string",
                          "description": "The exact decoded token string (whitespace preserved, e.g. \" cat\").",
                          "maxLength": 256
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "LOGIT_LENS",
                            "JACOBIAN_LENS"
                          ]
                        }
                      }
                    }
                  },
                  "steerLayers": {
                    "type": "array",
                    "description": "Layers to inject the steering direction at. Empty/omitted = the read-out layers.",
                    "maxItems": 512,
                    "items": {
                      "type": "integer"
                    }
                  },
                  "steerStrength": {
                    "type": "number",
                    "description": "Signed steering strength as a fraction of each position's residual norm (negative suppresses the read-out).",
                    "minimum": -50,
                    "maximum": 50
                  },
                  "steerAblate": {
                    "type": "boolean",
                    "description": "Ablate (project out) the read-out direction instead of additively steering. Mutually exclusive with steerStrength."
                  },
                  "swapToken": {
                    "type": "object",
                    "description": "SWAP target read-out to replace the source read-out (steerTokens[0]) with.",
                    "properties": {
                      "token": {
                        "type": "string",
                        "maxLength": 256
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "LOGIT_LENS",
                          "JACOBIAN_LENS"
                        ]
                      }
                    }
                  },
                  "steerGeneratedTokens": {
                    "type": "boolean",
                    "description": "Apply the steer/swap intervention to generated tokens too.",
                    "default": false
                  },
                  "stream": {
                    "type": "boolean",
                    "description": "When true, stream results as NDJSON. When false, return a single buffered JSON object `{ meta, tokens, done }`.",
                    "default": true
                  },
                  "cachedTokenIds": {
                    "type": "array",
                    "description": "Advanced. Token ids the client already has read-outs for (prefix reuse). The server reuses the longest common token-id prefix and only recomputes the new positions. Max 4096 ids.",
                    "maxItems": 4096,
                    "items": {
                      "type": "integer"
                    }
                  },
                  "inputTokenIds": {
                    "type": "array",
                    "description": "Advanced. Exact, pre-tokenized sequence (in order) to read out over, bypassing tokenization and generation. Used to reproduce a previous run's read-outs by feeding back the token `id` values from a prior response. When provided, `prompt`/`chat` are not required. Max 4096 ids.",
                    "maxItems": 4096,
                    "items": {
                      "type": "integer"
                    }
                  }
                }
              },
              "example": {
                "modelId": "qwen3.6-27b",
                "chat": [
                  {
                    "role": "user",
                    "content": "What is the capital of France? Answer in 1 word."
                  }
                ],
                "type": [
                  "LOGIT_LENS",
                  "JACOBIAN_LENS"
                ],
                "topN": 8,
                "temperature": 0,
                "numCompletionTokens": 32,
                "stream": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "When `stream` is true (default), an NDJSON stream (`application/x-ndjson`) with one JSON message per line: a single `meta` message, then one `token` message per position, then a final `done` message (or an `error` message). When `stream` is false, a single JSON object `{ meta, tokens, done }`.\n",
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "type": "string",
                  "description": "Newline-delimited JSON messages (when `stream` is true)."
                },
                "examples": {
                  "stream": {
                    "summary": "Example message lines",
                    "value": "{\"kind\":\"meta\",\"model\":\"qwen3.6-27b\",\"types\":[\"LOGIT_LENS\",\"JACOBIAN_LENS\"],\"layers_by_type\":{\"LOGIT_LENS\":[0,1,2],\"JACOBIAN_LENS\":[0,1,2]},\"top_n\":8,\"prompt_len\":6,\"num_completion_tokens\":32,\"temperature\":0,\"prepend_bos\":true,\"reuse_len\":0}\n{\"kind\":\"token\",\"position\":0,\"token\":\"The\",\"id\":464,\"is_generated\":false,\"results\":[{\"type\":\"LOGIT_LENS\",\"top_tokens\":[[\"a\",\" the\"]],\"top_probs\":[[0.12,0.08]]}]}\n{\"kind\":\"done\",\"seq_len\":38,\"prompt_len\":6,\"vocab_size\":151936,\"completion\":\" Paris.\"}\n"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Buffered response (when `stream` is false).",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "description": "The run's `meta` message."
                    },
                    "tokens": {
                      "type": "array",
                      "description": "One `token` message per sequence position.",
                      "items": {
                        "type": "object"
                      }
                    },
                    "done": {
                      "type": "object",
                      "description": "The final `done` message, including the generated `completion` string."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, validation error, or not exactly one of `prompt`/`chat` provided."
          },
          "500": {
            "description": "Lens request failed or an internal error occurred."
          }
        }
      }
    },
    "/api/lens/share": {
      "post": {
        "summary": "Share J-lens Run",
        "description": "Creates a shareable, permanent snapshot of a [J-lens](https://neuronpedia.org/jlens) run.\n\nProvide **exactly one** of `prompt` (completion / raw text) or `chat` (instruct / chat-formatted turns) \u2014 same input surface as `/api/lens/prompt`. The server tokenizes, generates `numCompletionTokens`, computes the read-outs, gzips the result to S3, and creates a share record. Because the run is computed server-side, the stored data is trusted (not caller-supplied) and the prompt/generated boundary is derived automatically.\n\n_Advanced:_ instead of `prompt`/`chat` you may supply `inputTokenIds` to reproduce an exact, pre-tokenized run verbatim (a forced decode, no generation). This is what the JLens UI uses to share exactly the run being viewed. When `inputTokenIds` is present it takes precedence, and `prompt`/`messages` are stored only as display metadata.\n\nAuthentication is optional: authenticated shares are attributed to the user, anonymous shares are attributed to an anonymous owner. Requests are rate-limited per IP address per day.\n",
        "tags": [
          "Jacobian Lens"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "topN",
                  "temperature",
                  "numCompletionTokens",
                  "activeLensModeTab",
                  "hideNonWordTokens"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "The Neuronpedia model id the run was computed with.",
                    "maxLength": 128,
                    "example": "qwen3.6-27b"
                  },
                  "prompt": {
                    "type": "string",
                    "description": "Raw completion prompt to run and share. Provide exactly one of `prompt` or `chat` (unless `inputTokenIds` is supplied).",
                    "maxLength": 1024,
                    "example": "The capital of France is"
                  },
                  "chat": {
                    "type": "array",
                    "description": "Chat-formatted conversation turns to run and share. Provide exactly one of `prompt` or `chat` (unless `inputTokenIds` is supplied).",
                    "maxItems": 200,
                    "items": {
                      "type": "object",
                      "required": [
                        "role",
                        "content"
                      ],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "user",
                            "assistant",
                            "system"
                          ]
                        },
                        "content": {
                          "type": "string",
                          "maxLength": 10000
                        }
                      }
                    }
                  },
                  "kind": {
                    "type": "string",
                    "description": "Advanced. Explicit run kind for the `inputTokenIds` path. For the `prompt`/`chat` path the kind is inferred from the input given.",
                    "enum": [
                      "chat",
                      "completion"
                    ],
                    "default": "chat"
                  },
                  "messages": {
                    "type": "array",
                    "description": "Advanced. Conversation turns stored for display on the `inputTokenIds` path. For the `chat` generation path, use `chat` instead.",
                    "maxItems": 200,
                    "items": {
                      "type": "object",
                      "required": [
                        "role",
                        "content"
                      ],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "user",
                            "assistant",
                            "system"
                          ]
                        },
                        "content": {
                          "type": "string",
                          "maxLength": 10000
                        }
                      }
                    }
                  },
                  "topN": {
                    "type": "integer",
                    "description": "Number of top read-out tokens returned per layer per position.",
                    "minimum": 1,
                    "maximum": 10
                  },
                  "temperature": {
                    "type": "number",
                    "description": "Sampling temperature used for the run.",
                    "minimum": 0,
                    "maximum": 2
                  },
                  "numCompletionTokens": {
                    "type": "integer",
                    "description": "Number of generated tokens in the run. The maximum depends on the model \u2014 2048 for deepseek-v4-flash, 1024 for every other model.",
                    "minimum": 0,
                    "maximum": 2048
                  },
                  "activeLensModeTab": {
                    "type": "string",
                    "description": "The lens display mode tab that was active when sharing.",
                    "enum": [
                      "JACOBIAN_LENS",
                      "LOGIT_LENS",
                      "DIFF"
                    ]
                  },
                  "hideNonWordTokens": {
                    "type": "boolean",
                    "description": "Whether non-word tokens were filtered from the read-outs. The stored snapshot is captured with this filter applied."
                  },
                  "lockedTokens": {
                    "type": "array",
                    "description": "Tokens the user pinned in the UI.",
                    "maxItems": 512,
                    "items": {
                      "type": "object",
                      "required": [
                        "key",
                        "type"
                      ],
                      "properties": {
                        "key": {
                          "type": "string",
                          "maxLength": 256
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "LOGIT_LENS",
                            "JACOBIAN_LENS"
                          ]
                        }
                      }
                    }
                  },
                  "selectedPositions": {
                    "type": "array",
                    "description": "Token positions the user selected in the UI.",
                    "maxItems": 4096,
                    "items": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "description": {
                    "type": "string",
                    "description": "Optional description for the shared run."
                  },
                  "inputTokenIds": {
                    "type": "array",
                    "description": "Advanced. Exact, pre-tokenized sequence to reproduce verbatim (forced decode, no generation). When provided, takes precedence over `prompt`/`chat` and is the path the JLens UI uses.",
                    "minItems": 1,
                    "maxItems": 4096,
                    "items": {
                      "type": "integer"
                    }
                  },
                  "numPromptTokens": {
                    "type": "integer",
                    "description": "Advanced. Number of leading prompt tokens for the `inputTokenIds` path (the remainder were generated). Ignored on the `prompt`/`chat` path, where it's derived from the run.",
                    "minimum": 0
                  },
                  "steer": {
                    "type": "object",
                    "description": "Advanced. Optional steered run to carry with the share. Its read-outs are re-computed server-side over `inputTokenIds`.",
                    "required": [
                      "token",
                      "type",
                      "layers",
                      "strength",
                      "ablate",
                      "inputTokenIds"
                    ],
                    "properties": {
                      "token": {
                        "type": "string",
                        "description": "The exact decoded read-out token that was steered on.",
                        "maxLength": 256
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "LOGIT_LENS",
                          "JACOBIAN_LENS"
                        ]
                      },
                      "layers": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 512,
                        "items": {
                          "type": "integer"
                        }
                      },
                      "strength": {
                        "type": "number",
                        "minimum": -2,
                        "maximum": 2
                      },
                      "ablate": {
                        "type": "boolean"
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "steer",
                          "swap"
                        ],
                        "default": "steer"
                      },
                      "swapToken": {
                        "type": "string",
                        "description": "Target token for a swap intervention (empty for plain steers).",
                        "maxLength": 256,
                        "default": ""
                      },
                      "steerGenerated": {
                        "type": "boolean",
                        "description": "Whether the intervention was applied to generated tokens too.",
                        "default": false
                      },
                      "inputTokenIds": {
                        "type": "array",
                        "description": "Full token-id sequence of the steered run.",
                        "minItems": 1,
                        "maxItems": 4096,
                        "items": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "modelId": "gemma-3-12b",
                "prompt": "The capital of France is",
                "topN": 8,
                "temperature": 0,
                "numCompletionTokens": 3,
                "activeLensModeTab": "JACOBIAN_LENS",
                "hideNonWordTokens": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The shared run was created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The share id."
                    },
                    "path": {
                      "type": "string",
                      "description": "The relative path to view the shared run on Neuronpedia."
                    },
                    "url": {
                      "type": "string",
                      "description": "The S3 url of the stored run data."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON body or validation error."
          },
          "413": {
            "description": "The shared run exceeds the maximum upload size."
          },
          "429": {
            "description": "Too many shares created from this IP address today."
          },
          "500": {
            "description": "Lens re-run failed, or uploading/saving the share failed."
          }
        }
      }
    },
    "/api/nla/completion": {
      "post": {
        "summary": "Run a Chat Completion (for NLA Analysis)",
        "tags": [
          "NLA"
        ],
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "description": "Generates an assistant response via OpenRouter using the model\nbacking the requested NLA pair, then returns the canonical\nNLA-tokenized full chat (prompt + assistant turn) so you can\naddress token positions in a follow-up `/api/nla/explain` call.\n\nProvide `messages` (chat turns). The server applies the model's\nchat template, calls OpenRouter, and tokenizes the assembled\nfull text with the same tokenizer NLA's `/explain` uses \u2014 so the\n`tokens[*].position` values you receive here are valid inputs\nto `/api/nla/explain`'s `positions` array.\n\nSee `GET /api/nla/sources` for valid `(modelId, nlaSourceId)` pairs.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "messages",
                  "completion_tokens"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "The Neuronpedia model id (e.g. `gemma-3-27b-it`). Must have an OpenRouter mapping."
                  },
                  "nlaSourceId": {
                    "type": "string",
                    "description": "Optional. NLA source id \u2014 controls which NLA server tokenizes the full chat. Defaults to a server configured for `modelId`."
                  },
                  "messages": {
                    "type": "array",
                    "description": "Chat turns. Server applies the model's chat template.",
                    "items": {
                      "type": "object",
                      "required": [
                        "role",
                        "content"
                      ],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "user",
                            "assistant"
                          ]
                        },
                        "content": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "completion_tokens": {
                    "type": "integer",
                    "description": "Max tokens to generate. Capped server-side at 512."
                  },
                  "temperature": {
                    "type": "number",
                    "description": "Sampling temperature. Default `0.7`."
                  }
                },
                "example": {
                  "modelId": "gemma-3-27b-it",
                  "nlaSourceId": "kitft-l41",
                  "messages": [
                    {
                      "role": "user",
                      "content": "What is the capital of Canada?"
                    }
                  ],
                  "completion_tokens": 32,
                  "temperature": 0.7
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chat completion plus the canonical NLA tokenization of the full chat.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "completion": {
                      "type": "string",
                      "description": "Assistant's generated text."
                    },
                    "full_text": {
                      "type": "string",
                      "description": "Chat-templated `prompt + assistant_turn` string. Pass this as `text` to `/api/nla/explain`."
                    },
                    "tokens": {
                      "type": "array",
                      "description": "NLA tokenizer's token list spanning the full chat.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "token": {
                            "type": "string"
                          },
                          "token_id": {
                            "type": "integer"
                          },
                          "position": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (missing messages, bad modelId, etc)."
          },
          "429": {
            "description": "Rate-limited. Default cap is 240 requests/hour per IP."
          }
        }
      }
    },
    "/api/nla/explain": {
      "post": {
        "summary": "Explain NLA Activations at Token Positions",
        "tags": [
          "NLA"
        ],
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "description": "Returns natural-language descriptions of the activations at the\nrequested token positions in a prompt, produced by the Natural\nLanguage Autoencoder (NLA) at a specific source (AV/AR\npair). See the `GET /api/nla/sources` for available NLA sources.\n\nProvide either `text` (a chat-templated string) OR `messages`\n(an array of `{role, content}` chat turns that the server will\ntemplate using the model's chat template).\n\nEach request may target at most 16 *new* (uncached) positions.\nPreviously-explained positions for the same `(text, modelId,\nnlaSourceId, temperature)` are served from cache and don't count\ntoward this limit.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "nlaSourceId",
                  "positions"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "The Neuronpedia model id (`gemma-3-27b-it`, `llama3.3-70b-it`, `qwen2.5-1.5b-it`)."
                  },
                  "nlaSourceId": {
                    "type": "string",
                    "description": "The NLA source id for this model (`kitft-l41` for gemma 3, `kitft-l53` for llama 70b, or `andyxu-l18` for qwen 1.5b). See `GET /api/nla/sources`."
                  },
                  "text": {
                    "type": "string",
                    "description": "Pre-chat-templated prompt string. Provide this OR `messages`. Max 16384 characters."
                  },
                  "messages": {
                    "type": "array",
                    "description": "Chat-format turns. Server applies the model's chat template. Provide this OR `text`.",
                    "items": {
                      "type": "object",
                      "required": [
                        "role",
                        "content"
                      ],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "user",
                            "assistant"
                          ]
                        },
                        "content": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "positions": {
                    "type": "array",
                    "description": "Token positions (0-indexed) to explain. Up to 16 new positions per request.",
                    "items": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "temperature": {
                    "type": "number",
                    "description": "Sampling temperature for the NLA explainer. Default `0.7`."
                  }
                },
                "example": {
                  "modelId": "gemma-3-27b-it",
                  "nlaSourceId": "kitft-l41",
                  "messages": [
                    {
                      "role": "user",
                      "content": "What is the capital of Canada?"
                    }
                  ],
                  "positions": [
                    4,
                    7,
                    9
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Explanations for the requested positions, plus the canonical token list of the prompt.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "position": {
                            "type": "integer"
                          },
                          "token": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "layer_index": {
                      "type": "integer"
                    },
                    "prompt_length": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (missing text/messages, bad positions, too many new positions, etc)."
          },
          "429": {
            "description": "Rate-limited. Default cap is 120 requests/hour per IP."
          }
        }
      }
    },
    "/api/nla/sources": {
      "get": {
        "summary": "List Available NLA Sources",
        "tags": [
          "NLA"
        ],
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "description": "Returns every `(modelId, nlaSourceId)` pair available through\n`/api/nla/explain` and `/api/nla/completion`, with public metadata\n(display name, author, layer, AR/AV ids). Use the `modelId` and\n`id` fields from this response to populate the corresponding\nrequest fields of `/api/nla/explain` and `/api/nla/completion`.\n\n`model.openRouterAvailable` indicates whether the model has an\nOpenRouter mapping (required for `/api/nla/completion`'s\ngeneration path). Sources without it can still be used for\n`/api/nla/explain` if you supply your own `text`.\n",
        "responses": {
          "200": {
            "description": "Available sources.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sources": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "modelId": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string",
                            "description": "Pass as `nlaSourceId` to explain/completion."
                          },
                          "displayName": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "author": {
                            "type": "string"
                          },
                          "av": {
                            "type": "string"
                          },
                          "ar": {
                            "type": "string"
                          },
                          "layerNum": {
                            "type": "integer"
                          },
                          "norm": {
                            "type": "number"
                          },
                          "model": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              },
                              "openRouterAvailable": {
                                "type": "boolean"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/sparsity/connected-neurons": {
      "get": {
        "tags": [
          "Sparsity"
        ],
        "summary": "Get Connected Neurons",
        "description": "Returns connected neurons from the sparsity server, along with top 2 explanations for each neuron and residual stream channel.",
        "parameters": [
          {
            "name": "modelId",
            "in": "query",
            "description": "Model ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "layer",
            "in": "query",
            "description": "Layer index",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "index",
            "in": "query",
            "description": "Neuron index",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "traceDepth",
            "in": "query",
            "description": "Depth of circuit trace (default: 1)",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "traceK",
            "in": "query",
            "description": "Top K channels/neurons per step in trace (default: 5)",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Connected neurons with explanations"
          },
          "400": {
            "description": "Missing required parameters"
          },
          "500": {
            "description": "Error fetching from sparsity server"
          }
        }
      }
    },
    "/api/steer-logits": {
      "post": {
        "summary": "Steer Graph Features (2/2) - Steer + Logits",
        "description": "Generates default and steered completions from an attribution graph prompt, returning top logits for each generated token.\nThis is equivalent to the steer button in the /circuit-tracer subgraph (bottom left). In our example, we negatively steer on a \"Texas\" feature to have the model generate \"Albany\" instead of \"Austin\".\nTo get the token positions to steer on, you first tokenize the prompt using the `/api/graph/tokenize` endpoint.\nThis endpoint currently supports only `gemma-2-2b` and `qwen3-4b`.\n",
        "tags": [
          "Attribution Graphs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "prompt",
                  "features"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "enum": [
                      "gemma-2-2b",
                      "qwen3-4b"
                    ],
                    "description": "The model id to steer. Only `gemma-2-2b` and `qwen3-4b` are supported currently. Email us if you need other models supported.",
                    "example": "gemma-2-2b"
                  },
                  "sourceSetName": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional source set name. If omitted or null, the model's default graph source set is used.",
                    "example": "gemmascope-transcoder-16k"
                  },
                  "prompt": {
                    "type": "string",
                    "description": "Prompt text to generate from.",
                    "example": "Fact: The capital of the state containing Dallas is"
                  },
                  "features": {
                    "type": "array",
                    "description": "Features to steer or ablate while generating.",
                    "items": {
                      "type": "object",
                      "required": [
                        "layer",
                        "index",
                        "token_active_position",
                        "steer_generated_tokens",
                        "ablate"
                      ],
                      "properties": {
                        "layer": {
                          "type": "integer",
                          "description": "Feature layer.",
                          "example": 14
                        },
                        "index": {
                          "type": "integer",
                          "description": "Feature index.",
                          "example": 2268
                        },
                        "token_active_position": {
                          "type": "integer",
                          "description": "Prompt token position where the feature is active.",
                          "example": 9
                        },
                        "steer_position": {
                          "type": "integer",
                          "nullable": true,
                          "description": "Token position to steer. Use null when steer_generated_tokens is true - if you want to steer both specific steer positions and generated tokens, you must use two feature entries.",
                          "example": 9
                        },
                        "steer_generated_tokens": {
                          "type": "boolean",
                          "description": "Whether to apply steering to generated tokens.",
                          "example": false
                        },
                        "delta": {
                          "type": "number",
                          "nullable": true,
                          "description": "Steering delta. Use null when ablating. In the UI, we take the top known activation value for the feature and multiply it by the multiplier on the slider to get the delta. For our example here, we are doing -1.0x steering on the feature, which has a top known activation value of about 200, so the delta is -200.",
                          "example": -200
                        },
                        "ablate": {
                          "type": "boolean",
                          "description": "Whether to ablate this feature instead of applying `delta`.",
                          "example": false
                        }
                      }
                    }
                  },
                  "nTokens": {
                    "type": "integer",
                    "description": "Number of completion tokens to generate.",
                    "minimum": 1,
                    "maximum": 256,
                    "default": 256,
                    "example": 2
                  },
                  "topK": {
                    "type": "integer",
                    "description": "Number of top logits to return per generated token.",
                    "minimum": 0,
                    "maximum": 10,
                    "default": 5,
                    "example": 1
                  },
                  "freezeAttention": {
                    "type": "boolean",
                    "description": "Whether to freeze attention during steering.",
                    "default": true,
                    "example": true
                  },
                  "temperature": {
                    "type": "number",
                    "description": "Sampling temperature.",
                    "minimum": 0,
                    "maximum": 2,
                    "default": 0.5,
                    "example": 0
                  },
                  "freqPenalty": {
                    "type": "number",
                    "description": "Frequency penalty.",
                    "minimum": -2,
                    "maximum": 2,
                    "default": 1,
                    "example": 0
                  },
                  "seed": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Random seed. Use null for no fixed seed.",
                    "default": 16
                  }
                }
              },
              "example": {
                "modelId": "gemma-2-2b",
                "sourceSetName": "gemmascope-transcoder-16k",
                "prompt": "Fact: The capital of the state containing Dallas is",
                "features": [
                  {
                    "layer": 14,
                    "index": 2268,
                    "token_active_position": 9,
                    "steer_position": 9,
                    "steer_generated_tokens": false,
                    "delta": -200,
                    "ablate": false
                  }
                ],
                "nTokens": 2,
                "topK": 1,
                "freezeAttention": true,
                "temperature": 0,
                "freqPenalty": 0,
                "seed": 16
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default and steered generations with top logits by token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "DEFAULT_GENERATION": {
                      "type": "string",
                      "description": "Unsteered generated text."
                    },
                    "STEERED_GENERATION": {
                      "type": "string",
                      "description": "Steered generated text."
                    },
                    "DEFAULT_LOGITS_BY_TOKEN": {
                      "type": "array",
                      "description": "Top logits for each unsteered generated token.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "token": {
                            "type": "string",
                            "description": "Generated token."
                          },
                          "top_logits": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "prob": {
                                  "type": "number",
                                  "description": "Token probability."
                                },
                                "token": {
                                  "type": "string",
                                  "description": "Candidate token."
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "STEERED_LOGITS_BY_TOKEN": {
                      "type": "array",
                      "description": "Top logits for each steered generated token.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "token": {
                            "type": "string",
                            "description": "Generated token."
                          },
                          "top_logits": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "prob": {
                                  "type": "number",
                                  "description": "Token probability."
                                },
                                "token": {
                                  "type": "string",
                                  "description": "Candidate token."
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or missing source set."
          }
        }
      }
    },
    "/api/activation/new": {
      "post": {
        "summary": "Feature Activation for Text",
        "description": "Gets activation values for a given feature when processing custom input text. Equivalent to going to a feature page and entering custom text. The example shows this feature https://neuronpedia.org/gpt2-small/9-res-jb/200",
        "tags": [
          "Activations"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "feature",
                  "customText"
                ],
                "properties": {
                  "feature": {
                    "type": "object",
                    "properties": {
                      "modelId": {
                        "description": "The model the feature is in.",
                        "type": "string",
                        "required": true,
                        "default": "gpt2-small"
                      },
                      "source": {
                        "description": "The SAE ID the feature is in.",
                        "type": "string",
                        "required": true,
                        "default": "9-res-jb"
                      },
                      "index": {
                        "description": "The index of the feature.",
                        "type": "string",
                        "required": true,
                        "default": "200"
                      }
                    }
                  },
                  "customText": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "The custom text to process. Either a single string or an array of strings.",
                    "required": true,
                    "default": "Hello world"
                  },
                  "ignoreBos": {
                    "type": "boolean",
                    "description": "When true, omits the leading beginning-of-sequence token (and its activation value) from the result.",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response, with activation data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferenceActivationResultSingle"
                }
              }
            }
          },
          "400": {
            "description": "Bad request, missing or invalid input"
          },
          "401": {
            "description": "Unauthorized, user doesn't have access to the model or SAE set"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/activation/source": {
      "post": {
        "summary": "All Feature Activations in a Source/SAE",
        "description": "Gets activation values for all features in a source/SAE when processing custom input text(s). It returns the activations and tokenized prompts only, without any of the dashboards or explanations.",
        "tags": [
          "Activations"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "source",
                  "customText"
                ],
                "properties": {
                  "modelId": {
                    "description": "The model the source is in.",
                    "type": "string",
                    "required": true,
                    "default": "gpt2-small"
                  },
                  "source": {
                    "description": "The source/SAE ID.",
                    "type": "string",
                    "required": true,
                    "default": "9-res-jb"
                  },
                  "customText": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "The custom text to process. Either a single string or an array of strings. If it's a single string, the max is a 1024 token text. If it's an array, the max is 4 strings of 256 tokens max each.",
                    "required": true,
                    "default": "Hello world"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response, with activation data"
          },
          "400": {
            "description": "Bad request, missing or invalid input"
          },
          "401": {
            "description": "Unauthorized, user doesn't have access to the model or SAE set"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/bookmark/add": {
      "post": {
        "summary": "Add Bookmark",
        "description": "Adds a bookmark for a specific feature to the authenticated user's bookmarks.",
        "tags": [
          "Bookmarks"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "layer",
                  "index"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "The ID of the model the feature belongs to"
                  },
                  "layer": {
                    "type": "string",
                    "description": "The layer of the feature"
                  },
                  "index": {
                    "type": "string",
                    "description": "The index of the feature"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully added bookmark"
          }
        }
      }
    },
    "/api/bookmark/delete": {
      "post": {
        "summary": "Delete Bookmark",
        "description": "Deletes a bookmark for a specific feature from the authenticated user's bookmarks.",
        "tags": [
          "Bookmarks"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "layer",
                  "index"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "The ID of the model the feature belongs to"
                  },
                  "layer": {
                    "type": "string",
                    "description": "The layer of the feature"
                  },
                  "index": {
                    "type": "string",
                    "description": "The index of the feature"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully deleted bookmark"
          }
        }
      }
    },
    "/api/explanation/generate": {
      "post": {
        "summary": "Auto-Interp - Generate",
        "description": "Generates an explanation for a specific feature using the specified explanation type and model. IMPORTANT- this requires you to set your OpenAI/Anthropic/Google auto-interp API keys under Neuronpedia Settings.",
        "tags": [
          "Explanations"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "layer",
                  "index",
                  "explanationType",
                  "explanationModelName"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "The ID of the model the feature belongs to"
                  },
                  "layer": {
                    "type": "string",
                    "description": "The layer of the feature"
                  },
                  "index": {
                    "type": "number",
                    "description": "The index of the feature"
                  },
                  "explanationType": {
                    "type": "string",
                    "description": "The type of explanation to generate. Currently supported types are \"oai_attention-head\" and \"oai_token-act-pair\"."
                  },
                  "explanationModelName": {
                    "type": "string",
                    "description": "The name of the model to use for generating the explanation. See full list of supported models in the auto-interpdropdown on a Neuronpedia dashboard: https://neuronpedia.org/gpt2-small/8-res-jb/55"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully generated explanation"
          }
        }
      }
    },
    "/api/explanation/score": {
      "post": {
        "summary": "Auto-Interp - Score",
        "description": "Scores an explanation using a specified scoring model and method. IMPORTANT- Your account needs to have an active OpenRouter and/or OpenAI/Gemini/Anthropic key to do this, which you can set up at `https://www.neuronpedia.org/account` once logged in.",
        "tags": [
          "Explanations"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "explanationId",
                  "scorerModel",
                  "scorerType"
                ],
                "properties": {
                  "explanationId": {
                    "type": "string",
                    "description": "The ID of the explanation to score. You can get the explanationId from the Get Feature endpoint `/api/feature/{modelId}/{layer}/{index}` - it's in the `explanations` array in the response."
                  },
                  "scorerModel": {
                    "type": "string",
                    "description": "The model to use for scoring (e.g., `gpt-4o-mini`, `gemini-1.5-flash`, etc). You can see the full list of supported models on any feature dashboard page in the auto-interp dropdown.",
                    "example": "gpt-4o-mini"
                  },
                  "scorerType": {
                    "type": "string",
                    "description": "The type of scoring method to use (recall_alt, eleuther_fuzz, eleuther_recall, or eleuther_embedding)",
                    "example": "recall_alt"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully scored the explanation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "score": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Unique identifier for the score"
                        },
                        "initiatedByUserId": {
                          "type": "string",
                          "description": "ID of the user who initiated the scoring"
                        },
                        "value": {
                          "type": "number",
                          "description": "The calculated score value, from 0 to 1."
                        },
                        "explanationId": {
                          "type": "string",
                          "description": "ID of the explanation that was scored"
                        },
                        "explanationScoreTypeName": {
                          "type": "string",
                          "description": "The scoring method used (e.g., recall_alt)"
                        },
                        "explanationScoreModelName": {
                          "type": "string",
                          "description": "The model used for scoring (e.g., gpt-4o-mini)"
                        },
                        "jsonDetails": {
                          "type": "string",
                          "description": "The scoring details, as a JSON string. This is a different format depending on the explanationScoreType used."
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Timestamp when the score was created"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request (invalid input, duplicate score, or missing OpenRouter key)"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/explanation/search-all": {
      "post": {
        "tags": [
          "Explanations"
        ],
        "summary": "Search All Features",
        "security": [
          {
            "apiKey": []
          }
        ],
        "description": "Search for explanations in all features on Neuronpedia. Takes a query and returns up to 20 results at a time.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "required": true,
                    "type": "string",
                    "description": "The search query. For example, \"new york\".",
                    "default": "new york"
                  },
                  "offset": {
                    "type": "number",
                    "description": "Optional. The offset for pagination.",
                    "default": 0
                  }
                },
                "example": {
                  "query": "golden retrievers"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request": {
                      "type": "object",
                      "properties": {
                        "modelId": {
                          "required": true,
                          "type": "string"
                        },
                        "layers": {
                          "items": {
                            "required": true,
                            "type": "string"
                          }
                        },
                        "query": {
                          "required": true,
                          "type": "string"
                        },
                        "offset": {
                          "type": "number"
                        }
                      }
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": null
                      }
                    },
                    "resultsCount": {
                      "type": "number"
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextOffset": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/explanation/search-model": {
      "post": {
        "summary": "Search by Model",
        "tags": [
          "Explanations"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "description": "Search for explanations within a specific model. Takes a query and returns up to 20 results at a time.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "query"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "The ID of the model to search within."
                  },
                  "query": {
                    "type": "string",
                    "description": "The search query (minimum 3 characters)."
                  },
                  "offset": {
                    "type": "number",
                    "description": "Optional. The offset for pagination."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response"
          }
        }
      }
    },
    "/api/explanation/search-release": {
      "post": {
        "summary": "Search by Release",
        "tags": [
          "Explanations"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "description": "Search for explanations within a specific release. Takes a query and returns up to 20 results at a time.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "releaseName",
                  "query"
                ],
                "properties": {
                  "releaseName": {
                    "type": "string",
                    "description": "The name of the release to search within."
                  },
                  "query": {
                    "type": "string",
                    "description": "The search query (minimum 3 characters)."
                  },
                  "offset": {
                    "type": "number",
                    "description": "Optional. The offset for pagination."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response"
          }
        }
      }
    },
    "/api/explanation/search": {
      "post": {
        "tags": [
          "Explanations"
        ],
        "summary": "Search by SAEs/Sources",
        "security": [
          {
            "apiKey": []
          }
        ],
        "description": "Search for explanations in the features of one or more SAEs/Sources in a model. Takes a query and returns up to 20 results at a time.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "modelId": {
                    "required": true,
                    "type": "string",
                    "description": "The ID of the model. For example, \"gemma-2b\".",
                    "default": "gemma-2-2b"
                  },
                  "layers": {
                    "required": true,
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "The layers / SAE IDs to search. For example, [\"0-res-jb\", \"6-res-jb\"]",
                    "default": [
                      "20-gemmascope-res-16k",
                      "21-gemmascope-res-16k"
                    ]
                  },
                  "query": {
                    "required": true,
                    "type": "string",
                    "description": "The search query. For example, \"new york\".",
                    "default": "new york"
                  },
                  "offset": {
                    "type": "number",
                    "description": "Optional. The offset for pagination.",
                    "default": 0
                  }
                },
                "example": {
                  "modelId": "gemma-2-2b",
                  "layers": [
                    "20-gemmascope-res-16k",
                    "21-gemmascope-res-16k"
                  ],
                  "query": "golden retrievers"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request": {
                      "type": "object",
                      "properties": {
                        "modelId": {
                          "required": true,
                          "type": "string"
                        },
                        "layers": {
                          "items": {
                            "required": true,
                            "type": "string"
                          }
                        },
                        "query": {
                          "required": true,
                          "type": "string"
                        },
                        "offset": {
                          "type": "number"
                        }
                      }
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": null
                      }
                    },
                    "resultsCount": {
                      "type": "number"
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextOffset": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/list/add-features": {
      "post": {
        "summary": "Add Features to List",
        "description": "Adds one or more features to an existing list.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "listId",
                  "featuresToAdd"
                ],
                "properties": {
                  "listId": {
                    "type": "string",
                    "description": "The ID of the list to add features to"
                  },
                  "featuresToAdd": {
                    "description": "The features to add to the list. Takes a max of 100 features at a time.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "modelId",
                        "layer",
                        "index"
                      ],
                      "properties": {
                        "modelId": {
                          "type": "string",
                          "description": "The ID of the model the feature belongs to"
                        },
                        "layer": {
                          "type": "string",
                          "description": "The layer of the feature"
                        },
                        "index": {
                          "type": "string",
                          "description": "The index of the feature"
                        },
                        "description": {
                          "type": "string",
                          "description": "Optional description for the feature"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully added features to the list"
          }
        }
      }
    },
    "/api/list/delete": {
      "post": {
        "summary": "Delete List",
        "description": "Deletes an existing list that you own.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "listId"
                ],
                "properties": {
                  "listId": {
                    "type": "string",
                    "description": "The ID of the list to delete"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully deleted list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean",
                  "description": "Returns true if the list was successfully deleted"
                }
              }
            }
          }
        }
      }
    },
    "/api/list/edit-feature": {
      "post": {
        "summary": "Edit List Feature",
        "description": "Updates the description of a specific feature in a list.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "listId",
                  "modelId",
                  "layer",
                  "index",
                  "description"
                ],
                "properties": {
                  "listId": {
                    "type": "string",
                    "description": "The ID of the list containing the feature"
                  },
                  "modelId": {
                    "type": "string",
                    "description": "The ID of the model the feature belongs to"
                  },
                  "layer": {
                    "type": "string",
                    "description": "The layer of the feature"
                  },
                  "index": {
                    "type": "string",
                    "description": "The index of the feature"
                  },
                  "description": {
                    "type": "string",
                    "description": "The new description for the feature"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully updated feature description"
          }
        }
      }
    },
    "/api/list/get": {
      "post": {
        "summary": "Get List Details",
        "description": "Retrieves detailed information about a specific list.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "listId"
                ],
                "properties": {
                  "listId": {
                    "type": "string",
                    "description": "The ID of the list to retrieve"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully retrieved list details"
          }
        }
      }
    },
    "/api/list/list": {
      "post": {
        "summary": "Get Lists",
        "description": "Retrieves all lists created by the authenticated user.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved user lists"
          }
        }
      }
    },
    "/api/list/new-with-features": {
      "post": {
        "summary": "Create List with Features",
        "description": "Creates a new list and adds specified features to it.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "features"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The name of the new list",
                    "default": "Twitter features"
                  },
                  "description": {
                    "type": "string",
                    "description": "Optional description for the list",
                    "default": "This is a twitter list"
                  },
                  "testText": {
                    "type": "string",
                    "description": "Optional test text for the list, which will show the activations for the text for all the features in the list."
                  },
                  "features": {
                    "type": "array",
                    "description": "The features to add to the list",
                    "default": [
                      {
                        "modelId": "gpt2-small",
                        "layer": "9-res-jb",
                        "index": 1124
                      },
                      {
                        "modelId": "gpt2-small",
                        "layer": "2-att-kk",
                        "index": 10116
                      }
                    ],
                    "items": {
                      "type": "object",
                      "required": [
                        "modelId",
                        "layer",
                        "index"
                      ],
                      "properties": {
                        "modelId": {
                          "type": "string",
                          "description": "The ID of the model"
                        },
                        "layer": {
                          "type": "string",
                          "description": "The SAE ID / layer name of the feature"
                        },
                        "index": {
                          "type": "integer",
                          "description": "The index of the feature"
                        },
                        "description": {
                          "type": "string",
                          "description": "Optional description for the feature"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully created list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "description": "The URL of the newly created list"
                    },
                    "name": {
                      "type": "string",
                      "description": "The name of the created list"
                    },
                    "description": {
                      "type": "string",
                      "description": "The description of the created list"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/list/new": {
      "post": {
        "summary": "Create List",
        "description": "Creates an empty new list for the authenticated user.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The name of the new list",
                    "default": "Test List"
                  },
                  "description": {
                    "type": "string",
                    "description": "Optional description for the list",
                    "default": "This is a test list"
                  },
                  "testText": {
                    "type": "string",
                    "description": "Optional test text for the list, which will show the activations for the text for all the features in the list.",
                    "default": null
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully created list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "description": "The URL of the newly created list"
                    },
                    "name": {
                      "type": "string",
                      "description": "The name of the created list"
                    },
                    "description": {
                      "type": "string",
                      "description": "The description of the created list"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/list/remove": {
      "post": {
        "summary": "Remove Feature from List",
        "description": "Removes a specified feature from a list.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "listId",
                  "modelId",
                  "layer",
                  "index"
                ],
                "properties": {
                  "listId": {
                    "type": "string",
                    "description": "The ID of the list from which to remove the feature"
                  },
                  "modelId": {
                    "type": "string",
                    "description": "The ID of the model the feature belongs to"
                  },
                  "layer": {
                    "type": "string",
                    "description": "The layer name or SAE ID of the feature"
                  },
                  "index": {
                    "type": "string",
                    "description": "The index of the feature"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully removed feature from list"
          }
        }
      }
    },
    "/api/list/update": {
      "post": {
        "summary": "Update List Metadata",
        "description": "Updates an existing list's metadata.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "listId",
                  "name"
                ],
                "properties": {
                  "listId": {
                    "type": "string",
                    "description": "The ID of the list to update"
                  },
                  "name": {
                    "type": "string",
                    "description": "The new name for the list"
                  },
                  "description": {
                    "type": "string",
                    "description": "The new description for the list"
                  },
                  "defaultTestText": {
                    "type": "string",
                    "description": "Optional new default test text for the list"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully updated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "description": "The URL of the newly created list"
                    },
                    "name": {
                      "type": "string",
                      "description": "The updated name of the list"
                    },
                    "description": {
                      "type": "string",
                      "description": "The updated description of the list"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/model/new": {
      "post": {
        "summary": "Create a new model",
        "description": "Creates a new model with the specified parameters. Requires authentication.",
        "tags": [
          "Models"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "layers"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 32,
                    "pattern": "^[a-z][a-z0-9.-]*[a-z0-9]$|^[a-z]$",
                    "description": "Unique model identifier. Must start with lowercase letter, contain only lowercase letters, digits, hyphens, and periods, and not end with hyphen or period.",
                    "example": "gpt2-new"
                  },
                  "layers": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 127,
                    "description": "Number of layers in the model",
                    "example": 12
                  },
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Human-readable display name for the model",
                    "example": "GPT-2 New"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "nullable": true,
                    "description": "Optional URL for the model's website or documentation",
                    "example": "https://huggingface.co/gpt2"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Model created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The created model's ID"
                    },
                    "message": {
                      "type": "string",
                      "description": "Success message"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - validation error or model already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Error message"
                    },
                    "path": {
                      "type": "string",
                      "description": "Field path that caused the validation error (if applicable)"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - authentication required"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/search-all": {
      "post": {
        "summary": "Top Features for Entire Text",
        "description": "Returns the top features for a given text input. Equivalent to the https://neuronpedia.org/search functionality. Contact us to increase your rate limit for free if you hit it.",
        "tags": [
          "Search via Inference"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "modelId": {
                    "description": "The model to search.",
                    "type": "string",
                    "required": true,
                    "default": "gpt2-small"
                  },
                  "sourceSet": {
                    "description": "The SAE set to search.",
                    "type": "string",
                    "required": true,
                    "default": "res-jb"
                  },
                  "text": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "The custom text to run through the model. Either a single string or an array of strings.",
                    "required": true,
                    "default": "hello world"
                  },
                  "selectedLayers": {
                    "description": "The SAE IDs to search. Use [] to search all SAEs in this SAE set.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "default": [
                      "6-res-jb"
                    ]
                  },
                  "sortIndexes": {
                    "description": "The token(s) to sort by. Specify multiple to sort by the sum of the selected tokens. Use [] to sort by max activation of any token (default behavior). In this \"hello world\" example, a <|endoftext|> is automatically prepended, so sorting by index 1 means we sort by token \" hello\".",
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "default": [
                      1
                    ]
                  },
                  "ignoreBos": {
                    "description": "Don't return results where the top token activation is the BOS token.",
                    "type": "boolean",
                    "default": true
                  },
                  "densityThreshold": {
                    "description": "Don't return features with a density greater than this threshold. Should be between 0 and 1. -1 means no threshold (default).",
                    "type": "number",
                    "default": -1
                  },
                  "numResults": {
                    "description": "The max number of results to return. May return fewer if density threshold is used. Max is 100.",
                    "type": "number",
                    "default": 50
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful search with results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tokens": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "result": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "modelId": {
                            "type": "string"
                          },
                          "layer": {
                            "type": "string"
                          },
                          "index": {
                            "type": "string"
                          },
                          "values": {
                            "type": "array",
                            "items": {
                              "type": "number"
                            }
                          },
                          "maxValue": {
                            "type": "number"
                          },
                          "maxValueIndex": {
                            "type": "number"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body or missing search text."
          },
          "500": {
            "description": "Internal server error during the search process."
          }
        }
      }
    },
    "/api/search-topk-by-token": {
      "post": {
        "summary": "Top Features for Text by Token",
        "tags": [
          "Search TopK by Token"
        ],
        "description": "Returns the top-k activating features for each token in the provided text",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "source",
                  "text"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "ID of the model to search",
                    "maxLength": 50,
                    "example": "gpt2-small"
                  },
                  "source": {
                    "type": "string",
                    "description": "Source name to search",
                    "maxLength": 50,
                    "example": "6-res-jb"
                  },
                  "text": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "Text to analyze",
                    "maxLength": 1000,
                    "example": "The quick brown fox jumps over the lazy dog"
                  },
                  "numResults": {
                    "type": "number",
                    "description": "Number of top features to return per token",
                    "minimum": 1,
                    "maximum": 20,
                    "default": 10,
                    "example": 10
                  },
                  "ignoreBos": {
                    "type": "boolean",
                    "description": "Whether to omit sequence-boundary tokens (beginning-of-sequence and end-of-sequence) and their features from the results",
                    "default": true,
                    "example": true
                  },
                  "densityThreshold": {
                    "type": "number",
                    "description": "Filter features by density threshold (0-1)",
                    "minimum": 0,
                    "maximum": 1,
                    "default": 0.01,
                    "example": 0.01
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response with top-k activations by token"
          },
          "400": {
            "description": "Bad request, validation error"
          }
        }
      }
    },
    "/api/steer-chat": {
      "post": {
        "tags": [
          "Steering"
        ],
        "summary": "Steer With SAE Features (Chat)",
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "description": "Given chat messages and a set of SAE features, steer a model to generate both its default and steered chat completions, as well as logprobs for each generated token. This is for chat, not completions.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "example": {
                  "defaultChatMessages": [
                    {
                      "role": "user",
                      "content": "hi"
                    }
                  ],
                  "steeredChatMessages": [
                    {
                      "role": "user",
                      "content": "hi"
                    }
                  ],
                  "modelId": "gemma-2-9b-it",
                  "features": [
                    {
                      "modelId": "gemma-2-9b-it",
                      "layer": "9-gemmascope-res-131k",
                      "index": 62610,
                      "strength": 48
                    }
                  ],
                  "temperature": 0.5,
                  "n_tokens": 48,
                  "seed": 16,
                  "strength_multiplier": 4,
                  "steer_special_tokens": true,
                  "steer_method": "SIMPLE_ADDITIVE"
                },
                "properties": {
                  "defaultChatMessages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "role",
                        "content"
                      ],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "user",
                            "assistant",
                            "system",
                            "model"
                          ]
                        },
                        "content": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "steeredChatMessages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "role",
                        "content"
                      ],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "user",
                            "assistant",
                            "system",
                            "model"
                          ]
                        },
                        "content": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "modelId": {
                    "type": "string"
                  },
                  "features": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "modelId",
                        "layer",
                        "index",
                        "strength"
                      ],
                      "properties": {
                        "modelId": {
                          "type": "string"
                        },
                        "layer": {
                          "type": "string"
                        },
                        "index": {
                          "type": "number"
                        },
                        "strength": {
                          "type": "number"
                        }
                      }
                    }
                  },
                  "temperature": {
                    "type": "number"
                  },
                  "n_tokens": {
                    "type": "number"
                  },
                  "seed": {
                    "type": "number"
                  },
                  "strength_multiplier": {
                    "type": "number"
                  },
                  "steer_special_tokens": {
                    "type": "boolean"
                  },
                  "steer_method": {
                    "type": "string",
                    "enum": [
                      "SIMPLE_ADDITIVE",
                      "ORTHOGONAL_DECOMP"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful steering response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "default": {
                      "type": "object",
                      "properties": {
                        "raw": {
                          "type": "string"
                        },
                        "chat_template": {
                          "type": "array"
                        }
                      }
                    },
                    "steered": {
                      "type": "object",
                      "properties": {
                        "raw": {
                          "type": "string"
                        },
                        "chat_template": {
                          "type": "array"
                        }
                      }
                    },
                    "id": {
                      "type": "string"
                    },
                    "shareUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/steer": {
      "post": {
        "tags": [
          "Steering"
        ],
        "summary": "Steer With SAE Features (Non-Chat)",
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "description": "Given a prompt and a set of SAE features, steer a model to generate both its default and steered text, as well as logprobs for each generated token. This is for completions, not chat.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "example": {
                  "prompt": "The most iconic structure on Earth is",
                  "modelId": "gemma-2-2b",
                  "features": [
                    {
                      "modelId": "gemma-2-2b",
                      "layer": "20-gemmascope-res-16k",
                      "index": 3124,
                      "strength": 38.5
                    }
                  ],
                  "temperature": 0.5,
                  "n_tokens": 48,
                  "seed": 16,
                  "strength_multiplier": 4,
                  "steer_method": "SIMPLE_ADDITIVE"
                },
                "properties": {
                  "prompt": {
                    "type": "string"
                  },
                  "modelId": {
                    "type": "string"
                  },
                  "features": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "modelId",
                        "layer",
                        "index",
                        "strength"
                      ],
                      "properties": {
                        "modelId": {
                          "type": "string"
                        },
                        "layer": {
                          "type": "string"
                        },
                        "index": {
                          "type": "number"
                        },
                        "strength": {
                          "type": "number"
                        }
                      }
                    }
                  },
                  "temperature": {
                    "type": "number"
                  },
                  "n_tokens": {
                    "type": "number"
                  },
                  "seed": {
                    "type": "number"
                  },
                  "strength_multiplier": {
                    "type": "number"
                  },
                  "steer_method": {
                    "type": "string",
                    "enum": [
                      "SIMPLE_ADDITIVE",
                      "ORTHOGONAL_DECOMP"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": null
          }
        }
      }
    },
    "/api/vector/delete": {
      "post": {
        "summary": "Delete Vector",
        "description": "Deletes an existing vector on Neuronpedia. You can only delete vectors you created.",
        "tags": [
          "Vectors"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "source",
                  "index"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "ID of the model"
                  },
                  "source": {
                    "type": "string",
                    "description": "Source identifier for the vector"
                  },
                  "index": {
                    "type": "string",
                    "description": "Index of the vector to delete"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Vector deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/vector/get": {
      "post": {
        "summary": "Get Vector Details",
        "description": "Returns details for a specific vector by model ID, source and index",
        "tags": [
          "Vectors"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "source",
                  "index"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "ID of the model"
                  },
                  "source": {
                    "type": "string",
                    "description": "Source/layer identifier"
                  },
                  "index": {
                    "type": "string",
                    "description": "Vector index"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Vector details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "vector": {
                      "type": "object",
                      "properties": {
                        "modelId": {
                          "type": "string"
                        },
                        "layer": {
                          "type": "string"
                        },
                        "index": {
                          "type": "string"
                        },
                        "vectorLabel": {
                          "type": "string"
                        },
                        "vectorDefaultSteerStrength": {
                          "type": "number"
                        },
                        "hookName": {
                          "type": "string"
                        },
                        "vector": {
                          "type": "array",
                          "items": {
                            "type": "number"
                          }
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/vector/list-owned": {
      "post": {
        "summary": "List User's Vectors",
        "description": "Returns all vectors owned by the authenticated user",
        "tags": [
          "Vectors"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "List of user's vectors",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "vectors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "modelId": {
                            "type": "string"
                          },
                          "layer": {
                            "type": "string"
                          },
                          "index": {
                            "type": "string"
                          },
                          "vectorLabel": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "vectorDefaultSteerStrength": {
                            "type": "number"
                          },
                          "hookName": {
                            "type": "string"
                          },
                          "vector": {
                            "type": "array",
                            "items": {
                              "type": "number"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/vector/new": {
      "post": {
        "summary": "Create Vector",
        "description": "Creates a new vector to store on Neuronpedia",
        "tags": [
          "Vectors"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "modelId",
                  "layerNumber",
                  "hookType",
                  "vector",
                  "vectorDefaultSteerStrength",
                  "vectorLabel"
                ],
                "properties": {
                  "modelId": {
                    "type": "string",
                    "description": "ID of the model"
                  },
                  "layerNumber": {
                    "type": "number",
                    "description": "Layer number in the model (0-based)"
                  },
                  "hookType": {
                    "type": "string",
                    "description": "Hook type. Currently only \"resid-pre\" and \"resid-post\" are supported.",
                    "enum": [
                      "resid-pre",
                      "resid-post"
                    ]
                  },
                  "vector": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 24576,
                    "description": "The vector's values. Must match the model's dimension."
                  },
                  "vectorDefaultSteerStrength": {
                    "type": "number",
                    "minimum": -100,
                    "maximum": 100,
                    "description": "Default steering strength (-100 to 100)."
                  },
                  "vectorLabel": {
                    "type": "string",
                    "description": "Label/name for the vector"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Vector created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "id": {
                      "type": "object",
                      "properties": {
                        "modelId": {
                          "type": "string"
                        },
                        "source": {
                          "type": "string"
                        },
                        "index": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "tags": []
}