curl -X POST https://suite.sundaypyjamas.com/api/v1/chat \ -H "Authorization: Bearer spj_ai_your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "role": "user", "content": "Write a professional email greeting." } ] }'
Hello! Here's a professional email greeting for you:Dear [Recipient's Name],I hope this email finds you well. I wanted to reach out to discuss [purpose of email].Best regards,[Your Name]
Chat
POST /chat
Send messages to AI models and receive streaming text responses for conversational AI and content generation
POST
/
api
/
v1
/
chat
curl -X POST https://suite.sundaypyjamas.com/api/v1/chat \ -H "Authorization: Bearer spj_ai_your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "role": "user", "content": "Write a professional email greeting." } ] }'
Hello! Here's a professional email greeting for you:Dear [Recipient's Name],I hope this email finds you well. I wanted to reach out to discuss [purpose of email].Best regards,[Your Name]
The POST /chat endpoint is the primary way to interact with SundayPyjamas AI models. It accepts a conversation history and returns an AI-generated response as a streaming text.
All responses are streamed in real-time for better user experience in conversational applications.
curl -X POST https://suite.sundaypyjamas.com/api/v1/chat \ -H "Authorization: Bearer spj_ai_your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "role": "user", "content": "Write a professional email greeting." } ] }'
Hello! Here's a professional email greeting for you:Dear [Recipient's Name],I hope this email finds you well. I wanted to reach out to discuss [purpose of email].Best regards,[Your Name]
curl -X POST https://suite.sundaypyjamas.com/api/v1/chat \ -H "Authorization: Bearer spj_ai_your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "role": "system", "content": "You are a technical writer who creates clear, concise documentation." }, { "role": "user", "content": "Explain what an API is in simple terms." } ] }'
An API (Application Programming Interface) is like a waiter in a restaurant:- You (the customer) make a request for food- The waiter takes your order to the kitchen- The kitchen prepares your meal - The waiter brings back your foodSimilarly, an API:- Receives requests from applications- Processes those requests- Returns the requested data or performs actions- Enables different software systems to communicateAPIs make it possible for apps on your phone to get weather data, social media feeds, or payment processing without having to build those services themselves.
curl -X POST https://suite.sundaypyjamas.com/api/v1/chat \ -H "Authorization: Bearer spj_ai_your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "role": "user", "content": "What is machine learning?" }, { "role": "assistant", "content": "Machine learning is a subset of artificial intelligence (AI) that enables computers to learn and improve from experience without being explicitly programmed for every task." }, { "role": "user", "content": "Can you give me a simple example?" } ] }'
Sure! Here's a simple example:**Email Spam Detection**1. **Training**: You show the computer thousands of emails labeled as "spam" or "not spam"2. **Learning**: The computer finds patterns - spam emails often have words like "FREE!", "URGENT!", multiple exclamation marks, or suspicious links3. **Prediction**: When a new email arrives, the computer uses these learned patterns to predict if it's spam or notThe computer "learned" to recognize spam without being programmed with explicit rules like "if email contains 'FREE!' then it's spam." Instead, it discovered these patterns by analyzing examples.Other everyday examples:- Netflix recommending movies based on what you've watched- Your phone's autocorrect learning your typing patterns- Banks detecting fraudulent transactions