Created
January 7, 2026 14:26
-
-
Save xhawk/2c6a5fb4447a65094bf92b4cf320b11c to your computer and use it in GitHub Desktop.
Add ai command to fish by adding content of this gist to ~/.config/fish/config.fish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ai | |
| set -l prompt (string join ' ' $argv) | |
| set -l payload (jq -n --arg prompt "$prompt" '{ | |
| model: "mistral-tiny", | |
| messages: [ { role: "user", content: $prompt } ], | |
| temperature: 0.5 | |
| }') | |
| echo $payload | curl -s https://api.mistral.ai/v1/chat/completions \ | |
| -H "Authorization: Bearer $MISTRAL_API_KEY" \ | |
| -H "Content-Type: application/json" \ | |
| -d @- | jq -r '.choices[0].message.content' | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment