This project has no affiliation with Mistral AI.
MistralCLI is a simple open source command-line interface (CLI) written in Rust that allows you to easily interact with the Mistral AI API.
- Rust: You can install Rust by following the instructions on the official website: https://www.rust-lang.org/learn/get-started.
Before you can interact with the API, you need to set your Mistral API key.
- Obtain a Mistral API key from the Mistral website: https://mistral.ai
- Add your API key to your shell environment. You can do this by adding the following line to your
~/.bashrc
(or~/.bash_profile
on Mac) file:export MISTRAL_API_KEY=your-api-key
- To apply the changes, either restart your shell session or run the following command:
source ~/.bashrc # or source ~/.bash_profile on Mac
- Clone the MistralCLI repository to your local machine using Git:
git clone https://github.com/aumbriac/MistralCLI
- Enter the directory:
cd MistralCLI
- Test the project locally using Cargo (Rust's package manager):
cargo run What is the meaning of life?
- Build the executable:
cargo build
- Copy the executable to a directory in your system's PATH to make it easily accessible:
- Windows: You can copy it to a directory listed in your system's
Path
environment variable, such asC:\Windows\System32
. - Mac: You can copy it to
/usr/local/bin/
using the following command:sudo cp target/release/mistral /usr/local/bin/
- Windows: You can copy it to a directory listed in your system's
Now that you have the MistralCLI installed on your system, you can use it directly from within your shell environment.
- Example usage:
mistral What is the meaning of life?
Note: mistral-tiny
is the default model, but you can use either mistral-small
or mistral-medium
by specifying an optional -m
flag with the model suffix: mistral -m medium What is the meaning of life?
This project is licensed under the MIT License - see the LICENSE.md file for details.