Quick Start
Track your first AI interaction in under 5 minutes.
Prerequisites
- An Atheon Gateway Account.
- A Project API Key (get it from the Project Settings page).
Step 1: Install
pip install atheon-codex
npm install @atheon-inc/codex
Step 2: Initialise & Track (Backend)
Call init() once at startup, then track() after every LLM call. Both are non-blocking, so your API response time is unaffected.
import os
import atheon
# Call once at application startup
atheon.init(os.environ["ATHEON_API_KEY"])
# Inside your chat handler
user_query = "How do I center a div?"
llm_output = "You can use Flexbox..."
interaction_id, prompt_hash, fingerprint = atheon.track(
provider="openai",
model_name="gpt-4o",
input=user_query,
output=llm_output,
tokens_input=14,
tokens_output=32,
finish_reason="stop",
)
# Return the payload to your frontend
return {
"reply": llm_output,
"interaction_id": str(interaction_id),
"prompt_hash": prompt_hash,
"fingerprint": fingerprint
}
import * as atheon from "@atheon-inc/codex";
// Call once at application startup.
// This awaits the security handshake.
await atheon.init({ apiKey: process.env.ATHEON_API_KEY });
// Inside your chat handler
const userQuery = "How do I center a div?";
const llmOutput = "You can use Flexbox...";
const [interactionId, promptHash, fingerprint] = atheon.track({
provider: "openai",
modelName: "gpt-4o",
input: userQuery,
output: llmOutput,
tokensInput: 14,
tokensOutput: 32,
finishReason: "stop",
});
// Return the payload to your frontend
return {
reply: llmOutput,
interaction_id: interactionId,
prompt_hash: promptHash,
fingerprint: fingerprint
};
Step 3: Render (Frontend)
Load the Atheon script. Wrap your prompt input in <atheon-input> and your LLM output in <atheon-output>, passing the backend attributes.
<script
data-atheon-publisher-key="YOUR_PUBLISHER_KEY"
src="https://js.atheon.ad/atheon.js"
defer
></script>
<atheon-input>
<textarea id="prompt-bar" placeholder="Ask a question..."></textarea>
<button data-atheon-submit>Send</button>
</atheon-input>
<atheon-output id="chat-bubble">
<div id="text-content"></div>
</atheon-output>
<script>
const { reply, interaction_id, prompt_hash, fingerprint } = backendResponse;
document.getElementById('text-content').innerText = reply;
const bubble = document.getElementById('chat-bubble');
bubble.setAttribute('interaction-id', interaction_id);
bubble.setAttribute('prompt-hash', prompt_hash);
bubble.setAttribute('fingerprint', fingerprint);
</script>
Step 4: Shut Down Gracefully
Call shutdown() when your process exits to flush any remaining queued events.
atheon.shutdown()
await atheon.shutdown();
That's it, your interaction is now tracked, fingerprinted, and visible in the Atheon Dashboard.
Next Steps
- Streaming & multi-turn flows → use
begin()/finish()so latency is measured automatically. See Server-Side Integration → - Tool & agent tracking → natively capture advanced backend behaviors. See Server-Side Integration →
- User behavior via different frontend frameworks → natively capture user interaction behaviors with framework of your choice. See Client-Side Integration →