Skip to main content

A simple CLI for interacting with OpenAI models.

Project description

qork

A simple, beautiful CLI for asking LLMs questions from your terminal. Fast defaults, clean output, and optional conversational threading.

Highlights

  • Backend: OpenAI Responses API
  • Optional streaming output (--stream)
  • Optional global thread mode (--thread) that stores a single previous_response_id
  • Plaintext or pretty Rich output

Install

pip install qork

Prerequisites

  • Environment: OPENAI_API_KEY must be set
  • Models: you can pass -m/--model at call time; otherwise defaults apply (see below)

Quick start

  • Default (Responses API, non-streaming):
qork "Say hello in one short sentence."
  • Responses API with explicit model:
qork -m gpt-5-mini "Give me a five-word poem."
  • Presets:
qork --profile nano "Explain this in one sentence."
qork --profile high "Think carefully and give the best answer."
  • Streaming:
qork --stream "List 3 colors."
  • Plaintext output (easier to copy/paste):
qork -pt "Plain output please."
  • Debug info (tokens/cost where available):
qork -d "How many seconds in a day?"

Backends and defaults

  • Responses API (only backend)
    • Non‑streaming by default; use --stream to enable streaming
    • Default model if not specified: QORK_MODEL or gpt-5-mini

Thread mode (simple and explicit)

qork can optionally reuse a single global previous_response_id to continue one thread across invocations.

  • Enable with -t/--thread
  • State file lives at: ~/.qork/history/session.id
  • This is global and will clobber across shells (intentionally simple)
  • To reset: delete ~/.qork/history/session.id

CLI flags

  • -m, --model Set model name
  • --profile Preset: nano|mini|large|high (high sets reasoning.effort=high)
  • --stream/--no-stream Stream output tokens
  • -t, --thread Continue a single global thread (stores previous_response_id)
  • -pt, --plaintext Plain stdout (no rich panels/markdown)
  • -d, --debug Show token usage/cost when available

Python API

Call from notebooks and scripts using the same behavior as the CLI.

from qork.ask import ask

# Responses API (non-streaming)
text = ask("One short sentence.", stream=False, plaintext=True, return_text=True)

# Responses API (streaming)
text = ask("Print three facts.", stream=True, plaintext=True, return_text=True)

Parameters you’ll likely use:

  • prompt: str (required)
  • model: Optional[str]
  • stream: bool
  • plaintext: bool (stdout formatting)
  • debug: bool (token/cost info)
  • previous_response_id: Optional[str] (continue a thread)
  • return_text: bool (return text value in addition to printing)

Examples

  • Continue a single global thread:
qork -t "Start a thread in one sentence."
qork -t "Continue in one sentence."

Tests (end‑to‑end)

These tests hit live APIs (no mocks). Set your key first.

export OPENAI_API_KEY=sk-...
pytest -q tests/test_e2e_cli.py::test_cli_responses_session_persistence
pytest -q tests/test_e2e_cli.py::test_cli_plaintext_non_stream
pytest -q tests/test_e2e_cli.py::test_cli_plaintext_stream
pytest -q tests/test_e2e_python_api.py

You can select a model for tests with QORK_E2E_MODEL or rely on defaults.

Troubleshooting

  • “API key not set”: ensure OPENAI_API_KEY is exported in your shell
  • No thread carry‑over: ensure you used -t/--thread; check ~/.qork/history/session.id (delete it to reset)
  • Streaming: use --stream if you prefer incremental output

Designed for fast, accurate answers from the terminal with minimal ceremony.

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

qork-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

qork-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file qork-0.1.0.tar.gz.

File metadata

  • Download URL: qork-0.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for qork-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c498097a9ef571fc0a84d39682edfc0c050c9eb21c7f4908eb0def1d71387a70
MD5 4a5ebf173e95c50cfb23e32c712af753
BLAKE2b-256 9ca5b4bd303fa295da0e9ba139892b404f0c375adb5ea2ea179e2b397ebd625a

See more details on using hashes here.

File details

Details for the file qork-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qork-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for qork-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 135ba81ae9f1f328f5e92f12b08c80d8d8be711e1b414cacfc549dcf636c1552
MD5 244034d025a2ef6b1432966ffed64664
BLAKE2b-256 b30b09d65fb1bae0196bcdcab9979f7e8f8d6439b0c8f08805cf951399396ba7

See more details on using hashes here.

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