Join our community of builders on Discord!

Verifying an Answer

Every completion is one job on the Lightchain AI network, and every response says which one:
CodeJSON
FieldIs
job_idThe job's id in the JobRegistry contract.
session_idThe session the job ran in: one of the sessions the API keeps open for your key and model, shared by whichever of your calls it served.
tx_hashThe transaction that submitted the job: sent by the API's delegate, paid from your prepaid balance.
workerThe worker that served it.
dropped_messagesOnly when the job left the conversation's oldest messages out, to stay within the server's bound on what one job carries: how many (see Limits). The job, as the worker and the disputers read it, is the conversation without them.
The object is in the JSON body of a completion, on the last chunk of a stream, and in the x-lightchain response header (the same object, as JSON). OpenAI SDKs keep unknown fields, so it is there in JavaScript as completion.lightchain (TypeScript needs a cast: the SDK's types do not know it) and in Python as completion.model_extra["lightchain"]. To read the header with the Node SDK:
CodeTYPESCRIPT

Check it on chain

CodeBASH
The transaction is also in the testnet block explorer (see Connect to Testnet).

What this proves, and what it does not

It proves that your answer came from a real job on the network: submitted and paid from your wallet, served by the named worker, and committed on chain, where the protocol's disputers sample results, re-run them and slash a worker whose answer does not hold up. It does not let you check the text you received against the committed answer yourself. The answer is committed encrypted, and the key that decrypts it is held by the API, which decrypts it for you. That is the trade-off of a drop-in API: see Custody and Trust.