Skip to main content

API

Neuronpedia has a public API for almost everything on the website. You can get features and explanations, test activations, steer, search, make graphs, run the Jacobian Lens, use NLAs, and upload data.

API reference: https://neuronpedia.org/api-doc. You can test calls in your browser.

The Neuronpedia API reference.

Before You Start​

  • Check what is available. The Available Resources page lists all models and sources in the API. Only sources with inference enabled can do steering, test activations, and search via inference.
  • Get an API key. Many GET endpoints work without a key. Endpoints that write data need a key in the x-api-key header. See Accounts.
  • Know the limits. See Rate Limits.
  • Use exports for bulk data. If you need data for many features, download the exports. Do not call the API for each feature.

Example - Get a Feature​

Add /api/feature after neuronpedia.org in any feature URL:

curl https://www.neuronpedia.org/api/feature/gemma-2-2b/20-gemmascope-res-16k/10956

The response has the feature's activations, explanations, logits, and density.

Example - Test Activations​

Get one feature's activations for your text:

curl -X POST https://www.neuronpedia.org/api/activation/new \
-H "Content-Type: application/json" \
-d '{
"feature": {"modelId": "gemma-2-2b", "source": "20-gemmascope-res-16k", "index": "10956"},
"customText": "We are committed to being your best vendor."
}'

Groups of Endpoints​

GroupWhat it does
FeaturesGet a feature or vector.
ActivationsTest one feature, or all features in a source, with your text.
ExplanationsSearch, make, and score explanations. Test the interpretable score.
Search via Inference / Search TopK by TokenFind the top features for your text.
SteeringSteer completions and chats. See Steering.
Attribution GraphsMake, upload, get, and steer graphs. Save subgraphs. See Circuit Tracing.
Jacobian LensRun prompts through the J-lens.
NLAExplain activations with NLAs.
VectorsUpload, list, and delete custom vectors.
Lists and BookmarksMake and change lists and bookmarks.
ModelsAdd a new model.

Python and TypeScript​

Questions or Requests​

Do you need a new endpoint, or a higher limit? Contact us.