This directory contains Bash examples for interacting with uncloseai.com's AI services using curl. Bash is perfect for quick scripts and command-line automation.
# Build the Docker image
docker build -t ai-unturf-bash languages/bash/
# Run the examples
docker run --rm ai-unturf-bash
# Make script executable
chmod +x examples.sh
# Run the examples
./examples.sh
Using curl to call the Hermes AI endpoint for general purpose conversation:
#!/bin/bash
# Hermes AI Chat - Non-Streaming
hermes_response=$(curl -s -X POST "https://hermes.ai.unturf.com/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer dummy-key" \
-d '{
"model": "adamo1139/Hermes-3-Llama-3.1-8B-FP8-Dynamic",
"messages": [{"role": "user", "content": "Give a Python Fizzbuzz solution in one line of code?"}],
"temperature": 0.5,
"max_tokens": 150
}')
# Parse response with jq (optional)
echo "$hermes_response" | jq -r '.choices[0].message.content'
Qwen is specialized for coding tasks:
#!/bin/bash
# Qwen 3 Coder - Specialized for Code
qwen_response=$(curl -s -X POST "https://qwen.ai.unturf.com/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer dummy-key" \
-d '{
"model": "hf.co/unsloth/Qwen3-Coder-30B-A3B-Instruct-GGUF:Q4_K_M",
"messages": [{"role": "user", "content": "Write a bash function to check if a port is open"}],
"temperature": 0.5,
"max_tokens": 200
}')
echo "$qwen_response" | jq -r '.choices[0].message.content'
Generate speech from text and save to a file:
#!/bin/bash
# Text-to-Speech - Save to file
curl -s -X POST "https://speech.ai.unturf.com/v1/audio/speech" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOLO" \
-d '{
"model": "tts-1",
"voice": "alloy",
"input": "Hello from Bash! Today is a wonderful day to build something people love!"
}' \
--output speech.mp3
# Check if file was created
if [ -f speech.mp3 ]; then
echo "✓ Speech file created successfully"
fi
The curl command makes HTTP POST requests to the API endpoints:
-s - Silent mode (no progress bar)-X POST - Use POST method-H - Add HTTP headers (Content-Type, Authorization)-d - Send JSON data in request body--output - Save response to file (for TTS)The $(command) syntax captures command output into a variable:
response=$(curl -s "https://api.example.com")
echo "$response"
The jq tool extracts data from JSON responses:
echo "$response" | jq -r '.choices[0].message.content'
# -r flag removes quotes from string output
apk add jq (Alpine) or apt-get install jq (Debian/Ubuntu)
apk add ca-certificates
-s flag from curl to see error messages
Try modifying the examples: