Skip to main content

LLM inference for power users.

Project description

LLMux

Large language model inference for power users. At the current development stage it is more or less a ChatGPT CLI/TUI.

Get started

Install

pipx install git+https://github.com/danisztls/llmux

Get an API key

Go to platform.openai.com and log-in with your OpenAI account (register if you don't have one). Click on your name initial in the top-right corner, then select "View API keys". Finally click on "Create new secret key". That's it.

You may also need to add a payment method, clicking on Billing --> Payment methods. New accounts should have some free credits, but adding a payment method may still be mandatory. For pricing, check this page.

Configure API key

There are three alternatives.

a. Export the key as an env var: export OPENAI_API_KEY="<YOUR_KEY>"

b. Create a global configuration at $XDG_CONFIG_HOME/llmux/config.yaml or a local at ./llmux.yaml:

api-key: "YOUR_KEY"

c. Use the command line option --key <YOUR_KEY>.

The configuration priority order is: Command line option > Environment variable > Local configuration file > Global configuration file.

Usage

Run llmux. Then just chat!

The number next to the prompt is the tokens used in the conversation at that point.

Use the /q command to quit and show the number of total tokens used and an estimate of the expense for that session, based on the specific model in use.

Advanced configuration

model: "gpt-3.5-turbo"
markdown: false
max_tokens: 500
temperature: 1

Models

ChatGPT CLI, by default, uses the original gpt-3.5-turbo model. In order to use other ChatGPT models, edit the model parameter in the config.yml file ore use the --model command line option. Here is a list of all the available options:

Name Pricing (input token) Pricing(output token)
gpt-3.5-turbo 0.0015 0.002
gpt-3.5-turbo-0613 0.0015 0.002
gpt-3.5-turbo-16k 0.003 0.004
gpt-4 0.03 0.06
gpt-4-0613 0.03 0.06
gpt-4-32k 0.06 0.12
gpt-4-32k-0613 0.06 0.12

Pricing is calculated as $/1000 tokens.

Check this page for the technical details of each model.

Advanced usage

Multiline input

Add the --multiline (or -ml) flag in order to toggle multi-line input mode. In this mode use Alt+Enter or Esc+Enter to submit messages.

Context

Use the --context <FILE PATH> command line option (or -c as a short version) in order to provide the model an initial context (technically a system message for ChatGPT). For example:

llmux --context notes.txt

Both absolute and relative paths are accepted. Note that this option can be specified multiple times to give multiple files for context. Example:

llmux --context notes-from-thursday.txt --context notes-from-friday.txt

Restoring previous sessions

ChatGPT CLI saves all the past conversations (including context and token usage) in $XDG_DATA_HOME/llmux. In order to restore a session the --restore <YYYYMMDD-hhmmss> (or -r) option is available. For example:

llmux --restore 20230728-162302 restores the session from the $XDG_DATA_HOME/llmux/session-20230728-162302.json file. Then the chat goes on from that point.

It is also possible to use the special value last:

llmux --restore last

In this case it restores the last chat session, without specifying the timestamp.

Note that, if --restore is set, it overwrites any --context option.

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

llmux-0.2.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

llmux-0.2.2-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llmux-0.2.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.1 Linux/6.12.6-arch1-1

File hashes

Hashes for llmux-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b02060ac76423170ef8f059af6c74f333d4b968461486c175cc2cafde94c1565
MD5 a29b664422b3b5a520757128b767ff3f
BLAKE2b-256 b6a1eca4b5c9972bcd92b11ccda243eb8cfbc9a323c104386ddb2e70b9055242

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llmux-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.1 Linux/6.12.6-arch1-1

File hashes

Hashes for llmux-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2d4cc98b57c1e0688a055d1d185613791599e3215cfe22a09f8738087a6b8ff8
MD5 0b64fd8c2d6169a3525cac9cde167c26
BLAKE2b-256 ae46ca17f52edb3c0f0101074deccebaec9d557c8d5f0215b72e2087744bb2d5

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