Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,20 @@ Install latest version from source:
pip install git+https://github.com/kharvd/gpt-cli.git
```

Or install by cloning the repository manually:
Install by cloning the repository manually:

```bash
git clone https://github.com/kharvd/gpt-cli.git
cd gpt-cli
pip install .
```

Or use with `nix`:

```bash
nix run github:kharvd/gpt-cli
```

Add the OpenAI API key to your `.bashrc` file (in the root of your home folder).
In this example we use nano, you can use any text editor.

Expand Down
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
description = "Command-line interface for ChatGPT, Claude and Bard";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};

python = pkgs.python3.withPackages (ps:
with ps; [
pydantic
anthropic
attrs
black
cohere
google-generativeai
openai
prompt-toolkit
pytest
pyyaml
rich
typing-extensions
]);
in {
devShells.default = pkgs.mkShell {
packages = [
python
pkgs.uv
];
};
packages = rec {
default = gpt-cli;
gpt-cli = pkgs.callPackage ./package.nix {};
};
});
}
55 changes: 55 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
lib,
python3Packages,
fetchFromGitHub,
python3,
}:
python3Packages.buildPythonApplication {
pname = "gpt-cli";
version = "0.3.2";
format = "pyproject";

preBuild = ''
substituteInPlace pyproject.toml \
--replace 'anthropic~=0.44.0' 'anthropic' \
--replace 'black~=24.10.0' 'black' \
--replace 'google-generativeai~=0.8.4' 'google-generativeai' \
--replace 'openai~=1.60.0' 'openai' \
--replace 'pydantic<2' 'pydantic'
'';

nativeBuildInputs = with python3.pkgs; [
pip
setuptools
wheel
];

propagatedBuildInputs = with python3.pkgs; [
anthropic
attrs
black
cohere
google-generativeai
openai
prompt-toolkit
pytest
pyyaml
rich
typing-extensions
pydantic
];

src = fetchFromGitHub {
owner = "kharvd";
repo = "gpt-cli";
rev = "08b535cb459f2f2269d8889de297f7f995d800f4";
sha256 = "sha256-Zmqhdh+XMvJ3bhW+qkQOJT3nf+8luv7aJGW6xJSPuns=";
};

meta = with lib; {
description = "Command-line interface for ChatGPT, Claude and Bard";
homepage = "https://github.com/kharvd/gpt-cli";
license = licenses.mit;
maintainers = with maintainers; [_404wolf];
};
}