qodiqa
SpecificationRun a simulation

From clone to a signed decision.

Run the gateway sandbox, sign a request, send it, then check the evidence offline.

  • Docker or npmsame gateway
  • No API keystand-in model
  • Evaluation onlynot for production

Quickstart

Four steps.

Commands are POSIX shell: on Windows use Git Bash or WSL.

  1. Get the code

    You need Git, curl and jq, plus Docker with Compose v2 (or Node.js 22+ and Docker for the npm path).

    Terminal
    git clone https://github.com/qodiqa/qodiqa-gateway.git && cd qodiqa-gateway
    Expected

    A qodiqa-gateway folder; the next command runs inside it.

    What you just proved You have the source of the real gateway. Nothing is installed or started yet.

  2. Start the sandbox

    One command builds the sandbox image and starts it, with a stand-in for the model.

    Terminal
    docker compose -f docker-compose.quickstart.yml up
    # second terminal, same folder: the throwaway signing key is in the log
    docker compose -f docker-compose.quickstart.yml logs | grep "Authorization: Bearer"
    Expected

    The gateway listens on http://127.0.0.1:3000 and is ready when curl http://127.0.0.1:3000/health answers {"status":"ok", ...}. The signing key is printed once, on a line Authorization: Bearer <key>.

    What you just proved The real enforcement pipeline runs on your machine with disposable Redis and PostgreSQL, so no provider account or key is involved.

  3. Send a signed request

    Put the key from the log in SK, ask /sign for an artifact, then send the request with it.

    Terminal
    SK=<the key from the log>
    ARTIFACT=$(curl -s -X POST localhost:3000/sign -H "Authorization: Bearer $SK" -H 'content-type: application/json' \
      -d '{"request":{"method":"POST","path":"/ai/chat","body":{"prompt":"hello"}},"payload":{"userId":"me"},"ttl":60000}' \
      | jq -c '.artifact // .' | base64 | tr -d '\n')
    curl -s -X POST localhost:3000/ai/chat -H 'content-type: application/json' -H "x-qodiqa-artifact: $ARTIFACT" -d '{"prompt":"hello"}'
    # {"decision":"EXECUTE","response":"[sandbox] hello", ...}
    Expected

    {"decision":"EXECUTE","response":"[sandbox] hello", ...}. For a BLOCK, use the prompt sandbox-block-me please in both places. A reason code instead? See the error codes.

    What you just proved The artifact is bound to this one request. The gateway verified it, checked consent and policy, recorded the decision, and only then let the stand-in model answer.

  4. Verify the evidence offline

    The public verifier uses only the Node.js standard library and trusts keys you hand it.

    Terminal · Node.js 18 or later
    git clone https://github.com/qodiqa/qodiqa-verify.git && cd qodiqa-verify
    node bin/verify.bundle.external.js \
      --keys examples/front-half/keys.json \
      --transparency-keys examples/front-half/transparency-keys.json \
      examples/front-half/bundle-with-proof.json
    # exit 0 = VALID
    Expected

    A JSON verdict with "valid": true and exit code 0. A changed field exits 1.

    What you just proved A recorded session checks out without trusting the gateway that produced it. Receipts from your own sandbox are fetched as shown in the receipt operation.

Next

Next steps

Something else in the way? The usual causes are in the repository's troubleshooting guide.

Related documents

All documents