The London AI Cost Hackathon
Submit your hackathon entry Open the submission form →Build an AI reviewer that catches dangerous software changes. Submissions must pass the quality gate, and the lowest cost measured by Merge Gateway wins.
Official results
See who built the lowest-cost qualifying reviewer.What you are building
Your submission implements one Python function. It receives a pull-request case containing a diff, issue, repository context, CI logs, migrations, dependencies, and prior discussion. It returns an evidence-backed release review.
from costhack.schema import Case, Review
def review(case: Case) -> Review:
...
The organizer calls this function with each private case. Your function may use deterministic rules, call Merge Gateway directly, or combine both approaches. No model client is passed into your function. After the run, the organizer reads the cost recorded by Merge Gateway.
Set up the sponsor accounts
You can skip this section until you want to make live model calls. If the event gives you credentials, use those instead of creating separate ones.
Merge Gateway
- Open gateway.merge.dev/signup.
- Create an account and complete verification.
- Accept the event organization invitation if you receive one.
- Open Settings → API keys.
- Create a regular model-calling key beginning with
mg_. -
Copy the event project ID. Do not use an
mgmt_management key.
condense.chat
Start at condense.chat. There are two supported ways to use it, and you may use either or both.
Option 1: Run a coding agent through Condense
Install and sign in to the dense CLI by following the
agent setup instructions. Then
launch Codex or Claude Code through Condense:
dense codex
dense claude
This keeps the agent's normal authentication and routes its requests through the Condense proxy.
Option 2: Call models through the proxy API
Point an OpenAI-compatible client at Condense, supply your normal upstream provider key, and add your Condense token:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["OPENAI_API_KEY"],
base_url="https://api.condense.chat/openai/v1",
default_headers={
"X-Condense-Auth-Token": os.environ["CONDENSE_AUTH_TOKEN"],
},
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Review this change."}],
)
The standard OpenAI request methods continue to work. Anthropic users can follow the equivalent proxy example in the Condense quickstart.
Store credentials locally
cp .env.example .env
chmod 600 .env
Edit .env:
MERGE_GATEWAY_API_KEY=mg_replace_me
MERGE_GATEWAY_PROJECT_ID=replace_me
CONDENSE_AUTH_TOKEN=ak_replace_me
OPENAI_API_KEY=sk_replace_me
.env.
If a secret is committed, revoke it immediately. Removing it from the
latest commit does not remove it from Git history.
Install the prerequisites
You need:
- Git
- Python 3.11 or newer
- uv
Check them:
git --version
python3 --version
uv --version
Fork and clone the starter
Fork the starter repository
on GitHub and keep your fork public. Then clone your fork, replacing
YOUR-USERNAME with your GitHub username:
git clone https://github.com/YOUR-USERNAME/ai-cost-hack.git
cd ai-cost-hack
uv sync
This installs the benchmark CLI and development tools from the committed lockfile.
Run the public benchmark
uv run costhack benchmark --public
The deliberately incomplete starter should report:
NOT ELIGIBLE quality=50.0
Model cost is measured separately in Merge Gateway.
The starter catches five of ten cases. The examples demonstrate the input, output, and scoring contract without revealing the final test set.
Inspect a public case
uv run costhack inspect public-auth-delete
Read data/public_cases.json to see the complete public case
schema. Public cases include their rubrics; private cases do not.
Edit your strategy
Open submission/strategy.py. Keep the
review(case) entry point and return this shape:
{
"risk": "high",
"findings": [
{
"category": "authorization",
"severity": "high",
"file": "api/delete_project.py",
"evidence": "The project is loaded without an owner check.",
"explanation": "A user can delete another tenant's project.",
}
],
"tests": ["Cross-tenant deletion must return 403"],
"next_action": "block",
}
If you use a model, create a Merge Gateway client inside your submission and read its credentials from the environment.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["MERGE_GATEWAY_API_KEY"],
base_url="https://api-gateway.merge.dev/v1/openai",
)
response = client.chat.completions.create(
model="gpt-5.5",
messages=[
{"role": "system", "content": "Review this change."},
{"role": "user", "content": case["brief"]},
],
extra_body={"project_id": os.environ["MERGE_GATEWAY_PROJECT_ID"]},
)
There are two complete starting points:
submission/strategy.py contains the deterministic Python
rules baseline, and examples/merge_only/strategy.py contains
the GPT-5.5-through-Merge strategy.
Once quality is reliable, consider condense.chat for long, noisy cases.
Use the dense CLI with Codex or Claude Code, or call models
through Condense's supported proxy API. Scored model inference must still
appear in Merge Gateway so its cost is included in the official
measurement.
Validate your submission
uv run costhack preflight
uv run costhack benchmark --public
uv run pytest
git status --short
Confirm that .env is ignored and that your public benchmark
still passes after every strategy change.
Commit, push, and submit
git add submission pyproject.toml uv.lock
git commit -m "Submit PatchGuard strategy"
git push
Submit your public GitHub repository URL through the submission form before the cutoff.
Scoring
Scoring happens in two stages:
- Pass the quality gate. Your reviewer must catch the required dangerous changes on the private benchmark. Cost is considered only for submissions that pass.
- Rank by Merge Gateway cost. Among passing submissions, the winner is the entry with the lowest total model cost recorded by Merge Gateway while the organizer calls the submission on the official benchmark.