# Aitherium Integration: OpenClaw Skill File

Use this template to create an OpenClaw skill that delegates complex tasks to Aitherium agents.

## Prerequisites

1. An Aitherium API key (register at `POST https://gateway.aitherium.com/v1/billing/register`)
2. OpenClaw installed and configured

## Skill File

Save this as `aither-delegate.md` in your OpenClaw skills directory:

```markdown
---
name: aither-delegate
description: Delegate complex tasks to Aitherium's 43 specialized AI agents
version: 1.0.0
---

# Aitherium Delegation Skill

You can delegate tasks to Aitherium when they require:
- Deep multi-step reasoning
- Code review or security analysis
- Persistent memory across sessions
- Multi-agent orchestration
- Research with knowledge graph queries

## Configuration

Set these environment variables:
- AITHER_API_KEY: Your Aitherium API key (aither_sk_live_...)
- AITHER_BASE_URL: https://mcp.aitherium.com/v1

## How to Delegate

Make an HTTP POST to the chat completions endpoint:

Endpoint: ${AITHER_BASE_URL}/chat/completions
Headers:
  Authorization: Bearer ${AITHER_API_KEY}
  Content-Type: application/json

Body:
{
  "model": "aither-orchestrator",
  "messages": [
    {"role": "system", "content": "You are a specialized agent. Complete the task thoroughly."},
    {"role": "user", "content": "THE_TASK_HERE"}
  ],
  "max_tokens": 4096,
  "temperature": 0.3
}

## Effort Mapping

Map your task complexity to an Aitherium model:

| Task Type | Model | Cost |
|-----------|-------|------|
| Quick question, summary | aither-small | 1 tok/1K |
| Code review, analysis, planning | aither-orchestrator | 3 tok/1K |
| Deep reasoning, complex debugging | aither-reasoning | 10 tok/1K |
| Image understanding | aither-vision | 8 tok/1K |
| Code generation | aither-coding | 5 tok/1K |

## Agent Delegation Examples

### Delegate a code review to Hydra
{
  "model": "aither-orchestrator",
  "messages": [
    {"role": "system", "content": "You are Hydra, the code review specialist. Review thoroughly for bugs, security issues, and performance problems."},
    {"role": "user", "content": "Review this code:\n\n```python\n[paste code here]\n```"}
  ]
}

### Delegate research to Lyra
{
  "model": "aither-reasoning",
  "messages": [
    {"role": "system", "content": "You are Lyra, the creative research agent. Explore this topic deeply and synthesize findings."},
    {"role": "user", "content": "Research: [topic]"}
  ]
}

### Delegate security analysis to Athena
{
  "model": "aither-orchestrator",
  "messages": [
    {"role": "system", "content": "You are Athena, the security oracle. Perform a thorough security analysis."},
    {"role": "user", "content": "Analyze the security of:\n\n[paste artifact here]"}
  ]
}

## Cost Tracking

Check your remaining balance:
GET https://gateway.aitherium.com/v1/billing/balance
Headers: Authorization: Bearer ${AITHER_API_KEY}

## Error Handling

If the API returns an error:
- 401: API key is invalid or expired. Refresh at POST /v1/billing/keys/refresh
- 429: Rate limited. Wait and retry.
- 402: Insufficient balance. Top up at the billing portal.
- 5xx: Service issue. Retry after 5 seconds.
```

## Usage

Once the skill file is saved, tell OpenClaw:

> "Use the aither-delegate skill to review this code for security issues"

OpenClaw will:
1. Read the skill file for instructions
2. Format the HTTP request with your code
3. Send it to Aitherium's API
4. Return the analysis results
