Skip to main content

CLI tool to call Grok LLM

Project description

DeployVersion

grk

Use GROK API in the terminal, control input, output and profiles.

Features

  • Prompt grok using a combination of file(s) and prompt.
  • Have profiles to use different grok assistants in the same project.
  • Precisely control which files go into grok (contrast with agents).

Installation

Install with uv:

uv pip install https://github.com/wr1/grk.git

Configuration

You can create a .grkrc YAML file in the current directory to set default options. It now supports multiple profiles.

profiles:
    default:
        model: grok-4
        role: expert engineer and dev
        output: output.json
        prompt_prepend: " "
        temperature: 0.1  
    law:
        model: grok-4
        role: lawyer, expert legal scholar
        output: output.json
        prompt_prepend: ""
        temperature: 0.15
    docs:
        model: grok-4
        role: documentation-specialist
        output: output.json
        prompt_prepend: "aim for conciseness and documenting use over implementation, "
        temperature: 0.7  
brief:
    file: "design_brief.typ"
    role: "assistant"

Usage

img

Quick start

Using shorthand for fish shell.

# write project brief
echo "write a 3d finite element solver using hex8 elements, use it to model a cube with 10x10x10 elements where x,y,z span range [0,1], clamp z==0 and apply unit distributed surface stress in positive z direction at z==1, output a vtu file where stresses and displacements are added as point data to the mesh, use numpy operations for speed and a logger to print progress to stdout, use user [{name="test",email="test@example.com"}]" > README.md

# fold the project
cf 

# start session
gu codefold.json

# ask to implement
gm "please implement according to README" -o __temp.json

# unfold and install
cu __temp.json ; uv pip install -e . 

# close session
gd

# run code
hex-fem
# INFO:hex_fem.fem:Generating mesh
# INFO:hex_fem.fem:Assembling stiffness
# INFO:hex_fem.fem:Assembling forces
# INFO:hex_fem.fem:Solving system
# INFO:hex_fem.fem:Computing stresses
# INFO:hex_fem.fem:Writing output

running output

Single-Shot (One-Off) Commands

grk config init
grk config list
grk single run <input_file> <prompt> [-p <profile>]  # Note: -p is the short form for --profile

Interactive (Session-Based) Commands

grk session up <initial_file> [-p <profile>]
grk session msg <prompt> [-o <output>] [-i <input_file>]
grk session list
grk session down

In session mode, responses are postprocessed: any explanatory messages are printed to the console, and the output file is cleaned to ensure valid JSON in {'files': [...]} format (if possible).

All settings are governed by the specified profile in .grkrc. If no .grkrc exists, it uses the default profile.

Environment Variables

  • XAI_API_KEY: xAI API key (required)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grk_cli-0.2.2.tar.gz (6.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grk_cli-0.2.2-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file grk_cli-0.2.2.tar.gz.

File metadata

  • Download URL: grk_cli-0.2.2.tar.gz
  • Upload date:
  • Size: 6.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for grk_cli-0.2.2.tar.gz
Algorithm Hash digest
SHA256 91dda5919c2b2daa7c43e2563f47d827aea57adb02c6583ffdcd5a7888a028d8
MD5 05061940c1785a9f8d9b374372670600
BLAKE2b-256 fb4f08f5df36a025a8e62594caa0fdac5a799a99c5824f387289875f93eaad23

See more details on using hashes here.

Provenance

The following attestation bundles were made for grk_cli-0.2.2.tar.gz:

Publisher: publish.yml on wr1/grk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grk_cli-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: grk_cli-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for grk_cli-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 34a646dec403a5c0ed9cb181011f3e520b0824b69387d2bcbc83b4a2e8c4ad74
MD5 5434af928da1a5d3f88075fb83ffb102
BLAKE2b-256 a901afea7eeff018740cce6072395fe1ac601e0c65519d761c22af682b880749

See more details on using hashes here.

Provenance

The following attestation bundles were made for grk_cli-0.2.2-py3-none-any.whl:

Publisher: publish.yml on wr1/grk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page