Documentation
Everything you need to build amazing AI applications with Mollyra AI.
Introduction
Mollyra AI provides a powerful and easy-to-use API for integrating advanced AI capabilities into your applications. Our platform supports text generation, image creation, code completion, embeddings, and more.
Start with our Quick Start guide to make your first API call in under 5 minutes.
Key Features
- Multiple AI models including GPT-4, Claude 3, and our proprietary Mollyra-X
- Real-time streaming for chat applications
- High-quality image generation with DALL-E 3
- Text embeddings for semantic search and similarity matching
- Custom fine-tuning for specialized use cases
- Comprehensive SDKs for Python, Node.js, Go, and Ruby
Quick Start Guide
Get started with Mollyra AI in just a few simple steps.
Create an Account
Sign up for a free Mollyra AI account from the pricing page. No credit card required to start.
Get Your API Key
Navigate to the Dashboard and generate your API key. Keep it secure and never share it publicly.
# Your API key will look like this:
mlyra_sk_1234567890abcdefghijklmnop
Make Your First Request
Use the Python SDK or make a direct API call:
import mollyra
client = mollyra.Client("YOUR_API_KEY")
response = client.chat.completions.create(
model="gpt-4-turbo",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
Explore the Examples
Check out the API reference for pre-built examples covering common use cases.
Building Chatbots
Create intelligent chatbots with conversational memory using our Chat Completions API.
Basic Chatbot
import mollyra
client = mollyra.Client("YOUR_API_KEY")
messages = [
{"role": "system", "content": "You are a helpful customer support assistant."}
]
while True:
user_input = input("You: ")
if user_input.lower() == "exit":
break
messages.append({"role": "user", "content": user_input})
response = client.chat.completions.create(
model="gpt-4-turbo",
messages=messages
)
assistant_message = response.choices[0].message.content
messages.append({"role": "assistant", "content": assistant_message})
print(f"Assistant: {assistant_message}")
Streaming Chatbot
For a better user experience, use streaming to show responses as they are generated:
response = client.chat.completions.create(
model="gpt-4-turbo",
messages=messages,
stream=True
)
for chunk in response:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
Image Generation
Create stunning images from text prompts using DALL-E 3 and our custom diffusion models.
Basic Image Generation
response = client.images.generate(
model="dall-e-3",
prompt="A futuristic cyberpunk city at night with neon lights reflecting on wet streets",
n=1,
size="1024x1024"
)
image_url = response.data[0].url
Be specific about style, mood, lighting, and composition. Include details like "photorealistic", "oil painting", or "digital art" to guide the style.
Best Practices
Security
Never expose your API key in client-side code. Always make API calls from your backend server.
Cost Optimization
- Use shorter prompts when possible
- Implement caching for repeated queries
- Choose appropriate model sizes for your use case
- Monitor usage with our dashboard analytics
Performance
- Use streaming for better perceived latency
- Implement request queuing to handle bursts
- Consider using embeddings for similarity search instead of full prompts
- Use webhooks for async operations