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": "Hello! Can you help me write a professional email?" } ] }'
Copy
Hello! Here's a professional email greeting:Dear [Recipient's Name],I hope this email finds you well. I wanted to reach out regarding...
API Documentation
Chat API
Complete guide to the Chat API for conversational AI, content generation, and text completion
The Chat API provides access to powerful language models for conversational AI, content generation, and text completion tasks. Built for developers who need reliable, scalable AI solutions with streaming responses.
All responses are streamed in real-time, providing a better user experience for 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": "Hello! Can you help me write a professional email?" } ] }'
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 the capital of France?" }, { "role": "assistant", "content": "The capital of France is Paris." }, { "role": "user", "content": "What about its population?" } ] }'
Roughly 4 characters = 1 token for English text. The API uses the same tokenization as the underlying model for precise counting.
Example calculation:
Copy
Input: "Hello, how are you today?" (26 characters) ≈ 7 tokensOutput: "I'm doing well, thank you for asking!" (36 characters) ≈ 9 tokensTotal: ~16 tokens
{ "messages": [ { "role": "system", "content": "You are a creative content writer specializing in blog posts." }, { "role": "user", "content": "Write an introduction for a blog post about sustainable living tips." } ]}
Email Writing
Copy
{ "messages": [ { "role": "system", "content": "You are a professional email writer. Write clear, polite, and effective emails." }, { "role": "user", "content": "Write a follow-up email for a job interview." } ]}
Marketing Copy
Copy
{ "messages": [ { "role": "system", "content": "You are an expert copywriter. Write compelling marketing copy that drives action." }, { "role": "user", "content": "Create homepage copy for a productivity app targeting busy professionals." } ]}
{ "messages": [ { "role": "system", "content": "You are a helpful programming assistant. Provide clean, well-documented code." }, { "role": "user", "content": "Write a Python function to calculate the fibonacci sequence." } ]}
Code Review
Copy
{ "messages": [ { "role": "system", "content": "You are a senior software engineer. Provide constructive code reviews." }, { "role": "user", "content": "Review this JavaScript function and suggest improvements: [code here]" } ]}
Debugging Help
Copy
{ "messages": [ { "role": "system", "content": "You are a debugging expert. Help identify and fix code issues." }, { "role": "user", "content": "I'm getting a TypeError in this Python code. Can you help me fix it?" } ]}