summaryrefslogtreecommitdiffstats
path: root/Argcfile.sh
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2025-02-17 07:45:01 +0800
committerGitHub <noreply@github.com>2025-02-17 07:45:01 +0800
commitf14f1ad01bf31bb4bb4322661691be9392c30acf (patch)
treed704d1e5e74e083205b50523859118e951e2ecdc /Argcfile.sh
parent5efdb3c666c5f5125260bd9f116f7cc2e7ba06b1 (diff)
downloadaichat-f14f1ad01bf31bb4bb4322661691be9392c30acf.tar.gz
refactor: several improvements (#1180)
Diffstat (limited to 'Argcfile.sh')
-rwxr-xr-xArgcfile.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/Argcfile.sh b/Argcfile.sh
index 47ec38b..ea0b9c1 100755
--- a/Argcfile.sh
+++ b/Argcfile.sh
@@ -247,6 +247,21 @@ chat-claude() {
-d "$(_build_body claude "$@")"
}
+# @cmd List claude models
+# @env CLAUDE_API_KEY!
+# @flag --name-only Print model name only
+models-claude() {
+ jq_args=()
+ if [[ -n "$argc_name_only" ]]; then
+ jq_args+=(-r '.data[].id')
+ fi
+ _wrapper curl -fsSL "https://api.anthropic.com/v1/models" \
+-H 'Content-Type: application/json' \
+-H 'anthropic-version: 2023-06-01' \
+-H "x-api-key: $CLAUDE_API_KEY" \
+ | jq "${jq_args[@]}"
+}
+
# @cmd Chat with cohere api
# @env COHERE_API_KEY!
# @option -m --model=command-r-08-2024 $COHERE_MODEL
@@ -436,7 +451,7 @@ _build_body() {
_wrapper() {
if [[ "$DRY_RUN" == "true" ]] || [[ "$DRY_RUN" == "1" ]]; then
- echo "$@"
+ echo "$@" >&2
else
"$@"
fi