AI
Pass

AI Sleep Coach Agent Skill — AI Pass API

Overview

AI Pass "AI Sleep Coach" skill (sleep-coach) analyzes a user's sleep patterns and provides evidence-based, personalized sleep coaching advice. The skill ingests sleep logs and pattern descriptions (sleep duration, awakenings, bedtime/wake time variability, naps, caffeine/alcohol/timing), then returns actionable recommendations, sleep-hygiene tips, and suggested bedtime routines tailored to the individual.

Use cases for AI agents:

  • Personalized sleep assessments for digital health assistants or wellness apps.
  • Integrating automated sleep-coaching into telehealth or behavioral health workflows.
  • Generating weekly sleep improvement plans and progress summaries from wearable/exported sleep data.
  • Triage guidance and sleep hygiene education for coaches, therapists, or fitness platforms (not a replacement for medical advice).

Skill purpose: Analyze user sleep patterns and generate evidence-based, personalized sleep coaching advice.

API base URL: https://aipass.one/apikey/v1
Developer dashboard: https://aipass.one/panel/developer.html

Skill File (YAML)

name: sleep-coach
description: Analyzes your sleep patterns and provides personalized sleep improvement advice
version: "1.0"
auth:
  type: bearer
  token_env: AIPASS_API_KEY
endpoints:
  - name: generate
    method: POST
    url: https://aipass.one/apikey/v1/chat/completions
    headers:
      Authorization: "Bearer $AIPASS_API_KEY"
      Content-Type: application/json

(ALWAYS use $AIPASS_API_KEY — never a real key)

Example Usage

Curl example

curl -X POST "https://aipass.one/apikey/v1/chat/completions" \
  -H "Authorization: Bearer $AIPASS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Client-Id: YOUR_CLIENT_ID" \
  -d '{
    "model": "aipass-gpt-4o",
    "messages": [
      {"role": "system", "content": "You are a sleep coach. Provide evidence-based, practical sleep improvement advice."},
      {"role": "user", "content": "Here is my sleep log for the past week: Mon 6.0h, Tue 5.5h, Wed 7.0h, Thu 4.5h (woke up 2 times), Fri 6.5h, Sat 8.5h, Sun 7.5h. Bedtime varies between 11pm and 2am. I drink coffee at 3pm most days."}
    ],
    "temperature": 0.2,
    "max_tokens": 600
  }'

Python example

import os
import requests

API_URL = "https://aipass.one/apikey/v1/chat/completions"
API_KEY = os.environ.get("AIPASS_API_KEY")  # ALWAYS use the environment variable
HEADERS = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json",
    "X-Client-Id": "YOUR_CLIENT_ID"
}

payload = {
    "model": "aipass-gpt-4o",
    "messages": [
        {"role": "system", "content": "You are a sleep coach. Give evidence-based, personalized advice and practical next steps."},
        {"role": "user", "content": (
            "Sleep log: Mon 6.0h, Tue 5.5h, Wed 7.0h, Thu 4.5h (2 awakenings), "
            "Fri 6.5h, Sat 8.5h, Sun 7.5h. Bedtime varies 11pm-2am. Coffee at 3pm daily. "
            "Goal: feel more rested and reduce mid-night awakenings."
        )}
    ],
    "temperature": 0.2,
    "max_tokens": 600
}

resp = requests.post(API_URL, headers=HEADERS, json=payload)
resp.raise_for_status()
result = resp.json()
# The model response will typically be in result["choices"][0]["message"]["content"]
print(result)

Notes:

  • Include "X-Client-Id: YOUR_CLIENT_ID" if you need to pass a client identifier.
  • Adjust model, temperature, and max_tokens to tune style and length of the coaching response.
  • Always sanitize and limit any PHI/personal data per your privacy policy and applicable regulations.

Available Models

Relevant AI Pass models you can use with this skill (choose based on quality/latency/cost):

  • aipass-gpt-4o — best overall quality for nuanced, evidence-based coaching and multi-step plans.
  • aipass-gpt-4-mini — lower-latency, cost-effective option for conversational coaching and summaries.
  • aipass-gpt-3.5-turbo — fast and economical for basic recommendations and short tips.
  • aipass-embed-1 — use for embedding sleep logs or user profiles to build personalized retrieval-augmented coaching (paired with a vector DB).

