Skip to content

Quickstart

Use Prism to trace assistant output back to influential context. Connect your application through the HTTP API today; agent skills with a hosted MCP connection are coming soon.

Sign in to the Strahl dashboard, create an API key, and copy the secret when it is shown. Check that your account has available credits before sending attribution requests.

Coming soon. Install Strahl’s skills and connect your agent to the hosted Prism MCP service to investigate answers and unexpected choices. Installation instructions will be added here when this workflow is available.

Set the key in your backend’s environment:

Terminal window
export STRAHL_API_KEY="your-prism-api-key"

Keep the messages your application sent to the model and append the assistant message it returned. Include the system instructions, retrieved context, tool results, and tool definitions that were part of that conversation.

Prism currently accepts text and tool calls in openai/v1/chat/completions format. Pass the message array, including the assistant output, rather than the provider’s entire response envelope. Preserve message order and the original text: attribution results refer back to positions in those strings.

Choose what to investigate:

Output Target
A claim in an answer Assistant message index, content, and the claim’s character range
A tool argument Assistant message index, function_arguments, tool-call index, and the value’s character range

Indexes start at zero. Character ranges count Unicode code points, include start, and exclude end. See target fields for the full selection format.

Use the HTTP API from your existing application. This Python function uses only the standard library; save it in your backend as prism.py:

import json
import os
from urllib.request import Request, urlopen
def attribute(conversation, target):
request = Request(
"https://strahl.ai/api/v1/attributions",
data=json.dumps({
"input": {
"format": "openai/v1/chat/completions",
"data": conversation,
"target": target,
}
}).encode("utf-8"),
headers={
"Authorization": f"Bearer {os.environ['STRAHL_API_KEY']}",
"Content-Type": "application/json",
},
method="POST",
)
with urlopen(request, timeout=120) as response:
return json.load(response)

Call it when a user selects text in your transcript viewer, or from a background review job. Here, messages is your recorded conversation and start and end are the selected range in its final assistant message:

from prism import attribute
result = attribute(
conversation={"messages": messages},
target={
"ref": {"message_index": len(messages) - 1, "field": "content"},
"span": {"start": start, "end": end},
},
)

If you captured tool definitions, include them as tools alongside messages. For a selected tool argument, use field: "function_arguments" and add tool_call_index to the reference. Select offsets in the original argument string, before pretty-printing its JSON.

Return the result to your application and display its excerpts in their returned order. Each excerpt provides:

  • ref: the original message and field containing the source.
  • text: the source passage with surrounding context.
  • highlights: influential phrases and their ranges in the original field.
  • relative_score: influence relative to other excerpts in this response.

Use effective_span to show the output range that was actually analyzed. When highlighting inside an excerpt, subtract the excerpt’s start from each highlight’s offsets to get positions within text.

The worked examples show how selected output and source highlights look together. Influence helps focus a review; it does not by itself establish that a source is true or an action is authorized.

Deploy the backend with its Prism key, then connect your application’s review UI or background jobs to it. Run attribution after the assistant output has been recorded. Request attribution for the passage being investigated rather than submitting a new request for every generated token.

Handle API failures explicitly:

Status Application behavior
400 Correct the request format, selection, or size before resubmitting.
401 Check the deployed API key; it may be missing, invalid, or revoked.
402 Check the account’s available credits.
429 Reduce concurrent requests and respect Retry-After when provided.
5xx or timeout Report that attribution is unavailable; avoid unbounded retries.

The Python function raises HTTPError for HTTP failures; handle these at your application boundary. A timeout does not establish whether the server completed the request, so an automatic retry may result in another billable analysis.

Use the dashboard to review usage and charges after deployment. The API reference covers the complete request, response, and error contract.