Skip to main content
POST
https://api.caistrolabs.com
/
v1
/
chat
/
completions
curl https://api.caistrolabs.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Nous-20B",
    "messages": [
      {"role": "system", "content": "You are a marketing strategist."},
      {"role": "user", "content": "How do I improve my ROAS on Meta?"}
    ],
    "temperature": 0.7,
    "max_tokens": 500
  }'
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "Nous-20B",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "To improve your ROAS on Meta, focus on these key areas:\n\n1. **Audience Refinement**: Use Advantage+ audiences but exclude past purchasers from prospecting campaigns.\n\n2. **Creative Testing**: Run 3-5 ad variations per ad set with different hooks in the first 3 seconds.\n\n3. **Budget Allocation**: Allocate 70% to proven winners and 30% to testing.\n\n4. **Conversion Optimization**: Ensure your pixel is firing correctly and optimize for the deepest funnel event you have sufficient volume for."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 42,
    "completion_tokens": 128,
    "total_tokens": 170
  }
}

Request

model
string
default:"Nous-20B"
The model to use for completion
messages
array
required
A list of messages comprising the conversation so far
temperature
number
default:"0.7"
Sampling temperature between 0 and 2
max_tokens
number
default:"512"
Maximum number of tokens to generate

Response

id
string
Unique identifier for this completion
object
string
The object type, always chat.completion
model
string
The model used for completion
choices
array
A list of chat completion choices
usage
object
Token usage statistics

Example

curl https://api.caistrolabs.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Nous-20B",
    "messages": [
      {"role": "system", "content": "You are a marketing strategist."},
      {"role": "user", "content": "How do I improve my ROAS on Meta?"}
    ],
    "temperature": 0.7,
    "max_tokens": 500
  }'
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "Nous-20B",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "To improve your ROAS on Meta, focus on these key areas:\n\n1. **Audience Refinement**: Use Advantage+ audiences but exclude past purchasers from prospecting campaigns.\n\n2. **Creative Testing**: Run 3-5 ad variations per ad set with different hooks in the first 3 seconds.\n\n3. **Budget Allocation**: Allocate 70% to proven winners and 30% to testing.\n\n4. **Conversion Optimization**: Ensure your pixel is firing correctly and optimize for the deepest funnel event you have sufficient volume for."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 42,
    "completion_tokens": 128,
    "total_tokens": 170
  }
}