Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Interactive API Playground

DELEGATE-GEMINI3: Developer Experience Enhancement

Version: 1.0
Last Updated: 2026-12-28
Target: Developer Documentation


Overview

The Interactive API Playground provides a hands-on way to explore ReasonKit’s API without installing anything. Try endpoints, see responses, and understand the API structure in real-time.

Access: ReasonKit.sh/docs/api/playground


Features

1. Live API Testing

  • No Installation Required: Test API endpoints directly in your browser
  • Real Responses: Connect to actual ReasonKit API (sandbox mode)
  • Multiple Endpoints: Test all available API endpoints
  • Request/Response View: See full request and response details

2. Code Generation

  • SDK Code: Generate code for Python, Rust, JavaScript, cURL
  • Copy-Paste Ready: Generated code is production-ready
  • Multiple Languages: Support for all SDK languages

3. Interactive Examples

  • Pre-Built Examples: Common use cases ready to test
  • Customizable: Modify examples to fit your needs
  • Save & Share: Save your examples for later

Playground Interface

Request Builder

Endpoint Selector:

[Dropdown: Select Endpoint]
├── POST /api/v1/think
├── POST /api/v1/tools/:tool
├── GET /api/v1/profiles
├── GET /api/v1/health
└── POST /api/v1/stream

Request Body Editor:

{
  "question": "Should I take this job offer?",
  "profile": "balanced",
  "options": {
    "format": "json",
    "include_metadata": true
  }
}

Headers:

Authorization: Bearer rk_test_xxxxxxxx
Content-Type: application/json

Response Viewer

Response Display:

  • Formatted JSON with syntax highlighting
  • Expandable/collapsible sections
  • Response time display
  • Token usage metrics
  • Error handling display

Example Workflows

Example 1: Basic Reasoning Query

Endpoint: POST /api/v1/think

Request:

{
  "question": "Should I invest in this startup?",
  "profile": "balanced"
}

Response Preview:

{
  "success": true,
  "data": {
    "question": "Should I invest in this startup?",
    "profile": "balanced",
    "results": {
      "gigathink": {
        "perspectives": [
          "Financial: ROI potential, risk assessment",
          "Market: Competitive landscape, timing",
          "Team: Founder experience, execution capability"
        ]
      },
      "laserlogic": {
        "flaws": [],
        "valid_arguments": 8
      },
      "bedrock": {
        "core_question": "What's the actual risk/reward ratio?",
        "first_principles": [
          "Investment amount vs. potential return",
          "Risk tolerance vs. opportunity cost"
        ]
      },
      "proofguard": {
        "verified": [
          "Market size claim: Verified via industry reports",
          "Team experience: Verified via LinkedIn"
        ],
        "unverified": ["Revenue projections: No historical data"]
      },
      "brutalhonesty": {
        "uncomfortable_truths": [
          "90% of startups fail - are you prepared to lose this investment?",
          "You're betting on the team, not just the idea"
        ]
      }
    },
    "synthesis": "Investment decision requires careful risk assessment...",
    "metadata": {
      "execution_time_ms": 12500,
      "tokens_used": 4892,
      "confidence": 0.78
    }
  }
}

Generated Code (Python):

import requests

url = "https://api.reasonkit.sh/v1/think"
headers = {
    "Authorization": "Bearer rk_test_xxxxxxxx",
    "Content-Type": "application/json"
}
data = {
    "question": "Should I invest in this startup?",
    "profile": "balanced"
}

response = requests.post(url, json=data, headers=headers)
result = response.json()
print(result)

Example 2: Single ThinkTool

Endpoint: POST /api/v1/tools/brutalhonesty

Request:

{
  "input": "I'm going to start a YouTube channel",
  "options": {
    "severity": "high"
  }
}

Response Preview:

{
  "success": true,
  "data": {
    "tool": "brutalhonesty",
    "input": "I'm going to start a YouTube channel",
    "uncomfortable_truths": [
      "99% of YouTube channels never reach 1,000 subscribers",
      "You'll need 100+ videos before seeing meaningful growth",
      "Monetization requires 1,000 subscribers + 4,000 watch hours"
    ],
    "questions": [
      "Why YouTube? (Newsletter/podcast may be easier)",
      "Is this for money or creative expression?",
      "Do you have 6+ months of content planned?"
    ],
    "conditional_advice": [
      "IF YOU STILL WANT TO DO IT:",
      "• Make 10 videos before 'launching'",
      "• Treat it as hobby, not business, until proven"
    ]
  }
}

Example 3: Streaming Response

Endpoint: POST /api/v1/stream

Request:

{
  "question": "Should we migrate to microservices?",
  "profile": "deep",
  "stream": true
}

Response (SSE Stream):

event: step
data: {"step": 1, "tool": "gigathink", "status": "running"}

event: step
data: {"step": 1, "tool": "gigathink", "status": "complete", "result": {...}}

event: step
data: {"step": 2, "tool": "laserlogic", "status": "running"}

...

Authentication

Test Mode (Playground)