Get Your API Key

Get an API key from the developer dashboard: https://aipass.one/panel/developer.html → API Keys section.
Remember: NEVER commit or share real API keys in code repositories. Use $AIPASS_API_KEY in examples and store keys in secure environment variables for production.

Related Apps

Explore the app page: https://aipass.one/apps/sleep-coach

Important reminders

  • The AI Sleep Coach provides coaching and educational material, not medical diagnoses. Advise users to seek professional medical care for serious or persistent sleep disorders.
  • ALWAYS use $AIPASS_API_KEY (environment variable) and YOUR_CLIENT_ID placeholders in examples and configs — never embed real secrets.

Skill File

name: ai_pass_sleep_coach
title: AI Pass — Sleep Coach
version: 1.0
frameworks:
  - OpenClaw
  - generic
description: >
  Analyzes your sleep patterns and provides personalized sleep improvement advice.
  Use this skill to send sleep logs, symptoms, and questions to the AI Pass chat
  completions API and return actionable, evidence-based sleep coaching guidance.

auth:
  type: bearer
  env_var: AIPASS_API_KEY
  header_name: Authorization
  header_value_prefix: "Bearer "

api:
  base_url: https://aipass.one/apikey/v1
  timeout_seconds: 30

endpoints:
  - id: chat_completions
    name: Create Chat Completion
    description: Call AI Pass chat completions to generate personalized sleep-coach responses.
    method: POST
    path: /chat/completions
    headers:
      Content-Type: application/json
      Authorization: "Bearer ${AIPASS_API_KEY}"
    request_schema:
      type: object
      description: Request body follows an OpenAI-like chat completions schema.
      properties:
        model:
          type: string
          description: Model name to use (choose a model supported by AI Pass)
          default: gpt-4o-mini
        messages:
          type: array
          description: Array of message objects (role, content) in chat format.
          items:
            type: object
            properties:
              role:
                type: string
                enum: [system, user, assistant]
              content:
                type: string
        temperature:
          type: number
          minimum: 0
          maximum: 2
          default: 0.7
        max_tokens:
          type: integer
          default: 800
      required:
        - model
        - messages
    response_schema:
      type: object
      description: >
        The API returns a chat completion response. The assistant reply text is
        typically found at choices[0].message.content.
      properties:
        raw:
          type: object
          description: Full raw response from the AI Pass API.
        assistant_text:
          type: string
          description: Extracted assistant reply (choices[0].message.content)
          example: "Here are some personalized recommendations to improve your sleep..."
    error_handling:
      - status: 401
        message: "Invalid or missing API key. Ensure AIPASS_API_KEY is set."
      - status: 429
        message: "Rate limited. Consider backing off and retrying."
      - status: 500
        message: "Server error from AI Pass. Retry with exponential backoff."

examples:
  - name: sleep_log_analysis
    description: Send sleep diary and ask for tailored improvement plan
    request:
      model: gpt-4o-mini
      messages:
        - role: system
          content: >-
            You are a Sleep Coach AI. Analyze sleep logs, identify patterns, and provide
            concise, evidence-based, actionable advice including sleep hygiene,
            schedule changes, strategies for nighttime awakenings, and CBT-I techniques
            when appropriate.
        - role: user
          content: |
            I usually go to bed at 1:00 AM and wake at 7:00 AM (about 6 hours). I wake
            around 3:00 AM and have trouble falling back asleep. I drink coffee at 3 PM,
            use my phone in bed, and take a 30-minute nap most afternoons. I feel tired
            daytime and want to improve sleep. What should I change?
    expected_response:
      assistant_text: >-
        A personalized plan including: move caffeine earlier (before 2pm), establish a
        consistent wind-down routine removing screens 30–60 minutes before bed, adjust
        sleep window gradually to increase total sleep, strategies for brief awakenings
        (get out of bed if unable to fall back asleep within ~20 minutes), limit naps,
        improve sleep environment, and consider short-term sleep restriction or CBT-I
        if insomnia persists. Include measurable steps and timeline.

notes:
  - Ensure the environment variable AIPASS_API_KEY is set in the agent runtime.
  - This skill posts to /chat/completions and expects OpenAI-like chat messages.
  - Keep user messages concise and provide sleep logs, patterns, durations, and relevant behaviors for best results.
Download Skill File