fake_api
Tool
tools/llm/fake_api.py(program, Models). A stand-in for the Claude API and the claude command, so the tests spend nothing.
Run it with ./gameframe run fake_api ARGS or python3 tools/llm/fake_api.py. Source on GitHub.
Its own help
This is the help text in the tool itself, as ./gameframe tool fake_api prints it.
text
A stand-in for the Claude API and the claude command, so the tests spend nothing.
Usage:
fake_api.py serve PORTFILE serve on a free port on 127.0.0.1 and write the port to
PORTFILE; point GAMEFRAME_LLM_ENDPOINT at it
fake_api.py claude ARGS... act as `claude -p --output-format json`: print a JSON result
The server answers POST /v1/messages, and creates, reports and returns Message Batches
(every batch has ended at once). Under a JSON schema (output_config.format) the answer fills
the schema: each string is "fake_<property>", each enum its first value, each number 0 and each
boolean true. Otherwise it echoes
the start of the last user message. The claude mode answers "fake run: " and the start of the
prompt (read from stdin) and the number of CLAUDE* variables it was given, with a cost of 0.01. It writes FAKE_ANSWER, when set, to answer.txt in the current
folder (the tests of skillcheck.py use it).
What it does not do: model anything. It checks the shape of requests only as far as the
tools need, and it keeps batches in memory until it stops.