The playground uses test API keys that don’t require billing:

Authorization: Bearer rk_test_demo_xxxxxxxx

Limitations:

  • 10 requests per hour
  • Responses may be cached
  • No production data

Production Mode

For production use, get your API key from:

Authorization: Bearer rk_live_xxxxxxxxxxxxxxxx

Code Generation

Supported Languages

Python:

import requests

url = "https://api.reasonkit.sh/v1/think"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "question": "Your question here",
    "profile": "balanced"
}

response = requests.post(url, json=data, headers=headers)
result = response.json()

Rust:

#![allow(unused)]
fn main() {
use reqwest;
use serde_json::json;

let client = reqwest::Client::new();
let response = client
    .post("https://api.reasonkit.sh/v1/think")
    .header("Authorization", "Bearer YOUR_API_KEY")
    .json(&json!({
        "question": "Your question here",
        "profile": "balanced"
    }))
    .send()
    .await?;

let result: serde_json::Value = response.json().await?;
}

JavaScript/TypeScript:

const response = await fetch("https://api.reasonkit.sh/v1/think", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    question: "Your question here",
    profile: "balanced",
  }),
});

const result = await response.json();

cURL:

curl -X POST https://api.reasonkit.sh/v1/think \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "question": "Your question here",
    "profile": "balanced"
  }'

Error Handling

Common Errors

401 Unauthorized:

{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key",
    "details": "Please check your Authorization header"
  }
}

400 Bad Request:

{
  "error": {
    "code": "invalid_request",
    "message": "Invalid request parameters",
    "details": {
      "field": "profile",
      "issue": "Invalid profile. Must be one of: quick, balanced, deep, paranoid"
    }
  }
}

429 Rate Limit:

{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Rate limit exceeded",
    "details": {
      "limit": 100,
      "remaining": 0,
      "reset_at": "2026-12-28T23:00:00Z"
    }
  }
}

Best Practices

1. Use Appropriate Profiles

  • Quick: User-facing chat, low-stakes decisions
  • Balanced: Standard analysis (default)
  • Deep: Thorough analysis, high-stakes decisions
  • Paranoid: Critical decisions, maximum verification

2. Handle Errors Gracefully

try:
    response = requests.post(url, json=data, headers=headers)
    response.raise_for_status()
    result = response.json()
except requests.exceptions.HTTPError as e:
    if e.response.status_code == 429:
        # Handle rate limit
        retry_after = e.response.headers.get('Retry-After')
        time.sleep(int(retry_after))
    else:
        # Handle other errors
        error_data = e.response.json()
        print(f"Error: {error_data['error']['message']}")

3. Use Streaming for Long Queries

import requests

url = "https://api.reasonkit.sh/v1/stream"
response = requests.post(url, json=data, headers=headers, stream=True)

for line in response.iter_lines():
    if line:
        event_data = json.loads(line.decode('utf-8'))
        print(f"Step {event_data['step']}: {event_data['status']}")

4. Monitor Token Usage

result = response.json()
metadata = result['data']['metadata']
print(f"Tokens used: {metadata['tokens_used']}")
print(f"Estimated cost: ${metadata['estimated_cost']}")

Integration Examples

Example: Slack Bot Integration

from flask import Flask, request
import requests

app = Flask(__name__)

@app.route('/slack/reason', methods=['POST'])
def slack_reason():
    question = request.form.get('text')

    # Call ReasonKit API
    response = requests.post(
        'https://api.reasonkit.sh/v1/think',
        headers={'Authorization': f'Bearer {API_KEY}'},
        json={'question': question, 'profile': 'quick'}
    )

    result = response.json()
    synthesis = result['data']['synthesis']

    return {
        'response_type': 'in_channel',
        'text': f'ReasonKit Analysis:\n{synthesis}'
    }

Example: CI/CD Integration

# .github/workflows/reason-check.yml
name: Reason Check

on:
  pull_request:
    types: [opened, synchronize]

jobs:
  reason-check:
    runs-on: ubuntu-latest
    steps:
      - name: Analyze PR with ReasonKit
        run: |
          curl -X POST https://api.reasonkit.sh/v1/think \
            -H "Authorization: Bearer ${{ secrets.REASONKIT_API_KEY }}" \
            -H "Content-Type: application/json" \
            -d '{
              "question": "Should we merge this PR?",
              "profile": "balanced"
            }' > reason-result.json

      - name: Comment on PR
        uses: actions/github-script@v6
        with:
          script: |
            const result = require('./reason-result.json');
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: `ReasonKit Analysis:\n${result.data.synthesis}`
            });

Next Steps

  1. Try the playground: ReasonKit.sh/docs/api/playground
  2. Get your API key: ReasonKit.sh/dashboard
  3. Read the full API reference: ReasonKit.sh/docs/api
  4. Join our GitHub Discussions

Document Version: 1.0
Last Updated: 2026-12-28
Status: ✅ Production-Ready


“Designed, Not Dreamed. Turn Prompts into Protocols.”
https://reasonkit.sh