Python SDK for the Meyka AI Chatbot API
Project description
Meyka AI Python SDK
Python SDK for the Meyka AI Stock Market Chatbot API. Access GPT, Claude, and DeepSeek models with streaming support.
Installation
pip install meyka-sdk
For async support:
pip install meyka-sdk[async]
Quick Start
from meyka_sdk import MeykaClient
client = MeykaClient("your_api_key")
# Quick one-liner
response = client.quick_chat("What is the capital of France?")
print(response)
# Or with a chat session
chat = client.create_chat(model="gpt-4o-mini")
response = client.send_message(chat.id, "Analyze Tesla stock")
print(response.ai_message)
Features
- Multiple AI models (GPT, Claude, DeepSeek)
- Streaming responses
- Custom system prompts
- Extended thinking mode
- Usage and billing tracking
- Sync and async clients
Available Models
OpenAI
gpt-4o-mini(default) - Cost-effective for everyday tasksgpt-4o- Multimodal GPT-4gpt-4-turbo- Extended contextgpt-4- Advanced reasoninggpt-3.5-turbo- Fast and efficientgpt-5- Latest with thinking capabilities
Anthropic (Claude)
claude-sonnet-4-5-20250929- 1M token contextclaude-opus-4-1-20250805- Most capableclaude-3-5-sonnet-20241022- Balancedclaude-3-5-haiku-20241022- Fastclaude-haiku-4-5-20251001- Latest Haiku
DeepSeek
deepseek-chat- General chat with toolsdeepseek-reasoner- Chain-of-thought reasoning
Usage Examples
Basic Chat
from meyka_sdk import MeykaClient
client = MeykaClient("your_api_key")
# Create a chat session
chat = client.create_chat(model="claude-3-5-sonnet-20241022")
# Send a message
response = client.send_message(chat.id, "Explain quantum computing")
print(response.ai_message)
# Check token usage
print(f"Tokens used: {response.metadata.tokens.ai_message}")
print(f"Cost: ${response.metadata.billing.total_cost}")
Streaming Responses
from meyka_sdk import MeykaClient
client = MeykaClient("your_api_key")
chat = client.create_chat()
for chunk in client.send_message_stream(chat.id, "Write a poem about AI"):
if chunk.content:
print(chunk.content, end="", flush=True)
if chunk.event_type == "hint":
print(f"\n[Tool: {chunk.content}]")
if chunk.event_type == "reasoning":
print(f"\n[Thinking: {chunk.content}]")
Custom System Prompt
response = client.send_message(
chat_id=chat.id,
content="Analyze AAPL",
system_prompt="You are a professional financial advisor specializing in tech stocks.",
company_name="My Company"
)
Extended Thinking Mode
For models that support it (Claude Sonnet 4.5, DeepSeek Reasoner):
chat = client.create_chat(model="deepseek-reasoner")
response = client.send_message(
chat.id,
"Solve this complex math problem...",
enable_thinking=True
)
Async Client
import asyncio
from meyka_sdk import AsyncMeykaClient
async def main():
async with AsyncMeykaClient("your_api_key") as client:
chat = await client.create_chat()
response = await client.send_message(chat.id, "Hello!")
print(response.ai_message)
# Streaming
async for chunk in client.send_message_stream(chat.id, "Tell me a story"):
if chunk.content:
print(chunk.content, end="")
asyncio.run(main())
Chat Management
# List all chats
chats = client.list_chats()
for chat in chats:
print(f"{chat.id}: {chat.title}")
# Get chat details
chat = client.get_chat("chat_id")
# Update chat
chat = client.update_chat("chat_id", title="New Title")
# Get messages
messages = client.get_messages("chat_id")
for msg in messages:
print(f"{msg.role}: {msg.content[:50]}...")
# Delete chat
client.delete_chat("chat_id")
Error Handling
from meyka_sdk import (
MeykaClient,
AuthenticationError,
PaymentRequiredError,
NotFoundError,
BadRequestError,
)
client = MeykaClient("your_api_key")
try:
response = client.send_message("chat_id", "Hello")
except AuthenticationError:
print("Invalid API key")
except PaymentRequiredError as e:
print(f"Insufficient balance: {e}")
except NotFoundError:
print("Chat not found")
except BadRequestError as e:
print(f"Invalid request: {e}")
Context Manager
with MeykaClient("your_api_key") as client:
response = client.quick_chat("Hello!")
print(response)
# Session automatically closed
Response Objects
ChatResponse
response = client.send_message(chat.id, "Hello")
response.ai_message # The AI's response text
response.metadata.tokens # Token usage info
response.metadata.billing # Cost information
response.metadata.model # Model used
response.metadata.chat_id # Chat ID
StreamChunk
for chunk in client.send_message_stream(chat.id, "Hello"):
chunk.content # Text content (may be None)
chunk.event_type # "hint", "reasoning", or None
chunk.done # True for final chunk
chunk.metadata # Only in final chunk
API Reference
MeykaClient
| Method | Description |
|---|---|
list_chats() |
List all chat sessions |
create_chat(model, title) |
Create new chat |
get_chat(chat_id) |
Get chat details |
update_chat(chat_id, title, model) |
Update chat |
delete_chat(chat_id) |
Delete chat |
get_messages(chat_id) |
Get all messages |
send_message(chat_id, content, ...) |
Send message |
send_message_stream(chat_id, content, ...) |
Stream response |
quick_chat(content, model) |
One-off chat |
quick_chat_stream(content, model) |
One-off streaming |
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
meyka_sdk-1.0.0.tar.gz
(5.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file meyka_sdk-1.0.0.tar.gz.
File metadata
- Download URL: meyka_sdk-1.0.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b8be8192b805d73cf3ed325078ec85cadd7ebbc37967aace109c4c1fe268aa3
|
|
| MD5 |
96ac3fe198ecb2f2ecc108e0290a6b6c
|
|
| BLAKE2b-256 |
62156f93dbe4a682d6b8050e69892d84e8a3347c0208af177a3b38bef0e51fab
|
File details
Details for the file meyka_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: meyka_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8c5d53fcf3b83b92fecadd63ae3066ae8d3c53163e17ee6d01f2c29ae0f1464
|
|
| MD5 |
56447118d17da57a02222736ae48cc47
|
|
| BLAKE2b-256 |
67d614346469336876fa7ccb2c37faa7153126f85a9824e53c2060bf2d358972
|