Skip to main content
POST
/
v1
/
explainability
/
context-attributor
Get context attribution
curl --request POST \
  --url https://flow.seekr.com/v1/explainability/context-attributor \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "context": "<string>",
  "query": "<string>",
  "response": "<string>",
  "highlight": "<string>",
  "granularity": "sentence",
  "top_k": 5,
  "num_ablations": 123,
  "return_diagnostics": false
}
'
import requests

url = "https://flow.seekr.com/v1/explainability/context-attributor"

payload = {
"context": "<string>",
"query": "<string>",
"response": "<string>",
"highlight": "<string>",
"granularity": "sentence",
"top_k": 5,
"num_ablations": 123,
"return_diagnostics": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
context: '<string>',
query: '<string>',
response: '<string>',
highlight: '<string>',
granularity: 'sentence',
top_k: 5,
num_ablations: 123,
return_diagnostics: false
})
};

fetch('https://flow.seekr.com/v1/explainability/context-attributor', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://flow.seekr.com/v1/explainability/context-attributor",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'context' => '<string>',
'query' => '<string>',
'response' => '<string>',
'highlight' => '<string>',
'granularity' => 'sentence',
'top_k' => 5,
'num_ablations' => 123,
'return_diagnostics' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://flow.seekr.com/v1/explainability/context-attributor"

payload := strings.NewReader("{\n \"context\": \"<string>\",\n \"query\": \"<string>\",\n \"response\": \"<string>\",\n \"highlight\": \"<string>\",\n \"granularity\": \"sentence\",\n \"top_k\": 5,\n \"num_ablations\": 123,\n \"return_diagnostics\": false\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://flow.seekr.com/v1/explainability/context-attributor")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"context\": \"<string>\",\n \"query\": \"<string>\",\n \"response\": \"<string>\",\n \"highlight\": \"<string>\",\n \"granularity\": \"sentence\",\n \"top_k\": 5,\n \"num_ablations\": 123,\n \"return_diagnostics\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://flow.seekr.com/v1/explainability/context-attributor")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"context\": \"<string>\",\n \"query\": \"<string>\",\n \"response\": \"<string>\",\n \"highlight\": \"<string>\",\n \"granularity\": \"sentence\",\n \"top_k\": 5,\n \"num_ablations\": 123,\n \"return_diagnostics\": false\n}"

response = http.request(request)
puts response.read_body
{
  "response_text": "<string>",
  "segments": [],
  "highlight": "<string>",
  "sources": [
    {
      "id": 123,
      "text": "<string>",
      "attribution": 123,
      "offset": 123,
      "tool_name": "<string>",
      "tool_call_id": "<string>",
      "tool": {
        "url": "<string>",
        "search_query": "<string>",
        "type": "web_search",
        "title": "<string>"
      },
      "source_type": "tool_response"
    }
  ],
  "diagnostics": {
    "num_sources": 123,
    "num_ablations": 123,
    "lasso_alpha": 123,
    "mask_probability": 123,
    "y_vector_stats": {},
    "raw_coef_stats": {},
    "scaler_stats": {}
  }
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
Determines which parts of the provided context contributed to the model’s response. Attribution can be returned for a specific highlight within the response, or broken into segments across the full response. Required fields
  • context — The context text provided to the model
  • query — The user’s query or question
  • response — The model’s response to attribute
Optional fields
  • highlight — A specific portion of the response to attribute. If omitted, returns attributions for all response segments.
  • granularity — How to partition the context: sentence or paragraph
  • top_k — Number of top sources to return per segment
  • num_ablations — Number of ablation experiments to run (32–256). Auto-computed if not set.
  • return_diagnostics — If true, includes internal diagnostic information in the response. Defaults to false.

Authorizations

Authorization
string
header
required

Your Seekr API key, sent in the Authorization header with no 'Bearer' prefix.

Body

application/json

Request model for context attribution.

Computes which parts of the context contributed to the model's response using the ContextCite algorithm.

context
string
required

The context text provided to the model.

query
string
required

The user's question/query.

response
string
required

The model's response to attribute.

highlight
string | null

Specific portion of response to attribute. If None, attributes all segments.

granularity
enum<string>
default:sentence

Granularity for partitioning context: sentence or paragraph.

Available options:
sentence,
paragraph
top_k
integer
default:5

Number of top attributed sources to return per segment.

Required range: x >= 1
num_ablations
integer | null

Number of ablation experiments to run. If None, computed dynamically using O(k log d) formula. Must be between 32 and 256 (inclusive) if specified.

return_diagnostics
boolean
default:false

If True, include diagnostic information in the response.

Response

Successful Response

Response model for context attribution.

response_text
string
required

The full response text that was attributed.

segments
SegmentAttribution · object[]

Attribution results for each response segment. Populated when highlight is not provided.

highlight
string | null

The highlighted portion of the response (if provided in request).

sources
(ToolResponseSource · object | RawContextSource · object | SystemPromptSource · object)[] | null

Context sources for the highlight. Only populated when highlight is provided.

A context source that originated from a tool call.

This model contains the core attribution fields plus tool-specific metadata nested in the tool field.

diagnostics
ContextAttributionDiagnostics · object | null

Diagnostic information. Only populated when return_diagnostics=True.

Last modified on June 25, 2026