Command-line client for interacting with the Speedcode platform.
speedcode-cli lets you:
- List available problems
- Submit solutions from a single file or a JSON payload
- Check submission status
This CLI works against both:
- FastCoder-Frontend (localhost) for local development
- Speedcode (speedcode.org) for the hosted service
- Python 3.9+
- An API key (see “Authentication”)
cd speedcode-cli
pip install -e .- Sign in
- FastCoder-Frontend (local): open http://localhost:3001 and sign in
- Speedcode (hosted): open https://speedcode.org and sign in
- Get your API key (preferred: UI)
- FastCoder-Frontend: visit http://localhost:3001/keys and click “Copy”
- Speedcode: visit https://speedcode.org/keys and click “Copy”
Alternative (API, requires browser session cookie):
- FastCoder-Frontend:
GET http://localhost:3000/auth/api-key - Speedcode:
GET https://speedcode.org/api/auth/api-key
Rotate your key (UI recommended):
- UI: use the “Rotate” button on the /keys page
- API:
POST /auth/api-key/rotate(same base URLs as above)
Security:
- Your CLI config is stored at
~/.config/speedcode/config.json(override withSPEEDCODE_CONFIG_PATH). - Treat your API key like a password. Rotate immediately if exposed.
Set the API base URL and API key:
# Local FastCoder-Frontend backend
speedcode configure --base-url http://localhost:3000 --api-key <YOUR_API_KEY>
# Hosted Speedcode backend (note the /api prefix)
speedcode configure --base-url https://speedcode.org/api --api-key <YOUR_API_KEY>Notes:
- Configuration is stored at
~/.config/speedcode/config.json(or at the path set bySPEEDCODE_CONFIG_PATH). - On first run, both
--base-urland--api-keyare required. Subsequent runs require at least one.
# Pretty table (default)
speedcode problems list
# JSON output
speedcode problems list --json
# Choose columns and filter
speedcode problems list --columns const_id,title --search graph --limit 20Sample table output:
CONST_ID TITLE SHORT_DESCRIPTION
-------------- ---------------------------- -------------------------------
graph_mst Minimum Spanning Tree Build an MST over weighted graph
vector_add Vector Addition Implement vector addition kernel
Display options:
--json: machine-readable JSON list--columns: comma-separated fields (default:const_id,title,short_description)--limit: max rows--search: case-insensitive filter onconst_id/title--no-header: hide header--truncate: truncate long fields (default 60;0disables)
Fetch details for a specific problem: allowed files, inputs, README, and optional file contents.
# Summary view
speedcode problems get graph_mst
# Print README
speedcode problems get graph_mst --readme
# Show competitor-visible files (truncated)
speedcode problems get graph_mst --files --truncate 300
# Download competitor-visible files to ./problem-files
speedcode problems get graph_mst --download --out-dir ./problem-files
# Restrict to specific file paths
speedcode problems get graph_mst --files --only solution.cpp --only include/helpers.hpp
# Full JSON descriptor
speedcode problems get graph_mst --jsonOptions:
--json: output full JSON--readme: print README/description--files: print competitor-visible file contents--truncate N: truncate long file contents (default 200;0disables)--download: write competitor-visible files to disk--out-dir DIR: directory used with--download(default:.)--only PATH: restrict to specific file paths (repeatable)
For problems where competitors submit a single file (e.g., solution.cpp):
speedcode submit-file \
--problem-id graph_mst \
--file /path/to/solution.cpp \
--input small \
--target correctnessOptions:
--problem-id: problemconst_id--file: local path to your modified file--path-in-problem: destination path within the problem (default:solution.cpp)--input: one or more input targets (repeatable)--target: one or more targets (correctness,benchmark,cilkscale,cilksan,perf-profiler)
Returns a token you can use to check status.
speedcode submit submission.jsonExample file (exercise submission):
{
"submission_type": "exercise",
"problem_id": "graph_mst",
"submission": {
"targets": ["correctness"],
"input_targets": ["small"],
"modified_files": [
{ "path": "solution.cpp", "content": "<base64>", "encoding": "base64" }
]
}
}speedcode status <TOKEN>Prints the combined response for your submission.
Configure
speedcode configure --base-url <URL> --api-key <KEY>- First run requires both flags; later runs require at least one
Problems
speedcode problems list [--json] [--columns ...] [--limit N] [--search Q] [--no-header] [--truncate N]speedcode problems get <ID> [--json] [--readme] [--files] [--truncate N] [--download] [--out-dir DIR] [--only PATH]
Submit
speedcode submit-file --problem-id <ID> --file <PATH> --input <TARGET> [--target correctness ...] [--path-in-problem solution.cpp]speedcode submit <FILE.json>
Status
speedcode status <TOKEN>
- 401 Unauthorized: Verify your API key (rotate if needed) and base URL.
- Hosted base URL must include
/api(e.g.,https://speedcode.org/api). - Problem list shows empty: ensure you’re authenticated with a valid key.
- Local vs Hosted base URLs:
- FastCoder-Frontend: http://localhost:3000
- Speedcode (hosted): https://speedcode.org/api
- Keep your API key secret. Rotate it if you suspect it's been exposed.
speedcode --help
speedcode problems --help
speedcode submit-file --helpspeedcode-cli
Command-line client for interacting with the Speedcode platform.
Installation (local development)
cd /home/ubuntu/speedcode-dev/speedcode-cli
pip install -e .Ensure your backend API server is running and accessible.
Configure
speedcode configure --base-url http://localhost:3000 --api-key <YOUR_API_KEY>- Obtain an API key from the web UI (/get_api_key) while logged in, or via curl with an authenticated session.
- The CLI stores configuration at ~/.config/speedcode/config.yaml.
Submit
Prepare a submission file (JSON) describing the exercise submission using speedcode-models structures. Example:
{
"problem_id": "my-problem-const-id",
"submission": {
"targets": ["correctness"],
"input_targets": ["small"],
"modified_files": [
{"path": "solution.cpp", "content": "<base64>", "encoding": "base64"}
]
}
}Submit:
speedcode submit submission.jsonThe command prints a polling token.
Status
speedcode status <TOKEN>Prints the combined response for the submission.