AI-powered chat, translation, sentiment, and content generation
AI conversations
100+ languages
Emotion analysis
Content creation
X-Smsly-Key-Id: sk_live_xxx
X-SMSLY-SDK-KEY: sdk_live_xxx
from smsly import SMSly
# === DUAL KEY SECURITY ===
# Two keys required (both can be in .env or embedded):
# 1. API Key - for authentication
# 2. SDK Key - for SDK validation
client = SMSly(
api_key="setup_api_your_key", # From dashboard
sdk_key="setup_sdk_your_key" # From dashboard
)
# AI Chat Completion
response = client.ai.chat([
{"role": "system", "content": "You are a helpful customer support agent."},
{"role": "user", "content": "How do I track my order?"}
])
print(response.message)
# Summarize customer feedback
summary = client.ai.summarize(
text="Long customer feedback text here...",
max_length=100
)
print(summary.text)
# Translate message
translated = client.ai.translate(
text="Hello, how can I help you?",
target_lang="es"
)
print(translated.text) # "Hola, ¿cómo puedo ayudarte?"
# Analyze sentiment
sentiment = client.ai.sentiment("I love your service!")
print(f"Sentiment: {sentiment.label}") # positive
print(f"Score: {sentiment.score}") # 0.95
# Generate marketing content
content = client.ai.generate(
prompt="Write a promotional SMS for a summer sale",
type="marketing",
max_length=160
)
print(content.text)/v1/ai/chatAI chat completion/v1/ai/summarizeSummarize text/v1/ai/translateTranslate text/v1/ai/sentimentAnalyze sentiment/v1/ai/generateGenerate content